21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson#!/bin/sh
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# Copyright (C) 2000-2002, 2004, 2007, 2008, 2012, 2016 Internet Systems Consortium, Inc. ("ISC")
bf8267aa453e5d2a735ed732a043b77a0b355b20Mark Andrews#
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# This Source Code Form is subject to the terms of the Mozilla Public
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# License, v. 2.0. If a copy of the MPL was not distributed with this
0c27b3fe77ac1d5094ba3521e8142d9e7973133fMark Andrews# file, You can obtain one at http://mozilla.org/MPL/2.0/.
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews
ea94d370123a5892f6c47a97f21d1b28d44bb168Tinderbox User# $Id$
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson#
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson# "Alternative build" test.
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson#
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson# Build BIND9 with build options that are seldom tested otherwise.
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson# Specify the CVS tag or the name of a kit .tar.gz file as a
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson# command line argument.
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson#
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewstmpdir=/tmp
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssoncase $# in
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrews 2) arg=$1 tmpdir="$2" ;;
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson 1) arg=$1 ;;
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrews *) echo "usage: $0 cvs-tag | absolute-path-to-gzipped-tar-file [tmpdir]" >&2; exit 1 ;;
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssonesac
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
e4c6adf028fedafcadee9e22e1e734e9e716471bAndreas Gustafssonhere=`pwd`
e4c6adf028fedafcadee9e22e1e734e9e716471bAndreas Gustafsson
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafssontest -f util/check-instincludes.sh || {
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafsson echo "$0: must be run from top of CVS tree";
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafsson exit 1;
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafsson}
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafsson
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewskitdir=${tmpdir}/kit
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewssrcdir=${tmpdir}/src
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewsbuilddir=${tmpdir}/build
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewsinstdir=${tmpdir}/inst
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
a078776647dc80691fe97e2dd94a2525564df3ecMark Andrewstest -d $tmpdir || mkdir $tmpdir
49a6051082aac7ef5e358ba74791e94f5c456a15Andreas Gustafssontest ! -d $kitdir || rm -rf $kitdir
49a6051082aac7ef5e358ba74791e94f5c456a15Andreas Gustafssonmkdir $kitdir
49a6051082aac7ef5e358ba74791e94f5c456a15Andreas Gustafsson
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssontest ! -d $srcdir || rm -rf $srcdir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssonmkdir $srcdir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssontest ! -d $builddir || rm -rf $builddir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssonmkdir $builddir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafssontest ! -d $instdir || rm -rf $instdir
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafssonmkdir $instdir
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafssoncase $arg in
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson *.tar.gz)
58c48b3b48f0de8fa31fc913aff3b8774c1e72e7Andreas Gustafsson kit="$arg"
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson ;;
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson *)
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson tag="$arg"
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson sh util/kit.sh $tag $kitdir || exit 1
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson kit=$kitdir/*.tar.gz
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafsson ;;
336ca4423f475d9881ff0dcb326808935be7cd19Andreas Gustafssonesac
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
49a6051082aac7ef5e358ba74791e94f5c456a15Andreas Gustafssoncd $srcdir || exit 1
9d22ce85ccded7790a511dbe4065723f8d4f80a6Mark Andrewsgzcat $kit | tar xf -
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssoncd $builddir || exit 1
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
43b9c76f5e8ad75226a2f58650b3f0be03f49994Andreas Gustafsson# Test a libtool / separate object dir / threadless build.
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
9224b1c0b6738407c84b61cb151af7672a201018Andreas GustafssonCFLAGS="-g -DISC_CHECK_NONE -DISC_MEM_FILL=0 -DISC_LIST_CHECKINIT" \
43b9c76f5e8ad75226a2f58650b3f0be03f49994Andreas Gustafsson sh $srcdir/bind-*/configure --with-libtool \
6cdaeb94d4d12b72b919f3c7099f7c47c172b59bEvan Hunt --disable-threads --with-openssl --prefix=$instdir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssongmake clean
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssongmake
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssongmake install
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson# Rebuild in the source tree so that the test suite
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson# works, then run it.
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafsson
49a6051082aac7ef5e358ba74791e94f5c456a15Andreas Gustafssoncd $srcdir/bind-* || exit 1
9224b1c0b6738407c84b61cb151af7672a201018Andreas GustafssonCFLAGS="-g -DISC_CHECK_NONE -DISC_MEM_FILL=0 -DISC_LIST_CHECKINIT" \
9224b1c0b6738407c84b61cb151af7672a201018Andreas Gustafsson sh configure --with-libtool --disable-threads --prefix=$instdir
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssonmake
21f17c42eca9b552d516c38b66564673c60a4504Andreas Gustafssonmake install
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson( cd bin/tests && make test )
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson# Check the installed header files
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafsson
e4c6adf028fedafcadee9e22e1e734e9e716471bAndreas Gustafssoncd $here
82493dc831d40482faf20cdb4d4295174879c9f9Andreas Gustafssonsh util/check-instincludes.sh $instdir