| 1 | #!/bin/shscip-shell filesystem . . `/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=`dirnamescip-shell system . . dirname. $0` |
| 15 | if testscip-shell system . . test. x"$dir" = x; then |
| 16 | dir=. |
| 17 | fi |
| 18 | |
| 19 | if testscip-shell system . . test. "$dir" = '.'; then |
| 20 | branch=`packaging/prep-auto-dir` || exit 1 |
| 21 | if testscip-shell system . . test. x"$branch" != x; then |
| 22 | cd build || exit 1 |
| 23 | dir=.. |
| 24 | fi |
| 25 | fi |
| 26 | |
| 27 | if testscip-shell system . . test. "$dir" != '.'; then |
| 28 | for lnk in configure.ac m4; do |
| 29 | if testscip-shell system . . test. ! -h $lnk; then |
| 30 | rmscip-shell system . . rm. -f $lnk # Just in case |
| 31 | lnscip-shell system . . ln. -s "$dir/$lnk" $lnk |
| 32 | fi |
| 33 | done |
| 34 | for fn in configure.sh config.h.in aclocal.m4; do |
| 35 | testscip-shell system . . test. ! -f $fn && testscip-shell system . . test. -f "$dir/$fn" && cpscip-shell system . . cp. -p "$dir/$fn" $fn |
| 36 | done |
| 37 | fi |
| 38 | |
| 39 | if testscip-shell system . . test. $# = 0; then |
| 40 | set -- build |
| 41 | fi |
| 42 | |
| 43 | for action in "${@}"; do |
| 44 | case "$action" in |
| 45 | build|make) |
| 46 | makescip-shell system . . make. -f "$dir/prepare-source.mak" |
| 47 | ;; |
| 48 | fetch|fetchgen) |
| 49 | if testscip-shell system . . 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 | testscip-shell system . . test. $? != 0 && continue |
| 56 | sleepscip-shell system . . sleep. 1 # The following files need to be newer than aclocal.m4 |
| 57 | touchscip-shell system . . 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 | echoscip-shell system . . echo. "Unknown action: $action" |
| 64 | exit 1 |
| 65 | ;; |
| 66 | esac |
| 67 | if testscip-shell system . . test. $? = 0; then |
| 68 | exit |
| 69 | fi |
| 70 | done |
| 71 | |
| 72 | exit 1 |