cvs updates from Wed Dec 15 17:45:22 EST 2010
[tridge/bind9.git] / util / altbuild.sh
1 #!/bin/sh
2 #
3 # Copyright (C) 2004, 2007, 2008  Internet Systems Consortium, Inc. ("ISC")
4 # Copyright (C) 2000-2002  Internet Software Consortium.
5 #
6 # Permission to use, copy, modify, and/or distribute this software for any
7 # purpose with or without fee is hereby granted, provided that the above
8 # copyright notice and this permission notice appear in all copies.
9 #
10 # THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
11 # REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
12 # AND FITNESS.  IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
13 # INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
14 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
15 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16 # PERFORMANCE OF THIS SOFTWARE.
17
18 # $Id: altbuild.sh,v 1.19 2008/09/25 04:02:39 tbox Exp $
19
20 #
21 # "Alternative build" test.
22 #
23 # Build BIND9 with build options that are seldom tested otherwise.
24 # Specify the CVS tag or the name of a kit .tar.gz file as a
25 # command line argument.
26 #
27
28 tmpdir=/tmp
29 case $# in 
30     2) arg=$1 tmpdir="$2" ;;
31     1) arg=$1 ;;
32     *) echo "usage: $0 cvs-tag | absolute-path-to-gzipped-tar-file [tmpdir]" >&2; exit 1 ;;
33 esac
34
35 here=`pwd`
36
37 test -f util/check-instincludes.sh || {
38     echo "$0: must be run from top of CVS tree";
39     exit 1;
40 }
41
42 kitdir=${tmpdir}/kit
43 srcdir=${tmpdir}/src
44 builddir=${tmpdir}/build
45 instdir=${tmpdir}/inst
46
47 test -d $tmpdir || mkdir $tmpdir
48 test ! -d $kitdir || rm -rf $kitdir
49 mkdir $kitdir
50
51 test ! -d $srcdir || rm -rf $srcdir
52 mkdir $srcdir
53
54 test ! -d $builddir || rm -rf $builddir
55 mkdir $builddir
56
57 test ! -d $instdir || rm -rf $instdir
58 mkdir $instdir
59
60 case $arg in
61     *.tar.gz)
62         kit="$arg"
63         ;;
64     *)
65         tag="$arg"
66         sh util/kit.sh $tag $kitdir || exit 1
67         kit=$kitdir/*.tar.gz
68         ;;
69 esac
70
71 cd $srcdir || exit 1
72 gzcat $kit | tar xf -
73
74 cd $builddir || exit 1
75
76 # Test a libtool / separate object dir / threadless build.
77
78 CFLAGS="-g -DISC_CHECK_NONE -DISC_MEM_FILL=0 -DISC_LIST_CHECKINIT" \
79     sh $srcdir/bind-*/configure --with-libtool \
80         --disable-threads --with-openssl --prefix=$instdir
81 gmake clean
82 gmake
83 gmake install
84
85 # Rebuild in the source tree so that the test suite
86 # works, then run it.
87
88 cd $srcdir/bind-* || exit 1
89 CFLAGS="-g -DISC_CHECK_NONE -DISC_MEM_FILL=0 -DISC_LIST_CHECKINIT" \
90     sh configure --with-libtool --disable-threads --prefix=$instdir
91 make
92 make install
93
94 ( cd bin/tests && make test )
95
96 # Check the installed header files
97
98 cd $here
99 sh util/check-instincludes.sh $instdir