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