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.25 2005-08-20 15:32:59 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.30 2005-08-21 21:23:48 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" |
425 |
while read sym dep |
while read sym dep |
426 |
do |
do |
427 |
cat="$(dirname ${dep})" |
cat="$(dirname ${dep})" |
428 |
# abort on virtual |
# change if not virtual |
429 |
[[ ${cat} = virtual ]] && continue |
if [[ ${cat} != virtual ]] |
430 |
|
then |
431 |
# fix pver to target-pver |
# fix pver to target-pver |
432 |
# to get pname-target-pver |
# to get pname-target-pver |
433 |
|
|
434 |
# doing it backwards ! |
# doing it backwards ! |
435 |
pver="${dep##*-}" |
pver="${dep##*-}" |
436 |
pname=$(basename ${dep/-${pver}/}) |
pname=$(basename ${dep/-${pver}/}) |
437 |
|
fi |
438 |
|
|
439 |
# do not add empty lines |
# do not add empty lines |
440 |
if [ -z "${NDEPEND}" ] |
if [ -z "${NDEPEND}" ] |
479 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
480 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
481 |
# |
# |
482 |
# gets called with build_mage_script target # <-- '-' is essential ! |
# gets called with build_mage_script target |
483 |
build_mage_script() |
build_mage_script() |
484 |
{ |
{ |
485 |
local magefile |
local magefile |
492 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
493 |
|
|
494 |
# determinate which suffix this mage file should get, if any |
# determinate which suffix this mage file should get, if any |
495 |
target="$1" |
[ -n "$1" ] && target="-$1" |
496 |
|
|
497 |
# name of magefile |
# name of magefile |
498 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
509 |
> ${dest} |
> ${dest} |
510 |
|
|
511 |
# header |
# header |
512 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.25 2005-08-20 15:32:59 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.30 2005-08-21 21:23:48 niro Exp $' >> ${dest} |
513 |
echo >> ${dest} |
echo >> ${dest} |
514 |
|
|
515 |
# pgkname and state |
# pgkname and state |
522 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
523 |
echo >> ${dest} |
echo >> ${dest} |
524 |
|
|
525 |
# special tags |
# special tags and vars |
526 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
527 |
|
# add special vars |
528 |
|
if [ -n "${SPECIAL_VARS}" ] |
529 |
|
then |
530 |
|
local i |
531 |
|
for i in ${SPECIAL_VARS} |
532 |
|
do |
533 |
|
# being tricky here :) |
534 |
|
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
535 |
|
done |
536 |
|
echo >> ${dest} |
537 |
|
fi |
538 |
|
# add at least all includes |
539 |
if [ -n "${INHERITS}" ] |
if [ -n "${INHERITS}" ] |
540 |
then |
then |
541 |
echo -n "minclude" >> ${dest} |
echo -n "minclude" >> ${dest} |
550 |
|
|
551 |
# deps and provides |
# deps and provides |
552 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
553 |
|
echo >> ${dest} |
554 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
555 |
|
echo >> ${dest} |
556 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
557 |
echo >> ${dest} |
echo >> ${dest} |
558 |
|
|
567 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
568 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
569 |
done |
done |
570 |
fi |
echo >> ${dest} |
|
|
|
|
# add special vars |
|
|
if [ -n "${SPECIAL_VARS}" ] |
|
|
then |
|
|
local i |
|
|
for i in ${SPECIAL_VARS} |
|
|
do |
|
|
# being tricky here :) |
|
|
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
|
|
done |
|
571 |
fi |
fi |
572 |
|
|
573 |
# pre|post-install|removes |
# pre|post-install|removes |
588 |
# build them only if requested |
# build them only if requested |
589 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
590 |
then |
then |
591 |
# build for each target an mage file |
# run it without targets |
592 |
for i in ${MAGE_TARGETS} |
if [ -z "${MAGE_TARGETS}" ] |
593 |
do |
then |
594 |
echo |
echo |
595 |
build_mage_script "-${i}" |
build_mage_script |
596 |
echo |
echo |
597 |
done |
else |
598 |
|
|
599 |
|
# build for each target an mage file |
600 |
|
# run it with several targets |
601 |
|
for i in ${MAGE_TARGETS} |
602 |
|
do |
603 |
|
echo |
604 |
|
build_mage_script "${i}" |
605 |
|
echo |
606 |
|
done |
607 |
|
fi |
608 |
fi |
fi |
609 |
|
|
610 |
# now unset all uneeded vars to be safe |
# now unset all uneeded vars to be safe |