Contents of /trunk/mage/usr/lib/mage/smage2.sh
Parent Directory | Revision Log
Revision 1640 -
(show annotations)
(download)
(as text)
Fri Jan 13 18:29:52 2012 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 18533 byte(s)
Fri Jan 13 18:29:52 2012 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 18533 byte(s)
-split of smage2-functions into an extra include
1 | #!/bin/bash |
2 | # $Id$ |
3 | |
4 | # compiles/installs .smage2 source install scripts |
5 | # needs pkgbuild_dir (mage) |
6 | |
7 | # TODO: record dynlib, gz | xz database |
8 | |
9 | |
10 | # set default user mage.rc |
11 | : ${MAGERC="/etc/mage.rc"} |
12 | |
13 | # export default C locale |
14 | export LC_ALL=C |
15 | |
16 | source /etc/mage.rc.global |
17 | source ${MAGERC} |
18 | source ${MLIBDIR}/mage4.functions.sh |
19 | source ${MLIBDIR}/smage2.functions.sh |
20 | |
21 | ## setup ## |
22 | SMAGENAME="$1" |
23 | SMAGEVERSION="$(< ${MLIBDIR}/version)" |
24 | |
25 | # expand PKGDIR, BUILDDIR and BINDIR with MROOT |
26 | if [[ -n ${MROOT} ]] |
27 | then |
28 | export PKGDIR=${MROOT}/${PKGDIR} |
29 | export BUILDDIR=${MROOT}/${BUILDDIR} |
30 | export BINDIR=${MROOT}/${BINDIR} |
31 | fi |
32 | |
33 | # print out our version |
34 | showversion |
35 | echo |
36 | |
37 | if [ -z "$1" ] |
38 | then |
39 | echo "No .smage2 file given. Exiting." |
40 | echo |
41 | exit 1 |
42 | fi |
43 | |
44 | # load supported mage features |
45 | load_mage_features |
46 | |
47 | # updating smage2-scripts |
48 | if [[ $1 = update ]] |
49 | then |
50 | if [ ! -d ${SOURCEDIR} ] |
51 | then |
52 | install -d ${SOURCEDIR} |
53 | fi |
54 | syncsmage2 |
55 | exit 0 |
56 | fi |
57 | |
58 | # creates md5sums for smages to given dir |
59 | if [[ $1 = calcmd5 ]] |
60 | then |
61 | if [ $# -ge 2 ] |
62 | then |
63 | SMAGENAME="$2" |
64 | MD5DIR="$3" |
65 | [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
66 | |
67 | smagesource ${SMAGENAME} || die "download source failed" |
68 | |
69 | # overridable sourcedir; must be declared after source of the smage2 |
70 | CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
71 | |
72 | [ -z "${SRC_URI}" ] && die "Nothing declared to calculate." |
73 | |
74 | # end of array |
75 | EOA=${#SRC_URI[*]} |
76 | |
77 | [ ! -d ${MD5DIR} ] && install -d ${MD5DIR} |
78 | |
79 | # clear md5sum file |
80 | MY_MD5_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
81 | echo -n > ${MY_MD5_FILE} |
82 | |
83 | for ((i=0; i < EOA; i++)) |
84 | do |
85 | # url to file |
86 | my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)" |
87 | |
88 | # subdir in sources dir; the my_SRCI_URI file goes to there |
89 | my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)" |
90 | |
91 | # if my_src_uri_dest is not equal my_src_uri; than an other dir is used |
92 | if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]] |
93 | then |
94 | MY_SRC_FILE="${my_SRC_URI_DEST}/$(basename ${SRC_URI[${i}]})" |
95 | else |
96 | MY_SRC_FILE="$(basename ${SRC_URI[${i}]})" |
97 | fi |
98 | |
99 | if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ] |
100 | then |
101 | echo "calculating $(basename ${MY_SRC_FILE}) ..." |
102 | ( cd ${CALC_SOURCEDIR}; md5sum "${MY_SRC_FILE}" ) >> ${MY_MD5_FILE} |
103 | else |
104 | echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}." |
105 | fi |
106 | |
107 | # unset them to be shure |
108 | unset my_SRC_URI |
109 | unset my_SRC_URI_DEST |
110 | unset my_SRC_URI_MIRROR |
111 | unset my_SOURCEDIR |
112 | done |
113 | |
114 | echo |
115 | echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done." |
116 | echo |
117 | else |
118 | echo "Usage: Calculating MD5 Sums:" |
119 | echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
120 | echo |
121 | echo |
122 | echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
123 | echo |
124 | exit 1 |
125 | fi |
126 | |
127 | exit 0 |
128 | fi |
129 | |
130 | # download sources |
131 | if [ "$1" == "download" -a -n "$2" ] |
132 | then |
133 | if [ ! -d ${SMAGESCRIPTSDIR} ] |
134 | then |
135 | install -d ${SMAGESCRIPTSDIR} |
136 | fi |
137 | |
138 | # get smage |
139 | SMAGENAME="$2" |
140 | MD5DIR="$(dirname ${SMAGENAME})/md5" |
141 | smagesource ${SMAGENAME} || die "download source failed" |
142 | |
143 | download_sources |
144 | exit 0 |
145 | fi |
146 | |
147 | # regen-mage-tree |
148 | if [ "$1" == "only-regen-tree" -a -n "$2" ] |
149 | then |
150 | # set correct SMAGENAME |
151 | SMAGENAME="$2" |
152 | MD5DIR="$(dirname ${SMAGENAME})/md5" |
153 | smagesource ${SMAGENAME} || die "regen: smage2 not found" |
154 | |
155 | regen_mage_tree |
156 | |
157 | # build several targets |
158 | if [[ -n ${MAGE_TARGETS} ]] |
159 | then |
160 | for target in ${MAGE_TARGETS} |
161 | do |
162 | # build md5sum for existing packages |
163 | generate_package_md5sum \ |
164 | --pcat "${PCATEGORIE}" \ |
165 | --pname "${PNAME}" \ |
166 | --pver "${PVER}" \ |
167 | --pbuild "${PBUILD}" \ |
168 | --parch "${ARCH}" \ |
169 | --target "${target}" |
170 | done |
171 | |
172 | # build several subpackages |
173 | elif [[ -n ${SPLIT_PACKAGES} ]] |
174 | then |
175 | split_save_variables |
176 | for subpackage in ${SPLIT_PACKAGES} |
177 | do |
178 | # get the right variables for the split |
179 | export PNAME="${subpackage}" |
180 | split_info_${subpackage} |
181 | # build md5sum for existing packages |
182 | generate_package_md5sum \ |
183 | --pcat "${PCATEGORIE}" \ |
184 | --pname "${PNAME}" \ |
185 | --pver "${PVER}" \ |
186 | --pbuild "${PBUILD}" \ |
187 | --parch "${ARCH}" |
188 | # restore smage environment |
189 | split_restore_variables |
190 | done |
191 | # unset all saved smage variables |
192 | split_unset_variables |
193 | |
194 | else |
195 | # build md5sum for existing packages |
196 | generate_package_md5sum \ |
197 | --pcat "${PCATEGORIE}" \ |
198 | --pname "${PNAME}" \ |
199 | --pver "${PVER}" \ |
200 | --pbuild "${PBUILD}" \ |
201 | --parch "${ARCH}" |
202 | fi |
203 | |
204 | exit 0 |
205 | fi |
206 | |
207 | if [ "$1" == "--create-src-tarball" -a -n "$2" ] |
208 | then |
209 | # set correct SMAGENAME |
210 | SMAGENAME="$2" |
211 | MD5DIR="$(dirname ${SMAGENAME})/md5" |
212 | |
213 | echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
214 | |
215 | smagesource ${SMAGENAME} || die "regen: smage2 not found" |
216 | |
217 | if [[ -d ${SOURCEDIR}/${PNAME} ]] |
218 | then |
219 | echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}" |
220 | rm -rf ${SOURCEDIR}/${PKGNAME} |
221 | fi |
222 | |
223 | download_sources |
224 | source_pkg_build ${SMAGENAME} |
225 | exit 0 |
226 | fi |
227 | |
228 | if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ] |
229 | then |
230 | SRCPKGTARBALL="${2}" |
231 | msetfeature "srcpkgtarball" |
232 | |
233 | # abort if given file is not a source pkg |
234 | [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file." |
235 | |
236 | # set correct SMAGENAME; use the one that the src_pkg provide |
237 | # /path/to/SOURCEDIR/PNAME/SMAGENAME |
238 | SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}" |
239 | |
240 | echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}" |
241 | |
242 | [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR} |
243 | |
244 | # unpack srctarball |
245 | [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting." |
246 | |
247 | tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die "Error unpackung src-tarball ${SRCPKGTARBALL}" |
248 | |
249 | [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}" |
250 | fi |
251 | |
252 | if [ "$1" == "--resume" -a -n "$2" ] |
253 | then |
254 | msetfeature "resume" |
255 | SMAGENAME="$2" |
256 | fi |
257 | |
258 | [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting." |
259 | [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] && |
260 | die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting." |
261 | [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly." |
262 | [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly." |
263 | [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly." |
264 | [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}" |
265 | [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}" |
266 | [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
267 | [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
268 | |
269 | smagesource ${SMAGENAME} || die "source failed" |
270 | PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
271 | MD5DIR="$(dirname ${SMAGENAME})/md5" |
272 | SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
273 | |
274 | xtitle "Compiling ${PKGNAME}" |
275 | echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
276 | |
277 | # auto regen mage tree if requested |
278 | regen_mage_tree |
279 | |
280 | if mqueryfeature "srcpkgbuild" |
281 | then |
282 | if [[ -d ${SOURCEDIR}/${PNAME} ]] |
283 | then |
284 | echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}" |
285 | rm -rf ${SOURCEDIR}/${PNAME} |
286 | fi |
287 | fi |
288 | |
289 | # download sources |
290 | mqueryfeature "srcpkgtarball" || download_sources |
291 | |
292 | # fixes some issues with these functions |
293 | export -f src_prepare || die "src_prepare export failed" |
294 | export -f src_compile || die "src_compile export failed" |
295 | export -f src_check || die "src_check export failed" |
296 | export -f src_install || die "src_install export failed" |
297 | |
298 | # fixes some compile issues |
299 | export CHOST="${CHOST}" || die "CHOST export failed" |
300 | export CFLAGS="${CFLAGS}" || die "CFLAGS export failed" |
301 | if [[ -z ${CXXFLAGS} ]] |
302 | then |
303 | export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed" |
304 | else |
305 | export CXXFLAGS="${CXXFLAGS}" || die "CXXFLAGS export failed" |
306 | fi |
307 | export LDFLAGS="${LDFLAGS}" || die "LDFLAGS export failed" |
308 | export BINDIR="${BINDIR}" || die "BINDIR export failed" |
309 | export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" |
310 | |
311 | # setup distcc |
312 | # setup for distcc goes *before* ccache, so ccache comes before distcc in path |
313 | mqueryfeature "distcc" && setup_distcc_environment |
314 | |
315 | # setup ccache |
316 | mqueryfeature "ccache" && setup_ccache_environment |
317 | |
318 | if mqueryfeature "resume" |
319 | then |
320 | echo -e "${COLMAGENTA}Resume requested; continuing previous build${COLDEFAULT}" |
321 | |
322 | # setup build logging |
323 | [[ ! -d /var/log/smage ]] && install -d /var/log/smage |
324 | if [[ -f /var/log/smage/${PKGNAME}.log.bz2 ]] |
325 | then |
326 | bunzip2 -f /var/log/smage/${PKGNAME}.log.bz2 |
327 | fi |
328 | echo -e "### Resume started on $(date) ###\n" >> /var/log/smage/${PKGNAME}.log |
329 | |
330 | else |
331 | # clean up builddir if a previously one exist |
332 | if [ -d ${BUILDDIR} ] |
333 | then |
334 | rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR." |
335 | fi |
336 | install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR." |
337 | |
338 | # clean up srcdir if a previously unpacked one exist |
339 | if [ -d ${SRCDIR} ] |
340 | then |
341 | rm -rf ${SRCDIR} |
342 | fi |
343 | |
344 | # clean up bindir if a previous build exist or create a new one |
345 | if [ -d ${BINDIR} ] |
346 | then |
347 | rm -rf ${BINDIR} |
348 | fi |
349 | install -d ${BINDIR} || die "couldn't create \$BINDIR." |
350 | |
351 | # clean up package temp dir if a previous build exist |
352 | if [ -d ${BUILDDIR}/${PKGNAME} ] |
353 | then |
354 | rm -rf ${BUILDDIR}/${PKGNAME} |
355 | fi |
356 | |
357 | # clean up stamps dir |
358 | if [ -d ${BUILDDIR}/.stamps ] |
359 | then |
360 | rm -rf ${BUILDDIR}/.stamps |
361 | fi |
362 | |
363 | # setup build logging |
364 | [[ ! -d /var/log/smage ]] && install -d /var/log/smage |
365 | echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
366 | fi |
367 | |
368 | if [[ ${PKGTYPE} = virtual ]] |
369 | then |
370 | echo "virtual package detected; nothing will be build ..." |
371 | # automatically set !pkgbuild here too |
372 | msetfeature "!pkgbuild" |
373 | else |
374 | ( run_resume src_prepare || src_prepare ) | ${SMAGE_LOG_CMD} |
375 | die_pipestatus 0 "src_prepare failed" |
376 | resume_stamp src_prepare |
377 | step_by_step src_prepare |
378 | |
379 | ( run_resume src_compile || src_compile ) | ${SMAGE_LOG_CMD} |
380 | die_pipestatus 0 "src_compile failed" |
381 | resume_stamp src_compile |
382 | step_by_step src_compile |
383 | |
384 | # only run checks if requested |
385 | if mqueryfeature "!check" |
386 | then |
387 | echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD} |
388 | else |
389 | ( run_resume src_check || src_check ) | ${SMAGE_LOG_CMD} |
390 | die_pipestatus 0 "src_check failed" |
391 | resume_stamp src_check |
392 | fi |
393 | step_by_step src_check |
394 | |
395 | # build several subpackages |
396 | if [[ -n ${SPLIT_PACKAGES} ]] |
397 | then |
398 | # save bindir & pname |
399 | split_save_variables |
400 | export SAVED_BINDIR="${BINDIR}" |
401 | for subpackage in ${SPLIT_PACKAGES} |
402 | do |
403 | if typeset -f src_install_${subpackage} > /dev/null |
404 | then |
405 | # export subpackage bindir |
406 | export BINDIR="${SAVED_BINDIR}_${subpackage}" |
407 | # export PNAME, several internal function and include |
408 | # rely on this variable |
409 | export PNAME="${subpackage}" |
410 | |
411 | echo |
412 | echo -en "${COLBLUE}*** ${COLDEFAULT}" |
413 | echo -en " Running ${COLGREEN}split src_install()${COLDEFAULT}" |
414 | echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}" |
415 | echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..." |
416 | |
417 | ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} |
418 | die_pipestatus 0 "src_install_${subpackage} failed" |
419 | resume_stamp src_install_${subpackage} |
420 | step_by_step src_install_${subpackage} |
421 | fi |
422 | done |
423 | # restore bindir & pname |
424 | split_restore_variables |
425 | # unset all saved smage variables |
426 | split_unset_variables |
427 | else |
428 | ( run_resume src_install || src_install ) | ${SMAGE_LOG_CMD} |
429 | die_pipestatus 0 "src_install failed" |
430 | resume_stamp src_install |
431 | step_by_step src_install |
432 | fi |
433 | fi |
434 | |
435 | # echo for sake of good-looking |
436 | echo |
437 | |
438 | if mqueryfeature "!compressdoc" |
439 | then |
440 | echo -e "!compressdoc detected; documentation will not be compressed ..." |
441 | elif mqueryfeature "!pkgbuild" |
442 | then |
443 | echo "!pkgbuild detected; skipping documentation compression..." |
444 | else |
445 | # compressing doc, info & man files |
446 | if [[ -n ${SPLIT_PACKAGES} ]] |
447 | then |
448 | for subpackage in ${SPLIT_PACKAGES} |
449 | do |
450 | run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
451 | resume_stamp post-mcompressdoc_${subpackage} |
452 | done |
453 | else |
454 | run_resume post-mcompressdoc || mcompressdocs ${BINDIR} |
455 | resume_stamp post-mcompressdoc |
456 | fi |
457 | fi |
458 | |
459 | if mqueryfeature "!libtool" |
460 | then |
461 | if mqueryfeature "!pkgbuild" |
462 | then |
463 | echo "!pkgbuild detected; skipping libtool archive stripping ..." |
464 | else |
465 | if [[ -n ${SPLIT_PACKAGES} ]] |
466 | then |
467 | for subpackage in ${SPLIT_PACKAGES} |
468 | do |
469 | echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}" |
470 | run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} |
471 | resume_stamp post-mstriplibtoolarchive_${subpackage} |
472 | done |
473 | else |
474 | echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
475 | run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} |
476 | resume_stamp post-mstriplibtoolarchive |
477 | fi |
478 | fi |
479 | fi |
480 | |
481 | if mqueryfeature "purge" |
482 | then |
483 | if mqueryfeature "!pkgbuild" |
484 | then |
485 | echo "!pkgbuild detected; skipping file purgation..." |
486 | else |
487 | if [[ -n ${SPLIT_PACKAGES} ]] |
488 | then |
489 | for subpackage in ${SPLIT_PACKAGES} |
490 | do |
491 | echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}" |
492 | run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} |
493 | resume_stamp post-mpurgetargets_${subpackage} |
494 | done |
495 | else |
496 | echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
497 | run_resume post-mpurgetargets || mpurgetargets ${BINDIR} |
498 | resume_stamp post-mpurgetargets |
499 | fi |
500 | fi |
501 | fi |
502 | |
503 | # stripping all bins and libs |
504 | if mqueryfeature "!strip" |
505 | then |
506 | echo -e "!strip detected; Package will not be stripped ..." |
507 | elif mqueryfeature "!pkgbuild" |
508 | then |
509 | echo "!pkgbuild detected; skipping stripping of the package ..." |
510 | else |
511 | if [[ -n ${SPLIT_PACKAGES} ]] |
512 | then |
513 | for subpackage in ${SPLIT_PACKAGES} |
514 | do |
515 | echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
516 | run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} |
517 | resume_stamp post-mstripbins_${subpackage} |
518 | echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
519 | run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} |
520 | resume_stamp post-mstriplibs_${subpackage} |
521 | echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
522 | run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} |
523 | resume_stamp post-mstripstatic_${subpackage} |
524 | done |
525 | else |
526 | echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
527 | run_resume post-mstripbins || mstripbins ${BINDIR} |
528 | resume_stamp post-mstripbins |
529 | echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
530 | run_resume post-mstriplibs || mstriplibs ${BINDIR} |
531 | resume_stamp post-mstriplibs |
532 | echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
533 | run_resume post-mstripstatic || mstripstatic ${BINDIR} |
534 | resume_stamp post-mstripstatic |
535 | fi |
536 | fi |
537 | |
538 | if mqueryfeature "!pkgbuild" |
539 | then |
540 | echo -e "!pkgbuild detected; Package will not be build ..." |
541 | else |
542 | # build several targets |
543 | if [[ -n ${MAGE_TARGETS} ]] |
544 | then |
545 | for target in ${MAGE_TARGETS} |
546 | do |
547 | # check if a special target_pkgbuild exists |
548 | if typeset -f ${target}_pkgbuild > /dev/null |
549 | then |
550 | # run it |
551 | run_resume post-${target}_pkgbuild || ${target}_pkgbuild |
552 | resume_stamp post-${target}_pkgbuild |
553 | fi |
554 | # now create the target package |
555 | run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ |
556 | "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \ |
557 | ${BINDIR} || die "target: ${target} package-build failed" |
558 | resume_stamp post-pkg_builddir_${target} |
559 | |
560 | # build pkg-md5-sum if requested |
561 | run_resume post-md5sum_${target} || generate_package_md5sum \ |
562 | --pcat "${PCATEGORIE}" \ |
563 | --pname "${PNAME}" \ |
564 | --pver "${PVER}" \ |
565 | --pbuild "${PBUILD}" \ |
566 | --parch "${ARCH}" \ |
567 | --target "${target}" |
568 | resume_stamp post-md5sum_${target} |
569 | |
570 | echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
571 | done |
572 | |
573 | # build several subpackages |
574 | elif [[ -n ${SPLIT_PACKAGES} ]] |
575 | then |
576 | split_save_variables |
577 | for subpackage in ${SPLIT_PACKAGES} |
578 | do |
579 | # get the right variables for the split |
580 | export PNAME="${subpackage}" |
581 | split_info_${PNAME} |
582 | |
583 | # jump to next one if !pkgbuild is set in split_info |
584 | mqueryfeature "!pkgbuild" && continue |
585 | |
586 | # check if an special subpackage_pkgbuild exists |
587 | if typeset -f ${PNAME}_pkgbuild > /dev/null |
588 | then |
589 | # run it |
590 | run_resume post-${PNAME}_pkgbuild || ${PNAME}_pkgbuild |
591 | resume_stamp post-${PNAME}_pkgbuild |
592 | fi |
593 | # now create the target package |
594 | run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ |
595 | "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \ |
596 | "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
597 | resume_stamp post-pkg_builddir_${PNAME} |
598 | |
599 | # build pkg-md5-sum if requested |
600 | run_resume post-md5sum_${PNAME} || generate_package_md5sum \ |
601 | --pcat "${PCATEGORIE}" \ |
602 | --pname "${PNAME}" \ |
603 | --pver "${PVER}" \ |
604 | --pbuild "${PBUILD}" \ |
605 | --parch "${ARCH}" |
606 | resume_stamp post-md5sum_${PNAME} |
607 | |
608 | echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}" |
609 | |
610 | # restore smage environment |
611 | split_restore_variables |
612 | done |
613 | # unset all saved smage variables |
614 | split_unset_variables |
615 | |
616 | else |
617 | run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
618 | resume_stamp post-pkg_builddir |
619 | |
620 | # build pkg-md5-sum if requested |
621 | run_resume post-md5sum || generate_package_md5sum \ |
622 | --pcat "${PCATEGORIE}" \ |
623 | --pname "${PNAME}" \ |
624 | --pver "${PVER}" \ |
625 | --pbuild "${PBUILD}" \ |
626 | --parch "${ARCH}" |
627 | resume_stamp post-md5sum |
628 | |
629 | echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}" |
630 | fi |
631 | |
632 | # build src-pkg-tarball if requested |
633 | if mqueryfeature "srcpkgbuild" |
634 | then |
635 | run_resume post-srcpkgbuild || source_pkg_build ${SMAGENAME} |
636 | resume_stamp post-srcpkgbuild |
637 | fi |
638 | fi |
639 | |
640 | if mqueryfeature "buildlog" |
641 | then |
642 | bzip2 -9f /var/log/smage/${PKGNAME}.log |
643 | else |
644 | [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
645 | fi |
646 | |
647 | xtitleclean |
Properties
Name | Value |
---|---|
svn:executable | * |