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.40 2005-12-26 23:16:38 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.44 2006-07-17 20:52:38 niro Exp $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
14 |
PKGSUFFIX="mpk" |
PKGSUFFIX="mpk" |
15 |
SMAGENAME="$1" |
SMAGENAME="$1" |
16 |
SMAGESUFFIX="smage2" |
SMAGESUFFIX="smage2" |
|
#SOURCEDIR="/bootstrap/sources" |
|
|
#SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts" |
|
|
#SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts" |
|
17 |
MLIBDIR=/usr/lib/mage |
MLIBDIR=/usr/lib/mage |
18 |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
19 |
|
|
20 |
|
## only for tests -> normally in /etc/rc.d/init.d/functions |
21 |
|
COLRED="\033[1;6m\033[31m" |
22 |
|
COLGREEN="\033[1;6m\033[32m" |
23 |
|
COLYELLOW="\033[1;6m\033[33m" |
24 |
|
COLBLUE="\033[1;6m\033[34m" |
25 |
|
COLMAGENTA="\033[1;6m\033[35m" |
26 |
|
COLWHITE="\033[1;6m\033[37m" |
27 |
|
COLGRAY="\033[0;6m\033[37m" |
28 |
|
COLBOLD="\033[1m" |
29 |
|
COLDEFAULT="\033[0m" |
30 |
|
|
31 |
|
if [[ ${NOCOLORS} = true ]] |
32 |
|
then |
33 |
|
COLRED="" |
34 |
|
COLGREEN="" |
35 |
|
COLYELLOW="" |
36 |
|
COLBLUE="" |
37 |
|
COLMAGENTA="" |
38 |
|
COLWHITE="" |
39 |
|
COLGRAY="" |
40 |
|
COLBOLD="" |
41 |
|
COLDEFAULT="" |
42 |
|
fi |
43 |
|
|
44 |
# export default C locale |
# export default C locale |
45 |
export LC_ALL=C |
export LC_ALL=C |
46 |
|
|
47 |
source /etc/mage.rc |
source /etc/mage.rc |
48 |
|
|
49 |
|
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
50 |
|
if [[ -n ${MROOT} ]] |
51 |
|
then |
52 |
|
export PKGDIR=${MROOT}/${PKGDIR} |
53 |
|
export BUILDDIR=${MROOT}/${BUILDDIR} |
54 |
|
export BINDIR=${MROOT}/${BINDIR} |
55 |
|
fi |
56 |
|
|
57 |
showversion() |
showversion() |
58 |
{ |
{ |
59 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
91 |
local i |
local i |
92 |
for i in ${SMAGE2RSYNC} |
for i in ${SMAGE2RSYNC} |
93 |
do |
do |
94 |
rsync \ |
rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR} |
|
--recursive \ |
|
|
--links \ |
|
|
--perms \ |
|
|
--times \ |
|
|
--devices \ |
|
|
--timeout=600 \ |
|
|
--verbose \ |
|
|
--compress \ |
|
|
--progress \ |
|
|
--stats \ |
|
|
--delete \ |
|
|
--delete-after \ |
|
|
${i} ${SMAGESCRIPTSDIR} |
|
|
|
|
95 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
96 |
then |
then |
97 |
break |
break |
98 |
else |
else |
99 |
continue |
continue |
100 |
fi |
fi |
|
|
|
101 |
done |
done |
102 |
|
|
103 |
# clean up backup files (foo~) |
# clean up backup files (foo~) |
172 |
do |
do |
173 |
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")" |
my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")" |
174 |
|
|
|
#echo "DEBUG: ${MY_SRC_URI}" |
|
175 |
if [[ ${FETCHING} = true ]] |
if [[ ${FETCHING} = true ]] |
176 |
then |
then |
177 |
echo "==> fetching ${my_SRC_URI_MIRROR}" |
echo "==> fetching ${my_SRC_URI_MIRROR}" |
191 |
fi |
fi |
192 |
done |
done |
193 |
else |
else |
|
#echo "DEBUG: ${SRC_URI[${i}]}" |
|
194 |
if [[ ${FETCHING} = true ]] |
if [[ ${FETCHING} = true ]] |
195 |
then |
then |
196 |
echo "==> fetching ${my_SRC_URI}" |
echo "==> fetching ${my_SRC_URI}" |
201 |
--progress bar \ |
--progress bar \ |
202 |
--directory-prefix="${my_SOURCEDIR}" \ |
--directory-prefix="${my_SOURCEDIR}" \ |
203 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
|
# only needed to run through a list of mirrors |
|
|
# if [ "$?" == "0" ] |
|
|
# then |
|
|
# break |
|
|
# else |
|
|
# continue |
|
|
# fi |
|
204 |
fi |
fi |
205 |
fi |
fi |
206 |
|
|
245 |
return 0 |
return 0 |
246 |
} |
} |
247 |
|
|
248 |
|
mlibdir() |
249 |
|
{ |
250 |
|
local libdir=lib |
251 |
|
[[ ${ARCH} = x86_64 ]] && libdir=lib64 |
252 |
|
|
253 |
|
echo "${libdir}" |
254 |
|
} |
255 |
|
|
256 |
mconfigure() |
mconfigure() |
257 |
{ |
{ |
258 |
if [ -x ./configure ] |
if [ -x ./configure ] |
265 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
266 |
--sysconfdir=/etc \ |
--sysconfdir=/etc \ |
267 |
--localstatedir=/var/lib \ |
--localstatedir=/var/lib \ |
268 |
|
--libdir=/usr/$(mlibdir) \ |
269 |
"$@" || die "mconfigure failed" |
"$@" || die "mconfigure failed" |
270 |
else |
else |
271 |
echo "configure is not an executable ..." |
echo "configure is not an executable ..." |
283 |
localstatedir=${BINDIR}/var/lib \ |
localstatedir=${BINDIR}/var/lib \ |
284 |
mandir=${BINDIR}/usr/share/man \ |
mandir=${BINDIR}/usr/share/man \ |
285 |
sysconfdir=${BINDIR}/etc \ |
sysconfdir=${BINDIR}/etc \ |
286 |
|
libdir=${BINDIR}/usr/$(mlibdir) \ |
287 |
"$@" install || die "minstall failed" |
"$@" install || die "minstall failed" |
288 |
else |
else |
289 |
die "no Makefile found" |
die "no Makefile found" |
347 |
PATCHOPTS=$1 |
PATCHOPTS=$1 |
348 |
PATCHFILE=$2 |
PATCHFILE=$2 |
349 |
|
|
350 |
|
echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}" |
351 |
patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} |
patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} |
352 |
} |
} |
353 |
|
|
406 |
if [ -x /usr/bin/distcc ] |
if [ -x /usr/bin/distcc ] |
407 |
then |
then |
408 |
echo "Using DistCC for compilation ..." |
echo "Using DistCC for compilation ..." |
409 |
export PATH=/usr/lib/distcc/bin:${PATH} || die "distcc: could not export new $PATH" |
export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH" |
|
|
|
|
# export distcc as compiler |
|
|
# export CC="distcc" |
|
|
# export CXX=distcc |
|
410 |
|
|
411 |
export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed" |
export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed" |
412 |
|
|
|
# ccache + distcc together |
|
|
if [[ ${SMAGE_USE_CCACHE} = true ]] |
|
|
then |
|
|
if [ -x /usr/bin/ccache ] |
|
|
then |
|
|
echo "Preparing DistCC to work together with CCache ..." |
|
|
#export CCACHE_PREFIX="distcc" || die "distcc: could not set ccach_prefix" |
|
|
# export CC="ccache distcc" |
|
|
# export CXX="ccache distcc" |
|
|
fi |
|
|
fi |
|
|
|
|
413 |
# creating distcc tempdir |
# creating distcc tempdir |
414 |
install -o distcc -g daemon -d ${DISTCC_DIR} |
install -o distcc -g daemon -d ${DISTCC_DIR} |
415 |
chmod 1777 ${DISTCC_DIR} |
chmod 1777 ${DISTCC_DIR} |
421 |
if [ -x /usr/bin/ccache ] |
if [ -x /usr/bin/ccache ] |
422 |
then |
then |
423 |
echo "Using CCache for compilation ..." |
echo "Using CCache for compilation ..." |
424 |
export PATH=/usr/lib/ccache/bin:${PATH} || die "ccache: could not export new $PATH" |
export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH" |
|
#unset CC CXX |
|
425 |
fi |
fi |
426 |
} |
} |
427 |
|
|
532 |
> ${dest} |
> ${dest} |
533 |
|
|
534 |
# header |
# header |
535 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.40 2005-12-26 23:16:38 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.44 2006-07-17 20:52:38 niro Exp $' >> ${dest} |
536 |
echo >> ${dest} |
echo >> ${dest} |
537 |
|
|
538 |
# pgkname and state |
# pgkname and state |
923 |
|
|
924 |
|
|
925 |
# setup distcc |
# setup distcc |
926 |
# distcc mus be setup *before* ccache, as ccache need to be before distcc in path |
# setup for distcc goes *before* ccache, so ccache comes before distcc in path |
927 |
[[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment |
[[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment |
928 |
|
|
929 |
# setup ccache |
# setup ccache |
932 |
# small sleep to show our settings |
# small sleep to show our settings |
933 |
sleep 1 |
sleep 1 |
934 |
|
|
|
#debug |
|
|
#echo "CC=${CC}" |
|
|
#echo "CXX=${CXX}" |
|
|
#echo "DISTCC_DIR=${DISTCC_DIR}" |
|
|
#echo "PATH: ${PATH}" |
|
|
#echo "--------------------------------------" |
|
|
#env |
|
|
#echo "--------------------------------------" |
|
|
#read |
|
|
#debug end |
|
|
|
|
935 |
# cleans up build if a previously one exists |
# cleans up build if a previously one exists |
936 |
if [ -d ${BUILDDIR} ] |
if [ -d ${BUILDDIR} ] |
937 |
then |
then |
1047 |
# for sure |
# for sure |
1048 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1049 |
unset NOSTRIP |
unset NOSTRIP |
1050 |
|
|
1051 |
xtitleclean |
xtitleclean |
|
#echo -e "\nPackage ${PKGNAME} successfully builded.\n" |
|