1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106
|
#! /bin/sh
#
# another build script ($Id: build-script,v 1.5 1999/07/01 00:46:08 sas Exp $)
#
# you can put this in your crontab
# redirect STDOUT to /dev/null, error messages are on STDERR
# e.g.:
# 30 2 * * * (cd /home/user/php3 && ./build-script) >/dev/null
#
#
# $config_file should contain at least:
#
# #! /bin/sh
# ../configure "$@"
#
# note the ".." at the beginning.
# don't forget to chmod 755 it.
#
# you need some software in your path for this
# (autoconf, make, cc or gcc)
########################################################
# leave an option empty (""), if you want to disable it!
# path to Apache's apxs utility (Apache needs to be installed first)
apxs="/home/user/httpd/bin/apxs"
# path to an uninstalled Apache source tree
apache_src="/home/user/apache_1.3.6"
# your config script which performs basic configuration
config_file="mydo-conf"
# the email address error logs are sent to
# don't direct this to any public mailing list
mailto="foo@bar.baz"
# whether the script shall perform a CVS update
update_cvs=1
# want to run make test?
make_test=1
die ( ) {
echo $* 1>&2
exit 1
}
alarm ( ) {
file=$1
shift
msg="$*"
cat $file | mail -s "[AUTO BUILD] $msg" $mailto
}
try_compile ( ) {
name="$1"
shift
args="$*"
echo "Running $name with \"$args\""
path="comp-$name"
log="log-$name"
rm -rf $path
mkdir $path
( \
cd $path || die "cannot cd into $path" ; \
sh ../$config_file $* ; \
test -f Makefile || \
alarm ../$log "configure failed for $name with $args" ; \
test -f Makefile && make || \
alarm ../$log "build failed for $name with $args" ; \
) > $log 2>&1
}
try_make_test ( ) {
log=logtest
PHP="`pwd`/comp-cgi/php"
# not sure whether we need this:
export PHP
( \
(cd comp-cgi && make test) || \
alarm ../$log "make test failed" \
) > $log 2>&1
}
test -f configure.in || die "cannot find sources."
test -f "$config_file" || die "cannot find $config_file."
test -d CVS && test "$update_cvs" = "1" && \
( echo "updating CVS" ; cvs upd -d -P >/dev/null 2>&1)
autoheader && autoconf || die "autoconf failed"
test -n "$apxs" && \
try_compile apxs --with-apxs="$apxs"
test -n "$apache_src" && \
try_compile apache --with-apache="$apache_src"
test -n "$apache_src" && \
try_compile shared-apache --with-shared-apache="$apache_src"
try_compile cgi
# still broken
#test -n "$make_test" && test -f comp-cgi/php && \
# try_make_test
|