178 |
# get the right variables for the split |
# get the right variables for the split |
179 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
180 |
split_info_${subpackage} |
split_info_${subpackage} |
181 |
|
# fix PCATEGORIE -> PCAT |
182 |
|
if [[ ! -z ${PCATEGORIE} ]] |
183 |
|
then |
184 |
|
PCAT="${PCATEGORIE}" |
185 |
|
unset PCATEGORIE |
186 |
|
fi |
187 |
# build md5sum for existing packages |
# build md5sum for existing packages |
188 |
generate_package_md5sum \ |
generate_package_md5sum \ |
189 |
--pcat "${PCAT}" \ |
--pcat "${PCAT}" \ |
273 |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
274 |
|
|
275 |
smagesource ${SMAGENAME} || die "source failed" |
smagesource ${SMAGENAME} || die "source failed" |
276 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" |
277 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
278 |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
279 |
|
|
406 |
export SAVED_BINDIR="${BINDIR}" |
export SAVED_BINDIR="${BINDIR}" |
407 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
408 |
do |
do |
409 |
if typeset -f src_install_${subpackage} > /dev/null |
split_info_${subpackage} |
410 |
|
if [[ ${PKGTYPE} = virtual ]] |
411 |
then |
then |
|
# export subpackage bindir |
|
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
|
|
# export PNAME, several internal function and include |
|
|
# rely on this variable |
|
|
export PNAME="${subpackage}" |
|
|
|
|
412 |
echo |
echo |
413 |
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
414 |
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
echo -en "Virtual package detected" |
415 |
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
416 |
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
417 |
|
|
418 |
( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} |
echo "virtual package detected; nothing will be build ..." |
419 |
die_pipestatus 0 "src_install_${subpackage} failed" |
# automatically set !pkgbuild here too |
420 |
resume_stamp src_install_${subpackage} |
msetfeature "!pkgbuild" |
421 |
step_by_step src_install_${subpackage} |
else |
422 |
|
if typeset -f src_install_${subpackage} > /dev/null |
423 |
|
then |
424 |
|
# export subpackage bindir |
425 |
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
426 |
|
# export PNAME, several internal function and include |
427 |
|
# rely on this variable |
428 |
|
export PNAME="${subpackage}" |
429 |
|
|
430 |
|
echo |
431 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
432 |
|
echo -en "Running ${COLGREEN}split src_install()${COLDEFAULT}" |
433 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
434 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
435 |
|
|
436 |
|
( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} |
437 |
|
die_pipestatus 0 "src_install_${subpackage} failed" |
438 |
|
resume_stamp src_install_${subpackage} |
439 |
|
step_by_step src_install_${subpackage} |
440 |
|
fi |
441 |
fi |
fi |
442 |
|
# restore smage environment |
443 |
|
split_restore_variables |
444 |
done |
done |
|
# restore bindir & pname |
|
|
split_restore_variables |
|
445 |
# unset all saved smage variables |
# unset all saved smage variables |
446 |
split_unset_variables |
split_unset_variables |
447 |
else |
else |
465 |
# compressing doc, info & man files |
# compressing doc, info & man files |
466 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
467 |
then |
then |
468 |
|
# save smage environment |
469 |
|
split_save_variables |
470 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
471 |
do |
do |
472 |
run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
# honor split_info |
473 |
resume_stamp post-mcompressdoc_${subpackage} |
split_info_${subpackage} |
474 |
|
|
475 |
|
if mqueryfeature "!compressdoc" |
476 |
|
then |
477 |
|
echo -e "!compressdoc detected; documentation of '${subpackage}' will not be compressed ..." |
478 |
|
elif mqueryfeature "!pkgbuild" |
479 |
|
then |
480 |
|
echo "!pkgbuild detected; skipping documentation compression for '${subpackage}' ..." |
481 |
|
else |
482 |
|
run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
483 |
|
resume_stamp post-mcompressdoc_${subpackage} |
484 |
|
fi |
485 |
|
# restore smage environment |
486 |
|
split_restore_variables |
487 |
done |
done |
488 |
|
# unset saved variables |
489 |
|
split_unset_variables |
490 |
else |
else |
491 |
run_resume post-mcompressdoc || mcompressdocs ${BINDIR} |
run_resume post-mcompressdoc || mcompressdocs ${BINDIR} |
492 |
resume_stamp post-mcompressdoc |
resume_stamp post-mcompressdoc |
501 |
else |
else |
502 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
503 |
then |
then |
504 |
|
# save smage environment |
505 |
|
split_save_variables |
506 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
507 |
do |
do |
508 |
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" |
# honor split_info |
509 |
run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} |
split_info_${subpackage} |
510 |
resume_stamp post-mstriplibtoolarchive_${subpackage} |
|
511 |
|
if mqueryfeature "!libtool" |
512 |
|
then |
513 |
|
if mqueryfeature "!pkgbuild" |
514 |
|
then |
515 |
|
echo "!pkgbuild detected; skipping libtool archive stripping for '${subpackage}'..." |
516 |
|
else |
517 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" |
518 |
|
run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} |
519 |
|
resume_stamp post-mstriplibtoolarchive_${subpackage} |
520 |
|
fi |
521 |
|
fi |
522 |
|
|
523 |
|
# restore smage environment |
524 |
|
split_restore_variables |
525 |
done |
done |
526 |
|
# unset saved variables |
527 |
|
split_unset_variables |
528 |
else |
else |
529 |
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
530 |
run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} |
run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} |
537 |
then |
then |
538 |
if mqueryfeature "!pkgbuild" |
if mqueryfeature "!pkgbuild" |
539 |
then |
then |
540 |
echo "!pkgbuild detected; skipping file purgation..." |
echo "!pkgbuild detected; skipping file purgation ..." |
541 |
else |
else |
542 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
543 |
then |
then |
544 |
|
# save smage environment |
545 |
|
split_save_variables |
546 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
547 |
do |
do |
548 |
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" |
# honor split_info |
549 |
run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} |
split_info_${subpackage} |
550 |
resume_stamp post-mpurgetargets_${subpackage} |
|
551 |
|
if mqueryfeature "purge" |
552 |
|
then |
553 |
|
if mqueryfeature "!pkgbuild" |
554 |
|
then |
555 |
|
echo "!pkgbuild detected; skipping file purgation for '${subpackage}' ..." |
556 |
|
else |
557 |
|
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" |
558 |
|
run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} |
559 |
|
resume_stamp post-mpurgetargets_${subpackage} |
560 |
|
fi |
561 |
|
fi |
562 |
|
|
563 |
|
# restore smage environment |
564 |
|
split_restore_variables |
565 |
done |
done |
566 |
|
# unset saved variables |
567 |
|
split_unset_variables |
568 |
else |
else |
569 |
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
570 |
run_resume post-mpurgetargets || mpurgetargets ${BINDIR} |
run_resume post-mpurgetargets || mpurgetargets ${BINDIR} |
576 |
# stripping all bins and libs |
# stripping all bins and libs |
577 |
if mqueryfeature "!strip" |
if mqueryfeature "!strip" |
578 |
then |
then |
579 |
echo -e "!strip detected; Package will not be stripped ..." |
echo -e "!strip detected; package will not be stripped ..." |
580 |
elif mqueryfeature "!pkgbuild" |
elif mqueryfeature "!pkgbuild" |
581 |
then |
then |
582 |
echo "!pkgbuild detected; skipping stripping of the package ..." |
echo "!pkgbuild detected; skipping stripping of the package ..." |
583 |
else |
else |
584 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
585 |
then |
then |
586 |
|
# save smage environment |
587 |
|
split_save_variables |
588 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
589 |
do |
do |
590 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
# honor split_info |
591 |
run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} |
split_info_${subpackage} |
592 |
resume_stamp post-mstripbins_${subpackage} |
|
593 |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
if mqueryfeature "!strip" |
594 |
run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} |
then |
595 |
resume_stamp post-mstriplibs_${subpackage} |
echo -e "!strip detected; package '${subpackage}' will not be stripped ..." |
596 |
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
elif mqueryfeature "!pkgbuild" |
597 |
run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} |
then |
598 |
resume_stamp post-mstripstatic_${subpackage} |
echo "!pkgbuild detected; skipping stripping of the package '${subpackage}' ..." |
599 |
|
else |
600 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
601 |
|
run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} |
602 |
|
resume_stamp post-mstripbins_${subpackage} |
603 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
604 |
|
run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} |
605 |
|
resume_stamp post-mstriplibs_${subpackage} |
606 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
607 |
|
run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} |
608 |
|
resume_stamp post-mstripstatic_${subpackage} |
609 |
|
fi |
610 |
|
|
611 |
|
# restore smage environment |
612 |
|
split_restore_variables |
613 |
done |
done |
614 |
|
# unset saved variables |
615 |
|
split_unset_variables |
616 |
else |
else |
617 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
618 |
run_resume post-mstripbins || mstripbins ${BINDIR} |
run_resume post-mstripbins || mstripbins ${BINDIR} |
644 |
fi |
fi |
645 |
# now create the target package |
# now create the target package |
646 |
run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ |
run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ |
647 |
"${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \ |
"${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
648 |
${BINDIR} || die "target: ${target} package-build failed" |
${BINDIR} || die "target: ${target} package-build failed" |
649 |
resume_stamp post-pkg_builddir_${target} |
resume_stamp post-pkg_builddir_${target} |
650 |
|
|
658 |
--target "${target}" |
--target "${target}" |
659 |
resume_stamp post-md5sum_${target} |
resume_stamp post-md5sum_${target} |
660 |
|
|
661 |
echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD} successfully builded.\n${COLDEFAULT}" |
662 |
done |
done |
663 |
|
|
664 |
# build several subpackages |
# build several subpackages |
670 |
# get the right variables for the split |
# get the right variables for the split |
671 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
672 |
split_info_${PNAME} |
split_info_${PNAME} |
673 |
|
# fix PCATEGORIE -> PCAT |
674 |
|
if [[ ! -z ${PCATEGORIE} ]] |
675 |
|
then |
676 |
|
PCAT="${PCATEGORIE}" |
677 |
|
unset PCATEGORIE |
678 |
|
fi |
679 |
|
|
680 |
# jump to next one if !pkgbuild is set in split_info |
# jump to next one if !pkgbuild is set in split_info |
681 |
mqueryfeature "!pkgbuild" && continue |
if mqueryfeature "!pkgbuild" |
682 |
|
then |
683 |
|
# restore smage environment |
684 |
|
split_restore_variables |
685 |
|
continue |
686 |
|
fi |
687 |
|
|
688 |
# check if an special subpackage_pkgbuild exists |
# check if an special subpackage_pkgbuild exists |
689 |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
694 |
fi |
fi |
695 |
# now create the target package |
# now create the target package |
696 |
run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ |
run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ |
697 |
"${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ |
"${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
698 |
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
699 |
resume_stamp post-pkg_builddir_${PNAME} |
resume_stamp post-pkg_builddir_${PNAME} |
700 |
|
|
707 |
--parch "${ARCH}" |
--parch "${ARCH}" |
708 |
resume_stamp post-md5sum_${PNAME} |
resume_stamp post-md5sum_${PNAME} |
709 |
|
|
710 |
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD} successfully builded.\n${COLDEFAULT}" |
711 |
|
|
712 |
# restore smage environment |
# restore smage environment |
713 |
split_restore_variables |
split_restore_variables |