Magellan Linux

Diff of /branches/mage-next/src/smage2.in

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

revision 253 by niro, Sun Oct 2 14:23:11 2005 UTC revision 1435 by niro, Mon Jul 25 11:01:48 2011 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.37 2005-10-02 14:23:11 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    
24    ## only for tests -> normally in /etc/rc.d/init.d/functions
25    COLRED="\033[1;6m\033[31m"
26    COLGREEN="\033[1;6m\033[32m"
27    COLYELLOW="\033[1;6m\033[33m"
28    COLBLUE="\033[1;6m\033[34m"
29    COLMAGENTA="\033[1;6m\033[35m"
30    COLWHITE="\033[1;6m\033[37m"
31    COLGRAY="\033[0;6m\033[37m"
32    COLBOLD="\033[1m"
33    COLDEFAULT="\033[0m"
34    
35    if [[ ${NOCOLORS} = true ]]
36    then
37     COLRED=""
38     COLGREEN=""
39     COLYELLOW=""
40     COLBLUE=""
41     COLMAGENTA=""
42     COLWHITE=""
43     COLGRAY=""
44     COLBOLD=""
45     COLDEFAULT=""
46    fi
47    
48  # export default C locale  # export default C locale
49  export LC_ALL=C  export LC_ALL=C
50    
51  source /etc/mage.rc  source /etc/mage.rc.global
52    source ${MAGERC}
53    source ${MLIBDIR}/mage4.functions.sh
54    
55    # set PKGDIR and BUILDDIR and BINDIR to MROOT
56    if [[ -n ${MROOT} ]]
57    then
58     export PKGDIR=${MROOT}/${PKGDIR}
59     export BUILDDIR=${MROOT}/${BUILDDIR}
60     export BINDIR=${MROOT}/${BINDIR}
61    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  showversion() {   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()
91    {
92   echo -en "Magellan Source Install v${SMAGEVERSION} "   echo -en "Magellan Source Install v${SMAGEVERSION} "
93   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"
94  }  }
95    
96  die() {  die()
97    {
98   xtitleclean   xtitleclean
99     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
100   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
101   exit 1   exit 1
102  }  }
103    
104  xtitle() {  die_pipestatus()
105   if [ ${TERM} == "xterm" ]  {
106     # the status change if we do any parameter declarations!!
107     # dont do this anymore, keep this in mind!
108     #
109     # local pos="$1"
110     # local comment="$2"
111     #
112     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
113     #
114     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
115    }
116    
117    xtitle()
118    {
119     if [[ ${TERM} = xterm ]]
120   then   then
121   echo -ne "\033]0;[sMage: $@]\007"   echo -ne "\033]0;[sMage: $@]\007"
122   fi   fi
123   return 0   return 0
124  }  }
125    
126  xtitleclean() {  xtitleclean()
127   if [ ${TERM} == "xterm" ]  {
128     if [[ ${TERM} = xterm ]]
129   then   then
130   echo -ne "\033]0;\007"   echo -ne "\033]0;\007"
131   fi   fi
132   return 0   return 0
133  }  }
134    
135  syncsmage2() {  syncsmage2()
136    {
137   xtitle "Updating smage2-script tree ..."   xtitle "Updating smage2-script tree ..."
138   local i   local i
139   for i in ${SMAGE2RSYNC}   for i in ${SMAGE2RSYNC}
140   do   do
141   rsync \   rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR}
142   --recursive \   if [[ $? = 0 ]]
  --links \  
  --perms \  
  --times \  
  --devices \  
  --timeout=600 \  
  --verbose \  
  --compress \  
  --progress \  
  --stats \  
  --delete \  
  --delete-after \  
  ${i} ${SMAGESCRIPTSDIR}  
   
  if [ "$?" == "0" ]  
143   then   then
144   break   break
145   else   else
146   continue   continue
147   fi   fi
   
148   done   done
149    
150   #clean up backup files (foo~)   # clean up backup files (foo~)
151   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'
152    
153   xtitleclean   xtitleclean
154  }  }
155    
156  # $1 filename  # $1 filename
157  get_db_md5_sum() {  get_db_md5_sum()
158    {
159   local DB_FILE   local DB_FILE
160   local MD5_FILE   local MD5_FILE
161   local i   local i
# Line 101  get_db_md5_sum() { Line 168  get_db_md5_sum() {
168   echo "${i}"   echo "${i}"
169  }  }
170    
171  download_sources() {  download_sources()
172    {
173    
174   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
175    
# Line 113  download_sources() { Line 181  download_sources() {
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   #install SRCDIR/PNAME if not exist   # 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
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, not fetching needed   # md5's ok, no fetching needed
197   FETCHING=false   FETCHING=false
198   else   else
199   FETCHING=true   FETCHING=true
200   fi   fi
201    
202   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
203   do   do
204   # url to file   # url to file
# Line 144  download_sources() { Line 215  download_sources() {
215   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
216   fi   fi
217    
218     # create the SOURCEDIR
219     install -d ${my_SOURCEDIR}
220    
221   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
222   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
223   then   then
224   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
225   do   do
226   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")"
227    
228   #echo "DEBUG: ${MY_SRC_URI}"   if [[ ${FETCHING} = true ]]
229   if [[ ${FETCHING} == true ]]   then
230     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
231     wget \
232     ${wget_opts} \
233     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
234     "${my_SRC_URI_MIRROR}"
235     if [[ $? = 0 ]]
236     then
237     break
238     else
239     continue
240     fi
241     fi
242     done
243     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
244     then
245     for mirror in ${SOURCEFORGE_MIRRORS}
246     do
247     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
248    
249     if [[ ${FETCHING} = true ]]
250   then   then
251   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
252   wget \   wget \
253   --passive-ftp \   ${wget_opts} \
254   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
255   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
256   if [ "$?" == "0" ]   if [[ $? = 0 ]]
257     then
258     break
259     else
260     continue
261     fi
262     fi
263     done
264     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
265     then
266     for mirror in ${GNU_MIRRORS}
267     do
268     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
269    
270     if [[ ${FETCHING} = true ]]
271     then
272     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
273     wget \
274     ${wget_opts} \
275     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
276     "${my_SRC_URI_MIRROR}"
277     if [[ $? = 0 ]]
278     then
279     break
280     else
281     continue
282     fi
283     fi
284     done
285     elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]
286     then
287     for mirror in ${KDE_MIRRORS}
288     do
289     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"
290    
291     if [[ ${FETCHING} = true ]]
292     then
293     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
294     wget \
295     ${wget_opts} \
296     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
297     "${my_SRC_URI_MIRROR}"
298     if [[ $? = 0 ]]
299     then
300     break
301     else
302     continue
303     fi
304     fi
305     done
306     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]
307     then
308     for mirror in ${GNOME_MIRRORS}
309     do
310     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"
311    
312     if [[ ${FETCHING} = true ]]
313     then
314     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
315     wget \
316     ${wget_opts} \
317     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
318     "${my_SRC_URI_MIRROR}"
319     if [[ $? = 0 ]]
320   then   then
321   break   break
322   else   else
# Line 171  download_sources() { Line 325  download_sources() {
325   fi   fi
326   done   done
327   else   else
328   #echo "DEBUG: ${SRC_URI[${i}]}"   if [[ ${FETCHING} = true ]]
  if [[ ${FETCHING} == true ]]  
329   then   then
330   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
331   wget \   wget \
332   --passive-ftp \   ${wget_opts} \
333   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
334   "${my_SRC_URI}"   "${my_SRC_URI}"
 # only needed to run through a list of mirrors  
 # if [ "$?" == "0" ]  
 # then  
 # break  
 # else  
 # continue  
 # fi  
335   fi   fi
336   fi   fi
337    
338   # unset them to be shure   # unset them to be shure
339   unset my_SRC_URI   unset my_SRC_URI
340   unset my_SRC_URI_DEST   unset my_SRC_URI_DEST
# Line 201  download_sources() { Line 344  download_sources() {
344    
345   # recheck md5 sums   # recheck md5 sums
346   echo   echo
347   echo ">== Checking MD5 sums:"   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
# Line 210  download_sources() { Line 353  download_sources() {
353  }  }
354    
355  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
356  src_prepare() {  src_prepare()
357    {
358   echo "no src_prepare defined"   echo "no src_prepare defined"
359   sleep 2   sleep 2
360   return 0   return 0
361  }  }
362    
363  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
364  src_compile() {  src_compile()
365    {
366   echo "no src_compile defined"   echo "no src_compile defined"
367   sleep 2   sleep 2
368   return 0   return 0
369  }  }
370    
371  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
372  src_install() {  src_install()
373    {
374   echo "no src_install defined"   echo "no src_install defined"
375   sleep 2   sleep 2
376   return 0   return 0
377  }  }
378    
379  mconfigure() {  mlibdir()
380    {
381     local libdir=lib
382     [[ ${ARCH} = x86_64 ]] && libdir=lib64
383    
384     echo "${libdir}"
385    }
386    
387    mconfigure()
388    {
389   if [ -x ./configure ]   if [ -x ./configure ]
390   then   then
391   ./configure \   ./configure \
392   --prefix=/usr \   --prefix=/usr \
393   --host=${CHOST} \   --host=${CHOST} \
394   --mandir=/usr/share/man \   --build=${CHOST} \
395   --infodir=/usr/share/info \   --mandir=/usr/share/man \
396   --datadir=/usr/share \   --infodir=/usr/share/info \
397   --sysconfdir=/etc \   --datadir=/usr/share \
398   --localstatedir=/var/lib \   --sysconfdir=/etc \
399   "$@" || die "mconfigure failed"   --localstatedir=/var/lib \
400     --libdir=/usr/$(mlibdir) \
401     "$@" || die "mconfigure failed"
402   else   else
403   echo "configure is not an executable ..."   echo "configure is not an executable ..."
404   exit 1   exit 1
405   fi   fi
406  }  }
407    
408  minstall() {  minstall()
409   if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then  {
410     if [ -f ./[mM]akefile -o -f ./GNUmakefile ]
411     then
412   make prefix=${BINDIR}/usr \   make prefix=${BINDIR}/usr \
413   datadir=${BINDIR}/usr/share \   datadir=${BINDIR}/usr/share \
414   infodir=${BINDIR}/usr/share/info \   infodir=${BINDIR}/usr/share/info \
415   localstatedir=${BINDIR}/var/lib \   localstatedir=${BINDIR}/var/lib \
416   mandir=${BINDIR}/usr/share/man \   mandir=${BINDIR}/usr/share/man \
417   sysconfdir=${BINDIR}/etc \   sysconfdir=${BINDIR}/etc \
418     libdir=${BINDIR}/usr/$(mlibdir) \
419   "$@" install || die "minstall failed"   "$@" install || die "minstall failed"
420          else          else
421                  die "no Makefile found"                  die "no Makefile found"
422          fi          fi
423  }  }
424    
425  mmake() {  mmake()
426    {
427   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
428  }  }
429    
430  munpack() {  munpack()
431    {
432   local SRCFILE   local SRCFILE
433   local IFTAR   local IFTAR
434   local DEST   local DEST
435    
436   SRCFILE=$1   SRCFILE=$1
437    
438   if [ -z "$2" ]   if [[ -z $2 ]]
439   then   then
440   DEST=${BUILDDIR}   DEST=${BUILDDIR}
441   else   else
442   DEST=$2   DEST=$2
443   fi   fi
444    
445     [[ ! -d ${DEST} ]] && install -d ${DEST}
446    
447   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
448   bz2)   bz2)
449   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
450   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
451   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
452   then   then
453   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."
454     else
455     pushd ${DEST} > /dev/null
456     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
457     popd > /dev/null
458   fi   fi
459   ;;   ;;
460   gz)   gz)
461   IFTAR="$(basename $SRCFILE .gz)"   IFTAR="$(basename $SRCFILE .gz)"
462   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
463   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
464   then   then
465   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."
466     else
467     pushd ${DEST} > /dev/null
468     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
469     popd > /dev/null
470   fi   fi
471   ;;   ;;
472   tbz2)   xz)
473   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   IFTAR="$(basename $SRCFILE .xz)"
474     IFTAR="${IFTAR##*.}"
475     if [[ ${IFTAR} = tar ]]
476     then
477     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
478     else
479     pushd ${DEST} > /dev/null
480     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
481     popd > /dev/null
482     fi
483     ;;
484     tbz2|mpks|mpk)
485     tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
486   ;;   ;;
487   tgz)   tgz)
488   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
489     ;;
490     txz|mpkzs|mpkz)
491     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
492     ;;
493     rar)
494     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
495     ;;
496     zip|xpi)
497     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
498     ;;
499     rpm)
500     pushd ${DEST} > /dev/null
501     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
502     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
503     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
504     then
505     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
506     fi
507   ;;   ;;
508   *)   *)
509   die "munpack failed"   die "munpack failed"
# Line 309  munpack() { Line 511  munpack() {
511   esac   esac
512  }  }
513    
514  mpatch() {  mpatch()
515    {
516   local PATCHOPTS   local PATCHOPTS
517   local PATCHFILE   local PATCHFILE
518     local i
519    
520   PATCHOPTS=$1   PATCHOPTS=$1
521   PATCHFILE=$2   PATCHFILE=$2
522    
523     if [[ -z $2 ]]
524     then
525     PATCHFILE=$1
526    
527     ## patch level auto-detection, get patch level
528     for ((i=0; i < 10; i++))
529     do
530     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
531     if [[ $? = 0 ]]
532     then
533     PATCHOPTS="-Np${i}"
534     break
535     fi
536     done
537     fi
538    
539     echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
540   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
541  }  }
542    
543    mlibtoolize()
544    {
545     local opts="$@"
546     [[ -z ${opts} ]] && opts="--verbose --install --force"
547    
548     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
549    }
550    
551  minstalldocs() {  mautoreconf()
552    {
553     local opts="$@"
554     [[ -z ${opts} ]] && opts="--verbose --install --force"
555    
556     autoreconf ${opts} || die "running: mautoreconf ${opts}"
557    }
558    
559    minstalldocs()
560    {
561   local docfiles   local docfiles
   
562   docfiles="$@"   docfiles="$@"
563    
564   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
565   then   then
566   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
567   fi   fi
568    
569     local i
570   for i in ${docfiles}   for i in ${docfiles}
571   do   do
572   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
573   install -m 0644 ${SRCDIR}/${i}.gz \   then
574   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
575     install -m 0644 ${SRCDIR}/${i}.gz \
576     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
577     fi
578   done   done
579  }  }
580    
581  mstriplibs() {  mstriplibs()
582    {
583   local stripdir="$@"   local stripdir="$@"
584    
585   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
586   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
587  }  }
588    
589  mstripbins() {  mstripbins()
590    {
591   local stripdir="$@"   local stripdir="$@"
592    
593   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
594   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
595  }  }
596    
597  sminclude() {  mcompressdocs()
598    {
599     local bindir="$@"
600    
601     if [ -d ${bindir}/usr/share/man ]
602     then
603     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
604     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
605     fi
606    
607     if [ -d ${bindir}/usr/share/info ]
608     then
609     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
610     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
611     fi
612    }
613    
614    sminclude()
615    {
616   local i   local i
617    
618   if [[ -n "$@" ]]   if [[ -n "$@" ]]
# Line 366  sminclude() { Line 626  sminclude() {
626   fi   fi
627  }  }
628    
629  setup_distcc_environment(){  setup_distcc_environment()
630    {
631   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
632   then   then
633   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
634   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  
635    
636   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
637    
638     # 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  
639   install -o distcc -g daemon -d ${DISTCC_DIR}   install -o distcc -g daemon -d ${DISTCC_DIR}
640   chmod 1777 ${DISTCC_DIR}   chmod 1777 ${DISTCC_DIR}
641   fi   fi
642  }  }
643    
644  setup_ccache_environment(){  setup_ccache_environment()
645    {
646   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
647   then   then
648   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
649   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  
650   fi   fi
651  }  }
652    
653    
654  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
655  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
656  fix_mage_deps() {  fix_mage_deps()
657    {
658   local target="$1"   local target="$1"
659   local depend="$2"   local depend="$2"
660   local NDEPEND   local NDEPEND
# Line 424  fix_mage_deps() { Line 669  fix_mage_deps() {
669   # fix DEPEND   # fix DEPEND
670   while read sym dep   while read sym dep
671   do   do
672     # ignore empty lines
673     [[ -z ${dep} ]] && continue
674    
675   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
676   # change if not virtual   # change if not virtual
677   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 476  EOF Line 724  EOF
724  # special tags:  # special tags:
725  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
726  #   INHERITS              which functions get included  #   INHERITS              which functions get included
727  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
728  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
729    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
730    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
731    #                         (only in the resulting magefile}
732  #  #
733  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
734  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 488  build_mage_script() Line 739  build_mage_script()
739   local magefile   local magefile
740   local dest   local dest
741   local target   local target
742     local split_pkg_base
743   local sym   local sym
744   local depname   local depname
745    
# Line 495  build_mage_script() Line 747  build_mage_script()
747   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
748    
749   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
750   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
751    
752     # mark package as splitpackage
753     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
754    
755   # name of magefile   # name of magefile
756   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 504  build_mage_script() Line 759  build_mage_script()
759   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
760    
761   # show what we are doing   # show what we are doing
762   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
763   echo "  ${dest}"   echo "${dest}"
764    
765   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
766   # now build the mage file   # now build the mage file
767   > ${dest}   > ${dest}
768    
  # header  
  echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.37 2005-10-02 14:23:11 niro Exp $' >> ${dest}  
  echo  >> ${dest}  
   
769   # pgkname and state   # pgkname and state
770   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
771   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
  echo >> ${dest}  
772    
773   # description and homepage   # description and homepage
774   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
775   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
  echo >> ${dest}  
776    
777   # special tags and vars   # special tags and vars
778   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
779    
780   # echo MAGE_TARGETS ## note -target is needed !   # echo MAGE_TARGETS ## note -target is needed !
781   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
782   echo >> ${dest}  
783     # split package base
784     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
785    
786   # add special vars   # add special vars
787   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
# Line 541  build_mage_script() Line 792  build_mage_script()
792   # being tricky here :)   # being tricky here :)
793   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
794   done   done
  echo  >> ${dest}  
795   fi   fi
796    
797   # add at least all includes   # add at least all includes
# Line 553  build_mage_script() Line 803  build_mage_script()
803   do   do
804   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
805   done   done
806   echo  >> ${dest}   # a CRLF is needed here!
807     echo >> ${dest}
808   fi   fi
  echo >> ${dest}  
809    
810   # deps and provides   # deps and provides
811   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
  echo >> ${dest}  
812   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
  echo >> ${dest}  
813   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
  echo >> ${dest}  
814    
815   # add special functions   # add special functions
816   if [ -n "${SPECIAL_FUNCTIONS}" ]   if [ -n "${SPECIAL_FUNCTIONS}" ]
# Line 573  build_mage_script() Line 820  build_mage_script()
820   do   do
821   # add to mage (quotes needed !)   # add to mage (quotes needed !)
822   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  echo >> ${dest}  
823   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
824   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
825   done   done
  echo  >> ${dest}  
826   fi   fi
827    
828   # pre|post-install|removes   # pre|post-install|removes
829   typeset -f preinstall >> ${dest}   typeset -f preinstall >> ${dest}
  echo  >> ${dest}  
830   typeset -f postinstall >> ${dest}   typeset -f postinstall >> ${dest}
  echo  >> ${dest}  
831   typeset -f preremove >> ${dest}   typeset -f preremove >> ${dest}
  echo  >> ${dest}  
832   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
  echo  >> ${dest}  
833  }  }
834    
835  regen_mage_tree()  regen_mage_tree()
# Line 599  regen_mage_tree() Line 840  regen_mage_tree()
840   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
841   then   then
842   # run it without targets   # run it without targets
843   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
844   then   then
845     # build for each target a mage file
846     # run it with several targets
847   echo   echo
848   build_mage_script   for i in ${MAGE_TARGETS}
849     do
850     build_mage_script --target "${i}"
851     done
852   echo   echo
  else  
853    
854   # build for each target an mage file   # run it for splitpackages
855     elif [[ -n ${SPLIT_PACKAGES} ]]
856     then
857     local split_pkg_base="${PNAME}"
858     # save smage environment
859     split_save_variables
860     # build for each subpackage a mage file
861   # run it with several targets   # run it with several targets
862   for i in ${MAGE_TARGETS}   echo
863     for i in ${SPLIT_PACKAGES}
864   do   do
865   echo   # get the right variables for the split
866   build_mage_script "${i}"   export PNAME="${i}"
867   echo   split_info_${i}
868     build_mage_script --split-pkg-base "${split_pkg_base}"
869     # restore smage environment
870     split_restore_variables
871   done   done
872     echo
873     # unset all saved smage variables
874     split_unset_variables
875    
876     else
877     echo
878     build_mage_script
879     echo
880   fi   fi
881   fi   fi
882    
883   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
884   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
885   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
886   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
887   do  # do
888   unset "${i}"  # unset "${i}"
889   done  # done
890   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
891   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
892   do  # do
893   unset "${i}"  # unset "${i}"
894   done  # done
895   unset SPECIAL_VARS   unset SPECIAL_VARS
896   unset STATE   unset STATE
897   unset DESCRIPTION   unset DESCRIPTION
# Line 644  regen_mage_tree() Line 907  regen_mage_tree()
907   unset postremove   unset postremove
908  }  }
909    
910    split_save_variables()
911    {
912     export SAVED_PNAME="${PNAME}"
913     export SAVED_PVER="${PVER}"
914     export SAVED_PBUILD="${PBUILD}"
915     export SAVED_PCATEGORIE="${PCATEGORIE}"
916     export SAVED_DESCRIPTION="${DESCRIPTION}"
917     export SAVED_HOMEPAGE="${HOMEPAGE}"
918     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
919     export SAVED_STATE="${STATE}"
920     export SAVED_PKGTYPE="${PKGTYPE}"
921     export SAVED_INHERITS="${INHERITS}"
922     export SAVED_DEPEND="${DEPEND}"
923     export SAVED_SDEPEND="${SDEPEND}"
924     export SAVED_PROVIDE="${PROVIDE}"
925     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
926    
927     # bindir too
928     export SAVED_BINDIR="${BINDIR}"
929    
930     # export the SPLIT_PACKAGE_BASE
931     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
932    
933     # functions
934     if [[ ! -z $(typeset -f preinstall) ]]
935     then
936     # rename the old one
937     local saved_preinstall
938     saved_preinstall=SAVED_$(typeset -f preinstall)
939     eval "${saved_preinstall}"
940     export -f SAVED_preinstall
941     fi
942    
943     if [[ ! -z $(typeset -f postinstall) ]]
944     then
945     # rename the old one
946     local saved_postinstall
947     saved_postinstall=SAVED_$(typeset -f postinstall)
948     eval "${saved_postinstall}"
949     export -f SAVED_postinstall
950     fi
951    
952     if [[ ! -z $(typeset -f preremove) ]]
953     then
954     # rename the old one
955     local saved_preremove
956     saved_preremove=SAVED_$(typeset -f preremove)
957     eval "${saved_preremove}"
958     export -f SAVED_preremove
959     fi
960    
961     if [[ ! -z $(typeset -f postremove) ]]
962     then
963     # rename the old one
964     local saved_postremove
965     saved_postremove=SAVED_$(typeset -f postremove)
966     eval "${saved_postremove}"
967     export -f SAVED_postremove
968     fi
969    }
970    
971    split_restore_variables()
972    {
973     export PNAME="${SAVED_PNAME}"
974     export PVER="${SAVED_PVER}"
975     export PBUILD="${SAVED_PBUILD}"
976     export PCATEGORIE="${SAVED_PCATEGORIE}"
977     export DESCRIPTION="${SAVED_DESCRIPTION}"
978     export HOMEPAGE="${SAVED_HOMEPAGE}"
979     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
980     export STATE="${SAVED_STATE}"
981     export PKGTYPE="${SAVED_PKGTYPE}"
982     export INHERITS="${SAVED_INHERITS}"
983     export DEPEND="${SAVED_DEPEND}"
984     export SDEPEND="${SAVED_SDEPEND}"
985     export PROVIDE="${SAVED_PROVIDE}"
986     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
987    
988     # bindir too
989     export BINDIR="${SAVED_BINDIR}"
990    
991     # functions
992     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
993     then
994     # rename the old one
995     local saved_preinstall
996     saved_preinstall=$(typeset -f SAVED_preinstall)
997     eval "${saved_preinstall/SAVED_/}"
998     export -f preinstall
999     fi
1000    
1001     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
1002     then
1003     # rename the old one
1004     local saved_postinstall
1005     saved_postinstall=$(typeset -f SAVED_postinstall)
1006     eval "${saved_postinstall/SAVED_/}"
1007     export -f postinstall
1008     fi
1009    
1010     if [[ ! -z $(typeset -f SAVED_preremove) ]]
1011     then
1012     # rename the old one
1013     local saved_preremove
1014     saved_preremove=$(typeset -f SAVED_preremove)
1015     eval "${saved_preremove/SAVED_/}"
1016     export -f preremove
1017     fi
1018    
1019     if [[ ! -z $(typeset -f SAVED_postremove) ]]
1020     then
1021     # rename the old one
1022     local saved_postremove
1023     saved_postremove=$(typeset -f SAVED_postremove)
1024     eval "${saved_postremove/SAVED_/}"
1025     export -f postremove
1026     fi
1027    }
1028    
1029    split_unset_variables()
1030    {
1031     # unset saved vars; not needed anymore
1032     unset SAVED_PNAME
1033     unset SAVED_PVER
1034     unset SAVED_PBUILD
1035     unset SAVED_PCATEGORIE
1036     unset SAVED_DESCRIPTION
1037     unset SAVED_HOMEPAGE
1038     unset SAVED_SPECIAL_VARS
1039     unset SAVED_STATE
1040     unset SAVED_PKGTYPE
1041     unset SAVED_INHERITS
1042     unset SAVED_DEPEND
1043     unset SAVED_SDEPEND
1044     unset SAVED_PROVIDE
1045     unset SAVED_BINDIR
1046     unset SAVED_NOPKGBUILD
1047     unset SPLIT_PACKAGE_BASE
1048     unset -f SAVED_preinstall
1049     unset -f SAVED_postinstall
1050     unset -f SAVED_preremove
1051     unset -f SAVED_postremove
1052    }
1053    
1054  export_inherits()  export_inherits()
1055  {  {
1056   local include="$1"   local include="$1"
# Line 666  export_inherits() Line 1073  export_inherits()
1073   done   done
1074  }  }
1075    
1076    generate_package_md5sum()
1077    {
1078     local dest
1079     local pcat
1080     local pname
1081     local pver
1082     local pbuild
1083     local parch
1084     local target
1085     local pkgname
1086    
1087     # very basic getops
1088     for i in $*
1089     do
1090     case $1 in
1091     --pcat|-c) shift; pcat="$1" ;;
1092     --pname|-n) shift; pname="$1" ;;
1093     --pver|-v) shift; pver="$1" ;;
1094     --pbuild|-b) shift; pbuild="$1" ;;
1095     --parch|a) shift; parch="$1" ;;
1096     --target|t) shift; target="$1" ;;
1097     esac
1098     shift
1099     done
1100    
1101     # sanity checks; abort if not given
1102     [ -z "${pcat}" ] && die "generate_package_md5sum() \$pcat not given."
1103     [ -z "${pname}" ] && die "generate_package_md5sum() \$pname not given."
1104     [ -z "${pver}" ] && die "generate_package_md5sum() \$pver not given."
1105     [ -z "${pbuild}" ] && die "generate_package_md5sum() \$pbuild not given."
1106     [ -z "${parch}" ] && die "generate_package_md5sum() \$parch not given."
1107    
1108     # check needed global vars
1109     [ -z "${PKGDIR}" ] && die "generate_package_md5sum() \$PKGDIR not set."
1110     [ -z "${PKGSUFFIX}" ] && die "generate_package_md5sum() \$PKGSUFFIX not set."
1111    
1112     # fix target as it may be empty !
1113     [ -n "${target}" ] && target="-${target}"
1114    
1115    
1116     # build pkgname
1117     pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1118    
1119     # build pkg-md5-sum only if requested
1120     if [[ ${REGEN_MAGE_TREE} = true ]]
1121     then
1122     echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1123    
1124     # abort if not exist
1125     if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
1126     then
1127     echo -e "${COLRED}! exists${COLDEFAULT}"
1128     return 0
1129     fi
1130    
1131     # if MAGE_TREE_DEST not set use BUILDDIR
1132     : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1133    
1134     # setup md5 dir
1135     dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1136     install -d ${dest}
1137    
1138     # gen md5sum
1139     ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
1140     > ${dest}/${pkgname}.md5
1141     echo -e "${COLGREEN}done${COLDEFAULT}"
1142     fi
1143    }
1144    
1145    source_pkg_build()
1146    {
1147     if [[ ${PKGTYPE} = virtual ]]
1148     then
1149     echo "Virtual package detected; src-pkg-tarball not necessary ..."
1150     return 0
1151     fi
1152    
1153     if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1154     then
1155     echo "No SRC_URI defined; src-pkg-tarball not necessary ..."
1156     return 0
1157     fi
1158    
1159     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
1160    
1161     echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
1162    
1163     # include the smage2 file
1164     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
1165    
1166     ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
1167     [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1168     mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1169    
1170     echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1171    }
1172    
1173    step_by_step()
1174    {
1175     if [[ ${STEP_BY_STEP} = true ]]
1176     then
1177     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1178     echo "Press [enter] to continue"
1179     read
1180     fi
1181    }
1182    
1183    
1184  # print out our version  # print out our version
1185  showversion  showversion
1186  echo  echo
# Line 678  then Line 1193  then
1193  fi  fi
1194    
1195  # updating smage2-scripts  # updating smage2-scripts
1196  if [ "$1" == "update" ]  if [[ $1 = update ]]
1197  then  then
1198   if [ ! -d ${SOURCEDIR} ]   if [ ! -d ${SOURCEDIR} ]
1199   then   then
# Line 689  then Line 1204  then
1204  fi  fi
1205    
1206  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1207  if [ "$1" == "calcmd5" ]  if [[ $1 = calcmd5 ]]
1208  then  then
1209   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1210   then   then
1211   SMAGENAME="$2"   SMAGENAME="$2"
1212   MD5DIR="$3"   MD5DIR="$3"
1213   source ${SMAGENAME} || die "download source failed"   [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1214    
1215     smagesource ${SMAGENAME} || die "download source failed"
1216    
1217   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
1218   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
# Line 741  then Line 1258  then
1258   unset my_SRC_URI_MIRROR   unset my_SRC_URI_MIRROR
1259   unset my_SOURCEDIR   unset my_SOURCEDIR
1260   done   done
1261    
1262   echo   echo
1263   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."
1264   echo   echo
1265   else   else
1266   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1267   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1268   echo   echo
1269   echo   echo
1270   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
1271   echo   echo
1272   exit 1   exit 1
1273   fi   fi
1274    
1275   exit 0   exit 0
1276  fi  fi
1277    
# Line 769  then Line 1286  then
1286   # get smage   # get smage
1287   SMAGENAME="$2"   SMAGENAME="$2"
1288   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1289   source ${SMAGENAME} || die "download source failed"   smagesource ${SMAGENAME} || die "download source failed"
1290    
1291   download_sources   download_sources
1292   exit 0   exit 0
# Line 781  then Line 1298  then
1298   # set correct SMAGENAME   # set correct SMAGENAME
1299   SMAGENAME="$2"   SMAGENAME="$2"
1300   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1301   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1302    
1303   regen_mage_tree   regen_mage_tree
1304    
1305     # build several targets
1306     if [[ -n ${MAGE_TARGETS} ]]
1307     then
1308     for target in ${MAGE_TARGETS}
1309     do
1310     # build md5sum for existing packages
1311     generate_package_md5sum \
1312     --pcat "${PCATEGORIE}" \
1313     --pname "${PNAME}" \
1314     --pver "${PVER}" \
1315     --pbuild "${PBUILD}" \
1316     --parch "${ARCH}" \
1317     --target "${target}"
1318     done
1319    
1320     # build several subpackages
1321     elif [[ -n ${SPLIT_PACKAGES} ]]
1322     then
1323     split_save_variables
1324     for subpackage in ${SPLIT_PACKAGES}
1325     do
1326     # get the right variables for the split
1327     export PNAME="${subpackage}"
1328     split_info_${subpackage}
1329     # build md5sum for existing packages
1330     generate_package_md5sum \
1331     --pcat "${PCATEGORIE}" \
1332     --pname "${PNAME}" \
1333     --pver "${PVER}" \
1334     --pbuild "${PBUILD}" \
1335     --parch "${ARCH}"
1336     # restore smage environment
1337     split_restore_variables
1338     done
1339     # unset all saved smage variables
1340     split_unset_variables
1341    
1342     else
1343     # build md5sum for existing packages
1344     generate_package_md5sum \
1345     --pcat "${PCATEGORIE}" \
1346     --pname "${PNAME}" \
1347     --pver "${PVER}" \
1348     --pbuild "${PBUILD}" \
1349     --parch "${ARCH}"
1350     fi
1351    
1352   exit 0   exit 0
1353  fi  fi
1354    
1355  if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ]  if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1356  then  then
1357   die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."   # set correct SMAGENAME
1358  fi   SMAGENAME="$2"
1359     MD5DIR="$(dirname ${SMAGENAME})/md5"
1360    
1361  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  
1362    
1363  if [ -z "${SOURCEDIR}" ]   smagesource ${SMAGENAME} || die "regen: smage2 not found"
 then  
  die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  
 fi  
1364    
1365  if [ -z "${SMAGESCRIPTSDIR}" ]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1366  then   then
1367   die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."   echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1368  fi   rm -rf ${SOURCEDIR}/${PKGNAME}
1369     fi
1370    
1371  if [ -z "${SMAGE2RSYNC}" ]   download_sources
1372  then   source_pkg_build ${SMAGENAME}
1373   echo "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."   exit 0
  exit 1  
1374  fi  fi
1375    
1376  if [ -z "${BINDIR}" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1377  then  then
1378   die "no BINDIR variable found in /etc/mage.rc"   SRCPKGTARBALL="${2}"
1379  fi   USE_SRC_PKG_TARBALL=true
1380    
1381  if [ -z "${CHOST}" ]   # abort if given file is not a source pkg
1382  then   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
  die "no CHOST variable found in /etc/mage.rc"  
 fi  
1383    
1384  if [ -z "${CFLAGS}" ]   # set correct SMAGENAME; use the one that the src_pkg provide
1385  then   # /path/to/SOURCEDIR/PNAME/SMAGENAME
1386   die "no CFLAGS variable found in /etc/mage.rc"   SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
 fi  
1387    
1388  if [ -z "${CXXFLAGS}" ]   echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1389  then  
1390   die "no CXXFLAGS variable found in /etc/mage.rc"   [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
1391    
1392     # unpack srctarball
1393     [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1394    
1395     tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1396    
1397     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1398  fi  fi
1399    
1400    
1401  source ${SMAGENAME} || die "source failed"  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1402  PKGNAME="${PNAME}-${PVER}-${CHOST%%-*}-${PBUILD}"  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1403     die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1404    [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1405    [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1406    [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1407    [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1408    [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1409    [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1410    [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1411    
1412    smagesource ${SMAGENAME} || die "source failed"
1413    PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1414  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1415    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1416    
1417  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1418  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1419    
1420  # auto regen mage tree if requested  # auto regen mage tree if requested
1421  regen_mage_tree  regen_mage_tree
1422    
1423    if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]
1424    then
1425     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1426     then
1427     echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1428     rm -rf ${SOURCEDIR}/${PNAME}
1429     fi
1430    fi
1431    
1432  # download sources  # download sources
1433  download_sources  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources
1434    
1435  # fixes some issues with these functions  # fixes some issues with these functions
1436  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
# Line 861  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1446  export MAKEOPTS="${MAKEOPTS}" || die "MA
1446    
1447    
1448  # setup distcc  # setup distcc
1449  # 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
1450  if [ "${SMAGE_USE_DISTCC}" == "true" ]  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment
 then  
  setup_distcc_environment  
 fi  
1451    
1452  # setup ccache  # setup ccache
1453  if [ "${SMAGE_USE_CCACHE}" == "true" ]  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
 then  
  setup_ccache_environment  
 fi  
   
1454    
1455  # small sleep to show our settings  # small sleep to show our settings
1456  sleep 1  sleep 1
1457    
 #debug  
 #echo "CC=${CC}"  
 #echo "CXX=${CXX}"  
 #echo "DISTCC_DIR=${DISTCC_DIR}"  
 #echo "PATH: ${PATH}"  
 #echo "--------------------------------------"  
 #env  
 #echo "--------------------------------------"  
 #read  
 #debug end  
   
1458  # cleans up build if a previously one exists  # cleans up build if a previously one exists
1459  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1460  then  then
# Line 920  then Line 1487  then
1487   mage rmstamp   mage rmstamp
1488  fi  fi
1489    
1490  src_prepare || die "src_prepare failed"  # setup build loggins
1491  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1492  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1493    
1494    src_prepare | ${SMAGE_LOG_CMD}
1495    die_pipestatus 0 "src_prepare failed"
1496    step_by_step $_
1497    
1498    src_compile | ${SMAGE_LOG_CMD}
1499    die_pipestatus 0 "src_compile failed"
1500    step_by_step $_
1501    
1502    # build several subpackages
1503    if [[ -n ${SPLIT_PACKAGES} ]]
1504    then
1505     # save bindir & pname
1506     split_save_variables
1507     export SAVED_BINDIR="${BINDIR}"
1508     for subpackage in ${SPLIT_PACKAGES}
1509     do
1510     if typeset -f src_install_${subpackage} > /dev/null
1511     then
1512     # export subpackage bindir
1513     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1514     # export PNAME, several internal function and include
1515     # rely on this variable
1516     export PNAME="${subpackage}"
1517    
1518     echo
1519     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1520     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1521     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1522     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1523    
1524     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1525     die_pipestatus 0 "src_install_${subpackage} failed"
1526     step_by_step $_
1527     fi
1528     done
1529     # restore bindir & pname
1530     split_restore_variables
1531     # unset all saved smage variables
1532     split_unset_variables
1533    else
1534     src_install | ${SMAGE_LOG_CMD}
1535     die_pipestatus 0 "src_install failed"
1536     step_by_step $_
1537    fi
1538    
1539  # compressing doc, info & man files  # compressing doc, info & man files
1540  echo -e "Compressing man-pages ..."  if [[ -n ${SPLIT_PACKAGES} ]]
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1541  then  then
1542   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   for subpackage in ${SPLIT_PACKAGES}
1543     do
1544     mcompressdocs ${BINDIR}_${subpackage}
1545     done
1546    else
1547     mcompressdocs ${BINDIR}
1548  fi  fi
1549    
 echo -e "Compressing info-pages ..."  
 if [ -d ${BUILDDIR}/builded/usr/share/info ]  
 then  
  ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info  
 fi  
1550    
1551  # stripping all bins and libs  # stripping all bins and libs
1552  case ${NOSTRIP} in  case ${NOSTRIP} in
# Line 944  case ${NOSTRIP} in Line 1554  case ${NOSTRIP} in
1554   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1555   ;;   ;;
1556   *)   *)
1557   echo -e "Stripping binaries ..."   if [[ -n ${SPLIT_PACKAGES} ]]
1558   mstripbins ${BINDIR}   then
1559   echo -e "Stripping libraries ..."   for subpackage in ${SPLIT_PACKAGES}
1560   mstriplibs ${BINDIR}   do
1561     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1562     mstripbins ${BINDIR}_${subpackage}
1563     echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"
1564     mstriplibs ${BINDIR}_${subpackage}
1565     done
1566     else
1567     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1568     mstripbins ${BINDIR}
1569     echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1570     mstriplibs ${BINDIR}
1571     fi
1572   ;;   ;;
1573  esac  esac
1574    
# Line 957  case ${NOPKGBUILD} in Line 1578  case ${NOPKGBUILD} in
1578   echo -e "NOPGKBUILD=true detected; Package will not be build ..."   echo -e "NOPGKBUILD=true detected; Package will not be build ..."
1579   ;;   ;;
1580   *)   *)
1581   # build serveral targets   # build several targets
1582   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1583   then   then
1584   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1585   do   do
# Line 970  case ${NOPKGBUILD} in Line 1591  case ${NOPKGBUILD} in
1591   fi   fi
1592   # now create the target package   # now create the target package
1593   ${MLIBDIR}/pkgbuild_dir.sh \   ${MLIBDIR}/pkgbuild_dir.sh \
1594   "${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD}" \   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \
1595   ${BINDIR} || die "target: ${target} package-build failed"   ${BINDIR} || die "target: ${target} package-build failed"
1596   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD} successfully builded.\n"  
1597     # build pkg-md5-sum if requested
1598     generate_package_md5sum \
1599     --pcat "${PCATEGORIE}" \
1600     --pname "${PNAME}" \
1601     --pver "${PVER}" \
1602     --pbuild "${PBUILD}" \
1603     --parch "${ARCH}" \
1604     --target "${target}"
1605    
1606     echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1607     done
1608    
1609     # build several subpackages
1610     elif [[ -n ${SPLIT_PACKAGES} ]]
1611     then
1612     split_save_variables
1613     for subpackage in ${SPLIT_PACKAGES}
1614     do
1615     # get the right variables for the split
1616     export PNAME="${subpackage}"
1617     split_info_${PNAME}
1618    
1619     # jump to next one if NOPKGBUILD is set in split_info
1620     case ${NOPKGBUILD} in
1621     true|TRUE|yes|y) continue ;;
1622     esac
1623    
1624     # check if an special subpackage_pkgbuild exists
1625     if typeset -f ${PNAME}_pkgbuild > /dev/null
1626     then
1627     # run it
1628     ${PNAME}_pkgbuild
1629     fi
1630     # now create the target package
1631     ${MLIBDIR}/pkgbuild_dir.sh \
1632     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1633     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1634    
1635     # build pkg-md5-sum if requested
1636     generate_package_md5sum \
1637     --pcat "${PCATEGORIE}" \
1638     --pname "${PNAME}" \
1639     --pver "${PVER}" \
1640     --pbuild "${PBUILD}" \
1641     --parch "${ARCH}"
1642    
1643     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1644    
1645     # restore smage environment
1646     split_restore_variables
1647   done   done
1648     # unset all saved smage variables
1649     split_unset_variables
1650    
1651   else   else
1652   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1653   echo -e "\nPackage ${PKGNAME} successfully builded.\n"  
1654     # build pkg-md5-sum if requested
1655     generate_package_md5sum \
1656     --pcat "${PCATEGORIE}" \
1657     --pname "${PNAME}" \
1658     --pver "${PVER}" \
1659     --pbuild "${PBUILD}" \
1660     --parch "${ARCH}"
1661    
1662     echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1663   fi   fi
1664    
1665     # build src-pkg-tarball if requested
1666     [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}
1667   ;;   ;;
1668  esac  esac
1669    
1670    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1671    then
1672     bzip2 -9f /var/log/smage/${PKGNAME}.log
1673    else
1674     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1675    fi
1676    
1677  # for sure  # for sure
1678  unset NOPKGBUILD  unset NOPKGBUILD
1679  unset NOSTRIP  unset NOSTRIP
1680    
1681  xtitleclean  xtitleclean
 #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  

Legend:
Removed from v.253  
changed lines
  Added in v.1435