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