1#! /bin/sh 2# 3# $NetBSD: bind2netbsd,v 1.7 2024/09/08 10:02:00 rillig Exp $ 4# 5# Copyright (c) 2000 The NetBSD Foundation, Inc. 6# All rights reserved. 7# 8# Redistribution and use in source and binary forms, with or without 9# modification, are permitted provided that the following conditions 10# are met: 11# 1. Redistributions of source code must retain the above copyright 12# notice, this list of conditions and the following disclaimer. 13# 2. Redistributions in binary form must reproduce the above copyright 14# notice, this list of conditions and the following disclaimer in the 15# documentation and/or other materials provided with the distribution. 16# 17# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS 18# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 19# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 20# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS 21# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 22# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 25# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 27# POSSIBILITY OF SUCH DAMAGE. 28# 29# bind2netbsd: convert a bind source tree into a 30# netbsd bind source tree, under src/external/mpl/bind/dist, 31# based on bind2netbsd by Bernd Ernesti and changes by Simon Burge 32# 33# Rough instructions for importing new bind release: 34# 35# $ cd /some/where/temporary 36# $ tar xpfz /new/bind/release/tar/file 37# $ sh /usr/src/external/mpl/bind/bind2netbsd bind-9.x.y `pwd` 38# $ cd src/external/mpl/bind/dist 39# $ cvs -d cvs.netbsd.org:/cvsroot import src/external/mpl/bind/dist ISC bind-9-x-y 40# Enter the new CHANGES portion as your commit message 41# $ cd ../../../../../bind-9.x.y 42# $ run ./configure --enable-dnsrps --enable-querytrace --enable-fixed-rrset --without-python 43# $ run make 44# - use the binclude4netbsd to create and import the new headers in 45# /usr/src/external/mpl/bind/include 46# - check makefiles to see if any extra sources have been added. 47# - update distrib/sets if necessary. 48# 49# Note that properly the import message should include a short summary 50# of changes since the previous import rather than just "Import bind 9.x.y". 51# 52 53if [ $# -ne 2 ]; then echo "bind2netbsd src dest"; exit 1; fi 54 55r=$1 56d=$2/src/external/mpl/bind/dist 57 58case "$d" in 59 /*) 60 ;; 61 *) 62 d=`/bin/pwd`/$d 63 ;; 64esac 65 66case "$r" in 67 /*) 68 ;; 69 *) 70 r=`/bin/pwd`/$r 71 ;; 72esac 73 74echo preparing directory $d 75rm -rf $d 76mkdir -p $d 77 78### Copy the files and directories 79echo copying $r to $d 80cd $r 81pax -rw * $d 82 83if [ -d $d/libtool.m4 ] 84then 85 mv $d/libtool.m4 $d/m4 86fi 87 88### Remove the $'s around RCS tags 89cleantags $d 90 91### Add our NetBSD RCS Id 92find $d -type f -name '*.[chly]' -print | while read c; do 93 sed 1q < $c | grep -q '\$NetBSD' || ( 94echo "/* \$NetBSD\$ */" >/tmp/bind3n$$ 95echo "" >>/tmp/bind3n$$ 96cat $c >> /tmp/bind3n$$ 97mv /tmp/bind3n$$ $c && echo added NetBSD RCS tag to $c 98 ) 99done 100 101find $d -type f -name '*.[0-9]' -print | while read m; do 102 sed 1q < $m | grep -q '\$NetBSD' || ( 103echo ".\\\" \$NetBSD\$" >/tmp/bind2m$$ 104echo ".\\\"" >>/tmp/bind2m$$ 105cat $m >> /tmp/bind2m$$ 106mv /tmp/bind2m$$ $m && echo added NetBSD RCS tag to $m 107 ) 108done 109 110find $d -type f -name '*.texi' -print | while read t; do 111 sed "2 s/^/@c \$NetBSD\$\\ 112/" < $t > /tmp/bind4t$$ 113 mv /tmp/bind4t$$ $t && echo added NetBSD RCS tag to $t 114done 115 116echo done 117 118### Clean up any CVS directories that might be around. 119echo "cleaning up CVS residue." 120( 121 cd $d 122 find . -type d -name "CVS" -exec rm -r {} + 123) 124echo done 125 126echo "cleaning up GIT residue." 127( 128 cd $d 129 find . -type d -name ".gitattributes" -exec rm {} + 130) 131echo done 132 133echo "cleaning up clang-format residue." 134( 135 cd $d 136 find . -type d -name ".clang-format*" -exec rm {} + 137) 138echo done 139 140### Fixing file and directory permissions. 141echo "Fixing file/directory permissions." 142( 143 cd $d 144 find . -type f -print | xargs chmod u+rw,go+r 145 find . -type d -print | xargs chmod u+rwx,go+rx 146) 147echo done 148 149exit 0 150