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.60 2007-11-05 17:08:33 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
73 |
exit 1 |
exit 1 |
74 |
} |
} |
75 |
|
|
76 |
|
die_pipestatus() |
77 |
|
{ |
78 |
|
# the status change if we do any parameter declarations!! |
79 |
|
# dont do this anymore, keep this in mind! |
80 |
|
# |
81 |
|
# local pos="$1" |
82 |
|
# local comment="$2" |
83 |
|
# |
84 |
|
# [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}" |
85 |
|
# |
86 |
|
[ ${PIPESTATUS[$1]} -ne 0 ] && die "$2" |
87 |
|
} |
88 |
|
|
89 |
xtitle() |
xtitle() |
90 |
{ |
{ |
91 |
if [[ ${TERM} = xterm ]] |
if [[ ${TERM} = xterm ]] |
184 |
my_SOURCEDIR="${SOURCEDIR}/${PNAME}" |
my_SOURCEDIR="${SOURCEDIR}/${PNAME}" |
185 |
fi |
fi |
186 |
|
|
187 |
|
# create the SOURCEDIR |
188 |
|
install -d ${my_SOURCEDIR} |
189 |
|
|
190 |
# if an mirrored file than replace first the mirror uri |
# if an mirrored file than replace first the mirror uri |
191 |
if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]] |
if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]] |
192 |
then |
then |
202 |
--tries 3 \ |
--tries 3 \ |
203 |
--continue \ |
--continue \ |
204 |
--progress bar \ |
--progress bar \ |
205 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
206 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
207 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
208 |
then |
then |
226 |
--tries 3 \ |
--tries 3 \ |
227 |
--continue \ |
--continue \ |
228 |
--progress bar \ |
--progress bar \ |
229 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
230 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
231 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
232 |
then |
then |
250 |
--tries 3 \ |
--tries 3 \ |
251 |
--continue \ |
--continue \ |
252 |
--progress bar \ |
--progress bar \ |
253 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
254 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
255 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
256 |
then |
then |
274 |
--tries 3 \ |
--tries 3 \ |
275 |
--continue \ |
--continue \ |
276 |
--progress bar \ |
--progress bar \ |
277 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
278 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
279 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
280 |
then |
then |
298 |
--tries 3 \ |
--tries 3 \ |
299 |
--continue \ |
--continue \ |
300 |
--progress bar \ |
--progress bar \ |
301 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
302 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
303 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
304 |
then |
then |
317 |
--tries 3 \ |
--tries 3 \ |
318 |
--continue \ |
--continue \ |
319 |
--progress bar \ |
--progress bar \ |
320 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
321 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
322 |
fi |
fi |
323 |
fi |
fi |
378 |
./configure \ |
./configure \ |
379 |
--prefix=/usr \ |
--prefix=/usr \ |
380 |
--host=${CHOST} \ |
--host=${CHOST} \ |
381 |
|
--build=${CHOST} \ |
382 |
--mandir=/usr/share/man \ |
--mandir=/usr/share/man \ |
383 |
--infodir=/usr/share/info \ |
--infodir=/usr/share/info \ |
384 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
469 |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
470 |
;; |
;; |
471 |
rpm) |
rpm) |
472 |
pushd ${BUILDDIR} > /dev/null |
pushd ${DEST} > /dev/null |
473 |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
474 |
tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz/} || die "tar: .rpm unpack failed." |
tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed." |
475 |
[[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} |
if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]] |
476 |
|
then |
477 |
|
rm ${DEST}/${SRCFILE/.rpm/.tar.gz} |
478 |
|
fi |
479 |
;; |
;; |
480 |
*) |
*) |
481 |
die "munpack failed" |
die "munpack failed" |
530 |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
531 |
fi |
fi |
532 |
|
|
533 |
|
local i |
534 |
for i in ${docfiles} |
for i in ${docfiles} |
535 |
do |
do |
536 |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
if [ -f ${i} ] |
537 |
install -m 0644 ${SRCDIR}/${i}.gz \ |
then |
538 |
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
539 |
|
install -m 0644 ${SRCDIR}/${i}.gz \ |
540 |
|
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
541 |
|
fi |
542 |
done |
done |
543 |
} |
} |
544 |
|
|
558 |
find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
559 |
} |
} |
560 |
|
|
561 |
|
mcompressdocs() |
562 |
|
{ |
563 |
|
local bindir="$@" |
564 |
|
|
565 |
|
if [ -d ${bindir}/usr/share/man ] |
566 |
|
then |
567 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
568 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man |
569 |
|
fi |
570 |
|
|
571 |
|
if [ -d ${bindir}/usr/share/info ] |
572 |
|
then |
573 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
574 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info |
575 |
|
fi |
576 |
|
} |
577 |
|
|
578 |
sminclude() |
sminclude() |
579 |
{ |
{ |
580 |
local i |
local i |
688 |
# special tags: |
# special tags: |
689 |
# PKGTYPE type of pkg |
# PKGTYPE type of pkg |
690 |
# INHERITS which functions get included |
# INHERITS which functions get included |
691 |
# SPECIAL_FUNCTIONS special functions wich should also be added |
# SPECIAL_FUNCTIONS special functions which should also be added |
692 |
# warning: they get killed before the build starts ! |
# warning: they get killed before the build starts ! |
693 |
|
# SPLIT_PACKAGES names of all subpackages which are splitted from parent |
694 |
|
# SPLIT_PACKAGE_BASE base package name for splitpackages |
695 |
|
# (only in the resulting magefile} |
696 |
# |
# |
697 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
698 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
703 |
local magefile |
local magefile |
704 |
local dest |
local dest |
705 |
local target |
local target |
706 |
|
local split_pkg_base |
707 |
local sym |
local sym |
708 |
local depname |
local depname |
709 |
|
|
711 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
712 |
|
|
713 |
# determinate which suffix this mage file should get, if any |
# determinate which suffix this mage file should get, if any |
714 |
[ -n "$1" ] && target="-$1" |
[[ $1 = --target ]] && shift && target="-$1" |
715 |
|
|
716 |
|
# mark package as splitpackage |
717 |
|
[[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1" |
718 |
|
|
719 |
# name of magefile |
# name of magefile |
720 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
731 |
> ${dest} |
> ${dest} |
732 |
|
|
733 |
# header |
# header |
734 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.60 2007-11-05 17:08:33 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest} |
735 |
echo >> ${dest} |
echo >> ${dest} |
736 |
|
|
737 |
# pgkname and state |
# pgkname and state |
751 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
752 |
echo >> ${dest} |
echo >> ${dest} |
753 |
|
|
754 |
|
# split package base |
755 |
|
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
756 |
|
echo >> ${dest} |
757 |
|
|
758 |
# add special vars |
# add special vars |
759 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
760 |
then |
then |
822 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
823 |
then |
then |
824 |
# run it without targets |
# run it without targets |
825 |
if [ -z "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
826 |
then |
then |
827 |
|
# build for each target a mage file |
828 |
|
# run it with several targets |
829 |
echo |
echo |
830 |
build_mage_script |
for i in ${MAGE_TARGETS} |
831 |
|
do |
832 |
|
build_mage_script --target "${i}" |
833 |
|
done |
834 |
echo |
echo |
|
else |
|
835 |
|
|
836 |
# build for each target an mage file |
# run it for splitpackages |
837 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
838 |
|
then |
839 |
|
local split_pkg_base="${PNAME}" |
840 |
|
# save smage environment |
841 |
|
split_save_variables |
842 |
|
# build for each subpackage a mage file |
843 |
# run it with several targets |
# run it with several targets |
844 |
for i in ${MAGE_TARGETS} |
echo |
845 |
|
for i in ${SPLIT_PACKAGES} |
846 |
do |
do |
847 |
echo |
# get the right variables for the split |
848 |
build_mage_script "${i}" |
export PNAME="${i}" |
849 |
echo |
split_info_${i} |
850 |
|
build_mage_script --split-pkg-base "${split_pkg_base}" |
851 |
|
# restore smage environment |
852 |
|
split_restore_variables |
853 |
done |
done |
854 |
|
echo |
855 |
|
# unset all saved smage variables |
856 |
|
split_unset_variables |
857 |
|
|
858 |
|
else |
859 |
|
echo |
860 |
|
build_mage_script |
861 |
|
echo |
862 |
fi |
fi |
863 |
fi |
fi |
864 |
|
|
889 |
unset postremove |
unset postremove |
890 |
} |
} |
891 |
|
|
892 |
|
split_save_variables() |
893 |
|
{ |
894 |
|
export SAVED_PNAME="${PNAME}" |
895 |
|
export SAVED_PVER="${PVER}" |
896 |
|
export SAVED_PBUILD="${PBUILD}" |
897 |
|
export SAVED_PCATEGORIE="${PCATEGORIE}" |
898 |
|
export SAVED_DESCRIPTION="${DESCRIPTION}" |
899 |
|
export SAVED_HOMEPAGE="${HOMEPAGE}" |
900 |
|
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
901 |
|
export SAVED_STATE="${STATE}" |
902 |
|
export SAVED_PKGTYPE="${PKGTYPE}" |
903 |
|
export SAVED_INHERITS="${INHERITS}" |
904 |
|
export SAVED_DEPEND="${DEPEND}" |
905 |
|
export SAVED_SDEPEND="${SDEPEND}" |
906 |
|
export SAVED_PROVIDE="${PROVIDE}" |
907 |
|
export SAVED_NOPKGBUILD="${NOPKGBUILD}" |
908 |
|
|
909 |
|
# bindir too |
910 |
|
export SAVED_BINDIR="${BINDIR}" |
911 |
|
|
912 |
|
# export the SPLIT_PACKAGE_BASE |
913 |
|
export SPLIT_PACKAGE_BASE="${SAVED_PNAME}" |
914 |
|
|
915 |
|
# functions |
916 |
|
if [[ ! -z $(typeset -f preinstall) ]] |
917 |
|
then |
918 |
|
# rename the old one |
919 |
|
local saved_preinstall |
920 |
|
saved_preinstall=SAVED_$(typeset -f preinstall) |
921 |
|
eval "${saved_preinstall}" |
922 |
|
export -f SAVED_preinstall |
923 |
|
fi |
924 |
|
|
925 |
|
if [[ ! -z $(typeset -f postinstall) ]] |
926 |
|
then |
927 |
|
# rename the old one |
928 |
|
local saved_postinstall |
929 |
|
saved_postinstall=SAVED_$(typeset -f postinstall) |
930 |
|
eval "${saved_postinstall}" |
931 |
|
export -f SAVED_postinstall |
932 |
|
fi |
933 |
|
|
934 |
|
if [[ ! -z $(typeset -f preremove) ]] |
935 |
|
then |
936 |
|
# rename the old one |
937 |
|
local saved_preremove |
938 |
|
saved_preremove=SAVED_$(typeset -f preremove) |
939 |
|
eval "${saved_preremove}" |
940 |
|
export -f SAVED_preremove |
941 |
|
fi |
942 |
|
|
943 |
|
if [[ ! -z $(typeset -f postremove) ]] |
944 |
|
then |
945 |
|
# rename the old one |
946 |
|
local saved_postremove |
947 |
|
saved_postremove=SAVED_$(typeset -f postremove) |
948 |
|
eval "${saved_postremove}" |
949 |
|
export -f SAVED_postremove |
950 |
|
fi |
951 |
|
} |
952 |
|
|
953 |
|
split_restore_variables() |
954 |
|
{ |
955 |
|
export PNAME="${SAVED_PNAME}" |
956 |
|
export PVER="${SAVED_PVER}" |
957 |
|
export PBUILD="${SAVED_PBUILD}" |
958 |
|
export PCATEGORIE="${SAVED_PCATEGORIE}" |
959 |
|
export DESCRIPTION="${SAVED_DESCRIPTION}" |
960 |
|
export HOMEPAGE="${SAVED_HOMEPAGE}" |
961 |
|
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
962 |
|
export STATE="${SAVED_STATE}" |
963 |
|
export PKGTYPE="${SAVED_PKGTYPE}" |
964 |
|
export INHERITS="${SAVED_INHERITS}" |
965 |
|
export DEPEND="${SAVED_DEPEND}" |
966 |
|
export SDEPEND="${SAVED_SDEPEND}" |
967 |
|
export PROVIDE="${SAVED_PROVIDE}" |
968 |
|
export NOPKGBUILD="${SAVED_NOPKGBUILD}" |
969 |
|
|
970 |
|
# bindir too |
971 |
|
export BINDIR="${SAVED_BINDIR}" |
972 |
|
|
973 |
|
# functions |
974 |
|
if [[ ! -z $(typeset -f SAVED_preinstall) ]] |
975 |
|
then |
976 |
|
# rename the old one |
977 |
|
local saved_preinstall |
978 |
|
saved_preinstall=$(typeset -f SAVED_preinstall) |
979 |
|
eval "${saved_preinstall/SAVED_/}" |
980 |
|
export -f preinstall |
981 |
|
fi |
982 |
|
|
983 |
|
if [[ ! -z $(typeset -f SAVED_postinstall) ]] |
984 |
|
then |
985 |
|
# rename the old one |
986 |
|
local saved_postinstall |
987 |
|
saved_postinstall=$(typeset -f SAVED_postinstall) |
988 |
|
eval "${saved_postinstall/SAVED_/}" |
989 |
|
export -f postinstall |
990 |
|
fi |
991 |
|
|
992 |
|
if [[ ! -z $(typeset -f SAVED_preremove) ]] |
993 |
|
then |
994 |
|
# rename the old one |
995 |
|
local saved_preremove |
996 |
|
saved_preremove=$(typeset -f SAVED_preremove) |
997 |
|
eval "${saved_preremove/SAVED_/}" |
998 |
|
export -f preremove |
999 |
|
fi |
1000 |
|
|
1001 |
|
if [[ ! -z $(typeset -f SAVED_postremove) ]] |
1002 |
|
then |
1003 |
|
# rename the old one |
1004 |
|
local saved_postremove |
1005 |
|
saved_postremove=$(typeset -f SAVED_postremove) |
1006 |
|
eval "${saved_postremove/SAVED_/}" |
1007 |
|
export -f postremove |
1008 |
|
fi |
1009 |
|
} |
1010 |
|
|
1011 |
|
split_unset_variables() |
1012 |
|
{ |
1013 |
|
# unset saved vars; not needed anymore |
1014 |
|
unset SAVED_PNAME |
1015 |
|
unset SAVED_PVER |
1016 |
|
unset SAVED_PBUILD |
1017 |
|
unset SAVED_PCATEGORIE |
1018 |
|
unset SAVED_DESCRIPTION |
1019 |
|
unset SAVED_HOMEPAGE |
1020 |
|
unset SAVED_SPECIAL_VARS |
1021 |
|
unset SAVED_STATE |
1022 |
|
unset SAVED_PKGTYPE |
1023 |
|
unset SAVED_INHERITS |
1024 |
|
unset SAVED_DEPEND |
1025 |
|
unset SAVED_SDEPEND |
1026 |
|
unset SAVED_PROVIDE |
1027 |
|
unset SAVED_BINDIR |
1028 |
|
unset SAVED_NOPKGBUILD |
1029 |
|
unset SPLIT_PACKAGE_BASE |
1030 |
|
unset -f SAVED_preinstall |
1031 |
|
unset -f SAVED_postinstall |
1032 |
|
unset -f SAVED_preremove |
1033 |
|
unset -f SAVED_postremove |
1034 |
|
} |
1035 |
|
|
1036 |
export_inherits() |
export_inherits() |
1037 |
{ |
{ |
1038 |
local include="$1" |
local include="$1" |
1094 |
# fix target as it may be empty ! |
# fix target as it may be empty ! |
1095 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
1096 |
|
|
1097 |
|
|
1098 |
# build pkgname |
# build pkgname |
1099 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
1100 |
|
|
1114 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
1115 |
|
|
1116 |
# setup md5 dir |
# setup md5 dir |
1117 |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5" |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5" |
1118 |
install -d ${dest} |
install -d ${dest} |
1119 |
|
|
1120 |
# gen md5sum |
# gen md5sum |
1152 |
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}" |
1153 |
} |
} |
1154 |
|
|
1155 |
|
step_by_step() |
1156 |
|
{ |
1157 |
|
if [[ ${STEP_BY_STEP} = true ]] |
1158 |
|
then |
1159 |
|
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
1160 |
|
echo "Press [enter] to continue" |
1161 |
|
read |
1162 |
|
fi |
1163 |
|
} |
1164 |
|
|
1165 |
|
|
1166 |
# print out our version |
# print out our version |
1167 |
showversion |
showversion |
1282 |
|
|
1283 |
regen_mage_tree |
regen_mage_tree |
1284 |
|
|
1285 |
# build md5sum for existing packages |
# build several targets |
1286 |
generate_package_md5sum \ |
if [[ -n ${MAGE_TARGETS} ]] |
1287 |
--pcat "${PCATEGORIE}" \ |
then |
1288 |
--pname "${PNAME}" \ |
for target in ${MAGE_TARGETS} |
1289 |
--pver "${PVER}" \ |
do |
1290 |
--pbuild "${PBUILD}" \ |
# build md5sum for existing packages |
1291 |
--parch "${ARCH}" \ |
generate_package_md5sum \ |
1292 |
--target "${target}" |
--pcat "${PCATEGORIE}" \ |
1293 |
|
--pname "${PNAME}" \ |
1294 |
|
--pver "${PVER}" \ |
1295 |
|
--pbuild "${PBUILD}" \ |
1296 |
|
--parch "${ARCH}" \ |
1297 |
|
--target "${target}" |
1298 |
|
done |
1299 |
|
|
1300 |
|
# build several subpackages |
1301 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1302 |
|
then |
1303 |
|
split_save_variables |
1304 |
|
for subpackage in ${SPLIT_PACKAGES} |
1305 |
|
do |
1306 |
|
# get the right variables for the split |
1307 |
|
export PNAME="${subpackage}" |
1308 |
|
split_info_${subpackage} |
1309 |
|
# build md5sum for existing packages |
1310 |
|
generate_package_md5sum \ |
1311 |
|
--pcat "${PCATEGORIE}" \ |
1312 |
|
--pname "${PNAME}" \ |
1313 |
|
--pver "${PVER}" \ |
1314 |
|
--pbuild "${PBUILD}" \ |
1315 |
|
--parch "${ARCH}" |
1316 |
|
# restore smage environment |
1317 |
|
split_restore_variables |
1318 |
|
done |
1319 |
|
# unset all saved smage variables |
1320 |
|
split_unset_variables |
1321 |
|
|
1322 |
|
else |
1323 |
|
# build md5sum for existing packages |
1324 |
|
generate_package_md5sum \ |
1325 |
|
--pcat "${PCATEGORIE}" \ |
1326 |
|
--pname "${PNAME}" \ |
1327 |
|
--pver "${PVER}" \ |
1328 |
|
--pbuild "${PBUILD}" \ |
1329 |
|
--parch "${ARCH}" |
1330 |
|
fi |
1331 |
|
|
1332 |
exit 0 |
exit 0 |
1333 |
fi |
fi |
1392 |
source ${SMAGENAME} || die "source failed" |
source ${SMAGENAME} || die "source failed" |
1393 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1394 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1395 |
|
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1396 |
|
|
1397 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
1398 |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
1467 |
mage rmstamp |
mage rmstamp |
1468 |
fi |
fi |
1469 |
|
|
1470 |
src_prepare || die "src_prepare failed" |
# setup build loggins |
1471 |
src_compile || die "src_compile failed" |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1472 |
src_install || die "src_install failed" |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1473 |
|
|
1474 |
|
src_prepare | ${SMAGE_LOG_CMD} |
1475 |
|
die_pipestatus 0 "src_prepare failed" |
1476 |
|
step_by_step $_ |
1477 |
|
|
1478 |
|
src_compile | ${SMAGE_LOG_CMD} |
1479 |
|
die_pipestatus 0 "src_compile failed" |
1480 |
|
step_by_step $_ |
1481 |
|
|
1482 |
# compressing doc, info & man files |
# build several subpackages |
1483 |
if [ -d ${BUILDDIR}/builded/usr/share/man ] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1484 |
then |
then |
1485 |
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
# save bindir & pname |
1486 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man |
split_save_variables |
1487 |
|
export SAVED_BINDIR="${BINDIR}" |
1488 |
|
for subpackage in ${SPLIT_PACKAGES} |
1489 |
|
do |
1490 |
|
if typeset -f src_install_${subpackage} > /dev/null |
1491 |
|
then |
1492 |
|
# export subpackage bindir |
1493 |
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
1494 |
|
# export PNAME, several internal function and include |
1495 |
|
# rely on this variable |
1496 |
|
export PNAME="${subpackage}" |
1497 |
|
|
1498 |
|
echo |
1499 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
1500 |
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
1501 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
1502 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
1503 |
|
|
1504 |
|
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
1505 |
|
die_pipestatus 0 "src_install_${subpackage} failed" |
1506 |
|
step_by_step $_ |
1507 |
|
fi |
1508 |
|
done |
1509 |
|
# restore bindir & pname |
1510 |
|
split_restore_variables |
1511 |
|
# unset all saved smage variables |
1512 |
|
split_unset_variables |
1513 |
|
else |
1514 |
|
src_install | ${SMAGE_LOG_CMD} |
1515 |
|
die_pipestatus 0 "src_install failed" |
1516 |
|
step_by_step $_ |
1517 |
fi |
fi |
1518 |
|
|
1519 |
if [ -d ${BUILDDIR}/builded/usr/share/info ] |
# compressing doc, info & man files |
1520 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1521 |
then |
then |
1522 |
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGES} |
1523 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info |
do |
1524 |
|
mcompressdocs ${BINDIR}_${subpackage} |
1525 |
|
done |
1526 |
|
else |
1527 |
|
mcompressdocs ${BINDIR} |
1528 |
fi |
fi |
1529 |
|
|
1530 |
|
|
1531 |
# stripping all bins and libs |
# stripping all bins and libs |
1532 |
case ${NOSTRIP} in |
case ${NOSTRIP} in |
1533 |
true|TRUE|yes|y) |
true|TRUE|yes|y) |
1534 |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
1535 |
;; |
;; |
1536 |
*) |
*) |
1537 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
if [[ -n ${SPLIT_PACKAGES} ]] |
1538 |
mstripbins ${BINDIR} |
then |
1539 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGES} |
1540 |
mstriplibs ${BINDIR} |
do |
1541 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1542 |
|
mstripbins ${BINDIR}_${subpackage} |
1543 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
1544 |
|
mstriplibs ${BINDIR}_${subpackage} |
1545 |
|
done |
1546 |
|
else |
1547 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1548 |
|
mstripbins ${BINDIR} |
1549 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
1550 |
|
mstriplibs ${BINDIR} |
1551 |
|
fi |
1552 |
;; |
;; |
1553 |
esac |
esac |
1554 |
|
|
1559 |
;; |
;; |
1560 |
*) |
*) |
1561 |
# build several targets |
# build several targets |
1562 |
if [ -n "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
1563 |
then |
then |
1564 |
for target in ${MAGE_TARGETS} |
for target in ${MAGE_TARGETS} |
1565 |
do |
do |
1585 |
|
|
1586 |
echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
1587 |
done |
done |
1588 |
|
|
1589 |
|
# build several subpackages |
1590 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1591 |
|
then |
1592 |
|
split_save_variables |
1593 |
|
for subpackage in ${SPLIT_PACKAGES} |
1594 |
|
do |
1595 |
|
# get the right variables for the split |
1596 |
|
export PNAME="${subpackage}" |
1597 |
|
split_info_${PNAME} |
1598 |
|
|
1599 |
|
# jump to next one if NOPKGBUILD is set in split_info |
1600 |
|
case ${NOPKGBUILD} in |
1601 |
|
true|TRUE|yes|y) continue ;; |
1602 |
|
esac |
1603 |
|
|
1604 |
|
# check if an special subpackage_pkgbuild exists |
1605 |
|
if typeset -f ${PNAME}_pkgbuild > /dev/null |
1606 |
|
then |
1607 |
|
# run it |
1608 |
|
${PNAME}_pkgbuild |
1609 |
|
fi |
1610 |
|
# now create the target package |
1611 |
|
${MLIBDIR}/pkgbuild_dir.sh \ |
1612 |
|
"${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ |
1613 |
|
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
1614 |
|
|
1615 |
|
# build pkg-md5-sum if requested |
1616 |
|
generate_package_md5sum \ |
1617 |
|
--pcat "${PCATEGORIE}" \ |
1618 |
|
--pname "${PNAME}" \ |
1619 |
|
--pver "${PVER}" \ |
1620 |
|
--pbuild "${PBUILD}" \ |
1621 |
|
--parch "${ARCH}" |
1622 |
|
|
1623 |
|
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
1624 |
|
|
1625 |
|
# restore smage environment |
1626 |
|
split_restore_variables |
1627 |
|
done |
1628 |
|
# unset all saved smage variables |
1629 |
|
split_unset_variables |
1630 |
|
|
1631 |
else |
else |
1632 |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
1633 |
|
|
1647 |
;; |
;; |
1648 |
esac |
esac |
1649 |
|
|
1650 |
|
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
1651 |
|
then |
1652 |
|
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1653 |
|
else |
1654 |
|
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1655 |
|
fi |
1656 |
|
|
1657 |
# for sure |
# for sure |
1658 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1659 |
unset NOSTRIP |
unset NOSTRIP |