makeobsolete revision 1.20
1#!/bin/sh
2#
3# $NetBSD: makeobsolete,v 1.20 2003/12/09 17:57:42 matt Exp $
4#
5# Print out the obsolete files for a set
6# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
7#    [-t target] [setname ...]
8#
9
10# set defaults
11. $(dirname $0)/sets.defaults
12setd=`pwd`
13nlists="base comp etc games man misc text"
14xlists="xbase xcomp xcontrib xfont xserver xmisc"
15lists=$nlists
16target=./dist
17
18# handle args
19while : ; do
20	case $1 in
21	-b*)
22		lists="$xlists $nlists"
23		;;
24	-x*)
25		lists=$xlists;;
26	-a*)
27		machine_arch=$2; shift
28		;;
29	-m*)
30		machine=$2; shift
31		;;
32	-s*)
33		setd=$2; shift
34		;;
35	-t*)
36		target=$2;shift
37		;;
38	-*)
39		cat 1>&2 <<USAGE
40Usage: $0 [-a arch] [-m machine] [-s setsdir] [setname ...]
41	-b		make netbsd + x11 lists
42	-x 		only make x11 lists
43	-a arch		set arch (e.g, m68k, mips, powerpc)	[$machine_arch]
44	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
45	-s setsdir	directory to find sets	[$setd]
46	-t target	target directory [$target]
47	[setname ...] 	sets to build
48USAGE
49		exit 1
50		;;
51	*)
52		break
53		;;
54	esac
55	shift
56done
57if [ -n "$1" ]; then
58	lists="$*"
59fi
60
61# Convert mipse[lb] to mips after processing command line arguments.
62machine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,`
63
64if [ ! -d $target ] ; then
65	echo "target directory [$target] doesn't exist"
66	exit 1
67fi
68
69# Automatically add XFree86 version specific sets
70for list in $lists
71do
72 if [ -z "$_lists" ]
73 then
74  _lists=$list
75 else
76  _lists="$_lists $list"
77 fi
78 if [ -d "$setd/lists/$list${x11_version}" ]
79 then
80  _lists="$_lists $list${x11_version}"
81 fi
82done
83lists=$_lists
84unset _lists
85
86for setname in $lists; do
87	file=$target/${setname}
88	(
89	if [ -f $setd/lists/$setname/obsolete.mi ]; then
90		awk -- '{print $1}' $setd/lists/$setname/obsolete.mi
91	fi
92	if [ "$machine" != "$cpu" -a \
93	    -f $setd/lists/$setname/obsolete.${machine_arch} ]; then
94		awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine_arch}
95	fi
96	if [ -f $setd/lists/$setname/obsolete.${machine} ]; then
97		awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine}
98	fi
99	if [ "$use_tools_toolchain" != yes -a \
100	    -f $setd/lists/$setname/obsolete.gcc ]; then
101		awk -- '{print $1}' $setd/lists/$setname/obsolete.gcc
102	fi
103	) | egrep -v '^#' | sort -ru > $file
104	if [ ! -s $file ] ; then
105		rm $file
106	fi
107
108done
109