4 |
# needs pkgbuild_dir (mage) |
# needs pkgbuild_dir (mage) |
5 |
|
|
6 |
# SMAGE2 |
# SMAGE2 |
7 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.24 2005-08-19 14:14:59 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.29 2005-08-21 20:35:47 niro Exp $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
408 |
|
|
409 |
|
|
410 |
# fixes given dependencies to match a MAGE_TARGET |
# fixes given dependencies to match a MAGE_TARGET |
411 |
# fix_mage_deps -target s/depend # <-- '-' is essential ! (build_mage_script needs this) |
# fix_mage_deps -target s/depend # <-- note -target ! |
412 |
fix_mage_deps() { |
fix_mage_deps() { |
413 |
local target="$1" |
local target="$1" |
414 |
local depend="$2" |
local depend="$2" |
478 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
479 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
480 |
# |
# |
481 |
# gets called with build_mage_script target # <-- '-' is essential ! |
# gets called with build_mage_script target |
482 |
build_mage_script() |
build_mage_script() |
483 |
{ |
{ |
484 |
local magefile |
local magefile |
491 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
492 |
|
|
493 |
# determinate which suffix this mage file should get, if any |
# determinate which suffix this mage file should get, if any |
494 |
target="$1" |
[ -n "$1" ] && target="-$1" |
495 |
|
|
496 |
# name of magefile |
# name of magefile |
497 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
508 |
> ${dest} |
> ${dest} |
509 |
|
|
510 |
# header |
# header |
511 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.24 2005-08-19 14:14:59 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.29 2005-08-21 20:35:47 niro Exp $' >> ${dest} |
512 |
echo >> ${dest} |
echo >> ${dest} |
513 |
|
|
514 |
# pgkname and state |
# pgkname and state |
521 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
522 |
echo >> ${dest} |
echo >> ${dest} |
523 |
|
|
524 |
# special tags |
# special tags and vars |
525 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
526 |
|
# add special vars |
527 |
|
if [ -n "${SPECIAL_VARS}" ] |
528 |
|
then |
529 |
|
local i |
530 |
|
for i in ${SPECIAL_VARS} |
531 |
|
do |
532 |
|
# being tricky here :) |
533 |
|
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
534 |
|
done |
535 |
|
echo >> ${dest} |
536 |
|
fi |
537 |
|
# add at least all includes |
538 |
if [ -n "${INHERITS}" ] |
if [ -n "${INHERITS}" ] |
539 |
then |
then |
540 |
echo -n "minclude" >> ${dest} |
echo -n "minclude" >> ${dest} |
549 |
|
|
550 |
# deps and provides |
# deps and provides |
551 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
552 |
|
echo >> ${dest} |
553 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
554 |
|
echo >> ${dest} |
555 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
556 |
echo >> ${dest} |
echo >> ${dest} |
557 |
|
|
566 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
567 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
568 |
done |
done |
569 |
|
echo >> ${dest} |
570 |
fi |
fi |
571 |
|
|
572 |
# pre|post-install|removes |
# pre|post-install|removes |
587 |
# build them only if requested |
# build them only if requested |
588 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
589 |
then |
then |
590 |
# build for each target an mage file |
# run it without targets |
591 |
for i in ${MAGE_TARGETS} |
if [ -z "${MAGE_TARGETS}" ] |
592 |
do |
then |
593 |
echo |
echo |
594 |
build_mage_script "-${i}" |
build_mage_script |
595 |
echo |
echo |
596 |
done |
else |
597 |
|
|
598 |
|
# build for each target an mage file |
599 |
|
# run it with several targets |
600 |
|
for i in ${MAGE_TARGETS} |
601 |
|
do |
602 |
|
echo |
603 |
|
build_mage_script "${i}" |
604 |
|
echo |
605 |
|
done |
606 |
|
fi |
607 |
fi |
fi |
608 |
|
|
609 |
# now unset all uneeded vars to be safe |
# now unset all uneeded vars to be safe |
614 |
unset "${i}" |
unset "${i}" |
615 |
done |
done |
616 |
unset SPECIAL_FUNCTIONS |
unset SPECIAL_FUNCTIONS |
617 |
|
for i in ${SPECIAL_VARS} |
618 |
|
do |
619 |
|
unset "${i}" |
620 |
|
done |
621 |
|
unset SPECIAL_VARS |
622 |
unset STATE |
unset STATE |
623 |
unset DESCRIPTION |
unset DESCRIPTION |
624 |
unset HOMEPAGE |
unset HOMEPAGE |