| 1 | #!/bin/sh |
| 2 | # Either use autoconf and autoheader to create configure.sh and config.h.in |
| 3 | # or (optionally) fetch the latest development versions of generated files. |
| 4 | # |
| 5 | # Specify one action or more than one to provide a fall-back: |
| 6 | # |
| 7 | # build build the config files [the default w/no arg] |
| 8 | # fetch fetch the latest dev autoconfig files |
| 9 | # fetchgen fetch all the latest dev generated files (including manpages) |
| 10 | # fetchSRC fetch the latest dev source files [NON-GENERATED FILES] |
| 11 | # |
| 12 | # The script stops after the first successful action. |
| 13 | |
| 14 | dir=`dirname $0` |
| 15 | if test x"$dir" = x; then |
| 16 | dir=. |
| 17 | fi |
| 18 | |
| 19 | if test "$dir" = '.'; then |
| 20 | branch=`packaging/prep-auto-dir` || exit 1 |
| 21 | if test x"$branch" != x; then |
| 22 | cd build || exit 1 |
| 23 | dir=.. |
| 24 | fi |
| 25 | fi |
| 26 | |
| 27 | if test "$dir" != '.'; then |
| 28 | for lnk in configure.ac m4; do |
| 29 | if test ! -h $lnk; then |
| 30 | rm -f $lnk # Just in case |
| 31 | ln -s "$dir/$lnk" $lnk |
| 32 | fi |
| 33 | done |
| 34 | for fn in configure.sh config.h.in aclocal.m4; do |
| 35 | test ! -f $fn && test -f "$dir/$fn" && cp -p "$dir/$fn" $fn |
| 36 | done |
| 37 | fi |
| 38 | |
| 39 | if test $# = 0; then |
| 40 | set -- build |
| 41 | fi |
| 42 | |
| 43 | for action in "${@}"; do |
| 44 | case "$action" in |
| 45 | build|make) |
| 46 | make -f "$dir/prepare-source.mak" |
| 47 | ;; |
| 48 | fetch|fetchgen) |
| 49 | if test "$action" = fetchgen; then |
| 50 | match='*' |
| 51 | else |
| 52 | match='[ca]*' |
| 53 | fi |
| 54 | $dir/rsync-ssl -iipc --no-motd "rsync://download.samba.org/rsyncftp/generated-files/$match" ./ |
| 55 | test $? != 0 && continue |
| 56 | sleep 1 # The following files need to be newer than aclocal.m4 |
| 57 | touch configure.sh config.h.in |
| 58 | ;; |
| 59 | fetchSRC) |
| 60 | ./rsync-ssl -iipr --no-motd --exclude=/.git/ rsync://download.samba.org/ftp/pub/unpacked/rsync/ . |
| 61 | ;; |
| 62 | *) |
| 63 | echo "Unknown action: $action" |
| 64 | exit 1 |
| 65 | ;; |
| 66 | esac |
| 67 | if test $? = 0; then |
| 68 | exit |
| 69 | fi |
| 70 | done |
| 71 | |
| 72 | exit 1 |