--- trunk/mage/usr/lib/mage/smage2.sh 2005/08/19 14:14:59 193 +++ trunk/mage/usr/lib/mage/smage2.sh 2005/08/20 15:55:19 196 @@ -4,7 +4,7 @@ # needs pkgbuild_dir (mage) # SMAGE2 -# $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.27 2005-08-20 15:55:19 niro Exp $ #01.10.2004 # added ccache support @@ -408,7 +408,7 @@ # fixes given dependencies to match a MAGE_TARGET -# fix_mage_deps -target s/depend # <-- '-' is essential ! (build_mage_script needs this) +# fix_mage_deps target s/depend fix_mage_deps() { local target="$1" local depend="$2" @@ -438,10 +438,10 @@ # do not add empty lines if [ -z "${NDEPEND}" ] then - NDEPEND="${sym} ${cat}/${pname}${target}-${pver}" + NDEPEND="${sym} ${cat}/${pname}-${target}-${pver}" else NDEPEND="${NDEPEND} - ${sym} ${cat}/${pname}${target}-${pver}" + ${sym} ${cat}/${pname}-${target}-${pver}" fi unset cat pname pver @@ -478,7 +478,7 @@ # MAGE_TREE_DEST target destination of the generated tree # REGEN_MAGE_TREE set to 'true' to enable this # -# gets called with build_mage_script target # <-- '-' is essential ! +# gets called with build_mage_script target build_mage_script() { local magefile @@ -491,7 +491,7 @@ : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} # determinate which suffix this mage file should get, if any - target="$1" + [ -n "$1" ] && target="-$1" # name of magefile magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" @@ -508,7 +508,7 @@ > ${dest} # header - 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.27 2005-08-20 15:55:19 niro Exp $' >> ${dest} echo >> ${dest} # pgkname and state @@ -521,7 +521,7 @@ echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} echo >> ${dest} - # special tags + # special tags and vars echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} if [ -n "${INHERITS}" ] then @@ -535,9 +535,23 @@ 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 + echo >> ${dest} + fi + # deps and provides echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} + echo >> ${dest} echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} + echo >> ${dest} echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} echo >> ${dest} @@ -552,6 +566,7 @@ # unset to be safe (quotes needed !) #unset "${i}" <-- later to get every target built done + echo >> ${dest} fi # pre|post-install|removes @@ -572,13 +587,23 @@ # build them only if requested if [[ ${REGEN_MAGE_TREE} = true ]] then - # build for each target an mage file - for i in ${MAGE_TARGETS} - do + # run it without targets + if [ -z "${MAGE_TARGETS}" ] + then echo - build_mage_script "-${i}" + build_mage_script echo - done + else + + # build for each target an mage file + # run it with several targets + for i in ${MAGE_TARGETS} + do + echo + build_mage_script "${i}" + echo + done + fi fi # now unset all uneeded vars to be safe @@ -589,6 +614,11 @@ unset "${i}" done unset SPECIAL_FUNCTIONS + for i in ${SPECIAL_VARS} + do + unset "${i}" + done + unset SPECIAL_VARS unset STATE unset DESCRIPTION unset HOMEPAGE