1 #! /bin/sh 2 # 3 # $NetBSD: bind2netbsd,v 1.12 2026/01/29 18:36:25 christos 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 43 44 #U=/usr/src/external/lgpl2/userspace-rcu 45 #OBJ=/obj.amd64-x86_64 46 #env LIBURCU_CFLAGS="-I$U/include -I$U/dist/include" LIBURCU_LIBS="-L$U/lib/liburcu-memb$OBJ -lurcu-memb -L$U/lib/liburcu-cds$OBJ -lurcu-cds -L$U/lib/liburcu-common$OBJ -lurcu-common" ./configure --enable-querytrace --enable-fixed-rrset --with-liburcu=membarrier 47 48 # $ run make 49 # - use the binclude4netbsd to create and import the new headers in 50 # /usr/src/external/mpl/bind/include 51 # - check makefiles to see if any extra sources have been added. 52 # - update distrib/sets if necessary. 53 # 54 # Note that properly the import message should include a short summary 55 # of changes since the previous import rather than just "Import bind 9.x.y". 56 # 57 58 if [ $# -ne 2 ]; then echo "bind2netbsd src dest"; exit 1; fi 59 60 r=$1 61 d=$2/src/external/mpl/bind/dist 62 63 case "$d" in 64 /*) 65 ;; 66 *) 67 d=`/bin/pwd`/$d 68 ;; 69 esac 70 71 case "$r" in 72 /*) 73 ;; 74 *) 75 r=`/bin/pwd`/$r 76 ;; 77 esac 78 79 echo preparing directory $d 80 rm -rf $d 81 mkdir -p $d 82 83 ### Copy the files and directories 84 echo copying $r to $d 85 cd $r 86 pax -rw * $d 87 88 if [ -d $d/libtool.m4 ] 89 then 90 mv $d/libtool.m4 $d/m4 91 fi 92 93 ### Remove the $'s around RCS tags 94 cleantags $d 95 96 ### Add our NetBSD RCS Id 97 find $d -type f -name '*.[chly]' -print | while read c; do 98 sed 1q < $c | grep -q '\$NetBSD' || ( 99 echo "/* \$NetBSD\$ */" >/tmp/bind3n$$ 100 echo "" >>/tmp/bind3n$$ 101 cat $c >> /tmp/bind3n$$ 102 mv /tmp/bind3n$$ $c && echo added NetBSD RCS tag to $c 103 ) 104 done 105 106 find $d -type f -name '*.[0-9]' -print | while read m; do 107 sed 1q < $m | grep -q '\$NetBSD' || ( 108 echo ".\\\" \$NetBSD\$" >/tmp/bind2m$$ 109 echo ".\\\"" >>/tmp/bind2m$$ 110 cat $m >> /tmp/bind2m$$ 111 mv /tmp/bind2m$$ $m && echo added NetBSD RCS tag to $m 112 ) 113 done 114 115 find $d -type f -name '*.texi' -print | while read t; do 116 sed "2 s/^/@c \$NetBSD\$\\ 117 /" < $t > /tmp/bind4t$$ 118 mv /tmp/bind4t$$ $t && echo added NetBSD RCS tag to $t 119 done 120 121 echo done 122 123 ### Clean up any CVS directories that might be around. 124 echo "cleaning up CVS residue." 125 ( 126 cd $d 127 find . -type d -name "CVS" -exec rm -r {} + 128 ) 129 echo done 130 131 echo "cleaning up GIT residue." 132 ( 133 cd $d 134 find . -type d -name ".gitattributes" -exec rm {} + 135 ) 136 echo done 137 138 echo "cleaning up clang-format residue." 139 ( 140 cd $d 141 find . -type d -name ".clang-format*" -exec rm {} + 142 ) 143 echo done 144 145 ### Fixing file and directory permissions. 146 echo "Fixing file/directory permissions." 147 ( 148 cd $d 149 find . -type f -print | xargs chmod u+rw,go+r 150 find . -type d -print | xargs chmod u+rwx,go+rx 151 ) 152 echo done 153 154 exit 0 155