--- trunk/mage/usr/lib/mage/smage2.sh 2012/01/09 20:44:55 1618 +++ trunk/mage/usr/lib/mage/smage2.sh 2012/01/13 13:32:22 1636 @@ -177,6 +177,8 @@ fi echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}" + # always use verbose mode for source downloads + FVERBOSE=off msetfeature "verbose" # do not die here, mchecksum catches download errors mdownload --uri "${uri}" --dir "${outputdir}" @@ -240,11 +242,28 @@ local myopts if [[ ! -z ${CTARGET} ]] then - myopts="--target=${CTARGET}" + myopts+=" --target=${CTARGET}" fi if [ -x ./configure ] then + # if requested disable-static + if [[ ! -z $(./configure --help | grep -- '--.*able-static') ]] + then + if mqueryfeature '!static' + then + myopts+=" --disable-static" + else + myopts+=" --enable-static" + fi + fi + + # always enable shared by default + if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] + then + myopts+=" --enable-shared" + fi + ./configure \ --prefix=/usr \ --host=${CHOST} \ @@ -434,7 +453,7 @@ cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "gzipping +installing ${doc}." chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "fixing permissions of ${doc}." else - install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}." + install -m 0644 ${doc} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}." fi fi done @@ -446,7 +465,7 @@ [[ -z ${stripdir} ]] && stripdir="${BINDIR}" [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug" - find ${stripdir} ! -type d | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null + find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null } mstripbins() @@ -455,7 +474,7 @@ [[ -z ${stripdir} ]] && stripdir="${BINDIR}" [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug" - find ${stripdir} ! -type d | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null + find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null } mstripstatic() @@ -464,7 +483,7 @@ [[ -z ${stripdir} ]] && stripdir="${BINDIR}" [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug" - find ${stripdir} ! -type d | xargs file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null + find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null } mstriplibtoolarchive() @@ -472,7 +491,7 @@ local stripdir="$@" [[ -z ${stripdir} ]] && stripdir="${BINDIR}" - find ${stripdir} ! -type d -name \*.la | xargs | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null + find ${stripdir} ! -type d -name \*.la | xargs --no-run-if-empty file | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null } mpurgetargets() @@ -1146,14 +1165,15 @@ resume_stamp() { local step="$1" - touch ${BUILDDIR}/.smage-${PKGNAME}-${step} + [[ ! -d ${BUILDDIR}/.stamps ]] && install -d ${BUILDDIR}/.stamps + touch ${BUILDDIR}/.stamps/smage-${PKGNAME}-${step} } run_resume() { local step="$1" - if mqueryfeature "resume" && [[ -f ${BUILDDIR}/.smage-${PKGNAME}-${step} ]] + if mqueryfeature "resume" && [[ -f ${BUILDDIR}/.stamps/smage-${PKGNAME}-${step} ]] then echo -e "${COLMAGENTA}${step} already processed; doing nothing${COLDEFAULT}" return 0 @@ -1409,7 +1429,7 @@ # auto regen mage tree if requested regen_mage_tree -if mqueryfeature "srcpkg" +if mqueryfeature "srcpkgbuild" then if [[ -d ${SOURCEDIR}/${PNAME} ]] then @@ -1486,6 +1506,12 @@ rm -rf ${BUILDDIR}/${PKGNAME} fi + # clean up stamps dir + if [ -d ${BUILDDIR}/.stamps ] + then + rm -rf ${BUILDDIR}/.stamps + fi + # setup build logging [[ ! -d /var/log/smage ]] && install -d /var/log/smage echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log @@ -1573,12 +1599,12 @@ then for subpackage in ${SPLIT_PACKAGES} do - run_resume mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} - resume_stamp mcompressdoc_${subpackage} + run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} + resume_stamp post-mcompressdoc_${subpackage} done else - run_resume mcompressdoc || mcompressdocs ${BINDIR} - resume_stamp mcompressdoc + run_resume post-mcompressdoc || mcompressdocs ${BINDIR} + resume_stamp post-mcompressdoc fi fi @@ -1593,13 +1619,13 @@ for subpackage in ${SPLIT_PACKAGES} do echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" - run_resume mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} - resume_stamp mstriplibtoolarchive_${subpackage} + run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} + resume_stamp post-mstriplibtoolarchive_${subpackage} done else echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" - run_resume mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} - resume_stamp mstriplibtoolarchive + run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} + resume_stamp post-mstriplibtoolarchive fi fi fi @@ -1615,13 +1641,13 @@ for subpackage in ${SPLIT_PACKAGES} do echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" - run_resume mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} - resume_stamp mpurgetargets_${subpackage} + run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} + resume_stamp post-mpurgetargets_${subpackage} done else echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" - run_resume mpurgetargets || mpurgetargets ${BINDIR} - resume_stamp mpurgetargets + run_resume post-mpurgetargets || mpurgetargets ${BINDIR} + resume_stamp post-mpurgetargets fi fi fi @@ -1639,25 +1665,25 @@ for subpackage in ${SPLIT_PACKAGES} do echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" - run_resume mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} - resume_stamp mstripbins_${subpackage} + run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} + resume_stamp post-mstripbins_${subpackage} echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" - run_resume mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} - resume_stamp mstriplibs_${subpackage} + run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} + resume_stamp post-mstriplibs_${subpackage} echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" - run_resume mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} - resume_stamp mstripstatic_${subpackage} + run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} + resume_stamp post-mstripstatic_${subpackage} done else echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" - run_resume mstripbins || mstripbins ${BINDIR} - resume_stamp mstripbins + run_resume post-mstripbins || mstripbins ${BINDIR} + resume_stamp post-mstripbins echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" - run_resume mstriplibs || mstriplibs ${BINDIR} - resume_stamp mstriplibs + run_resume post-mstriplibs || mstriplibs ${BINDIR} + resume_stamp post-mstriplibs echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" - run_resume mstripstatic || mstripstatic ${BINDIR} - resume_stamp mstripstatic + run_resume post-mstripstatic || mstripstatic ${BINDIR} + resume_stamp post-mstripstatic fi fi @@ -1674,24 +1700,24 @@ if typeset -f ${target}_pkgbuild > /dev/null then # run it - run_resume ${target}_pkgbuild || ${target}_pkgbuild - resume_stamp ${target}_pkgbuild + run_resume post-${target}_pkgbuild || ${target}_pkgbuild + resume_stamp post-${target}_pkgbuild fi # now create the target package - run_resume pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ + run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \ ${BINDIR} || die "target: ${target} package-build failed" - resume_stamp pkg_builddir_${target} + resume_stamp post-pkg_builddir_${target} # build pkg-md5-sum if requested - run_resume md5sum_${target} || generate_package_md5sum \ + run_resume post-md5sum_${target} || generate_package_md5sum \ --pcat "${PCATEGORIE}" \ --pname "${PNAME}" \ --pver "${PVER}" \ --pbuild "${PBUILD}" \ --parch "${ARCH}" \ --target "${target}" - resume_stamp md5sum_${target} + resume_stamp post-md5sum_${target} echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" done @@ -1713,23 +1739,23 @@ if typeset -f ${PNAME}_pkgbuild > /dev/null then # run it - run_resume ${PNAME}_pkgbuild || ${PNAME}_pkgbuild - resume_stamp ${PNAME}_pkgbuild + run_resume post-${PNAME}_pkgbuild || ${PNAME}_pkgbuild + resume_stamp post-${PNAME}_pkgbuild fi # now create the target package - run_resume pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ + run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" - resume_stamp pkg_builddir_${PNAME} + resume_stamp post-pkg_builddir_${PNAME} # build pkg-md5-sum if requested - run_resume md5sum_${PNAME} || generate_package_md5sum \ + run_resume post-md5sum_${PNAME} || generate_package_md5sum \ --pcat "${PCATEGORIE}" \ --pname "${PNAME}" \ --pver "${PVER}" \ --pbuild "${PBUILD}" \ --parch "${ARCH}" - resume_stamp md5sum_${PNAME} + resume_stamp post-md5sum_${PNAME} echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" @@ -1740,26 +1766,26 @@ split_unset_variables else - run_resume pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" - resume_stamp pkg_builddir + run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" + resume_stamp post-pkg_builddir # build pkg-md5-sum if requested - run_resume md5sum || generate_package_md5sum \ + run_resume post-md5sum || generate_package_md5sum \ --pcat "${PCATEGORIE}" \ --pname "${PNAME}" \ --pver "${PVER}" \ --pbuild "${PBUILD}" \ --parch "${ARCH}" - resume_stamp md5sum + resume_stamp post-md5sum echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}" fi # build src-pkg-tarball if requested - if mqueryfeature "srcpkg" + if mqueryfeature "srcpkgbuild" then - run_resume srcpkgbuild || source_pkg_build ${SMAGENAME} - resume_stamp srcpkgbuild + run_resume post-srcpkgbuild || source_pkg_build ${SMAGENAME} + resume_stamp post-srcpkgbuild fi fi