xref: /netbsd-src/external/bsd/flex/flex2netbsd (revision c232f289ed172ffcad43649d76fba38dbb6e7c3e)
1c2f95008Schristos#! /bin/sh
2c2f95008Schristos#
3*c232f289Srillig#	$NetBSD: flex2netbsd,v 1.6 2024/09/08 10:01:58 rillig Exp $
4c2f95008Schristos#
5c2f95008Schristos# Copyright (c) 2000 The NetBSD Foundation, Inc.
6c2f95008Schristos# All rights reserved.
7c2f95008Schristos#
8c2f95008Schristos# Redistribution and use in source and binary forms, with or without
9c2f95008Schristos# modification, are permitted provided that the following conditions
10c2f95008Schristos# are met:
11c2f95008Schristos# 1. Redistributions of source code must retain the above copyright
12c2f95008Schristos#    notice, this list of conditions and the following disclaimer.
13c2f95008Schristos# 2. Redistributions in binary form must reproduce the above copyright
14c2f95008Schristos#    notice, this list of conditions and the following disclaimer in the
15c2f95008Schristos#    documentation and/or other materials provided with the distribution.
16c2f95008Schristos#
17c2f95008Schristos# THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
18c2f95008Schristos# ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
19c2f95008Schristos# TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
20c2f95008Schristos# PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
21c2f95008Schristos# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
22c2f95008Schristos# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23c2f95008Schristos# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24c2f95008Schristos# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25c2f95008Schristos# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26c2f95008Schristos# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27c2f95008Schristos# POSSIBILITY OF SUCH DAMAGE.
28c2f95008Schristos#
29*c232f289Srillig# flex2netbsd:  convert a flex source tree into a
30c2f95008Schristos# netbsd flex source tree, under src/external/bsd/flex/dist,
31c2f95008Schristos# based on flex2netbsd by Bernd Ernesti and changes by Simon Burge
32c2f95008Schristos#
33c2f95008Schristos# Rough instructions for importing new flex release:
34c2f95008Schristos#
35c2f95008Schristos#	$ cd /some/where/temporary
36c2f95008Schristos#	$ tar xpfz /new/flex/release/tar/file
37a11deec2Schristos#	$ sh /usr/src/external/bsd/flex/dist/flex2netbsd flex-2.6.x
38a11deec2Schristos#	$ cd flex-2.6.x
39a11deec2Schristos#	$ cvs import -m "Import flex 2.6.x" src/external/bsd/flex/dist FLEX flex-2-6-x
40c2f95008Schristos#	$ run ./configure
41c2f95008Schristos#	$ run make
42c2f95008Schristos#	check the config file and copy it to /usr/src/external/bsd/flex/include
43c2f95008Schristos#	check the manual page against our copy if there are new options and
44c2f95008Schristos#	update
4519618145Schristos#	build the initparse.c and initscan.c without line numbers in src/dist
4619618145Schristos#	and commit them:
4719618145Schristos#       - nbyacc -l -d -o initparse.c parse.y
4819618145Schristos#	- nblex -L -t -p scan.l > initscan.c
4919618145Schristos
50c2f95008Schristos
51b17953c2Schristosif [ $# -ne 1 ]; then echo "flex2netbsd src"; exit 1; fi
52c2f95008Schristos
53c2f95008Schristosr=$1
54c2f95008Schristos
55c2f95008Schristoscase "$r" in
56c2f95008Schristos	/*)
57c2f95008Schristos		;;
58c2f95008Schristos	*)
59c2f95008Schristos		r=`/bin/pwd`/$r
60c2f95008Schristos		;;
61c2f95008Schristosesac
62c2f95008Schristos
63b17953c2Schristoscd "$r"
64c2f95008Schristos
65c2f95008Schristos### Remove the $'s around RCS tags
66b17953c2Schristoscleantags .
67c2f95008Schristos
68c2f95008Schristosexit 0
69