NetBSD/distrib/sets/makeobsolete
dyoung 17b5668ccd Factor duplicated code for setting variables such as machine_cpu
and machine_arch to their defaults into sets.defaults, and source
it at the top of each script.

Also, to be consistent with variable naming, s/arch/machine_arch/.

sets.defaults introduces two new variables, krb and krb4, which
will affect whether Kerberos- or Kerberos IV-only files are put
into the set lists.
2003-11-25 07:19:46 +00:00

108 lines
2.2 KiB
Bash
Executable File

#!/bin/sh
#
# $NetBSD: makeobsolete,v 1.19 2003/11/25 07:19:46 dyoung Exp $
#
# Print out the obsolete files for a set
# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
# [-t target] [setname ...]
#
# set defaults
. $(dirname $0)/sets.defaults
setd=`pwd`
nlists="base comp etc games man misc text"
xlists="xbase xcomp xcontrib xfont xserver xmisc"
lists=$nlists
target=./dist
# handle args
while : ; do
case $1 in
-b*)
lists="$xlists $nlists"
;;
-x*)
lists=$xlists;;
-a*)
machine_arch=$2; shift
;;
-m*)
machine=$2; shift
;;
-s*)
setd=$2; shift
;;
-t*)
target=$2;shift
;;
-*)
cat 1>&2 <<USAGE
Usage: $0 [-a arch] [-m machine] [-s setsdir] [setname ...]
-b make netbsd + x11 lists
-x only make x11 lists
-a arch set arch (e.g, m68k, mips, powerpc) [$machine_arch]
-m machine set machine (e.g, amiga, i386, macppc) [$machine]
-s setsdir directory to find sets [$setd]
-t target target directory [$target]
[setname ...] sets to build
USAGE
exit 1
;;
*)
break
;;
esac
shift
done
if [ -n "$1" ]; then
lists="$*"
fi
# Convert mipse[lb] to mips after processing command line arguments.
machine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,`
if [ ! -d $target ] ; then
echo "target directory [$target] doesn't exist"
exit 1
fi
# Automatically add XFree86 version specific sets
for list in $lists
do
if [ -z "$_lists" ]
then
_lists=$list
else
_lists="$_lists $list"
fi
if [ -d "$setd/lists/$list${x11_version}" ]
then
_lists="$_lists $list${x11_version}"
fi
done
lists=$_lists
unset _lists
for setname in $lists; do
file=$target/${setname}
(
if [ -f $setd/lists/$setname/obsolete.mi ]; then
awk -- '{print $1}' $setd/lists/$setname/obsolete.mi
fi
if [ "$machine" != "$cpu" -a \
-f $setd/lists/$setname/obsolete.${machine_arch} ]; then
awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine_arch}
fi
if [ -f $setd/lists/$setname/obsolete.${machine} ]; then
awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine}
fi
if [ "$have_gcc3" = yes -a -f $setd/lists/$setname/obsolete.gcc ]; then
awk -- '{print $1}' $setd/lists/$setname/obsolete.gcc
fi
) | egrep -v '^#' | sort -ru > $file
if [ ! -s $file ] ; then
rm $file
fi
done