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.39 2005-10-03 21:02:31 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.42 2006-03-22 17:45:49 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 |
showversion() { |
# 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() |
58 |
|
{ |
59 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
60 |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
echo -e "-- Niels Rogalla (niro@magellan-linux.de)" |
61 |
} |
} |
62 |
|
|
63 |
die() { |
die() |
64 |
|
{ |
65 |
xtitleclean |
xtitleclean |
66 |
echo "SMAGE failed: $@" |
echo "SMAGE failed: $@" |
67 |
exit 1 |
exit 1 |
68 |
} |
} |
69 |
|
|
70 |
xtitle() { |
xtitle() |
71 |
if [ ${TERM} == "xterm" ] |
{ |
72 |
|
if [[ ${TERM} = xterm ]] |
73 |
then |
then |
74 |
echo -ne "\033]0;[sMage: $@]\007" |
echo -ne "\033]0;[sMage: $@]\007" |
75 |
fi |
fi |
76 |
return 0 |
return 0 |
77 |
} |
} |
78 |
|
|
79 |
xtitleclean() { |
xtitleclean() |
80 |
if [ ${TERM} == "xterm" ] |
{ |
81 |
|
if [[ ${TERM} = xterm ]] |
82 |
then |
then |
83 |
echo -ne "\033]0;\007" |
echo -ne "\033]0;\007" |
84 |
fi |
fi |
85 |
return 0 |
return 0 |
86 |
} |
} |
87 |
|
|
88 |
syncsmage2() { |
syncsmage2() |
89 |
|
{ |
90 |
xtitle "Updating smage2-script tree ..." |
xtitle "Updating smage2-script tree ..." |
91 |
local i |
local i |
92 |
for i in ${SMAGE2RSYNC} |
for i in ${SMAGE2RSYNC} |
105 |
--delete \ |
--delete \ |
106 |
--delete-after \ |
--delete-after \ |
107 |
${i} ${SMAGESCRIPTSDIR} |
${i} ${SMAGESCRIPTSDIR} |
108 |
|
|
109 |
if [ "$?" == "0" ] |
if [[ $? = 0 ]] |
110 |
then |
then |
111 |
break |
break |
112 |
else |
else |
113 |
continue |
continue |
114 |
fi |
fi |
115 |
|
|
116 |
done |
done |
117 |
|
|
118 |
#clean up backup files (foo~) |
# clean up backup files (foo~) |
119 |
find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';' |
find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';' |
120 |
|
|
121 |
xtitleclean |
xtitleclean |
122 |
} |
} |
123 |
|
|
124 |
# $1 filename |
# $1 filename |
125 |
get_db_md5_sum() { |
get_db_md5_sum() |
126 |
|
{ |
127 |
local DB_FILE |
local DB_FILE |
128 |
local MD5_FILE |
local MD5_FILE |
129 |
local i |
local i |
136 |
echo "${i}" |
echo "${i}" |
137 |
} |
} |
138 |
|
|
139 |
download_sources() { |
download_sources() |
140 |
|
{ |
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 |
|
|
149 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
150 |
local FETCHING |
local FETCHING |
151 |
local i mirror |
local i mirror |
|
|
|
152 |
|
|
153 |
#install SRCDIR/PNAME if not exist |
|
154 |
|
# install SRCDIR/PNAME if not exist |
155 |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
156 |
|
|
157 |
# check if FETCHING is needed |
# check if FETCHING is needed |
158 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
159 |
if [[ $? == 0 ]] |
if [[ $? = 0 ]] |
160 |
then |
then |
161 |
# md5's ok, not fetching needed |
# md5's ok, not fetching needed |
162 |
FETCHING=false |
FETCHING=false |
163 |
else |
else |
164 |
FETCHING=true |
FETCHING=true |
165 |
fi |
fi |
166 |
|
|
167 |
for ((i=0; i < EOA; i++)) |
for ((i=0; i < EOA; i++)) |
168 |
do |
do |
169 |
# url to file |
# url to file |
187 |
do |
do |
188 |
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")" |
189 |
|
|
190 |
#echo "DEBUG: ${MY_SRC_URI}" |
if [[ ${FETCHING} = true ]] |
|
if [[ ${FETCHING} == true ]] |
|
191 |
then |
then |
192 |
echo "==> fetching ${my_SRC_URI_MIRROR}" |
echo "==> fetching ${my_SRC_URI_MIRROR}" |
193 |
wget \ |
wget \ |
197 |
--progress bar \ |
--progress bar \ |
198 |
--directory-prefix="${my_SOURCEDIR}" \ |
--directory-prefix="${my_SOURCEDIR}" \ |
199 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
200 |
if [ "$?" == "0" ] |
if [[ $? = 0 ]] |
201 |
then |
then |
202 |
break |
break |
203 |
else |
else |
206 |
fi |
fi |
207 |
done |
done |
208 |
else |
else |
209 |
#echo "DEBUG: ${SRC_URI[${i}]}" |
if [[ ${FETCHING} = true ]] |
|
if [[ ${FETCHING} == true ]] |
|
210 |
then |
then |
211 |
echo "==> fetching ${my_SRC_URI}" |
echo "==> fetching ${my_SRC_URI}" |
212 |
wget \ |
wget \ |
216 |
--progress bar \ |
--progress bar \ |
217 |
--directory-prefix="${my_SOURCEDIR}" \ |
--directory-prefix="${my_SOURCEDIR}" \ |
218 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
|
# only needed to run through a list of mirrors |
|
|
# if [ "$?" == "0" ] |
|
|
# then |
|
|
# break |
|
|
# else |
|
|
# continue |
|
|
# fi |
|
219 |
fi |
fi |
220 |
fi |
fi |
221 |
|
|
222 |
# unset them to be shure |
# unset them to be shure |
223 |
unset my_SRC_URI |
unset my_SRC_URI |
224 |
unset my_SRC_URI_DEST |
unset my_SRC_URI_DEST |
237 |
} |
} |
238 |
|
|
239 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that not exist in smage file |
240 |
src_prepare() { |
src_prepare() |
241 |
|
{ |
242 |
echo "no src_prepare defined" |
echo "no src_prepare defined" |
243 |
sleep 2 |
sleep 2 |
244 |
return 0 |
return 0 |
245 |
} |
} |
246 |
|
|
247 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that not exist in smage file |
248 |
src_compile() { |
src_compile() |
249 |
|
{ |
250 |
echo "no src_compile defined" |
echo "no src_compile defined" |
251 |
sleep 2 |
sleep 2 |
252 |
return 0 |
return 0 |
253 |
} |
} |
254 |
|
|
255 |
# dummy function, used if that not exist in smage file |
# dummy function, used if that not exist in smage file |
256 |
src_install() { |
src_install() |
257 |
|
{ |
258 |
echo "no src_install defined" |
echo "no src_install defined" |
259 |
sleep 2 |
sleep 2 |
260 |
return 0 |
return 0 |
261 |
} |
} |
262 |
|
|
263 |
mconfigure() { |
mlibdir() |
264 |
|
{ |
265 |
|
local libdir=lib |
266 |
|
[[ ${ARCH} = x86_64 ]] && libdir=lib64 |
267 |
|
|
268 |
|
echo "${libdir}" |
269 |
|
} |
270 |
|
|
271 |
|
mconfigure() |
272 |
|
{ |
273 |
if [ -x ./configure ] |
if [ -x ./configure ] |
274 |
then |
then |
275 |
./configure \ |
./configure \ |
276 |
--prefix=/usr \ |
--prefix=/usr \ |
277 |
--host=${CHOST} \ |
--host=${CHOST} \ |
278 |
--mandir=/usr/share/man \ |
--mandir=/usr/share/man \ |
279 |
--infodir=/usr/share/info \ |
--infodir=/usr/share/info \ |
280 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
281 |
--sysconfdir=/etc \ |
--sysconfdir=/etc \ |
282 |
--localstatedir=/var/lib \ |
--localstatedir=/var/lib \ |
283 |
"$@" || die "mconfigure failed" |
--libdir=/usr/$(mlibdir) \ |
284 |
|
"$@" || die "mconfigure failed" |
285 |
else |
else |
286 |
echo "configure is not an executable ..." |
echo "configure is not an executable ..." |
287 |
exit 1 |
exit 1 |
288 |
fi |
fi |
289 |
} |
} |
290 |
|
|
291 |
minstall() { |
minstall() |
292 |
if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then |
{ |
293 |
|
if [ -f ./[mM]akefile -o -f ./GNUmakefile ] |
294 |
|
then |
295 |
make prefix=${BINDIR}/usr \ |
make prefix=${BINDIR}/usr \ |
296 |
datadir=${BINDIR}/usr/share \ |
datadir=${BINDIR}/usr/share \ |
297 |
infodir=${BINDIR}/usr/share/info \ |
infodir=${BINDIR}/usr/share/info \ |
298 |
localstatedir=${BINDIR}/var/lib \ |
localstatedir=${BINDIR}/var/lib \ |
299 |
mandir=${BINDIR}/usr/share/man \ |
mandir=${BINDIR}/usr/share/man \ |
300 |
sysconfdir=${BINDIR}/etc \ |
sysconfdir=${BINDIR}/etc \ |
301 |
|
libdir=${BINDIR}/usr/$(mlibdir) \ |
302 |
"$@" install || die "minstall failed" |
"$@" install || die "minstall failed" |
303 |
else |
else |
304 |
die "no Makefile found" |
die "no Makefile found" |
305 |
fi |
fi |
306 |
} |
} |
307 |
|
|
308 |
mmake() { |
mmake() |
309 |
|
{ |
310 |
make ${MAKEOPTS} ${EXTRA_EMAKE} "$@" |
make ${MAKEOPTS} ${EXTRA_EMAKE} "$@" |
311 |
} |
} |
312 |
|
|
313 |
munpack() { |
munpack() |
314 |
|
{ |
315 |
local SRCFILE |
local SRCFILE |
316 |
local IFTAR |
local IFTAR |
317 |
local DEST |
local DEST |
318 |
|
|
319 |
SRCFILE=$1 |
SRCFILE=$1 |
320 |
|
|
321 |
if [ -z "$2" ] |
if [ -z "$2" ] |
322 |
then |
then |
323 |
DEST=${BUILDDIR} |
DEST=${BUILDDIR} |
324 |
else |
else |
325 |
DEST=$2 |
DEST=$2 |
326 |
fi |
fi |
327 |
|
|
328 |
case "${SRCFILE##*.}" in |
case "${SRCFILE##*.}" in |
329 |
bz2) |
bz2) |
330 |
IFTAR="$(basename $SRCFILE .bz2)" |
IFTAR="$(basename $SRCFILE .bz2)" |
331 |
IFTAR="${IFTAR##*.}" |
IFTAR="${IFTAR##*.}" |
332 |
if [ "${IFTAR}" == "tar" ] |
if [[ ${IFTAR} = tar ]] |
333 |
then |
then |
334 |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} |
335 |
fi |
fi |
337 |
gz) |
gz) |
338 |
IFTAR="$(basename $SRCFILE .gz)" |
IFTAR="$(basename $SRCFILE .gz)" |
339 |
IFTAR="${IFTAR##*.}" |
IFTAR="${IFTAR##*.}" |
340 |
if [ "${IFTAR}" == "tar" ] |
if [[ ${IFTAR} = tar ]] |
341 |
then |
then |
342 |
tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} |
tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} |
343 |
fi |
fi |
354 |
esac |
esac |
355 |
} |
} |
356 |
|
|
357 |
mpatch() { |
mpatch() |
358 |
|
{ |
359 |
local PATCHOPTS |
local PATCHOPTS |
360 |
local PATCHFILE |
local PATCHFILE |
361 |
|
|
366 |
} |
} |
367 |
|
|
368 |
|
|
369 |
minstalldocs() { |
minstalldocs() |
370 |
|
{ |
371 |
local docfiles |
local docfiles |
|
|
|
372 |
docfiles="$@" |
docfiles="$@" |
373 |
|
|
374 |
if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ] |
if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ] |
375 |
then |
then |
376 |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs." |
377 |
fi |
fi |
378 |
|
|
379 |
for i in ${docfiles} |
for i in ${docfiles} |
380 |
do |
do |
381 |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs." |
384 |
done |
done |
385 |
} |
} |
386 |
|
|
387 |
mstriplibs() { |
mstriplibs() |
388 |
|
{ |
389 |
local stripdir="$@" |
local stripdir="$@" |
390 |
|
|
391 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
392 |
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-unneeded 2> /dev/null |
393 |
} |
} |
394 |
|
|
395 |
mstripbins() { |
mstripbins() |
396 |
|
{ |
397 |
local stripdir="$@" |
local stripdir="$@" |
398 |
|
|
399 |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
[ -z "${stripdir}" ] && stripdir=${BINDIR} |
400 |
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 |
401 |
} |
} |
402 |
|
|
403 |
sminclude() { |
sminclude() |
404 |
|
{ |
405 |
local i |
local i |
406 |
|
|
407 |
if [[ -n "$@" ]] |
if [[ -n "$@" ]] |
415 |
fi |
fi |
416 |
} |
} |
417 |
|
|
418 |
setup_distcc_environment(){ |
setup_distcc_environment() |
419 |
|
{ |
420 |
if [ -x /usr/bin/distcc ] |
if [ -x /usr/bin/distcc ] |
421 |
then |
then |
422 |
echo "Using DistCC for compilation ..." |
echo "Using DistCC for compilation ..." |
423 |
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 |
|
424 |
|
|
425 |
export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed" |
export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed" |
426 |
|
|
427 |
|
# creating distcc tempdir |
|
#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 |
|
|
|
|
|
#creating distcc tempdir |
|
428 |
install -o distcc -g daemon -d ${DISTCC_DIR} |
install -o distcc -g daemon -d ${DISTCC_DIR} |
429 |
chmod 1777 ${DISTCC_DIR} |
chmod 1777 ${DISTCC_DIR} |
430 |
fi |
fi |
431 |
} |
} |
432 |
|
|
433 |
setup_ccache_environment(){ |
setup_ccache_environment() |
434 |
|
{ |
435 |
if [ -x /usr/bin/ccache ] |
if [ -x /usr/bin/ccache ] |
436 |
then |
then |
437 |
echo "Using CCache for compilation ..." |
echo "Using CCache for compilation ..." |
438 |
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 |
|
439 |
fi |
fi |
440 |
} |
} |
441 |
|
|
442 |
|
|
443 |
# fixes given dependencies to match a MAGE_TARGET |
# fixes given dependencies to match a MAGE_TARGET |
444 |
# fix_mage_deps -target s/depend # <-- note -target ! |
# fix_mage_deps -target s/depend # <-- note -target ! |
445 |
fix_mage_deps() { |
fix_mage_deps() |
446 |
|
{ |
447 |
local target="$1" |
local target="$1" |
448 |
local depend="$2" |
local depend="$2" |
449 |
local NDEPEND |
local NDEPEND |
546 |
> ${dest} |
> ${dest} |
547 |
|
|
548 |
# header |
# header |
549 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.39 2005-10-03 21:02:31 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.42 2006-03-22 17:45:49 niro Exp $' >> ${dest} |
550 |
echo >> ${dest} |
echo >> ${dest} |
551 |
|
|
552 |
# pgkname and state |
# pgkname and state |
780 |
fi |
fi |
781 |
|
|
782 |
# updating smage2-scripts |
# updating smage2-scripts |
783 |
if [ "$1" == "update" ] |
if [[ $1 = update ]] |
784 |
then |
then |
785 |
if [ ! -d ${SOURCEDIR} ] |
if [ ! -d ${SOURCEDIR} ] |
786 |
then |
then |
791 |
fi |
fi |
792 |
|
|
793 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
794 |
if [ "$1" == "calcmd5" ] |
if [[ $1 = calcmd5 ]] |
795 |
then |
then |
796 |
if [ $# -ge 3 ] |
if [ $# -ge 3 ] |
797 |
then |
then |
843 |
unset my_SRC_URI_MIRROR |
unset my_SRC_URI_MIRROR |
844 |
unset my_SOURCEDIR |
unset my_SOURCEDIR |
845 |
done |
done |
846 |
|
|
847 |
echo |
echo |
848 |
echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done." |
echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done." |
849 |
echo |
echo |
856 |
echo |
echo |
857 |
exit 1 |
exit 1 |
858 |
fi |
fi |
859 |
|
|
860 |
exit 0 |
exit 0 |
861 |
fi |
fi |
862 |
|
|
899 |
exit 0 |
exit 0 |
900 |
fi |
fi |
901 |
|
|
902 |
if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] |
[ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting." |
903 |
then |
[ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] && |
904 |
die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting." |
die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting." |
905 |
fi |
[ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your mage.rc correctly." |
906 |
|
[ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly." |
907 |
if [ -z "`basename ${SMAGENAME}|grep .${SMAGESUFFIX}`" ] |
[ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly." |
908 |
then |
[ -z "${BINDIR}" ] && die "no BINDIR variable found in /etc/mage.rc" |
909 |
die "File '`basename ${SMAGENAME}`' is not a sMage v${SMAGEVERSION} file. Aborting." |
[ -z "${CHOST}" ] && die "no CHOST variable found in /etc/mage.rc" |
910 |
fi |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in /etc/mage.rc" |
911 |
|
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in /etc/mage.rc" |
|
if [ -z "${SOURCEDIR}" ] |
|
|
then |
|
|
die "\$SOURCEDIR not found. Please setup your mage.rc correctly." |
|
|
fi |
|
|
|
|
|
if [ -z "${SMAGESCRIPTSDIR}" ] |
|
|
then |
|
|
die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly." |
|
|
fi |
|
|
|
|
|
if [ -z "${SMAGE2RSYNC}" ] |
|
|
then |
|
|
echo "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly." |
|
|
exit 1 |
|
|
fi |
|
|
|
|
|
if [ -z "${BINDIR}" ] |
|
|
then |
|
|
die "no BINDIR variable found in /etc/mage.rc" |
|
|
fi |
|
|
|
|
|
if [ -z "${CHOST}" ] |
|
|
then |
|
|
die "no CHOST variable found in /etc/mage.rc" |
|
|
fi |
|
|
|
|
|
if [ -z "${CFLAGS}" ] |
|
|
then |
|
|
die "no CFLAGS variable found in /etc/mage.rc" |
|
|
fi |
|
|
|
|
|
if [ -z "${CXXFLAGS}" ] |
|
|
then |
|
|
die "no CXXFLAGS variable found in /etc/mage.rc" |
|
|
fi |
|
|
|
|
912 |
|
|
913 |
source ${SMAGENAME} || die "source failed" |
source ${SMAGENAME} || die "source failed" |
914 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
937 |
|
|
938 |
|
|
939 |
# setup distcc |
# setup distcc |
940 |
# 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 |
941 |
if [ "${SMAGE_USE_DISTCC}" == "true" ] |
[[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment |
|
then |
|
|
setup_distcc_environment |
|
|
fi |
|
942 |
|
|
943 |
# setup ccache |
# setup ccache |
944 |
if [ "${SMAGE_USE_CCACHE}" == "true" ] |
[[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment |
|
then |
|
|
setup_ccache_environment |
|
|
fi |
|
|
|
|
945 |
|
|
946 |
# small sleep to show our settings |
# small sleep to show our settings |
947 |
sleep 1 |
sleep 1 |
948 |
|
|
|
#debug |
|
|
#echo "CC=${CC}" |
|
|
#echo "CXX=${CXX}" |
|
|
#echo "DISTCC_DIR=${DISTCC_DIR}" |
|
|
#echo "PATH: ${PATH}" |
|
|
#echo "--------------------------------------" |
|
|
#env |
|
|
#echo "--------------------------------------" |
|
|
#read |
|
|
#debug end |
|
|
|
|
949 |
# cleans up build if a previously one exists |
# cleans up build if a previously one exists |
950 |
if [ -d ${BUILDDIR} ] |
if [ -d ${BUILDDIR} ] |
951 |
then |
then |
1015 |
echo -e "NOPGKBUILD=true detected; Package will not be build ..." |
echo -e "NOPGKBUILD=true detected; Package will not be build ..." |
1016 |
;; |
;; |
1017 |
*) |
*) |
1018 |
# build serveral targets |
# build several targets |
1019 |
if [ -n "${MAGE_TARGETS}" ] |
if [ -n "${MAGE_TARGETS}" ] |
1020 |
then |
then |
1021 |
for target in ${MAGE_TARGETS} |
for target in ${MAGE_TARGETS} |
1061 |
# for sure |
# for sure |
1062 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1063 |
unset NOSTRIP |
unset NOSTRIP |
1064 |
|
|
1065 |
xtitleclean |
xtitleclean |
|
#echo -e "\nPackage ${PKGNAME} successfully builded.\n" |
|