7 |
# TODO: record dynlib, gz | xz database |
# TODO: record dynlib, gz | xz database |
8 |
|
|
9 |
|
|
10 |
# set default user mage.rc |
# set default variables |
11 |
: ${MAGERC="/etc/mage.rc"} |
: ${MAGERC="@@SYSCONFDIR@@/mage.rc"} |
12 |
|
: ${MLIBDIR="@@MAGELIBDIR@@"} |
13 |
|
|
14 |
# export default C locale |
# export default C locale |
15 |
export LC_ALL=C |
export LC_ALL=C |
16 |
|
|
17 |
source /etc/mage.rc.global |
# first of all include common functions |
18 |
source ${MAGERC} |
source ${MLIBDIR}/common.functions.sh || exit 1 |
19 |
source ${MLIBDIR}/mage4.functions.sh |
source @@SYSCONFDIR@@/mage.rc.global || die "@@SYSCONFDIR@@/mage.rc.global missing." |
20 |
source ${MLIBDIR}/smage2.functions.sh |
source ${MAGERC} || die "${MAGERC} missing." |
21 |
|
source ${MLIBDIR}/mage4.functions.sh || die "${MLIBDIR}/mage4.functions.sh missing." |
22 |
|
source ${MLIBDIR}/smage2.functions.sh || die "${MLIBDIR}/smage2.functions.sh missing." |
23 |
|
|
24 |
|
# export default path |
25 |
|
export PATH="${PATH}:${MLIBDIR}" |
26 |
|
|
27 |
|
print_usage() |
28 |
|
{ |
29 |
|
echo "Usage: $(basename $0) [option] pkgname ..." |
30 |
|
echo "Options:" |
31 |
|
echo "--smage" |
32 |
|
echo "--src-tarball" |
33 |
|
echo "--calc" |
34 |
|
echo "--update" |
35 |
|
echo "--download" |
36 |
|
echo "--regen" |
37 |
|
echo "--create-src-tarball" |
38 |
|
echo "--resume" |
39 |
|
echo |
40 |
|
echo "Environment variables::" |
41 |
|
echo " NOCOLORS=true $(basename $0) [src]install PACKAGE" |
42 |
|
echo " Disables all colors in the messages." |
43 |
|
echo |
44 |
|
} |
45 |
|
|
46 |
|
# very basic getops |
47 |
|
for i in $* |
48 |
|
do |
49 |
|
case $1 in |
50 |
|
--smage|*.${SMAGESUFFIX}) shift; SMAGENAME="$1" ;; |
51 |
|
--src-tarball) shift; SRCPKGTARBALL="$1" ;; |
52 |
|
--calc) shift; SMAGENAME="$1" ;; |
53 |
|
--update) ;; |
54 |
|
--download) shift; SMAGENAME="$1" ;; |
55 |
|
--regen) shift; SMAGENAME="$1" ;; |
56 |
|
--create-src-tarball) shift; SMAGENAME="$1" ;; |
57 |
|
--resume) ;; |
58 |
|
esac |
59 |
|
shift |
60 |
|
done |
61 |
|
|
62 |
## setup ## |
## setup ## |
63 |
SMAGENAME="$1" |
SMAGENAME="$1" |
|
SMAGEVERSION="$(< ${MLIBDIR}/version)" |
|
64 |
|
|
65 |
# expand PKGDIR, BUILDDIR and BINDIR with MROOT |
# expand PKGDIR, BUILDDIR and BINDIR with MROOT |
66 |
if [[ -n ${MROOT} ]] |
if [[ -n ${MROOT} ]] |
194 |
|
|
195 |
regen_mage_tree |
regen_mage_tree |
196 |
|
|
|
# build several targets |
|
|
if [[ -n ${MAGE_TARGETS} ]] |
|
|
then |
|
|
for target in ${MAGE_TARGETS} |
|
|
do |
|
|
# build md5sum for existing packages |
|
|
generate_package_md5sum \ |
|
|
--pcat "${PCAT}" \ |
|
|
--pname "${PNAME}" \ |
|
|
--pver "${PVER}" \ |
|
|
--pbuild "${PBUILD}" \ |
|
|
--parch "${ARCH}" \ |
|
|
--target "${target}" |
|
|
done |
|
|
|
|
197 |
# build several subpackages |
# build several subpackages |
198 |
elif [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
199 |
then |
then |
200 |
split_save_variables |
split_save_variables |
201 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
286 |
SMAGENAME="$2" |
SMAGENAME="$2" |
287 |
fi |
fi |
288 |
|
|
289 |
[ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting." |
[ ! -e ${MLIBDIR}/pkgbuild_dir ] && die "Error: ${MLIBDIR}/pkgbuild_dir not found. Aborting." |
290 |
[ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] && |
[ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] && |
291 |
die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting." |
die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting." |
292 |
[ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly." |
[ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly." |
305 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
306 |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
307 |
|
|
|
# auto regen mage tree if requested |
|
|
regen_mage_tree |
|
|
|
|
308 |
if mqueryfeature "srcpkgbuild" |
if mqueryfeature "srcpkgbuild" |
309 |
then |
then |
310 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
508 |
echo -e "!compressdoc detected; documentation of '${subpackage}' will not be compressed ..." |
echo -e "!compressdoc detected; documentation of '${subpackage}' will not be compressed ..." |
509 |
elif mqueryfeature "!pkgbuild" |
elif mqueryfeature "!pkgbuild" |
510 |
then |
then |
511 |
echo "!pkgbuild detected; skipping documentation compression for '${subpackage}' ..." |
echo "!pkgbuild detected; skipping documentation compression for '${subpackage}' ..." |
512 |
else |
else |
513 |
run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
514 |
resume_stamp post-mcompressdoc_${subpackage} |
resume_stamp post-mcompressdoc_${subpackage} |
515 |
fi |
fi |
516 |
# restore smage environment |
# restore smage environment |
517 |
split_restore_variables |
split_restore_variables |
719 |
then |
then |
720 |
echo -e "!pkgbuild detected; Package will not be build ..." |
echo -e "!pkgbuild detected; Package will not be build ..." |
721 |
else |
else |
|
# build several targets |
|
|
if [[ -n ${MAGE_TARGETS} ]] |
|
|
then |
|
|
for target in ${MAGE_TARGETS} |
|
|
do |
|
|
# check if a special target_pkgbuild exists |
|
|
if typeset -f ${target}_pkgbuild > /dev/null |
|
|
then |
|
|
# run it |
|
|
run_resume post-${target}_pkgbuild || ${target}_pkgbuild |
|
|
resume_stamp post-${target}_pkgbuild |
|
|
fi |
|
|
# now create the target package |
|
|
run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ |
|
|
"${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
|
|
${BINDIR} || die "target: ${target} package-build failed" |
|
|
resume_stamp post-pkg_builddir_${target} |
|
|
|
|
|
# build pkg-md5-sum if requested |
|
|
run_resume post-md5sum_${target} || generate_package_md5sum \ |
|
|
--pcat "${PCAT}" \ |
|
|
--pname "${PNAME}" \ |
|
|
--pver "${PVER}" \ |
|
|
--pbuild "${PBUILD}" \ |
|
|
--parch "${ARCH}" \ |
|
|
--target "${target}" |
|
|
resume_stamp post-md5sum_${target} |
|
|
|
|
|
echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD} successfully builded.\n${COLDEFAULT}" |
|
|
done |
|
|
|
|
722 |
# build several subpackages |
# build several subpackages |
723 |
elif [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
724 |
then |
then |
725 |
split_save_variables |
split_save_variables |
726 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
756 |
resume_stamp post-${PNAME}_pkgbuild |
resume_stamp post-${PNAME}_pkgbuild |
757 |
fi |
fi |
758 |
# now create the target package |
# now create the target package |
759 |
run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ |
run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir \ |
760 |
"${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
"${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
761 |
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
762 |
resume_stamp post-pkg_builddir_${PNAME} |
resume_stamp post-pkg_builddir_${PNAME} |
779 |
split_unset_variables |
split_unset_variables |
780 |
|
|
781 |
else |
else |
782 |
run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir ${PKGNAME} ${BINDIR} || die "package-build failed" |
783 |
resume_stamp post-pkg_builddir |
resume_stamp post-pkg_builddir |
784 |
|
|
785 |
# build pkg-md5-sum if requested |
# build pkg-md5-sum if requested |
802 |
fi |
fi |
803 |
fi |
fi |
804 |
|
|
805 |
|
# auto regen mage tree if requested |
806 |
|
regen_mage_tree |
807 |
|
|
808 |
if mqueryfeature "buildlog" |
if mqueryfeature "buildlog" |
809 |
then |
then |
810 |
bzip2 -9f /var/log/smage/${PKGNAME}.log |
bzip2 -9f /var/log/smage/${PKGNAME}.log |