skip duplicate util-vserver dir
[util-vserver.git] / build-all
diff --git a/build-all b/build-all
new file mode 100755 (executable)
index 0000000..86eb12a
--- /dev/null
+++ b/build-all
@@ -0,0 +1,96 @@
+#! /bin/sh
+
+# Copyright (C) 2004,2005,2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+#  
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#  
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#  
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set -e
+
+J=-j8
+
+confflags="-C --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc --localstatedir=/var"
+configure="`pwd`/configure $confflags"
+make=eval\ "${CLEAN:+make $J silent.clean;} \
+           echo -e \"== executing 'make all'...\" && \
+           make $J ${SILENT:+-s silent.}all && \
+           echo -e \"\n== executing 'make check'...\" && \
+           make $J ${SILENT:+-s silent.}check"
+
+LANG=C
+CPPFLAGS='-D_FORTIFY_SOURCE=99'
+
+## Usage: xtermTitle <title>
+function xtermTitle
+{
+    tty -s || return 0
+    echo -ne "\e]0;$@\007"
+}
+
+## Usage: operate <dir> <configure-opts>*
+function operate()
+{
+    d=$1
+    shift
+    
+    echo  "******************"
+    echo $"** Operating in directory '$d'..."
+    xtermTitle "Operating in directory '$d'... ($@)"
+    
+    mkdir -p $d && cd $d
+
+    test -z "$CLEAN" || rm -f config.cache
+    test -e Makefile || CCACHE_DISABLE=1 $configure "$@"
+    $make
+    cd -
+}
+
+case "$1" in
+    dist)
+       test -e Makefile || \
+           CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' CPPFLAGS=$CPPFLAGS \
+           ./configure $confflags
+       $make
+       exit
+       ;;
+    debian-woody|debian-sarge|fc-1-90|fc-1|fc-2|fc-3)
+       cat util-vserver-"$2".tar.bz2 | \
+           ssh $1 "cd /tmp && rm -rf /tmp/util-vserver-* && \
+                   tar xjf - && cd util-vserver-$2 && \
+                   export PATH=/usr/lib/ccache:/usr/lib/ccache/bin:\$PATH && \
+                       ./configure && \
+                   make ${SILENT:+-s silent.}all && \
+                   echo -e '\n\n\n' &&
+                   make ${SILENT:+-s silent.}check"
+       exit
+       ;;
+    *)  test -z "$1" || {
+           echo $"Unknown option '$1'" >&2
+           exit 1
+       }
+esac
+
+test -d "Build" || {
+    d=$(mktemp -d /tmp/build-ensc.XXXXXX)
+    rm -f Build
+    ln -sf $d Build
+}
+
+operate Build/diet-noopt                                       CPPFLAGS=$CPPFLAGS CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3'
+operate Build/diet-opt     --enable-release                    CPPFLAGS=$CPPFLAGS
+operate Build/nodiet-noopt --disable-dietlibc                  CPPFLAGS=$CPPFLAGS CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' 
+operate Build/nodiet-opt   --enable-release --disable-dietlibc CPPFLAGS=$CPPFLAGS
+operate Build/gcc32-opt    --enable-release --disable-dietlibc CPPFLAGS=$CPPFLAGS CC='ccache gcc32'  CXX='ccache g++'
+
+operate Build/diet-opt-api   --enable-release --enable-apis=NOLEGACY                    CPPFLAGS=$CPPFLAGS
+operate Build/nodiet-opt-api --enable-release --enable-apis=NOLEGACY --disable-dietlibc CPPFLAGS=$CPPFLAGS