| @@ -1,14 +1,14 @@ | | | @@ -1,14 +1,14 @@ |
1 | # $NetBSD: sets.subr,v 1.109 2009/12/11 12:07:58 he Exp $ | | 1 | # $NetBSD: sets.subr,v 1.110 2009/12/11 12:57:39 uebayasi Exp $ |
2 | # | | 2 | # |
3 | | | 3 | |
4 | # | | 4 | # |
5 | # The following variables contain defaults for sets.subr functions and callers: | | 5 | # The following variables contain defaults for sets.subr functions and callers: |
6 | # setsdir path to src/distrib/sets | | 6 | # setsdir path to src/distrib/sets |
7 | # nlists list of base sets | | 7 | # nlists list of base sets |
8 | # xlists list of x11 sets | | 8 | # xlists list of x11 sets |
9 | # extlists list of extsrc sets | | 9 | # extlists list of extsrc sets |
10 | # obsolete controls if obsolete files are selected instead | | 10 | # obsolete controls if obsolete files are selected instead |
11 | # module if != "no", enable MODULE sets | | 11 | # module if != "no", enable MODULE sets |
12 | # shlib shared library format (a.out, elf, or "") | | 12 | # shlib shared library format (a.out, elf, or "") |
13 | # stlib static library format (a.out, elf) | | 13 | # stlib static library format (a.out, elf) |
14 | # | | 14 | # |
| @@ -168,27 +168,27 @@ extlists="extbase extcomp extetc" | | | @@ -168,27 +168,27 @@ extlists="extbase extcomp extetc" |
168 | OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` | | 168 | OSRELEASE=`${HOST_SH} ${NETBSDSRCDIR}/sys/conf/osrelease.sh` |
169 | MODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" | | 169 | MODULEDIR="stand/${MACHINE}/${OSRELEASE}/modules" |
170 | SUBST="s#@MODULEDIR@#${MODULEDIR}#g" | | 170 | SUBST="s#@MODULEDIR@#${MODULEDIR}#g" |
171 | SUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" | | 171 | SUBST="${SUBST};s#@OSRELEASE@#${OSRELEASE}#g" |
172 | SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" | | 172 | SUBST="${SUBST};s#@MACHINE@#${MACHINE}#g" |
173 | | | 173 | |
174 | # | | 174 | # |
175 | # list_set_files setfile [...] | | 175 | # list_set_files setfile [...] |
176 | # | | 176 | # |
177 | # Produce a packing list for setfile(s). | | 177 | # Produce a packing list for setfile(s). |
178 | # In each file, a record consists of a path and a System Package name, | | 178 | # In each file, a record consists of a path and a System Package name, |
179 | # separated by whitespace. E.g., | | 179 | # separated by whitespace. E.g., |
180 | # | | 180 | # |
181 | # # $NetBSD: sets.subr,v 1.109 2009/12/11 12:07:58 he Exp $ | | 181 | # # $NetBSD: sets.subr,v 1.110 2009/12/11 12:57:39 uebayasi Exp $ |
182 | # . base-sys-root [keyword[,...]] | | 182 | # . base-sys-root [keyword[,...]] |
183 | # ./altroot base-sys-root | | 183 | # ./altroot base-sys-root |
184 | # ./bin base-sys-root | | 184 | # ./bin base-sys-root |
185 | # ./bin/[ base-util-root | | 185 | # ./bin/[ base-util-root |
186 | # ./bin/cat base-util-root | | 186 | # ./bin/cat base-util-root |
187 | # [...] | | 187 | # [...] |
188 | # | | 188 | # |
189 | # A # in the first column marks a comment. | | 189 | # A # in the first column marks a comment. |
190 | # | | 190 | # |
191 | # If ${obsolete} != 0, only entries with an "obsolete" keyword will | | 191 | # If ${obsolete} != 0, only entries with an "obsolete" keyword will |
192 | # be printed. All other keywords must be present. | | 192 | # be printed. All other keywords must be present. |
193 | # | | 193 | # |
194 | # The third field is an optional comma separated list of keywords to | | 194 | # The third field is an optional comma separated list of keywords to |
| @@ -376,118 +376,93 @@ list_set_files() | | | @@ -376,118 +376,93 @@ list_set_files() |
376 | # rescue.ad.${MACHINE_ARCH} | | 376 | # rescue.ad.${MACHINE_ARCH} |
377 | # (or) rescue.ad.${MACHINE_CPU} | | 377 | # (or) rescue.ad.${MACHINE_CPU} |
378 | # rescue.ad.${MACHINE_CPU}.shl | | 378 | # rescue.ad.${MACHINE_CPU}.shl |
379 | # | | 379 | # |
380 | # Environment: | | 380 | # Environment: |
381 | # shlib | | 381 | # shlib |
382 | # stlib | | 382 | # stlib |
383 | # | | 383 | # |
384 | list_set_lists() | | 384 | list_set_lists() |
385 | { | | 385 | { |
386 | setname=$1 | | 386 | setname=$1 |
387 | | | 387 | |
388 | setdir=$setsdir/lists/$setname | | 388 | setdir=$setsdir/lists/$setname |
| | | 389 | |
389 | echo $setdir/mi | | 390 | echo $setdir/mi |
390 | for _extsrc_pkg in ${EXTSRCS}; do | | 391 | |
391 | if [ -f $setdir/mi.ext.${_extsrc_pkg} ]; then | | | |
392 | echo $setdir/mi.ext.${_extsrc_pkg} | | | |
393 | fi | | | |
394 | done | | | |
395 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then | | 392 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then |
396 | # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, | | 393 | # Prefer an ad.${MACHINE_ARCH} over an ad.${MACHINE_CPU}, |
397 | # since the arch-specific one will be more specific than | | 394 | # since the arch-specific one will be more specific than |
398 | # the cpu-specific one. | | 395 | # the cpu-specific one. |
399 | if [ -f $setdir/ad.${MACHINE_ARCH} ]; then | | 396 | echo_if_exist $setdir/ad.${MACHINE_ARCH} || \ |
400 | echo $setdir/ad.${MACHINE_ARCH} | | 397 | echo_if_exist $setdir/ad.${MACHINE_CPU} |
401 | elif [ -f $setdir/ad.${MACHINE_CPU} ]; then | | 398 | if [ "$shlib" != "no" ]; then |
402 | echo $setdir/ad.${MACHINE_CPU} | | 399 | echo_if_exist $setdir/ad.${MACHINE_CPU}.shl |
403 | fi | | 400 | fi |
404 | if [ "$shlib" != "no" -a \ | | | |
405 | -f $setdir/ad.${MACHINE_CPU}.shl ]; then | | | |
406 | echo $setdir/ad.${MACHINE_CPU}.shl | | | |
407 | fi | | | |
408 | fi | | | |
409 | if [ -f $setdir/md.${MACHINE}.${MACHINE_ARCH} ]; then | | | |
410 | echo $setdir/md.${MACHINE}.${MACHINE_ARCH} | | | |
411 | elif [ -f $setdir/md.${MACHINE} ]; then | | | |
412 | echo $setdir/md.${MACHINE} | | | |
413 | fi | | | |
414 | if [ -f $setdir/stl.mi ]; then | | | |
415 | echo $setdir/stl.mi | | | |
416 | fi | | | |
417 | if [ -f $setdir/stl.${stlib} ]; then | | | |
418 | echo $setdir/stl.${stlib} | | | |
419 | fi | | 401 | fi |
| | | 402 | |
| | | 403 | echo_if_exist $setdir/md.${MACHINE}.${MACHINE_ARCH} || \ |
| | | 404 | echo_if_exist $setdir/md.${MACHINE} |
| | | 405 | |
| | | 406 | echo_if_exist $setdir/stl.mi |
| | | 407 | echo_if_exist $setdir/stl.${stlib} |
| | | 408 | |
420 | if [ "$shlib" != "no" ]; then | | 409 | if [ "$shlib" != "no" ]; then |
421 | if [ -f $setdir/shl.mi ]; then | | 410 | echo_if_exist $setdir/shl.mi |
422 | echo $setdir/shl.mi | | 411 | echo_if_exist $setdir/shl.${shlib} |
423 | fi | | | |
424 | for _extsrc_pkg in ${EXTSRCS}; do | | | |
425 | if [ -f $setdir/shl.mi.ext.${_extsrc_pkg} ]; then | | | |
426 | echo $setdir/shl.mi.ext.${_extsrc_pkg} | | | |
427 | fi | | | |
428 | done | | | |
429 | if [ -f $setdir/shl.${shlib} ]; then | | | |
430 | echo $setdir/shl.${shlib} | | | |
431 | fi | | | |
432 | for _extsrc_pkg in ${EXTSRCS}; do | | | |
433 | if [ -f $setdir/shl.${shlib}.ext.${_extsrc_pkg} ]; then | | | |
434 | echo $setdir/shl.${shlib}.ext.${_extsrc_pkg} | | | |
435 | fi | | | |
436 | done | | | |
437 | fi | | 412 | fi |
| | | 413 | |
438 | if [ "$module" != "no" ]; then | | 414 | if [ "$module" != "no" ]; then |
439 | if [ -f $setdir/module.mi ]; then | | 415 | echo_if_exist $setdir/module.mi |
440 | echo $setdir/module.mi | | 416 | echo_if_exist $setdir/module.${MACHINE} |
441 | fi | | | |
442 | if [ -f $setdir/module.${MACHINE} ]; then | | | |
443 | echo $setdir/module.${MACHINE} | | | |
444 | fi | | | |
445 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then | | 417 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then |
446 | # Prefer a module.ad.${MACHINE_ARCH} over a | | 418 | # Prefer a module.ad.${MACHINE_ARCH} over a |
447 | # module.ad.${MACHINE_CPU}, since the arch- | | 419 | # module.ad.${MACHINE_CPU}, since the arch- |
448 | # specific one will be more specific than the | | 420 | # specific one will be more specific than the |
449 | # cpu-specific one. | | 421 | # cpu-specific one. |
450 | if [ -f $setdir/module.ad.${MACHINE_ARCH} ]; then | | 422 | echo_if_exist $setdir/module.ad.${MACHINE_ARCH} || \ |
451 | echo $setdir/module.ad.${MACHINE_ARCH} | | 423 | echo_if_exist $setdir/module.ad.${MACHINE_CPU} |
452 | elif [ -f $setdir/module.ad.${MACHINE_CPU} ]; then | | | |
453 | echo $setdir/module.ad.${MACHINE_CPU} | | | |
454 | fi | | | |
455 | fi | | 424 | fi |
456 | fi | | 425 | fi |
457 | | | 426 | |
458 | if [ -f $setdir/rescue.mi ]; then | | 427 | echo_if_exist $setdir/rescue.mi |
459 | echo $setdir/rescue.mi | | 428 | echo_if_exist $setdir/rescue.${MACHINE} |
460 | fi | | | |
461 | if [ -f $setdir/rescue.${MACHINE} ]; then | | | |
462 | echo $setdir/rescue.${MACHINE} | | | |
463 | fi | | | |
464 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then | | 429 | if [ "${MACHINE}" != "${MACHINE_ARCH}" ]; then |
465 | # Prefer a rescue.ad.${MACHINE_ARCH} over a | | 430 | # Prefer a rescue.ad.${MACHINE_ARCH} over a |
466 | # rescue.ad.${MACHINE_CPU}, since the arch- | | 431 | # rescue.ad.${MACHINE_CPU}, since the arch- |
467 | # specific one will be more specific than the | | 432 | # specific one will be more specific than the |
468 | # cpu-specific one. | | 433 | # cpu-specific one. |
469 | if [ -f $setdir/rescue.ad.${MACHINE_ARCH} ]; then | | 434 | echo_if_exist $setdir/rescue.ad.${MACHINE_ARCH} || \ |
470 | echo $setdir/rescue.ad.${MACHINE_ARCH} | | 435 | echo_if_exist $setdir/rescue.ad.${MACHINE_CPU} |
471 | elif [ -f $setdir/rescue.ad.${MACHINE_CPU} ]; then | | 436 | if [ "$shlib" != "no" ]; then |
472 | echo $setdir/rescue.ad.${MACHINE_CPU} | | 437 | echo_if_exist $setdir/rescue.ad.${MACHINE_CPU}.shl |
473 | fi | | | |
474 | if [ "$shlib" != "no" -a \ | | | |
475 | -f $setdir/rescue.ad.${MACHINE_CPU}.shl ]; then | | | |
476 | echo $setdir/rescue.ad.${MACHINE_CPU}.shl | | | |
477 | fi | | 438 | fi |
478 | fi | | 439 | fi |
479 | } | | 440 | } |
480 | | | 441 | |
| | | 442 | echo_if_exist() |
| | | 443 | { |
| | | 444 | [ -f $1 ] && echo $1 |
| | | 445 | return $? |
| | | 446 | } |
| | | 447 | |
| | | 448 | echo_if_exist_foreach() |
| | | 449 | { |
| | | 450 | local _list=$1; shift |
| | | 451 | for _suffix in $@; do |
| | | 452 | echo_if_exist ${_list}.${_suffix} |
| | | 453 | done |
| | | 454 | } |
| | | 455 | |
481 | # arch_to_cpu mach | | 456 | # arch_to_cpu mach |
482 | # | | 457 | # |
483 | # Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, | | 458 | # Print the ${MACHINE_CPU} for ${MACHINE_ARCH}=mach, |
484 | # as determined by <bsd.own.mk>. | | 459 | # as determined by <bsd.own.mk>. |
485 | # | | 460 | # |
486 | arch_to_cpu() | | 461 | arch_to_cpu() |
487 | { | | 462 | { |
488 | MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE | | 463 | MACHINE_ARCH=${1} ${MAKE} -B -f- all <<EOMAKE |
489 | .include <bsd.own.mk> | | 464 | .include <bsd.own.mk> |
490 | all: | | 465 | all: |
491 | @echo \${MACHINE_CPU} | | 466 | @echo \${MACHINE_CPU} |
492 | EOMAKE | | 467 | EOMAKE |
493 | } | | 468 | } |