50 |
|
|
51 |
source /etc/mage.rc.global |
source /etc/mage.rc.global |
52 |
source ${MAGERC} |
source ${MAGERC} |
53 |
|
source ${MLIBDIR}/mage4.functions.sh |
54 |
|
|
55 |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
# set PKGDIR and BUILDDIR and BINDIR to MROOT |
56 |
if [[ -n ${MROOT} ]] |
if [[ -n ${MROOT} ]] |
60 |
export BINDIR=${MROOT}/${BINDIR} |
export BINDIR=${MROOT}/${BINDIR} |
61 |
fi |
fi |
62 |
|
|
63 |
|
# sources the smage file and uses state from distribution file if exist |
64 |
|
# may helpful for repository support later on |
65 |
|
smagesource() |
66 |
|
{ |
67 |
|
local file="$1" |
68 |
|
local mystate |
69 |
|
local mycodename |
70 |
|
|
71 |
|
source ${file} |
72 |
|
|
73 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
74 |
|
|
75 |
|
# do not overide if local state was broken or disabled! |
76 |
|
case ${STATE} in |
77 |
|
broken) return ;; |
78 |
|
disabled) return ;; |
79 |
|
esac |
80 |
|
|
81 |
|
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
82 |
|
then |
83 |
|
source ${SMAGESCRIPTSDIR}/distribution |
84 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
85 |
|
fi |
86 |
|
# now switch state and export it |
87 |
|
STATE="${mystate}" |
88 |
|
} |
89 |
|
|
90 |
showversion() |
showversion() |
91 |
{ |
{ |
92 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
181 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
182 |
local FETCHING |
local FETCHING |
183 |
local i mirror |
local i mirror |
184 |
|
local wget_opts |
185 |
|
|
186 |
|
# filter wget command if busybox was found |
187 |
|
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
188 |
|
|
189 |
# install SRCDIR/PNAME if not exist |
# install SRCDIR/PNAME if not exist |
190 |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
191 |
|
|
192 |
# check if FETCHING is needed |
# check if FETCHING is needed |
193 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null ) |
194 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
195 |
then |
then |
196 |
# md5's ok, no fetching needed |
# md5's ok, no fetching needed |
229 |
then |
then |
230 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
231 |
wget \ |
wget \ |
232 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
233 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
234 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
235 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
250 |
then |
then |
251 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
252 |
wget \ |
wget \ |
253 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
254 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
255 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
256 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
271 |
then |
then |
272 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
273 |
wget \ |
wget \ |
274 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
275 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
276 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
277 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
292 |
then |
then |
293 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
294 |
wget \ |
wget \ |
295 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
296 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
297 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
298 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
313 |
then |
then |
314 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
315 |
wget \ |
wget \ |
316 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
317 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
318 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
319 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
329 |
then |
then |
330 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
331 |
wget \ |
wget \ |
332 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
333 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
334 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
335 |
fi |
fi |
345 |
# recheck md5 sums |
# recheck md5 sums |
346 |
echo |
echo |
347 |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
348 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
349 |
echo |
echo |
350 |
|
|
351 |
# not needed anymore |
# not needed anymore |
533 |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
534 |
} |
} |
535 |
|
|
536 |
|
mautoreconf() |
537 |
|
{ |
538 |
|
local opts="$@" |
539 |
|
[[ -z ${opts} ]] && opts="--verbose --install --force" |
540 |
|
|
541 |
|
autoreconf ${opts} || die "running: mautoreconf ${opts}" |
542 |
|
} |
543 |
|
|
544 |
minstalldocs() |
minstalldocs() |
545 |
{ |
{ |
546 |
local docfiles |
local docfiles |
751 |
# now build the mage file |
# now build the mage file |
752 |
> ${dest} |
> ${dest} |
753 |
|
|
|
# header |
|
|
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} |
|
|
echo >> ${dest} |
|
|
|
|
754 |
# pgkname and state |
# pgkname and state |
755 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
756 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
|
echo >> ${dest} |
|
757 |
|
|
758 |
# description and homepage |
# description and homepage |
759 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
760 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
|
echo >> ${dest} |
|
761 |
|
|
762 |
# special tags and vars |
# special tags and vars |
763 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
764 |
|
|
765 |
# echo MAGE_TARGETS ## note -target is needed ! |
# echo MAGE_TARGETS ## note -target is needed ! |
766 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
echo >> ${dest} |
|
767 |
|
|
768 |
# split package base |
# split package base |
769 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
|
echo >> ${dest} |
|
770 |
|
|
771 |
# add special vars |
# add special vars |
772 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
777 |
# being tricky here :) |
# being tricky here :) |
778 |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
779 |
done |
done |
|
echo >> ${dest} |
|
780 |
fi |
fi |
781 |
|
|
782 |
# add at least all includes |
# add at least all includes |
788 |
do |
do |
789 |
echo -n " ${i}" >> ${dest} |
echo -n " ${i}" >> ${dest} |
790 |
done |
done |
|
echo >> ${dest} |
|
791 |
fi |
fi |
|
echo >> ${dest} |
|
792 |
|
|
793 |
# deps and provides |
# deps and provides |
794 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
795 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
796 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
|
echo >> ${dest} |
|
797 |
|
|
798 |
# add special functions |
# add special functions |
799 |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
803 |
do |
do |
804 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
805 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
echo >> ${dest} |
|
806 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
807 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
808 |
done |
done |
|
echo >> ${dest} |
|
809 |
fi |
fi |
810 |
|
|
811 |
# pre|post-install|removes |
# pre|post-install|removes |
812 |
typeset -f preinstall >> ${dest} |
typeset -f preinstall >> ${dest} |
|
echo >> ${dest} |
|
813 |
typeset -f postinstall >> ${dest} |
typeset -f postinstall >> ${dest} |
|
echo >> ${dest} |
|
814 |
typeset -f preremove >> ${dest} |
typeset -f preremove >> ${dest} |
|
echo >> ${dest} |
|
815 |
typeset -f postremove >> ${dest} |
typeset -f postremove >> ${dest} |
|
echo >> ${dest} |
|
816 |
} |
} |
817 |
|
|
818 |
regen_mage_tree() |
regen_mage_tree() |
1189 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
1190 |
if [[ $1 = calcmd5 ]] |
if [[ $1 = calcmd5 ]] |
1191 |
then |
then |
1192 |
if [ $# -ge 3 ] |
if [ $# -ge 2 ] |
1193 |
then |
then |
1194 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1195 |
MD5DIR="$3" |
MD5DIR="$3" |
1196 |
source ${SMAGENAME} || die "download source failed" |
[[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
1197 |
|
|
1198 |
|
smagesource ${SMAGENAME} || die "download source failed" |
1199 |
|
|
1200 |
# overridable sourcedir; must be declared after source of the smage2 |
# overridable sourcedir; must be declared after source of the smage2 |
1201 |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
1247 |
echo |
echo |
1248 |
else |
else |
1249 |
echo "Usage: Calculating MD5 Sums:" |
echo "Usage: Calculating MD5 Sums:" |
1250 |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR" |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
1251 |
echo |
echo |
1252 |
echo |
echo |
1253 |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
1269 |
# get smage |
# get smage |
1270 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1271 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1272 |
source ${SMAGENAME} || die "download source failed" |
smagesource ${SMAGENAME} || die "download source failed" |
1273 |
|
|
1274 |
download_sources |
download_sources |
1275 |
exit 0 |
exit 0 |
1281 |
# set correct SMAGENAME |
# set correct SMAGENAME |
1282 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1283 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1284 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1285 |
|
|
1286 |
regen_mage_tree |
regen_mage_tree |
1287 |
|
|
1304 |
elif [[ -n ${SPLIT_PACKAGES} ]] |
elif [[ -n ${SPLIT_PACKAGES} ]] |
1305 |
then |
then |
1306 |
split_save_variables |
split_save_variables |
1307 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1308 |
do |
do |
1309 |
# get the right variables for the split |
# get the right variables for the split |
1310 |
export PNAME="${subpackage}" |
export PNAME="${subpackage}" |
1343 |
|
|
1344 |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
1345 |
|
|
1346 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1347 |
|
|
1348 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
1349 |
then |
then |
1392 |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
1393 |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
1394 |
|
|
1395 |
source ${SMAGENAME} || die "source failed" |
smagesource ${SMAGENAME} || die "source failed" |
1396 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1397 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1398 |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1522 |
# compressing doc, info & man files |
# compressing doc, info & man files |
1523 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1524 |
then |
then |
1525 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1526 |
do |
do |
1527 |
mcompressdocs ${BINDIR}_${subpackage} |
mcompressdocs ${BINDIR}_${subpackage} |
1528 |
done |
done |
1539 |
*) |
*) |
1540 |
if [[ -n ${SPLIT_PACKAGES} ]] |
if [[ -n ${SPLIT_PACKAGES} ]] |
1541 |
then |
then |
1542 |
for subpackage in ${SPLIT_PACKAGE} |
for subpackage in ${SPLIT_PACKAGES} |
1543 |
do |
do |
1544 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1545 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1546 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
1547 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1548 |
done |
done |
1549 |
else |
else |