Magellan Linux

Diff of /trunk/mage/usr/lib/mage/smage2.sh

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 204 by niro, Mon Aug 22 00:07:32 2005 UTC revision 885 by niro, Tue Jun 30 20:19:28 2009 UTC
# Line 4  Line 4 
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.34 2005-08-22 00:07:32 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
11  # added distcc support  # added distcc support
12    
13    # set default user mage.rc
14    : ${MAGERC="/etc/mage.rc"}
15    
16  ## setup ##  ## setup ##
17  PKGSUFFIX="mpk"  PKGSUFFIX="mpk"
18    SRCPKGSUFFIX="mpks"
19  SMAGENAME="$1"  SMAGENAME="$1"
20  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
 #SOURCEDIR="/bootstrap/sources"  
 #SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts"  
 #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"  
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
27    COLRED="\033[1;6m\033[31m"
28    COLGREEN="\033[1;6m\033[32m"
29    COLYELLOW="\033[1;6m\033[33m"
30    COLBLUE="\033[1;6m\033[34m"
31    COLMAGENTA="\033[1;6m\033[35m"
32    COLWHITE="\033[1;6m\033[37m"
33    COLGRAY="\033[0;6m\033[37m"
34    COLBOLD="\033[1m"
35    COLDEFAULT="\033[0m"
36    
37    if [[ ${NOCOLORS} = true ]]
38    then
39     COLRED=""
40     COLGREEN=""
41     COLYELLOW=""
42     COLBLUE=""
43     COLMAGENTA=""
44     COLWHITE=""
45     COLGRAY=""
46     COLBOLD=""
47     COLDEFAULT=""
48    fi
49    
50  # export default C locale  # export default C locale
51  export LC_ALL=C  export LC_ALL=C
52    
53  source /etc/mage.rc  source /etc/mage.rc.global
54    source ${MAGERC}
55    
56  showversion() {  # set PKGDIR and BUILDDIR and BINDIR to MROOT
57    if [[ -n ${MROOT} ]]
58    then
59     export PKGDIR=${MROOT}/${PKGDIR}
60     export BUILDDIR=${MROOT}/${BUILDDIR}
61     export BINDIR=${MROOT}/${BINDIR}
62    fi
63    
64    showversion()
65    {
66   echo -en "Magellan Source Install v${SMAGEVERSION} "   echo -en "Magellan Source Install v${SMAGEVERSION} "
67   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"
68  }  }
69    
70  die() {  die()
71    {
72   xtitleclean   xtitleclean
73     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
74   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
75   exit 1   exit 1
76  }  }
77    
78  xtitle() {  xtitle()
79   if [ ${TERM} == "xterm" ]  {
80     if [[ ${TERM} = xterm ]]
81   then   then
82   echo -ne "\033]0;[sMage: $@]\007"   echo -ne "\033]0;[sMage: $@]\007"
83   fi   fi
84   return 0   return 0
85  }  }
86    
87  xtitleclean() {  xtitleclean()
88   if [ ${TERM} == "xterm" ]  {
89     if [[ ${TERM} = xterm ]]
90   then   then
91   echo -ne "\033]0;\007"   echo -ne "\033]0;\007"
92   fi   fi
93   return 0   return 0
94  }  }
95    
96  syncsmage2() {  syncsmage2()
97    {
98   xtitle "Updating smage2-script tree ..."   xtitle "Updating smage2-script tree ..."
99   local i   local i
100   for i in ${SMAGE2RSYNC}   for i in ${SMAGE2RSYNC}
101   do   do
102   rsync \   rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR}
103   --recursive \   if [[ $? = 0 ]]
  --links \  
  --perms \  
  --times \  
  --devices \  
  --timeout=600 \  
  --verbose \  
  --compress \  
  --progress \  
  --stats \  
  --delete \  
  --delete-after \  
  ${i} ${SMAGESCRIPTSDIR}  
   
  if [ "$?" == "0" ]  
104   then   then
105   break   break
106   else   else
107   continue   continue
108   fi   fi
   
109   done   done
110    
111   #clean up backup files (foo~)   # clean up backup files (foo~)
112   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'
113    
114   xtitleclean   xtitleclean
115  }  }
116    
117  # $1 filename  # $1 filename
118  get_db_md5_sum() {  get_db_md5_sum()
119    {
120   local DB_FILE   local DB_FILE
121   local MD5_FILE   local MD5_FILE
122   local i   local i
# Line 101  get_db_md5_sum() { Line 129  get_db_md5_sum() {
129   echo "${i}"   echo "${i}"
130  }  }
131    
132  download_sources() {  download_sources()
133    {
134    
135   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
136    
# Line 113  download_sources() { Line 142  download_sources() {
142   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
143   local FETCHING   local FETCHING
144   local i mirror   local i mirror
   
145    
146   #install SRCDIR/PNAME if not exist  
147     # install SRCDIR/PNAME if not exist
148   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
149    
150   # check if FETCHING is needed   # check if FETCHING is needed
151   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
152   if [[ $? == 0 ]]   if [[ $? = 0 ]]
153   then   then
154   # md5's ok, not fetching needed   # md5's ok, no fetching needed
155   FETCHING=false   FETCHING=false
156   else   else
157   FETCHING=true   FETCHING=true
158   fi   fi
159    
160   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
161   do   do
162   # url to file   # url to file
# Line 144  download_sources() { Line 173  download_sources() {
173   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
174   fi   fi
175    
176     # create the SOURCEDIR
177     install -d ${my_SOURCEDIR}
178    
179   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
180   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
181   then   then
182   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
183   do   do
184   my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"   my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"
185    
186   #echo "DEBUG: ${MY_SRC_URI}"   if [[ ${FETCHING} = true ]]
187   if [[ ${FETCHING} == true ]]   then
188     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
189     wget \
190     --passive-ftp \
191     --tries 3 \
192     --continue \
193     --progress bar \
194     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
195     "${my_SRC_URI_MIRROR}"
196     if [[ $? = 0 ]]
197     then
198     break
199     else
200     continue
201     fi
202     fi
203     done
204     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
205     then
206     for mirror in ${SOURCEFORGE_MIRRORS}
207     do
208     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
209    
210     if [[ ${FETCHING} = true ]]
211     then
212     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
213     wget \
214     --passive-ftp \
215     --tries 3 \
216     --continue \
217     --progress bar \
218     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
219     "${my_SRC_URI_MIRROR}"
220     if [[ $? = 0 ]]
221     then
222     break
223     else
224     continue
225     fi
226     fi
227     done
228     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
229     then
230     for mirror in ${GNU_MIRRORS}
231     do
232     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
233    
234     if [[ ${FETCHING} = true ]]
235     then
236     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
237     wget \
238     --passive-ftp \
239     --tries 3 \
240     --continue \
241     --progress bar \
242     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
243     "${my_SRC_URI_MIRROR}"
244     if [[ $? = 0 ]]
245     then
246     break
247     else
248     continue
249     fi
250     fi
251     done
252     elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]
253     then
254     for mirror in ${KDE_MIRRORS}
255     do
256     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"
257    
258     if [[ ${FETCHING} = true ]]
259   then   then
260   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
261   wget \   wget \
262   --passive-ftp \   --passive-ftp \
263   --tries 3 \   --tries 3 \
264   --continue \   --continue \
265   --progress bar \   --progress bar \
266   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
267   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
268   if [ "$?" == "0" ]   if [[ $? = 0 ]]
269     then
270     break
271     else
272     continue
273     fi
274     fi
275     done
276     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]
277     then
278     for mirror in ${GNOME_MIRRORS}
279     do
280     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"
281    
282     if [[ ${FETCHING} = true ]]
283     then
284     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
285     wget \
286     --passive-ftp \
287     --tries 3 \
288     --continue \
289     --progress bar \
290     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
291     "${my_SRC_URI_MIRROR}"
292     if [[ $? = 0 ]]
293   then   then
294   break   break
295   else   else
# Line 171  download_sources() { Line 298  download_sources() {
298   fi   fi
299   done   done
300   else   else
301   #echo "DEBUG: ${SRC_URI[${i}]}"   if [[ ${FETCHING} = true ]]
  if [[ ${FETCHING} == true ]]  
302   then   then
303   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
304   wget \   wget \
305   --passive-ftp \   --passive-ftp \
306   --tries 3 \   --tries 3 \
307   --continue \   --continue \
308   --progress bar \   --progress bar \
309   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
310   "${my_SRC_URI}"   "${my_SRC_URI}"
 # only needed to run through a list of mirrors  
 # if [ "$?" == "0" ]  
 # then  
 # break  
 # else  
 # continue  
 # fi  
311   fi   fi
312   fi   fi
313    
314   # unset them to be shure   # unset them to be shure
315   unset my_SRC_URI   unset my_SRC_URI
316   unset my_SRC_URI_DEST   unset my_SRC_URI_DEST
# Line 201  download_sources() { Line 320  download_sources() {
320    
321   # recheck md5 sums   # recheck md5 sums
322   echo   echo
323   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
324   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"
325   echo   echo
326    
# Line 210  download_sources() { Line 329  download_sources() {
329  }  }
330    
331  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
332  src_prepare() {  src_prepare()
333    {
334   echo "no src_prepare defined"   echo "no src_prepare defined"
335   sleep 2   sleep 2
336   return 0   return 0
337  }  }
338    
339  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
340  src_compile() {  src_compile()
341    {
342   echo "no src_compile defined"   echo "no src_compile defined"
343   sleep 2   sleep 2
344   return 0   return 0
345  }  }
346    
347  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
348  src_install() {  src_install()
349    {
350   echo "no src_install defined"   echo "no src_install defined"
351   sleep 2   sleep 2
352   return 0   return 0
353  }  }
354    
355  mconfigure() {  mlibdir()
356    {
357     local libdir=lib
358     [[ ${ARCH} = x86_64 ]] && libdir=lib64
359    
360     echo "${libdir}"
361    }
362    
363    mconfigure()
364    {
365   if [ -x ./configure ]   if [ -x ./configure ]
366   then   then
367   ./configure \   ./configure \
368   --prefix=/usr \   --prefix=/usr \
369   --host=${CHOST} \   --host=${CHOST} \
370   --mandir=/usr/share/man \   --build=${CHOST} \
371   --infodir=/usr/share/info \   --mandir=/usr/share/man \
372   --datadir=/usr/share \   --infodir=/usr/share/info \
373   --sysconfdir=/etc \   --datadir=/usr/share \
374   --localstatedir=/var/lib \   --sysconfdir=/etc \
375   "$@" || die "mconfigure failed"   --localstatedir=/var/lib \
376     --libdir=/usr/$(mlibdir) \
377     "$@" || die "mconfigure failed"
378   else   else
379   echo "configure is not an executable ..."   echo "configure is not an executable ..."
380   exit 1   exit 1
381   fi   fi
382  }  }
383    
384  minstall() {  minstall()
385   if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then  {
386     if [ -f ./[mM]akefile -o -f ./GNUmakefile ]
387     then
388   make prefix=${BINDIR}/usr \   make prefix=${BINDIR}/usr \
389   datadir=${BINDIR}/usr/share \   datadir=${BINDIR}/usr/share \
390   infodir=${BINDIR}/usr/share/info \   infodir=${BINDIR}/usr/share/info \
391   localstatedir=${BINDIR}/var/lib \   localstatedir=${BINDIR}/var/lib \
392   mandir=${BINDIR}/usr/share/man \   mandir=${BINDIR}/usr/share/man \
393   sysconfdir=${BINDIR}/etc \   sysconfdir=${BINDIR}/etc \
394     libdir=${BINDIR}/usr/$(mlibdir) \
395   "$@" install || die "minstall failed"   "$@" install || die "minstall failed"
396          else          else
397                  die "no Makefile found"                  die "no Makefile found"
398          fi          fi
399  }  }
400    
401  mmake() {  mmake()
402    {
403   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
404  }  }
405    
406  munpack() {  munpack()
407    {
408   local SRCFILE   local SRCFILE
409   local IFTAR   local IFTAR
410   local DEST   local DEST
411    
412   SRCFILE=$1   SRCFILE=$1
413    
414   if [ -z "$2" ]   if [[ -z $2 ]]
415   then   then
416   DEST=${BUILDDIR}   DEST=${BUILDDIR}
417   else   else
418   DEST=$2   DEST=$2
419   fi   fi
420    
421     [[ ! -d ${DEST} ]] && install -d ${DEST}
422    
423   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
424   bz2)   bz2)
425   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
426   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
427   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
428   then   then
429   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.bz2 unpack failed."
430     else
431     pushd ${DEST} > /dev/null
432     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
433     popd > /dev/null
434   fi   fi
435   ;;   ;;
436   gz)   gz)
437   IFTAR="$(basename $SRCFILE .gz)"   IFTAR="$(basename $SRCFILE .gz)"
438   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
439   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
440   then   then
441   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.gz unpack failed."
442     else
443     pushd ${DEST} > /dev/null
444     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
445     popd > /dev/null
446   fi   fi
447   ;;   ;;
448   tbz2)   tbz2|mpks|mpk)
449   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
450   ;;   ;;
451   tgz)   tgz)
452   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
453     ;;
454     rar)
455     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
456     ;;
457     zip|xpi)
458     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
459     ;;
460     rpm)
461     pushd ${DEST} > /dev/null
462     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
463     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
464     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
465     then
466     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
467     fi
468   ;;   ;;
469   *)   *)
470   die "munpack failed"   die "munpack failed"
# Line 309  munpack() { Line 472  munpack() {
472   esac   esac
473  }  }
474    
475  mpatch() {  mpatch()
476    {
477   local PATCHOPTS   local PATCHOPTS
478   local PATCHFILE   local PATCHFILE
479     local i
480    
481   PATCHOPTS=$1   PATCHOPTS=$1
482   PATCHFILE=$2   PATCHFILE=$2
483    
484     if [[ -z $2 ]]
485     then
486     PATCHFILE=$1
487    
488     ## patch level auto-detection, get patch level
489     for ((i=0; i < 10; i++))
490     do
491     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
492     if [[ $? = 0 ]]
493     then
494     PATCHOPTS="-Np${i}"
495     break
496     fi
497     done
498     fi
499    
500     echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
501   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
502  }  }
503    
504    mlibtoolize()
505    {
506     local opts="$@"
507     [[ -z ${opts} ]] && opts="--copy --force"
508    
509     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
510    }
511    
512  minstalldocs() {  minstalldocs()
513    {
514   local docfiles   local docfiles
   
515   docfiles="$@"   docfiles="$@"
516    
517   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
518   then   then
519   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
520   fi   fi
521    
522   for i in ${docfiles}   for i in ${docfiles}
523   do   do
524   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
# Line 338  minstalldocs() { Line 527  minstalldocs() {
527   done   done
528  }  }
529    
530  mstriplibs() {  mstriplibs()
531    {
532   local stripdir="$@"   local stripdir="$@"
533    
534   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
535   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
536  }  }
537    
538  mstripbins() {  mstripbins()
539    {
540   local stripdir="$@"   local stripdir="$@"
541    
542   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
543   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
544  }  }
545    
546  sminclude() {  sminclude()
547    {
548   local i   local i
549    
550   if [[ -n "$@" ]]   if [[ -n "$@" ]]
# Line 366  sminclude() { Line 558  sminclude() {
558   fi   fi
559  }  }
560    
561  setup_distcc_environment(){  setup_distcc_environment()
562    {
563   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
564   then   then
565   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
566   export PATH=/usr/lib/distcc/bin:${PATH} || die "distcc: could not export new $PATH"   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"
   
  #export distcc as compiler  
 # export CC="distcc"  
 # export CXX=distcc  
567    
568   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
569    
570     # creating distcc tempdir
  #ccache + distcc together  
  if [ "${SMAGE_USE_CCACHE}" == "true" ]  
  then  
  if [ -x /usr/bin/ccache ]  
  then  
  echo "Preparing DistCC to work together with CCache ..."  
  #export CCACHE_PREFIX="distcc" || die "distcc: could not set ccach_prefix"  
 # export CC="ccache distcc"  
 # export CXX="ccache distcc"  
  fi  
  fi  
   
  #creating distcc tempdir  
571   install -o distcc -g daemon -d ${DISTCC_DIR}   install -o distcc -g daemon -d ${DISTCC_DIR}
572   chmod 1777 ${DISTCC_DIR}   chmod 1777 ${DISTCC_DIR}
573   fi   fi
574  }  }
575    
576  setup_ccache_environment(){  setup_ccache_environment()
577    {
578   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
579   then   then
580   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
581   export PATH=/usr/lib/ccache/bin:${PATH} || die "ccache: could not export new $PATH"   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"
  #unset CC CXX  
582   fi   fi
583  }  }
584    
585    
586  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
587  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
588  fix_mage_deps() {  fix_mage_deps()
589    {
590   local target="$1"   local target="$1"
591   local depend="$2"   local depend="$2"
592   local NDEPEND   local NDEPEND
# Line 424  fix_mage_deps() { Line 601  fix_mage_deps() {
601   # fix DEPEND   # fix DEPEND
602   while read sym dep   while read sym dep
603   do   do
604     # ignore empty lines
605     [[ -z ${dep} ]] && continue
606    
607   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
608   # change if not virtual   # change if not virtual
609   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 476  EOF Line 656  EOF
656  # special tags:  # special tags:
657  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
658  #   INHERITS              which functions get included  #   INHERITS              which functions get included
659  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
660  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
661  #  #
662  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
# Line 504  build_mage_script() Line 684  build_mage_script()
684   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
685    
686   # show what we are doing   # show what we are doing
687   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
688   echo "  ${dest}"   echo "${dest}"
689    
690   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
691   # now build the mage file   # now build the mage file
692   > ${dest}   > ${dest}
693    
694   # header   # header
695   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.34 2005-08-22 00:07:32 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}
696   echo  >> ${dest}   echo  >> ${dest}
697    
698   # pgkname and state   # pgkname and state
# Line 527  build_mage_script() Line 707  build_mage_script()
707    
708   # special tags and vars   # special tags and vars
709   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
710    
711     # echo MAGE_TARGETS ## note -target is needed !
712     echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
713     echo >> ${dest}
714    
715   # add special vars   # add special vars
716   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
717   then   then
# Line 538  build_mage_script() Line 723  build_mage_script()
723   done   done
724   echo  >> ${dest}   echo  >> ${dest}
725   fi   fi
726    
727   # add at least all includes   # add at least all includes
728   if [ -n "${INHERITS}" ]   if [ -n "${INHERITS}" ]
729   then   then
# Line 567  build_mage_script() Line 753  build_mage_script()
753   do   do
754   # add to mage (quotes needed !)   # add to mage (quotes needed !)
755   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
756     echo >> ${dest}
757   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
758   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
759   done   done
# Line 582  build_mage_script() Line 769  build_mage_script()
769   echo  >> ${dest}   echo  >> ${dest}
770   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
771   echo  >> ${dest}   echo  >> ${dest}
   
  # echo MAGE_TARGETS ## note -target is needed !  
  echo "MAGE_TARGETS=\"${targets}\"" >> ${dest}  
772  }  }
773    
774  regen_mage_tree()  regen_mage_tree()
# Line 616  regen_mage_tree() Line 800  regen_mage_tree()
800   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
801   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
802   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
803   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
804   do  # do
805   unset "${i}"  # unset "${i}"
806   done  # done
807   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
808   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
809   do  # do
810   unset "${i}"  # unset "${i}"
811   done  # done
812   unset SPECIAL_VARS   unset SPECIAL_VARS
813   unset STATE   unset STATE
814   unset DESCRIPTION   unset DESCRIPTION
# Line 640  regen_mage_tree() Line 824  regen_mage_tree()
824   unset postremove   unset postremove
825  }  }
826    
827    export_inherits()
828    {
829     local include="$1"
830     shift
831    
832     while [ "$1" ]
833     do
834     local functions="$1"
835    
836     # sanity checks
837     [ -z "${include}" ] && die "export_inherits(): \$include not given."
838     [ -z "${functions}" ] && die "export_inherits(): \$functions not given."
839    
840     eval "${functions}() { ${include}_${functions} ; }"
841    
842     # debug
843     [[ ${MAGEDEBUG} = on ]] && typeset -f "${functions}"
844    
845     shift
846     done
847    }
848    
849    generate_package_md5sum()
850    {
851     local dest
852     local pcat
853     local pname
854     local pver
855     local pbuild
856     local parch
857     local target
858     local pkgname
859    
860     # very basic getops
861     for i in $*
862     do
863     case $1 in
864     --pcat|-c) shift; pcat="$1" ;;
865     --pname|-n) shift; pname="$1" ;;
866     --pver|-v) shift; pver="$1" ;;
867     --pbuild|-b) shift; pbuild="$1" ;;
868     --parch|a) shift; parch="$1" ;;
869     --target|t) shift; target="$1" ;;
870     esac
871     shift
872     done
873    
874     # sanity checks; abort if not given
875     [ -z "${pcat}" ] && die "generate_package_md5sum() \$pcat not given."
876     [ -z "${pname}" ] && die "generate_package_md5sum() \$pname not given."
877     [ -z "${pver}" ] && die "generate_package_md5sum() \$pver not given."
878     [ -z "${pbuild}" ] && die "generate_package_md5sum() \$pbuild not given."
879     [ -z "${parch}" ] && die "generate_package_md5sum() \$parch not given."
880    
881     # check needed global vars
882     [ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set."
883     [ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set."
884    
885     # fix target as it may be empty !
886     [ -n "${target}" ] && target="-${target}"
887    
888     # build pkgname
889     pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
890    
891     # build pkg-md5-sum only if requested
892     if [[ ${REGEN_MAGE_TREE} = true ]]
893     then
894     echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
895    
896     # abort if not exist
897     if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
898     then
899     echo -e "${COLRED}! exists${COLDEFAULT}"
900     return 0
901     fi
902    
903     # if MAGE_TREE_DEST not set use BUILDDIR
904     : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
905    
906     # setup md5 dir
907     dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"
908     install -d ${dest}
909    
910     # gen md5sum
911     ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
912     > ${dest}/${pkgname}.md5
913     echo -e "${COLGREEN}done${COLDEFAULT}"
914     fi
915    }
916    
917    source_pkg_build()
918    {
919     if [[ ${PKGTYPE} = virtual ]]
920     then
921     echo "Virtual package detected; src-pkg-tarball not necessary ..."
922     return 0
923     fi
924    
925     if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
926     then
927     echo "No SRC_URI defined; src-pkg-tarball not necessary ..."
928     return 0
929     fi
930    
931     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
932    
933     echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
934    
935     # include the smage2 file
936     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
937    
938     ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
939     [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
940     mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
941    
942     echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
943    }
944    
945    step_by_step()
946    {
947     if [[ ${STEP_BY_STEP} = true ]]
948     then
949     echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
950     echo "Press [enter] to continue"
951     read
952     fi
953    }
954    
955    
956  # print out our version  # print out our version
957  showversion  showversion
958  echo  echo
# Line 652  then Line 965  then
965  fi  fi
966    
967  # updating smage2-scripts  # updating smage2-scripts
968  if [ "$1" == "update" ]  if [[ $1 = update ]]
969  then  then
970   if [ ! -d ${SOURCEDIR} ]   if [ ! -d ${SOURCEDIR} ]
971   then   then
# Line 663  then Line 976  then
976  fi  fi
977    
978  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
979  if [ "$1" == "calcmd5" ]  if [[ $1 = calcmd5 ]]
980  then  then
981   if [ $# -ge 3 ]   if [ $# -ge 3 ]
982   then   then
# Line 715  then Line 1028  then
1028   unset my_SRC_URI_MIRROR   unset my_SRC_URI_MIRROR
1029   unset my_SOURCEDIR   unset my_SOURCEDIR
1030   done   done
1031    
1032   echo   echo
1033   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."
1034   echo   echo
# Line 728  then Line 1041  then
1041   echo   echo
1042   exit 1   exit 1
1043   fi   fi
1044    
1045   exit 0   exit 0
1046  fi  fi
1047    
# Line 758  then Line 1071  then
1071   source ${SMAGENAME} || die "regen: smage2 not found"   source ${SMAGENAME} || die "regen: smage2 not found"
1072    
1073   regen_mage_tree   regen_mage_tree
1074    
1075     # build md5sum for existing packages
1076     generate_package_md5sum \
1077     --pcat "${PCATEGORIE}" \
1078     --pname "${PNAME}" \
1079     --pver "${PVER}" \
1080     --pbuild "${PBUILD}" \
1081     --parch "${ARCH}" \
1082     --target "${target}"
1083    
1084   exit 0   exit 0
1085  fi  fi
1086    
1087  if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ]  if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1088  then  then
1089   die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."   # set correct SMAGENAME
1090  fi   SMAGENAME="$2"
1091     MD5DIR="$(dirname ${SMAGENAME})/md5"
1092    
1093  if [ -z "`basename ${SMAGENAME}|grep .${SMAGESUFFIX}`" ]   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
 then  
  die "File '`basename ${SMAGENAME}`' is not a sMage v${SMAGEVERSION} file. Aborting."  
 fi  
1094    
1095  if [ -z "${SOURCEDIR}" ]   source ${SMAGENAME} || die "regen: smage2 not found"
 then  
  die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  
 fi  
1096    
1097  if [ -z "${SMAGESCRIPTSDIR}" ]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1098  then   then
1099   die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."   echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1100  fi   rm -rf ${SOURCEDIR}/${PKGNAME}
1101     fi
1102    
1103  if [ -z "${SMAGE2RSYNC}" ]   download_sources
1104  then   source_pkg_build ${SMAGENAME}
1105   echo "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."   exit 0
  exit 1  
1106  fi  fi
1107    
1108  if [ -z "${BINDIR}" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1109  then  then
1110   die "no BINDIR variable found in /etc/mage.rc"   SRCPKGTARBALL="${2}"
1111  fi   USE_SRC_PKG_TARBALL=true
1112    
1113  if [ -z "${CHOST}" ]   # abort if given file is not a source pkg
1114  then   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
  die "no CHOST variable found in /etc/mage.rc"  
 fi  
1115    
1116  if [ -z "${CFLAGS}" ]   # set correct SMAGENAME; use the one that the src_pkg provide
1117  then   # /path/to/SOURCEDIR/PNAME/SMAGENAME
1118   die "no CFLAGS variable found in /etc/mage.rc"   SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
 fi  
1119    
1120  if [ -z "${CXXFLAGS}" ]   echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1121  then  
1122   die "no CXXFLAGS variable found in /etc/mage.rc"   [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
1123    
1124     # unpack srctarball
1125     [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1126    
1127     tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1128    
1129     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1130  fi  fi
1131    
1132    
1133    [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1134    [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1135     die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1136    [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1137    [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1138    [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1139    [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1140    [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1141    [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1142    [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1143    
1144  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1145  PKGNAME="${PNAME}-${PVER}-${CHOST%%-*}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1146  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1147    
1148  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1149  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1150    
1151  # auto regen mage tree if requested  # auto regen mage tree if requested
1152  regen_mage_tree  regen_mage_tree
1153    
1154    if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]
1155    then
1156     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1157     then
1158     echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1159     rm -rf ${SOURCEDIR}/${PNAME}
1160     fi
1161    fi
1162    
1163  # download sources  # download sources
1164  download_sources  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources
1165    
1166  # fixes some issues with these functions  # fixes some issues with these functions
1167  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
# Line 835  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1177  export MAKEOPTS="${MAKEOPTS}" || die "MA
1177    
1178    
1179  # setup distcc  # setup distcc
1180  # distcc mus be setup *before* ccache, as ccache need to be before distcc in path  # setup for distcc goes *before* ccache, so ccache comes before distcc in path
1181  if [ "${SMAGE_USE_DISTCC}" == "true" ]  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment
 then  
  setup_distcc_environment  
 fi  
1182    
1183  # setup ccache  # setup ccache
1184  if [ "${SMAGE_USE_CCACHE}" == "true" ]  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
 then  
  setup_ccache_environment  
 fi  
   
1185    
1186  # small sleep to show our settings  # small sleep to show our settings
1187  sleep 1  sleep 1
1188    
 #debug  
 #echo "CC=${CC}"  
 #echo "CXX=${CXX}"  
 #echo "DISTCC_DIR=${DISTCC_DIR}"  
 #echo "PATH: ${PATH}"  
 #echo "--------------------------------------"  
 #env  
 #echo "--------------------------------------"  
 #read  
 #debug end  
   
1189  # cleans up build if a previously one exists  # cleans up build if a previously one exists
1190  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1191  then  then
# Line 894  then Line 1218  then
1218   mage rmstamp   mage rmstamp
1219  fi  fi
1220    
1221  src_prepare || die "src_prepare failed"  # setup build loggins
1222  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1223  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1224    
1225    src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD}
1226    step_by_step $_
1227    src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD}
1228    step_by_step $_
1229    src_install || die "src_install failed" | ${SMAGE_LOG_CMD}
1230    step_by_step $_
1231    
1232    
1233  # compressing doc, info & man files  # compressing doc, info & man files
 echo -e "Compressing man-pages ..."  
1234  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [ -d ${BUILDDIR}/builded/usr/share/man ]
1235  then  then
1236     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
1237   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man
1238  fi  fi
1239    
 echo -e "Compressing info-pages ..."  
1240  if [ -d ${BUILDDIR}/builded/usr/share/info ]  if [ -d ${BUILDDIR}/builded/usr/share/info ]
1241  then  then
1242     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
1243   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
1244  fi  fi
1245    
# Line 918  case ${NOSTRIP} in Line 1249  case ${NOSTRIP} in
1249   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1250   ;;   ;;
1251   *)   *)
1252   echo -e "Stripping binaries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1253   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1254   echo -e "Stripping libraries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1255   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1256   ;;   ;;
1257  esac  esac
# Line 931  case ${NOPKGBUILD} in Line 1262  case ${NOPKGBUILD} in
1262   echo -e "NOPGKBUILD=true detected; Package will not be build ..."   echo -e "NOPGKBUILD=true detected; Package will not be build ..."
1263   ;;   ;;
1264   *)   *)
1265   # build serveral targets   # build several targets
1266   if [ -n "${MAGE_TARGETS}" ]   if [ -n "${MAGE_TARGETS}" ]
1267   then   then
1268   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
# Line 944  case ${NOPKGBUILD} in Line 1275  case ${NOPKGBUILD} in
1275   fi   fi
1276   # now create the target package   # now create the target package
1277   ${MLIBDIR}/pkgbuild_dir.sh \   ${MLIBDIR}/pkgbuild_dir.sh \
1278   "${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD}" \   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \
1279   ${BINDIR} || die "target: ${target} package-build failed"   ${BINDIR} || die "target: ${target} package-build failed"
1280   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD} successfully builded.\n"  
1281     # build pkg-md5-sum if requested
1282     generate_package_md5sum \
1283     --pcat "${PCATEGORIE}" \
1284     --pname "${PNAME}" \
1285     --pver "${PVER}" \
1286     --pbuild "${PBUILD}" \
1287     --parch "${ARCH}" \
1288     --target "${target}"
1289    
1290     echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1291   done   done
1292   else   else
1293   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1294   echo -e "\nPackage ${PKGNAME} successfully builded.\n"  
1295     # build pkg-md5-sum if requested
1296     generate_package_md5sum \
1297     --pcat "${PCATEGORIE}" \
1298     --pname "${PNAME}" \
1299     --pver "${PVER}" \
1300     --pbuild "${PBUILD}" \
1301     --parch "${ARCH}"
1302    
1303     echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1304   fi   fi
1305    
1306     # build src-pkg-tarball if requested
1307     [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}
1308   ;;   ;;
1309  esac  esac
1310    
1311    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1312    then
1313     bzip2 -9f /var/log/smage/${PKGNAME}.log
1314    else
1315     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1316    fi
1317    
1318  # for sure  # for sure
1319  unset NOPKGBUILD  unset NOPKGBUILD
1320  unset NOSTRIP  unset NOSTRIP
1321    
1322  xtitleclean  xtitleclean
 #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  

Legend:
Removed from v.204  
changed lines
  Added in v.885