nt-kit revision 15a44745412679c30a6d022733925af70a38b715
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley# Copyright (C) 1999, 2000 Internet Software Consortium.
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley# Permission to use, copy, modify, and distribute this software for any
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley# purpose with or without fee is hereby granted, provided that the above
7d32c065c7bb56f281651ae3dd2888f32ce4f1d9Bob Halley# copyright notice and this permission notice appear in all copies.
15a44745412679c30a6d022733925af70a38b715David Lawrence# THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM
15a44745412679c30a6d022733925af70a38b715David Lawrence# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
15a44745412679c30a6d022733925af70a38b715David Lawrence# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
15a44745412679c30a6d022733925af70a38b715David Lawrence# INTERNET SOFTWARE CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT,
15a44745412679c30a6d022733925af70a38b715David Lawrence# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
15a44745412679c30a6d022733925af70a38b715David Lawrence# FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
15a44745412679c30a6d022733925af70a38b715David Lawrence# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
15a44745412679c30a6d022733925af70a38b715David Lawrence# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15a44745412679c30a6d022733925af70a38b715David Lawrence# $Id: nt-kit,v 1.4 2000/07/27 09:54:58 tale Exp $
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# XXX no command line options at all. especially useful would be a way
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# to specify the target directory on the NT machine, since it is needed
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# in the Makefiles and otherwise config.status.win32 needs to be edited.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# XXX long term something different clearly needs to be done, so someone
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# without any Unix boxes at all could download the source kit and compile.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# it'll happen; it has been a higher priority just to try to work
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# on the code issues.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence echo "$0: must be run in bind9 top level directory" >&2
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrenceif test -e "$dstdir/version"; then
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# Try to make an effort to not wipe out current directory or non-bind directory
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrencetest "0$this_version" -eq "0$that_version" && {
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence echo "$0: dstdir must not be current directory" >&2
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrencetest ! -d $dstdir -o "$that_version" -ne 0 || {
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence echo "$0: existing dstdir must be a bind9 source directory" >&2
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# XXX Tale BSD/OS special
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# Start with a clean slate. This is not done in the source tree before
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# the copy so as not to disturb things there.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# XXX header files that (currently) need to be built on Unix
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence##make code.h include/dns/enumtype.h include/dns/enumclass.h include/dns/rdatastruct.h
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# XXX Need a better way
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrenceperl -pi -e '$_ = "" if /chmod\(.*\)/' lib/dns/sec/dst/dst_parse.c
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrenceperl -pi -e 'last if /^##confparser\.c/' lib/dns/config/Makefile.in
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# Adjust Makefiles to have NT paths and nmake-compatible variable expansion.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%(-I.*)unix%$1win32%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%(-I.*)pthreads.*?(\\?)$%$2%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%-I ?%/I %g;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%(\$\(ARFLAGS\)) \$@%$1 /out:\$@%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%\$\(UNIXOBJS\)%\$(WIN32OBJS)%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%\$\(PTHREADOBJS\)%%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%^(SUBDIRS.*)(pthreads)(.*)%$1$3%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%^(SUBDIRS.*)(unix)(.*)%$1win32$3%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%rm -f%-del /q /f%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%rm -rf%-rd /q /s%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # /K is specified in MAKEDEFS *YUCK* because nmake
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # for some BRAINDAMAGED REASON does not put K
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # in MAKEFLAGS (confirm with "nmake /PKN foo";
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # only P and N are in Makeflags.) However ... doing
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # things this way ends up putting /K when you might not
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # want it. Thanks, Microsoft.
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence 'print "MAKEDEFS = /nologo /K\$(MAKEFLAGS)\n"
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence tr%{}/%()\\%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%rm -f%-del /q /f%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s%rm -rf%-rd /q /s%;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s/for\ i\ in\ \$\(ALL_SUBDIRS\).*
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /for %i in (\$(ALL_SUBDIRS)) do \\/x;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s/if\ \[\ (\S+)\ !=\ "nulldir".*
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /\@if NOT $1=="nulldir" \\/x;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s/^.*echo "making .* in .*\n//;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s/\(cd\ (\S+);\ (.*)\);\ \\
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence /pushd $1 && cd && $2 && popd || popd/x;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence s/\$\$i/%i/g;
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# Make Makefiles
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence# Copy win32 special files
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # r = recurse
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # l = LF -> CRLF
487e6abc16c1b2958d371b0d4e808953646b520aDavid Lawrence # 9 = highest compression