NetBSD/distrib/sets/sets.subr

207 lines
5.1 KiB
Plaintext

#
# list_set_files setname
#
# Produce a packing list for setname. Each record is a line
# consisting of a path and a System Package name, separated by
# whitespace. E.g.,
#
# ./bin/cp base-util-root
#
# Environment
#
# have_gcc3
# krb
# krb4
# lintlibs
# lkm
# machine
# machine_arch
# machine_cpu
# setd
# shlib
# stlib
# toolchain_missing
#
list_set_files () {
for setname; do
list_set_lists $setname
done | xargs cat | grep -v '^#'
}
#
# list_set_lists setname
#
# Print to stdout a list of files, one filename per line, which
# concatenate to create the packing list for setname. E.g.,
#
# .../lists/base/mi
# .../lists/base/rescue.mi
# .../lists/base/md.i386
# .
# .
# .
#
# In each file, a record consists of a path and a System Package name,
# separated by whitespace. E.g.,
#
# # $NetBSD: sets.subr,v 1.7 2003/12/11 09:46:26 dyoung Exp $
# . base-sys-root
# ./altroot base-sys-root
# ./bin base-sys-root
# ./bin/[ base-util-root
# ./bin/cat base-util-root
# .
# .
# .
#
# A # in the first column marks a comment.
#
# Environment
#
# have_gcc3
# krb
# krb4
# lintlibs
# lkm
# machine
# machine_arch
# machine_cpu
# setd
# shlib
# stlib
# toolchain_missing
#
list_set_lists () {
setname=$1
echo $setd/lists/$setname/mi
if [ "$machine" != "$machine_arch" ]; then
# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
# since the arch-specific one will be more specific than
# the cpu-specific one.
if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
echo $setd/lists/$setname/ad.${machine_arch}
elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
echo $setd/lists/$setname/ad.${machine_cpu}
fi
if [ "$shlib" != "no" -a \
-f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
echo $setd/lists/$setname/ad.${machine_cpu}.shl
fi
fi
if [ -f $setd/lists/$setname/md.${machine}.${machine_arch} ]; then
echo $setd/lists/$setname/md.${machine}.${machine_arch}
elif [ -f $setd/lists/$setname/md.${machine} ]; then
echo $setd/lists/$setname/md.${machine}
fi
if [ -f $setd/lists/$setname/stl.mi ]; then
echo $setd/lists/$setname/stl.mi
fi
if [ -f $setd/lists/$setname/stl.${stlib} ]; then
echo $setd/lists/$setname/stl.${stlib}
fi
if [ "$shlib" != "no" ]; then
if [ -f $setd/lists/$setname/shl.mi ]; then
echo $setd/lists/$setname/shl.mi
fi
if [ -f $setd/lists/$setname/shl.${shlib} ]; then
echo $setd/lists/$setname/shl.${shlib}
fi
if [ "$krb" != "no" -a \
-f $setd/lists/$setname/krb.shl.${shlib} ]; then
echo $setd/lists/$setname/krb.shl.${shlib}
fi
if [ "$krb" != "no" -a "$krb4" != "no" -a \
-f $setd/lists/$setname/krb4.shl.${shlib} ]; then
echo $setd/lists/$setname/krb4.shl.${shlib}
fi
if [ "$krb" != "no" -a -f $setd/lists/$setname/krb.shl.mi ]
then
echo $setd/lists/$setname/krb.shl.mi
fi
if [ "$krb" != "no" -a "$krb4" != "no" -a \
-f $setd/lists/$setname/krb4.shl.mi ]
then
echo $setd/lists/$setname/krb4.shl.mi
fi
fi
if [ "$krb" != "no" -a -f $setd/lists/$setname/krb.mi ]; then
echo $setd/lists/$setname/krb.mi
fi
if [ "$krb" != "no" -a "$krb4" != "no" -a \
-f $setd/lists/$setname/krb4.mi ]; then
echo $setd/lists/$setname/krb4.mi
fi
if [ "$lkm" != "no" ]; then
if [ -f $setd/lists/$setname/lkm.mi ]; then
echo $setd/lists/$setname/lkm.mi
fi
fi
if [ "$lintlibs" != no ]; then
if [ -f $setd/lists/$setname/lint.mi ]; then
echo $setd/lists/$setname/lint.mi
fi
if [ "$krb" != "no" -a "$krb4" != "no" -a \
-f $setd/lists/$setname/krb4.lint.mi ]
then
echo $setd/lists/$setname/krb4.lint.mi
fi
if [ "$krb" != "no" -a -f $setd/lists/$setname/krb.lint.mi ]
then
echo $setd/lists/$setname/krb.lint.mi
fi
fi
if [ "$toolchain_missing" != "yes" ]; then
if [ "$have_gcc3" = "yes" ]; then
if [ -f $setd/lists/$setname/gcc.mi ]; then
echo $setd/lists/$setname/gcc.mi
fi
if [ "$shlib" != "no" ]; then
if [ -f $setd/lists/$setname/gcc.shl ]; then
echo $setd/lists/$setname/gcc.shl
fi
fi
else
if [ -f $setd/lists/$setname/tc.mi ]; then
echo $setd/lists/$setname/tc.mi
fi
if [ "$shlib" != "no" ]; then
if [ -f $setd/lists/$setname/tc.shl ]; then
echo $setd/lists/$setname/tc.shl
fi
fi
fi
fi
if [ -f $setd/lists/$setname/rescue.mi ]; then
echo $setd/lists/$setname/rescue.mi
fi
if [ -f $setd/lists/$setname/rescue.${machine} ]; then
echo $setd/lists/$setname/rescue.${machine}
fi
if [ "$machine" != "$machine_arch" ]; then
# Prefer a rescue.ad.${machine_arch} over a
# rescue.ad.${machine_cpu}, since the arch-
# specific one will be more specific than the
# cpu-specific one.
if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
echo $setd/lists/$setname/rescue.ad.${machine_arch}
elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
echo $setd/lists/$setname/rescue.ad.${machine_cpu}
fi
if [ "$shlib" != "no" -a -f \
$setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
echo $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
fi
fi
}
arch_to_cpu () {
MACHINE_ARCH=${1} ${MAKE:-make} -f- all <<EOF
.include <bsd.own.mk>
all:
@echo \${MACHINE_CPU}
EOF
}