1#! /bin/sh 2# 3# $NetBSD: groff2netbsd,v 1.1 2016/01/13 19:01:55 christos Exp $ 4# 5# Copyright (c) 2001-2003 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# groff2netbsd: convert an groff source tree into a 30# netbsd groff source tree, under basesrc/dist, 31# based on bind2netbsd by Bernd Ernesti and changes by Simon Burge 32# 33# Rough instructions for importing new groff release: 34# 35# $ cd /some/where/temporary 36# $ tar xpfz /new/groff/release/tar/file 37# $ sh /usr/src/external/gpl2/groff/groff2netbsd groff-1.x.y `pwd` 38# $ cd `pwd`/src/external/gpl2/groff/dist 39# $ cvs import -m "Import groff 1.x.y" src/external/gpl2/groff/dist FSF groff-1-x-y 40# merge sources according to instructions given 41# e.g. cvs -d cvs.netbsd.org:/cvsroot checkout -jgroff-1-19 -jgroff-1-19-1 src/gnu/dist/groff 42# $ cd ../../../groff-1.x.y 43# $ run ./configure 44# merge newly generated src/include/config.h with 45# /usr/src/gnu/usr.bin/groff/include/config.h; compare VARIABLES in Makefile 46# with those in /usr/src/gnu/usr.bin/groff/Makefile.inc 47# $ cd .. 48# $ rm -r gnusrc groff-1.x.y 49# $ cd /usr/src/gnu/usr.bin/groff 50# $ cvs commit -m "Updated autoconf generated files for groff 1.x.y." 51# 52# - check makefiles to see if any extra sources have been added. 53# - update distrib/sets if necessary. 54 55if [ $# -ne 2 ]; then echo "groff2netbsd src dest"; exit 1; fi 56 57r=$1 58d=$2/src/external/gpl2/groff/dist 59 60case "$d" in 61 /*) 62 ;; 63 *) 64 d=`/bin/pwd`/$d 65 ;; 66esac 67 68case "$r" in 69 /*) 70 ;; 71 *) 72 r=`/bin/pwd`/$r 73 ;; 74esac 75 76echo preparing directory $d 77rm -rf $d 78mkdir -p $d 79 80### Copy the files and directories 81echo copying $r to $d 82cd $r 83pax -rw * $d 84 85# cd to import directory 86cd $d 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/groff3n$$ 95echo "" >>/tmp/groff3n$$ 96cat $c >> /tmp/groff3n$$ 97mv /tmp/groff3n$$ $c && echo added NetBSD RCS tag to $c 98 ) 99done 100 101find $d -type f -name '*.cpp' -print | while read c; do 102 sed 1q < $c | grep -q '\$NetBSD' || ( 103echo "/* \$NetBSD\$ */" >/tmp/groff3n$$ 104echo "" >>/tmp/groff3n$$ 105cat $c >> /tmp/groff3n$$ 106mv /tmp/groff3n$$ $c && echo added NetBSD RCS tag to $c 107 ) 108done 109 110find $d -type f -name '*.[0-9]' -print | while read m; do 111 sed 1q < $m | grep -q '\$NetBSD' || ( 112echo ".\\\" \$NetBSD\$" >/tmp/groff2m$$ 113echo ".\\\"" >>/tmp/groff2m$$ 114cat $m >> /tmp/groff2m$$ 115mv /tmp/groff2m$$ $m && echo added NetBSD RCS tag to $m 116 ) 117done 118 119find $d -type f -name '*.texi' -print | while read t; do 120 sed "2 s/^/@c \$NetBSD\$\\ 121/" < $t > /tmp/groff4t$$ 122 mv /tmp/groff4t$$ $t && echo added NetBSD RCS tag to $t 123done 124 125echo done 126 127### Clean up any CVS directories that might be around. 128echo "cleaning up CVS residue." 129( 130 cd $d 131 find . -type d -name "CVS" -print | xargs rm -r 132) 133echo done 134 135### Fixing file and directory permissions. 136echo "Fixing file/directory permissions." 137( 138 cd $d 139 find . -type f -print | xargs chmod u+rw,go+r 140 find . -type d -print | xargs chmod u+rwx,go+rx 141) 142echo done 143 144exit 0 145