4 |
# needs pkgbuild_dir (mage) |
# needs pkgbuild_dir (mage) |
5 |
|
|
6 |
# SMAGE2 |
# SMAGE2 |
7 |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.10 2005-06-01 15:49:20 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
11 |
# added distcc support |
# added distcc support |
12 |
|
|
13 |
## setup ## |
## setup ## |
|
SMAGEVERSION=0.3.6-r15 |
|
14 |
PKGSUFFIX="mpk" |
PKGSUFFIX="mpk" |
15 |
SMAGENAME="$1" |
SMAGENAME="$1" |
16 |
SMAGESUFFIX="smage2" |
SMAGESUFFIX="smage2" |
18 |
#SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts" |
#SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts" |
19 |
#SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts" |
#SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts" |
20 |
MLIBDIR=/usr/lib/mage |
MLIBDIR=/usr/lib/mage |
21 |
|
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
22 |
|
|
23 |
|
# export default C locale |
24 |
|
export LC_ALL=C |
25 |
|
|
26 |
source /etc/mage.rc |
source /etc/mage.rc |
27 |
|
|
182 |
--progress bar \ |
--progress bar \ |
183 |
--directory-prefix="${my_SOURCEDIR}" \ |
--directory-prefix="${my_SOURCEDIR}" \ |
184 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
185 |
if [ "$?" == "0" ] |
# only needed to run through a list of mirrors |
186 |
then |
# if [ "$?" == "0" ] |
187 |
break |
# then |
188 |
else |
# break |
189 |
continue |
# else |
190 |
fi |
# continue |
191 |
|
# fi |
192 |
fi |
fi |
193 |
fi |
fi |
194 |
|
|
357 |
find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null |
358 |
} |
} |
359 |
|
|
360 |
|
sminclude() { |
361 |
|
local i |
362 |
|
|
363 |
|
if [[ -n "$@" ]] |
364 |
|
then |
365 |
|
for i in $@ |
366 |
|
do |
367 |
|
echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc" |
368 |
|
source ${SMAGESCRIPTSDIR}/include/${i}.sminc |
369 |
|
done |
370 |
|
echo |
371 |
|
fi |
372 |
|
} |
373 |
|
|
374 |
setup_distcc_environment(){ |
setup_distcc_environment(){ |
375 |
if [ -x /usr/bin/distcc ] |
if [ -x /usr/bin/distcc ] |
376 |
then |
then |
411 |
fi |
fi |
412 |
} |
} |
413 |
|
|
414 |
|
# alx_create_mage_file: helper functions for regen_mage_tree() |
415 |
|
# generates an mage file with given information in smage file |
416 |
|
# needs at least: |
417 |
|
# PNAME name of pkg |
418 |
|
# PVER version |
419 |
|
# PBUILD revision |
420 |
|
# PCATEGORIE categorie of the pkg |
421 |
|
# STATE state of pkg stable|unstable|old |
422 |
|
# DESCRIPTION va short description (opt) |
423 |
|
# HOMEPAGE homepage (opt) |
424 |
|
# DEPEND runtime dependencies (opt) |
425 |
|
# SDEPEND add. needed deps to build the pkg (opt) |
426 |
|
# PROVIDE provides a virtual (opt) |
427 |
|
# |
428 |
|
# special tags: |
429 |
|
# PKGTYPE type of pkg |
430 |
|
# INHERITS which functions get included |
431 |
|
# SPECIAL_FUNCTIONS special functions wich should also be added |
432 |
|
# warning: they get killed before the build starts ! |
433 |
|
# |
434 |
|
# MAGE_TREE_DEST target destination of the generated tree |
435 |
|
# REGEN_MAGE_TREE set to 'true' to enable this |
436 |
|
alx_create_mage_file() |
437 |
|
{ |
438 |
|
local magefile |
439 |
|
local dest |
440 |
|
local suffix |
441 |
|
local sym |
442 |
|
local depname |
443 |
|
|
444 |
|
# if MAGE_TREE_DEST not set use BUILDDIR |
445 |
|
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
446 |
|
|
447 |
|
# determinate which suffix this mage file should get, if any |
448 |
|
suffix="$1" |
449 |
|
|
450 |
|
# name of magefile |
451 |
|
magefile="${PNAME}${suffix}-${PVER}-${PBUILD}.mage" |
452 |
|
|
453 |
|
# destination to magefile |
454 |
|
dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${suffix}/${magefile}" |
455 |
|
|
456 |
|
# show what we are doing |
457 |
|
echo "Generating Mage file:" |
458 |
|
echo " ${dest}" |
459 |
|
|
460 |
|
install -d "$(dirname ${dest})" |
461 |
|
# now build the mage file |
462 |
|
> ${dest} |
463 |
|
|
464 |
|
# header |
465 |
|
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.22 2005-08-19 02:24:12 niro Exp $' >> ${dest} |
466 |
|
echo >> ${dest} |
467 |
|
|
468 |
|
# pgkname and state |
469 |
|
echo "PKGNAME=\"${PNAME}${suffix}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
470 |
|
echo "STATE=\"${STATE}\"" >> ${dest} |
471 |
|
echo >> ${dest} |
472 |
|
|
473 |
|
# description and homepage |
474 |
|
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
475 |
|
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
476 |
|
echo >> ${dest} |
477 |
|
|
478 |
|
# special tags |
479 |
|
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
480 |
|
if [ -n "${INHERITS}" ] |
481 |
|
then |
482 |
|
echo -n "minclude" >> ${dest} |
483 |
|
local i |
484 |
|
for i in ${INHERITS} |
485 |
|
do |
486 |
|
echo -n " ${i}" >> ${dest} |
487 |
|
done |
488 |
|
echo >> ${dest} |
489 |
|
fi |
490 |
|
echo >> ${dest} |
491 |
|
|
492 |
|
# deps and provides |
493 |
|
echo "DEPEND=\"${DEPEND}\"" >> ${dest} |
494 |
|
echo "SDEPEND=\"${SDEPEND}\"" >> ${dest} |
495 |
|
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
496 |
|
echo >> ${dest} |
497 |
|
|
498 |
|
# add special functions |
499 |
|
if [ -n "${SPECIAL_FUNCTIONS}" ] |
500 |
|
then |
501 |
|
local i |
502 |
|
for i in ${SPECIAL_FUNCTIONS} |
503 |
|
do |
504 |
|
# add to mage (quotes needed !) |
505 |
|
typeset -f "${i}" >> ${dest} |
506 |
|
# unset to be safe (quotes needed !) |
507 |
|
unset "${i}" |
508 |
|
done |
509 |
|
fi |
510 |
|
|
511 |
|
# pre|post-install|removes |
512 |
|
typeset -f preinstall >> ${dest} |
513 |
|
echo >> ${dest} |
514 |
|
typeset -f postinstall >> ${dest} |
515 |
|
echo >> ${dest} |
516 |
|
typeset -f preremove >> ${dest} |
517 |
|
echo >> ${dest} |
518 |
|
typeset -f postremove >> ${dest} |
519 |
|
echo >> ${dest} |
520 |
|
} |
521 |
|
|
522 |
|
regen_mage_tree() |
523 |
|
{ |
524 |
|
local i |
525 |
|
|
526 |
|
# build them only if requested |
527 |
|
if [[ ${REGEN_MAGE_TREE} = true ]] |
528 |
|
then |
529 |
|
# build for each target an mage file |
530 |
|
for i in ${MAGE_TARGETS} |
531 |
|
do |
532 |
|
echo |
533 |
|
alx_create_mage_file "${i}" |
534 |
|
echo |
535 |
|
done |
536 |
|
fi |
537 |
|
|
538 |
|
# now unset all uneeded vars to be safe |
539 |
|
unset PKGNAME |
540 |
|
unset STATE |
541 |
|
unset DESCRIPTION |
542 |
|
unset HOMEPAGE |
543 |
|
unset PKGTYPE |
544 |
|
unset INHERITS |
545 |
|
unset DEPEND |
546 |
|
unset SDEPEND |
547 |
|
unset PROVIDE |
548 |
|
unset SPECIAL_FUNCTIONS |
549 |
|
unset preinstall |
550 |
|
unset postinstall |
551 |
|
unset preremove |
552 |
|
unset postremove |
553 |
|
} |
554 |
|
|
555 |
# print out our version |
# print out our version |
556 |
showversion |
showversion |
557 |
echo |
echo |
647 |
#download sources |
#download sources |
648 |
if [ "$1" == "download" -a -n "$2" ] |
if [ "$1" == "download" -a -n "$2" ] |
649 |
then |
then |
|
showversion |
|
650 |
if [ ! -d ${SMAGESCRIPTSDIR} ] |
if [ ! -d ${SMAGESCRIPTSDIR} ] |
651 |
then |
then |
652 |
install -d ${SMAGESCRIPTSDIR} |
install -d ${SMAGESCRIPTSDIR} |
715 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
716 |
echo "Compiling ${PKGNAME}" |
echo "Compiling ${PKGNAME}" |
717 |
|
|
718 |
|
# auto regen mage tree if requested |
719 |
|
regen_mage_tree |
720 |
|
|
721 |
#download sources |
#download sources |
722 |
download_sources |
download_sources |
723 |
|
|
838 |
|
|
839 |
#for sure |
#for sure |
840 |
unset NOPKGBUILD |
unset NOPKGBUILD |
841 |
|
unset NOSTRIP |
842 |
|
|
843 |
xtitleclean |
xtitleclean |
844 |
#echo -e "\nPackage ${PKGNAME} successfully builded.\n" |
#echo -e "\nPackage ${PKGNAME} successfully builded.\n" |