Home | History | Annotate | Line # | Download | only in ntp
      1 #! /bin/sh
      2 #
      3 #	$NetBSD: ntp2netbsd,v 1.10 2024/09/08 10:01:59 rillig Exp $
      4 #
      5 # Copyright (c) 1998, 1999 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 # ntp2netbsd:  convert an ntp source tree into a
     30 # netbsd ntp source tree, under src/dist,
     31 # based on bind2netbsd by Bernd Ernesti
     32 #
     33 # Rough instructions for importing new NTP release:
     34 #
     35 #	$ cd /some/where/temporary
     36 #	$ tar xpfz /new/ntp/release/tar/file
     37 #	$ sh /usr/src/external/bsd/ntp/ntp2netbsd ntp-4.x.y `pwd`
     38 #	$ cd src/external/bsd/ntp/dist
     39 #	$ cvs import src/external/bsd/ntp/dist UDEL ntp-4-x-y
     40 #	$ cd ../../../../../ntp-4.x.y
     41 #	$ run ./configure  --enable-all-clocks --enable-parse-clocks
     42 #	$ echo cp config.h /usr/src/external/bsd/ntp/include
     43 #         - not really - we have some changed defaults and the vax port has no ieee.h support.
     44 #           so do a careful diff and patch - Frank Kardel
     45 #	$ echo cp scripts/build/mkver /usr/src/external/bsd/ntp/scripts
     46 #		merge possible changes to mkver 
     47 #	        our version uses the import date in the file
     48 #               /usr/src/external/bsd/ntp/importdate for the date and buildnumber information
     49 #		to achieve consistent version string over all builds
     50 #	$ cd ..
     51 #	$ rm -r src ntp-4.x.y
     52 #	$ cd dist/ntpd
     53 #	$ cc -DOPENSSL -I../../include keyword-gen.c -I../include -I../libntp/lib/isc/unix/include -I../libntp/lib/isc/include -I../../bin/ntpd/obj.amd64-x86_64 -L../../lib/libntp/obj.amd64-x86_64 -lntp -L../../lib/libisc/obj.amd64-x86_64 -lisc -L/usr/src/external/mit/libuv/lib/obj.amd64-x86_64 -luv -lm -lssl -lcrypto -lutil -lkvm -lexecinfo
     54 #	$ ./a.out ntp_keyword.h > ntp_keyword.h
     55 #	- Rebuild ntp_keywords file since our parser is not bison and the
     56 #	  keyword numbers are different
     57 #	$ cd /usr/src/external/bsd/ntp
     58 #	$ cvs update
     59 #	$ cvs commit -m "Updated autoconf generated files for ntp 4.x.y."
     60 #
     61 #	- check makefiles to see if any extra sources have been added,
     62 #	  esp. libntp and ntpd.
     63 #	- check for and remove img tags in html docs.
     64 #	- update distrib/sets if necessary.
     65 #       - update src/external/bsd/ntp/importdate to match the date of this import
     66 #	- build in the original distribution directory, then copy all the
     67 #	  generated man pages in the respective program directories
     68 #
     69 if [ $# -ne 2 ]; then echo "ntp2netbsd src dest"; exit 1; fi
     70 
     71 r=$1
     72 d=$2/src/external/bsd/ntp/dist
     73 
     74 case "$d" in
     75 	/*)
     76 		;;
     77 	*)
     78 		d=`/bin/pwd`/$d
     79 		;;
     80 esac
     81 
     82 case "$r" in
     83 	/*)
     84 		;;
     85 	*)
     86 		r=`/bin/pwd`/$r
     87 		;;
     88 esac
     89 
     90 echo preparing directory $d
     91 rm -rf $d
     92 mkdir -p $d
     93 
     94 ### Copy the files and directories
     95 echo copying $r to $d
     96 cd $r
     97 pax -rw * $d
     98 
     99 echo removing unneeded directories and files
    100 
    101 ### Remove unneeded directories
    102 cd $d
    103 rm -r ports html/pic
    104 
    105 ### Remove .cvsignore
    106 find $d -name '.cvsignore*' -exec rm {} \;
    107 
    108 ### Remove the $'s around RCS tags
    109 cleantags $d
    110 
    111 ### Add our NetBSD RCS Id
    112 find $d -name '*.[chly]' -print | while read c; do
    113 	sed 1q < $c | grep -q '\$NetBSD' || (
    114 echo "/*	\$NetBSD\$	*/" >/tmp/ntp3n$$
    115 echo "" >>/tmp/ntp3n$$
    116 cat $c  >> /tmp/ntp3n$$
    117 mv /tmp/ntp3n$$ $c && echo added NetBSD RCS tag to $c
    118 	)
    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" -print | xargs rm -r
    128 )
    129 echo done
    130 
    131 ### Fixing file and directory permissions.
    132 echo "Fixing file/directory permissions."
    133 (
    134 	cd $d
    135 	find . -type f -print | xargs chmod u+rw,go+r
    136 	find . -type d -print | xargs chmod u+rwx,go+rx
    137 )
    138 echo done
    139 
    140 exit 0
    141