Annotation of /trunk/mage/usr/lib/mage/smage2.sh
Parent Directory | Revision Log
Revision 1649 -
(hide annotations)
(download)
(as text)
Fri Jan 13 21:04:02 2012 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 18597 byte(s)
Fri Jan 13 21:04:02 2012 UTC (12 years, 8 months ago) by niro
File MIME type: application/x-sh
File size: 18597 byte(s)
-added mage-feature pkgdistrotag to support DISTROTAG in package tarballs
1 | niro | 24 | #!/bin/bash |
2 | niro | 1571 | # $Id$ |
3 | niro | 24 | |
4 | # compiles/installs .smage2 source install scripts | ||
5 | # needs pkgbuild_dir (mage) | ||
6 | |||
7 | niro | 1571 | # TODO: record dynlib, gz | xz database |
8 | niro | 24 | |
9 | |||
10 | niro | 419 | # set default user mage.rc |
11 | : ${MAGERC="/etc/mage.rc"} | ||
12 | |||
13 | niro | 169 | # export default C locale |
14 | export LC_ALL=C | ||
15 | |||
16 | niro | 439 | source /etc/mage.rc.global |
17 | niro | 419 | source ${MAGERC} |
18 | niro | 1273 | source ${MLIBDIR}/mage4.functions.sh |
19 | niro | 1640 | source ${MLIBDIR}/smage2.functions.sh |
20 | niro | 24 | |
21 | niro | 1589 | ## setup ## |
22 | SMAGENAME="$1" | ||
23 | SMAGEVERSION="$(< ${MLIBDIR}/version)" | ||
24 | |||
25 | niro | 1639 | # expand PKGDIR, BUILDDIR and BINDIR with MROOT |
26 | niro | 347 | if [[ -n ${MROOT} ]] |
27 | then | ||
28 | export PKGDIR=${MROOT}/${PKGDIR} | ||
29 | export BUILDDIR=${MROOT}/${BUILDDIR} | ||
30 | export BINDIR=${MROOT}/${BINDIR} | ||
31 | fi | ||
32 | |||
33 | niro | 59 | # print out our version |
34 | showversion | ||
35 | echo | ||
36 | |||
37 | niro | 1641 | if [[ -z ${SMAGENAME} ]] |
38 | niro | 24 | then |
39 | echo "No .smage2 file given. Exiting." | ||
40 | echo | ||
41 | exit 1 | ||
42 | fi | ||
43 | |||
44 | niro | 1584 | # load supported mage features |
45 | load_mage_features | ||
46 | |||
47 | niro | 192 | # updating smage2-scripts |
48 | niro | 306 | if [[ $1 = update ]] |
49 | niro | 24 | then |
50 | niro | 59 | if [ ! -d ${SOURCEDIR} ] |
51 | then | ||
52 | install -d ${SOURCEDIR} | ||
53 | fi | ||
54 | syncsmage2 | ||
55 | exit 0 | ||
56 | fi | ||
57 | |||
58 | niro | 192 | # creates md5sums for smages to given dir |
59 | niro | 306 | if [[ $1 = calcmd5 ]] |
60 | niro | 59 | then |
61 | niro | 1207 | if [ $# -ge 2 ] |
62 | niro | 59 | then |
63 | SMAGENAME="$2" | ||
64 | MD5DIR="$3" | ||
65 | niro | 1207 | [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
66 | |||
67 | niro | 1346 | smagesource ${SMAGENAME} || die "download source failed" |
68 | niro | 59 | |
69 | niro | 66 | # overridable sourcedir; must be declared after source of the smage2 |
70 | CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" | ||
71 | |||
72 | niro | 59 | [ -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 | niro | 66 | # 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 | niro | 59 | 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 | niro | 66 | |
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 | niro | 59 | done |
113 | niro | 306 | |
114 | niro | 59 | echo |
115 | echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done." | ||
116 | echo | ||
117 | else | ||
118 | echo "Usage: Calculating MD5 Sums:" | ||
119 | niro | 1207 | echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
120 | niro | 59 | echo |
121 | echo | ||
122 | echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." | ||
123 | echo | ||
124 | exit 1 | ||
125 | fi | ||
126 | niro | 306 | |
127 | niro | 59 | exit 0 |
128 | fi | ||
129 | |||
130 | niro | 192 | # download sources |
131 | niro | 59 | if [ "$1" == "download" -a -n "$2" ] |
132 | then | ||
133 | niro | 24 | if [ ! -d ${SMAGESCRIPTSDIR} ] |
134 | then | ||
135 | install -d ${SMAGESCRIPTSDIR} | ||
136 | fi | ||
137 | niro | 59 | |
138 | # get smage | ||
139 | SMAGENAME="$2" | ||
140 | MD5DIR="$(dirname ${SMAGENAME})/md5" | ||
141 | niro | 1346 | smagesource ${SMAGENAME} || die "download source failed" |
142 | niro | 59 | |
143 | download_sources | ||
144 | niro | 24 | exit 0 |
145 | fi | ||
146 | |||
147 | niro | 202 | # 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 | niro | 1346 | smagesource ${SMAGENAME} || die "regen: smage2 not found" |
154 | niro | 202 | |
155 | regen_mage_tree | ||
156 | niro | 255 | |
157 | niro | 890 | # build several targets |
158 | niro | 943 | if [[ -n ${MAGE_TARGETS} ]] |
159 | niro | 890 | then |
160 | for target in ${MAGE_TARGETS} | ||
161 | do | ||
162 | # build md5sum for existing packages | ||
163 | generate_package_md5sum \ | ||
164 | niro | 1641 | --pcat "${PCAT}" \ |
165 | niro | 890 | --pname "${PNAME}" \ |
166 | --pver "${PVER}" \ | ||
167 | --pbuild "${PBUILD}" \ | ||
168 | --parch "${ARCH}" \ | ||
169 | --target "${target}" | ||
170 | done | ||
171 | niro | 943 | |
172 | # build several subpackages | ||
173 | elif [[ -n ${SPLIT_PACKAGES} ]] | ||
174 | then | ||
175 | split_save_variables | ||
176 | niro | 964 | for subpackage in ${SPLIT_PACKAGES} |
177 | niro | 943 | 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 | niro | 1641 | --pcat "${PCAT}" \ |
184 | niro | 943 | --pname "${PNAME}" \ |
185 | --pver "${PVER}" \ | ||
186 | --pbuild "${PBUILD}" \ | ||
187 | --parch "${ARCH}" | ||
188 | niro | 951 | # restore smage environment |
189 | split_restore_variables | ||
190 | niro | 943 | done |
191 | niro | 951 | # unset all saved smage variables |
192 | split_unset_variables | ||
193 | niro | 943 | |
194 | niro | 890 | else |
195 | # build md5sum for existing packages | ||
196 | generate_package_md5sum \ | ||
197 | niro | 1641 | --pcat "${PCAT}" \ |
198 | niro | 890 | --pname "${PNAME}" \ |
199 | --pver "${PVER}" \ | ||
200 | --pbuild "${PBUILD}" \ | ||
201 | niro | 943 | --parch "${ARCH}" |
202 | niro | 890 | fi |
203 | niro | 255 | |
204 | niro | 202 | exit 0 |
205 | fi | ||
206 | |||
207 | niro | 412 | if [ "$1" == "--create-src-tarball" -a -n "$2" ] |
208 | niro | 403 | then |
209 | # set correct SMAGENAME | ||
210 | SMAGENAME="$2" | ||
211 | MD5DIR="$(dirname ${SMAGENAME})/md5" | ||
212 | |||
213 | niro | 412 | echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
214 | niro | 403 | |
215 | niro | 1346 | smagesource ${SMAGENAME} || die "regen: smage2 not found" |
216 | niro | 403 | |
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 | niro | 406 | if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ] |
229 | niro | 403 | then |
230 | niro | 412 | SRCPKGTARBALL="${2}" |
231 | niro | 1584 | msetfeature "srcpkgtarball" |
232 | niro | 403 | |
233 | niro | 412 | # 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 | niro | 403 | 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 | niro | 412 | |
249 | [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}" | ||
250 | niro | 403 | fi |
251 | |||
252 | niro | 1617 | if [ "$1" == "--resume" -a -n "$2" ] |
253 | then | ||
254 | msetfeature "resume" | ||
255 | SMAGENAME="$2" | ||
256 | fi | ||
257 | niro | 403 | |
258 | niro | 306 | [ ! -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 | niro | 419 | [ -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 | niro | 24 | |
269 | niro | 1346 | smagesource ${SMAGENAME} || die "source failed" |
270 | niro | 1649 | PKGNAME="${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" |
271 | niro | 59 | MD5DIR="$(dirname ${SMAGENAME})/md5" |
272 | niro | 941 | SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
273 | niro | 24 | |
274 | xtitle "Compiling ${PKGNAME}" | ||
275 | niro | 439 | echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
276 | niro | 59 | |
277 | niro | 191 | # auto regen mage tree if requested |
278 | regen_mage_tree | ||
279 | |||
280 | niro | 1635 | if mqueryfeature "srcpkgbuild" |
281 | niro | 403 | then |
282 | if [[ -d ${SOURCEDIR}/${PNAME} ]] | ||
283 | then | ||
284 | niro | 441 | echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}" |
285 | niro | 408 | rm -rf ${SOURCEDIR}/${PNAME} |
286 | niro | 403 | fi |
287 | fi | ||
288 | |||
289 | niro | 192 | # download sources |
290 | niro | 1584 | mqueryfeature "srcpkgtarball" || download_sources |
291 | niro | 59 | |
292 | niro | 192 | # fixes some issues with these functions |
293 | niro | 24 | export -f src_prepare || die "src_prepare export failed" |
294 | export -f src_compile || die "src_compile export failed" | ||
295 | niro | 1575 | export -f src_check || die "src_check export failed" |
296 | niro | 24 | export -f src_install || die "src_install export failed" |
297 | |||
298 | niro | 192 | # fixes some compile issues |
299 | niro | 24 | export CHOST="${CHOST}" || die "CHOST export failed" |
300 | export CFLAGS="${CFLAGS}" || die "CFLAGS export failed" | ||
301 | niro | 1616 | 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 | niro | 24 | export BINDIR="${BINDIR}" || die "BINDIR export failed" |
309 | export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed" | ||
310 | |||
311 | niro | 192 | # setup distcc |
312 | niro | 351 | # setup for distcc goes *before* ccache, so ccache comes before distcc in path |
313 | niro | 1584 | mqueryfeature "distcc" && setup_distcc_environment |
314 | niro | 24 | |
315 | niro | 192 | # setup ccache |
316 | niro | 1584 | mqueryfeature "ccache" && setup_ccache_environment |
317 | niro | 24 | |
318 | niro | 1617 | if mqueryfeature "resume" |
319 | niro | 24 | then |
320 | niro | 1617 | echo -e "${COLMAGENTA}Resume requested; continuing previous build${COLDEFAULT}" |
321 | niro | 24 | |
322 | niro | 1617 | # 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 | niro | 24 | |
330 | niro | 1617 | 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 | niro | 24 | |
338 | niro | 1617 | # 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 | niro | 1621 | # clean up stamps dir |
358 | if [ -d ${BUILDDIR}/.stamps ] | ||
359 | then | ||
360 | rm -rf ${BUILDDIR}/.stamps | ||
361 | fi | ||
362 | |||
363 | niro | 1617 | # 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 | niro | 24 | fi |
367 | |||
368 | niro | 1593 | if [[ ${PKGTYPE} = virtual ]] |
369 | niro | 1575 | then |
370 | niro | 1593 | echo "virtual package detected; nothing will be build ..." |
371 | # automatically set !pkgbuild here too | ||
372 | msetfeature "!pkgbuild" | ||
373 | niro | 1575 | else |
374 | niro | 1617 | ( run_resume src_prepare || src_prepare ) | ${SMAGE_LOG_CMD} |
375 | niro | 1593 | die_pipestatus 0 "src_prepare failed" |
376 | niro | 1617 | resume_stamp src_prepare |
377 | step_by_step src_prepare | ||
378 | niro | 1575 | |
379 | niro | 1617 | ( run_resume src_compile || src_compile ) | ${SMAGE_LOG_CMD} |
380 | niro | 1593 | die_pipestatus 0 "src_compile failed" |
381 | niro | 1617 | resume_stamp src_compile |
382 | step_by_step src_compile | ||
383 | niro | 945 | |
384 | niro | 1593 | # 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 | niro | 1617 | ( run_resume src_check || src_check ) | ${SMAGE_LOG_CMD} |
390 | niro | 1593 | die_pipestatus 0 "src_check failed" |
391 | niro | 1617 | resume_stamp src_check |
392 | niro | 1593 | fi |
393 | niro | 1617 | step_by_step src_check |
394 | niro | 945 | |
395 | niro | 1593 | # 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 | niro | 1617 | ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD} |
418 | niro | 1593 | die_pipestatus 0 "src_install_${subpackage} failed" |
419 | niro | 1617 | resume_stamp src_install_${subpackage} |
420 | step_by_step src_install_${subpackage} | ||
421 | niro | 1593 | fi |
422 | done | ||
423 | # restore bindir & pname | ||
424 | split_restore_variables | ||
425 | # unset all saved smage variables | ||
426 | split_unset_variables | ||
427 | else | ||
428 | niro | 1617 | ( run_resume src_install || src_install ) | ${SMAGE_LOG_CMD} |
429 | niro | 1593 | die_pipestatus 0 "src_install failed" |
430 | niro | 1617 | resume_stamp src_install |
431 | step_by_step src_install | ||
432 | niro | 1593 | fi |
433 | niro | 943 | fi |
434 | niro | 24 | |
435 | niro | 1593 | # echo for sake of good-looking |
436 | echo | ||
437 | |||
438 | niro | 1584 | if mqueryfeature "!compressdoc" |
439 | niro | 24 | then |
440 | niro | 1584 | echo -e "!compressdoc detected; documentation will not be compressed ..." |
441 | niro | 1595 | elif mqueryfeature "!pkgbuild" |
442 | then | ||
443 | echo "!pkgbuild detected; skipping documentation compression..." | ||
444 | niro | 943 | else |
445 | niro | 1584 | # compressing doc, info & man files |
446 | if [[ -n ${SPLIT_PACKAGES} ]] | ||
447 | then | ||
448 | for subpackage in ${SPLIT_PACKAGES} | ||
449 | do | ||
450 | niro | 1636 | run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage} |
451 | resume_stamp post-mcompressdoc_${subpackage} | ||
452 | niro | 1584 | done |
453 | else | ||
454 | niro | 1636 | run_resume post-mcompressdoc || mcompressdocs ${BINDIR} |
455 | resume_stamp post-mcompressdoc | ||
456 | niro | 1584 | fi |
457 | niro | 24 | fi |
458 | |||
459 | niro | 1584 | if mqueryfeature "!libtool" |
460 | niro | 1580 | then |
461 | niro | 1595 | if mqueryfeature "!pkgbuild" |
462 | then | ||
463 | echo "!pkgbuild detected; skipping libtool archive stripping ..." | ||
464 | else | ||
465 | niro | 1580 | 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 | niro | 1636 | run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage} |
471 | resume_stamp post-mstriplibtoolarchive_${subpackage} | ||
472 | niro | 1580 | done |
473 | else | ||
474 | niro | 1617 | echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}" |
475 | niro | 1636 | run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR} |
476 | resume_stamp post-mstriplibtoolarchive | ||
477 | niro | 1580 | fi |
478 | niro | 1595 | fi |
479 | niro | 1580 | fi |
480 | niro | 24 | |
481 | niro | 1584 | if mqueryfeature "purge" |
482 | niro | 1580 | then |
483 | niro | 1595 | if mqueryfeature "!pkgbuild" |
484 | then | ||
485 | echo "!pkgbuild detected; skipping file purgation..." | ||
486 | else | ||
487 | niro | 1580 | 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 | niro | 1636 | run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage} |
493 | resume_stamp post-mpurgetargets_${subpackage} | ||
494 | niro | 1580 | done |
495 | else | ||
496 | niro | 1617 | echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}" |
497 | niro | 1636 | run_resume post-mpurgetargets || mpurgetargets ${BINDIR} |
498 | resume_stamp post-mpurgetargets | ||
499 | niro | 1580 | fi |
500 | niro | 1595 | fi |
501 | niro | 1580 | fi |
502 | |||
503 | niro | 79 | # stripping all bins and libs |
504 | niro | 1584 | if mqueryfeature "!strip" |
505 | then | ||
506 | echo -e "!strip detected; Package will not be stripped ..." | ||
507 | niro | 1595 | elif mqueryfeature "!pkgbuild" |
508 | then | ||
509 | echo "!pkgbuild detected; skipping stripping of the package ..." | ||
510 | niro | 1584 | else |
511 | niro | 1595 | 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 | niro | 1636 | run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage} |
517 | resume_stamp post-mstripbins_${subpackage} | ||
518 | niro | 1595 | echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}" |
519 | niro | 1636 | run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage} |
520 | resume_stamp post-mstriplibs_${subpackage} | ||
521 | niro | 1595 | echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}" |
522 | niro | 1636 | run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage} |
523 | resume_stamp post-mstripstatic_${subpackage} | ||
524 | niro | 1595 | done |
525 | else | ||
526 | echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" | ||
527 | niro | 1636 | run_resume post-mstripbins || mstripbins ${BINDIR} |
528 | resume_stamp post-mstripbins | ||
529 | niro | 1595 | echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}" |
530 | niro | 1636 | run_resume post-mstriplibs || mstriplibs ${BINDIR} |
531 | resume_stamp post-mstriplibs | ||
532 | niro | 1595 | echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}" |
533 | niro | 1636 | run_resume post-mstripstatic || mstripstatic ${BINDIR} |
534 | resume_stamp post-mstripstatic | ||
535 | niro | 1595 | fi |
536 | niro | 1584 | fi |
537 | niro | 79 | |
538 | niro | 1595 | if mqueryfeature "!pkgbuild" |
539 | niro | 1584 | then |
540 | niro | 1595 | echo -e "!pkgbuild detected; Package will not be build ..." |
541 | niro | 1584 | else |
542 | niro | 306 | # build several targets |
543 | niro | 943 | if [[ -n ${MAGE_TARGETS} ]] |
544 | niro | 192 | then |
545 | for target in ${MAGE_TARGETS} | ||
546 | do | ||
547 | niro | 1573 | # check if a special target_pkgbuild exists |
548 | niro | 192 | if typeset -f ${target}_pkgbuild > /dev/null |
549 | then | ||
550 | # run it | ||
551 | niro | 1636 | run_resume post-${target}_pkgbuild || ${target}_pkgbuild |
552 | resume_stamp post-${target}_pkgbuild | ||
553 | niro | 192 | fi |
554 | # now create the target package | ||
555 | niro | 1636 | run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \ |
556 | niro | 1649 | "${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
557 | niro | 192 | ${BINDIR} || die "target: ${target} package-build failed" |
558 | niro | 1636 | resume_stamp post-pkg_builddir_${target} |
559 | niro | 255 | |
560 | # build pkg-md5-sum if requested | ||
561 | niro | 1636 | run_resume post-md5sum_${target} || generate_package_md5sum \ |
562 | niro | 1641 | --pcat "${PCAT}" \ |
563 | niro | 255 | --pname "${PNAME}" \ |
564 | --pver "${PVER}" \ | ||
565 | --pbuild "${PBUILD}" \ | ||
566 | --parch "${ARCH}" \ | ||
567 | --target "${target}" | ||
568 | niro | 1636 | resume_stamp post-md5sum_${target} |
569 | niro | 255 | |
570 | niro | 1649 | echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD} successfully builded.\n${COLDEFAULT}" |
571 | niro | 192 | done |
572 | niro | 943 | |
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 | niro | 1595 | # jump to next one if !pkgbuild is set in split_info |
584 | mqueryfeature "!pkgbuild" && continue | ||
585 | niro | 947 | |
586 | niro | 943 | # check if an special subpackage_pkgbuild exists |
587 | if typeset -f ${PNAME}_pkgbuild > /dev/null | ||
588 | then | ||
589 | # run it | ||
590 | niro | 1636 | run_resume post-${PNAME}_pkgbuild || ${PNAME}_pkgbuild |
591 | resume_stamp post-${PNAME}_pkgbuild | ||
592 | niro | 943 | fi |
593 | # now create the target package | ||
594 | niro | 1636 | run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \ |
595 | niro | 1649 | "${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD}" \ |
596 | niro | 943 | "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed" |
597 | niro | 1636 | resume_stamp post-pkg_builddir_${PNAME} |
598 | niro | 943 | |
599 | # build pkg-md5-sum if requested | ||
600 | niro | 1636 | run_resume post-md5sum_${PNAME} || generate_package_md5sum \ |
601 | niro | 1641 | --pcat "${PCAT}" \ |
602 | niro | 943 | --pname "${PNAME}" \ |
603 | --pver "${PVER}" \ | ||
604 | --pbuild "${PBUILD}" \ | ||
605 | --parch "${ARCH}" | ||
606 | niro | 1636 | resume_stamp post-md5sum_${PNAME} |
607 | niro | 943 | |
608 | niro | 1649 | echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}$(print_distrotag)-${PBUILD} successfully builded.\n${COLDEFAULT}" |
609 | niro | 951 | |
610 | # restore smage environment | ||
611 | split_restore_variables | ||
612 | niro | 943 | done |
613 | niro | 951 | # unset all saved smage variables |
614 | split_unset_variables | ||
615 | niro | 943 | |
616 | niro | 192 | else |
617 | niro | 1636 | run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed" |
618 | resume_stamp post-pkg_builddir | ||
619 | niro | 255 | |
620 | # build pkg-md5-sum if requested | ||
621 | niro | 1636 | run_resume post-md5sum || generate_package_md5sum \ |
622 | niro | 1641 | --pcat "${PCAT}" \ |
623 | niro | 255 | --pname "${PNAME}" \ |
624 | --pver "${PVER}" \ | ||
625 | --pbuild "${PBUILD}" \ | ||
626 | --parch "${ARCH}" | ||
627 | niro | 1636 | resume_stamp post-md5sum |
628 | niro | 255 | |
629 | niro | 439 | echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}" |
630 | niro | 192 | fi |
631 | niro | 403 | |
632 | # build src-pkg-tarball if requested | ||
633 | niro | 1635 | if mqueryfeature "srcpkgbuild" |
634 | niro | 1617 | then |
635 | niro | 1636 | run_resume post-srcpkgbuild || source_pkg_build ${SMAGENAME} |
636 | resume_stamp post-srcpkgbuild | ||
637 | niro | 1617 | fi |
638 | niro | 1584 | fi |
639 | niro | 24 | |
640 | niro | 1584 | if mqueryfeature "buildlog" |
641 | niro | 875 | 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 | niro | 24 | xtitleclean |
Properties
Name | Value |
---|---|
svn:executable | * |