sets.subr revision 1.37
11.37She# $NetBSD: sets.subr,v 1.37 2005/01/10 00:20:21 he Exp $ 21.1Sdyoung# 31.9Slukem 41.9Slukem# 51.11Slukem# The following variables contain defaults for sets.subr functions and callers: 61.9Slukem# setsdir path to src/distrib/sets 71.9Slukem# nlists list of base sets 81.9Slukem# xlists list of x11 sets 91.9Slukem# obsolete controls if obsolete files are selected instead 101.9Slukem# lkm if != "no", enable LKM sets 111.9Slukem# shlib shared library format (a.out, elf, or "") 121.9Slukem# stlib static library format (a.out, elf) 131.20Slukem# x11_version version of XFree86. one of: 141.20Slukem# "" cross built from src/x11 151.20Slukem# 3 XFree86 3.x from xsrc/xc 161.20Slukem# 4 XFree86 4.x from xsrc/xfree/xc 171.11Slukem# 181.11Slukem# The following <bsd.own.mk> variables are exported to the environment: 191.11Slukem# MACHINE 201.11Slukem# MACHINE_ARCH 211.11Slukem# MACHINE_CPU 221.11Slukem# HAVE_GCC3 231.11Slukem# TOOLCHAIN_MISSING 241.11Slukem# OBJECT_FMT 251.22Slukem# as well as: 261.22Slukem# 271.22SlukemMKVARS="\ 281.22Slukem MKBFD \ 291.22Slukem MKCATPAGES \ 301.22Slukem MKCRYPTO \ 311.22Slukem MKCRYPTO_IDEA \ 321.22Slukem MKCRYPTO_MDC2 \ 331.22Slukem MKCRYPTO_RC5 \ 341.22Slukem MKCVS \ 351.36Smatt MKGCCCMDS \ 361.23Slukem MKDOC \ 371.32Sscw MKGDB \ 381.22Slukem MKHESIOD \ 391.23Slukem MKINFO \ 401.22Slukem MKKERBEROS \ 411.22Slukem MKKERBEROS4 \ 421.22Slukem MKLINT \ 431.22Slukem MKMAN \ 441.33Sjmc MKMANPAGES \ 451.22Slukem MKMANZ \ 461.23Slukem MKNLS \ 471.37She MKPAM \ 481.30Smatt MKPIC \ 491.22Slukem MKPOSTFIX \ 501.22Slukem MKPROFILE \ 511.22Slukem MKSENDMAIL \ 521.24Slukem MKSHARE \ 531.22Slukem MKSKEY \ 541.25Slukem MKUUCP \ 551.22Slukem MKYP \ 561.22Slukem" 571.12Slukem 581.9SlukemoIFS=$IFS 591.9SlukemIFS=" 601.9Slukem" 611.9Slukemfor x in $( 621.12Slukem${MAKE:-make} -B -f- all <<EOMAKE 631.9Slukem.include <bsd.own.mk> 641.33Sjmc.if (\${MKMAN} == "no" || empty(MANINSTALL:Mmaninstall)) 651.33SjmcMKMANPAGES=no 661.33Sjmc.else 671.33SjmcMKMANPAGES=yes 681.33Sjmc.endif 691.9Slukemall: 701.11Slukem.for i in MACHINE MACHINE_ARCH MACHINE_CPU \ 711.11Slukem HAVE_GCC3 OBJECT_FMT TOOLCHAIN_MISSING \ 721.12Slukem ${MKVARS} 731.12Slukem @echo "export \$i=\${\$i}" 741.11Slukem.endfor 751.20Slukem.if (\${MKX11:Uno} != "no") 761.20Slukem @echo x11_version="" 771.35Stron.else 781.9Slukem @echo x11_version=4 791.9Slukem.endif 801.9Slukem 811.12SlukemEOMAKE 821.9Slukem); do 831.11Slukem# echo 1>&2 "DEBUG: read $x" 841.9Slukem eval $x 851.9Slukemdone 861.9SlukemIFS=$oIFS 871.9Slukem 881.34Serhsetsdir=${0%/*} 891.9Slukemnlists="base comp etc games man misc text" 901.9Slukemcase $x11_version in 911.20Slukem3) xlists="xbase3 xcomp3 xcontrib3 xfont3 xmisc3 xserver3" ;; 921.20Slukem4) xlists="xbase4 xcomp4 xcontrib4 xfont4 xmisc4 xserver4" ;; 931.28Slukem"") xlists="xbase xcomp xetc xfont xserver" ;; 941.20Slukem*) xlists="" ;; # unknown! 951.9Slukemesac 961.9Slukemobsolete=0 971.9Slukemlkm=yes 981.11Slukemif [ "${MACHINE}" = "evbppc" ]; then 991.9Slukem lkm=no # Turn off LKMs for some ports. 1001.9Slukemfi 1011.31Sjmc# Determine lib type. Do this first so stlib also gets set. 1021.31Sjmcif [ "${OBJECT_FMT}" = "ELF" ]; then 1031.9Slukem shlib=elf 1041.9Slukemelse 1051.9Slukem shlib=aout 1061.9Slukemfi 1071.9Slukemstlib=$shlib 1081.31Sjmc# Now check for MKPIC or specials and turn off shlib if need be. 1091.31Sjmcif [ "${MKPIC}" = "no" ]; then 1101.31Sjmc shlib=no 1111.31Sjmcfi 1121.29Suweif [ "${MACHINE_ARCH}" = "m68000" ]; then 1131.9Slukem shlib=no # Turn off shlibs for some ports. 1141.9Slukemfi 1151.9Slukem 1161.9Slukem# 1171.9Slukem# list_set_files setfile [...] 1181.1Sdyoung# 1191.9Slukem# Produce a packing list for setfile(s). 1201.9Slukem# In each file, a record consists of a path and a System Package name, 1211.9Slukem# separated by whitespace. E.g., 1221.9Slukem# 1231.37She# # $NetBSD: sets.subr,v 1.37 2005/01/10 00:20:21 he Exp $ 1241.9Slukem# . base-sys-root [keyword[,...]] 1251.9Slukem# ./altroot base-sys-root 1261.9Slukem# ./bin base-sys-root 1271.9Slukem# ./bin/[ base-util-root 1281.9Slukem# ./bin/cat base-util-root 1291.9Slukem# [...] 1301.9Slukem# 1311.9Slukem# A # in the first column marks a comment. 1321.9Slukem# 1331.9Slukem# If ${obsolete} != 0, only entries with an "obsolete" keyword will 1341.9Slukem# be printed. 1351.9Slukem# 1361.9Slukem# The third field is an optional comma separated list of keywords to 1371.9Slukem# control if a record is printed; every keyword listed must be enabled 1381.9Slukem# for the record to be printed. The following keywords are available: 1391.9Slukem# dummy dummy entry (ignored) 1401.13Slukem# obsolete file is obsolete, and only printed if 1411.13Slukem# ${obsolete} != 0 1421.13Slukem# 1431.22Slukem# bfd ${MKBFD} != no 1441.22Slukem# catpages ${MKCATPAGES} != no 1451.22Slukem# crypto ${MKCRYPTO} != no 1461.22Slukem# crypto_idea ${MKCRYPTO_IDEA} != no 1471.22Slukem# crypto_mdc2 ${MKCRYPTO_MDC2} != no 1481.22Slukem# crypto_rc5 ${MKCRYPTO_RC5} != no 1491.22Slukem# cvs ${MKCVS} != no 1501.23Slukem# doc ${MKDOC} != no 1511.36Smatt# gcccmds ${MKGCCCMDS} != no 1521.32Sscw# gdb ${MKGDB} != no 1531.22Slukem# hesiod ${MKHESIOD} != no 1541.23Slukem# info ${MKINFO} != no 1551.22Slukem# kerberos ${MKKERBEROS} != no 1561.22Slukem# kerberos4 ${MKKERBEROS4} != no 1571.22Slukem# lint ${MKLINT} != no 1581.22Slukem# man ${MKMAN} != no 1591.22Slukem# manz ${MKMANZ} != no 1601.23Slukem# nls ${MKNLS} != no 1611.37She# pam ${MKPAM} != no 1621.22Slukem# postfix ${MKPOSTFIX} != no 1631.22Slukem# profile ${MKPROFILE} != no 1641.22Slukem# sendmail ${MKSENDMAIL} != no 1651.24Slukem# share ${MKSHARE} != no 1661.22Slukem# skey ${MKSKEY} != no 1671.25Slukem# uucp ${MKUUCP} != no 1681.22Slukem# yp ${MKYP} != no 1691.22Slukem# 1701.22Slukem# .cat if ${MKMANZ} != "no" && ${MKCATPAGES} != "no" 1711.22Slukem# automatically append ".gz" to the filename 1721.22Slukem# 1731.22Slukem# .man if ${MKMANZ} != "no" && ${MKMAN} != "no" 1741.22Slukem# automatically append ".gz" to the filename 1751.1Sdyoung# 1761.8Slukemlist_set_files() 1771.8Slukem{ 1781.1Sdyoung for setname; do 1791.1Sdyoung list_set_lists $setname 1801.9Slukem done | xargs cat | \ 1811.11Slukem awk -v obsolete=${obsolete} ' 1821.9Slukem BEGIN { 1831.9Slukem if (! obsolete) { 1841.12Slukem split("'"${MKVARS}"'", needvars) 1851.9Slukem for (vi in needvars) { 1861.9Slukem nv = needvars[vi] 1871.12Slukem kw = tolower(substr(nv, 3)) 1881.12Slukem if (ENVIRON[nv] != "no") 1891.12Slukem wanted[kw] = 1 1901.9Slukem } 1911.33Sjmc if (("man" in wanted) && ("catpages" in wanted)) 1921.22Slukem wanted[".cat"] = 1 1931.33Sjmc if (("man" in wanted) && ("manpages" in wanted)) 1941.22Slukem wanted[".man"] = 1 1951.9Slukem } 1961.9Slukem } 1971.9Slukem 1981.9Slukem /^#/ { 1991.9Slukem next; 2001.9Slukem } 2011.9Slukem 2021.9Slukem NF > 2 && $3 != "-" { 2031.9Slukem split($3, keywords, ",") 2041.9Slukem show = 1 2051.9Slukem for (ki in keywords) { 2061.9Slukem kw = keywords[ki] 2071.9Slukem if (kw == "obsolete") { 2081.9Slukem if (obsolete) 2091.9Slukem print 2101.9Slukem next 2111.9Slukem } 2121.22Slukem if (("manz" in wanted) && 2131.22Slukem (kw == ".cat" || kw == ".man")) 2141.22Slukem $1 = $1 ".gz" 2151.9Slukem if (! (kw in wanted)) 2161.9Slukem show = 0 2171.9Slukem } 2181.9Slukem if (show) 2191.9Slukem print 2201.9Slukem next 2211.9Slukem } 2221.9Slukem 2231.9Slukem { 2241.9Slukem if (! obsolete) 2251.9Slukem print 2261.9Slukem }' 2271.9Slukem 2281.1Sdyoung} 2291.1Sdyoung 2301.1Sdyoung# 2311.1Sdyoung# list_set_lists setname 2321.1Sdyoung# 2331.1Sdyoung# Print to stdout a list of files, one filename per line, which 2341.1Sdyoung# concatenate to create the packing list for setname. E.g., 2351.1Sdyoung# 2361.1Sdyoung# .../lists/base/mi 2371.1Sdyoung# .../lists/base/rescue.mi 2381.1Sdyoung# .../lists/base/md.i386 2391.9Slukem# [...] 2401.1Sdyoung# 2411.9Slukem# For a given setname $set, the following files may be selected from 2421.9Slukem# .../list/$set: 2431.9Slukem# mi 2441.11Slukem# ad.${MACHINE_ARCH} 2451.11Slukem# (or) ad.${MACHINE_CPU} 2461.11Slukem# ad.${MACHINE_CPU}.shl 2471.11Slukem# md.${MACHINE}.${MACHINE_ARCH} 2481.11Slukem# (or) md.${MACHINE} 2491.9Slukem# stl.mi 2501.9Slukem# stl.stlib 2511.9Slukem# shl.mi 2521.9Slukem# shl.shlib 2531.9Slukem# lkm.mi if ${lkm} != no 2541.9Slukem# gcc.mi 2551.9Slukem# gcc.shl 2561.9Slukem# tc.mi 2571.9Slukem# tc.shl 2581.9Slukem# rescue.shl 2591.11Slukem# rescue.${MACHINE} 2601.11Slukem# rescue.ad.${MACHINE_ARCH} 2611.11Slukem# (or) rescue.ad.${MACHINE_CPU} 2621.11Slukem# rescue.ad.${MACHINE_CPU}.shl 2631.1Sdyoung# 2641.9Slukem# Environment: 2651.1Sdyoung# shlib 2661.1Sdyoung# stlib 2671.1Sdyoung# 2681.8Slukemlist_set_lists() 2691.8Slukem{ 2701.1Sdyoung setname=$1 2711.1Sdyoung 2721.9Slukem setdir=$setsdir/lists/$setname 2731.9Slukem echo $setdir/mi 2741.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 2751.11Slukem # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, 2761.1Sdyoung # since the arch-specific one will be more specific than 2771.1Sdyoung # the cpu-specific one. 2781.11Slukem if [ -f $setdir/ad.${MACHINE_ARCH} ]; then 2791.11Slukem echo $setdir/ad.${MACHINE_ARCH} 2801.11Slukem elif [ -f $setdir/ad.${MACHINE_CPU} ]; then 2811.11Slukem echo $setdir/ad.${MACHINE_CPU} 2821.1Sdyoung fi 2831.1Sdyoung if [ "$shlib" != "no" -a \ 2841.11Slukem -f $setdir/ad.${MACHINE_CPU}.shl ]; then 2851.11Slukem echo $setdir/ad.${MACHINE_CPU}.shl 2861.1Sdyoung fi 2871.1Sdyoung fi 2881.11Slukem if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then 2891.11Slukem echo $setdir/md.${MACHINE}.${MACHINE_ARCH} 2901.11Slukem elif [ -f $setdir/md.${MACHINE} ]; then 2911.11Slukem echo $setdir/md.${MACHINE} 2921.1Sdyoung fi 2931.9Slukem if [ -f $setdir/stl.mi ]; then 2941.9Slukem echo $setdir/stl.mi 2951.1Sdyoung fi 2961.9Slukem if [ -f $setdir/stl.${stlib} ]; then 2971.9Slukem echo $setdir/stl.${stlib} 2981.1Sdyoung fi 2991.1Sdyoung if [ "$shlib" != "no" ]; then 3001.9Slukem if [ -f $setdir/shl.mi ]; then 3011.9Slukem echo $setdir/shl.mi 3021.7Sdyoung fi 3031.9Slukem if [ -f $setdir/shl.${shlib} ]; then 3041.9Slukem echo $setdir/shl.${shlib} 3051.7Sdyoung fi 3061.1Sdyoung fi 3071.1Sdyoung if [ "$lkm" != "no" ]; then 3081.9Slukem if [ -f $setdir/lkm.mi ]; then 3091.9Slukem echo $setdir/lkm.mi 3101.1Sdyoung fi 3111.1Sdyoung fi 3121.11Slukem if [ "${TOOLCHAIN_MISSING}" != "yes" ]; then 3131.11Slukem if [ "${HAVE_GCC3}" = "yes" ]; then 3141.9Slukem if [ -f $setdir/gcc.mi ]; then 3151.9Slukem echo $setdir/gcc.mi 3161.2Smrg fi 3171.2Smrg if [ "$shlib" != "no" ]; then 3181.9Slukem if [ -f $setdir/gcc.shl ]; then 3191.9Slukem echo $setdir/gcc.shl 3201.2Smrg fi 3211.2Smrg fi 3221.2Smrg else 3231.9Slukem if [ -f $setdir/tc.mi ]; then 3241.9Slukem echo $setdir/tc.mi 3251.2Smrg fi 3261.2Smrg if [ "$shlib" != "no" ]; then 3271.9Slukem if [ -f $setdir/tc.shl ]; then 3281.9Slukem echo $setdir/tc.shl 3291.2Smrg fi 3301.1Sdyoung fi 3311.1Sdyoung fi 3321.1Sdyoung fi 3331.1Sdyoung 3341.9Slukem if [ -f $setdir/rescue.mi ]; then 3351.9Slukem echo $setdir/rescue.mi 3361.1Sdyoung fi 3371.11Slukem if [ -f $setdir/rescue.${MACHINE} ]; then 3381.11Slukem echo $setdir/rescue.${MACHINE} 3391.1Sdyoung fi 3401.11Slukem if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then 3411.11Slukem # Prefer a rescue.ad.${MACHINE_ARCH} over a 3421.11Slukem # rescue.ad.${MACHINE_CPU}, since the arch- 3431.1Sdyoung # specific one will be more specific than the 3441.1Sdyoung # cpu-specific one. 3451.11Slukem if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then 3461.11Slukem echo $setdir/rescue.ad.${MACHINE_ARCH} 3471.11Slukem elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then 3481.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU} 3491.1Sdyoung fi 3501.10Sjmc if [ "$shlib" != "no" -a \ 3511.11Slukem -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then 3521.11Slukem echo $setdir/rescue.ad.${MACHINE_CPU}.shl 3531.10Sjmc fi 3541.1Sdyoung fi 3551.5Sdyoung} 3561.5Sdyoung 3571.9Slukem# arch_to_cpu mach 3581.9Slukem# 3591.11Slukem# Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, 3601.9Slukem# as determined by <bsd.own.mk>. 3611.9Slukem# 3621.8Slukemarch_to_cpu() 3631.8Slukem{ 3641.12Slukem MACHINE_ARCH=${1} ${MAKE:-make} -f- all <<EOMAKE 3651.5Sdyoung.include <bsd.own.mk> 3661.5Sdyoungall: 3671.5Sdyoung @echo \${MACHINE_CPU} 3681.12SlukemEOMAKE 3691.1Sdyoung} 370