Home | History | Annotate | Line # | Download | only in dist
      1      1.1    kardel #! /bin/sh
      2      1.1    kardel 
      3      1.1    kardel #  This "bootstrap" script performs various pre-autoreconf actions
      4      1.1    kardel #  that are required after pulling fresh sources from the repository.
      5      1.1    kardel #
      6  1.1.1.2    kardel #  --force is supported and will be passed to autoreconf
      7  1.1.1.2    kardel #
      8      1.1    kardel #  NOTE:  THE NTP VERSION NUMBER COMES FROM packageinfo.sh
      9      1.1    kardel #
     10      1.1    kardel #  all other instances of it anywhere in the source base have propagated
     11      1.1    kardel #  from this one source.
     12      1.1    kardel #
     13      1.1    kardel #  To use the raw sources from the repository, you must have the following
     14      1.1    kardel #  tools available to you:
     15      1.1    kardel #
     16      1.1    kardel #  1.  Autoconf and Automake.
     17      1.1    kardel #
     18      1.1    kardel #  2.  lynx.  This is used to extract the COPYRIGHT file extracted from
     19      1.1    kardel #      the html documentation.
     20      1.1    kardel #
     21      1.1    kardel #  *** The following are no longer needed for simple builds from the repo
     22      1.1    kardel #  3.  AutoGen.  The repository does *not* contain the files generated from
     23      1.1    kardel #      the option definition files and it does not contain the libopts
     24      1.1    kardel #      tear-off/redistributable library.
     25      1.1    kardel #
     26      1.1    kardel #      Note: AutoGen needs GNU Guile.
     27      1.1    kardel #
     28      1.1    kardel #  4.  gunzip.  The tear-off library is a gzipped tarball.
     29      1.1    kardel 
     30      1.1    kardel set -e
     31      1.1    kardel 
     32  1.1.1.3  christos (cd sntp  && ../scripts/build/genver) || { 
     33  1.1.1.3  christos     echo scripts/build/genver failed ; exit 1; }
     34      1.1    kardel 
     35      1.1    kardel # autoreconf says:
     36      1.1    kardel # The environment variables AUTOCONF, AUTOHEADER, AUTOMAKE, ACLOCAL,
     37      1.1    kardel # AUTOPOINT, LIBTOOLIZE, M4 are honored.
     38      1.1    kardel 
     39      1.1    kardel AUTORECONF=${AUTORECONF:-autoreconf}
     40      1.1    kardel 
     41  1.1.1.3  christos # case `hostname` in
     42  1.1.1.3  christos #  pogo.udel.edu)
     43  1.1.1.3  christos #     if fgrep -q 4.2.4 sntp/m4/version.m4; then
     44  1.1.1.3  christos # 	AUTOCONF=autoconf-2.59
     45  1.1.1.3  christos # 	AUTOHEADER=autoheader-2.59
     46  1.1.1.3  christos # 	AUTOMAKE=automake-1.9
     47  1.1.1.3  christos # 	ACLOCAL=aclocal-1.9
     48  1.1.1.3  christos # 	export AUTOCONF AUTOHEADER AUTOMAKE ACLOCAL
     49  1.1.1.3  christos #     fi
     50  1.1.1.3  christos #     ;;
     51  1.1.1.3  christos # esac
     52      1.1    kardel 
     53  1.1.1.5  christos ## Old way
     54      1.1    kardel # 20060629: HMS: Let's try checking in libopts and the autogen-generated files
     55      1.1    kardel ## The copy for ntp...
     56      1.1    kardel #rm -rf libopts*
     57      1.1    kardel #gunzip -c $(autoopts-config --libsrc) | (
     58      1.1    kardel #  tar -xvf -
     59      1.1    kardel #  mv libopts-*.*.* libopts )
     60      1.1    kardel 
     61      1.1    kardel ## The copy for sntp...
     62      1.1    kardel #rm -rf sntp/libopts*
     63      1.1    kardel #gunzip -c $(autoopts-config --libsrc) | (
     64      1.1    kardel #  cd sntp
     65      1.1    kardel #  tar -xvf -
     66      1.1    kardel #  mv libopts-*.*.* libopts )
     67      1.1    kardel 
     68  1.1.1.5  christos ## EOOld way
     69      1.1    kardel 
     70  1.1.1.5  christos ## Unity test runners
     71  1.1.1.5  christos # the ruby generator must be older than the test files.
     72  1.1.1.5  christos # the test files must be older than the runner files.
     73  1.1.1.5  christos 
     74  1.1.1.5  christos runner_files=`find [B-Za-z]* -type f -name 'run-*' -print | fgrep -v /SCCS/`
     75  1.1.1.5  christos l=
     76  1.1.1.5  christos lt=
     77  1.1.1.5  christos lr=
     78  1.1.1.5  christos for f in ${runner_files}
     79  1.1.1.5  christos do
     80  1.1.1.5  christos     fb=`echo $f | sed -e 's/run-//'`
     81  1.1.1.5  christos     lt="$lt $fb"
     82  1.1.1.5  christos     lr="$lr $f"		# Yes, lr and runner_files are eventually the same
     83  1.1.1.5  christos done
     84  1.1.1.5  christos touch $lt
     85  1.1.1.5  christos echo "Touching <$lt>"
     86  1.1.1.5  christos sleep 1
     87  1.1.1.5  christos touch $lr
     88  1.1.1.5  christos echo "Touching <$lr>"
     89      1.1    kardel 
     90  1.1.1.5  christos ## EOUnity test runners
     91      1.1    kardel 
     92  1.1.1.5  christos ## AutoGen stuff
     93      1.1    kardel 
     94  1.1.1.5  christos def_files=`find [B-Za-z]* -type f -name '*.def' -print | fgrep -v /SCCS/`
     95  1.1.1.5  christos prog_opt_files=`grep -l '^prog.name' $def_files`
     96      1.1    kardel 
     97      1.1    kardel # touch the stuff generated by the opt files
     98      1.1    kardel 
     99  1.1.1.4  christos l=
    100  1.1.1.4  christos lh=
    101  1.1.1.4  christos li=
    102      1.1    kardel for f in ${prog_opt_files}
    103      1.1    kardel do
    104  1.1.1.3  christos     f=`echo $f | sed -e 's/-opts.def//' -e 's/.def//'`
    105  1.1.1.3  christos     dfi=`dirname $f`
    106  1.1.1.3  christos     dfi=`echo $dfi | sed -e 's:$:/invoke-*:'`
    107  1.1.1.3  christos     for i in `ls -1 $f* $dfi`
    108      1.1    kardel     do
    109      1.1    kardel 	case "$i" in
    110  1.1.1.4  christos 	 *invoke-*)
    111  1.1.1.4  christos 	    li="$li $i"
    112  1.1.1.4  christos 	    ;;
    113  1.1.1.4  christos 	 *.c|*.h|*.[1-9]*man|*.[1-9]*mdoc|*.man.in|*.mdoc.in|*-opts|*.texi|*.menu)
    114      1.1    kardel 	    l="$l $i"
    115      1.1    kardel 	    ;;
    116  1.1.1.2    kardel 	 *.html)
    117  1.1.1.2    kardel 	    lh="$lh $i"
    118  1.1.1.2    kardel 	    ;;
    119      1.1    kardel 	esac
    120      1.1    kardel     done
    121      1.1    kardel done
    122  1.1.1.4  christos case "$l" in
    123  1.1.1.4  christos  '') ;;
    124  1.1.1.4  christos  *) touch $l
    125  1.1.1.4  christos     echo "Touching <$l>"
    126  1.1.1.4  christos     sleep 1
    127  1.1.1.4  christos     ;;
    128  1.1.1.4  christos esac
    129  1.1.1.4  christos case "$li" in
    130  1.1.1.4  christos  '') ;;
    131  1.1.1.4  christos  *) touch $li
    132  1.1.1.4  christos     echo "Touching <$li>"
    133  1.1.1.4  christos     sleep 1
    134  1.1.1.4  christos     ;;
    135  1.1.1.4  christos esac
    136  1.1.1.4  christos case "$lh" in
    137  1.1.1.4  christos  '') ;;
    138  1.1.1.4  christos  *) touch $lh
    139  1.1.1.4  christos     echo "Touching <$lh>"
    140  1.1.1.4  christos     ;;
    141  1.1.1.4  christos esac
    142      1.1    kardel 
    143      1.1    kardel ## EOAutoGen stuff
    144      1.1    kardel 
    145  1.1.1.5  christos ## Yacc/bison files
    146  1.1.1.5  christos 
    147  1.1.1.2    kardel # Yacc/bison files ntp_parser.[ch] so we don't require the tool if
    148  1.1.1.2    kardel # ntp_parser.y hasn't been updated.  At the same time, keyword-gen-utd
    149  1.1.1.2    kardel # and ntp_keyword.h which are derived from ntp_parser.h and
    150  1.1.1.2    kardel # keyword-gen.c.
    151      1.1    kardel 
    152  1.1.1.2    kardel touch ntpd/ntp_parser.[ch] ntpd/keyword-gen-utd ntpd/ntp_keyword.h
    153      1.1    kardel 
    154  1.1.1.5  christos ## EOYacc/bison files
    155  1.1.1.5  christos 
    156      1.1    kardel cp bincheck.mf sntp/
    157      1.1    kardel cp depsver.mf sntp/
    158      1.1    kardel 
    159  1.1.1.3  christos ${AUTORECONF} -i -v "$@"
    160      1.1    kardel 
    161  1.1.1.4  christos # Because some systems do not support 'test a -nt b'
    162  1.1.1.4  christos case `ls -1tr config.h.in aclocal.m4 | tail -1` in
    163  1.1.1.4  christos  aclocal.m4) touch config.h.in ;;
    164  1.1.1.4  christos esac
    165  1.1.1.4  christos case `ls -1tr sntp/config.h.in sntp/aclocal.m4 | tail -1` in
    166  1.1.1.4  christos  sntp/aclocal.m4) touch sntp/config.h.in ;;
    167  1.1.1.4  christos esac
    168  1.1.1.4  christos case `ls -1tr sntp/libevent/config.h.in sntp/libevent/aclocal.m4 | tail -1` in
    169  1.1.1.4  christos  sntp/libevent/aclocal.m4) touch sntp/libevent/config.h.in ;;
    170  1.1.1.4  christos esac
    171  1.1.1.4  christos 
    172  1.1.1.3  christos # DH: 20110118: Due to our workaround for the AM_COND_IF bug that was
    173  1.1.1.3  christos # triggering the buggy recursive autoreconf, we can once again use a
    174  1.1.1.3  christos # single autoreconf invocation.  See
    175  1.1.1.3  christos # http://debbugs.gnu.org/cgi/bugreport.cgi?bug=7860
    176  1.1.1.2    kardel # DH: 20101120: We are back to a single copy of libopts, and
    177  1.1.1.2    kardel # once again it seems we need to run autoreconf in sntp after
    178  1.1.1.2    kardel # the top-level run to get a correct sntp/libopts/Makefile.in.
    179  1.1.1.2    kardel # To reduce redundancy, the top-level autoreconf uses --no-recursive.
    180  1.1.1.2    kardel #
    181      1.1    kardel # HMS: 20060618: Now that we use separate copies of libopts
    182      1.1    kardel # we should only need the previous line.
    183      1.1    kardel #
    184      1.1    kardel ## HMS: 20060615: the next line seems to be needed to make sure
    185      1.1    kardel ## we get the correct srcdir path in sntp/libopts/Makefile.in
    186      1.1    kardel #rm -rf sntp/autom4te.cache
    187      1.1    kardel #
    188  1.1.1.3  christos # (cd sntp && ${AUTORECONF} -i -v "$@")
    189