73 |
exit 1 |
exit 1 |
74 |
} |
} |
75 |
|
|
76 |
|
die_pipestatus() |
77 |
|
{ |
78 |
|
local pos="$1" |
79 |
|
local comment="$2" |
80 |
|
|
81 |
|
[ ${PIPESTATUS[${pos}]} -gt 0 ] && die "${comment}" |
82 |
|
} |
83 |
|
|
84 |
xtitle() |
xtitle() |
85 |
{ |
{ |
86 |
if [[ ${TERM} = xterm ]] |
if [[ ${TERM} = xterm ]] |
179 |
my_SOURCEDIR="${SOURCEDIR}/${PNAME}" |
my_SOURCEDIR="${SOURCEDIR}/${PNAME}" |
180 |
fi |
fi |
181 |
|
|
182 |
|
# create the SOURCEDIR |
183 |
|
install -d ${my_SOURCEDIR} |
184 |
|
|
185 |
# if an mirrored file than replace first the mirror uri |
# if an mirrored file than replace first the mirror uri |
186 |
if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]] |
if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]] |
187 |
then |
then |
197 |
--tries 3 \ |
--tries 3 \ |
198 |
--continue \ |
--continue \ |
199 |
--progress bar \ |
--progress bar \ |
200 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
201 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
202 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
203 |
then |
then |
221 |
--tries 3 \ |
--tries 3 \ |
222 |
--continue \ |
--continue \ |
223 |
--progress bar \ |
--progress bar \ |
224 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
225 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
226 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
227 |
then |
then |
245 |
--tries 3 \ |
--tries 3 \ |
246 |
--continue \ |
--continue \ |
247 |
--progress bar \ |
--progress bar \ |
248 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
249 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
250 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
251 |
then |
then |
269 |
--tries 3 \ |
--tries 3 \ |
270 |
--continue \ |
--continue \ |
271 |
--progress bar \ |
--progress bar \ |
272 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
273 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
274 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
275 |
then |
then |
293 |
--tries 3 \ |
--tries 3 \ |
294 |
--continue \ |
--continue \ |
295 |
--progress bar \ |
--progress bar \ |
296 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
297 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
298 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
299 |
then |
then |
312 |
--tries 3 \ |
--tries 3 \ |
313 |
--continue \ |
--continue \ |
314 |
--progress bar \ |
--progress bar \ |
315 |
--directory-prefix="${my_SOURCEDIR}" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
316 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
317 |
fi |
fi |
318 |
fi |
fi |
373 |
./configure \ |
./configure \ |
374 |
--prefix=/usr \ |
--prefix=/usr \ |
375 |
--host=${CHOST} \ |
--host=${CHOST} \ |
376 |
|
--build=${CHOST} \ |
377 |
--mandir=/usr/share/man \ |
--mandir=/usr/share/man \ |
378 |
--infodir=/usr/share/info \ |
--infodir=/usr/share/info \ |
379 |
--datadir=/usr/share \ |
--datadir=/usr/share \ |
662 |
# special tags: |
# special tags: |
663 |
# PKGTYPE type of pkg |
# PKGTYPE type of pkg |
664 |
# INHERITS which functions get included |
# INHERITS which functions get included |
665 |
# SPECIAL_FUNCTIONS special functions wich should also be added |
# SPECIAL_FUNCTIONS special functions which should also be added |
666 |
# warning: they get killed before the build starts ! |
# warning: they get killed before the build starts ! |
667 |
# |
# |
668 |
# MAGE_TREE_DEST target destination of the generated tree |
# MAGE_TREE_DEST target destination of the generated tree |
891 |
# fix target as it may be empty ! |
# fix target as it may be empty ! |
892 |
[ -n "${target}" ] && target="-${target}" |
[ -n "${target}" ] && target="-${target}" |
893 |
|
|
894 |
|
|
895 |
# build pkgname |
# build pkgname |
896 |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
pkgname="${pname}${target}-${pver}-${parch}-${pbuild}" |
897 |
|
|
911 |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
: ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree} |
912 |
|
|
913 |
# setup md5 dir |
# setup md5 dir |
914 |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5" |
dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5" |
915 |
install -d ${dest} |
install -d ${dest} |
916 |
|
|
917 |
# gen md5sum |
# gen md5sum |
949 |
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}" |
950 |
} |
} |
951 |
|
|
952 |
|
step_by_step() |
953 |
|
{ |
954 |
|
if [[ ${STEP_BY_STEP} = true ]] |
955 |
|
then |
956 |
|
echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}" |
957 |
|
echo "Press [enter] to continue" |
958 |
|
read |
959 |
|
fi |
960 |
|
} |
961 |
|
|
962 |
|
|
963 |
# print out our version |
# print out our version |
964 |
showversion |
showversion |
1079 |
|
|
1080 |
regen_mage_tree |
regen_mage_tree |
1081 |
|
|
1082 |
# build md5sum for existing packages |
# build several targets |
1083 |
generate_package_md5sum \ |
if [ -n "${MAGE_TARGETS}" ] |
1084 |
--pcat "${PCATEGORIE}" \ |
then |
1085 |
--pname "${PNAME}" \ |
for target in ${MAGE_TARGETS} |
1086 |
--pver "${PVER}" \ |
do |
1087 |
--pbuild "${PBUILD}" \ |
# build md5sum for existing packages |
1088 |
--parch "${ARCH}" \ |
generate_package_md5sum \ |
1089 |
--target "${target}" |
--pcat "${PCATEGORIE}" \ |
1090 |
|
--pname "${PNAME}" \ |
1091 |
|
--pver "${PVER}" \ |
1092 |
|
--pbuild "${PBUILD}" \ |
1093 |
|
--parch "${ARCH}" \ |
1094 |
|
--target "${target}" |
1095 |
|
done |
1096 |
|
else |
1097 |
|
# build md5sum for existing packages |
1098 |
|
generate_package_md5sum \ |
1099 |
|
--pcat "${PCATEGORIE}" \ |
1100 |
|
--pname "${PNAME}" \ |
1101 |
|
--pver "${PVER}" \ |
1102 |
|
--pbuild "${PBUILD}" \ |
1103 |
|
--parch "${ARCH}" \ |
1104 |
|
--target "${target}" |
1105 |
|
fi |
1106 |
|
|
1107 |
exit 0 |
exit 0 |
1108 |
fi |
fi |
1167 |
source ${SMAGENAME} || die "source failed" |
source ${SMAGENAME} || die "source failed" |
1168 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1169 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1170 |
|
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1171 |
|
|
1172 |
xtitle "Compiling ${PKGNAME}" |
xtitle "Compiling ${PKGNAME}" |
1173 |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}" |
1242 |
mage rmstamp |
mage rmstamp |
1243 |
fi |
fi |
1244 |
|
|
1245 |
src_prepare || die "src_prepare failed" |
# setup build loggins |
1246 |
src_compile || die "src_compile failed" |
[[ ! -d /var/log/smage ]] && install -d /var/log/smage |
1247 |
src_install || die "src_install failed" |
echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log |
1248 |
|
|
1249 |
|
src_prepare | ${SMAGE_LOG_CMD} |
1250 |
|
die_pipestatus 0 "src_prepare failed" |
1251 |
|
step_by_step $_ |
1252 |
|
|
1253 |
|
src_compile | ${SMAGE_LOG_CMD} |
1254 |
|
die_pipestatus 0 "src_compile failed" |
1255 |
|
step_by_step $_ |
1256 |
|
|
1257 |
|
src_install | ${SMAGE_LOG_CMD} |
1258 |
|
die_pipestatus 0 "src_install failed" |
1259 |
|
step_by_step $_ |
1260 |
|
|
1261 |
|
|
1262 |
# compressing doc, info & man files |
# compressing doc, info & man files |
1337 |
;; |
;; |
1338 |
esac |
esac |
1339 |
|
|
1340 |
|
if [[ ${SMAGE_BUILD_LOGGING} != false ]] |
1341 |
|
then |
1342 |
|
bzip2 -9f /var/log/smage/${PKGNAME}.log |
1343 |
|
else |
1344 |
|
[[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log |
1345 |
|
fi |
1346 |
|
|
1347 |
# for sure |
# for sure |
1348 |
unset NOPKGBUILD |
unset NOPKGBUILD |
1349 |
unset NOSTRIP |
unset NOSTRIP |