nt-kit revision 7d32c065c7bb56f281651ae3dd2888f32ce4f1d9
1633838b8255282d10af15c5c84cee5a51466712Bob Halley#! /bin/sh -ex
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews#
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# Copyright (C) 1999, 2000 Internet Software Consortium.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#
1633838b8255282d10af15c5c84cee5a51466712Bob Halley# Permission to use, copy, modify, and distribute this software for any
1633838b8255282d10af15c5c84cee5a51466712Bob Halley# purpose with or without fee is hereby granted, provided that the above
1633838b8255282d10af15c5c84cee5a51466712Bob Halley# copyright notice and this permission notice appear in all copies.
40f53fa8d9c6a4fc38c0014495e7a42b08f52481David Lawrence#
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
dafcb997e390efa4423883dafd100c975c4095d6Mark Andrews# ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
1633838b8255282d10af15c5c84cee5a51466712Bob Halley# SOFTWARE.
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# XXX no command line options at all. especially useful would be a way
9c3531d72aeaad6c5f01efe6a1c82023e1379e4dDavid Lawrence# to specify the target directory on the NT machine, since it is needed
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley# in the Makefiles and otherwise config.status.win32 needs to be edited.
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley# XXX long term something different clearly needs to be done, so someone
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# without any Unix boxes at all could download the source kit and compile.
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein# it'll happen; it has been a higher priority just to try to work
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley# on the code issues.
e4e071ae12aee942fefc2c0a3280e402938669deBob Halley
904a5734375869ffb504ed8cde6b68cafadb6d64Bob HalleyZIP=bind9-nt.zip
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob HalleyDOZIP=false
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrencecase "$1" in
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence-nozip) DOZIP=false; shift ;;
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence-zip) DOZIP=true ; shift ;;
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrenceesac
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrencecase $# in
1a69a1a78cfaa86f3b68bbc965232b7876d4da2aDavid Lawrence0)
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley dstdir=../bind9-nt
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley rmtdir=g:/proj/bind9-nt
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley ;;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley1)
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington dstdir=../bind9-nt
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington rmtdir="$1"
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews ;;
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews2)
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews dstdir="$2"
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews rmtdir="$1"
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington ;;
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington*)
b6309ed962c4988a314d61742c4fbc4935467d68Mark Andrews echo "usage: $0 rmtdir [dstdir]" >&2
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington exit 99
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington ;;
bcff3198111e329e89cde7dac9d432b002477d80Mark Andrewsesac
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtontest -f version || {
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington echo "$0: must be run in bind9 top level directory" >&2
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington exit 1
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington}
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtonset -- `ls -i version`
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleythis_version=$1
84cb41f729e2a8526300dd7a6cffaa66da5cf6cdMark Andrewsif test -e "$dstdir/version"; then
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington set -- `ls -i "$dstdir/version" 2>&1`
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtonelse
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington set -- 0
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtonfi
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtonthat_version=$1
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
618e871c2eb80021673bedf083496ccd1bf65cd0Brian Wellington# Try to make an effort to not wipe out current directory or non-bind directory
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtontest "0$this_version" -eq "0$that_version" && {
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington echo "$0: dstdir must not be current directory" >&2
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington exit 1
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington}
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellingtontest ! -d $dstdir -o "$that_version" -ne 0 || {
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington echo "$0: existing dstdir must be a bind9 source directory" >&2
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington exit 1
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington}
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleyrm -rf $dstdir
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleymkdir $dstdir
b55c30f2de6e1baaa3a9ba69b92f428f2c255ac3Mark Andrewstar cf - . | (cd $dstdir; tar xfp -)
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleycd $dstdir
308c7ad5f68301d19f023af616f62f3e7cbce632Andreas Gustafsson
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellington# XXX Tale BSD/OS special
04b8111f2137a9cf9b0b71228f76b3e40ffa1173Brian Wellingtonrm -f stdio.h
ccad3c9ecbe8a1060ff7b407a318ccd592de536eBrian Wellington
ccad3c9ecbe8a1060ff7b407a318ccd592de536eBrian Wellington# Start with a clean slate. This is not done in the source tree before
ccad3c9ecbe8a1060ff7b407a318ccd592de536eBrian Wellington# the copy so as not to disturb things there.
ccad3c9ecbe8a1060ff7b407a318ccd592de536eBrian Wellington./configure
ccad3c9ecbe8a1060ff7b407a318ccd592de536eBrian Wellingtonmake clean
8224be5129daebea8f0f5e8be5f925679ec893f1Brian Wellington
8224be5129daebea8f0f5e8be5f925679ec893f1Brian Wellington# XXX header files that (currently) need to be built on Unix
a413f94248ceed48a6b7aaa2fa1d2401fb8b9f30Brian Wellington##cd lib/isc
d14b749789121d9d502fa1348e9e73270e9b039fBob Halley##make
63d1ef9e771b748ca9bf241dfc1f07d3730203faBob Halley##cd ../dns
659175b7d430afe13b439e499442a964e2c9110fMark Andrews##make code.h include/dns/enumtype.h include/dns/enumclass.h include/dns/rdatastruct.h
cd02757774252fe5b92dbd59a24b34721fb49ff4Bob Halley##cd ../..
cd02757774252fe5b92dbd59a24b34721fb49ff4Bob Halley
7b4dcbb89b71b17f5c16ca19a0e705e09509f063Bob Halley# XXX Need a better way
73af6575e00f8cf4942abce177f435797b9cfe41Brian Wellingtonperl -pi -e '$_ = "" if /chmod\(.*\)/' lib/dns/sec/dst/dst_parse.c
322b0fb39dd1538c9f5021cd2f54d4c12684ecdbBrian Wellington
3864eb0e9a73148ac744893b5367169761184db5Mark Andrews# XXX grrr.
f53e43c37f2c978ccec0b49ed829426b213f9933Bob Halleyperl -pi -e 'last if /^##confparser\.c/' lib/dns/config/Makefile.in
afbc02482008c58af2c98000209165f6880835f7Mark Andrews
e1f16346db02486f751c6db683fffe53c866c186Andreas Gustafsson# Adjust Makefiles to have NT paths and nmake-compatible variable expansion.
93d6dfaf66258337985427c86181f01fc51f0bb4Mark Andrewsset +x
2ee24549b3dddd4046ee14257e1207cf2e34f29cBrian Wellingtonecho doing Makefile substitutions
9ac7076ebad044afb15e9e2687e3696868778538Mark Andrewswhile read file type dates; do
6850cdd4497424c9d42ade487edfde9fb9a47de9Brian Wellington case $file in
20a313a4581e7f85fb2ce37430a146b3538da841Mark Andrews */Makefile.in|./make/includes.in|./version)
20a313a4581e7f85fb2ce37430a146b3538da841Mark Andrews echo $file
b20ee662a7c847c9ef7b96ab9e5e34543efe5c0dMark Andrews perl -pi -e 'tr%{}/%()\\%;
b55c30f2de6e1baaa3a9ba69b92f428f2c255ac3Mark Andrews s%(-I.*)unix%$1win32%;
e21d199dca95aff5d50f133d6b064309e209af00Brian Wellington s%(-I.*)pthreads.*?(\\?)$%$2%;
6a56be50dd11702cb65347a57894ffd96a7e3501Andreas Gustafsson s%-I ?%/I %g;
1275a72e8db349ce249c84804b2b4861d33d4db7Brian Wellington s%-D%/D %g;
15af30dfc1c54a02d252dcf4c6f3b8759eaf0327Bob Halley s%(\$\(ARFLAGS\)) \$@%$1 /out:\$@%;
15af30dfc1c54a02d252dcf4c6f3b8759eaf0327Bob Halley s%\$\(UNIXOBJS\)%\$(WIN32OBJS)%;
58cbc05eb0b80510182496ad905cd407f3624dbeBrian Wellington s%\$\(PTHREADOBJS\)%%;
a93cf7e83be621d3d68f51e37121a47a70a6757bMark Andrews s%^(SUBDIRS.*)(pthreads)(.*)%$1$3%;
9ac7076ebad044afb15e9e2687e3696868778538Mark Andrews s%^(SUBDIRS.*)(unix)(.*)%$1win32$3%;
5ea0d11ca45bfd1ea9db8db07f18fbb02f500661Brian Wellington s%rm -f%-del /q /f%;
a9ef4854464fcc56d95f72331b6e09e9563bb5f3Andreas Gustafsson s%rm -rf%-rd /q /s%;
2c64908ae0d5b5a1cfead295d7526e7be550d3d3Mark Andrews s%touch%copy NUL:%' $file
01446841be2b73f9a2ead74056df2d5342414041Andreas Gustafsson ;;
ff1b064f5e2bf19c8e25f8927d23df5714e666edMark Andrews ./make/rules.in)
b6279d0b4b19f041b29775e637074e09f38e5e11Brian Wellington echo frobbing conditionals in $file
231ffa6c85cd04d5d83f80643e26fdc3ff510138Brian Wellington
4b171ebd702d72200a4d7609f11c5f79d6b6f964Brian Wellington # /K is specified in MAKEDEFS *YUCK* because nmake
0b09763c354ec91fb352b6b4cea383bd0195b2d8Mark Andrews # for some BRAINDAMAGED REASON does not put K
4d9f3f00d93fcb8743b1105e8cf82e862be220d1Mark Andrews # in MAKEFLAGS (confirm with "nmake /PKN foo";
5bd76af084edfdcd1cb4db9453ac781d32dde6f7Mark Andrews # only P and N are in Makeflags.) However ... doing
5bd76af084edfdcd1cb4db9453ac781d32dde6f7Mark Andrews # things this way ends up putting /K when you might not
5bd76af084edfdcd1cb4db9453ac781d32dde6f7Mark Andrews # want it. Thanks, Microsoft.
5bd76af084edfdcd1cb4db9453ac781d32dde6f7Mark Andrews perl -pi -e \
5bd76af084edfdcd1cb4db9453ac781d32dde6f7Mark Andrews 'print "MAKEDEFS = /nologo /K\$(MAKEFLAGS)\n"
c86eed4bdecad9df12f992f9d743dfee3a6c5bdcMark Andrews if $. == 1;
421e4cf66e4cba0b0751a34a9c027e39fe0474f9Mark Andrews
8b5de9701428e2b5eb50aba96af23dc1186124ddMark Andrews tr%{}/%()\\%;
182a34004c7c48e2c1626f3ce7e787f413955126Mark Andrews
35541328a8c18ba1f984300dfe30ec8713c90031Mark Andrews s%-I%/I %g;
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews s%-D%/D %g;
2047977ce2dfcfe3a0fa2d638c3242841310fad3Mark Andrews s%-c%/c %g;
d5ad558234adfef1b847b534dd7b4c6302cc5ea3Mark Andrews
c5cde9d5a70c921da901a23845e740ccc7a8c4e4Mark Andrews s/\.c\.o:/.c.obj:/;
8d414d155953f89a4eff40f16878438a8c9228f3Mark Andrews
6fac7ff1f9ec9c3873d3b55c5079fa79aba1f146Mark Andrews s%rm -f%-del /q /f%;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s%rm -rf%-rd /q /s%;
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/for\ i\ in\ \$\(ALL_SUBDIRS\).*
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley /for %i in (\$(ALL_SUBDIRS)) do \\/x;
894a2f61c9e3e51463bf21957c003d7c5636bdc5David Lawrence
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/if\ \[\ (\S+)\ !=\ "nulldir".*
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley /\@if NOT $1=="nulldir" \\/x;
894a2f61c9e3e51463bf21957c003d7c5636bdc5David Lawrence
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/^.*echo "making .* in .*\n//;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/\(cd\ (\S+);\ (.*)\);\ \\
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley /pushd $1 && cd && $2 && popd || popd/x;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/\$\$i/%i/g;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley s/^\t+(fi|done).*\n//' $file
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley ;;
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley esac
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleydone < util/copyrights
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleyset -x
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley# Make Makefiles
ab023a65562e62b85a824509d829b6fad87e00b1Rob Austein./config.status.win32 $rmtdir
125d72976ab6b8fa6629a5ace276a86e9fef91acBrian Wellington
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halley# Copy win32 special files
25e43e68b7431d5e4ff8b5427108cd7f5f9bcf3eBob Halleycp config.h.win32 config.h
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrenceif $DOZIP; then
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence dir="`basename $dstdir`"
6d12fdf96621801e80f3f4c2a8a569fe48766a20David Lawrence cd ..
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence rm -f $ZIP
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence # q = quiet
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence # r = recurse
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence # l = LF -> CRLF
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence # 9 = highest compression
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrence zip -qrl9 $ZIP $dir
09f22ac5b09e70bc526015f37168ba33e21ea91fDavid Lawrencefi
c50fd34a4e0e6978f8ca5f6f3ad8545549c3cfeeBob Halley
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halleyexit 0
904a5734375869ffb504ed8cde6b68cafadb6d64Bob Halley