4 |
# needs pkgbuild_dir (mage) |
# needs pkgbuild_dir (mage) |
5 |
|
|
6 |
# SMAGE2 |
# SMAGE2 |
7 |
# $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 $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
230 |
return 0 |
return 0 |
231 |
} |
} |
232 |
|
|
|
|
|
|
build_mage_script() { |
|
|
return 0 |
|
|
} |
|
|
|
|
233 |
mconfigure() { |
mconfigure() { |
234 |
if [ -x ./configure ] |
if [ -x ./configure ] |
235 |
then |
then |
406 |
fi |
fi |
407 |
} |
} |
408 |
|
|
409 |
# alx_create_mage_file: helper functions for regen_mage_tree() |
# build_mage_script(): helper functions for regen_mage_tree() |
410 |
# generates an mage file with given information in smage file |
# generates an mage file with given information in smage file |
411 |
# needs at least: |
# needs at least: |
412 |
# PNAME name of pkg |
# PNAME name of pkg |
428 |
# |
# |
429 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
430 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
431 |
alx_create_mage_file() |
build_mage_script() |
432 |
{ |
{ |
433 |
local magefile |
local magefile |
434 |
local dest |
local dest |
457 |
> ${dest} |
> ${dest} |
458 |
|
|
459 |
# header |
# header |
460 |
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} |
461 |
echo >> ${dest} |
echo >> ${dest} |
462 |
|
|
463 |
# pgkname and state |
# pgkname and state |
499 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
500 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
501 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
502 |
unset "${i}" |
#unset "${i}" <-- later to get every target built |
503 |
done |
done |
504 |
fi |
fi |
505 |
|
|
525 |
for i in ${MAGE_TARGETS} |
for i in ${MAGE_TARGETS} |
526 |
do |
do |
527 |
echo |
echo |
528 |
alx_create_mage_file "${i}" |
build_mage_script "${i}" |
529 |
echo |
echo |
530 |
done |
done |
531 |
fi |
fi |
532 |
|
|
533 |
# now unset all uneeded vars to be safe |
# now unset all uneeded vars to be safe |
534 |
unset PKGNAME |
# unset PKGNAME <-- don't do that; smage needs this var |
535 |
|
# unset to be safe (quotes needed !) |
536 |
|
for i in ${SPECIAL_FUNCTIONS} |
537 |
|
do |
538 |
|
unset "${i}" |
539 |
|
done |
540 |
|
unset SPECIAL_FUNCTIONS |
541 |
unset STATE |
unset STATE |
542 |
unset DESCRIPTION |
unset DESCRIPTION |
543 |
unset HOMEPAGE |
unset HOMEPAGE |
546 |
unset DEPEND |
unset DEPEND |
547 |
unset SDEPEND |
unset SDEPEND |
548 |
unset PROVIDE |
unset PROVIDE |
|
unset SPECIAL_FUNCTIONS |
|
549 |
unset preinstall |
unset preinstall |
550 |
unset postinstall |
unset postinstall |
551 |
unset preremove |
unset preremove |
563 |
exit 1 |
exit 1 |
564 |
fi |
fi |
565 |
|
|
566 |
#updating smage2-scripts |
# updating smage2-scripts |
567 |
if [ "$1" == "update" ] |
if [ "$1" == "update" ] |
568 |
then |
then |
569 |
if [ ! -d ${SOURCEDIR} ] |
if [ ! -d ${SOURCEDIR} ] |
574 |
exit 0 |
exit 0 |
575 |
fi |
fi |
576 |
|
|
577 |
#creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
578 |
if [ "$1" == "calcmd5" ] |
if [ "$1" == "calcmd5" ] |
579 |
then |
then |
580 |
if [ $# -ge 3 ] |
if [ $# -ge 3 ] |
644 |
exit 0 |
exit 0 |
645 |
fi |
fi |
646 |
|
|
647 |
#download sources |
# download sources |
648 |
if [ "$1" == "download" -a -n "$2" ] |
if [ "$1" == "download" -a -n "$2" ] |
649 |
then |
then |
650 |
if [ ! -d ${SMAGESCRIPTSDIR} ] |
if [ ! -d ${SMAGESCRIPTSDIR} ] |
718 |
# auto regen mage tree if requested |
# auto regen mage tree if requested |
719 |
regen_mage_tree |
regen_mage_tree |
720 |
|
|
721 |
#download sources |
# download sources |
722 |
download_sources |
download_sources |
723 |
|
|
724 |
#fixes some issues with these functions |
# fixes some issues with these functions |
725 |
export -f src_prepare || die "src_prepare export failed" |
export -f src_prepare || die "src_prepare export failed" |
726 |
export -f src_compile || die "src_compile export failed" |
export -f src_compile || die "src_compile export failed" |
727 |
export -f src_install || die "src_install export failed" |
export -f src_install || die "src_install export failed" |
728 |
|
|
729 |
#fixes some compile issues |
# fixes some compile issues |
730 |
export CHOST="${CHOST}" || die "CHOST export failed" |
export CHOST="${CHOST}" || die "CHOST export failed" |
731 |
export CFLAGS="${CFLAGS}" || die "CFLAGS export failed" |
export CFLAGS="${CFLAGS}" || die "CFLAGS export failed" |
732 |
export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed" |
export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed" |
734 |
export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" |
export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" |
735 |
|
|
736 |
|
|
737 |
#setup distcc |
# setup distcc |
738 |
#distcc mus be setup *before* ccache, as ccache need to be before distcc in path |
# distcc mus be setup *before* ccache, as ccache need to be before distcc in path |
739 |
if [ "${SMAGE_USE_DISTCC}" == "true" ] |
if [ "${SMAGE_USE_DISTCC}" == "true" ] |
740 |
then |
then |
741 |
setup_distcc_environment |
setup_distcc_environment |
742 |
fi |
fi |
743 |
|
|
744 |
#setup ccache |
# setup ccache |
745 |
if [ "${SMAGE_USE_CCACHE}" == "true" ] |
if [ "${SMAGE_USE_CCACHE}" == "true" ] |
746 |
then |
then |
747 |
setup_ccache_environment |
setup_ccache_environment |
762 |
#read |
#read |
763 |
#debug end |
#debug end |
764 |
|
|
765 |
#cleans up build if a previously one exists |
# cleans up build if a previously one exists |
766 |
if [ -d ${BUILDDIR} ] |
if [ -d ${BUILDDIR} ] |
767 |
then |
then |
768 |
rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." |
rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." |
769 |
fi |
fi |
770 |
install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." |
install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." |
771 |
|
|
772 |
#cleans up srcdir if a previously unpacked one exists |
# cleans up srcdir if a previously unpacked one exists |
773 |
if [ -d ${SRCDIR} ] |
if [ -d ${SRCDIR} ] |
774 |
then |
then |
775 |
rm -rf ${SRCDIR} |
rm -rf ${SRCDIR} |
776 |
fi |
fi |
777 |
|
|
778 |
#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 |
779 |
if [ -d ${BINDIR} ] |
if [ -d ${BINDIR} ] |
780 |
then |
then |
781 |
rm -rf ${BINDIR} |
rm -rf ${BINDIR} |
782 |
fi |
fi |
783 |
install -d ${BINDIR} || die "couldn't create \$BINDIR." |
install -d ${BINDIR} || die "couldn't create \$BINDIR." |
784 |
|
|
785 |
#cleans up package temp dir if a previous build exists |
# cleans up package temp dir if a previous build exists |
786 |
if [ -d ${BUILDDIR}/${PKGNAME} ] |
if [ -d ${BUILDDIR}/${PKGNAME} ] |
787 |
then |
then |
788 |
rm -rf ${BUILDDIR}/${PKGNAME} |
rm -rf ${BUILDDIR}/${PKGNAME} |
789 |
fi |
fi |
790 |
|
|
791 |
#cleans up timestamp if one exists |
# cleans up timestamp if one exists |
792 |
if [ -f /var/tmp/timestamp ] |
if [ -f /var/tmp/timestamp ] |
793 |
then |
then |
794 |
mage rmstamp |
mage rmstamp |
799 |
src_install || die "src_install failed" |
src_install || die "src_install failed" |
800 |
|
|
801 |
|
|
802 |
#compressing doc, info & man files |
# compressing doc, info & man files |
803 |
echo -e "Compressing man-pages ..." |
echo -e "Compressing man-pages ..." |
804 |
if [ -d ${BUILDDIR}/builded/usr/share/man ] |
if [ -d ${BUILDDIR}/builded/usr/share/man ] |
805 |
then |
then |
825 |
;; |
;; |
826 |
esac |
esac |
827 |
|
|
828 |
#the new buildpkg command |
# the new buildpkg command |
829 |
case ${NOPKGBUILD} in |
case ${NOPKGBUILD} in |
830 |
true|TRUE|yes|y) |
true|TRUE|yes|y) |
831 |
echo -e "NOPGKBUILD=true detected; Package will not be build ..." |
echo -e "NOPGKBUILD=true detected; Package will not be build ..." |
832 |
;; |
;; |
833 |
*) |
*) |
834 |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
# build serveral targets |
835 |
echo -e "\nPackage ${PKGNAME} successfully builded.\n" |
if [ -n "${MAGE_TARGETS}" ] |
836 |
|
then |
837 |
|
for target in ${MAGE_TARGETS} |
838 |
|
do |
839 |
|
# check if an special target_pkgbuild exists |
840 |
|
if typeset -f ${target}_pkgbuild > /dev/null |
841 |
|
then |
842 |
|
# run it |
843 |
|
${target}_pkgbuild |
844 |
|
fi |
845 |
|
# now create the target package |
846 |
|
${MLIBDIR}/pkgbuild_dir.sh \ |
847 |
|
"${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD}" \ |
848 |
|
${BINDIR} || die "target: ${target} package-build failed" |
849 |
|
echo -e "\nPackage ${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD} successfully builded.\n" |
850 |
|
done |
851 |
|
else |
852 |
|
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
853 |
|
echo -e "\nPackage ${PKGNAME} successfully builded.\n" |
854 |
|
fi |
855 |
;; |
;; |
856 |
esac |
esac |
857 |
|
|
858 |
#for sure |
# for sure |
859 |
unset NOPKGBUILD |
unset NOPKGBUILD |
860 |
unset NOSTRIP |
unset NOSTRIP |
861 |
|
|