7 |
smagesource() |
smagesource() |
8 |
{ |
{ |
9 |
local file="$1" |
local file="$1" |
10 |
local mystate |
local localstate |
11 |
|
local distfilestate |
12 |
local mytag |
local mytag |
13 |
|
|
14 |
source ${file} |
source ${file} |
20 |
if [[ -n ${PCATEGORIE} ]] |
if [[ -n ${PCATEGORIE} ]] |
21 |
then |
then |
22 |
PCAT="${PCATEGORIE}" |
PCAT="${PCATEGORIE}" |
23 |
|
unset PCATEGORIE |
24 |
# print a warning |
# print a warning |
25 |
echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}" |
echo -e "${COLYELLOW}Warning: 'PCATEGORIE' is deprecated and gets removed in the future.${COLDEFAULT}" |
26 |
echo -e "${COLYELLOW} Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}" |
echo -e "${COLYELLOW} Please modify this smage2 script to use the 'PCAT' variable.${COLDEFAULT}" |
30 |
fi |
fi |
31 |
fi |
fi |
32 |
|
|
33 |
[[ -n ${STATE} ]] && mystate="${STATE}" |
[[ -n ${STATE} ]] && localstate="${STATE}" |
34 |
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
35 |
|
|
|
# do not overide if local state was broken or disabled! |
|
|
case ${STATE} in |
|
|
broken) return ;; |
|
|
disabled) return ;; |
|
|
esac |
|
|
|
|
36 |
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
37 |
then |
then |
38 |
source ${SMAGESCRIPTSDIR}/distribution |
source ${SMAGESCRIPTSDIR}/distribution |
39 |
[[ -n ${STATE} ]] && mystate="${STATE}" |
[[ -n ${STATE} ]] && distfilestate="${STATE}" |
40 |
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
[[ -n ${DISTROTAG} ]] && mytag="${DISTROTAG}" |
41 |
fi |
fi |
42 |
# now switch state and export it |
# now switch state and export it but do not overide any local states |
43 |
STATE="${mystate}" |
if [[ ! -z ${localstate} ]] |
44 |
|
then |
45 |
|
STATE="${localstate}" |
46 |
|
else |
47 |
|
STATE="${distfilestate}" |
48 |
|
fi |
49 |
|
|
50 |
if mqueryfeature "pkgdistrotag" |
if mqueryfeature "pkgdistrotag" |
51 |
then |
then |
59 |
echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}" |
echo -e "${COLRED}Requested 'pkgdistrotag' but no \$DISTROTAG found!${COLDEFAULT}" |
60 |
echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}" |
echo -e "${COLRED}Disabled the feature for pkgbuild sanity!${COLDEFAULT}" |
61 |
else |
else |
62 |
# now switch state and export it |
# now switch state and export it but do not overide any local states |
63 |
export DISTROTAG="${mytag}" |
export DISTROTAG="${mytag}" |
64 |
fi |
fi |
65 |
else |
else |
225 |
} |
} |
226 |
|
|
227 |
# dummy function, used if that does not exist in smage file |
# dummy function, used if that does not exist in smage file |
228 |
|
pkg_setup() |
229 |
|
{ |
230 |
|
echo "no pkg_setup defined; doing nothing ..." |
231 |
|
return 0 |
232 |
|
} |
233 |
|
|
234 |
|
# dummy function, used if that does not exist in smage file |
235 |
src_prepare() |
src_prepare() |
236 |
{ |
{ |
237 |
echo "no src_prepare defined; doing nothing ..." |
echo "no src_prepare defined; doing nothing ..." |
288 |
fi |
fi |
289 |
fi |
fi |
290 |
|
|
291 |
# always enable shared by default |
# always enable shared by default but not for waf configure |
292 |
if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] |
if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]] && |
293 |
|
[[ -z $(./configure --version | grep waf) ]] |
294 |
then |
then |
295 |
myopts+=" --enable-shared" |
myopts+=" --enable-shared" |
296 |
fi |
fi |
325 |
sysconfdir=${BINDIR}/etc \ |
sysconfdir=${BINDIR}/etc \ |
326 |
libdir=${BINDIR}/usr/$(mlibdir) \ |
libdir=${BINDIR}/usr/$(mlibdir) \ |
327 |
"$@" install || die "minstall failed" |
"$@" install || die "minstall failed" |
328 |
else |
else |
329 |
die "no Makefile found" |
die "no Makefile found" |
330 |
fi |
fi |
331 |
} |
} |
332 |
|
|
333 |
mmake() |
mmake() |
350 |
DEST=$2 |
DEST=$2 |
351 |
fi |
fi |
352 |
|
|
353 |
|
echo -e "${COLBLUE}>>>${COLGREEN} Unpacking ${SOURCEDIR}/${PNAME}/${SRCFILE}${COLDEFAULT}" |
354 |
|
|
355 |
[[ ! -d ${DEST} ]] && install -d ${DEST} |
[[ ! -d ${DEST} ]] && install -d ${DEST} |
356 |
|
|
357 |
case "${SRCFILE##*.}" in |
case "${SRCFILE##*.}" in |
401 |
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed." |
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed." |
402 |
;; |
;; |
403 |
rar) |
rar) |
404 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
405 |
;; |
;; |
406 |
zip|xpi|jar) |
zip|xpi|jar) |
407 |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
573 |
then |
then |
574 |
for i in $@ |
for i in $@ |
575 |
do |
do |
576 |
echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" |
[[ ${SILENT} = 1 ]] || echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" |
577 |
source ${SMAGESCRIPTSDIR}/include/${i}.sminc |
source ${SMAGESCRIPTSDIR}/include/${i}.sminc |
578 |
done |
done |
579 |
echo |
[[ ${SILENT} = 1 ]] || echo |
580 |
fi |
fi |
581 |
} |
} |
582 |
|
|
583 |
|
march() |
584 |
|
{ |
585 |
|
local retval |
586 |
|
|
587 |
|
if [[ ! -z ${ARCH} ]] |
588 |
|
then |
589 |
|
echo "${ARCH}" |
590 |
|
retval=0 |
591 |
|
else |
592 |
|
retval=1 |
593 |
|
fi |
594 |
|
|
595 |
|
return "${retval}" |
596 |
|
} |
597 |
|
|
598 |
|
marchsrcfile() |
599 |
|
{ |
600 |
|
local retval |
601 |
|
local var="$1" |
602 |
|
|
603 |
|
[[ -z ${var} ]] && var="SRCFILE" |
604 |
|
|
605 |
|
if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]] |
606 |
|
then |
607 |
|
eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n' |
608 |
|
retval=0 |
609 |
|
else |
610 |
|
retval=1 |
611 |
|
fi |
612 |
|
|
613 |
|
return "${retval}" |
614 |
|
} |
615 |
|
|
616 |
|
marchsrcdir() |
617 |
|
{ |
618 |
|
local retval |
619 |
|
local var="$1" |
620 |
|
|
621 |
|
[[ -z ${var} ]] && var="SRCDIR" |
622 |
|
|
623 |
|
if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]] |
624 |
|
then |
625 |
|
eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n' |
626 |
|
retval=0 |
627 |
|
else |
628 |
|
retval=1 |
629 |
|
fi |
630 |
|
|
631 |
|
return "${retval}" |
632 |
|
} |
633 |
|
|
634 |
|
marchdepend() |
635 |
|
{ |
636 |
|
local retval |
637 |
|
local var="$1" |
638 |
|
|
639 |
|
[[ -z ${var} ]] && var="DEPEND" |
640 |
|
|
641 |
|
if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]] |
642 |
|
then |
643 |
|
# evaluate with escape strings for the magefile if called by smage |
644 |
|
# but do not escape if the smagefile was called by depwalker directly |
645 |
|
if [[ ${SMAGE_DEPEND} = 1 ]] |
646 |
|
then |
647 |
|
eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n' |
648 |
|
else |
649 |
|
echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')" |
650 |
|
fi |
651 |
|
retval=0 |
652 |
|
else |
653 |
|
retval=1 |
654 |
|
fi |
655 |
|
|
656 |
|
return "${retval}" |
657 |
|
} |
658 |
|
|
659 |
|
marchsdepend() |
660 |
|
{ |
661 |
|
local retval |
662 |
|
local var="$1" |
663 |
|
|
664 |
|
[[ -z ${var} ]] && var="SDEPEND" |
665 |
|
|
666 |
|
if [[ ! -z $(eval echo \$${var}_${ARCH/i*86/x86}) ]] |
667 |
|
then |
668 |
|
# evaluate with escape strings for the magefile if called by smage |
669 |
|
# but do not escape if the smagefile was called by depwalker directly |
670 |
|
if [[ ${SMAGE_DEPEND} = 1 ]] |
671 |
|
then |
672 |
|
eval echo \$${var}_${ARCH/i*86/x86} | tr ';' '\n' |
673 |
|
else |
674 |
|
echo "\$(eval echo \\\$${var}_\${ARCH/i*86/x86} | tr ';' '\n')" |
675 |
|
fi |
676 |
|
retval=0 |
677 |
|
else |
678 |
|
retval=1 |
679 |
|
fi |
680 |
|
|
681 |
|
return "${retval}" |
682 |
|
} |
683 |
|
|
684 |
setup_distcc_environment() |
setup_distcc_environment() |
685 |
{ |
{ |
686 |
if [ -x /usr/bin/distcc ] |
if [ -x /usr/bin/distcc ] |
696 |
fi |
fi |
697 |
} |
} |
698 |
|
|
699 |
setup_ccache_environment() |
setup_icecc_environment() |
700 |
{ |
{ |
701 |
if [ -x /usr/bin/ccache ] |
if [ -x /usr/bin/icecc ] |
702 |
then |
then |
703 |
echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}" |
echo -e "${COLBLUE}---${COLGREEN} Using IceCC for compilation ...${COLDEFAULT}" |
704 |
export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH" |
export PATH=/usr/$(mlibdir)/icecc/bin:${PATH} || die "icecc: could not export new $PATH" |
705 |
fi |
fi |
706 |
} |
} |
707 |
|
|
708 |
# fixes given dependencies to match a MAGE_TARGET |
setup_ccache_environment() |
709 |
# fix_mage_deps -target s/depend # <-- note -target ! |
{ |
710 |
fix_mage_deps() |
if [ -x /usr/bin/ccache ] |
|
{ |
|
|
local target="$1" |
|
|
local depend="$2" |
|
|
local NDEPEND |
|
|
local sym dep cat pver pname |
|
|
|
|
|
# deps and provides are special |
|
|
# they must be fixed to match the target |
|
|
|
|
|
# run this only if target and depend is not empty |
|
|
if [ -n "${target}" ] && [ -n "${depend}" ] |
|
711 |
then |
then |
712 |
# fix DEPEND |
mqueryfeature "icecc" && export CCACHE_PREFIX=icecc |
|
while read sym dep |
|
|
do |
|
|
# ignore empty lines |
|
|
[[ -z ${dep} ]] && continue |
|
|
|
|
|
cat="$(dirname ${dep})" |
|
|
# change if not virtual |
|
|
if [[ ${cat} = virtual ]] |
|
|
then |
|
|
pname="$(basename ${dep})" |
|
|
else |
|
|
# fix pver to target-pver |
|
|
# to get pname-target-pver |
|
|
|
|
|
# doing it backwards ! |
|
|
pver="${dep##*-}" |
|
|
# full pver |
|
|
pname="$(basename ${dep/-${pver}/})${target}-${pver}" |
|
|
fi |
|
|
|
|
|
# do not add empty lines |
|
|
if [ -z "${NDEPEND}" ] |
|
|
then |
|
|
NDEPEND="${sym} ${cat}/${pname}" |
|
|
else |
|
|
NDEPEND="${NDEPEND} |
|
|
${sym} ${cat}/${pname}" |
|
|
fi |
|
713 |
|
|
714 |
unset cat pname pver |
echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}" |
715 |
done << EOF |
export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH" |
|
${depend} |
|
|
EOF |
|
|
# set NDEPEND to DEPEND |
|
|
depend="${NDEPEND}" |
|
716 |
fi |
fi |
|
|
|
|
echo "${depend}" |
|
717 |
} |
} |
718 |
|
|
719 |
# build_mage_script(): helper functions for regen_mage_tree() |
# build_mage_script(): helper functions for regen_mage_tree() |
749 |
{ |
{ |
750 |
local magefile |
local magefile |
751 |
local dest |
local dest |
|
local target |
|
752 |
local split_pkg_base |
local split_pkg_base |
753 |
local sym |
local sym |
754 |
local depname |
local depname |
756 |
# if MAGE_TREE_DEST not set use BUILDDIR |
# if MAGE_TREE_DEST not set use BUILDDIR |
757 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
758 |
|
|
|
# determinate which suffix this mage file should get, if any |
|
|
[[ $1 = --target ]] && shift && target="-$1" |
|
|
|
|
759 |
# mark package as splitpackage |
# mark package as splitpackage |
760 |
[[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1" |
[[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1" |
761 |
|
|
762 |
# name of magefile |
# name of magefile |
763 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}-${PVER}-${PBUILD}.mage" |
764 |
|
|
765 |
# destination to magefile |
# destination to magefile |
766 |
dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}${target}/${magefile}" |
dest="${MAGE_TREE_DEST}/${PCAT}/${PNAME}/${magefile}" |
767 |
|
|
768 |
# show what we are doing |
# show what we are doing |
769 |
echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}" |
774 |
> ${dest} |
> ${dest} |
775 |
|
|
776 |
# pgkname and state |
# pgkname and state |
777 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}-${PVER}-\${ARCH}$(print_distrotag)-${PBUILD}\"" >> ${dest} |
778 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
779 |
|
|
780 |
# description and homepage |
# description and homepage |
787 |
# special tags and vars |
# special tags and vars |
788 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
789 |
|
|
|
# echo MAGE_TARGETS ## note -target is needed ! |
|
|
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
|
|
|
790 |
# split package base |
# split package base |
791 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
792 |
|
|
815 |
fi |
fi |
816 |
|
|
817 |
# deps and provides |
# deps and provides |
818 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"${DEPEND}\"" >> ${dest} |
819 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"${SDEPEND}\"" >> ${dest} |
820 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
821 |
|
|
822 |
# add special functions |
# add special functions |
827 |
do |
do |
828 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
829 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
# unset to be safe (quotes needed !) |
|
|
#unset "${i}" <-- later to get every target built |
|
830 |
done |
done |
831 |
fi |
fi |
832 |
|
|
844 |
# build them only if requested |
# build them only if requested |
845 |
if mqueryfeature regentree |
if mqueryfeature regentree |
846 |
then |
then |
|
# run it without targets |
|
|
if [[ -n ${MAGE_TARGETS} ]] |
|
|
then |
|
|
# build for each target a mage file |
|
|
# run it with several targets |
|
|
echo |
|
|
for subpackage in ${MAGE_TARGETS} |
|
|
do |
|
|
build_mage_script --target "${subpackage}" |
|
|
done |
|
|
echo |
|
|
|
|
847 |
# run it for splitpackages |
# run it for splitpackages |
848 |
elif [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
849 |
then |
then |
850 |
local split_pkg_base="${PNAME}" |
local split_pkg_base="${PNAME}" |
851 |
# save smage environment |
# save smage environment |
858 |
# get the right variables for the split |
# get the right variables for the split |
859 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
860 |
split_info_${subpackage} |
split_info_${subpackage} |
861 |
|
# fix PCATEGORIE -> PCAT |
862 |
|
if [[ ! -z ${PCATEGORIE} ]] |
863 |
|
then |
864 |
|
PCAT="${PCATEGORIE}" |
865 |
|
unset PCATEGORIE |
866 |
|
fi |
867 |
# get the preinstall etc |
# get the preinstall etc |
868 |
split_export_inherits ${subpackage} |
split_export_inherits ${subpackage} |
869 |
build_mage_script --split-pkg-base "${split_pkg_base}" |
build_mage_script --split-pkg-base "${split_pkg_base}" |
885 |
|
|
886 |
# now unset all uneeded vars to be safe |
# now unset all uneeded vars to be safe |
887 |
# unset PKGNAME <-- don't do that; smage needs this var |
# 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 |
|
888 |
unset SPECIAL_FUNCTIONS |
unset SPECIAL_FUNCTIONS |
|
# for i in ${SPECIAL_VARS} |
|
|
# do |
|
|
# unset "${i}" |
|
|
# done |
|
889 |
unset SPECIAL_VARS |
unset SPECIAL_VARS |
890 |
unset STATE |
unset STATE |
891 |
unset DESCRIPTION |
unset DESCRIPTION |
910 |
export SAVED_DESCRIPTION="${DESCRIPTION}" |
export SAVED_DESCRIPTION="${DESCRIPTION}" |
911 |
export SAVED_HOMEPAGE="${HOMEPAGE}" |
export SAVED_HOMEPAGE="${HOMEPAGE}" |
912 |
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
913 |
|
export SAVED_SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS}" |
914 |
export SAVED_STATE="${STATE}" |
export SAVED_STATE="${STATE}" |
|
export SAVED_PKGTYPE="${PKGTYPE}" |
|
915 |
export SAVED_INHERITS="${INHERITS}" |
export SAVED_INHERITS="${INHERITS}" |
916 |
export SAVED_DEPEND="${DEPEND}" |
export SAVED_DEPEND="${DEPEND}" |
917 |
export SAVED_SDEPEND="${SDEPEND}" |
export SAVED_SDEPEND="${SDEPEND}" |
985 |
export DESCRIPTION="${SAVED_DESCRIPTION}" |
export DESCRIPTION="${SAVED_DESCRIPTION}" |
986 |
export HOMEPAGE="${SAVED_HOMEPAGE}" |
export HOMEPAGE="${SAVED_HOMEPAGE}" |
987 |
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
988 |
|
export SPECIAL_FUNCTIONS="${SAVED_SPECIAL_FUNCTIONS}" |
989 |
export STATE="${SAVED_STATE}" |
export STATE="${SAVED_STATE}" |
|
export PKGTYPE="${SAVED_PKGTYPE}" |
|
990 |
export INHERITS="${SAVED_INHERITS}" |
export INHERITS="${SAVED_INHERITS}" |
991 |
export DEPEND="${SAVED_DEPEND}" |
export DEPEND="${SAVED_DEPEND}" |
992 |
export SDEPEND="${SAVED_SDEPEND}" |
export SDEPEND="${SAVED_SDEPEND}" |
1054 |
unset SAVED_DESCRIPTION |
unset SAVED_DESCRIPTION |
1055 |
unset SAVED_HOMEPAGE |
unset SAVED_HOMEPAGE |
1056 |
unset SAVED_SPECIAL_VARS |
unset SAVED_SPECIAL_VARS |
1057 |
|
unset SAVED_SPECIAL_FUNCTIONS |
1058 |
unset SAVED_STATE |
unset SAVED_STATE |
1059 |
unset SAVED_PKGTYPE |
unset SAVED_PKGTYPE |
1060 |
unset SAVED_INHERITS |
unset SAVED_INHERITS |
1135 |
local pver |
local pver |
1136 |
local pbuild |
local pbuild |
1137 |
local parch |
local parch |
|
local target |
|
1138 |
local pkgname |
local pkgname |
1139 |
|
|
1140 |
# very basic getops |
# very basic getops |
1146 |
--pver|-v) shift; pver="$1" ;; |
--pver|-v) shift; pver="$1" ;; |
1147 |
--pbuild|-b) shift; pbuild="$1" ;; |
--pbuild|-b) shift; pbuild="$1" ;; |
1148 |
--parch|a) shift; parch="$1" ;; |
--parch|a) shift; parch="$1" ;; |
|
--target|t) shift; target="$1" ;; |
|
1149 |
esac |
esac |
1150 |
shift |
shift |
1151 |
done |
done |
1161 |
[ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set." |
[ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set." |
1162 |
[ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set." |
[ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set." |
1163 |
|
|
|
# fix target as it may be empty ! |
|
|
[ -n "${target}" ] && target="-${target}" |
|
|
|
|
1164 |
# build pkgname |
# build pkgname |
1165 |
pkgname="${pname}${target}-${pver}-${parch}$(print_distrotag)-${pbuild}" |
pkgname="${pname}-${pver}-${parch}$(print_distrotag)-${pbuild}" |
1166 |
|
|
1167 |
# build pkg-md5-sum only if requested |
# build pkg-md5-sum only if requested |
1168 |
if mqueryfeature regentree |
if mqueryfeature regentree |
1180 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
1181 |
|
|
1182 |
# setup md5 dir |
# setup md5 dir |
1183 |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5" |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5" |
1184 |
install -d ${dest} |
install -d ${dest} |
1185 |
|
|
1186 |
# gen md5sum |
# gen md5sum |
1192 |
|
|
1193 |
source_pkg_build() |
source_pkg_build() |
1194 |
{ |
{ |
|
if [[ ${PKGTYPE} = virtual ]] |
|
|
then |
|
|
echo "Virtual package detected; src-pkg-tarball not necessary ..." |
|
|
return 0 |
|
|
fi |
|
|
|
|
1195 |
if [[ ! -d ${SOURCEDIR}/${PNAME} ]] |
if [[ ! -d ${SOURCEDIR}/${PNAME} ]] |
1196 |
then |
then |
1197 |
echo "No SRC_URI defined; src-pkg-tarball not necessary ..." |
install -d ${SOURCEDIR}/${PNAME} |
|
return 0 |
|
1198 |
fi |
fi |
1199 |
|
|
1200 |
[ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly." |
[ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly." |
1208 |
[[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR} |
[[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR} |
1209 |
mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} |
mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} |
1210 |
|
|
1211 |
echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}" |
echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}\n" |
1212 |
} |
} |
1213 |
|
|
1214 |
step_by_step() |
step_by_step() |
1240 |
return 1 |
return 1 |
1241 |
fi |
fi |
1242 |
} |
} |
1243 |
|
|
1244 |
|
mqalint() |
1245 |
|
{ |
1246 |
|
return 0 |
1247 |
|
} |