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