3 # It is used to compile on remote hosts
9 # Where to install the stuff into (REMOTE_PREFIX gets fixed by the makefile)
12 # Where extra libraries are installed (if any)
13 LD_LIBRARY_PATH="$PREFIX/lib"
15 # Extra environment to pass to configure
18 # Argument of configure
19 CONFIGURE_ARGS="--prefix=$PREFIX/@PACKAGE@"
29 # Magic to search a working shell (from autobook)
31 # Zsh is not Bourne compatible without the following:
32 if test -n "$ZSH_VERSION"; then
37 # Bash is not POSIX compliant without the following:
38 test -n "$BASH_VERSION" && set -o posix
40 SHELL="${SHELL-/bin/sh}"
41 if test x"$1" = x--re-executed; then
42 # Functional shell was found. Remove option and continue
44 elif "$SHELL" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
45 "$SHELL" -c 'export toto=tutu' 2>/dev/null ; then
46 # The current shell works already!
47 echo "Current shell ($SHELL) working"
49 # Try alternative shells that (sometimes) support functions
50 for cmd in bash sh ash bsh ksh zsh sh5
52 for dir in `echo $PATH | sed -e 's/:/ /g'` /bin /usr/bin
55 if (test -f "$shell" || test -f "$shell.exe") &&
56 "$shell" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
57 "$shell" -c 'export toto=tutu' 2>/dev/null
59 # Re-execute with discovered functional shell
60 echo "Reexecute $0 $@ with shell $shell"
61 SHELL="$shell" exec "$shell" "$0" --re-executed ${1+"$@"}
65 echo "Unable to locate a shell interpreter with function support and export syntax" >&2
74 # expend the path for solaris
75 PATH="$PATH:/usr/xpg4/bin"
80 echo CONFIG-LOG-DUMP-BEGIN
82 echo CONFIG-LOG-DUMP-END
89 cd $PREFIX/src || fail "Cannot cd to $PREFIX/src"
93 eval `echo $1` 2>&1 || fail "$2"
97 if echo $@ | grep clean >/dev/null ; then
98 for name in @PACKAGE@* ; do
99 if test "$name" != "@PACKAGE@-@VERSION@.tar.gz" ; then
100 echo "XXX Remove $name";
105 echo "XXX Untar @PACKAGE@-@VERSION@"
106 do_cmd "gunzip @PACKAGE@-@VERSION@.tar.gz" "Cannot gunzip"
107 do_cmd "tar xf @PACKAGE@-@VERSION@.tar" "Cannot untar"
110 if echo $@ | grep touch >/dev/null ; then
111 echo "XXX Touch everything within the tarball"
112 find @PACKAGE@-@VERSION@ -type f | while read f; do touch $f;done
115 cd @PACKAGE@-@VERSION@ || fail "Cannot cd to @PACKAGE@-@VERSION@"
117 if echo $@ | grep config >/dev/null ; then
118 do_cmd "env $CONFIGURE_ENV \
119 ./configure $CONFIGURE_ARGS" "Cannot configure"
122 if echo $@ | grep compile >/dev/null ; then
123 do_cmd "make $MAKE_ALL" "Cannot make"
126 if echo $@ | grep install >/dev/null ; then
127 do_cmd "make $MAKE_INSTALL" "Cannot make install"
130 if echo $@ | grep check >/dev/null ; then
131 do_cmd "make $MAKE_CHECK 2>&1" || fail "Cannot make check"
134 echo Remote compilation sucessful.
137 echo CONFIG-LOG-DUMP-BEGIN
139 echo CONFIG-LOG-DUMP-END
142 echo Remote compilation sucessful.