--- trunk/mage/usr/lib/mage/smage2.sh 2011/12/28 12:04:33 1582 +++ trunk/mage/usr/lib/mage/smage2.sh 2011/12/28 12:23:50 1584 @@ -421,7 +421,7 @@ do if [ -f ${doc} ] then - if [[ ${SMAGE_COMPRESSDOC} = true ]] + if mqueryfeature "compressdoc" then cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}." chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "fixing permissions of ${doc}." @@ -544,7 +544,6 @@ fi } - # fixes given dependencies to match a MAGE_TARGET # fix_mage_deps -target s/depend # <-- note -target ! fix_mage_deps() @@ -731,7 +730,7 @@ local subpackage # build them only if requested - if [[ ${REGEN_MAGE_TREE} = true ]] + if mqueryfeature regentree then # run it without targets if [[ -n ${MAGE_TARGETS} ]] @@ -820,9 +819,22 @@ export SAVED_DEPEND="${DEPEND}" export SAVED_SDEPEND="${SDEPEND}" export SAVED_PROVIDE="${PROVIDE}" - export SAVED_NOPKGBUILD="${NOPKGBUILD}" export SAVED_PKGTYPE="${PKGTYPE}" + # special handling needed for mage features + # pkgbuild + mqueryfeature "pkgbuild" && export SAVED_FEATURE_PKGBUILD="pkgbuild" + mqueryfeature "!pkgbuild" && export SAVED_FEATURE_PKGBUILD="!pkgbuild" + # strip + mqueryfeature "strip" && export SAVED_FEATURE_STRIP="strip" + mqueryfeature "!strip" && export SAVED_FEATURE_STRIP="!strip" + # libtool + mqueryfeature "libtool" && export SAVED_FEATURE_LIBTOOL="libtool" + mqueryfeature "!libtool" && export SAVED_FEATURE_LIBTOOL="!libtool" + # compressdoc + mqueryfeature "compressdoc" && export SAVED_FEATURE_COMPRESSDOC="compressdoc" + mqueryfeature "!compressdoc" && export SAVED_FEATURE_COMPRESSDOC="!compressdoc" + # bindir too export SAVED_BINDIR="${BINDIR}" @@ -882,9 +894,18 @@ export DEPEND="${SAVED_DEPEND}" export SDEPEND="${SAVED_SDEPEND}" export PROVIDE="${SAVED_PROVIDE}" - export NOPKGBUILD="${SAVED_NOPKGBUILD}" export PKGTYPE="${SAVED_PKGTYPE}" + # special handling needed for mage features + # pkgbuild + msetfeature "${SAVED_FEATURE_PKGBUILD}" + # strip + msetfeature "${SAVED_FEATURE_STRIP}" + # libtool + msetfeature "${SAVED_FEATURE_LIBTOOL}" + # compressdoc + msetfeature "${SAVED_FEATURE_COMPRESSDOC}" + # bindir too export BINDIR="${SAVED_BINDIR}" @@ -943,8 +964,11 @@ unset SAVED_SDEPEND unset SAVED_PROVIDE unset SAVED_BINDIR - unset SAVED_NOPKGBUILD unset SAVED_PKGTYPE + unset SAVED_FEATURE_PKGBUILD + unset SAVED_FEATURE_STRIP + unset SAVED_FEATURE_LIBTOOL + unset SAVED_FEATURE_COMPRESSDOC unset SPLIT_PACKAGE_BASE unset -f SAVED_preinstall unset -f SAVED_postinstall @@ -1044,12 +1068,11 @@ # fix target as it may be empty ! [ -n "${target}" ] && target="-${target}" - # build pkgname pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" # build pkg-md5-sum only if requested - if [[ ${REGEN_MAGE_TREE} = true ]] + if mqueryfeature regentree then echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}" @@ -1104,7 +1127,7 @@ step_by_step() { - if [[ ${STEP_BY_STEP} = true ]] + if mqueryfeature stepbystep then echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" echo "Press [enter] to continue" @@ -1124,6 +1147,9 @@ exit 1 fi +# load supported mage features +load_mage_features + # updating smage2-scripts if [[ $1 = update ]] then @@ -1308,7 +1334,7 @@ if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ] then SRCPKGTARBALL="${2}" - USE_SRC_PKG_TARBALL=true + msetfeature "srcpkgtarball" # abort if given file is not a source pkg [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file." @@ -1352,7 +1378,7 @@ # auto regen mage tree if requested regen_mage_tree -if [[ ${CREATE_SRC_PKG_TARBALL} = true ]] +if mqueryfeature "srcpkg" then if [[ -d ${SOURCEDIR}/${PNAME} ]] then @@ -1362,7 +1388,7 @@ fi # download sources -[[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources +mqueryfeature "srcpkgtarball" || download_sources # fixes some issues with these functions export -f src_prepare || die "src_prepare export failed" @@ -1377,13 +1403,12 @@ export BINDIR="${BINDIR}" || die "BINDIR export failed" export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" - # setup distcc # setup for distcc goes *before* ccache, so ccache comes before distcc in path -[[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment +mqueryfeature "distcc" && setup_distcc_environment # setup ccache -[[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment +mqueryfeature "ccache" && setup_ccache_environment # clean up builddir if a previously one exist if [ -d ${BUILDDIR} ] @@ -1424,9 +1449,9 @@ step_by_step $_ # only run checks if requested -if [[ ${MAGE_CHECK} != true ]] +if mqueryfeature "!check" then - echo "MAGE_CHECK not requested; src_check() will not be run!" | ${SMAGE_LOG_CMD} + echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} step_by_step src_check else src_check | ${SMAGE_LOG_CMD} @@ -1471,18 +1496,23 @@ step_by_step $_ fi -# compressing doc, info & man files -if [[ -n ${SPLIT_PACKAGES} ]] +if mqueryfeature "!compressdoc" then - for subpackage in ${SPLIT_PACKAGES} - do - mcompressdocs ${BINDIR}_${subpackage} - done + echo -e "!compressdoc detected; documentation will not be compressed ..." else - mcompressdocs ${BINDIR} + # compressing doc, info & man files + if [[ -n ${SPLIT_PACKAGES} ]] + then + for subpackage in ${SPLIT_PACKAGES} + do + mcompressdocs ${BINDIR}_${subpackage} + done + else + mcompressdocs ${BINDIR} + fi fi -if [[ ${SMAGE_STRIP_LIBTOOL} = true ]] +if mqueryfeature "!libtool" then if [[ -n ${SPLIT_PACKAGES} ]] then @@ -1497,7 +1527,7 @@ fi fi -if [[ ${SMAGE_PURGE} = true ]] +if mqueryfeature "purge" then if [[ -n ${SPLIT_PACKAGES} ]] then @@ -1513,11 +1543,10 @@ fi # stripping all bins and libs -case ${NOSTRIP} in - true|TRUE|yes|y) - echo -e "NOSTRIP=true detected; Package will not be stripped ..." - ;; - *) +if mqueryfeature "!strip" +then + echo -e "!strip detected; Package will not be stripped ..." +else if [[ -n ${SPLIT_PACKAGES} ]] then for subpackage in ${SPLIT_PACKAGES} @@ -1537,15 +1566,12 @@ echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" mstripstatic ${BINDIR} fi - ;; -esac +fi -# the new buildpkg command -case ${NOPKGBUILD} in - true|TRUE|yes|y) - echo -e "NOPGKBUILD=true detected; Package will not be build ..." - ;; - *) +if mqueryfeature "!buildpkg" +then + echo -e "!buildpkg detected; Package will not be build ..." +else # build several targets if [[ -n ${MAGE_TARGETS} ]] then @@ -1584,10 +1610,8 @@ export PNAME="${subpackage}" split_info_${PNAME} - # jump to next one if NOPKGBUILD is set in split_info - case ${NOPKGBUILD} in - true|TRUE|yes|y) continue ;; - esac + # jump to next one if !buildpkg is set in split_info + mqueryfeature "!buildpkg" && continue # check if an special subpackage_pkgbuild exists if typeset -f ${PNAME}_pkgbuild > /dev/null @@ -1631,19 +1655,14 @@ fi # build src-pkg-tarball if requested - [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME} - ;; -esac + mqueryfeature "srcpkg" && source_pkg_build ${SMAGENAME} +fi -if [[ ${SMAGE_BUILD_LOGGING} != false ]] +if mqueryfeature "buildlog" then bzip2 -9f /var/log/smage/${PKGNAME}.log else [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log fi -# for sure -unset NOPKGBUILD -unset NOSTRIP - xtitleclean