Magellan Linux

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

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

revision 384 by niro, Mon Jul 17 20:44:44 2006 UTC revision 1601 by niro, Mon Jan 2 15:52:59 2012 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    # $Id$
3    
4  # compiles/installs .smage2 source install scripts  # compiles/installs .smage2 source install scripts
5  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
6    
7  # SMAGE2  # TODO: record dynlib, gz | xz database
 # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.43 2006-07-17 20:44:44 niro Exp $  
8    
 #01.10.2004  
 # added ccache support  
 # added distcc support  
9    
10  ## setup ##  # set default user mage.rc
11  PKGSUFFIX="mpk"  : ${MAGERC="/etc/mage.rc"}
 SMAGENAME="$1"  
 SMAGESUFFIX="smage2"  
 MLIBDIR=/usr/lib/mage  
 SMAGEVERSION="$( < ${MLIBDIR}/version)"  
   
 ## only for tests -> normally in /etc/rc.d/init.d/functions  
 COLRED="\033[1;6m\033[31m"  
 COLGREEN="\033[1;6m\033[32m"  
 COLYELLOW="\033[1;6m\033[33m"  
 COLBLUE="\033[1;6m\033[34m"  
 COLMAGENTA="\033[1;6m\033[35m"  
 COLWHITE="\033[1;6m\033[37m"  
 COLGRAY="\033[0;6m\033[37m"  
 COLBOLD="\033[1m"  
 COLDEFAULT="\033[0m"  
   
 if [[ ${NOCOLORS} = true ]]  
 then  
  COLRED=""  
  COLGREEN=""  
  COLYELLOW=""  
  COLBLUE=""  
  COLMAGENTA=""  
  COLWHITE=""  
  COLGRAY=""  
  COLBOLD=""  
  COLDEFAULT=""  
 fi  
12    
13  # export default C locale  # export default C locale
14  export LC_ALL=C  export LC_ALL=C
15    
16  source /etc/mage.rc  source /etc/mage.rc.global
17    source ${MAGERC}
18    source ${MLIBDIR}/mage4.functions.sh
19    
20    ## setup ##
21    SMAGENAME="$1"
22    SMAGEVERSION="$(< ${MLIBDIR}/version)"
23    
24  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
25  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 54  then Line 29  then
29   export BINDIR=${MROOT}/${BINDIR}   export BINDIR=${MROOT}/${BINDIR}
30  fi  fi
31    
32    # sources the smage file and uses state from distribution file if exist
33    # may helpful for repository support later on
34    smagesource()
35    {
36     local file="$1"
37     local mystate
38     local mycodename
39    
40     source ${file}
41    
42     [[ -n ${STATE} ]] && mystate="${STATE}"
43    
44     # do not overide if local state was broken or disabled!
45     case ${STATE} in
46     broken) return ;;
47     disabled) return ;;
48     esac
49    
50     if [ -f ${SMAGESCRIPTSDIR}/distribution ]
51     then
52     source ${SMAGESCRIPTSDIR}/distribution
53     [[ -n ${STATE} ]] && mystate="${STATE}"
54     fi
55     # now switch state and export it
56     STATE="${mystate}"
57    }
58    
59  showversion()  showversion()
60  {  {
61   echo -en "Magellan Source Install v${SMAGEVERSION} "   echo -en "Magellan Source Install v${SMAGEVERSION} "
# Line 63  showversion() Line 65  showversion()
65  die()  die()
66  {  {
67   xtitleclean   xtitleclean
68     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
69   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
70   exit 1   exit 1
71  }  }
72    
73    die_pipestatus()
74    {
75     # the status change if we do any parameter declarations!!
76     # dont do this anymore, keep this in mind!
77     #
78     # local pos="$1"
79     # local comment="$2"
80     #
81     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
82     #
83     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
84    }
85    
86  xtitle()  xtitle()
87  {  {
88   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 91  syncsmage2() Line 107  syncsmage2()
107   local i   local i
108   for i in ${SMAGE2RSYNC}   for i in ${SMAGE2RSYNC}
109   do   do
110   rsync \   rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR}
  --recursive \  
  --links \  
  --perms \  
  --times \  
  --devices \  
  --timeout=600 \  
  --verbose \  
  --compress \  
  --progress \  
  --stats \  
  --delete \  
  --delete-after \  
  ${i} ${SMAGESCRIPTSDIR}  
   
111   if [[ $? = 0 ]]   if [[ $? = 0 ]]
112   then   then
113   break   break
114   else   else
115   continue   continue
116   fi   fi
   
117   done   done
118    
119   # clean up backup files (foo~)   # clean up backup files (foo~)
# Line 138  get_db_md5_sum() Line 139  get_db_md5_sum()
139    
140  download_sources()  download_sources()
141  {  {
   
142   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
143    
144   local EOA=${#SRC_URI[*]}   local count=${#SRC_URI[*]}
145   local my_SRC_URI   local uri
146   local my_SRC_URI_DEST   local subdir
147   local my_SRC_URI_MIRROR   local outputdir
148   local my_SOURCEDIR   local db_md5_file="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
149   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local fetching
150   local FETCHING   local i
  local i mirror  
   
   
  # install SRCDIR/PNAME if not exist  
  [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}  
151    
152   # check if FETCHING is needed   # check if FETCHING is needed
153   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   if mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5
  if [[ $? = 0 ]]  
154   then   then
155   # md5's ok, not fetching needed   # md5's ok, no fetching needed
156   FETCHING=false   fetching=false
157   else   else
158   FETCHING=true   fetching=true
159   fi   fi
160    
161   for ((i=0; i < EOA; i++))   if [[ ${fetching} = true ]]
162   do   then
163   # url to file   for ((i=0; i < count; i++))
164   my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"   do
165     # url to file
166   # subdir in sources dir; the my_SRCI_URI file goes to there   uri="${SRC_URI[${i}]%%' '*}"
  my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"  
   
  # if my_src_uri_dest is not equal my_src_uri; than an other dir is used  
  if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]  
  then  
  my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}"  
  else  
  my_SOURCEDIR="${SOURCEDIR}/${PNAME}"  
  fi  
167    
168   # if an mirrored file than replace first the mirror uri   # subdir in sources dir; the my_SRCI_URI file goes to there
169   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   subdir="${SRC_URI[${i}]##*' '}"
  then  
  for mirror in ${MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"  
170    
171   if [[ ${FETCHING} = true ]]   # if $subdir is not equal with $uri then an other dir is used
172   then   if [[ ${uri} != ${subdir} ]]
  echo "==> fetching ${my_SRC_URI_MIRROR}"  
  wget \  
  --passive-ftp \  
  --tries 3 \  
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  else  
  if [[ ${FETCHING} = true ]]  
173   then   then
174   echo "==> fetching ${my_SRC_URI}"   outputdir="${SOURCEDIR}/${PNAME}/${subdir}"
175   wget \   else
176   --passive-ftp \   outputdir="${SOURCEDIR}/${PNAME}"
  --tries 3 \  
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
  "${my_SRC_URI}"  
177   fi   fi
  fi  
178    
179   # unset them to be shure   echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}"
180   unset my_SRC_URI   # do not die here, mchecksum catches download errors
181   unset my_SRC_URI_DEST   mdownload --uri "${uri}" --dir "${outputdir}"
182   unset my_SRC_URI_MIRROR  
183   unset my_SOURCEDIR   # unset them to be sure
184   done   unset uri
185     unset subdir
186     unset outputdir
187     done
188    
189   # recheck md5 sums   # recheck md5 sums after download
190   echo   echo
191   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
192   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5 || die "md5 failed"
193   echo   echo
194     else
195     echo -e "${COLBLUE}===${COLGREEN} All sources already fetched, nothing to do${COLDEFAULT}"
196     fi
197    
198   # not needed anymore   # not needed anymore
199   unset SRC_URI   unset SRC_URI
200  }  }
201    
202  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
203  src_prepare()  src_prepare()
204  {  {
205   echo "no src_prepare defined"   echo "no src_prepare defined; doing nothing ..."
  sleep 2  
206   return 0   return 0
207  }  }
208    
209  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
210  src_compile()  src_compile()
211  {  {
212   echo "no src_compile defined"   echo "no src_compile defined; doing nothing ..."
  sleep 2  
213   return 0   return 0
214  }  }
215    
216  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
217    src_check()
218    {
219     echo "no src_check defined; doing nothing ..."
220     return 0
221    }
222    
223    # dummy function, used if that does not exist in smage file
224  src_install()  src_install()
225  {  {
226   echo "no src_install defined"   echo "no src_install defined; doing nothing ..."
  sleep 2  
227   return 0   return 0
228  }  }
229    
# Line 275  mconfigure() Line 242  mconfigure()
242   ./configure \   ./configure \
243   --prefix=/usr \   --prefix=/usr \
244   --host=${CHOST} \   --host=${CHOST} \
245     --build=${CHOST} \
246   --mandir=/usr/share/man \   --mandir=/usr/share/man \
247   --infodir=/usr/share/info \   --infodir=/usr/share/info \
248   --datadir=/usr/share \   --datadir=/usr/share \
# Line 318  munpack() Line 286  munpack()
286    
287   SRCFILE=$1   SRCFILE=$1
288    
289   if [ -z "$2" ]   if [[ -z $2 ]]
290   then   then
291   DEST=${BUILDDIR}   DEST=${BUILDDIR}
292   else   else
293   DEST=$2   DEST=$2
294   fi   fi
295    
296     [[ ! -d ${DEST} ]] && install -d ${DEST}
297    
298   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
299   bz2)   bz2)
300   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
301   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
302   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
303   then   then
304   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."
305     else
306     pushd ${DEST} > /dev/null
307     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
308     popd > /dev/null
309   fi   fi
310   ;;   ;;
311   gz)   gz)
# Line 339  munpack() Line 313  munpack()
313   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
314   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
315   then   then
316   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."
317     else
318     pushd ${DEST} > /dev/null
319     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
320     popd > /dev/null
321   fi   fi
322   ;;   ;;
323   tbz2)   xz)
324   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   IFTAR="$(basename $SRCFILE .xz)"
325     IFTAR="${IFTAR##*.}"
326     if [[ ${IFTAR} = tar ]]
327     then
328     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
329     else
330     pushd ${DEST} > /dev/null
331     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
332     popd > /dev/null
333     fi
334     ;;
335     tbz2|mpks|mpk)
336     tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
337   ;;   ;;
338   tgz)   tgz)
339   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
340     ;;
341     txz|mpkzs|mpkz)
342     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
343     ;;
344     rar)
345     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
346     ;;
347     zip|xpi)
348     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
349     ;;
350     rpm)
351     pushd ${DEST} > /dev/null
352     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
353     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
354     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
355     then
356     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
357     fi
358   ;;   ;;
359   *)   *)
360   die "munpack failed"   die "munpack failed"
# Line 358  mpatch() Line 366  mpatch()
366  {  {
367   local PATCHOPTS   local PATCHOPTS
368   local PATCHFILE   local PATCHFILE
369     local i
370    
371   PATCHOPTS=$1   PATCHOPTS=$1
372   PATCHFILE=$2   PATCHFILE=$2
373    
374     if [[ -z $2 ]]
375     then
376     PATCHFILE=$1
377    
378     ## patch level auto-detection, get patch level
379     for ((i=0; i < 10; i++))
380     do
381     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
382     if [[ $? = 0 ]]
383     then
384     PATCHOPTS="-Np${i}"
385     break
386     fi
387     done
388     fi
389    
390   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
391   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
392  }  }
393    
394    mlibtoolize()
395    {
396     local opts="$@"
397     [[ -z ${opts} ]] && opts="--verbose --install --force"
398    
399     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
400    }
401    
402    mautoreconf()
403    {
404     local opts="$@"
405     [[ -z ${opts} ]] && opts="--verbose --install --force"
406    
407     autoreconf ${opts} || die "running: mautoreconf ${opts}"
408    }
409    
410  minstalldocs()  minstalldocs()
411  {  {
412   local docfiles   local docfiles
413     local doc
414   docfiles="$@"   docfiles="$@"
415    
416   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
# Line 377  minstalldocs() Line 418  minstalldocs()
418   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
419   fi   fi
420    
421   for i in ${docfiles}   for doc in ${docfiles}
422   do   do
423   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${doc} ]
424   install -m 0644 ${SRCDIR}/${i}.gz \   then
425   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   if mqueryfeature "compressdoc"
426     then
427     cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}."
428     chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "fixing permissions of ${doc}."
429     else
430     install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."
431     fi
432     fi
433   done   done
434  }  }
435    
# Line 389  mstriplibs() Line 437  mstriplibs()
437  {  {
438   local stripdir="$@"   local stripdir="$@"
439    
440   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
441   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   [[ -z ${STRIP_DYN_LIB} ]] && STRIP_DYN_LIB="--strip-debug"
442     find ${stripdir} ! -type d | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null
443  }  }
444    
445  mstripbins()  mstripbins()
446  {  {
447   local stripdir="$@"   local stripdir="$@"
448    
449   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
450   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   [[ -z ${STRIP_DYN_BIN} ]] && STRIP_DYN_BIN="--strip-debug"
451     find ${stripdir} ! -type d | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null
452    }
453    
454    mstripstatic()
455    {
456     local stripdir="$@"
457    
458     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
459     [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug"
460     find ${stripdir} ! -type d | xargs file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null
461    }
462    
463    mstriplibtoolarchive()
464    {
465     local stripdir="$@"
466    
467     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
468     find ${stripdir} ! -type d -name \*.la | xargs | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null
469    }
470    
471    mpurgetargets()
472    {
473     local stripdir="$@"
474     local target
475    
476     [[ -z ${stripdir} ]] && stripdir=${BINDIR}
477     # nothing to do in this case
478     [[ -z ${PURGE_TARGETS[*]} ]] && return
479    
480     for target in ${PURGE_TARGETS[*]}
481     do
482     # check if target is a regex pattern without any slashes
483     if [[ ${target} = ${target//\/} ]]
484     then
485     find ${BINDIR} -type f -name "${target}" | xargs --no-run-if-empty rm -f -- 2> /dev/null
486     else
487     rm -f -- ${target} 2> /dev/null
488     fi
489     done
490    }
491    
492    mcompressdocs()
493    {
494     local bindir="$@"
495    
496     if [ -d ${bindir}/usr/share/man ]
497     then
498     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
499     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
500     fi
501    
502     if [ -d ${bindir}/usr/share/info ]
503     then
504     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
505     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
506     fi
507  }  }
508    
509  sminclude()  sminclude()
# Line 420  setup_distcc_environment() Line 525  setup_distcc_environment()
525  {  {
526   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
527   then   then
528   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
529   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"
530    
531   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
# Line 435  setup_ccache_environment() Line 540  setup_ccache_environment()
540  {  {
541   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
542   then   then
543   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
544   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"
545   fi   fi
546  }  }
547    
   
548  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
549  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
550  fix_mage_deps()  fix_mage_deps()
# Line 459  fix_mage_deps() Line 563  fix_mage_deps()
563   # fix DEPEND   # fix DEPEND
564   while read sym dep   while read sym dep
565   do   do
566     # ignore empty lines
567     [[ -z ${dep} ]] && continue
568    
569   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
570   # change if not virtual   # change if not virtual
571   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 511  EOF Line 618  EOF
618  # special tags:  # special tags:
619  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
620  #   INHERITS              which functions get included  #   INHERITS              which functions get included
621  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
622  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
623    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
624    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
625    #                         (only in the resulting magefile}
626  #  #
627  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
628  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 523  build_mage_script() Line 633  build_mage_script()
633   local magefile   local magefile
634   local dest   local dest
635   local target   local target
636     local split_pkg_base
637   local sym   local sym
638   local depname   local depname
639    
# Line 530  build_mage_script() Line 641  build_mage_script()
641   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
642    
643   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
644   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
645    
646     # mark package as splitpackage
647     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
648    
649   # name of magefile   # name of magefile
650   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 539  build_mage_script() Line 653  build_mage_script()
653   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
654    
655   # show what we are doing   # show what we are doing
656   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
657   echo "  ${dest}"   echo "${dest}"
658    
659   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
660   # now build the mage file   # now build the mage file
661   > ${dest}   > ${dest}
662    
  # header  
  echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.43 2006-07-17 20:44:44 niro Exp $' >> ${dest}  
  echo  >> ${dest}  
   
663   # pgkname and state   # pgkname and state
664   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
665   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
  echo >> ${dest}  
666    
667   # description and homepage   # description and homepage
668   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
669   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
  echo >> ${dest}  
670    
671   # special tags and vars   # special tags and vars
672   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
673    
674   # echo MAGE_TARGETS ## note -target is needed !   # echo MAGE_TARGETS ## note -target is needed !
675   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
676   echo >> ${dest}  
677     # split package base
678     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
679    
680   # add special vars   # add special vars
681   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
# Line 576  build_mage_script() Line 686  build_mage_script()
686   # being tricky here :)   # being tricky here :)
687   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
688   done   done
  echo  >> ${dest}  
689   fi   fi
690    
691   # add at least all includes   # add at least all includes
# Line 588  build_mage_script() Line 697  build_mage_script()
697   do   do
698   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
699   done   done
700   echo  >> ${dest}   # a CRLF is needed here!
701     echo >> ${dest}
702   fi   fi
  echo >> ${dest}  
703    
704   # deps and provides   # deps and provides
705   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
  echo >> ${dest}  
706   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
  echo >> ${dest}  
707   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
  echo >> ${dest}  
708    
709   # add special functions   # add special functions
710   if [ -n "${SPECIAL_FUNCTIONS}" ]   if [ -n "${SPECIAL_FUNCTIONS}" ]
# Line 608  build_mage_script() Line 714  build_mage_script()
714   do   do
715   # add to mage (quotes needed !)   # add to mage (quotes needed !)
716   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  echo >> ${dest}  
717   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
718   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
719   done   done
  echo  >> ${dest}  
720   fi   fi
721    
722   # pre|post-install|removes   # pre|post-install|removes
723   typeset -f preinstall >> ${dest}   typeset -f preinstall >> ${dest}
  echo  >> ${dest}  
724   typeset -f postinstall >> ${dest}   typeset -f postinstall >> ${dest}
  echo  >> ${dest}  
725   typeset -f preremove >> ${dest}   typeset -f preremove >> ${dest}
  echo  >> ${dest}  
726   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
  echo  >> ${dest}  
727  }  }
728    
729  regen_mage_tree()  regen_mage_tree()
730  {  {
731   local i   local subpackage
732    
733   # build them only if requested   # build them only if requested
734   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
735   then   then
736   # run it without targets   # run it without targets
737   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
738   then   then
739     # build for each target a mage file
740     # run it with several targets
741   echo   echo
742   build_mage_script   for subpackage in ${MAGE_TARGETS}
743     do
744     build_mage_script --target "${subpackage}"
745     done
746   echo   echo
  else  
747    
748   # build for each target an mage file   # run it for splitpackages
749     elif [[ -n ${SPLIT_PACKAGES} ]]
750     then
751     local split_pkg_base="${PNAME}"
752     # save smage environment
753     split_save_variables
754     # build for each subpackage a mage file
755   # run it with several targets   # run it with several targets
756   for i in ${MAGE_TARGETS}   echo
757     for subpackage in ${SPLIT_PACKAGES}
758   do   do
759   echo   # get the right variables for the split
760   build_mage_script "${i}"   export PNAME="${subpackage}"
761   echo   split_info_${subpackage}
762     # get the preinstall etc
763     split_export_inherits ${subpackage}
764     build_mage_script --split-pkg-base "${split_pkg_base}"
765     # delete split preinstall etc
766     split_delete_inherits ${subpackage}
767     # restore smage environment
768     split_restore_variables
769   done   done
770     echo
771     # unset all saved smage variables
772     split_unset_variables
773    
774     else
775     echo
776     build_mage_script
777     echo
778   fi   fi
779   fi   fi
780    
781   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
782   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
783   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
784   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
785   do  # do
786   unset "${i}"  # unset "${i}"
787   done  # done
788   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
789   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
790   do  # do
791   unset "${i}"  # unset "${i}"
792   done  # done
793   unset SPECIAL_VARS   unset SPECIAL_VARS
794   unset STATE   unset STATE
795   unset DESCRIPTION   unset DESCRIPTION
796   unset HOMEPAGE   unset HOMEPAGE
797   unset PKGTYPE   # unset PKGTYPE <-- don't do that either; smage needs this var
798   unset INHERITS   unset INHERITS
799   unset DEPEND   unset DEPEND
800   unset SDEPEND   unset SDEPEND
# Line 679  regen_mage_tree() Line 805  regen_mage_tree()
805   unset postremove   unset postremove
806  }  }
807    
808    split_save_variables()
809    {
810     export SAVED_PNAME="${PNAME}"
811     export SAVED_PVER="${PVER}"
812     export SAVED_PBUILD="${PBUILD}"
813     export SAVED_PCATEGORIE="${PCATEGORIE}"
814     export SAVED_DESCRIPTION="${DESCRIPTION}"
815     export SAVED_HOMEPAGE="${HOMEPAGE}"
816     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
817     export SAVED_STATE="${STATE}"
818     export SAVED_PKGTYPE="${PKGTYPE}"
819     export SAVED_INHERITS="${INHERITS}"
820     export SAVED_DEPEND="${DEPEND}"
821     export SAVED_SDEPEND="${SDEPEND}"
822     export SAVED_PROVIDE="${PROVIDE}"
823     export SAVED_PKGTYPE="${PKGTYPE}"
824    
825     # special handling needed for mage features
826     # pkgbuild
827     mqueryfeature "pkgbuild" && export SAVED_FEATURE_PKGBUILD="pkgbuild"
828     mqueryfeature "!pkgbuild" && export SAVED_FEATURE_PKGBUILD="!pkgbuild"
829     # strip
830     mqueryfeature "strip" && export SAVED_FEATURE_STRIP="strip"
831     mqueryfeature "!strip" && export SAVED_FEATURE_STRIP="!strip"
832     # libtool
833     mqueryfeature "libtool" && export SAVED_FEATURE_LIBTOOL="libtool"
834     mqueryfeature "!libtool" && export SAVED_FEATURE_LIBTOOL="!libtool"
835     # compressdoc
836     mqueryfeature "compressdoc" && export SAVED_FEATURE_COMPRESSDOC="compressdoc"
837     mqueryfeature "!compressdoc" && export SAVED_FEATURE_COMPRESSDOC="!compressdoc"
838    
839     # bindir too
840     export SAVED_BINDIR="${BINDIR}"
841    
842     # export the SPLIT_PACKAGE_BASE
843     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
844    
845     # functions
846     if [[ ! -z $(typeset -f preinstall) ]]
847     then
848     # rename the old one
849     local saved_preinstall
850     saved_preinstall=SAVED_$(typeset -f preinstall)
851     eval "${saved_preinstall}"
852     export -f SAVED_preinstall
853     fi
854    
855     if [[ ! -z $(typeset -f postinstall) ]]
856     then
857     # rename the old one
858     local saved_postinstall
859     saved_postinstall=SAVED_$(typeset -f postinstall)
860     eval "${saved_postinstall}"
861     export -f SAVED_postinstall
862     fi
863    
864     if [[ ! -z $(typeset -f preremove) ]]
865     then
866     # rename the old one
867     local saved_preremove
868     saved_preremove=SAVED_$(typeset -f preremove)
869     eval "${saved_preremove}"
870     export -f SAVED_preremove
871     fi
872    
873     if [[ ! -z $(typeset -f postremove) ]]
874     then
875     # rename the old one
876     local saved_postremove
877     saved_postremove=SAVED_$(typeset -f postremove)
878     eval "${saved_postremove}"
879     export -f SAVED_postremove
880     fi
881    }
882    
883    split_restore_variables()
884    {
885     export PNAME="${SAVED_PNAME}"
886     export PVER="${SAVED_PVER}"
887     export PBUILD="${SAVED_PBUILD}"
888     export PCATEGORIE="${SAVED_PCATEGORIE}"
889     export DESCRIPTION="${SAVED_DESCRIPTION}"
890     export HOMEPAGE="${SAVED_HOMEPAGE}"
891     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
892     export STATE="${SAVED_STATE}"
893     export PKGTYPE="${SAVED_PKGTYPE}"
894     export INHERITS="${SAVED_INHERITS}"
895     export DEPEND="${SAVED_DEPEND}"
896     export SDEPEND="${SAVED_SDEPEND}"
897     export PROVIDE="${SAVED_PROVIDE}"
898     export PKGTYPE="${SAVED_PKGTYPE}"
899    
900     # special handling needed for mage features
901     # pkgbuild
902     msetfeature "${SAVED_FEATURE_PKGBUILD}"
903     # strip
904     msetfeature "${SAVED_FEATURE_STRIP}"
905     # libtool
906     msetfeature "${SAVED_FEATURE_LIBTOOL}"
907     # compressdoc
908     msetfeature "${SAVED_FEATURE_COMPRESSDOC}"
909    
910     # bindir too
911     export BINDIR="${SAVED_BINDIR}"
912    
913     # functions
914     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
915     then
916     # rename the old one
917     local saved_preinstall
918     saved_preinstall=$(typeset -f SAVED_preinstall)
919     eval "${saved_preinstall/SAVED_/}"
920     export -f preinstall
921     fi
922    
923     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
924     then
925     # rename the old one
926     local saved_postinstall
927     saved_postinstall=$(typeset -f SAVED_postinstall)
928     eval "${saved_postinstall/SAVED_/}"
929     export -f postinstall
930     fi
931    
932     if [[ ! -z $(typeset -f SAVED_preremove) ]]
933     then
934     # rename the old one
935     local saved_preremove
936     saved_preremove=$(typeset -f SAVED_preremove)
937     eval "${saved_preremove/SAVED_/}"
938     export -f preremove
939     fi
940    
941     if [[ ! -z $(typeset -f SAVED_postremove) ]]
942     then
943     # rename the old one
944     local saved_postremove
945     saved_postremove=$(typeset -f SAVED_postremove)
946     eval "${saved_postremove/SAVED_/}"
947     export -f postremove
948     fi
949    }
950    
951    split_unset_variables()
952    {
953     # unset saved vars; not needed anymore
954     unset SAVED_PNAME
955     unset SAVED_PVER
956     unset SAVED_PBUILD
957     unset SAVED_PCATEGORIE
958     unset SAVED_DESCRIPTION
959     unset SAVED_HOMEPAGE
960     unset SAVED_SPECIAL_VARS
961     unset SAVED_STATE
962     unset SAVED_PKGTYPE
963     unset SAVED_INHERITS
964     unset SAVED_DEPEND
965     unset SAVED_SDEPEND
966     unset SAVED_PROVIDE
967     unset SAVED_BINDIR
968     unset SAVED_PKGTYPE
969     unset SAVED_FEATURE_PKGBUILD
970     unset SAVED_FEATURE_STRIP
971     unset SAVED_FEATURE_LIBTOOL
972     unset SAVED_FEATURE_COMPRESSDOC
973     unset SPLIT_PACKAGE_BASE
974     unset -f SAVED_preinstall
975     unset -f SAVED_postinstall
976     unset -f SAVED_preremove
977     unset -f SAVED_postremove
978    }
979    
980    split_export_inherits()
981    {
982     local subpackage="$1"
983     local func
984     local newfunc
985    
986     for func in preinstall postinstall preremove postremove
987     do
988     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
989     then
990     newfunc=$(typeset -f ${func}_${subpackage})
991     newfunc="${newfunc/_${subpackage} (/ (}"
992     eval "${newfunc}"
993     fi
994     done
995    }
996    
997    split_delete_inherits()
998    {
999     local subpackage="$1"
1000     local func
1001    
1002     for func in preinstall postinstall preremove postremove
1003     do
1004     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1005     then
1006     unset -f ${func}
1007     fi
1008     done
1009     }
1010    
1011  export_inherits()  export_inherits()
1012  {  {
1013   local include="$1"   local include="$1"
# Line 744  generate_package_md5sum() Line 1073  generate_package_md5sum()
1073   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1074    
1075   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1076   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
1077   then   then
1078   echo -n "Generating a md5sum for ${pkgname}.${PKGSUFFIX} ... "   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1079    
1080   # abort if not exist   # abort if not exist
1081   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
1082   then   then
1083   echo "! exists"   echo -e "${COLRED}! exists${COLDEFAULT}"
1084   return 0   return 0
1085   fi   fi
1086    
# Line 759  generate_package_md5sum() Line 1088  generate_package_md5sum()
1088   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1089    
1090   # setup md5 dir   # setup md5 dir
1091   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1092   install -d ${dest}   install -d ${dest}
1093    
1094   # gen md5sum   # gen md5sum
1095   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
1096   > ${dest}/${pkgname}.md5   > ${dest}/${pkgname}.md5
1097   echo "done"   echo -e "${COLGREEN}done${COLDEFAULT}"
1098   fi   fi
1099  }  }
1100    
1101    source_pkg_build()
1102    {
1103     if [[ ${PKGTYPE} = virtual ]]
1104     then
1105     echo "Virtual package detected; src-pkg-tarball not necessary ..."
1106     return 0
1107     fi
1108    
1109     if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1110     then
1111     echo "No SRC_URI defined; src-pkg-tarball not necessary ..."
1112     return 0
1113     fi
1114    
1115     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
1116    
1117     echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
1118    
1119     # include the smage2 file
1120     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
1121    
1122     ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
1123     [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1124     mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1125    
1126     echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1127    }
1128    
1129    step_by_step()
1130    {
1131     if mqueryfeature stepbystep
1132     then
1133     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1134     echo "Press [enter] to continue"
1135     read
1136     fi
1137    }
1138    
1139    
1140  # print out our version  # print out our version
1141  showversion  showversion
1142  echo  echo
# Line 780  then Line 1148  then
1148   exit 1   exit 1
1149  fi  fi
1150    
1151    # load supported mage features
1152    load_mage_features
1153    
1154  # updating smage2-scripts  # updating smage2-scripts
1155  if [[ $1 = update ]]  if [[ $1 = update ]]
1156  then  then
# Line 794  fi Line 1165  fi
1165  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1166  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1167  then  then
1168   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1169   then   then
1170   SMAGENAME="$2"   SMAGENAME="$2"
1171   MD5DIR="$3"   MD5DIR="$3"
1172   source ${SMAGENAME} || die "download source failed"   [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1173    
1174     smagesource ${SMAGENAME} || die "download source failed"
1175    
1176   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
1177   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
# Line 850  then Line 1223  then
1223   echo   echo
1224   else   else
1225   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1226   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1227   echo   echo
1228   echo   echo
1229   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 872  then Line 1245  then
1245   # get smage   # get smage
1246   SMAGENAME="$2"   SMAGENAME="$2"
1247   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1248   source ${SMAGENAME} || die "download source failed"   smagesource ${SMAGENAME} || die "download source failed"
1249    
1250   download_sources   download_sources
1251   exit 0   exit 0
# Line 884  then Line 1257  then
1257   # set correct SMAGENAME   # set correct SMAGENAME
1258   SMAGENAME="$2"   SMAGENAME="$2"
1259   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1260   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1261    
1262   regen_mage_tree   regen_mage_tree
1263    
1264   # build md5sum for existing packages   # build several targets
1265   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1266   --pcat "${PCATEGORIE}" \   then
1267   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1268   --pver "${PVER}" \   do
1269   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1270   --parch "${ARCH}" \   generate_package_md5sum \
1271   --target "${target}"   --pcat "${PCATEGORIE}" \
1272     --pname "${PNAME}" \
1273     --pver "${PVER}" \
1274     --pbuild "${PBUILD}" \
1275     --parch "${ARCH}" \
1276     --target "${target}"
1277     done
1278    
1279     # build several subpackages
1280     elif [[ -n ${SPLIT_PACKAGES} ]]
1281     then
1282     split_save_variables
1283     for subpackage in ${SPLIT_PACKAGES}
1284     do
1285     # get the right variables for the split
1286     export PNAME="${subpackage}"
1287     split_info_${subpackage}
1288     # build md5sum for existing packages
1289     generate_package_md5sum \
1290     --pcat "${PCATEGORIE}" \
1291     --pname "${PNAME}" \
1292     --pver "${PVER}" \
1293     --pbuild "${PBUILD}" \
1294     --parch "${ARCH}"
1295     # restore smage environment
1296     split_restore_variables
1297     done
1298     # unset all saved smage variables
1299     split_unset_variables
1300    
1301     else
1302     # build md5sum for existing packages
1303     generate_package_md5sum \
1304     --pcat "${PCATEGORIE}" \
1305     --pname "${PNAME}" \
1306     --pver "${PVER}" \
1307     --pbuild "${PBUILD}" \
1308     --parch "${ARCH}"
1309     fi
1310    
1311     exit 0
1312    fi
1313    
1314    if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1315    then
1316     # set correct SMAGENAME
1317     SMAGENAME="$2"
1318     MD5DIR="$(dirname ${SMAGENAME})/md5"
1319    
1320     echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
1321    
1322     smagesource ${SMAGENAME} || die "regen: smage2 not found"
1323    
1324     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1325     then
1326     echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1327     rm -rf ${SOURCEDIR}/${PKGNAME}
1328     fi
1329    
1330     download_sources
1331     source_pkg_build ${SMAGENAME}
1332   exit 0   exit 0
1333  fi  fi
1334    
1335    if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1336    then
1337     SRCPKGTARBALL="${2}"
1338     msetfeature "srcpkgtarball"
1339    
1340     # abort if given file is not a source pkg
1341     [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
1342    
1343     # set correct SMAGENAME; use the one that the src_pkg provide
1344     # /path/to/SOURCEDIR/PNAME/SMAGENAME
1345     SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
1346    
1347     echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1348    
1349     [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
1350    
1351     # unpack srctarball
1352     [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1353    
1354     tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1355    
1356     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1357    fi
1358    
1359    
1360  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1361  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1362   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1363  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1364  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1365  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1366  [ -z "${BINDIR}" ] && die "no BINDIR variable found in /etc/mage.rc"  [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1367  [ -z "${CHOST}" ] && die "no CHOST variable found in /etc/mage.rc"  [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1368  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in /etc/mage.rc"  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1369  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in /etc/mage.rc"  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1370    
1371  source ${SMAGENAME} || die "source failed"  smagesource ${SMAGENAME} || die "source failed"
1372  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1373  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1374    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1375    
1376  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1377  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1378    
1379  # auto regen mage tree if requested  # auto regen mage tree if requested
1380  regen_mage_tree  regen_mage_tree
1381    
1382    if mqueryfeature "srcpkg"
1383    then
1384     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1385     then
1386     echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1387     rm -rf ${SOURCEDIR}/${PNAME}
1388     fi
1389    fi
1390    
1391  # download sources  # download sources
1392  download_sources  mqueryfeature "srcpkgtarball" || download_sources
1393    
1394  # fixes some issues with these functions  # fixes some issues with these functions
1395  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
1396  export -f src_compile || die "src_compile export failed"  export -f src_compile || die "src_compile export failed"
1397    export -f src_check || die "src_check export failed"
1398  export -f src_install || die "src_install export failed"  export -f src_install || die "src_install export failed"
1399    
1400  # fixes some compile issues  # fixes some compile issues
# Line 936  export CXXFLAGS="${CFLAGS}" || die "CXXF Line 1404  export CXXFLAGS="${CFLAGS}" || die "CXXF
1404  export BINDIR="${BINDIR}" || die "BINDIR export failed"  export BINDIR="${BINDIR}" || die "BINDIR export failed"
1405  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"
1406    
   
1407  # setup distcc  # setup distcc
1408  # setup for distcc goes *before* ccache, so ccache comes before distcc in path  # setup for distcc goes *before* ccache, so ccache comes before distcc in path
1409  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment  mqueryfeature "distcc" && setup_distcc_environment
1410    
1411  # setup ccache  # setup ccache
1412  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  mqueryfeature "ccache" && setup_ccache_environment
1413    
1414  # small sleep to show our settings  # clean up builddir if a previously one exist
 sleep 1  
   
 # cleans up build if a previously one exists  
1415  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1416  then  then
1417   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1418  fi  fi
1419  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1420    
1421  # cleans up srcdir if a previously unpacked one exists  # clean up srcdir if a previously unpacked one exist
1422  if [ -d ${SRCDIR} ]  if [ -d ${SRCDIR} ]
1423  then  then
1424   rm -rf ${SRCDIR}   rm -rf ${SRCDIR}
1425  fi  fi
1426    
1427  # cleans up bindir if a previous build exists or creates a new one  # clean up bindir if a previous build exist or create a new one
1428  if [ -d ${BINDIR} ]  if [ -d ${BINDIR} ]
1429  then  then
1430   rm -rf ${BINDIR}   rm -rf ${BINDIR}
1431  fi  fi
1432  install -d ${BINDIR} || die "couldn't create \$BINDIR."  install -d ${BINDIR} || die "couldn't create \$BINDIR."
1433    
1434  # cleans up package temp dir if a previous build exists  # clean up package temp dir if a previous build exist
1435  if [ -d ${BUILDDIR}/${PKGNAME} ]  if [ -d ${BUILDDIR}/${PKGNAME} ]
1436  then  then
1437   rm -rf ${BUILDDIR}/${PKGNAME}   rm -rf ${BUILDDIR}/${PKGNAME}
1438  fi  fi
1439    
1440  # cleans up timestamp if one exists  # setup build logging
1441  if [ -f /var/tmp/timestamp ]  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1442    echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1443    
1444    if [[ ${PKGTYPE} = virtual ]]
1445  then  then
1446   mage rmstamp   echo "virtual package detected; nothing will be build ..."
1447     # automatically set !pkgbuild here too
1448     msetfeature "!pkgbuild"
1449    else
1450     src_prepare | ${SMAGE_LOG_CMD}
1451     die_pipestatus 0 "src_prepare failed"
1452     step_by_step $_
1453    
1454     src_compile | ${SMAGE_LOG_CMD}
1455     die_pipestatus 0 "src_compile failed"
1456     step_by_step $_
1457    
1458     # only run checks if requested
1459     if mqueryfeature "!check"
1460     then
1461     echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1462     step_by_step src_check
1463     else
1464     src_check | ${SMAGE_LOG_CMD}
1465     die_pipestatus 0 "src_check failed"
1466     step_by_step $_
1467     fi
1468    
1469     # build several subpackages
1470     if [[ -n ${SPLIT_PACKAGES} ]]
1471     then
1472     # save bindir & pname
1473     split_save_variables
1474     export SAVED_BINDIR="${BINDIR}"
1475     for subpackage in ${SPLIT_PACKAGES}
1476     do
1477     if typeset -f src_install_${subpackage} > /dev/null
1478     then
1479     # export subpackage bindir
1480     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1481     # export PNAME, several internal function and include
1482     # rely on this variable
1483     export PNAME="${subpackage}"
1484    
1485     echo
1486     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1487     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1488     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1489     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1490    
1491     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1492     die_pipestatus 0 "src_install_${subpackage} failed"
1493     step_by_step $_
1494     fi
1495     done
1496     # restore bindir & pname
1497     split_restore_variables
1498     # unset all saved smage variables
1499     split_unset_variables
1500     else
1501     src_install | ${SMAGE_LOG_CMD}
1502     die_pipestatus 0 "src_install failed"
1503     step_by_step $_
1504     fi
1505  fi  fi
1506    
1507  src_prepare || die "src_prepare failed"  # echo for sake of good-looking
1508  src_compile || die "src_compile failed"  echo
 src_install || die "src_install failed"  
1509    
1510    if mqueryfeature "!compressdoc"
1511    then
1512     echo -e "!compressdoc detected; documentation will not be compressed ..."
1513    elif mqueryfeature "!pkgbuild"
1514    then
1515     echo "!pkgbuild detected; skipping documentation compression..."
1516    else
1517     # compressing doc, info & man files
1518     if [[ -n ${SPLIT_PACKAGES} ]]
1519     then
1520     for subpackage in ${SPLIT_PACKAGES}
1521     do
1522     mcompressdocs ${BINDIR}_${subpackage}
1523     done
1524     else
1525     mcompressdocs ${BINDIR}
1526     fi
1527    fi
1528    
1529  # compressing doc, info & man files  if mqueryfeature "!libtool"
 echo -e "Compressing man-pages ..."  
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1530  then  then
1531   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   if mqueryfeature "!pkgbuild"
1532     then
1533     echo "!pkgbuild detected; skipping libtool archive stripping ..."
1534     else
1535     if [[ -n ${SPLIT_PACKAGES} ]]
1536     then
1537     for subpackage in ${SPLIT_PACKAGES}
1538     do
1539     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}"
1540     mstriplibtoolarchive ${BINDIR}_${subpackage}
1541     done
1542     else
1543     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"
1544     mstriplibtoolarchive ${BINDIR}
1545     fi
1546     fi
1547  fi  fi
1548    
1549  echo -e "Compressing info-pages ..."  if mqueryfeature "purge"
 if [ -d ${BUILDDIR}/builded/usr/share/info ]  
1550  then  then
1551   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   if mqueryfeature "!pkgbuild"
1552     then
1553     echo "!pkgbuild detected; skipping file purgation..."
1554     else
1555     if [[ -n ${SPLIT_PACKAGES} ]]
1556     then
1557     for subpackage in ${SPLIT_PACKAGES}
1558     do
1559     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}"
1560     mpurgetargets ${BINDIR}_${subpackage}
1561     done
1562     else
1563     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"
1564     mpurgetargets ${BINDIR}
1565     fi
1566     fi
1567  fi  fi
1568    
1569  # stripping all bins and libs  # stripping all bins and libs
1570  case ${NOSTRIP} in  if mqueryfeature "!strip"
1571   true|TRUE|yes|y)  then
1572   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "!strip detected; Package will not be stripped ..."
1573   ;;  elif mqueryfeature "!pkgbuild"
1574   *)  then
1575   echo -e "Stripping binaries ..."   echo "!pkgbuild detected; skipping stripping of the package ..."
1576   mstripbins ${BINDIR}  else
1577   echo -e "Stripping libraries ..."   if [[ -n ${SPLIT_PACKAGES} ]]
1578   mstriplibs ${BINDIR}   then
1579   ;;   for subpackage in ${SPLIT_PACKAGES}
1580  esac   do
1581     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1582  # the new buildpkg command   mstripbins ${BINDIR}_${subpackage}
1583  case ${NOPKGBUILD} in   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1584   true|TRUE|yes|y)   mstriplibs ${BINDIR}_${subpackage}
1585   echo -e "NOPGKBUILD=true detected; Package will not be build ..."   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1586   ;;   mstripstatic ${BINDIR}_${subpackage}
1587   *)   done
1588     else
1589     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1590     mstripbins ${BINDIR}
1591     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1592     mstriplibs ${BINDIR}
1593     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1594     mstripstatic ${BINDIR}
1595     fi
1596    fi
1597    
1598    if mqueryfeature "!pkgbuild"
1599    then
1600     echo -e "!pkgbuild detected; Package will not be build ..."
1601    else
1602   # build several targets   # build several targets
1603   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1604   then   then
1605   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1606   do   do
1607   # check if an special target_pkgbuild exists   # check if a special target_pkgbuild exists
1608   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1609   then   then
1610   # run it   # run it
# Line 1041  case ${NOPKGBUILD} in Line 1624  case ${NOPKGBUILD} in
1624   --parch "${ARCH}" \   --parch "${ARCH}" \
1625   --target "${target}"   --target "${target}"
1626    
1627   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1628     done
1629    
1630     # build several subpackages
1631     elif [[ -n ${SPLIT_PACKAGES} ]]
1632     then
1633     split_save_variables
1634     for subpackage in ${SPLIT_PACKAGES}
1635     do
1636     # get the right variables for the split
1637     export PNAME="${subpackage}"
1638     split_info_${PNAME}
1639    
1640     # jump to next one if !pkgbuild is set in split_info
1641     mqueryfeature "!pkgbuild" && continue
1642    
1643     # check if an special subpackage_pkgbuild exists
1644     if typeset -f ${PNAME}_pkgbuild > /dev/null
1645     then
1646     # run it
1647     ${PNAME}_pkgbuild
1648     fi
1649     # now create the target package
1650     ${MLIBDIR}/pkgbuild_dir.sh \
1651     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1652     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1653    
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 ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1663    
1664     # restore smage environment
1665     split_restore_variables
1666   done   done
1667     # unset all saved smage variables
1668     split_unset_variables
1669    
1670   else   else
1671   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1672    
# Line 1054  case ${NOPKGBUILD} in Line 1678  case ${NOPKGBUILD} in
1678   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1679   --parch "${ARCH}"   --parch "${ARCH}"
1680    
1681   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1682   fi   fi
  ;;  
 esac  
1683    
1684  # for sure   # build src-pkg-tarball if requested
1685  unset NOPKGBUILD   mqueryfeature "srcpkg" && source_pkg_build ${SMAGENAME}
1686  unset NOSTRIP  fi
1687    
1688    if mqueryfeature "buildlog"
1689    then
1690     bzip2 -9f /var/log/smage/${PKGNAME}.log
1691    else
1692     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1693    fi
1694    
1695  xtitleclean  xtitleclean

Legend:
Removed from v.384  
changed lines
  Added in v.1601