Fixup fromcvs/togit conversion
[pkgsrcv2.git] / sysutils / xapply / files / makeme
1 #!/bin/sh
2 # $Id: makeme,v 1.2 2005/04/06 15:48:17 epg Exp $
3 # This hack won't work for every trick you can play with /usr/msrc.
4 # If the Distfile sends different files to the various platforms, or
5 # builds a file on the meta source machine with a special tool or
6 # database you are toast.  {N.B. mk's lib, rdist, mkcmd have issues.}
7
8 # if we have a local.defs read it for umask, PATH, and such.
9 [ -f /usr/local/lib/distrib/local.defs ] && . /usr/local/lib/distrib/local.defs
10
11 # It does work for the tools that build the meta source system itself,
12 # of course (mkcmd, distrib, rcsvg, and the like).  You can use it to
13 # process the Make.host file through m4 for localhost.
14 #
15 # Check for the mandatory Make.host file...
16 if [ ! -f Make.host ] ; then
17         echo 1>&2 "$0: not in a meta source directory, no Make.host"
18         exit 126
19 fi
20
21 # distrib: default column headers: %HOST SHORTHOST HOSTTYPE HOSTOS HASSRC
22 if [ -z "$HOST" ] ; then
23         HOST=`uname -n || hostname`
24 fi
25 if [ -z "$SHORTHOST" ] ; then
26         SHORTHOST=`expr $HOST : '\([^.]*\)\..*' \| $HOST`
27 fi
28 if [ -z "$HOSTTYPE" ] ; then
29         case `uname -sr || uname -a` in
30         HP-UX*7.*)
31                 HOSTTYPE="HPUX9" ;;
32         HP-UX*8.*)
33                 HOSTTYPE="HPUX9" ;;
34         HP-UX*9.*)
35                 HOSTTYPE="HPUX9" ;;
36         HP-UX*10.*)
37                 HOSTTYPE="HPUX10" ;;
38         *NEXT*)
39                 HOSTTYPE="NEXT2" ;;
40         *Solaris*|*[Ss]un[Oo][Ss]*)
41                 HOSTTYPE="SUN5" ;;
42         Darwin*|*BSD*|DragonFly*)
43                 HOSTTYPE="FREEBSD" ;;
44         BSDI*)
45                 HOSTTYPE="BSDI" ;;
46         Linux*|LINUX*)
47                 HOSTTYPE="LINUX" ;;
48         *)
49                 echo 1>&2 "$0: set HOSTTYPE and export it by hand."
50                 exit 2 ;;
51         esac
52 fi
53 if [ -z "$HOSTOS" ] ; then
54         HOSTOS=`uname -r | sed -e 's/^[A-Za-z .]*//' -e 's/-[A-Za-z]*//' -e 's/\.\([0-9][0-9]\)/\1/g' -e 'y/./0/' -e 's/^0*//'`
55 fi
56
57 # Now fake the Distrib @file@ expansion and hope the rest works out.
58 # Some make's mistakenly think you must call fork() to get a SIG-child...
59 # so they barf out errors for this -- they should learn UNIX.
60 m4 - Make.host <<! |make -f - ${1:+"$@"}
61 define(\`HOST',\`$HOST')dnl
62 define(\`SHORTHOST',\`$SHORTHOST')dnl
63 define(\`HOSTTYPE',\`$HOSTTYPE')dnl
64 define(\`MYTYPE',\`$HOSTTYPE')dnl
65 define(\`HOSTOS',\`$HOSTOS')dnl
66 define(\`MYOS',\`$HOSTOS')dnl
67 define(\`HASSRC',\`yes')dnl
68 define(\`MSRC_BOOT',\`${MSRC_BOOT-yes}')dnl
69 !