makeobsolete revision 1.19 1 #!/bin/sh
2 #
3 # $NetBSD: makeobsolete,v 1.19 2003/11/25 07:19:46 dyoung 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
12 setd=`pwd`
13 nlists="base comp etc games man misc text"
14 xlists="xbase xcomp xcontrib xfont xserver xmisc"
15 lists=$nlists
16 target=./dist
17
18 # handle args
19 while : ; 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
40 Usage: $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
48 USAGE
49 exit 1
50 ;;
51 *)
52 break
53 ;;
54 esac
55 shift
56 done
57 if [ -n "$1" ]; then
58 lists="$*"
59 fi
60
61 # Convert mipse[lb] to mips after processing command line arguments.
62 machine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,`
63
64 if [ ! -d $target ] ; then
65 echo "target directory [$target] doesn't exist"
66 exit 1
67 fi
68
69 # Automatically add XFree86 version specific sets
70 for list in $lists
71 do
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
82 done
83 lists=$_lists
84 unset _lists
85
86 for 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 [ "$have_gcc3" = yes -a -f $setd/lists/$setname/obsolete.gcc ]; then
100 awk -- '{print $1}' $setd/lists/$setname/obsolete.gcc
101 fi
102 ) | egrep -v '^#' | sort -ru > $file
103 if [ ! -s $file ] ; then
104 rm $file
105 fi
106
107 done
108