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} 12machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | $MAKE -s -f-`} 13arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | $MAKE -s -f-`} 14setd=`pwd` 15nlists="base comp etc games man misc text" 16xlists="xbase xcomp xcontrib xfont xserver xmisc" 17lists=$nlists 18target=./dist 19 20# handle args 21while : ; 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 42Usage: $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 50USAGE 51 exit 1 52 ;; 53 *) 54 break 55 ;; 56 esac 57 shift 58done 59if [ -n "$1" ]; then 60 lists="$*" 61fi 62 63# Convert mipse[lb] to mips after processing command line arguments. 64arch=`echo $arch | sed s,^mipse.,mips, | sed s,^sh3e.,sh3e,` 65 66if [ ! -d $target ] ; then 67 echo "target directory [$target] doesn't exists" 68 exit 1 69fi 70 71# Automatically add XFree86 version specific sets 72for list in $lists 73do 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 84done 85lists=$_lists 86unset _lists 87 88for 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 105done | egrep -v '^#' | sort -ru 106