--- trunk/mage/usr/lib/mage/smage2.sh 2011/12/28 15:08:52 1589 +++ trunk/mage/usr/lib/mage/smage2.sh 2011/12/29 15:23:21 1595 @@ -201,28 +201,28 @@ # dummy function, used if that does not exist in smage file src_prepare() { - echo "no src_prepare defined" + echo "no src_prepare defined; doing nothing ..." return 0 } # dummy function, used if that does not exist in smage file src_compile() { - echo "no src_compile defined" + echo "no src_compile defined; doing nothing ..." return 0 } # dummy function, used if that does not exist in smage file src_check() { - echo "no src_check defined" + echo "no src_check defined; doing nothing ..." return 0 } # dummy function, used if that does not exist in smage file src_install() { - echo "no src_install defined" + echo "no src_install defined; doing nothing ..." return 0 } @@ -793,7 +793,7 @@ unset STATE unset DESCRIPTION unset HOMEPAGE - unset PKGTYPE + # unset PKGTYPE <-- don't do that either; smage needs this var unset INHERITS unset DEPEND unset SDEPEND @@ -1440,65 +1440,78 @@ [[ ! -d /var/log/smage ]] && install -d /var/log/smage echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log -src_prepare | ${SMAGE_LOG_CMD} -die_pipestatus 0 "src_prepare failed" -step_by_step $_ - -src_compile | ${SMAGE_LOG_CMD} -die_pipestatus 0 "src_compile failed" -step_by_step $_ - -# only run checks if requested -if mqueryfeature "!check" +if [[ ${PKGTYPE} = virtual ]] then - echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} - step_by_step src_check + echo "virtual package detected; nothing will be build ..." + # automatically set !pkgbuild here too + msetfeature "!pkgbuild" else - src_check | ${SMAGE_LOG_CMD} - die_pipestatus 0 "src_check failed" + src_prepare | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_prepare failed" step_by_step $_ -fi - -# build several subpackages -if [[ -n ${SPLIT_PACKAGES} ]] -then - # save bindir & pname - split_save_variables - export SAVED_BINDIR="${BINDIR}" - for subpackage in ${SPLIT_PACKAGES} - do - if typeset -f src_install_${subpackage} > /dev/null - then - # export subpackage bindir - export BINDIR="${SAVED_BINDIR}_${subpackage}" - # export PNAME, several internal function and include - # rely on this variable - export PNAME="${subpackage}" - echo - echo -en "${COLBLUE}*** ${COLDEFAULT}" - echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" - echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" - echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." - - src_install_${subpackage} | ${SMAGE_LOG_CMD} - die_pipestatus 0 "src_install_${subpackage} failed" - step_by_step $_ - fi - done - # restore bindir & pname - split_restore_variables - # unset all saved smage variables - split_unset_variables -else - src_install | ${SMAGE_LOG_CMD} - die_pipestatus 0 "src_install failed" + src_compile | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_compile failed" step_by_step $_ + + # only run checks if requested + if mqueryfeature "!check" + then + echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} + step_by_step src_check + else + src_check | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_check failed" + step_by_step $_ + fi + + # build several subpackages + if [[ -n ${SPLIT_PACKAGES} ]] + then + # save bindir & pname + split_save_variables + export SAVED_BINDIR="${BINDIR}" + for subpackage in ${SPLIT_PACKAGES} + do + if typeset -f src_install_${subpackage} > /dev/null + then + # export subpackage bindir + export BINDIR="${SAVED_BINDIR}_${subpackage}" + # export PNAME, several internal function and include + # rely on this variable + export PNAME="${subpackage}" + + echo + echo -en "${COLBLUE}*** ${COLDEFAULT}" + echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" + echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" + echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." + + src_install_${subpackage} | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_install_${subpackage} failed" + step_by_step $_ + fi + done + # restore bindir & pname + split_restore_variables + # unset all saved smage variables + split_unset_variables + else + src_install | ${SMAGE_LOG_CMD} + die_pipestatus 0 "src_install failed" + step_by_step $_ + fi fi +# echo for sake of good-looking +echo + if mqueryfeature "!compressdoc" then echo -e "!compressdoc detected; documentation will not be compressed ..." +elif mqueryfeature "!pkgbuild" +then + echo "!pkgbuild detected; skipping documentation compression..." else # compressing doc, info & man files if [[ -n ${SPLIT_PACKAGES} ]] @@ -1514,6 +1527,10 @@ if mqueryfeature "!libtool" then + if mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping libtool archive stripping ..." + else if [[ -n ${SPLIT_PACKAGES} ]] then for subpackage in ${SPLIT_PACKAGES} @@ -1525,10 +1542,15 @@ echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" mstriplibtoolarchive ${BINDIR} fi + fi fi if mqueryfeature "purge" then + if mqueryfeature "!pkgbuild" + then + echo "!pkgbuild detected; skipping file purgation..." + else if [[ -n ${SPLIT_PACKAGES} ]] then for subpackage in ${SPLIT_PACKAGES} @@ -1540,37 +1562,41 @@ echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" mpurgetargets ${BINDIR} fi + fi fi # stripping all bins and libs if mqueryfeature "!strip" then echo -e "!strip detected; Package will not be stripped ..." +elif mqueryfeature "!pkgbuild" +then + echo "!pkgbuild detected; skipping stripping of the package ..." else - if [[ -n ${SPLIT_PACKAGES} ]] - then - for subpackage in ${SPLIT_PACKAGES} - do - echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" - mstripbins ${BINDIR}_${subpackage} - echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" - mstriplibs ${BINDIR}_${subpackage} - echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" - mstripstatic ${BINDIR}_${subpackage} - done - else - echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" - mstripbins ${BINDIR} - echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" - mstriplibs ${BINDIR} - echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" - mstripstatic ${BINDIR} - fi + if [[ -n ${SPLIT_PACKAGES} ]] + then + for subpackage in ${SPLIT_PACKAGES} + do + echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" + mstripbins ${BINDIR}_${subpackage} + echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" + mstriplibs ${BINDIR}_${subpackage} + echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" + mstripstatic ${BINDIR}_${subpackage} + done + else + echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" + mstripbins ${BINDIR} + echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" + mstriplibs ${BINDIR} + echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" + mstripstatic ${BINDIR} + fi fi -if mqueryfeature "!buildpkg" +if mqueryfeature "!pkgbuild" then - echo -e "!buildpkg detected; Package will not be build ..." + echo -e "!pkgbuild detected; Package will not be build ..." else # build several targets if [[ -n ${MAGE_TARGETS} ]] @@ -1610,8 +1636,8 @@ export PNAME="${subpackage}" split_info_${PNAME} - # jump to next one if !buildpkg is set in split_info - mqueryfeature "!buildpkg" && continue + # jump to next one if !pkgbuild is set in split_info + mqueryfeature "!pkgbuild" && continue # check if an special subpackage_pkgbuild exists if typeset -f ${PNAME}_pkgbuild > /dev/null