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 |
|
if [ -f ${SMAGESCRIPTSDIR}/distribution ] |
75 |
|
then |
76 |
|
source ${SMAGESCRIPTSDIR}/distribution |
77 |
|
[[ -n ${STATE} ]] && mystate="${STATE}" |
78 |
|
fi |
79 |
|
# now switch state and export it |
80 |
|
STATE="${mystate}" |
81 |
|
} |
82 |
|
|
83 |
showversion() |
showversion() |
84 |
{ |
{ |
85 |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
echo -en "Magellan Source Install v${SMAGEVERSION} " |
174 |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5" |
175 |
local FETCHING |
local FETCHING |
176 |
local i mirror |
local i mirror |
177 |
|
local wget_opts |
178 |
|
|
179 |
|
# filter wget command if busybox was found |
180 |
|
wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})" |
181 |
|
|
182 |
# install SRCDIR/PNAME if not exist |
# install SRCDIR/PNAME if not exist |
183 |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
[ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME} |
184 |
|
|
185 |
# check if FETCHING is needed |
# check if FETCHING is needed |
186 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null ) |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null ) |
187 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
188 |
then |
then |
189 |
# md5's ok, no fetching needed |
# md5's ok, no fetching needed |
222 |
then |
then |
223 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
224 |
wget \ |
wget \ |
225 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
226 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
227 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
228 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
243 |
then |
then |
244 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
245 |
wget \ |
wget \ |
246 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
247 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
248 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
249 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
264 |
then |
then |
265 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
266 |
wget \ |
wget \ |
267 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
268 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
269 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
270 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
285 |
then |
then |
286 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
287 |
wget \ |
wget \ |
288 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
289 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
290 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
291 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
306 |
then |
then |
307 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}" |
308 |
wget \ |
wget \ |
309 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
310 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \ |
311 |
"${my_SRC_URI_MIRROR}" |
"${my_SRC_URI_MIRROR}" |
312 |
if [[ $? = 0 ]] |
if [[ $? = 0 ]] |
322 |
then |
then |
323 |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}" |
324 |
wget \ |
wget \ |
325 |
--passive-ftp \ |
${wget_opts} \ |
|
--tries 3 \ |
|
|
--continue \ |
|
|
--progress bar \ |
|
326 |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
--output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \ |
327 |
"${my_SRC_URI}" |
"${my_SRC_URI}" |
328 |
fi |
fi |
338 |
# recheck md5 sums |
# recheck md5 sums |
339 |
echo |
echo |
340 |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}" |
341 |
( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed" |
342 |
echo |
echo |
343 |
|
|
344 |
# not needed anymore |
# not needed anymore |
526 |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
libtoolize ${opts} || die "running: mlibtoolize ${opts}" |
527 |
} |
} |
528 |
|
|
529 |
|
mautoreconf() |
530 |
|
{ |
531 |
|
local opts="$@" |
532 |
|
[[ -z ${opts} ]] && opts="--verbose --install --force" |
533 |
|
|
534 |
|
autoreconf ${opts} || die "running: mautoreconf ${opts}" |
535 |
|
} |
536 |
|
|
537 |
minstalldocs() |
minstalldocs() |
538 |
{ |
{ |
539 |
local docfiles |
local docfiles |
744 |
# now build the mage file |
# now build the mage file |
745 |
> ${dest} |
> ${dest} |
746 |
|
|
|
# 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} |
|
|
|
|
747 |
# pgkname and state |
# pgkname and state |
748 |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest} |
749 |
echo "STATE=\"${STATE}\"" >> ${dest} |
echo "STATE=\"${STATE}\"" >> ${dest} |
|
echo >> ${dest} |
|
750 |
|
|
751 |
# description and homepage |
# description and homepage |
752 |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest} |
753 |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest} |
|
echo >> ${dest} |
|
754 |
|
|
755 |
# special tags and vars |
# special tags and vars |
756 |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
echo "PKGTYPE=\"${PKGTYPE}\"" >> ${dest} |
757 |
|
|
758 |
# echo MAGE_TARGETS ## note -target is needed ! |
# echo MAGE_TARGETS ## note -target is needed ! |
759 |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
echo "MAGE_TARGETS=\"${target}\"" >> ${dest} |
|
echo >> ${dest} |
|
760 |
|
|
761 |
# split package base |
# split package base |
762 |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest} |
|
echo >> ${dest} |
|
763 |
|
|
764 |
# add special vars |
# add special vars |
765 |
if [ -n "${SPECIAL_VARS}" ] |
if [ -n "${SPECIAL_VARS}" ] |
770 |
# being tricky here :) |
# being tricky here :) |
771 |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
echo "${i}=\"$(eval echo \$${i})\"" >> ${dest} |
772 |
done |
done |
|
echo >> ${dest} |
|
773 |
fi |
fi |
774 |
|
|
775 |
# add at least all includes |
# add at least all includes |
781 |
do |
do |
782 |
echo -n " ${i}" >> ${dest} |
echo -n " ${i}" >> ${dest} |
783 |
done |
done |
|
echo >> ${dest} |
|
784 |
fi |
fi |
|
echo >> ${dest} |
|
785 |
|
|
786 |
# deps and provides |
# deps and provides |
787 |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
788 |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest} |
|
echo >> ${dest} |
|
789 |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
echo "PROVIDE=\"${PROVIDE}\"" >> ${dest} |
|
echo >> ${dest} |
|
790 |
|
|
791 |
# add special functions |
# add special functions |
792 |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
if [ -n "${SPECIAL_FUNCTIONS}" ] |
796 |
do |
do |
797 |
# add to mage (quotes needed !) |
# add to mage (quotes needed !) |
798 |
typeset -f "${i}" >> ${dest} |
typeset -f "${i}" >> ${dest} |
|
echo >> ${dest} |
|
799 |
# unset to be safe (quotes needed !) |
# unset to be safe (quotes needed !) |
800 |
#unset "${i}" <-- later to get every target built |
#unset "${i}" <-- later to get every target built |
801 |
done |
done |
|
echo >> ${dest} |
|
802 |
fi |
fi |
803 |
|
|
804 |
# pre|post-install|removes |
# pre|post-install|removes |
805 |
typeset -f preinstall >> ${dest} |
typeset -f preinstall >> ${dest} |
|
echo >> ${dest} |
|
806 |
typeset -f postinstall >> ${dest} |
typeset -f postinstall >> ${dest} |
|
echo >> ${dest} |
|
807 |
typeset -f preremove >> ${dest} |
typeset -f preremove >> ${dest} |
|
echo >> ${dest} |
|
808 |
typeset -f postremove >> ${dest} |
typeset -f postremove >> ${dest} |
|
echo >> ${dest} |
|
809 |
} |
} |
810 |
|
|
811 |
regen_mage_tree() |
regen_mage_tree() |
1182 |
# creates md5sums for smages to given dir |
# creates md5sums for smages to given dir |
1183 |
if [[ $1 = calcmd5 ]] |
if [[ $1 = calcmd5 ]] |
1184 |
then |
then |
1185 |
if [ $# -ge 3 ] |
if [ $# -ge 2 ] |
1186 |
then |
then |
1187 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1188 |
MD5DIR="$3" |
MD5DIR="$3" |
1189 |
source ${SMAGENAME} || die "download source failed" |
[[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5" |
1190 |
|
|
1191 |
|
smagesource ${SMAGENAME} || die "download source failed" |
1192 |
|
|
1193 |
# overridable sourcedir; must be declared after source of the smage2 |
# overridable sourcedir; must be declared after source of the smage2 |
1194 |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}" |
1240 |
echo |
echo |
1241 |
else |
else |
1242 |
echo "Usage: Calculating MD5 Sums:" |
echo "Usage: Calculating MD5 Sums:" |
1243 |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR" |
echo " $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]" |
1244 |
echo |
echo |
1245 |
echo |
echo |
1246 |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs." |
1262 |
# get smage |
# get smage |
1263 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1264 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1265 |
source ${SMAGENAME} || die "download source failed" |
smagesource ${SMAGENAME} || die "download source failed" |
1266 |
|
|
1267 |
download_sources |
download_sources |
1268 |
exit 0 |
exit 0 |
1274 |
# set correct SMAGENAME |
# set correct SMAGENAME |
1275 |
SMAGENAME="$2" |
SMAGENAME="$2" |
1276 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1277 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1278 |
|
|
1279 |
regen_mage_tree |
regen_mage_tree |
1280 |
|
|
1336 |
|
|
1337 |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}" |
1338 |
|
|
1339 |
source ${SMAGENAME} || die "regen: smage2 not found" |
smagesource ${SMAGENAME} || die "regen: smage2 not found" |
1340 |
|
|
1341 |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
if [[ -d ${SOURCEDIR}/${PNAME} ]] |
1342 |
then |
then |
1385 |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
[ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}" |
1386 |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
[ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}" |
1387 |
|
|
1388 |
source ${SMAGENAME} || die "source failed" |
smagesource ${SMAGENAME} || die "source failed" |
1389 |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}" |
1390 |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
MD5DIR="$(dirname ${SMAGENAME})/md5" |
1391 |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log" |
1534 |
then |
then |
1535 |
for subpackage in ${SPLIT_PACKAGES} |
for subpackage in ${SPLIT_PACKAGES} |
1536 |
do |
do |
1537 |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}" |
1538 |
mstripbins ${BINDIR}_${subpackage} |
mstripbins ${BINDIR}_${subpackage} |
1539 |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}" |
echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}" |
1540 |
mstriplibs ${BINDIR}_${subpackage} |
mstriplibs ${BINDIR}_${subpackage} |
1541 |
done |
done |
1542 |
else |
else |