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 |
|
|
|
## setup ## |
|
|
PKGSUFFIX="mpk" |
|
|
SRCPKGSUFFIX="mpks" |
|
|
SMAGENAME="$1" |
|
|
SMAGESUFFIX="smage2" |
|
|
MLIBDIR=/usr/lib/mage |
|
|
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
|
|
|
|
|
## 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 |
|
|
|
|
13 |
# export default C locale |
# export default C locale |
14 |
export LC_ALL=C |
export LC_ALL=C |
15 |
|
|
17 |
source ${MAGERC} |
source ${MAGERC} |
18 |
source ${MLIBDIR}/mage4.functions.sh |
source ${MLIBDIR}/mage4.functions.sh |
19 |
|
|
20 |
|
## setup ## |
21 |
|
SMAGENAME="$1" |
22 |
|
SMAGEVERSION="$(< ${MLIBDIR}/version)" |
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} ]] |
26 |
then |
then |
40 |
source ${file} |
source ${file} |
41 |
|
|
42 |
[[ -n ${STATE} ]] && mystate="${STATE}" |
[[ -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 ] |
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
51 |
then |
then |
52 |
source ${SMAGESCRIPTSDIR}/distribution |
source ${SMAGESCRIPTSDIR}/distribution |
139 |
|
|
140 |
download_sources() |
download_sources() |
141 |
{ |
{ |
|
|
|
142 |
[ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0 |
[ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0 |
143 |
|
|
144 |
local EOA=${#SRC_URI[*]} |
local count=${#SRC_URI[*]} |
145 |
local my_SRC_URI |
local uri |
146 |
local my_SRC_URI_DEST |
local subdir |
147 |
local my_SRC_URI_MIRROR |
local outputdir |
148 |
local my_SOURCEDIR |
local db_md5_file="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
149 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local fetching |
150 |
local FETCHING |
local i |
|
local i mirror |
|
|
local wget_opts |
|
|
|
|
|
# filter wget command if busybox was found |
|
|
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
|
|
|
|
|
# install SRCDIR/PNAME if not exist |
|
|
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
|
151 |
|
|
152 |
# check if FETCHING is needed |
# check if FETCHING is needed |
153 |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null ) |
if mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5 |
|
if [[ $? = 0 ]] |
|
154 |
then |
then |
155 |
# md5's ok, no fetching needed |
# md5's ok, no fetching needed |
156 |
FETCHING=false |
fetching=false |
157 |
else |
else |
158 |
FETCHING=true |
fetching=true |
159 |
fi |
fi |
160 |
|
|
161 |
for ((i=0; i < EOA; i++)) |
if [[ ${fetching} = true ]] |
162 |
do |
then |
163 |
# url to file |
for ((i=0; i < count; i++)) |
164 |
my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)" |
do |
165 |
|
# url to file |
166 |
# subdir in sources dir; the my_SRCI_URI file goes to there |
uri="${SRC_URI[${i}]%%' '*}" |
|
my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)" |
|
|
|
|
|
# if my_src_uri_dest is not equal my_src_uri; than an other dir is used |
|
|
if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]] |
|
|
then |
|
|
my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}" |
|
|
else |
|
|
my_SOURCEDIR="${SOURCEDIR}/${PNAME}" |
|
|
fi |
|
|
|
|
|
# create the SOURCEDIR |
|
|
install -d ${my_SOURCEDIR} |
|
|
|
|
|
# if an mirrored file than replace first the mirror uri |
|
|
if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]] |
|
|
then |
|
|
for mirror in ${MIRRORS} |
|
|
do |
|
|
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")" |
|
|
|
|
|
if [[ ${FETCHING} = true ]] |
|
|
then |
|
|
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
|
"${my_SRC_URI_MIRROR}" |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
done |
|
|
elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]] |
|
|
then |
|
|
for mirror in ${SOURCEFORGE_MIRRORS} |
|
|
do |
|
|
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")" |
|
|
|
|
|
if [[ ${FETCHING} = true ]] |
|
|
then |
|
|
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
|
"${my_SRC_URI_MIRROR}" |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
done |
|
|
elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]] |
|
|
then |
|
|
for mirror in ${GNU_MIRRORS} |
|
|
do |
|
|
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")" |
|
|
|
|
|
if [[ ${FETCHING} = true ]] |
|
|
then |
|
|
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
|
"${my_SRC_URI_MIRROR}" |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
done |
|
|
elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]] |
|
|
then |
|
|
for mirror in ${KDE_MIRRORS} |
|
|
do |
|
|
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")" |
|
167 |
|
|
168 |
if [[ ${FETCHING} = true ]] |
# subdir in sources dir; the my_SRCI_URI file goes to there |
169 |
then |
subdir="${SRC_URI[${i}]##*' '}" |
|
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
|
"${my_SRC_URI_MIRROR}" |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
done |
|
|
elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]] |
|
|
then |
|
|
for mirror in ${GNOME_MIRRORS} |
|
|
do |
|
|
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")" |
|
170 |
|
|
171 |
if [[ ${FETCHING} = true ]] |
# if $subdir is not equal with $uri then an other dir is used |
172 |
then |
if [[ ${uri} != ${subdir} ]] |
|
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
|
|
wget \ |
|
|
${wget_opts} \ |
|
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
|
|
"${my_SRC_URI_MIRROR}" |
|
|
if [[ $? = 0 ]] |
|
|
then |
|
|
break |
|
|
else |
|
|
continue |
|
|
fi |
|
|
fi |
|
|
done |
|
|
else |
|
|
if [[ ${FETCHING} = true ]] |
|
173 |
then |
then |
174 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
outputdir="${SOURCEDIR}/${PNAME}/${subdir}" |
175 |
wget \ |
else |
176 |
${wget_opts} \ |
outputdir="${SOURCEDIR}/${PNAME}" |
|
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
|
|
"${my_SRC_URI}" |
|
177 |
fi |
fi |
|
fi |
|
178 |
|
|
179 |
# unset them to be shure |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}" |
180 |
unset my_SRC_URI |
mdownload --uri "${uri}" --dir "${outputdir}" || die "Could not download '${uri}'" |
|
unset my_SRC_URI_DEST |
|
|
unset my_SRC_URI_MIRROR |
|
|
unset my_SOURCEDIR |
|
|
done |
|
181 |
|
|
182 |
# recheck md5 sums |
# unset them to be sure |
183 |
echo |
unset uri |
184 |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
unset subdir |
185 |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
unset outputdir |
186 |
echo |
done |
187 |
|
|
188 |
|
# recheck md5 sums after download |
189 |
|
echo |
190 |
|
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
191 |
|
mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5 || die "md5 failed" |
192 |
|
echo |
193 |
|
else |
194 |
|
echo -e "${COLBLUE}===${COLGREEN} All sources already fetched, nothing to do${COLDEFAULT}" |
195 |
|
fi |
196 |
|
|
197 |
# not needed anymore |
# not needed anymore |
198 |
unset SRC_URI |
unset SRC_URI |
199 |
} |
} |
200 |
|
|
201 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that does not exist in smage file |
202 |
src_prepare() |
src_prepare() |
203 |
{ |
{ |
204 |
echo "no src_prepare defined" |
+ echo "no src_prepare defined; doing nothing ..." |
|
sleep 2 |
|
205 |
return 0 |
return 0 |
206 |
} |
} |
207 |
|
|
208 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that does not exist in smage file |
209 |
src_compile() |
src_compile() |
210 |
{ |
{ |
211 |
echo "no src_compile defined" |
echo "no src_compile defined; doing nothing ..." |
|
sleep 2 |
|
212 |
return 0 |
return 0 |
213 |
} |
} |
214 |
|
|
215 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that does not exist in smage file |
216 |
|
src_check() |
217 |
|
{ |
218 |
|
echo "no src_check defined; doing nothing ..." |
219 |
|
return 0 |
220 |
|
} |
221 |
|
|
222 |
|
# dummy function, used if that does not exist in smage file |
223 |
src_install() |
src_install() |
224 |
{ |
{ |
225 |
echo "no src_install defined" |
echo "no src_install defined; doing nothing ..." |
|
sleep 2 |
|
226 |
return 0 |
return 0 |
227 |
} |
} |
228 |
|
|
319 |
popd > /dev/null |
popd > /dev/null |
320 |
fi |
fi |
321 |
;; |
;; |
322 |
|
xz) |
323 |
|
IFTAR="$(basename $SRCFILE .xz)" |
324 |
|
IFTAR="${IFTAR##*.}" |
325 |
|
if [[ ${IFTAR} = tar ]] |
326 |
|
then |
327 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed." |
328 |
|
else |
329 |
|
pushd ${DEST} > /dev/null |
330 |
|
xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed." |
331 |
|
popd > /dev/null |
332 |
|
fi |
333 |
|
;; |
334 |
tbz2|mpks|mpk) |
tbz2|mpks|mpk) |
335 |
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." |
336 |
;; |
;; |
337 |
tgz) |
tgz) |
338 |
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." |
339 |
;; |
;; |
340 |
|
txz|mpkzs|mpkz) |
341 |
|
tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed." |
342 |
|
;; |
343 |
rar) |
rar) |
344 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
345 |
;; |
;; |
393 |
mlibtoolize() |
mlibtoolize() |
394 |
{ |
{ |
395 |
local opts="$@" |
local opts="$@" |
396 |
[[ -z ${opts} ]] && opts="--copy --force" |
[[ -z ${opts} ]] && opts="--verbose --install --force" |
397 |
|
|
398 |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
399 |
} |
} |
409 |
minstalldocs() |
minstalldocs() |
410 |
{ |
{ |
411 |
local docfiles |
local docfiles |
412 |
|
local doc |
413 |
docfiles="$@" |
docfiles="$@" |
414 |
|
|
415 |
if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ] |
if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ] |
417 |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
418 |
fi |
fi |
419 |
|
|
420 |
local i |
for doc in ${docfiles} |
|
for i in ${docfiles} |
|
421 |
do |
do |
422 |
if [ -f ${i} ] |
if [ -f ${doc} ] |
423 |
then |
then |
424 |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
if mqueryfeature "compressdoc" |
425 |
install -m 0644 ${SRCDIR}/${i}.gz \ |
then |
426 |
${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs." |
cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}." |
427 |
|
chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "fixing permissions of ${doc}." |
428 |
|
else |
429 |
|
install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}." |
430 |
|
fi |
431 |
fi |
fi |
432 |
done |
done |
433 |
} |
} |
436 |
{ |
{ |
437 |
local stripdir="$@" |
local stripdir="$@" |
438 |
|
|
439 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
440 |
find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
[[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug" |
441 |
|
find ${stripdir} ! -type d | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null |
442 |
} |
} |
443 |
|
|
444 |
mstripbins() |
mstripbins() |
445 |
{ |
{ |
446 |
local stripdir="$@" |
local stripdir="$@" |
447 |
|
|
448 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
449 |
find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
[[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug" |
450 |
|
find ${stripdir} ! -type d | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null |
451 |
|
} |
452 |
|
|
453 |
|
mstripstatic() |
454 |
|
{ |
455 |
|
local stripdir="$@" |
456 |
|
|
457 |
|
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
458 |
|
[[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug" |
459 |
|
find ${stripdir} ! -type d | xargs file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null |
460 |
|
} |
461 |
|
|
462 |
|
mstriplibtoolarchive() |
463 |
|
{ |
464 |
|
local stripdir="$@" |
465 |
|
|
466 |
|
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
467 |
|
find ${stripdir} ! -type d -name \*.la | xargs file | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null |
468 |
|
} |
469 |
|
|
470 |
|
mpurgetargets() |
471 |
|
{ |
472 |
|
local stripdir="$@" |
473 |
|
local target |
474 |
|
|
475 |
|
[[ -z ${stripdir} ]] && stripdir=${BINDIR} |
476 |
|
# nothing to do in this case |
477 |
|
[[ -z ${PURGE_TARGETS[*]} ]] && return |
478 |
|
|
479 |
|
for target in ${PURGE_TARGETS[*]} |
480 |
|
do |
481 |
|
# check if target is a regex pattern without any slashes |
482 |
|
if [[ ${target} = ${target//\/} ]] |
483 |
|
then |
484 |
|
find ${BINDIR} -type f -name "${target}" | xargs --no-run-if-empty rm -f -- 2> /dev/null |
485 |
|
else |
486 |
|
rm -f -- ${target} 2> /dev/null |
487 |
|
fi |
488 |
|
done |
489 |
} |
} |
490 |
|
|
491 |
mcompressdocs() |
mcompressdocs() |
544 |
fi |
fi |
545 |
} |
} |
546 |
|
|
|
|
|
547 |
# fixes given dependencies to match a MAGE_TARGET |
# fixes given dependencies to match a MAGE_TARGET |
548 |
# fix_mage_deps -target s/depend # <-- note -target ! |
# fix_mage_deps -target s/depend # <-- note -target ! |
549 |
fix_mage_deps() |
fix_mage_deps() |
659 |
# now build the mage file |
# now build the mage file |
660 |
> ${dest} |
> ${dest} |
661 |
|
|
|
# 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} |
|
|
|
|
662 |
# pgkname and state |
# pgkname and state |
663 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
664 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
|
echo >> ${dest} |
|
665 |
|
|
666 |
# description and homepage |
# description and homepage |
667 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
668 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
|
echo >> ${dest} |
|
669 |
|
|
670 |
# special tags and vars |
# special tags and vars |
671 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
672 |
|
|
673 |
# echo MAGE_TARGETS ## note -target is needed ! |
# echo MAGE_TARGETS ## note -target is needed ! |
674 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
echo >> ${dest} |
|
675 |
|
|
676 |
# split package base |
# split package base |
677 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
|
echo >> ${dest} |
|
678 |
|
|
679 |
# add special vars |
# add special vars |
680 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
685 |
# being tricky here :) |
# being tricky here :) |
686 |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
687 |
done |
done |
|
echo >> ${dest} |
|
688 |
fi |
fi |
689 |
|
|
690 |
# add at least all includes |
# add at least all includes |
696 |
do |
do |
697 |
echo -n " ${i}" >> ${dest} |
echo -n " ${i}" >> ${dest} |
698 |
done |
done |
699 |
echo >> ${dest} |
# a CRLF is needed here! |
700 |
|
echo >> ${dest} |
701 |
fi |
fi |
|
echo >> ${dest} |
|
702 |
|
|
703 |
# deps and provides |
# deps and provides |
704 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
705 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
706 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
|
echo >> ${dest} |
|
707 |
|
|
708 |
# add special functions |
# add special functions |
709 |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
713 |
do |
do |
714 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
715 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
echo >> ${dest} |
|
716 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
717 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
718 |
done |
done |
|
echo >> ${dest} |
|
719 |
fi |
fi |
720 |
|
|
721 |
# pre|post-install|removes |
# pre|post-install|removes |
722 |
typeset -f preinstall >> ${dest} |
typeset -f preinstall >> ${dest} |
|
echo >> ${dest} |
|
723 |
typeset -f postinstall >> ${dest} |
typeset -f postinstall >> ${dest} |
|
echo >> ${dest} |
|
724 |
typeset -f preremove >> ${dest} |
typeset -f preremove >> ${dest} |
|
echo >> ${dest} |
|
725 |
typeset -f postremove >> ${dest} |
typeset -f postremove >> ${dest} |
|
echo >> ${dest} |
|
726 |
} |
} |
727 |
|
|
728 |
regen_mage_tree() |
regen_mage_tree() |
729 |
{ |
{ |
730 |
local i |
local subpackage |
731 |
|
|
732 |
# build them only if requested |
# build them only if requested |
733 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if mqueryfeature regentree |
734 |
then |
then |
735 |
# run it without targets |
# run it without targets |
736 |
if [[ -n ${MAGE_TARGETS} ]] |
if [[ -n ${MAGE_TARGETS} ]] |
738 |
# build for each target a mage file |
# build for each target a mage file |
739 |
# run it with several targets |
# run it with several targets |
740 |
echo |
echo |
741 |
for i in ${MAGE_TARGETS} |
for subpackage in ${MAGE_TARGETS} |
742 |
do |
do |
743 |
build_mage_script --target "${i}" |
build_mage_script --target "${subpackage}" |
744 |
done |
done |
745 |
echo |
echo |
746 |
|
|
753 |
# build for each subpackage a mage file |
# build for each subpackage a mage file |
754 |
# run it with several targets |
# run it with several targets |
755 |
echo |
echo |
756 |
for i in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
757 |
do |
do |
758 |
# get the right variables for the split |
# get the right variables for the split |
759 |
export PNAME="${i}" |
export PNAME="${subpackage}" |
760 |
split_info_${i} |
split_info_${subpackage} |
761 |
|
# get the preinstall etc |
762 |
|
split_export_inherits ${subpackage} |
763 |
build_mage_script --split-pkg-base "${split_pkg_base}" |
build_mage_script --split-pkg-base "${split_pkg_base}" |
764 |
|
# delete split preinstall etc |
765 |
|
split_delete_inherits ${subpackage} |
766 |
# restore smage environment |
# restore smage environment |
767 |
split_restore_variables |
split_restore_variables |
768 |
done |
done |
819 |
export SAVED_DEPEND="${DEPEND}" |
export SAVED_DEPEND="${DEPEND}" |
820 |
export SAVED_SDEPEND="${SDEPEND}" |
export SAVED_SDEPEND="${SDEPEND}" |
821 |
export SAVED_PROVIDE="${PROVIDE}" |
export SAVED_PROVIDE="${PROVIDE}" |
822 |
export SAVED_NOPKGBUILD="${NOPKGBUILD}" |
export SAVED_PKGTYPE="${PKGTYPE}" |
823 |
|
|
824 |
|
# special handling needed for mage features |
825 |
|
# pkgbuild |
826 |
|
mqueryfeature "pkgbuild" && export SAVED_FEATURE_PKGBUILD="pkgbuild" |
827 |
|
mqueryfeature "!pkgbuild" && export SAVED_FEATURE_PKGBUILD="!pkgbuild" |
828 |
|
# strip |
829 |
|
mqueryfeature "strip" && export SAVED_FEATURE_STRIP="strip" |
830 |
|
mqueryfeature "!strip" && export SAVED_FEATURE_STRIP="!strip" |
831 |
|
# libtool |
832 |
|
mqueryfeature "libtool" && export SAVED_FEATURE_LIBTOOL="libtool" |
833 |
|
mqueryfeature "!libtool" && export SAVED_FEATURE_LIBTOOL="!libtool" |
834 |
|
# compressdoc |
835 |
|
mqueryfeature "compressdoc" && export SAVED_FEATURE_COMPRESSDOC="compressdoc" |
836 |
|
mqueryfeature "!compressdoc" && export SAVED_FEATURE_COMPRESSDOC="!compressdoc" |
837 |
|
|
838 |
# bindir too |
# bindir too |
839 |
export SAVED_BINDIR="${BINDIR}" |
export SAVED_BINDIR="${BINDIR}" |
894 |
export DEPEND="${SAVED_DEPEND}" |
export DEPEND="${SAVED_DEPEND}" |
895 |
export SDEPEND="${SAVED_SDEPEND}" |
export SDEPEND="${SAVED_SDEPEND}" |
896 |
export PROVIDE="${SAVED_PROVIDE}" |
export PROVIDE="${SAVED_PROVIDE}" |
897 |
export NOPKGBUILD="${SAVED_NOPKGBUILD}" |
export PKGTYPE="${SAVED_PKGTYPE}" |
898 |
|
|
899 |
|
# special handling needed for mage features |
900 |
|
# pkgbuild |
901 |
|
msetfeature "${SAVED_FEATURE_PKGBUILD}" |
902 |
|
# strip |
903 |
|
msetfeature "${SAVED_FEATURE_STRIP}" |
904 |
|
# libtool |
905 |
|
msetfeature "${SAVED_FEATURE_LIBTOOL}" |
906 |
|
# compressdoc |
907 |
|
msetfeature "${SAVED_FEATURE_COMPRESSDOC}" |
908 |
|
|
909 |
# bindir too |
# bindir too |
910 |
export BINDIR="${SAVED_BINDIR}" |
export BINDIR="${SAVED_BINDIR}" |
964 |
unset SAVED_SDEPEND |
unset SAVED_SDEPEND |
965 |
unset SAVED_PROVIDE |
unset SAVED_PROVIDE |
966 |
unset SAVED_BINDIR |
unset SAVED_BINDIR |
967 |
unset SAVED_NOPKGBUILD |
unset SAVED_PKGTYPE |
968 |
|
unset SAVED_FEATURE_PKGBUILD |
969 |
|
unset SAVED_FEATURE_STRIP |
970 |
|
unset SAVED_FEATURE_LIBTOOL |
971 |
|
unset SAVED_FEATURE_COMPRESSDOC |
972 |
unset SPLIT_PACKAGE_BASE |
unset SPLIT_PACKAGE_BASE |
973 |
unset -f SAVED_preinstall |
unset -f SAVED_preinstall |
974 |
unset -f SAVED_postinstall |
unset -f SAVED_postinstall |
976 |
unset -f SAVED_postremove |
unset -f SAVED_postremove |
977 |
} |
} |
978 |
|
|
979 |
|
split_export_inherits() |
980 |
|
{ |
981 |
|
local subpackage="$1" |
982 |
|
local func |
983 |
|
local newfunc |
984 |
|
|
985 |
|
for func in preinstall postinstall preremove postremove |
986 |
|
do |
987 |
|
if [[ ! -z $(typeset -f ${func}_${subpackage}) ]] |
988 |
|
then |
989 |
|
newfunc=$(typeset -f ${func}_${subpackage}) |
990 |
|
newfunc="${newfunc/_${subpackage} (/ (}" |
991 |
|
eval "${newfunc}" |
992 |
|
fi |
993 |
|
done |
994 |
|
} |
995 |
|
|
996 |
|
split_delete_inherits() |
997 |
|
{ |
998 |
|
local subpackage="$1" |
999 |
|
local func |
1000 |
|
|
1001 |
|
for func in preinstall postinstall preremove postremove |
1002 |
|
do |
1003 |
|
if [[ ! -z $(typeset -f ${func}_${subpackage}) ]] |
1004 |
|
then |
1005 |
|
unset -f ${func} |
1006 |
|
fi |
1007 |
|
done |
1008 |
|
} |
1009 |
|
|
1010 |
export_inherits() |
export_inherits() |
1011 |
{ |
{ |
1012 |
local include="$1" |
local include="$1" |
1068 |
# fix target as it may be empty ! |
# fix target as it may be empty ! |
1069 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
1070 |
|
|
|
|
|
1071 |
# build pkgname |
# build pkgname |
1072 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
1073 |
|
|
1074 |
# build pkg-md5-sum only if requested |
# build pkg-md5-sum only if requested |
1075 |
if [[ ${REGEN_MAGE_TREE} = true ]] |
if mqueryfeature regentree |
1076 |
then |
then |
1077 |
echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}" |
echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}" |
1078 |
|
|
1127 |
|
|
1128 |
step_by_step() |
step_by_step() |
1129 |
{ |
{ |
1130 |
if [[ ${STEP_BY_STEP} = true ]] |
if mqueryfeature stepbystep |
1131 |
then |
then |
1132 |
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
1133 |
echo "Press [enter] to continue" |
echo "Press [enter] to continue" |
1147 |
exit 1 |
exit 1 |
1148 |
fi |
fi |
1149 |
|
|
1150 |
|
# load supported mage features |
1151 |
|
load_mage_features |
1152 |
|
|
1153 |
# updating smage2-scripts |
# updating smage2-scripts |
1154 |
if [[ $1 = update ]] |
if [[ $1 = update ]] |
1155 |
then |
then |
1334 |
if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ] |
if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ] |
1335 |
then |
then |
1336 |
SRCPKGTARBALL="${2}" |
SRCPKGTARBALL="${2}" |
1337 |
USE_SRC_PKG_TARBALL=true |
msetfeature "srcpkgtarball" |
1338 |
|
|
1339 |
# abort if given file is not a source pkg |
# abort if given file is not a source pkg |
1340 |
[[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file." |
[[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file." |
1378 |
# auto regen mage tree if requested |
# auto regen mage tree if requested |
1379 |
regen_mage_tree |
regen_mage_tree |
1380 |
|
|
1381 |
if [[ ${CREATE_SRC_PKG_TARBALL} = true ]] |
if mqueryfeature "srcpkg" |
1382 |
then |
then |
1383 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
1384 |
then |
then |
1388 |
fi |
fi |
1389 |
|
|
1390 |
# download sources |
# download sources |
1391 |
[[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources |
mqueryfeature "srcpkgtarball" || download_sources |
1392 |
|
|
1393 |
# fixes some issues with these functions |
# fixes some issues with these functions |
1394 |
export -f src_prepare || die "src_prepare export failed" |
export -f src_prepare || die "src_prepare export failed" |
1395 |
export -f src_compile || die "src_compile export failed" |
export -f src_compile || die "src_compile export failed" |
1396 |
|
export -f src_check || die "src_check export failed" |
1397 |
export -f src_install || die "src_install export failed" |
export -f src_install || die "src_install export failed" |
1398 |
|
|
1399 |
# fixes some compile issues |
# fixes some compile issues |
1403 |
export BINDIR="${BINDIR}" || die "BINDIR export failed" |
export BINDIR="${BINDIR}" || die "BINDIR export failed" |
1404 |
export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" |
export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" |
1405 |
|
|
|
|
|
1406 |
# setup distcc |
# setup distcc |
1407 |
# setup for distcc goes *before* ccache, so ccache comes before distcc in path |
# setup for distcc goes *before* ccache, so ccache comes before distcc in path |
1408 |
[[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment |
mqueryfeature "distcc" && setup_distcc_environment |
1409 |
|
|
1410 |
# setup ccache |
# setup ccache |
1411 |
[[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment |
mqueryfeature "ccache" && setup_ccache_environment |
|
|
|
|
# small sleep to show our settings |
|
|
sleep 1 |
|
1412 |
|
|
1413 |
# cleans up build if a previously one exists |
# clean up builddir if a previously one exist |
1414 |
if [ -d ${BUILDDIR} ] |
if [ -d ${BUILDDIR} ] |
1415 |
then |
then |
1416 |
rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." |
rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." |
1417 |
fi |
fi |
1418 |
install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." |
install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." |
1419 |
|
|
1420 |
# cleans up srcdir if a previously unpacked one exists |
# clean up srcdir if a previously unpacked one exist |
1421 |
if [ -d ${SRCDIR} ] |
if [ -d ${SRCDIR} ] |
1422 |
then |
then |
1423 |
rm -rf ${SRCDIR} |
rm -rf ${SRCDIR} |
1424 |
fi |
fi |
1425 |
|
|
1426 |
# cleans up bindir if a previous build exists or creates a new one |
# clean up bindir if a previous build exist or create a new one |
1427 |
if [ -d ${BINDIR} ] |
if [ -d ${BINDIR} ] |
1428 |
then |
then |
1429 |
rm -rf ${BINDIR} |
rm -rf ${BINDIR} |
1430 |
fi |
fi |
1431 |
install -d ${BINDIR} || die "couldn't create \$BINDIR." |
install -d ${BINDIR} || die "couldn't create \$BINDIR." |
1432 |
|
|
1433 |
# cleans up package temp dir if a previous build exists |
# clean up package temp dir if a previous build exist |
1434 |
if [ -d ${BUILDDIR}/${PKGNAME} ] |
if [ -d ${BUILDDIR}/${PKGNAME} ] |
1435 |
then |
then |
1436 |
rm -rf ${BUILDDIR}/${PKGNAME} |
rm -rf ${BUILDDIR}/${PKGNAME} |
1437 |
fi |
fi |
1438 |
|
|
1439 |
# cleans up timestamp if one exists |
# setup build logging |
|
if [ -f /var/tmp/timestamp ] |
|
|
then |
|
|
mage rmstamp |
|
|
fi |
|
|
|
|
|
# setup build loggins |
|
1440 |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1441 |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1442 |
|
|
1448 |
die_pipestatus 0 "src_compile failed" |
die_pipestatus 0 "src_compile failed" |
1449 |
step_by_step $_ |
step_by_step $_ |
1450 |
|
|
1451 |
|
# only run checks if requested |
1452 |
|
if mqueryfeature "!check" |
1453 |
|
then |
1454 |
|
echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} |
1455 |
|
step_by_step src_check |
1456 |
|
else |
1457 |
|
src_check | ${SMAGE_LOG_CMD} |
1458 |
|
die_pipestatus 0 "src_check failed" |
1459 |
|
step_by_step $_ |
1460 |
|
fi |
1461 |
|
|
1462 |
# build several subpackages |
# build several subpackages |
1463 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1464 |
then |
then |
1496 |
step_by_step $_ |
step_by_step $_ |
1497 |
fi |
fi |
1498 |
|
|
1499 |
# compressing doc, info & man files |
if mqueryfeature "!compressdoc" |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
|
1500 |
then |
then |
1501 |
for subpackage in ${SPLIT_PACKAGES} |
echo -e "!compressdoc detected; documentation will not be compressed ..." |
|
do |
|
|
mcompressdocs ${BINDIR}_${subpackage} |
|
|
done |
|
1502 |
else |
else |
1503 |
mcompressdocs ${BINDIR} |
# compressing doc, info & man files |
1504 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1505 |
|
then |
1506 |
|
for subpackage in ${SPLIT_PACKAGES} |
1507 |
|
do |
1508 |
|
mcompressdocs ${BINDIR}_${subpackage} |
1509 |
|
done |
1510 |
|
else |
1511 |
|
mcompressdocs ${BINDIR} |
1512 |
|
fi |
1513 |
|
fi |
1514 |
|
|
1515 |
|
if mqueryfeature "!libtool" |
1516 |
|
then |
1517 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1518 |
|
then |
1519 |
|
for subpackage in ${SPLIT_PACKAGES} |
1520 |
|
do |
1521 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" |
1522 |
|
mstriplibtoolarchive ${BINDIR}_${subpackage} |
1523 |
|
done |
1524 |
|
else |
1525 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
1526 |
|
mstriplibtoolarchive ${BINDIR} |
1527 |
|
fi |
1528 |
fi |
fi |
1529 |
|
|
1530 |
|
if mqueryfeature "purge" |
1531 |
|
then |
1532 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1533 |
|
then |
1534 |
|
for subpackage in ${SPLIT_PACKAGES} |
1535 |
|
do |
1536 |
|
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" |
1537 |
|
mpurgetargets ${BINDIR}_${subpackage} |
1538 |
|
done |
1539 |
|
else |
1540 |
|
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
1541 |
|
mpurgetargets ${BINDIR} |
1542 |
|
fi |
1543 |
|
fi |
1544 |
|
|
1545 |
# stripping all bins and libs |
# stripping all bins and libs |
1546 |
case ${NOSTRIP} in |
if mqueryfeature "!strip" |
1547 |
true|TRUE|yes|y) |
then |
1548 |
echo -e "NOSTRIP=true detected; Package will not be stripped ..." |
echo -e "!strip detected; Package will not be stripped ..." |
1549 |
;; |
else |
|
*) |
|
1550 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1551 |
then |
then |
1552 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1553 |
do |
do |
1554 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1555 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1556 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
1557 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1558 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
1559 |
|
mstripstatic ${BINDIR}_${subpackage} |
1560 |
done |
done |
1561 |
else |
else |
1562 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1563 |
mstripbins ${BINDIR} |
mstripbins ${BINDIR} |
1564 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
1565 |
mstriplibs ${BINDIR} |
mstriplibs ${BINDIR} |
1566 |
|
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
1567 |
|
mstripstatic ${BINDIR} |
1568 |
fi |
fi |
1569 |
;; |
fi |
|
esac |
|
1570 |
|
|
1571 |
# the new buildpkg command |
if mqueryfeature "!buildpkg" |
1572 |
case ${NOPKGBUILD} in |
then |
1573 |
true|TRUE|yes|y) |
echo -e "!buildpkg detected; Package will not be build ..." |
1574 |
echo -e "NOPGKBUILD=true detected; Package will not be build ..." |
else |
|
;; |
|
|
*) |
|
1575 |
# build several targets |
# build several targets |
1576 |
if [[ -n ${MAGE_TARGETS} ]] |
if [[ -n ${MAGE_TARGETS} ]] |
1577 |
then |
then |
1578 |
for target in ${MAGE_TARGETS} |
for target in ${MAGE_TARGETS} |
1579 |
do |
do |
1580 |
# check if an special target_pkgbuild exists |
# check if a special target_pkgbuild exists |
1581 |
if typeset -f ${target}_pkgbuild > /dev/null |
if typeset -f ${target}_pkgbuild > /dev/null |
1582 |
then |
then |
1583 |
# run it |
# run it |
1610 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
1611 |
split_info_${PNAME} |
split_info_${PNAME} |
1612 |
|
|
1613 |
# jump to next one if NOPKGBUILD is set in split_info |
# jump to next one if !buildpkg is set in split_info |
1614 |
case ${NOPKGBUILD} in |
mqueryfeature "!buildpkg" && continue |
|
true|TRUE|yes|y) continue ;; |
|
|
esac |
|
1615 |
|
|
1616 |
# check if an special subpackage_pkgbuild exists |
# check if an special subpackage_pkgbuild exists |
1617 |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
1655 |
fi |
fi |
1656 |
|
|
1657 |
# build src-pkg-tarball if requested |
# build src-pkg-tarball if requested |
1658 |
[[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME} |
mqueryfeature "srcpkg" && source_pkg_build ${SMAGENAME} |
1659 |
;; |
fi |
|
esac |
|
1660 |
|
|
1661 |
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
if mqueryfeature "buildlog" |
1662 |
then |
then |
1663 |
bzip2 -9f /var/log/smage/${PKGNAME}.log |
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1664 |
else |
else |
1665 |
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1666 |
fi |
fi |
1667 |
|
|
|
# for sure |
|
|
unset NOPKGBUILD |
|
|
unset NOSTRIP |
|
|
|
|
1668 |
xtitleclean |
xtitleclean |