--- trunk/mage/usr/lib/mage/smage2.sh 2005/08/19 02:24:12 191 +++ trunk/mage/usr/lib/mage/smage2.sh 2005/08/19 03:43:56 192 @@ -4,7 +4,7 @@ # needs pkgbuild_dir (mage) # SMAGE2 -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.23 2005-08-19 03:43:56 niro Exp $ #01.10.2004 # added ccache support @@ -230,11 +230,6 @@ return 0 } - -build_mage_script() { - return 0 -} - mconfigure() { if [ -x ./configure ] then @@ -411,7 +406,7 @@ fi } -# alx_create_mage_file: helper functions for regen_mage_tree() +# build_mage_script(): helper functions for regen_mage_tree() # generates an mage file with given information in smage file # needs at least: # PNAME name of pkg @@ -433,7 +428,7 @@ # # MAGE_TREE_DEST target destination of the generated tree # REGEN_MAGE_TREE set to 'true' to enable this -alx_create_mage_file() +build_mage_script() { local magefile local dest @@ -462,7 +457,7 @@ > ${dest} # header - echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $' >> ${dest} + echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.23 2005-08-19 03:43:56 niro Exp $' >> ${dest} echo >> ${dest} # pgkname and state @@ -504,7 +499,7 @@ # add to mage (quotes needed !) typeset -f "${i}" >> ${dest} # unset to be safe (quotes needed !) - unset "${i}" + #unset "${i}" <-- later to get every target built done fi @@ -530,13 +525,19 @@ for i in ${MAGE_TARGETS} do echo - alx_create_mage_file "${i}" + build_mage_script "${i}" echo done fi # now unset all uneeded vars to be safe - unset PKGNAME + # unset PKGNAME <-- don't do that; smage needs this var + # unset to be safe (quotes needed !) + for i in ${SPECIAL_FUNCTIONS} + do + unset "${i}" + done + unset SPECIAL_FUNCTIONS unset STATE unset DESCRIPTION unset HOMEPAGE @@ -545,7 +546,6 @@ unset DEPEND unset SDEPEND unset PROVIDE - unset SPECIAL_FUNCTIONS unset preinstall unset postinstall unset preremove @@ -563,7 +563,7 @@ exit 1 fi -#updating smage2-scripts +# updating smage2-scripts if [ "$1" == "update" ] then if [ ! -d ${SOURCEDIR} ] @@ -574,7 +574,7 @@ exit 0 fi -#creates md5sums for smages to given dir +# creates md5sums for smages to given dir if [ "$1" == "calcmd5" ] then if [ $# -ge 3 ] @@ -644,7 +644,7 @@ exit 0 fi -#download sources +# download sources if [ "$1" == "download" -a -n "$2" ] then if [ ! -d ${SMAGESCRIPTSDIR} ] @@ -718,15 +718,15 @@ # auto regen mage tree if requested regen_mage_tree -#download sources +# download sources download_sources -#fixes some issues with these functions +# fixes some issues with these functions export -f src_prepare || die "src_prepare export failed" export -f src_compile || die "src_compile export failed" export -f src_install || die "src_install export failed" -#fixes some compile issues +# fixes some compile issues export CHOST="${CHOST}" || die "CHOST export failed" export CFLAGS="${CFLAGS}" || die "CFLAGS export failed" export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed" @@ -734,14 +734,14 @@ export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" -#setup distcc -#distcc mus be setup *before* ccache, as ccache need to be before distcc in path +# setup distcc +# distcc mus be setup *before* ccache, as ccache need to be before distcc in path if [ "${SMAGE_USE_DISTCC}" == "true" ] then setup_distcc_environment fi -#setup ccache +# setup ccache if [ "${SMAGE_USE_CCACHE}" == "true" ] then setup_ccache_environment @@ -762,33 +762,33 @@ #read #debug end -#cleans up build if a previously one exists +# cleans up build if a previously one exists if [ -d ${BUILDDIR} ] then rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." fi install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." -#cleans up srcdir if a previously unpacked one exists +# cleans up srcdir if a previously unpacked one exists if [ -d ${SRCDIR} ] then rm -rf ${SRCDIR} fi -#cleans up bindir if a previous build exists or creates a new one +# cleans up bindir if a previous build exists or creates a new one if [ -d ${BINDIR} ] then rm -rf ${BINDIR} fi install -d ${BINDIR} || die "couldn't create \$BINDIR." -#cleans up package temp dir if a previous build exists +# cleans up package temp dir if a previous build exists if [ -d ${BUILDDIR}/${PKGNAME} ] then rm -rf ${BUILDDIR}/${PKGNAME} fi -#cleans up timestamp if one exists +# cleans up timestamp if one exists if [ -f /var/tmp/timestamp ] then mage rmstamp @@ -799,7 +799,7 @@ src_install || die "src_install failed" -#compressing doc, info & man files +# compressing doc, info & man files echo -e "Compressing man-pages ..." if [ -d ${BUILDDIR}/builded/usr/share/man ] then @@ -825,18 +825,37 @@ ;; esac -#the new buildpkg command +# the new buildpkg command case ${NOPKGBUILD} in true|TRUE|yes|y) echo -e "NOPGKBUILD=true detected; Package will not be build ..." ;; - *) - ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" - echo -e "\nPackage ${PKGNAME} successfully builded.\n" + *) + # build serveral targets + if [ -n "${MAGE_TARGETS}" ] + then + for target in ${MAGE_TARGETS} + do + # check if an special target_pkgbuild exists + if typeset -f ${target}_pkgbuild > /dev/null + then + # run it + ${target}_pkgbuild + fi + # now create the target package + ${MLIBDIR}/pkgbuild_dir.sh \ + "${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD}" \ + ${BINDIR} || die "target: ${target} package-build failed" + echo -e "\nPackage ${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD} successfully builded.\n" + done + else + ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" + echo -e "\nPackage ${PKGNAME} successfully builded.\n" + fi ;; esac -#for sure +# for sure unset NOPKGBUILD unset NOSTRIP