50 |
|
|
51 |
source /etc/mage.rc.global |
source /etc/mage.rc.global |
52 |
source ${MAGERC} |
source ${MAGERC} |
53 |
|
source ${MLIBDIR}/mage4.functions.sh |
54 |
|
|
55 |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
56 |
if [[ -n ${MROOT} ]] |
if [[ -n ${MROOT} ]] |
60 |
export BINDIR=${MROOT}/${BINDIR} |
export BINDIR=${MROOT}/${BINDIR} |
61 |
fi |
fi |
62 |
|
|
63 |
|
# sources the smage file and uses state from distribution file if exist |
64 |
|
# may helpful for repository support later on |
65 |
|
smagesource() |
66 |
|
{ |
67 |
|
local file="$1" |
68 |
|
local mystate |
69 |
|
local mycodename |
70 |
|
|
71 |
|
source ${file} |
72 |
|
|
73 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
74 |
|
|
75 |
|
# do not overide if local state was broken or disabled! |
76 |
|
case ${STATE} in |
77 |
|
broken) return ;; |
78 |
|
disabled) return ;; |
79 |
|
esac |
80 |
|
|
81 |
|
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
82 |
|
then |
83 |
|
source ${SMAGESCRIPTSDIR}/distribution |
84 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
85 |
|
fi |
86 |
|
# now switch state and export it |
87 |
|
STATE="${mystate}" |
88 |
|
} |
89 |
|
|
90 |
showversion() |
showversion() |
91 |
{ |
{ |
92 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
181 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
182 |
local FETCHING |
local FETCHING |
183 |
local i mirror |
local i mirror |
184 |
|
local wget_opts |
185 |
|
|
186 |
|
# filter wget command if busybox was found |
187 |
|
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
188 |
|
|
189 |
# install SRCDIR/PNAME if not exist |
# install SRCDIR/PNAME if not exist |
190 |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
191 |
|
|
192 |
# check if FETCHING is needed |
# check if FETCHING is needed |
193 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null ) |
194 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
195 |
then |
then |
196 |
# md5's ok, no fetching needed |
# md5's ok, no fetching needed |
229 |
then |
then |
230 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
231 |
wget \ |
wget \ |
232 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
233 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
234 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
235 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
250 |
then |
then |
251 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
252 |
wget \ |
wget \ |
253 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
254 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
255 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
256 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
271 |
then |
then |
272 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
273 |
wget \ |
wget \ |
274 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
275 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
276 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
277 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
292 |
then |
then |
293 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
294 |
wget \ |
wget \ |
295 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
296 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
297 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
298 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
313 |
then |
then |
314 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
315 |
wget \ |
wget \ |
316 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
317 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
318 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
319 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
329 |
then |
then |
330 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
331 |
wget \ |
wget \ |
332 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
333 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
334 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
335 |
fi |
fi |
345 |
# recheck md5 sums |
# recheck md5 sums |
346 |
echo |
echo |
347 |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
348 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
349 |
echo |
echo |
350 |
|
|
351 |
# not needed anymore |
# not needed anymore |
469 |
popd > /dev/null |
popd > /dev/null |
470 |
fi |
fi |
471 |
;; |
;; |
472 |
|
xz) |
473 |
|
IFTAR="$(basename $SRCFILE .xz)" |
474 |
|
IFTAR="${IFTAR##*.}" |
475 |
|
if [[ ${IFTAR} = tar ]] |
476 |
|
then |
477 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed." |
478 |
|
else |
479 |
|
pushd ${DEST} > /dev/null |
480 |
|
xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed." |
481 |
|
popd > /dev/null |
482 |
|
fi |
483 |
|
;; |
484 |
tbz2|mpks|mpk) |
tbz2|mpks|mpk) |
485 |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed." |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed." |
486 |
;; |
;; |
487 |
tgz) |
tgz) |
488 |
tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed." |
tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed." |
489 |
;; |
;; |
490 |
|
txz|mpkzs|mpkz) |
491 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed." |
492 |
|
;; |
493 |
rar) |
rar) |
494 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
495 |
;; |
;; |
543 |
mlibtoolize() |
mlibtoolize() |
544 |
{ |
{ |
545 |
local opts="$@" |
local opts="$@" |
546 |
[[ -z ${opts} ]] && opts="--copy --force" |
[[ -z ${opts} ]] && opts="--verbose --install --force" |
547 |
|
|
548 |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
549 |
} |
} |
550 |
|
|
551 |
|
mautoreconf() |
552 |
|
{ |
553 |
|
local opts="$@" |
554 |
|
[[ -z ${opts} ]] && opts="--verbose --install --force" |
555 |
|
|
556 |
|
autoreconf ${opts} || die "running: mautoreconf ${opts}" |
557 |
|
} |
558 |
|
|
559 |
minstalldocs() |
minstalldocs() |
560 |
{ |
{ |
561 |
local docfiles |
local docfiles |
566 |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
567 |
fi |
fi |
568 |
|
|
569 |
|
local i |
570 |
for i in ${docfiles} |
for i in ${docfiles} |
571 |
do |
do |
572 |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
if [ -f ${i} ] |
573 |
install -m 0644 ${SRCDIR}/${i}.gz \ |
then |
574 |
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
575 |
|
install -m 0644 ${SRCDIR}/${i}.gz \ |
576 |
|
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
577 |
|
fi |
578 |
done |
done |
579 |
} |
} |
580 |
|
|
766 |
# now build the mage file |
# now build the mage file |
767 |
> ${dest} |
> ${dest} |
768 |
|
|
|
# header |
|
|
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} |
|
|
echo >> ${dest} |
|
|
|
|
769 |
# pgkname and state |
# pgkname and state |
770 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
771 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
|
echo >> ${dest} |
|
772 |
|
|
773 |
# description and homepage |
# description and homepage |
774 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
775 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
|
echo >> ${dest} |
|
776 |
|
|
777 |
# special tags and vars |
# special tags and vars |
778 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
779 |
|
|
780 |
# echo MAGE_TARGETS ## note -target is needed ! |
# echo MAGE_TARGETS ## note -target is needed ! |
781 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
echo >> ${dest} |
|
782 |
|
|
783 |
# split package base |
# split package base |
784 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
|
echo >> ${dest} |
|
785 |
|
|
786 |
# add special vars |
# add special vars |
787 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
792 |
# being tricky here :) |
# being tricky here :) |
793 |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
794 |
done |
done |
|
echo >> ${dest} |
|
795 |
fi |
fi |
796 |
|
|
797 |
# add at least all includes |
# add at least all includes |
803 |
do |
do |
804 |
echo -n " ${i}" >> ${dest} |
echo -n " ${i}" >> ${dest} |
805 |
done |
done |
806 |
echo >> ${dest} |
# a CRLF is needed here! |
807 |
|
echo >> ${dest} |
808 |
fi |
fi |
|
echo >> ${dest} |
|
809 |
|
|
810 |
# deps and provides |
# deps and provides |
811 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
812 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
813 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
|
echo >> ${dest} |
|
814 |
|
|
815 |
# add special functions |
# add special functions |
816 |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
820 |
do |
do |
821 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
822 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
echo >> ${dest} |
|
823 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
824 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
825 |
done |
done |
|
echo >> ${dest} |
|
826 |
fi |
fi |
827 |
|
|
828 |
# pre|post-install|removes |
# pre|post-install|removes |
829 |
typeset -f preinstall >> ${dest} |
typeset -f preinstall >> ${dest} |
|
echo >> ${dest} |
|
830 |
typeset -f postinstall >> ${dest} |
typeset -f postinstall >> ${dest} |
|
echo >> ${dest} |
|
831 |
typeset -f preremove >> ${dest} |
typeset -f preremove >> ${dest} |
|
echo >> ${dest} |
|
832 |
typeset -f postremove >> ${dest} |
typeset -f postremove >> ${dest} |
|
echo >> ${dest} |
|
833 |
} |
} |
834 |
|
|
835 |
regen_mage_tree() |
regen_mage_tree() |
866 |
export PNAME="${i}" |
export PNAME="${i}" |
867 |
split_info_${i} |
split_info_${i} |
868 |
build_mage_script --split-pkg-base "${split_pkg_base}" |
build_mage_script --split-pkg-base "${split_pkg_base}" |
869 |
|
# restore smage environment |
870 |
|
split_restore_variables |
871 |
done |
done |
872 |
echo |
echo |
873 |
# restore smage environment |
# unset all saved smage variables |
874 |
split_restore_variables |
split_unset_variables |
875 |
|
|
876 |
else |
else |
877 |
echo |
echo |
922 |
export SAVED_DEPEND="${DEPEND}" |
export SAVED_DEPEND="${DEPEND}" |
923 |
export SAVED_SDEPEND="${SDEPEND}" |
export SAVED_SDEPEND="${SDEPEND}" |
924 |
export SAVED_PROVIDE="${PROVIDE}" |
export SAVED_PROVIDE="${PROVIDE}" |
925 |
|
export SAVED_NOPKGBUILD="${NOPKGBUILD}" |
926 |
|
|
927 |
|
# bindir too |
928 |
|
export SAVED_BINDIR="${BINDIR}" |
929 |
|
|
930 |
|
# export the SPLIT_PACKAGE_BASE |
931 |
|
export SPLIT_PACKAGE_BASE="${SAVED_PNAME}" |
932 |
|
|
933 |
# functions |
# functions |
934 |
if [[ ! -z $(typeset -f preinstall) ]] |
if [[ ! -z $(typeset -f preinstall) ]] |
983 |
export DEPEND="${SAVED_DEPEND}" |
export DEPEND="${SAVED_DEPEND}" |
984 |
export SDEPEND="${SAVED_SDEPEND}" |
export SDEPEND="${SAVED_SDEPEND}" |
985 |
export PROVIDE="${SAVED_PROVIDE}" |
export PROVIDE="${SAVED_PROVIDE}" |
986 |
|
export NOPKGBUILD="${SAVED_NOPKGBUILD}" |
987 |
|
|
988 |
|
# bindir too |
989 |
|
export BINDIR="${SAVED_BINDIR}" |
990 |
|
|
991 |
# functions |
# functions |
992 |
if [[ ! -z $(typeset -f SAVED_preinstall) ]] |
if [[ ! -z $(typeset -f SAVED_preinstall) ]] |
1024 |
eval "${saved_postremove/SAVED_/}" |
eval "${saved_postremove/SAVED_/}" |
1025 |
export -f postremove |
export -f postremove |
1026 |
fi |
fi |
1027 |
|
} |
1028 |
|
|
1029 |
|
split_unset_variables() |
1030 |
|
{ |
1031 |
# unset saved vars; not needed anymore |
# unset saved vars; not needed anymore |
1032 |
unset SAVED_PNAME |
unset SAVED_PNAME |
1033 |
unset SAVED_PVER |
unset SAVED_PVER |
1042 |
unset SAVED_DEPEND |
unset SAVED_DEPEND |
1043 |
unset SAVED_SDEPEND |
unset SAVED_SDEPEND |
1044 |
unset SAVED_PROVIDE |
unset SAVED_PROVIDE |
1045 |
|
unset SAVED_BINDIR |
1046 |
|
unset SAVED_NOPKGBUILD |
1047 |
|
unset SPLIT_PACKAGE_BASE |
1048 |
unset -f SAVED_preinstall |
unset -f SAVED_preinstall |
1049 |
unset -f SAVED_postinstall |
unset -f SAVED_postinstall |
1050 |
unset -f SAVED_preremove |
unset -f SAVED_preremove |
1174 |
{ |
{ |
1175 |
if [[ ${STEP_BY_STEP} = true ]] |
if [[ ${STEP_BY_STEP} = true ]] |
1176 |
then |
then |
1177 |
echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
1178 |
echo "Press [enter] to continue" |
echo "Press [enter] to continue" |
1179 |
read |
read |
1180 |
fi |
fi |
1206 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
1207 |
if [[ $1 = calcmd5 ]] |
if [[ $1 = calcmd5 ]] |
1208 |
then |
then |
1209 |
if [ $# -ge 3 ] |
if [ $# -ge 2 ] |
1210 |
then |
then |
1211 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1212 |
MD5DIR="$3" |
MD5DIR="$3" |
1213 |
source ${SMAGENAME} || die "download source failed" |
[[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
1214 |
|
|
1215 |
|
smagesource ${SMAGENAME} || die "download source failed" |
1216 |
|
|
1217 |
# overridable sourcedir; must be declared after source of the smage2 |
# overridable sourcedir; must be declared after source of the smage2 |
1218 |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
1264 |
echo |
echo |
1265 |
else |
else |
1266 |
echo "Usage: Calculating MD5 Sums:" |
echo "Usage: Calculating MD5 Sums:" |
1267 |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR" |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
1268 |
echo |
echo |
1269 |
echo |
echo |
1270 |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
1286 |
# get smage |
# get smage |
1287 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1288 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1289 |
source ${SMAGENAME} || die "download source failed" |
smagesource ${SMAGENAME} || die "download source failed" |
1290 |
|
|
1291 |
download_sources |
download_sources |
1292 |
exit 0 |
exit 0 |
1298 |
# set correct SMAGENAME |
# set correct SMAGENAME |
1299 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1300 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1301 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1302 |
|
|
1303 |
regen_mage_tree |
regen_mage_tree |
1304 |
|
|
1321 |
elif [[ -n ${SPLIT_PACKAGES} ]] |
elif [[ -n ${SPLIT_PACKAGES} ]] |
1322 |
then |
then |
1323 |
split_save_variables |
split_save_variables |
1324 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1325 |
do |
do |
1326 |
# get the right variables for the split |
# get the right variables for the split |
1327 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
1333 |
--pver "${PVER}" \ |
--pver "${PVER}" \ |
1334 |
--pbuild "${PBUILD}" \ |
--pbuild "${PBUILD}" \ |
1335 |
--parch "${ARCH}" |
--parch "${ARCH}" |
1336 |
|
# restore smage environment |
1337 |
|
split_restore_variables |
1338 |
done |
done |
1339 |
split_restore_variables |
# unset all saved smage variables |
1340 |
|
split_unset_variables |
1341 |
|
|
1342 |
else |
else |
1343 |
# build md5sum for existing packages |
# build md5sum for existing packages |
1360 |
|
|
1361 |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
1362 |
|
|
1363 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1364 |
|
|
1365 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
1366 |
then |
then |
1409 |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
1410 |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
1411 |
|
|
1412 |
source ${SMAGENAME} || die "source failed" |
smagesource ${SMAGENAME} || die "source failed" |
1413 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1414 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1415 |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1502 |
# build several subpackages |
# build several subpackages |
1503 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1504 |
then |
then |
1505 |
# save bindir |
# save bindir & pname |
1506 |
|
split_save_variables |
1507 |
export SAVED_BINDIR="${BINDIR}" |
export SAVED_BINDIR="${BINDIR}" |
1508 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1509 |
do |
do |
1511 |
then |
then |
1512 |
# export subpackage bindir |
# export subpackage bindir |
1513 |
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
1514 |
|
# export PNAME, several internal function and include |
1515 |
|
# rely on this variable |
1516 |
|
export PNAME="${subpackage}" |
1517 |
|
|
1518 |
|
echo |
1519 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
1520 |
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
1521 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
1522 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
1523 |
|
|
1524 |
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
1525 |
die_pipestatus 0 "src_install_${subpackage} failed" |
die_pipestatus 0 "src_install_${subpackage} failed" |
1526 |
step_by_step $_ |
step_by_step $_ |
1527 |
fi |
fi |
1528 |
done |
done |
1529 |
# restore bindir |
# restore bindir & pname |
1530 |
export BINDIR="${SAVED_BINDIR}" |
split_restore_variables |
1531 |
unset SAVED_BINDIR |
# unset all saved smage variables |
1532 |
|
split_unset_variables |
1533 |
else |
else |
1534 |
src_install | ${SMAGE_LOG_CMD} |
src_install | ${SMAGE_LOG_CMD} |
1535 |
die_pipestatus 0 "src_install failed" |
die_pipestatus 0 "src_install failed" |
1536 |
step_by_step $_ |
step_by_step $_ |
1537 |
fi |
fi |
1538 |
|
|
|
echo -e "${COLGREEN}DEB${COLRED}UG!${COLDEFAULT}" |
|
|
|
|
1539 |
# compressing doc, info & man files |
# compressing doc, info & man files |
1540 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1541 |
then |
then |
1542 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1543 |
do |
do |
1544 |
mcompressdocs ${BINDIR}_${subpackage} |
mcompressdocs ${BINDIR}_${subpackage} |
1545 |
done |
done |
1556 |
*) |
*) |
1557 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1558 |
then |
then |
1559 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1560 |
do |
do |
1561 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1562 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1563 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
1564 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1565 |
done |
done |
1566 |
else |
else |
1616 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
1617 |
split_info_${PNAME} |
split_info_${PNAME} |
1618 |
|
|
1619 |
|
# jump to next one if NOPKGBUILD is set in split_info |
1620 |
|
case ${NOPKGBUILD} in |
1621 |
|
true|TRUE|yes|y) continue ;; |
1622 |
|
esac |
1623 |
|
|
1624 |
# check if an special subpackage_pkgbuild exists |
# check if an special subpackage_pkgbuild exists |
1625 |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
1626 |
then |
then |
1641 |
--parch "${ARCH}" |
--parch "${ARCH}" |
1642 |
|
|
1643 |
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
1644 |
|
|
1645 |
|
# restore smage environment |
1646 |
|
split_restore_variables |
1647 |
done |
done |
1648 |
split_restore_variables |
# unset all saved smage variables |
1649 |
|
split_unset_variables |
1650 |
|
|
1651 |
else |
else |
1652 |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |