skip duplicate util-vserver dir
[util-vserver.git] / build-all
1 #! /bin/sh
2
3 # Copyright (C) 2004,2005,2006 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
4 #  
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; version 2 of the License.
8 #  
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12 # GNU General Public License for more details.
13 #  
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
17
18 set -e
19
20 J=-j8
21
22 confflags="-C --enable-maintainer-mode --prefix=/usr --sysconfdir=/etc --localstatedir=/var"
23 configure="`pwd`/configure $confflags"
24 make=eval\ "${CLEAN:+make $J silent.clean;} \
25             echo -e \"== executing 'make all'...\" && \
26             make $J ${SILENT:+-s silent.}all && \
27             echo -e \"\n== executing 'make check'...\" && \
28             make $J ${SILENT:+-s silent.}check"
29
30 LANG=C
31 CPPFLAGS='-D_FORTIFY_SOURCE=99'
32
33 ## Usage: xtermTitle <title>
34 function xtermTitle
35 {
36     tty -s || return 0
37     echo -ne "\e]0;$@\007"
38 }
39
40 ## Usage: operate <dir> <configure-opts>*
41 function operate()
42 {
43     d=$1
44     shift
45     
46     echo  "******************"
47     echo $"** Operating in directory '$d'..."
48     xtermTitle "Operating in directory '$d'... ($@)"
49     
50     mkdir -p $d && cd $d
51
52     test -z "$CLEAN" || rm -f config.cache
53     test -e Makefile || CCACHE_DISABLE=1 $configure "$@"
54     $make
55     cd -
56 }
57
58 case "$1" in
59     dist)
60         test -e Makefile || \
61             CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' CPPFLAGS=$CPPFLAGS \
62             ./configure $confflags
63         $make
64         exit
65         ;;
66     debian-woody|debian-sarge|fc-1-90|fc-1|fc-2|fc-3)
67         cat util-vserver-"$2".tar.bz2 | \
68             ssh $1 "cd /tmp && rm -rf /tmp/util-vserver-* && \
69                     tar xjf - && cd util-vserver-$2 && \
70                     export PATH=/usr/lib/ccache:/usr/lib/ccache/bin:\$PATH && \
71                         ./configure && \
72                     make ${SILENT:+-s silent.}all && \
73                     echo -e '\n\n\n' &&
74                     make ${SILENT:+-s silent.}check"
75         exit
76         ;;
77     *)  test -z "$1" || {
78             echo $"Unknown option '$1'" >&2
79             exit 1
80         }
81 esac
82
83 test -d "Build" || {
84     d=$(mktemp -d /tmp/build-ensc.XXXXXX)
85     rm -f Build
86     ln -sf $d Build
87 }
88
89 operate Build/diet-noopt                                       CPPFLAGS=$CPPFLAGS CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3'
90 operate Build/diet-opt     --enable-release                    CPPFLAGS=$CPPFLAGS
91 operate Build/nodiet-noopt --disable-dietlibc                  CPPFLAGS=$CPPFLAGS CFLAGS='-O0 -g3' CXXFLAGS='-O0 -g3' 
92 operate Build/nodiet-opt   --enable-release --disable-dietlibc CPPFLAGS=$CPPFLAGS
93 operate Build/gcc32-opt    --enable-release --disable-dietlibc CPPFLAGS=$CPPFLAGS CC='ccache gcc32'  CXX='ccache g++'
94
95 operate Build/diet-opt-api   --enable-release --enable-apis=NOLEGACY                    CPPFLAGS=$CPPFLAGS
96 operate Build/nodiet-opt-api --enable-release --enable-apis=NOLEGACY --disable-dietlibc CPPFLAGS=$CPPFLAGS