3 # It is used to compile on remote hosts
9 # Where to install the stuff into (REMOTE_PREFIX gets fixed by the makefile)
11 if echo $PREFIX | egrep '^/' > /dev/null ; then
12 echo "Prefix is an absolute path. Good, it makes configure happy"
14 echo "Change prefix to an absolute path to keep configure happy"
15 PREFIX="$HOME/$PREFIX"
17 echo "(PREFIX=$PREFIX)"
19 # Where extra libraries are installed (if any)
20 LD_LIBRARY_PATH="$PREFIX/lib"
22 # Extra environment to pass to configure
25 # Argument of configure
26 CONFIGURE_ARGS="--prefix=$PREFIX/@PACKAGE@"
36 # Magic to search a working shell (from autobook)
38 # Zsh is not Bourne compatible without the following:
39 if test -n "$ZSH_VERSION"; then
44 # Bash is not POSIX compliant without the following:
45 test -n "$BASH_VERSION" && set -o posix
47 SHELL="${SHELL-/bin/sh}"
48 if test x"$1" = x--re-executed; then
49 # Functional shell was found. Remove option and continue
51 elif "$SHELL" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
52 "$SHELL" -c 'export toto=tutu' 2>/dev/null ; then
53 # The current shell works already!
54 echo "Current shell ($SHELL) working"
56 # Try alternative shells that (sometimes) support functions
57 for cmd in bash sh ash bsh ksh zsh sh5
59 for dir in `echo $PATH | sed -e 's/:/ /g'` /bin /usr/bin
62 if (test -f "$shell" || test -f "$shell.exe") &&
63 "$shell" -c 'foo () { exit 0; }; foo' 2>/dev/null &&
64 "$shell" -c 'export toto=tutu' 2>/dev/null
66 # Re-execute with discovered functional shell
67 echo "Reexecute $0 $@ with shell $shell"
68 SHELL="$shell" exec "$shell" "$0" --re-executed ${1+"$@"}
72 echo "Unable to locate a shell interpreter with function support and export syntax" >&2
82 # expend the path for solaris
83 PATH="$PATH:/usr/xpg4/bin"
88 echo CONFIG-LOG-DUMP-BEGIN
90 echo CONFIG-LOG-DUMP-END
97 cd $PREFIX/src || fail "Cannot cd to $PREFIX/src"
101 eval `echo $1` 2>&1 || fail "$2"
105 if echo $@ | grep clean >/dev/null ; then
106 for name in @PACKAGE@* ; do
107 if test "$name" != "@PACKAGE@-@VERSION@.tar.gz" ; then
108 echo "XXX Remove $name";
113 echo "XXX Untar @PACKAGE@-@VERSION@"
114 do_cmd "gunzip @PACKAGE@-@VERSION@.tar.gz" "Cannot gunzip"
115 do_cmd "tar xf @PACKAGE@-@VERSION@.tar" "Cannot untar"
118 if echo $@ | grep touch >/dev/null ; then
119 echo "XXX Touch everything within the tarball"
120 find @PACKAGE@-@VERSION@ -type f | while read f; do touch $f;done
123 cd @PACKAGE@-@VERSION@ || fail "Cannot cd to @PACKAGE@-@VERSION@"
125 if echo $@ | grep config >/dev/null ; then
126 do_cmd "env $CONFIGURE_ENV \
127 ./configure $CONFIGURE_ARGS" "Cannot configure"
130 if echo $@ | grep compile >/dev/null ; then
131 do_cmd "make $MAKE_ALL" "Cannot make"
134 if echo $@ | grep install >/dev/null ; then
135 do_cmd "make $MAKE_INSTALL" "Cannot make install"
138 if echo $@ | grep check >/dev/null ; then
139 do_cmd "make $MAKE_CHECK 2>&1" || fail "Cannot make check"
142 echo Remote compilation sucessful.
145 echo CONFIG-LOG-DUMP-BEGIN
147 echo CONFIG-LOG-DUMP-END
150 echo Remote compilation sucessful.