3 # $NetBSD: groff2netbsd,v 1.3 2004/07/30 15:29:45 wiz Exp $
5 # Copyright (c) 2001-2003 The NetBSD Foundation, Inc.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
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.
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.
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
33 # Rough instructions for importing new groff release:
35 # $ cd /some/where/temporary
36 # $ tar xpfz /new/groff/release/tar/file
37 # $ sh /usr/src/gnu/dist/groff/groff2netbsd groff-1.x.y `pwd`
38 # $ cd src/gnu/dist/groff
39 # $ cvs import -m "Import groff 1.x.y" src/gnu/dist/groff 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
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
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."
52 # - check makefiles to see if any extra sources have been added.
53 # - update distrib/sets if necessary.
55 if [ $# -ne 2 ]; then echo "groff2netbsd src dest"; exit 1; fi
58 d
=$2/src
/gnu
/dist
/groff
76 echo preparing directory
$d
80 ### Copy the files and directories
85 # cd to import directory
88 ### Remove the $'s around RCS tags
89 find $d -type f
-print |
xargs egrep -l '\$(Id|Created|Header|NetBSD|Revision)' |
while read f
; do
90 sed -e 's/\$\(Id.*\) \$/\1/' \
91 -e 's/\$\(Created.*\) \$/\1/' \
92 -e 's/\$\(Header.*\) \$/\1/' \
93 -e 's/\$\(NetBSD.*\) \$/\1/' \
94 -e 's/\$\(Revision.*\) \$/\1/' \
95 $f > /tmp
/groff1f$$
&& mv /tmp
/groff1f$$
$f && \
96 echo removed RCS tag from
$f
99 ### Add our NetBSD RCS Id
100 find $d -type f
-name '*.[chly]' -print |
while read c
; do
101 sed 1q
< $c |
grep -q '\$NetBSD' ||
(
102 echo "/* \$NetBSD\$ */" >/tmp
/groff3n$$
103 echo "" >>/tmp
/groff3n$$
104 cat $c >> /tmp
/groff3n$$
105 mv /tmp
/groff3n$$
$c && echo added NetBSD RCS tag to
$c
109 find $d -type f
-name '*.cpp' -print |
while read c
; do
110 sed 1q
< $c |
grep -q '\$NetBSD' ||
(
111 echo "/* \$NetBSD\$ */" >/tmp
/groff3n$$
112 echo "" >>/tmp
/groff3n$$
113 cat $c >> /tmp
/groff3n$$
114 mv /tmp
/groff3n$$
$c && echo added NetBSD RCS tag to
$c
118 find $d -type f
-name '*.[0-9]' -print |
while read m
; do
119 sed 1q
< $m |
grep -q '\$NetBSD' ||
(
120 echo ".\\\" \$NetBSD\$" >/tmp
/groff2m$$
121 echo ".\\\"" >>/tmp
/groff2m$$
122 cat $m >> /tmp
/groff2m$$
123 mv /tmp
/groff2m$$
$m && echo added NetBSD RCS tag to
$m
127 find $d -type f
-name '*.texi' -print |
while read t
; do
128 sed "2 s/^/@c \$NetBSD\$\\
129 /" < $t > /tmp
/groff4t$$
130 mv /tmp
/groff4t$$
$t && echo added NetBSD RCS tag to
$t
135 ### Clean up any CVS directories that might be around.
136 echo "cleaning up CVS residue."
139 find .
-type d
-name "CVS" -print |
xargs rm -r
143 ### Fixing file and directory permissions.
144 echo "Fixing file/directory permissions."
147 find .
-type f
-print |
xargs chmod u
+rw
,go
+r
148 find .
-type d
-print |
xargs chmod u
+rwx
,go
+rx