177 |
fi |
fi |
178 |
|
|
179 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}" |
180 |
mdownload --uri "${uri}" --dir "${outputdir}" || die "Could not download '${uri}'" |
# do not die here, mchecksum catches download errors |
181 |
|
mdownload --uri "${uri}" --dir "${outputdir}" |
182 |
|
|
183 |
# unset them to be sure |
# unset them to be sure |
184 |
unset uri |
unset uri |
202 |
# dummy function, used if that does not exist in smage file |
# dummy function, used if that does not exist in smage file |
203 |
src_prepare() |
src_prepare() |
204 |
{ |
{ |
205 |
+ echo "no src_prepare defined; doing nothing ..." |
echo "no src_prepare defined; doing nothing ..." |
206 |
return 0 |
return 0 |
207 |
} |
} |
208 |
|
|
237 |
|
|
238 |
mconfigure() |
mconfigure() |
239 |
{ |
{ |
240 |
|
local myopts |
241 |
|
if [[ ! -z ${CTARGET} ]] |
242 |
|
then |
243 |
|
myopts="--target=${CTARGET}" |
244 |
|
fi |
245 |
|
|
246 |
if [ -x ./configure ] |
if [ -x ./configure ] |
247 |
then |
then |
248 |
./configure \ |
./configure \ |
255 |
--sysconfdir=/etc \ |
--sysconfdir=/etc \ |
256 |
--localstatedir=/var/lib \ |
--localstatedir=/var/lib \ |
257 |
--libdir=/usr/$(mlibdir) \ |
--libdir=/usr/$(mlibdir) \ |
258 |
|
${myopts} \ |
259 |
"$@" || die "mconfigure failed" |
"$@" || die "mconfigure failed" |
260 |
else |
else |
261 |
echo "configure is not an executable ..." |
echo "configure is not an executable ..." |
351 |
rar) |
rar) |
352 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
353 |
;; |
;; |
354 |
zip|xpi) |
zip|xpi|jar) |
355 |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
356 |
;; |
;; |
357 |
rpm) |
rpm) |
431 |
then |
then |
432 |
if mqueryfeature "compressdoc" |
if mqueryfeature "compressdoc" |
433 |
then |
then |
434 |
cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}." |
cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "gzipping +installing ${doc}." |
435 |
chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "fixing permissions of ${doc}." |
chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "fixing permissions of ${doc}." |
436 |
else |
else |
437 |
install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}." |
install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}." |
438 |
fi |
fi |
472 |
local stripdir="$@" |
local stripdir="$@" |
473 |
|
|
474 |
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
[[ -z ${stripdir} ]] && stripdir="${BINDIR}" |
475 |
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 |
find ${stripdir} ! -type d -name \*.la | xargs | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null |
476 |
} |
} |
477 |
|
|
478 |
mpurgetargets() |
mpurgetargets() |
801 |
unset STATE |
unset STATE |
802 |
unset DESCRIPTION |
unset DESCRIPTION |
803 |
unset HOMEPAGE |
unset HOMEPAGE |
804 |
unset PKGTYPE |
# unset PKGTYPE <-- don't do that either; smage needs this var |
805 |
unset INHERITS |
unset INHERITS |
806 |
unset DEPEND |
unset DEPEND |
807 |
unset SDEPEND |
unset SDEPEND |
906 |
|
|
907 |
# special handling needed for mage features |
# special handling needed for mage features |
908 |
# pkgbuild |
# pkgbuild |
909 |
msetfeature "${SAVED_FEATURE_PKGBUILD}" |
FVERBOSE=off msetfeature "${SAVED_FEATURE_PKGBUILD}" |
910 |
# strip |
# strip |
911 |
msetfeature "${SAVED_FEATURE_STRIP}" |
FVERBOSE=off msetfeature "${SAVED_FEATURE_STRIP}" |
912 |
# libtool |
# libtool |
913 |
msetfeature "${SAVED_FEATURE_LIBTOOL}" |
FVERBOSE=off msetfeature "${SAVED_FEATURE_LIBTOOL}" |
914 |
# compressdoc |
# compressdoc |
915 |
msetfeature "${SAVED_FEATURE_COMPRESSDOC}" |
FVERBOSE=off msetfeature "${SAVED_FEATURE_COMPRESSDOC}" |
916 |
|
|
917 |
# bindir too |
# bindir too |
918 |
export BINDIR="${SAVED_BINDIR}" |
export BINDIR="${SAVED_BINDIR}" |
1448 |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1449 |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1450 |
|
|
1451 |
src_prepare | ${SMAGE_LOG_CMD} |
if [[ ${PKGTYPE} = virtual ]] |
|
die_pipestatus 0 "src_prepare failed" |
|
|
step_by_step $_ |
|
|
|
|
|
src_compile | ${SMAGE_LOG_CMD} |
|
|
die_pipestatus 0 "src_compile failed" |
|
|
step_by_step $_ |
|
|
|
|
|
# only run checks if requested |
|
|
if mqueryfeature "!check" |
|
1452 |
then |
then |
1453 |
echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} |
echo "virtual package detected; nothing will be build ..." |
1454 |
step_by_step src_check |
# automatically set !pkgbuild here too |
1455 |
|
msetfeature "!pkgbuild" |
1456 |
else |
else |
1457 |
src_check | ${SMAGE_LOG_CMD} |
src_prepare | ${SMAGE_LOG_CMD} |
1458 |
die_pipestatus 0 "src_check failed" |
die_pipestatus 0 "src_prepare failed" |
1459 |
step_by_step $_ |
step_by_step $_ |
|
fi |
|
1460 |
|
|
1461 |
# build several subpackages |
src_compile | ${SMAGE_LOG_CMD} |
1462 |
if [[ -n ${SPLIT_PACKAGES} ]] |
die_pipestatus 0 "src_compile failed" |
|
then |
|
|
# save bindir & pname |
|
|
split_save_variables |
|
|
export SAVED_BINDIR="${BINDIR}" |
|
|
for subpackage in ${SPLIT_PACKAGES} |
|
|
do |
|
|
if typeset -f src_install_${subpackage} > /dev/null |
|
|
then |
|
|
# export subpackage bindir |
|
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
|
|
# export PNAME, several internal function and include |
|
|
# rely on this variable |
|
|
export PNAME="${subpackage}" |
|
|
|
|
|
echo |
|
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
|
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
|
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
|
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
|
|
|
|
|
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
|
|
die_pipestatus 0 "src_install_${subpackage} failed" |
|
|
step_by_step $_ |
|
|
fi |
|
|
done |
|
|
# restore bindir & pname |
|
|
split_restore_variables |
|
|
# unset all saved smage variables |
|
|
split_unset_variables |
|
|
else |
|
|
src_install | ${SMAGE_LOG_CMD} |
|
|
die_pipestatus 0 "src_install failed" |
|
1463 |
step_by_step $_ |
step_by_step $_ |
1464 |
|
|
1465 |
|
# only run checks if requested |
1466 |
|
if mqueryfeature "!check" |
1467 |
|
then |
1468 |
|
echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} |
1469 |
|
step_by_step src_check |
1470 |
|
else |
1471 |
|
src_check | ${SMAGE_LOG_CMD} |
1472 |
|
die_pipestatus 0 "src_check failed" |
1473 |
|
step_by_step $_ |
1474 |
|
fi |
1475 |
|
|
1476 |
|
# build several subpackages |
1477 |
|
if [[ -n ${SPLIT_PACKAGES} ]] |
1478 |
|
then |
1479 |
|
# save bindir & pname |
1480 |
|
split_save_variables |
1481 |
|
export SAVED_BINDIR="${BINDIR}" |
1482 |
|
for subpackage in ${SPLIT_PACKAGES} |
1483 |
|
do |
1484 |
|
if typeset -f src_install_${subpackage} > /dev/null |
1485 |
|
then |
1486 |
|
# export subpackage bindir |
1487 |
|
export BINDIR="${SAVED_BINDIR}_${subpackage}" |
1488 |
|
# export PNAME, several internal function and include |
1489 |
|
# rely on this variable |
1490 |
|
export PNAME="${subpackage}" |
1491 |
|
|
1492 |
|
echo |
1493 |
|
echo -en "${COLBLUE}*** ${COLDEFAULT}" |
1494 |
|
echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
1495 |
|
echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
1496 |
|
echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
1497 |
|
|
1498 |
|
src_install_${subpackage} | ${SMAGE_LOG_CMD} |
1499 |
|
die_pipestatus 0 "src_install_${subpackage} failed" |
1500 |
|
step_by_step $_ |
1501 |
|
fi |
1502 |
|
done |
1503 |
|
# restore bindir & pname |
1504 |
|
split_restore_variables |
1505 |
|
# unset all saved smage variables |
1506 |
|
split_unset_variables |
1507 |
|
else |
1508 |
|
src_install | ${SMAGE_LOG_CMD} |
1509 |
|
die_pipestatus 0 "src_install failed" |
1510 |
|
step_by_step $_ |
1511 |
|
fi |
1512 |
fi |
fi |
1513 |
|
|
1514 |
|
# echo for sake of good-looking |
1515 |
|
echo |
1516 |
|
|
1517 |
if mqueryfeature "!compressdoc" |
if mqueryfeature "!compressdoc" |
1518 |
then |
then |
1519 |
echo -e "!compressdoc detected; documentation will not be compressed ..." |
echo -e "!compressdoc detected; documentation will not be compressed ..." |
1520 |
|
elif mqueryfeature "!pkgbuild" |
1521 |
|
then |
1522 |
|
echo "!pkgbuild detected; skipping documentation compression..." |
1523 |
else |
else |
1524 |
# compressing doc, info & man files |
# compressing doc, info & man files |
1525 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1535 |
|
|
1536 |
if mqueryfeature "!libtool" |
if mqueryfeature "!libtool" |
1537 |
then |
then |
1538 |
|
if mqueryfeature "!pkgbuild" |
1539 |
|
then |
1540 |
|
echo "!pkgbuild detected; skipping libtool archive stripping ..." |
1541 |
|
else |
1542 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1543 |
then |
then |
1544 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1550 |
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
1551 |
mstriplibtoolarchive ${BINDIR} |
mstriplibtoolarchive ${BINDIR} |
1552 |
fi |
fi |
1553 |
|
fi |
1554 |
fi |
fi |
1555 |
|
|
1556 |
if mqueryfeature "purge" |
if mqueryfeature "purge" |
1557 |
then |
then |
1558 |
|
if mqueryfeature "!pkgbuild" |
1559 |
|
then |
1560 |
|
echo "!pkgbuild detected; skipping file purgation..." |
1561 |
|
else |
1562 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1563 |
then |
then |
1564 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1570 |
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
1571 |
mpurgetargets ${BINDIR} |
mpurgetargets ${BINDIR} |
1572 |
fi |
fi |
1573 |
|
fi |
1574 |
fi |
fi |
1575 |
|
|
1576 |
# stripping all bins and libs |
# stripping all bins and libs |
1577 |
if mqueryfeature "!strip" |
if mqueryfeature "!strip" |
1578 |
then |
then |
1579 |
echo -e "!strip detected; Package will not be stripped ..." |
echo -e "!strip detected; Package will not be stripped ..." |
1580 |
|
elif mqueryfeature "!pkgbuild" |
1581 |
|
then |
1582 |
|
echo "!pkgbuild detected; skipping stripping of the package ..." |
1583 |
else |
else |
1584 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1585 |
then |
then |
1586 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1587 |
do |
do |
1588 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1589 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1590 |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
1591 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1592 |
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
1593 |
mstripstatic ${BINDIR}_${subpackage} |
mstripstatic ${BINDIR}_${subpackage} |
1594 |
done |
done |
1595 |
else |
else |
1596 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
1597 |
mstripbins ${BINDIR} |
mstripbins ${BINDIR} |
1598 |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
1599 |
mstriplibs ${BINDIR} |
mstriplibs ${BINDIR} |
1600 |
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
1601 |
mstripstatic ${BINDIR} |
mstripstatic ${BINDIR} |
1602 |
fi |
fi |
1603 |
fi |
fi |
1604 |
|
|
1605 |
if mqueryfeature "!buildpkg" |
if mqueryfeature "!pkgbuild" |
1606 |
then |
then |
1607 |
echo -e "!buildpkg detected; Package will not be build ..." |
echo -e "!pkgbuild detected; Package will not be build ..." |
1608 |
else |
else |
1609 |
# build several targets |
# build several targets |
1610 |
if [[ -n ${MAGE_TARGETS} ]] |
if [[ -n ${MAGE_TARGETS} ]] |
1644 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
1645 |
split_info_${PNAME} |
split_info_${PNAME} |
1646 |
|
|
1647 |
# jump to next one if !buildpkg is set in split_info |
# jump to next one if !pkgbuild is set in split_info |
1648 |
mqueryfeature "!buildpkg" && continue |
mqueryfeature "!pkgbuild" && continue |
1649 |
|
|
1650 |
# check if an special subpackage_pkgbuild exists |
# check if an special subpackage_pkgbuild exists |
1651 |
if typeset -f ${PNAME}_pkgbuild > /dev/null |
if typeset -f ${PNAME}_pkgbuild > /dev/null |