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