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 |
198 |
then |
then |
199 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
200 |
wget \ |
wget \ |
201 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
202 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
203 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
204 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
205 |
then |
then |
219 |
then |
then |
220 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
221 |
wget \ |
wget \ |
222 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
223 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
224 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
225 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
226 |
then |
then |
240 |
then |
then |
241 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
242 |
wget \ |
wget \ |
243 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
244 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
245 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
246 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
247 |
then |
then |
261 |
then |
then |
262 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
263 |
wget \ |
wget \ |
264 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
265 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
266 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
267 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
268 |
then |
then |
282 |
then |
then |
283 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
284 |
wget \ |
wget \ |
285 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
286 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
287 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
288 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
289 |
then |
then |
298 |
then |
then |
299 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
300 |
wget \ |
wget \ |
301 |
--passive-ftp \ |
${WGET_FETCH_OPTIONS} \ |
302 |
--tries 3 \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
|
--continue \ |
|
|
--progress bar \ |
|
|
--directory-prefix="${my_SOURCEDIR}" \ |
|
303 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
304 |
fi |
fi |
305 |
fi |
fi |
360 |
./configure \ |
./configure \ |
361 |
--prefix=/usr \ |
--prefix=/usr \ |
362 |
--host=${CHOST} \ |
--host=${CHOST} \ |
363 |
|
--build=${CHOST} \ |
364 |
--mandir=/usr/share/man \ |
--mandir=/usr/share/man \ |
365 |
--infodir=/usr/share/info \ |
--infodir=/usr/share/info \ |
366 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
451 |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
452 |
;; |
;; |
453 |
rpm) |
rpm) |
454 |
pushd ${BUILDDIR} > /dev/null |
pushd ${DEST} > /dev/null |
455 |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
456 |
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." |
457 |
[[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} |
if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]] |
458 |
|
then |
459 |
|
rm ${DEST}/${SRCFILE/.rpm/.tar.gz} |
460 |
|
fi |
461 |
;; |
;; |
462 |
*) |
*) |
463 |
die "munpack failed" |
die "munpack failed" |
512 |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
513 |
fi |
fi |
514 |
|
|
515 |
|
local i |
516 |
for i in ${docfiles} |
for i in ${docfiles} |
517 |
do |
do |
518 |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
if [ -f ${i} ] |
519 |
install -m 0644 ${SRCDIR}/${i}.gz \ |
then |
520 |
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
521 |
|
install -m 0644 ${SRCDIR}/${i}.gz \ |
522 |
|
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
523 |
|
fi |
524 |
done |
done |
525 |
} |
} |
526 |
|
|
540 |
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 |
541 |
} |
} |
542 |
|
|
543 |
|
mcompressdocs() |
544 |
|
{ |
545 |
|
local bindir="$@" |
546 |
|
|
547 |
|
if [ -d ${bindir}/usr/share/man ] |
548 |
|
then |
549 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
550 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man |
551 |
|
fi |
552 |
|
|
553 |
|
if [ -d ${bindir}/usr/share/info ] |
554 |
|
then |
555 |
|
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
556 |
|
${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info |
557 |
|
fi |
558 |
|
} |
559 |
|
|
560 |
sminclude() |
sminclude() |
561 |
{ |
{ |
562 |
local i |
local i |
670 |
# special tags: |
# special tags: |
671 |
# PKGTYPE type of pkg |
# PKGTYPE type of pkg |
672 |
# INHERITS which functions get included |
# INHERITS which functions get included |
673 |
# SPECIAL_FUNCTIONS special functions wich should also be added |
# SPECIAL_FUNCTIONS special functions which should also be added |
674 |
# warning: they get killed before the build starts ! |
# warning: they get killed before the build starts ! |
675 |
|
# SPLIT_PACKAGES names of all subpackages which are splitted from parent |
676 |
|
# SPLIT_PACKAGE_BASE base package name for splitpackages |
677 |
|
# (only in the resulting magefile} |
678 |
# |
# |
679 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
680 |
# REGEN_MAGE_TREE set to 'true' to enable this |
# REGEN_MAGE_TREE set to 'true' to enable this |
685 |
local magefile |
local magefile |
686 |
local dest |
local dest |
687 |
local target |
local target |
688 |
|
local split_pkg_base |
689 |
local sym |
local sym |
690 |
local depname |
local depname |
691 |
|
|
693 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
694 |
|
|
695 |
# determinate which suffix this mage file should get, if any |
# determinate which suffix this mage file should get, if any |
696 |
[ -n "$1" ] && target="-$1" |
[[ $1 = --target ]] && shift && target="-$1" |
697 |
|
|
698 |
|
# mark package as splitpackage |
699 |
|
[[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1" |
700 |
|
|
701 |
# name of magefile |
# name of magefile |
702 |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage" |
713 |
> ${dest} |
> ${dest} |
714 |
|
|
715 |
# header |
# header |
716 |
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} |
717 |
echo >> ${dest} |
echo >> ${dest} |
718 |
|
|
719 |
# pgkname and state |
# pgkname and state |
733 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
734 |
echo >> ${dest} |
echo >> ${dest} |
735 |
|
|
736 |
|
# split package base |
737 |
|
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
738 |
|
echo >> ${dest} |
739 |
|
|
740 |
# add special vars |
# add special vars |
741 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
742 |
then |
then |
804 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
805 |
then |
then |
806 |
# run it without targets |
# run it without targets |
807 |
if [ -z "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
808 |
then |
then |
809 |
|
# build for each target a mage file |
810 |
|
# run it with several targets |
811 |
echo |
echo |
812 |
build_mage_script |
for i in ${MAGE_TARGETS} |
813 |
|
do |
814 |
|
build_mage_script --target "${i}" |
815 |
|
done |
816 |
echo |
echo |
|
else |
|
817 |
|
|
818 |
# build for each target an mage file |
# run it for splitpackages |
819 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
820 |
|
then |
821 |
|
local split_pkg_base="${PNAME}" |
822 |
|
# save smage environment |
823 |
|
split_save_variables |
824 |
|
# build for each subpackage a mage file |
825 |
# run it with several targets |
# run it with several targets |
826 |
for i in ${MAGE_TARGETS} |
echo |
827 |
|
for i in ${SPLIT_PACKAGES} |
828 |
do |
do |
829 |
echo |
# get the right variables for the split |
830 |
build_mage_script "${i}" |
export PNAME="${i}" |
831 |
echo |
split_info_${i} |
832 |
|
build_mage_script --split-pkg-base "${split_pkg_base}" |
833 |
|
# restore smage environment |
834 |
|
split_restore_variables |
835 |
done |
done |
836 |
|
echo |
837 |
|
# unset all saved smage variables |
838 |
|
split_unset_variables |
839 |
|
|
840 |
|
else |
841 |
|
echo |
842 |
|
build_mage_script |
843 |
|
echo |
844 |
fi |
fi |
845 |
fi |
fi |
846 |
|
|
871 |
unset postremove |
unset postremove |
872 |
} |
} |
873 |
|
|
874 |
|
split_save_variables() |
875 |
|
{ |
876 |
|
export SAVED_PNAME="${PNAME}" |
877 |
|
export SAVED_PVER="${PVER}" |
878 |
|
export SAVED_PBUILD="${PBUILD}" |
879 |
|
export SAVED_PCATEGORIE="${PCATEGORIE}" |
880 |
|
export SAVED_DESCRIPTION="${DESCRIPTION}" |
881 |
|
export SAVED_HOMEPAGE="${HOMEPAGE}" |
882 |
|
export SAVED_SPECIAL_VARS="${SPECIAL_VARS}" |
883 |
|
export SAVED_STATE="${STATE}" |
884 |
|
export SAVED_PKGTYPE="${PKGTYPE}" |
885 |
|
export SAVED_INHERITS="${INHERITS}" |
886 |
|
export SAVED_DEPEND="${DEPEND}" |
887 |
|
export SAVED_SDEPEND="${SDEPEND}" |
888 |
|
export SAVED_PROVIDE="${PROVIDE}" |
889 |
|
export SAVED_NOPKGBUILD="${NOPKGBUILD}" |
890 |
|
|
891 |
|
# bindir too |
892 |
|
export SAVED_BINDIR="${BINDIR}" |
893 |
|
|
894 |
|
# export the SPLIT_PACKAGE_BASE |
895 |
|
export SPLIT_PACKAGE_BASE="${SAVED_PNAME}" |
896 |
|
|
897 |
|
# functions |
898 |
|
if [[ ! -z $(typeset -f preinstall) ]] |
899 |
|
then |
900 |
|
# rename the old one |
901 |
|
local saved_preinstall |
902 |
|
saved_preinstall=SAVED_$(typeset -f preinstall) |
903 |
|
eval "${saved_preinstall}" |
904 |
|
export -f SAVED_preinstall |
905 |
|
fi |
906 |
|
|
907 |
|
if [[ ! -z $(typeset -f postinstall) ]] |
908 |
|
then |
909 |
|
# rename the old one |
910 |
|
local saved_postinstall |
911 |
|
saved_postinstall=SAVED_$(typeset -f postinstall) |
912 |
|
eval "${saved_postinstall}" |
913 |
|
export -f SAVED_postinstall |
914 |
|
fi |
915 |
|
|
916 |
|
if [[ ! -z $(typeset -f preremove) ]] |
917 |
|
then |
918 |
|
# rename the old one |
919 |
|
local saved_preremove |
920 |
|
saved_preremove=SAVED_$(typeset -f preremove) |
921 |
|
eval "${saved_preremove}" |
922 |
|
export -f SAVED_preremove |
923 |
|
fi |
924 |
|
|
925 |
|
if [[ ! -z $(typeset -f postremove) ]] |
926 |
|
then |
927 |
|
# rename the old one |
928 |
|
local saved_postremove |
929 |
|
saved_postremove=SAVED_$(typeset -f postremove) |
930 |
|
eval "${saved_postremove}" |
931 |
|
export -f SAVED_postremove |
932 |
|
fi |
933 |
|
} |
934 |
|
|
935 |
|
split_restore_variables() |
936 |
|
{ |
937 |
|
export PNAME="${SAVED_PNAME}" |
938 |
|
export PVER="${SAVED_PVER}" |
939 |
|
export PBUILD="${SAVED_PBUILD}" |
940 |
|
export PCATEGORIE="${SAVED_PCATEGORIE}" |
941 |
|
export DESCRIPTION="${SAVED_DESCRIPTION}" |
942 |
|
export HOMEPAGE="${SAVED_HOMEPAGE}" |
943 |
|
export SPECIAL_VARS="${SAVED_SPECIAL_VARS}" |
944 |
|
export STATE="${SAVED_STATE}" |
945 |
|
export PKGTYPE="${SAVED_PKGTYPE}" |
946 |
|
export INHERITS="${SAVED_INHERITS}" |
947 |
|
export DEPEND="${SAVED_DEPEND}" |
948 |
|
export SDEPEND="${SAVED_SDEPEND}" |
949 |
|
export PROVIDE="${SAVED_PROVIDE}" |
950 |
|
export NOPKGBUILD="${SAVED_NOPKGBUILD}" |
951 |
|
|
952 |
|
# bindir too |
953 |
|
export BINDIR="${SAVED_BINDIR}" |
954 |
|
|
955 |
|
# functions |
956 |
|
if [[ ! -z $(typeset -f SAVED_preinstall) ]] |
957 |
|
then |
958 |
|
# rename the old one |
959 |
|
local saved_preinstall |
960 |
|
saved_preinstall=$(typeset -f SAVED_preinstall) |
961 |
|
eval "${saved_preinstall/SAVED_/}" |
962 |
|
export -f preinstall |
963 |
|
fi |
964 |
|
|
965 |
|
if [[ ! -z $(typeset -f SAVED_postinstall) ]] |
966 |
|
then |
967 |
|
# rename the old one |
968 |
|
local saved_postinstall |
969 |
|
saved_postinstall=$(typeset -f SAVED_postinstall) |
970 |
|
eval "${saved_postinstall/SAVED_/}" |
971 |
|
export -f postinstall |
972 |
|
fi |
973 |
|
|
974 |
|
if [[ ! -z $(typeset -f SAVED_preremove) ]] |
975 |
|
then |
976 |
|
# rename the old one |
977 |
|
local saved_preremove |
978 |
|
saved_preremove=$(typeset -f SAVED_preremove) |
979 |
|
eval "${saved_preremove/SAVED_/}" |
980 |
|
export -f preremove |
981 |
|
fi |
982 |
|
|
983 |
|
if [[ ! -z $(typeset -f SAVED_postremove) ]] |
984 |
|
then |
985 |
|
# rename the old one |
986 |
|
local saved_postremove |
987 |
|
saved_postremove=$(typeset -f SAVED_postremove) |
988 |
|
eval "${saved_postremove/SAVED_/}" |
989 |
|
export -f postremove |
990 |
|
fi |
991 |
|
} |
992 |
|
|
993 |
|
split_unset_variables() |
994 |
|
{ |
995 |
|
# unset saved vars; not needed anymore |
996 |
|
unset SAVED_PNAME |
997 |
|
unset SAVED_PVER |
998 |
|
unset SAVED_PBUILD |
999 |
|
unset SAVED_PCATEGORIE |
1000 |
|
unset SAVED_DESCRIPTION |
1001 |
|
unset SAVED_HOMEPAGE |
1002 |
|
unset SAVED_SPECIAL_VARS |
1003 |
|
unset SAVED_STATE |
1004 |
|
unset SAVED_PKGTYPE |
1005 |
|
unset SAVED_INHERITS |
1006 |
|
unset SAVED_DEPEND |
1007 |
|
unset SAVED_SDEPEND |
1008 |
|
unset SAVED_PROVIDE |
1009 |
|
unset SAVED_BINDIR |
1010 |
|
unset SAVED_NOPKGBUILD |
1011 |
|
unset SPLIT_PACKAGE_BASE |
1012 |
|
unset -f SAVED_preinstall |
1013 |
|
unset -f SAVED_postinstall |
1014 |
|
unset -f SAVED_preremove |
1015 |
|
unset -f SAVED_postremove |
1016 |
|
} |
1017 |
|
|
1018 |
export_inherits() |
export_inherits() |
1019 |
{ |
{ |
1020 |
local include="$1" |
local include="$1" |
1076 |
# fix target as it may be empty ! |
# fix target as it may be empty ! |
1077 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
1078 |
|
|
1079 |
|
|
1080 |
# build pkgname |
# build pkgname |
1081 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
1082 |
|
|
1096 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
1097 |
|
|
1098 |
# setup md5 dir |
# setup md5 dir |
1099 |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5" |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5" |
1100 |
install -d ${dest} |
install -d ${dest} |
1101 |
|
|
1102 |
# gen md5sum |
# gen md5sum |
1134 |
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}" |
1135 |
} |
} |
1136 |
|
|
1137 |
|
step_by_step() |
1138 |
|
{ |
1139 |
|
if [[ ${STEP_BY_STEP} = true ]] |
1140 |
|
then |
1141 |
|
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
1142 |
|
echo "Press [enter] to continue" |
1143 |
|
read |
1144 |
|
fi |
1145 |
|
} |
1146 |
|
|
1147 |
|
|
1148 |
# print out our version |
# print out our version |
1149 |
showversion |
showversion |
1170 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
1171 |
if [[ $1 = calcmd5 ]] |
if [[ $1 = calcmd5 ]] |
1172 |
then |
then |
1173 |
if [ $# -ge 3 ] |
if [ $# -ge 2 ] |
1174 |
then |
then |
1175 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1176 |
MD5DIR="$3" |
MD5DIR="$3" |
1177 |
|
[[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
1178 |
|
|
1179 |
source ${SMAGENAME} || die "download source failed" |
source ${SMAGENAME} || die "download source failed" |
1180 |
|
|
1181 |
# overridable sourcedir; must be declared after source of the smage2 |
# overridable sourcedir; must be declared after source of the smage2 |
1228 |
echo |
echo |
1229 |
else |
else |
1230 |
echo "Usage: Calculating MD5 Sums:" |
echo "Usage: Calculating MD5 Sums:" |
1231 |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR" |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
1232 |
echo |
echo |
1233 |
echo |
echo |
1234 |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
1266 |
|
|
1267 |
regen_mage_tree |
regen_mage_tree |
1268 |
|
|
1269 |
# build md5sum for existing packages |
# build several targets |
1270 |
generate_package_md5sum \ |
if [[ -n ${MAGE_TARGETS} ]] |
1271 |
--pcat "${PCATEGORIE}" \ |
then |
1272 |
--pname "${PNAME}" \ |
for target in ${MAGE_TARGETS} |
1273 |
--pver "${PVER}" \ |
do |
1274 |
--pbuild "${PBUILD}" \ |
# build md5sum for existing packages |
1275 |
--parch "${ARCH}" \ |
generate_package_md5sum \ |
1276 |
--target "${target}" |
--pcat "${PCATEGORIE}" \ |
1277 |
|
--pname "${PNAME}" \ |
1278 |
|
--pver "${PVER}" \ |
1279 |
|
--pbuild "${PBUILD}" \ |
1280 |
|
--parch "${ARCH}" \ |
1281 |
|
--target "${target}" |
1282 |
|
done |
1283 |
|
|
1284 |
|
# build several subpackages |
1285 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1286 |
|
then |
1287 |
|
split_save_variables |
1288 |
|
for subpackage in ${SPLIT_PACKAGES} |
1289 |
|
do |
1290 |
|
# get the right variables for the split |
1291 |
|
export PNAME="${subpackage}" |
1292 |
|
split_info_${subpackage} |
1293 |
|
# build md5sum for existing packages |
1294 |
|
generate_package_md5sum \ |
1295 |
|
--pcat "${PCATEGORIE}" \ |
1296 |
|
--pname "${PNAME}" \ |
1297 |
|
--pver "${PVER}" \ |
1298 |
|
--pbuild "${PBUILD}" \ |
1299 |
|
--parch "${ARCH}" |
1300 |
|
# restore smage environment |
1301 |
|
split_restore_variables |
1302 |
|
done |
1303 |
|
# unset all saved smage variables |
1304 |
|
split_unset_variables |
1305 |
|
|
1306 |
|
else |
1307 |
|
# build md5sum for existing packages |
1308 |
|
generate_package_md5sum \ |
1309 |
|
--pcat "${PCATEGORIE}" \ |
1310 |
|
--pname "${PNAME}" \ |
1311 |
|
--pver "${PVER}" \ |
1312 |
|
--pbuild "${PBUILD}" \ |
1313 |
|
--parch "${ARCH}" |
1314 |
|
fi |
1315 |
|
|
1316 |
exit 0 |
exit 0 |
1317 |
fi |
fi |
1376 |
source ${SMAGENAME} || die "source failed" |
source ${SMAGENAME} || die "source failed" |
1377 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1378 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1379 |
|
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1380 |
|
|
1381 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
1382 |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
1451 |
mage rmstamp |
mage rmstamp |
1452 |
fi |
fi |
1453 |
|
|
1454 |
src_prepare || die "src_prepare failed" |
# setup build loggins |
1455 |
src_compile || die "src_compile failed" |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1456 |
src_install || die "src_install failed" |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1457 |
|
|
1458 |
|
src_prepare | ${SMAGE_LOG_CMD} |
1459 |
|
die_pipestatus 0 "src_prepare failed" |
1460 |
|
step_by_step $_ |
1461 |
|
|
1462 |
|
src_compile | ${SMAGE_LOG_CMD} |
1463 |
|
die_pipestatus 0 "src_compile failed" |
1464 |
|
step_by_step $_ |
1465 |
|
|
1466 |
# compressing doc, info & man files |
# build several subpackages |
1467 |
if [ -d ${BUILDDIR}/builded/usr/share/man ] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1468 |
then |
then |
1469 |
echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}" |
# save bindir & pname |
1470 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man |
split_save_variables |
1471 |
|
export SAVED_BINDIR="${BINDIR}" |
1472 |
|
for subpackage in ${SPLIT_PACKAGES} |
1473 |
|
do |
1474 |
|
if typeset -f src_install_${subpackage} > /dev/null |
1475 |
|
then |
1476 |
|
# export subpackage bindir |
1477 |
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
1478 |
|
# export PNAME, several internal function and include |
1479 |
|
# rely on this variable |
1480 |
|
export PNAME="${subpackage}" |
1481 |
|
|
1482 |
|
echo |
1483 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
1484 |
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
1485 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
1486 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
1487 |
|
|
1488 |
|
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
1489 |
|
die_pipestatus 0 "src_install_${subpackage} failed" |
1490 |
|
step_by_step $_ |
1491 |
|
fi |
1492 |
|
done |
1493 |
|
# restore bindir & pname |
1494 |
|
split_restore_variables |
1495 |
|
# unset all saved smage variables |
1496 |
|
split_unset_variables |
1497 |
|
else |
1498 |
|
src_install | ${SMAGE_LOG_CMD} |
1499 |
|
die_pipestatus 0 "src_install failed" |
1500 |
|
step_by_step $_ |
1501 |
fi |
fi |
1502 |
|
|
1503 |
if [ -d ${BUILDDIR}/builded/usr/share/info ] |
# compressing doc, info & man files |
1504 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1505 |
then |
then |
1506 |
echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGES} |
1507 |
${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info |
do |
1508 |
|
mcompressdocs ${BINDIR}_${subpackage} |
1509 |
|
done |
1510 |
|
else |
1511 |
|
mcompressdocs ${BINDIR} |
1512 |
fi |
fi |
1513 |
|
|
1514 |
|
|
1515 |
# stripping all bins and libs |
# stripping all bins and libs |
1516 |
case ${NOSTRIP} in |
case ${NOSTRIP} in |
1517 |
true|TRUE|yes|y) |
true|TRUE|yes|y) |
1518 |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
1519 |
;; |
;; |
1520 |
*) |
*) |
1521 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
if [[ -n ${SPLIT_PACKAGES} ]] |
1522 |
mstripbins ${BINDIR} |
then |
1523 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
for subpackage in ${SPLIT_PACKAGES} |
1524 |
mstriplibs ${BINDIR} |
do |
1525 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1526 |
|
mstripbins ${BINDIR}_${subpackage} |
1527 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
1528 |
|
mstriplibs ${BINDIR}_${subpackage} |
1529 |
|
done |
1530 |
|
else |
1531 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1532 |
|
mstripbins ${BINDIR} |
1533 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
1534 |
|
mstriplibs ${BINDIR} |
1535 |
|
fi |
1536 |
;; |
;; |
1537 |
esac |
esac |
1538 |
|
|
1543 |
;; |
;; |
1544 |
*) |
*) |
1545 |
# build several targets |
# build several targets |
1546 |
if [ -n "${MAGE_TARGETS}" ] |
if [[ -n ${MAGE_TARGETS} ]] |
1547 |
then |
then |
1548 |
for target in ${MAGE_TARGETS} |
for target in ${MAGE_TARGETS} |
1549 |
do |
do |
1569 |
|
|
1570 |
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}" |
1571 |
done |
done |
1572 |
|
|
1573 |
|
# build several subpackages |
1574 |
|
elif [[ -n ${SPLIT_PACKAGES} ]] |
1575 |
|
then |
1576 |
|
split_save_variables |
1577 |
|
for subpackage in ${SPLIT_PACKAGES} |
1578 |
|
do |
1579 |
|
# get the right variables for the split |
1580 |
|
export PNAME="${subpackage}" |
1581 |
|
split_info_${PNAME} |
1582 |
|
|
1583 |
|
# jump to next one if NOPKGBUILD is set in split_info |
1584 |
|
case ${NOPKGBUILD} in |
1585 |
|
true|TRUE|yes|y) continue ;; |
1586 |
|
esac |
1587 |
|
|
1588 |
|
# check if an special subpackage_pkgbuild exists |
1589 |
|
if typeset -f ${PNAME}_pkgbuild > /dev/null |
1590 |
|
then |
1591 |
|
# run it |
1592 |
|
${PNAME}_pkgbuild |
1593 |
|
fi |
1594 |
|
# now create the target package |
1595 |
|
${MLIBDIR}/pkgbuild_dir.sh \ |
1596 |
|
"${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ |
1597 |
|
"${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
1598 |
|
|
1599 |
|
# build pkg-md5-sum if requested |
1600 |
|
generate_package_md5sum \ |
1601 |
|
--pcat "${PCATEGORIE}" \ |
1602 |
|
--pname "${PNAME}" \ |
1603 |
|
--pver "${PVER}" \ |
1604 |
|
--pbuild "${PBUILD}" \ |
1605 |
|
--parch "${ARCH}" |
1606 |
|
|
1607 |
|
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
1608 |
|
|
1609 |
|
# restore smage environment |
1610 |
|
split_restore_variables |
1611 |
|
done |
1612 |
|
# unset all saved smage variables |
1613 |
|
split_unset_variables |
1614 |
|
|
1615 |
else |
else |
1616 |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
1617 |
|
|
1631 |
;; |
;; |
1632 |
esac |
esac |
1633 |
|
|
1634 |
|
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
1635 |
|
then |
1636 |
|
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1637 |
|
else |
1638 |
|
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1639 |
|
fi |
1640 |
|
|
1641 |
# for sure |
# for sure |
1642 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1643 |
unset NOSTRIP |
unset NOSTRIP |