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.59 2007-11-05 16:47:10 niro Exp $ |
# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $ |
8 |
|
|
9 |
#01.10.2004 |
#01.10.2004 |
10 |
# added ccache support |
# added ccache support |
20 |
SMAGESUFFIX="smage2" |
SMAGESUFFIX="smage2" |
21 |
MLIBDIR=/usr/lib/mage |
MLIBDIR=/usr/lib/mage |
22 |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
SMAGEVERSION="$( < ${MLIBDIR}/version)" |
23 |
|
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
24 |
|
|
25 |
|
|
26 |
## only for tests -> normally in /etc/rc.d/init.d/functions |
## only for tests -> normally in /etc/rc.d/init.d/functions |
27 |
COLRED="\033[1;6m\033[31m" |
COLRED="\033[1;6m\033[31m" |
188 |
--tries 3 \ |
--tries 3 \ |
189 |
--continue \ |
--continue \ |
190 |
--progress bar \ |
--progress bar \ |
191 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
192 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
193 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
194 |
then |
then |
212 |
--tries 3 \ |
--tries 3 \ |
213 |
--continue \ |
--continue \ |
214 |
--progress bar \ |
--progress bar \ |
215 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
216 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
217 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
218 |
then |
then |
236 |
--tries 3 \ |
--tries 3 \ |
237 |
--continue \ |
--continue \ |
238 |
--progress bar \ |
--progress bar \ |
239 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
240 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
241 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
242 |
then |
then |
260 |
--tries 3 \ |
--tries 3 \ |
261 |
--continue \ |
--continue \ |
262 |
--progress bar \ |
--progress bar \ |
263 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
264 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
265 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
266 |
then |
then |
284 |
--tries 3 \ |
--tries 3 \ |
285 |
--continue \ |
--continue \ |
286 |
--progress bar \ |
--progress bar \ |
287 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
288 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
289 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
290 |
then |
then |
303 |
--tries 3 \ |
--tries 3 \ |
304 |
--continue \ |
--continue \ |
305 |
--progress bar \ |
--progress bar \ |
306 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
307 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
308 |
fi |
fi |
309 |
fi |
fi |
364 |
./configure \ |
./configure \ |
365 |
--prefix=/usr \ |
--prefix=/usr \ |
366 |
--host=${CHOST} \ |
--host=${CHOST} \ |
367 |
|
--build=${CHOST} \ |
368 |
--mandir=/usr/share/man \ |
--mandir=/usr/share/man \ |
369 |
--infodir=/usr/share/info \ |
--infodir=/usr/share/info \ |
370 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
442 |
popd > /dev/null |
popd > /dev/null |
443 |
fi |
fi |
444 |
;; |
;; |
445 |
tbz2) |
tbz2|mpks|mpk) |
446 |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed." |
tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed." |
447 |
;; |
;; |
448 |
tgz) |
tgz) |
451 |
rar) |
rar) |
452 |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST} || die ".rar unpack failed." |
453 |
;; |
;; |
454 |
zip) |
zip|xpi) |
455 |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed." |
456 |
;; |
;; |
457 |
rpm) |
rpm) |
458 |
pushd ${BUILDDIR} > /dev/null |
pushd ${DEST} > /dev/null |
459 |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed." |
460 |
tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz/} || die "tar: .rpm unpack failed." |
tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed." |
461 |
[[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} |
if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]] |
462 |
|
then |
463 |
|
rm ${DEST}/${SRCFILE/.rpm/.tar.gz} |
464 |
|
fi |
465 |
;; |
;; |
466 |
*) |
*) |
467 |
die "munpack failed" |
die "munpack failed" |
653 |
# special tags: |
# special tags: |
654 |
# PKGTYPE type of pkg |
# PKGTYPE type of pkg |
655 |
# INHERITS which functions get included |
# INHERITS which functions get included |
656 |
# SPECIAL_FUNCTIONS special functions wich should also be added |
# SPECIAL_FUNCTIONS special functions which should also be added |
657 |
# warning: they get killed before the build starts ! |
# warning: they get killed before the build starts ! |
658 |
# |
# |
659 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
689 |
> ${dest} |
> ${dest} |
690 |
|
|
691 |
# header |
# header |
692 |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.59 2007-11-05 16:47:10 niro Exp $' >> ${dest} |
echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest} |
693 |
echo >> ${dest} |
echo >> ${dest} |
694 |
|
|
695 |
# pgkname and state |
# pgkname and state |
939 |
echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}" |
echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}" |
940 |
} |
} |
941 |
|
|
942 |
|
step_by_step() |
943 |
|
{ |
944 |
|
if [[ ${STEP_BY_STEP} = true ]] |
945 |
|
then |
946 |
|
echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
947 |
|
echo "Press [enter] to continue" |
948 |
|
read |
949 |
|
fi |
950 |
|
} |
951 |
|
|
952 |
|
|
953 |
# print out our version |
# print out our version |
954 |
showversion |
showversion |
1215 |
mage rmstamp |
mage rmstamp |
1216 |
fi |
fi |
1217 |
|
|
1218 |
src_prepare || die "src_prepare failed" |
# setup build loggins |
1219 |
src_compile || die "src_compile failed" |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1220 |
src_install || die "src_install failed" |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1221 |
|
|
1222 |
|
src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD} |
1223 |
|
step_by_step $_ |
1224 |
|
src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD} |
1225 |
|
step_by_step $_ |
1226 |
|
src_install || die "src_install failed" | ${SMAGE_LOG_CMD} |
1227 |
|
step_by_step $_ |
1228 |
|
|
1229 |
|
|
1230 |
# compressing doc, info & man files |
# compressing doc, info & man files |
1305 |
;; |
;; |
1306 |
esac |
esac |
1307 |
|
|
1308 |
|
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
1309 |
|
then |
1310 |
|
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1311 |
|
else |
1312 |
|
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1313 |
|
fi |
1314 |
|
|
1315 |
# for sure |
# for sure |
1316 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1317 |
unset NOSTRIP |
unset NOSTRIP |