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