makeobsolete revision 1.19
11.1Sbouyer#!/bin/sh
21.1Sbouyer#
31.19Sdyoung# $NetBSD: makeobsolete,v 1.19 2003/11/25 07:19:46 dyoung Exp $
41.1Sbouyer#
51.1Sbouyer# Print out the obsolete files for a set
61.1Sbouyer# Usage: makeobsolete [-b] [-x] [-a arch] [-m machine] [-s setsdir] \
71.1Sbouyer#    [-t target] [setname ...]
81.1Sbouyer#
91.1Sbouyer
101.1Sbouyer# set defaults
111.19Sdyoung. $(dirname $0)/sets.defaults
121.1Sbouyersetd=`pwd`
131.7Swiznlists="base comp etc games man misc text"
141.10Stronxlists="xbase xcomp xcontrib xfont xserver xmisc"
151.1Sbouyerlists=$nlists
161.1Sbouyertarget=./dist
171.1Sbouyer
181.1Sbouyer# handle args
191.1Sbouyerwhile : ; do
201.1Sbouyer	case $1 in
211.1Sbouyer	-b*)
221.1Sbouyer		lists="$xlists $nlists"
231.1Sbouyer		;;
241.1Sbouyer	-x*)
251.1Sbouyer		lists=$xlists;;
261.1Sbouyer	-a*)
271.19Sdyoung		machine_arch=$2; shift
281.1Sbouyer		;;
291.1Sbouyer	-m*)
301.1Sbouyer		machine=$2; shift
311.1Sbouyer		;;
321.1Sbouyer	-s*)
331.1Sbouyer		setd=$2; shift
341.1Sbouyer		;;
351.1Sbouyer	-t*)
361.1Sbouyer		target=$2;shift
371.1Sbouyer		;;
381.1Sbouyer	-*)
391.1Sbouyer		cat 1>&2 <<USAGE
401.1SbouyerUsage: $0 [-a arch] [-m machine] [-s setsdir] [setname ...]
411.1Sbouyer	-b		make netbsd + x11 lists
421.1Sbouyer	-x 		only make x11 lists
431.19Sdyoung	-a arch		set arch (e.g, m68k, mips, powerpc)	[$machine_arch]
441.1Sbouyer	-m machine	set machine (e.g, amiga, i386, macppc)	[$machine]
451.1Sbouyer	-s setsdir	directory to find sets	[$setd]
461.1Sbouyer	-t target	target directory [$target]
471.1Sbouyer	[setname ...] 	sets to build
481.1SbouyerUSAGE
491.1Sbouyer		exit 1
501.1Sbouyer		;;
511.1Sbouyer	*)
521.1Sbouyer		break
531.1Sbouyer		;;
541.1Sbouyer	esac
551.1Sbouyer	shift
561.1Sbouyerdone
571.1Sbouyerif [ -n "$1" ]; then
581.1Sbouyer	lists="$*"
591.1Sbouyerfi
601.1Sbouyer
611.1Sbouyer# Convert mipse[lb] to mips after processing command line arguments.
621.19Sdyoungmachine_arch=`echo $machine_arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,`
631.1Sbouyer
641.1Sbouyerif [ ! -d $target ] ; then
651.14Slukem	echo "target directory [$target] doesn't exist"
661.1Sbouyer	exit 1
671.1Sbouyerfi
681.10Stron
691.10Stron# Automatically add XFree86 version specific sets
701.10Stronfor list in $lists
711.10Strondo
721.10Stron if [ -z "$_lists" ]
731.10Stron then
741.10Stron  _lists=$list
751.10Stron else
761.10Stron  _lists="$_lists $list"
771.10Stron fi
781.10Stron if [ -d "$setd/lists/$list${x11_version}" ]
791.10Stron then
801.10Stron  _lists="$_lists $list${x11_version}"
811.10Stron fi
821.10Strondone
831.10Stronlists=$_lists
841.10Stronunset _lists
851.1Sbouyer
861.1Sbouyerfor setname in $lists; do
871.17Slukem	file=$target/${setname}
881.1Sbouyer	(
891.1Sbouyer	if [ -f $setd/lists/$setname/obsolete.mi ]; then
901.2Sjwise		awk -- '{print $1}' $setd/lists/$setname/obsolete.mi
911.1Sbouyer	fi
921.1Sbouyer	if [ "$machine" != "$cpu" -a \
931.19Sdyoung	    -f $setd/lists/$setname/obsolete.${machine_arch} ]; then
941.19Sdyoung		awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine_arch}
951.1Sbouyer	fi
961.1Sbouyer	if [ -f $setd/lists/$setname/obsolete.${machine} ]; then
971.2Sjwise		awk -- '{print $1}' $setd/lists/$setname/obsolete.${machine}
981.18Stron	fi
991.18Stron	if [ "$have_gcc3" = yes -a -f $setd/lists/$setname/obsolete.gcc ]; then
1001.18Stron		awk -- '{print $1}' $setd/lists/$setname/obsolete.gcc
1011.13Slukem	fi
1021.13Slukem	) | egrep -v '^#' | sort -ru > $file
1031.1Sbouyer	if [ ! -s $file ] ; then
1041.1Sbouyer		rm $file
1051.1Sbouyer	fi
1061.1Sbouyer
1071.13Slukemdone
108