1 |
#!/bin/bash |
#!/bin/bash |
2 |
|
# $Id$ |
3 |
|
|
4 |
# compiles/installs .smage2 source install scripts |
# compiles/installs .smage2 source install scripts |
5 |
# needs pkgbuild_dir (mage) |
# needs pkgbuild_dir (mage) |
6 |
|
|
7 |
# SMAGE2 |
# TODO: record dynlib, gz | xz database |
|
# $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 |
|
|
|
#01.10.2004 |
|
|
# added ccache support |
|
|
# added distcc support |
|
9 |
|
|
10 |
# set default user mage.rc |
# set default user mage.rc |
11 |
: ${MAGERC="/etc/mage.rc"} |
: ${MAGERC="/etc/mage.rc"} |
12 |
|
|
13 |
## setup ## |
## setup ## |
|
PKGSUFFIX="mpk" |
|
|
SRCPKGSUFFIX="mpks" |
|
14 |
SMAGENAME="$1" |
SMAGENAME="$1" |
|
SMAGESUFFIX="smage2" |
|
|
MLIBDIR=/usr/lib/mage |
|
15 |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
16 |
|
|
|
## only for tests -> normally in /etc/rc.d/init.d/functions |
|
|
COLRED="\033[1;6m\033[31m" |
|
|
COLGREEN="\033[1;6m\033[32m" |
|
|
COLYELLOW="\033[1;6m\033[33m" |
|
|
COLBLUE="\033[1;6m\033[34m" |
|
|
COLMAGENTA="\033[1;6m\033[35m" |
|
|
COLWHITE="\033[1;6m\033[37m" |
|
|
COLGRAY="\033[0;6m\033[37m" |
|
|
COLBOLD="\033[1m" |
|
|
COLDEFAULT="\033[0m" |
|
|
|
|
|
if [[ ${NOCOLORS} = true ]] |
|
|
then |
|
|
COLRED="" |
|
|
COLGREEN="" |
|
|
COLYELLOW="" |
|
|
COLBLUE="" |
|
|
COLMAGENTA="" |
|
|
COLWHITE="" |
|
|
COLGRAY="" |
|
|
COLBOLD="" |
|
|
COLDEFAULT="" |
|
|
fi |
|
|
|
|
17 |
# export default C locale |
# export default C locale |
18 |
export LC_ALL=C |
export LC_ALL=C |
19 |
|
|
20 |
source /etc/mage.rc.global |
source /etc/mage.rc.global |
21 |
source ${MAGERC} |
source ${MAGERC} |
22 |
|
source ${MLIBDIR}/mage4.functions.sh |
23 |
|
|
24 |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
25 |
if [[ -n ${MROOT} ]] |
if [[ -n ${MROOT} ]] |
29 |
export BINDIR=${MROOT}/${BINDIR} |
export BINDIR=${MROOT}/${BINDIR} |
30 |
fi |
fi |
31 |
|
|
32 |
|
# sources the smage file and uses state from distribution file if exist |
33 |
|
# may helpful for repository support later on |
34 |
|
smagesource() |
35 |
|
{ |
36 |
|
local file="$1" |
37 |
|
local mystate |
38 |
|
local mycodename |
39 |
|
|
40 |
|
source ${file} |
41 |
|
|
42 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
43 |
|
|
44 |
|
# do not overide if local state was broken or disabled! |
45 |
|
case ${STATE} in |
46 |
|
broken) return ;; |
47 |
|
disabled) return ;; |
48 |
|
esac |
49 |
|
|
50 |
|
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
51 |
|
then |
52 |
|
source ${SMAGESCRIPTSDIR}/distribution |
53 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
54 |
|
fi |
55 |
|
# now switch state and export it |
56 |
|
STATE="${mystate}" |
57 |
|
} |
58 |
|
|
59 |
showversion() |
showversion() |
60 |
{ |
{ |
61 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
150 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
151 |
local FETCHING |
local FETCHING |
152 |
local i mirror |
local i mirror |
153 |
|
local wget_opts |
154 |
|
|
155 |
|
# filter wget command if busybox was found |
156 |
|
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
157 |
|
|
158 |
# install SRCDIR/PNAME if not exist |
# install SRCDIR/PNAME if not exist |
159 |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
160 |
|
|
161 |
# check if FETCHING is needed |
# check if FETCHING is needed |
162 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null ) |
163 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
164 |
then |
then |
165 |
# md5's ok, no fetching needed |
# md5's ok, no fetching needed |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
202 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
203 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
204 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
223 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
224 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
225 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
244 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
245 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
246 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
265 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
266 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
267 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
286 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
287 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
288 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
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_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
302 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
303 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
304 |
fi |
fi |
314 |
# recheck md5 sums |
# recheck md5 sums |
315 |
echo |
echo |
316 |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
317 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
318 |
echo |
echo |
319 |
|
|
320 |
# not needed anymore |
# not needed anymore |
438 |
popd > /dev/null |
popd > /dev/null |
439 |
fi |
fi |
440 |
;; |
;; |
441 |
|
xz) |
442 |
|
IFTAR="$(basename $SRCFILE .xz)" |
443 |
|
IFTAR="${IFTAR##*.}" |
444 |
|
if [[ ${IFTAR} = tar ]] |
445 |
|
then |
446 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed." |
447 |
|
else |
448 |
|
pushd ${DEST} > /dev/null |
449 |
|
xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed." |
450 |
|
popd > /dev/null |
451 |
|
fi |
452 |
|
;; |
453 |
tbz2|mpks|mpk) |
tbz2|mpks|mpk) |
454 |
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." |
455 |
;; |
;; |
456 |
tgz) |
tgz) |
457 |
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." |
458 |
;; |
;; |
459 |
|
txz|mpkzs|mpkz) |
460 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed." |
461 |
|
;; |
462 |
rar) |
rar) |
463 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
464 |
;; |
;; |
512 |
mlibtoolize() |
mlibtoolize() |
513 |
{ |
{ |
514 |
local opts="$@" |
local opts="$@" |
515 |
[[ -z ${opts} ]] && opts="--copy --force" |
[[ -z ${opts} ]] && opts="--verbose --install --force" |
516 |
|
|
517 |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
518 |
} |
} |
519 |
|
|
520 |
|
mautoreconf() |
521 |
|
{ |
522 |
|
local opts="$@" |
523 |
|
[[ -z ${opts} ]] && opts="--verbose --install --force" |
524 |
|
|
525 |
|
autoreconf ${opts} || die "running: mautoreconf ${opts}" |
526 |
|
} |
527 |
|
|
528 |
minstalldocs() |
minstalldocs() |
529 |
{ |
{ |
530 |
local docfiles |
local docfiles |
552 |
local stripdir="$@" |
local stripdir="$@" |
553 |
|
|
554 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
555 |
find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_LIB} 2> /dev/null |
556 |
} |
} |
557 |
|
|
558 |
mstripbins() |
mstripbins() |
560 |
local stripdir="$@" |
local stripdir="$@" |
561 |
|
|
562 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
563 |
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_DYN_BIN} 2> /dev/null |
564 |
|
} |
565 |
|
|
566 |
|
mstripstatic() |
567 |
|
{ |
568 |
|
local stripdir="$@" |
569 |
|
|
570 |
|
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
571 |
|
find ${stripdir} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip ${STRIP_STATIC_LIB} 2> /dev/null |
572 |
} |
} |
573 |
|
|
574 |
mcompressdocs() |
mcompressdocs() |
743 |
# now build the mage file |
# now build the mage file |
744 |
> ${dest} |
> ${dest} |
745 |
|
|
|
# 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} |
|
|
|
|
746 |
# pgkname and state |
# pgkname and state |
747 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
748 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
|
echo >> ${dest} |
|
749 |
|
|
750 |
# description and homepage |
# description and homepage |
751 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
752 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
|
echo >> ${dest} |
|
753 |
|
|
754 |
# special tags and vars |
# special tags and vars |
755 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
756 |
|
|
757 |
# echo MAGE_TARGETS ## note -target is needed ! |
# echo MAGE_TARGETS ## note -target is needed ! |
758 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
echo >> ${dest} |
|
759 |
|
|
760 |
# split package base |
# split package base |
761 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
|
echo >> ${dest} |
|
762 |
|
|
763 |
# add special vars |
# add special vars |
764 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
769 |
# being tricky here :) |
# being tricky here :) |
770 |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
771 |
done |
done |
|
echo >> ${dest} |
|
772 |
fi |
fi |
773 |
|
|
774 |
# add at least all includes |
# add at least all includes |
780 |
do |
do |
781 |
echo -n " ${i}" >> ${dest} |
echo -n " ${i}" >> ${dest} |
782 |
done |
done |
783 |
echo >> ${dest} |
# a CRLF is needed here! |
784 |
|
echo >> ${dest} |
785 |
fi |
fi |
|
echo >> ${dest} |
|
786 |
|
|
787 |
# deps and provides |
# deps and provides |
788 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
789 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
790 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
|
echo >> ${dest} |
|
791 |
|
|
792 |
# add special functions |
# add special functions |
793 |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
797 |
do |
do |
798 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
799 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
echo >> ${dest} |
|
800 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
801 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
802 |
done |
done |
|
echo >> ${dest} |
|
803 |
fi |
fi |
804 |
|
|
805 |
# pre|post-install|removes |
# pre|post-install|removes |
806 |
typeset -f preinstall >> ${dest} |
typeset -f preinstall >> ${dest} |
|
echo >> ${dest} |
|
807 |
typeset -f postinstall >> ${dest} |
typeset -f postinstall >> ${dest} |
|
echo >> ${dest} |
|
808 |
typeset -f preremove >> ${dest} |
typeset -f preremove >> ${dest} |
|
echo >> ${dest} |
|
809 |
typeset -f postremove >> ${dest} |
typeset -f postremove >> ${dest} |
|
echo >> ${dest} |
|
810 |
} |
} |
811 |
|
|
812 |
regen_mage_tree() |
regen_mage_tree() |
813 |
{ |
{ |
814 |
local i |
local subpackage |
815 |
|
|
816 |
# build them only if requested |
# build them only if requested |
817 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if [[ ${REGEN_MAGE_TREE} = true ]] |
822 |
# build for each target a mage file |
# build for each target a mage file |
823 |
# run it with several targets |
# run it with several targets |
824 |
echo |
echo |
825 |
for i in ${MAGE_TARGETS} |
for subpackage in ${MAGE_TARGETS} |
826 |
do |
do |
827 |
build_mage_script --target "${i}" |
build_mage_script --target "${subpackage}" |
828 |
done |
done |
829 |
echo |
echo |
830 |
|
|
837 |
# build for each subpackage a mage file |
# build for each subpackage a mage file |
838 |
# run it with several targets |
# run it with several targets |
839 |
echo |
echo |
840 |
for i in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
841 |
do |
do |
842 |
# get the right variables for the split |
# get the right variables for the split |
843 |
export PNAME="${i}" |
export PNAME="${subpackage}" |
844 |
split_info_${i} |
split_info_${subpackage} |
845 |
|
# get the preinstall etc |
846 |
|
split_export_inherits ${subpackage} |
847 |
build_mage_script --split-pkg-base "${split_pkg_base}" |
build_mage_script --split-pkg-base "${split_pkg_base}" |
848 |
|
# delete split preinstall etc |
849 |
|
split_delete_inherits ${subpackage} |
850 |
# restore smage environment |
# restore smage environment |
851 |
split_restore_variables |
split_restore_variables |
852 |
done |
done |
1032 |
unset -f SAVED_postremove |
unset -f SAVED_postremove |
1033 |
} |
} |
1034 |
|
|
1035 |
|
split_export_inherits() |
1036 |
|
{ |
1037 |
|
local subpackage="$1" |
1038 |
|
local func |
1039 |
|
local newfunc |
1040 |
|
|
1041 |
|
for func in preinstall postinstall preremove postremove |
1042 |
|
do |
1043 |
|
if [[ ! -z $(typeset -f ${func}_${subpackage}) ]] |
1044 |
|
then |
1045 |
|
newfunc=$(typeset -f ${func}_${subpackage}) |
1046 |
|
newfunc="${newfunc/_${subpackage} (/ (}" |
1047 |
|
eval "${newfunc}" |
1048 |
|
fi |
1049 |
|
done |
1050 |
|
} |
1051 |
|
|
1052 |
|
split_delete_inherits() |
1053 |
|
{ |
1054 |
|
local subpackage="$1" |
1055 |
|
local func |
1056 |
|
|
1057 |
|
for func in preinstall postinstall preremove postremove |
1058 |
|
do |
1059 |
|
if [[ ! -z $(typeset -f ${func}_${subpackage}) ]] |
1060 |
|
then |
1061 |
|
unset -f ${func} |
1062 |
|
fi |
1063 |
|
done |
1064 |
|
} |
1065 |
|
|
1066 |
export_inherits() |
export_inherits() |
1067 |
{ |
{ |
1068 |
local include="$1" |
local include="$1" |
1218 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
1219 |
if [[ $1 = calcmd5 ]] |
if [[ $1 = calcmd5 ]] |
1220 |
then |
then |
1221 |
if [ $# -ge 3 ] |
if [ $# -ge 2 ] |
1222 |
then |
then |
1223 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1224 |
MD5DIR="$3" |
MD5DIR="$3" |
1225 |
source ${SMAGENAME} || die "download source failed" |
[[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
1226 |
|
|
1227 |
|
smagesource ${SMAGENAME} || die "download source failed" |
1228 |
|
|
1229 |
# overridable sourcedir; must be declared after source of the smage2 |
# overridable sourcedir; must be declared after source of the smage2 |
1230 |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
1276 |
echo |
echo |
1277 |
else |
else |
1278 |
echo "Usage: Calculating MD5 Sums:" |
echo "Usage: Calculating MD5 Sums:" |
1279 |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR" |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
1280 |
echo |
echo |
1281 |
echo |
echo |
1282 |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
1298 |
# get smage |
# get smage |
1299 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1300 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1301 |
source ${SMAGENAME} || die "download source failed" |
smagesource ${SMAGENAME} || die "download source failed" |
1302 |
|
|
1303 |
download_sources |
download_sources |
1304 |
exit 0 |
exit 0 |
1310 |
# set correct SMAGENAME |
# set correct SMAGENAME |
1311 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1312 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1313 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1314 |
|
|
1315 |
regen_mage_tree |
regen_mage_tree |
1316 |
|
|
1372 |
|
|
1373 |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
1374 |
|
|
1375 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1376 |
|
|
1377 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
1378 |
then |
then |
1421 |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
1422 |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
1423 |
|
|
1424 |
source ${SMAGENAME} || die "source failed" |
smagesource ${SMAGENAME} || die "source failed" |
1425 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1426 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1427 |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1570 |
then |
then |
1571 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1572 |
do |
do |
1573 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1574 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1575 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
1576 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1577 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
1578 |
|
mstripstatic ${BINDIR}_${subpackage} |
1579 |
done |
done |
1580 |
else |
else |
1581 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1582 |
mstripbins ${BINDIR} |
mstripbins ${BINDIR} |
1583 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
1584 |
mstriplibs ${BINDIR} |
mstriplibs ${BINDIR} |
1585 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
1586 |
|
mstripstatic ${BINDIR} |
1587 |
fi |
fi |
1588 |
;; |
;; |
1589 |
esac |
esac |