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" |
554 |
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 |
555 |
} |
} |
556 |
|
|
557 |
|
mcompressdocs() |
558 |
|
{ |
559 |
|
local bindir="$@" |
560 |
|
|
561 |
|
if [ -d ${bindir}/usr/share/man ] |
562 |
|
then |
563 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
564 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man |
565 |
|
fi |
566 |
|
|
567 |
|
if [ -d ${bindir}/usr/share/info ] |
568 |
|
then |
569 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
570 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info |
571 |
|
fi |
572 |
|
} |
573 |
|
|
574 |
sminclude() |
sminclude() |
575 |
{ |
{ |
576 |
local i |
local i |
684 |
# special tags: |
# special tags: |
685 |
# PKGTYPE type of pkg |
# PKGTYPE type of pkg |
686 |
# INHERITS which functions get included |
# INHERITS which functions get included |
687 |
# SPECIAL_FUNCTIONS special functions wich should also be added |
# SPECIAL_FUNCTIONS special functions which should also be added |
688 |
# warning: they get killed before the build starts ! |
# warning: they get killed before the build starts ! |
689 |
|
# SPLIT_PACKAGES names of all subpackages which are splitted from parent |
690 |
|
# SPLIT_PACKAGE_BASE base package name for splitpackages |
691 |
|
# (only in the resulting magefile} |
692 |
# |
# |
693 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
694 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
699 |
local magefile |
local magefile |
700 |
local dest |
local dest |
701 |
local target |
local target |
702 |
|
local split_pkg_base |
703 |
local sym |
local sym |
704 |
local depname |
local depname |
705 |
|
|
707 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
708 |
|
|
709 |
# determinate which suffix this mage file should get, if any |
# determinate which suffix this mage file should get, if any |
710 |
[ -n "$1" ] && target="-$1" |
[[ $1 = --target ]] && shift && target="-$1" |
711 |
|
|
712 |
|
# mark package as splitpackage |
713 |
|
[[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1" |
714 |
|
|
715 |
# name of magefile |
# name of magefile |
716 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
727 |
> ${dest} |
> ${dest} |
728 |
|
|
729 |
# header |
# header |
730 |
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} |
731 |
echo >> ${dest} |
echo >> ${dest} |
732 |
|
|
733 |
# pgkname and state |
# pgkname and state |
747 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
748 |
echo >> ${dest} |
echo >> ${dest} |
749 |
|
|
750 |
|
# split package base |
751 |
|
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
752 |
|
echo >> ${dest} |
753 |
|
|
754 |
# add special vars |
# add special vars |
755 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
756 |
then |
then |
818 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
819 |
then |
then |
820 |
# run it without targets |
# run it without targets |
821 |
if [ -z "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
822 |
then |
then |
823 |
|
# build for each target a mage file |
824 |
|
# run it with several targets |
825 |
echo |
echo |
826 |
build_mage_script |
for i in ${MAGE_TARGETS} |
827 |
|
do |
828 |
|
build_mage_script --target "${i}" |
829 |
|
done |
830 |
echo |
echo |
|
else |
|
831 |
|
|
832 |
# build for each target an mage file |
# run it for splitpackages |
833 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
834 |
|
then |
835 |
|
local split_pkg_base="${PNAME}" |
836 |
|
# save smage environment |
837 |
|
split_save_variables |
838 |
|
# build for each subpackage a mage file |
839 |
# run it with several targets |
# run it with several targets |
840 |
for i in ${MAGE_TARGETS} |
echo |
841 |
|
for i in ${SPLIT_PACKAGES} |
842 |
do |
do |
843 |
echo |
# get the right variables for the split |
844 |
build_mage_script "${i}" |
export PNAME="${i}" |
845 |
echo |
split_info_${i} |
846 |
|
build_mage_script --split-pkg-base "${split_pkg_base}" |
847 |
done |
done |
848 |
|
echo |
849 |
|
# restore smage environment |
850 |
|
split_restore_variables |
851 |
|
|
852 |
|
else |
853 |
|
echo |
854 |
|
build_mage_script |
855 |
|
echo |
856 |
fi |
fi |
857 |
fi |
fi |
858 |
|
|
883 |
unset postremove |
unset postremove |
884 |
} |
} |
885 |
|
|
886 |
|
split_save_variables() |
887 |
|
{ |
888 |
|
export SAVED_PNAME="${PNAME}" |
889 |
|
export SAVED_PVER="${PVER}" |
890 |
|
export SAVED_PBUILD="${PBUILD}" |
891 |
|
export SAVED_PCATEGORIE="${PCATEGORIE}" |
892 |
|
export SAVED_DESCRIPTION="${DESCRIPTION}" |
893 |
|
export SAVED_HOMEPAGE="${HOMEPAGE}" |
894 |
|
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
895 |
|
export SAVED_STATE="${STATE}" |
896 |
|
export SAVED_PKGTYPE="${PKGTYPE}" |
897 |
|
export SAVED_INHERITS="${INHERITS}" |
898 |
|
export SAVED_DEPEND="${DEPEND}" |
899 |
|
export SAVED_SDEPEND="${SDEPEND}" |
900 |
|
export SAVED_PROVIDE="${PROVIDE}" |
901 |
|
export SAVED_NOPKGBUILD="${NOPKGBUILD}" |
902 |
|
|
903 |
|
# bindir too |
904 |
|
export SAVED_BINDIR="${BINDIR}" |
905 |
|
|
906 |
|
# export the SPLIT_PACKAGE_BASE |
907 |
|
export SPLIT_PACKAGE_BASE="${SAVED_PNAME}" |
908 |
|
|
909 |
|
# functions |
910 |
|
if [[ ! -z $(typeset -f preinstall) ]] |
911 |
|
then |
912 |
|
# rename the old one |
913 |
|
local saved_preinstall |
914 |
|
saved_preinstall=SAVED_$(typeset -f preinstall) |
915 |
|
eval "${saved_preinstall}" |
916 |
|
export -f SAVED_preinstall |
917 |
|
fi |
918 |
|
|
919 |
|
if [[ ! -z $(typeset -f postinstall) ]] |
920 |
|
then |
921 |
|
# rename the old one |
922 |
|
local saved_postinstall |
923 |
|
saved_postinstall=SAVED_$(typeset -f postinstall) |
924 |
|
eval "${saved_postinstall}" |
925 |
|
export -f SAVED_postinstall |
926 |
|
fi |
927 |
|
|
928 |
|
if [[ ! -z $(typeset -f preremove) ]] |
929 |
|
then |
930 |
|
# rename the old one |
931 |
|
local saved_preremove |
932 |
|
saved_preremove=SAVED_$(typeset -f preremove) |
933 |
|
eval "${saved_preremove}" |
934 |
|
export -f SAVED_preremove |
935 |
|
fi |
936 |
|
|
937 |
|
if [[ ! -z $(typeset -f postremove) ]] |
938 |
|
then |
939 |
|
# rename the old one |
940 |
|
local saved_postremove |
941 |
|
saved_postremove=SAVED_$(typeset -f postremove) |
942 |
|
eval "${saved_postremove}" |
943 |
|
export -f SAVED_postremove |
944 |
|
fi |
945 |
|
} |
946 |
|
|
947 |
|
split_restore_variables() |
948 |
|
{ |
949 |
|
export PNAME="${SAVED_PNAME}" |
950 |
|
export PVER="${SAVED_PVER}" |
951 |
|
export PBUILD="${SAVED_PBUILD}" |
952 |
|
export PCATEGORIE="${SAVED_PCATEGORIE}" |
953 |
|
export DESCRIPTION="${SAVED_DESCRIPTION}" |
954 |
|
export HOMEPAGE="${SAVED_HOMEPAGE}" |
955 |
|
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
956 |
|
export STATE="${SAVED_STATE}" |
957 |
|
export PKGTYPE="${SAVED_PKGTYPE}" |
958 |
|
export INHERITS="${SAVED_INHERITS}" |
959 |
|
export DEPEND="${SAVED_DEPEND}" |
960 |
|
export SDEPEND="${SAVED_SDEPEND}" |
961 |
|
export PROVIDE="${SAVED_PROVIDE}" |
962 |
|
export NOPKGBUILD="${SAVED_NOPKGBUILD}" |
963 |
|
|
964 |
|
# bindir too |
965 |
|
export BINDIR="${SAVED_BINDIR}" |
966 |
|
|
967 |
|
# functions |
968 |
|
if [[ ! -z $(typeset -f SAVED_preinstall) ]] |
969 |
|
then |
970 |
|
# rename the old one |
971 |
|
local saved_preinstall |
972 |
|
saved_preinstall=$(typeset -f SAVED_preinstall) |
973 |
|
eval "${saved_preinstall/SAVED_/}" |
974 |
|
export -f preinstall |
975 |
|
fi |
976 |
|
|
977 |
|
if [[ ! -z $(typeset -f SAVED_postinstall) ]] |
978 |
|
then |
979 |
|
# rename the old one |
980 |
|
local saved_postinstall |
981 |
|
saved_postinstall=$(typeset -f SAVED_postinstall) |
982 |
|
eval "${saved_postinstall/SAVED_/}" |
983 |
|
export -f postinstall |
984 |
|
fi |
985 |
|
|
986 |
|
if [[ ! -z $(typeset -f SAVED_preremove) ]] |
987 |
|
then |
988 |
|
# rename the old one |
989 |
|
local saved_preremove |
990 |
|
saved_preremove=$(typeset -f SAVED_preremove) |
991 |
|
eval "${saved_preremove/SAVED_/}" |
992 |
|
export -f preremove |
993 |
|
fi |
994 |
|
|
995 |
|
if [[ ! -z $(typeset -f SAVED_postremove) ]] |
996 |
|
then |
997 |
|
# rename the old one |
998 |
|
local saved_postremove |
999 |
|
saved_postremove=$(typeset -f SAVED_postremove) |
1000 |
|
eval "${saved_postremove/SAVED_/}" |
1001 |
|
export -f postremove |
1002 |
|
fi |
1003 |
|
|
1004 |
|
# unset saved vars; not needed anymore |
1005 |
|
unset SAVED_PNAME |
1006 |
|
unset SAVED_PVER |
1007 |
|
unset SAVED_PBUILD |
1008 |
|
unset SAVED_PCATEGORIE |
1009 |
|
unset SAVED_DESCRIPTION |
1010 |
|
unset SAVED_HOMEPAGE |
1011 |
|
unset SAVED_SPECIAL_VARS |
1012 |
|
unset SAVED_STATE |
1013 |
|
unset SAVED_PKGTYPE |
1014 |
|
unset SAVED_INHERITS |
1015 |
|
unset SAVED_DEPEND |
1016 |
|
unset SAVED_SDEPEND |
1017 |
|
unset SAVED_PROVIDE |
1018 |
|
unset SAVED_BINDIR |
1019 |
|
unset SAVED_NOPKGBUILD |
1020 |
|
unset SPLIT_PACKAGE_BASE |
1021 |
|
unset -f SAVED_preinstall |
1022 |
|
unset -f SAVED_postinstall |
1023 |
|
unset -f SAVED_preremove |
1024 |
|
unset -f SAVED_postremove |
1025 |
|
} |
1026 |
|
|
1027 |
export_inherits() |
export_inherits() |
1028 |
{ |
{ |
1029 |
local include="$1" |
local include="$1" |
1085 |
# fix target as it may be empty ! |
# fix target as it may be empty ! |
1086 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
1087 |
|
|
1088 |
|
|
1089 |
# build pkgname |
# build pkgname |
1090 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
1091 |
|
|
1105 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
1106 |
|
|
1107 |
# setup md5 dir |
# setup md5 dir |
1108 |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5" |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5" |
1109 |
install -d ${dest} |
install -d ${dest} |
1110 |
|
|
1111 |
# gen md5sum |
# gen md5sum |
1143 |
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}" |
1144 |
} |
} |
1145 |
|
|
1146 |
|
step_by_step() |
1147 |
|
{ |
1148 |
|
if [[ ${STEP_BY_STEP} = true ]] |
1149 |
|
then |
1150 |
|
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
1151 |
|
echo "Press [enter] to continue" |
1152 |
|
read |
1153 |
|
fi |
1154 |
|
} |
1155 |
|
|
1156 |
|
|
1157 |
# print out our version |
# print out our version |
1158 |
showversion |
showversion |
1273 |
|
|
1274 |
regen_mage_tree |
regen_mage_tree |
1275 |
|
|
1276 |
# build md5sum for existing packages |
# build several targets |
1277 |
generate_package_md5sum \ |
if [[ -n ${MAGE_TARGETS} ]] |
1278 |
--pcat "${PCATEGORIE}" \ |
then |
1279 |
--pname "${PNAME}" \ |
for target in ${MAGE_TARGETS} |
1280 |
--pver "${PVER}" \ |
do |
1281 |
--pbuild "${PBUILD}" \ |
# build md5sum for existing packages |
1282 |
--parch "${ARCH}" \ |
generate_package_md5sum \ |
1283 |
--target "${target}" |
--pcat "${PCATEGORIE}" \ |
1284 |
|
--pname "${PNAME}" \ |
1285 |
|
--pver "${PVER}" \ |
1286 |
|
--pbuild "${PBUILD}" \ |
1287 |
|
--parch "${ARCH}" \ |
1288 |
|
--target "${target}" |
1289 |
|
done |
1290 |
|
|
1291 |
|
# build several subpackages |
1292 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1293 |
|
then |
1294 |
|
split_save_variables |
1295 |
|
for subpackage in ${SPLIT_PACKAGE} |
1296 |
|
do |
1297 |
|
# get the right variables for the split |
1298 |
|
export PNAME="${subpackage}" |
1299 |
|
split_info_${subpackage} |
1300 |
|
# build md5sum for existing packages |
1301 |
|
generate_package_md5sum \ |
1302 |
|
--pcat "${PCATEGORIE}" \ |
1303 |
|
--pname "${PNAME}" \ |
1304 |
|
--pver "${PVER}" \ |
1305 |
|
--pbuild "${PBUILD}" \ |
1306 |
|
--parch "${ARCH}" |
1307 |
|
done |
1308 |
|
split_restore_variables |
1309 |
|
|
1310 |
|
else |
1311 |
|
# build md5sum for existing packages |
1312 |
|
generate_package_md5sum \ |
1313 |
|
--pcat "${PCATEGORIE}" \ |
1314 |
|
--pname "${PNAME}" \ |
1315 |
|
--pver "${PVER}" \ |
1316 |
|
--pbuild "${PBUILD}" \ |
1317 |
|
--parch "${ARCH}" |
1318 |
|
fi |
1319 |
|
|
1320 |
exit 0 |
exit 0 |
1321 |
fi |
fi |
1380 |
source ${SMAGENAME} || die "source failed" |
source ${SMAGENAME} || die "source failed" |
1381 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1382 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1383 |
|
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1384 |
|
|
1385 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
1386 |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
1455 |
mage rmstamp |
mage rmstamp |
1456 |
fi |
fi |
1457 |
|
|
1458 |
src_prepare || die "src_prepare failed" |
# setup build loggins |
1459 |
src_compile || die "src_compile failed" |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1460 |
src_install || die "src_install failed" |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1461 |
|
|
1462 |
|
src_prepare | ${SMAGE_LOG_CMD} |
1463 |
|
die_pipestatus 0 "src_prepare failed" |
1464 |
|
step_by_step $_ |
1465 |
|
|
1466 |
|
src_compile | ${SMAGE_LOG_CMD} |
1467 |
|
die_pipestatus 0 "src_compile failed" |
1468 |
|
step_by_step $_ |
1469 |
|
|
1470 |
# compressing doc, info & man files |
# build several subpackages |
1471 |
if [ -d ${BUILDDIR}/builded/usr/share/man ] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1472 |
then |
then |
1473 |
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
# save bindir & pname |
1474 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man |
split_save_variables |
1475 |
|
export SAVED_BINDIR="${BINDIR}" |
1476 |
|
for subpackage in ${SPLIT_PACKAGES} |
1477 |
|
do |
1478 |
|
if typeset -f src_install_${subpackage} > /dev/null |
1479 |
|
then |
1480 |
|
# export subpackage bindir |
1481 |
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
1482 |
|
# export PNAME, several internal function and include |
1483 |
|
# rely on this variable |
1484 |
|
export PNAME="${subpackage}" |
1485 |
|
|
1486 |
|
echo |
1487 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
1488 |
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
1489 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
1490 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
1491 |
|
|
1492 |
|
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
1493 |
|
die_pipestatus 0 "src_install_${subpackage} failed" |
1494 |
|
step_by_step $_ |
1495 |
|
fi |
1496 |
|
done |
1497 |
|
# restore bindir & pname |
1498 |
|
split_restore_variables |
1499 |
|
else |
1500 |
|
src_install | ${SMAGE_LOG_CMD} |
1501 |
|
die_pipestatus 0 "src_install failed" |
1502 |
|
step_by_step $_ |
1503 |
fi |
fi |
1504 |
|
|
1505 |
if [ -d ${BUILDDIR}/builded/usr/share/info ] |
# compressing doc, info & man files |
1506 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1507 |
then |
then |
1508 |
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGE} |
1509 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info |
do |
1510 |
|
mcompressdocs ${BINDIR}_${subpackage} |
1511 |
|
done |
1512 |
|
else |
1513 |
|
mcompressdocs ${BINDIR} |
1514 |
fi |
fi |
1515 |
|
|
1516 |
|
|
1517 |
# stripping all bins and libs |
# stripping all bins and libs |
1518 |
case ${NOSTRIP} in |
case ${NOSTRIP} in |
1519 |
true|TRUE|yes|y) |
true|TRUE|yes|y) |
1520 |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
1521 |
;; |
;; |
1522 |
*) |
*) |
1523 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
if [[ -n ${SPLIT_PACKAGES} ]] |
1524 |
mstripbins ${BINDIR} |
then |
1525 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGE} |
1526 |
mstriplibs ${BINDIR} |
do |
1527 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1528 |
|
mstripbins ${BINDIR}_${subpackage} |
1529 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
1530 |
|
mstriplibs ${BINDIR}_${subpackage} |
1531 |
|
done |
1532 |
|
else |
1533 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1534 |
|
mstripbins ${BINDIR} |
1535 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
1536 |
|
mstriplibs ${BINDIR} |
1537 |
|
fi |
1538 |
;; |
;; |
1539 |
esac |
esac |
1540 |
|
|
1545 |
;; |
;; |
1546 |
*) |
*) |
1547 |
# build several targets |
# build several targets |
1548 |
if [ -n "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
1549 |
then |
then |
1550 |
for target in ${MAGE_TARGETS} |
for target in ${MAGE_TARGETS} |
1551 |
do |
do |
1571 |
|
|
1572 |
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}" |
1573 |
done |
done |
1574 |
|
|
1575 |
|
# build several subpackages |
1576 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1577 |
|
then |
1578 |
|
split_save_variables |
1579 |
|
for subpackage in ${SPLIT_PACKAGES} |
1580 |
|
do |
1581 |
|
# get the right variables for the split |
1582 |
|
export PNAME="${subpackage}" |
1583 |
|
split_info_${PNAME} |
1584 |
|
|
1585 |
|
# check if an special subpackage_pkgbuild exists |
1586 |
|
if typeset -f ${PNAME}_pkgbuild > /dev/null |
1587 |
|
then |
1588 |
|
# run it |
1589 |
|
${PNAME}_pkgbuild |
1590 |
|
fi |
1591 |
|
# now create the target package |
1592 |
|
${MLIBDIR}/pkgbuild_dir.sh \ |
1593 |
|
"${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ |
1594 |
|
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
1595 |
|
|
1596 |
|
# build pkg-md5-sum if requested |
1597 |
|
generate_package_md5sum \ |
1598 |
|
--pcat "${PCATEGORIE}" \ |
1599 |
|
--pname "${PNAME}" \ |
1600 |
|
--pver "${PVER}" \ |
1601 |
|
--pbuild "${PBUILD}" \ |
1602 |
|
--parch "${ARCH}" |
1603 |
|
|
1604 |
|
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
1605 |
|
done |
1606 |
|
split_restore_variables |
1607 |
|
|
1608 |
else |
else |
1609 |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
1610 |
|
|
1624 |
;; |
;; |
1625 |
esac |
esac |
1626 |
|
|
1627 |
|
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
1628 |
|
then |
1629 |
|
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1630 |
|
else |
1631 |
|
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1632 |
|
fi |
1633 |
|
|
1634 |
# for sure |
# for sure |
1635 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1636 |
unset NOSTRIP |
unset NOSTRIP |