Magellan Linux

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

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

revision 477 by niro, Mon Apr 23 16:41:44 2007 UTC revision 1639 by niro, Fri Jan 13 18:27:28 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.57 2007-04-23 16:41:44 niro Exp $  
8    
 #01.10.2004  
 # added ccache support  
 # added distcc support  
9    
10  # set default user mage.rc  # set default user mage.rc
11  : ${MAGERC="/etc/mage.rc"}  : ${MAGERC="/etc/mage.rc"}
12    
 ## setup ##  
 PKGSUFFIX="mpk"  
 SRCPKGSUFFIX="mpks"  
 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  
   
13  # export default C locale  # export default C locale
14  export LC_ALL=C  export LC_ALL=C
15    
16  source /etc/mage.rc.global  source /etc/mage.rc.global
17  source ${MAGERC}  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  # expand PKGDIR, BUILDDIR and BINDIR with MROOT
25  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
26  then  then
27   export PKGDIR=${MROOT}/${PKGDIR}   export PKGDIR=${MROOT}/${PKGDIR}
# Line 59  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 73  die() Line 70  die()
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 129  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, no 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  
   
  # if an mirrored file than replace first the mirror uri  
  if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]  
  then  
  for mirror in ${MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  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  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]  
  then  
  for mirror in ${SOURCEFORGE_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  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  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]  
  then  
  for mirror in ${GNU_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  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  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]  
  then  
  for mirror in ${KDE_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"  
167    
168   if [[ ${FETCHING} = true ]]   # subdir in sources dir; the my_SRCI_URI file goes to there
169   then   subdir="${SRC_URI[${i}]##*' '}"
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  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  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]  
  then  
  for mirror in ${GNOME_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|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 -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  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 -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   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   # always use verbose mode for source downloads
181   unset my_SRC_URI_DEST   FVERBOSE=off msetfeature "verbose"
182   unset my_SRC_URI_MIRROR   # do not die here, mchecksum catches download errors
183   unset my_SOURCEDIR   mdownload --uri "${uri}" --dir "${outputdir}"
184   done  
185     # unset them to be sure
186     unset uri
187     unset subdir
188     unset outputdir
189     done
190    
191   # recheck md5 sums   # recheck md5 sums after download
192   echo   echo
193   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
194   ( 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"
195   echo   echo
196     else
197     echo -e "${COLBLUE}===${COLGREEN} All sources already fetched, nothing to do${COLDEFAULT}"
198     fi
199    
200   # not needed anymore   # not needed anymore
201   unset SRC_URI   unset SRC_URI
202  }  }
203    
204  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
205  src_prepare()  src_prepare()
206  {  {
207   echo "no src_prepare defined"   echo "no src_prepare defined; doing nothing ..."
  sleep 2  
208   return 0   return 0
209  }  }
210    
211  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
212  src_compile()  src_compile()
213  {  {
214   echo "no src_compile defined"   echo "no src_compile defined; doing nothing ..."
  sleep 2  
215   return 0   return 0
216  }  }
217    
218  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
219    src_check()
220    {
221     echo "no src_check defined; doing nothing ..."
222     return 0
223    }
224    
225    # dummy function, used if that does not exist in smage file
226  src_install()  src_install()
227  {  {
228   echo "no src_install defined"   echo "no src_install defined; doing nothing ..."
  sleep 2  
229   return 0   return 0
230  }  }
231    
# Line 357  mlibdir() Line 239  mlibdir()
239    
240  mconfigure()  mconfigure()
241  {  {
242     local myopts
243     if [[ ! -z ${CTARGET} ]]
244     then
245     myopts+=" --target=${CTARGET}"
246     fi
247    
248   if [ -x ./configure ]   if [ -x ./configure ]
249   then   then
250     # if requested disable-static
251     if [[ ! -z $(./configure --help | grep -- '--.*able-static') ]]
252     then
253     if mqueryfeature '!static'
254     then
255     myopts+=" --disable-static"
256     else
257     myopts+=" --enable-static"
258     fi
259     fi
260    
261     # always enable shared by default
262     if [[ ! -z $(./configure --help | grep -- '--.*able-shared') ]]
263     then
264     myopts+=" --enable-shared"
265     fi
266    
267   ./configure \   ./configure \
268   --prefix=/usr \   --prefix=/usr \
269   --host=${CHOST} \   --host=${CHOST} \
270     --build=${CHOST} \
271   --mandir=/usr/share/man \   --mandir=/usr/share/man \
272   --infodir=/usr/share/info \   --infodir=/usr/share/info \
273   --datadir=/usr/share \   --datadir=/usr/share \
274   --sysconfdir=/etc \   --sysconfdir=/etc \
275   --localstatedir=/var/lib \   --localstatedir=/var/lib \
276   --libdir=/usr/$(mlibdir) \   --libdir=/usr/$(mlibdir) \
277     ${myopts} \
278   "$@" || die "mconfigure failed"   "$@" || die "mconfigure failed"
279   else   else
280   echo "configure is not an executable ..."   echo "configure is not an executable ..."
# Line 405  munpack() Line 312  munpack()
312    
313   SRCFILE=$1   SRCFILE=$1
314    
315   if [ -z "$2" ]   if [[ -z $2 ]]
316   then   then
317   DEST=${BUILDDIR}   DEST=${BUILDDIR}
318   else   else
# Line 420  munpack() Line 327  munpack()
327   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
328   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
329   then   then
330   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."
331     else
332     pushd ${DEST} > /dev/null
333     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
334     popd > /dev/null
335   fi   fi
336   ;;   ;;
337   gz)   gz)
# Line 428  munpack() Line 339  munpack()
339   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
340   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
341   then   then
342   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."
343     else
344     pushd ${DEST} > /dev/null
345     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
346     popd > /dev/null
347     fi
348     ;;
349     xz)
350     IFTAR="$(basename $SRCFILE .xz)"
351     IFTAR="${IFTAR##*.}"
352     if [[ ${IFTAR} = tar ]]
353     then
354     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
355     else
356     pushd ${DEST} > /dev/null
357     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
358     popd > /dev/null
359   fi   fi
360   ;;   ;;
361   tbz2)   tbz2|mpks|mpk)
362   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
363   ;;   ;;
364   tgz)   tgz)
365   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
366     ;;
367     txz|mpkzs|mpkz)
368     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
369     ;;
370     rar)
371     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
372     ;;
373     zip|xpi|jar)
374     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
375     ;;
376     rpm)
377     pushd ${DEST} > /dev/null
378     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
379     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
380     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
381     then
382     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
383     fi
384   ;;   ;;
385   *)   *)
386   die "munpack failed"   die "munpack failed"
# Line 472  mpatch() Line 417  mpatch()
417   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
418  }  }
419    
420    mlibtoolize()
421    {
422     local opts="$@"
423     [[ -z ${opts} ]] && opts="--verbose --install --force"
424    
425     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
426    }
427    
428    mautoreconf()
429    {
430     local opts="$@"
431     [[ -z ${opts} ]] && opts="--verbose --install --force"
432    
433     autoreconf ${opts} || die "running: mautoreconf ${opts}"
434    }
435    
436  minstalldocs()  minstalldocs()
437  {  {
438   local docfiles   local docfiles
439     local doc
440   docfiles="$@"   docfiles="$@"
441    
442   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
# Line 483  minstalldocs() Line 444  minstalldocs()
444   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
445   fi   fi
446    
447   for i in ${docfiles}   for doc in ${docfiles}
448   do   do
449   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${doc} ]
450   install -m 0644 ${SRCDIR}/${i}.gz \   then
451   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   if mqueryfeature "compressdoc"
452     then
453     cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "gzipping +installing ${doc}."
454     chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "fixing permissions of ${doc}."
455     else
456     install -m 0644 ${doc} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."
457     fi
458     fi
459   done   done
460  }  }
461    
# Line 495  mstriplibs() Line 463  mstriplibs()
463  {  {
464   local stripdir="$@"   local stripdir="$@"
465    
466   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
467   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"
468     find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null
469  }  }
470    
471  mstripbins()  mstripbins()
472  {  {
473   local stripdir="$@"   local stripdir="$@"
474    
475   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
476   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"
477     find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null
478    }
479    
480    mstripstatic()
481    {
482     local stripdir="$@"
483    
484     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
485     [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug"
486     find ${stripdir} ! -type d | xargs --no-run-if-empty file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null
487    }
488    
489    mstriplibtoolarchive()
490    {
491     local stripdir="$@"
492    
493     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
494     find ${stripdir} ! -type d -name \*.la | xargs --no-run-if-empty file | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null
495    }
496    
497    mpurgetargets()
498    {
499     local stripdir="$@"
500     local target
501    
502     [[ -z ${stripdir} ]] && stripdir=${BINDIR}
503     # nothing to do in this case
504     [[ -z ${PURGE_TARGETS[*]} ]] && return
505    
506     for target in ${PURGE_TARGETS[*]}
507     do
508     # check if target is a regex pattern without any slashes
509     if [[ ${target} = ${target//\/} ]]
510     then
511     find ${BINDIR} -type f -name "${target}" | xargs --no-run-if-empty rm -f -- 2> /dev/null
512     else
513     rm -f -- ${target} 2> /dev/null
514     fi
515     done
516    }
517    
518    mcompressdocs()
519    {
520     local bindir="$@"
521    
522     if [ -d ${bindir}/usr/share/man ]
523     then
524     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
525     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
526     fi
527    
528     if [ -d ${bindir}/usr/share/info ]
529     then
530     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
531     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
532     fi
533  }  }
534    
535  sminclude()  sminclude()
# Line 546  setup_ccache_environment() Line 571  setup_ccache_environment()
571   fi   fi
572  }  }
573    
   
574  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
575  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
576  fix_mage_deps()  fix_mage_deps()
# Line 620  EOF Line 644  EOF
644  # special tags:  # special tags:
645  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
646  #   INHERITS              which functions get included  #   INHERITS              which functions get included
647  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
648  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
649    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
650    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
651    #                         (only in the resulting magefile}
652  #  #
653  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
654  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 632  build_mage_script() Line 659  build_mage_script()
659   local magefile   local magefile
660   local dest   local dest
661   local target   local target
662     local split_pkg_base
663   local sym   local sym
664   local depname   local depname
665    
# Line 639  build_mage_script() Line 667  build_mage_script()
667   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
668    
669   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
670   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
671    
672     # mark package as splitpackage
673     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
674    
675   # name of magefile   # name of magefile
676   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 655  build_mage_script() Line 686  build_mage_script()
686   # now build the mage file   # now build the mage file
687   > ${dest}   > ${dest}
688    
  # header  
  echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.57 2007-04-23 16:41:44 niro Exp $' >> ${dest}  
  echo  >> ${dest}  
   
689   # pgkname and state   # pgkname and state
690   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
691   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
  echo >> ${dest}  
692    
693   # description and homepage   # description and homepage
694   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
695   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
  echo >> ${dest}  
696    
697   # special tags and vars   # special tags and vars
698   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
699    
700   # echo MAGE_TARGETS ## note -target is needed !   # echo MAGE_TARGETS ## note -target is needed !
701   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
702   echo >> ${dest}  
703     # split package base
704     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
705    
706   # add special vars   # add special vars
707   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
# Line 685  build_mage_script() Line 712  build_mage_script()
712   # being tricky here :)   # being tricky here :)
713   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
714   done   done
  echo  >> ${dest}  
715   fi   fi
716    
717   # add at least all includes   # add at least all includes
# Line 697  build_mage_script() Line 723  build_mage_script()
723   do   do
724   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
725   done   done
726   echo  >> ${dest}   # a CRLF is needed here!
727     echo >> ${dest}
728   fi   fi
  echo >> ${dest}  
729    
730   # deps and provides   # deps and provides
731   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
  echo >> ${dest}  
732   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
  echo >> ${dest}  
733   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
  echo >> ${dest}  
734    
735   # add special functions   # add special functions
736   if [ -n "${SPECIAL_FUNCTIONS}" ]   if [ -n "${SPECIAL_FUNCTIONS}" ]
# Line 717  build_mage_script() Line 740  build_mage_script()
740   do   do
741   # add to mage (quotes needed !)   # add to mage (quotes needed !)
742   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  echo >> ${dest}  
743   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
744   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
745   done   done
  echo  >> ${dest}  
746   fi   fi
747    
748   # pre|post-install|removes   # pre|post-install|removes
749   typeset -f preinstall >> ${dest}   typeset -f preinstall >> ${dest}
  echo  >> ${dest}  
750   typeset -f postinstall >> ${dest}   typeset -f postinstall >> ${dest}
  echo  >> ${dest}  
751   typeset -f preremove >> ${dest}   typeset -f preremove >> ${dest}
  echo  >> ${dest}  
752   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
  echo  >> ${dest}  
753  }  }
754    
755  regen_mage_tree()  regen_mage_tree()
756  {  {
757   local i   local subpackage
758    
759   # build them only if requested   # build them only if requested
760   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
761   then   then
762   # run it without targets   # run it without targets
763   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
764   then   then
765     # build for each target a mage file
766     # run it with several targets
767   echo   echo
768   build_mage_script   for subpackage in ${MAGE_TARGETS}
769     do
770     build_mage_script --target "${subpackage}"
771     done
772   echo   echo
  else  
773    
774   # build for each target an mage file   # run it for splitpackages
775     elif [[ -n ${SPLIT_PACKAGES} ]]
776     then
777     local split_pkg_base="${PNAME}"
778     # save smage environment
779     split_save_variables
780     # build for each subpackage a mage file
781   # run it with several targets   # run it with several targets
782   for i in ${MAGE_TARGETS}   echo
783     for subpackage in ${SPLIT_PACKAGES}
784   do   do
785   echo   # get the right variables for the split
786   build_mage_script "${i}"   export PNAME="${subpackage}"
787   echo   split_info_${subpackage}
788     # get the preinstall etc
789     split_export_inherits ${subpackage}
790     build_mage_script --split-pkg-base "${split_pkg_base}"
791     # delete split preinstall etc
792     split_delete_inherits ${subpackage}
793     # restore smage environment
794     split_restore_variables
795   done   done
796     echo
797     # unset all saved smage variables
798     split_unset_variables
799    
800     else
801     echo
802     build_mage_script
803     echo
804   fi   fi
805   fi   fi
806    
# Line 777  regen_mage_tree() Line 820  regen_mage_tree()
820   unset STATE   unset STATE
821   unset DESCRIPTION   unset DESCRIPTION
822   unset HOMEPAGE   unset HOMEPAGE
823   unset PKGTYPE   # unset PKGTYPE <-- don't do that either; smage needs this var
824   unset INHERITS   unset INHERITS
825   unset DEPEND   unset DEPEND
826   unset SDEPEND   unset SDEPEND
# Line 788  regen_mage_tree() Line 831  regen_mage_tree()
831   unset postremove   unset postremove
832  }  }
833    
834    split_save_variables()
835    {
836     export SAVED_PNAME="${PNAME}"
837     export SAVED_PVER="${PVER}"
838     export SAVED_PBUILD="${PBUILD}"
839     export SAVED_PCATEGORIE="${PCATEGORIE}"
840     export SAVED_DESCRIPTION="${DESCRIPTION}"
841     export SAVED_HOMEPAGE="${HOMEPAGE}"
842     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
843     export SAVED_STATE="${STATE}"
844     export SAVED_PKGTYPE="${PKGTYPE}"
845     export SAVED_INHERITS="${INHERITS}"
846     export SAVED_DEPEND="${DEPEND}"
847     export SAVED_SDEPEND="${SDEPEND}"
848     export SAVED_PROVIDE="${PROVIDE}"
849     export SAVED_PKGTYPE="${PKGTYPE}"
850    
851     # special handling needed for mage features
852     # pkgbuild
853     mqueryfeature "pkgbuild" && export SAVED_FEATURE_PKGBUILD="pkgbuild"
854     mqueryfeature "!pkgbuild" && export SAVED_FEATURE_PKGBUILD="!pkgbuild"
855     # strip
856     mqueryfeature "strip" && export SAVED_FEATURE_STRIP="strip"
857     mqueryfeature "!strip" && export SAVED_FEATURE_STRIP="!strip"
858     # libtool
859     mqueryfeature "libtool" && export SAVED_FEATURE_LIBTOOL="libtool"
860     mqueryfeature "!libtool" && export SAVED_FEATURE_LIBTOOL="!libtool"
861     # compressdoc
862     mqueryfeature "compressdoc" && export SAVED_FEATURE_COMPRESSDOC="compressdoc"
863     mqueryfeature "!compressdoc" && export SAVED_FEATURE_COMPRESSDOC="!compressdoc"
864    
865     # bindir too
866     export SAVED_BINDIR="${BINDIR}"
867    
868     # export the SPLIT_PACKAGE_BASE
869     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
870    
871     # functions
872     if [[ ! -z $(typeset -f preinstall) ]]
873     then
874     # rename the old one
875     local saved_preinstall
876     saved_preinstall=SAVED_$(typeset -f preinstall)
877     eval "${saved_preinstall}"
878     export -f SAVED_preinstall
879     fi
880    
881     if [[ ! -z $(typeset -f postinstall) ]]
882     then
883     # rename the old one
884     local saved_postinstall
885     saved_postinstall=SAVED_$(typeset -f postinstall)
886     eval "${saved_postinstall}"
887     export -f SAVED_postinstall
888     fi
889    
890     if [[ ! -z $(typeset -f preremove) ]]
891     then
892     # rename the old one
893     local saved_preremove
894     saved_preremove=SAVED_$(typeset -f preremove)
895     eval "${saved_preremove}"
896     export -f SAVED_preremove
897     fi
898    
899     if [[ ! -z $(typeset -f postremove) ]]
900     then
901     # rename the old one
902     local saved_postremove
903     saved_postremove=SAVED_$(typeset -f postremove)
904     eval "${saved_postremove}"
905     export -f SAVED_postremove
906     fi
907    }
908    
909    split_restore_variables()
910    {
911     export PNAME="${SAVED_PNAME}"
912     export PVER="${SAVED_PVER}"
913     export PBUILD="${SAVED_PBUILD}"
914     export PCATEGORIE="${SAVED_PCATEGORIE}"
915     export DESCRIPTION="${SAVED_DESCRIPTION}"
916     export HOMEPAGE="${SAVED_HOMEPAGE}"
917     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
918     export STATE="${SAVED_STATE}"
919     export PKGTYPE="${SAVED_PKGTYPE}"
920     export INHERITS="${SAVED_INHERITS}"
921     export DEPEND="${SAVED_DEPEND}"
922     export SDEPEND="${SAVED_SDEPEND}"
923     export PROVIDE="${SAVED_PROVIDE}"
924     export PKGTYPE="${SAVED_PKGTYPE}"
925    
926     # special handling needed for mage features
927     # pkgbuild
928     FVERBOSE=off msetfeature "${SAVED_FEATURE_PKGBUILD}"
929     # strip
930     FVERBOSE=off msetfeature "${SAVED_FEATURE_STRIP}"
931     # libtool
932     FVERBOSE=off msetfeature "${SAVED_FEATURE_LIBTOOL}"
933     # compressdoc
934     FVERBOSE=off msetfeature "${SAVED_FEATURE_COMPRESSDOC}"
935    
936     # bindir too
937     export BINDIR="${SAVED_BINDIR}"
938    
939     # functions
940     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
941     then
942     # rename the old one
943     local saved_preinstall
944     saved_preinstall=$(typeset -f SAVED_preinstall)
945     eval "${saved_preinstall/SAVED_/}"
946     export -f preinstall
947     fi
948    
949     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
950     then
951     # rename the old one
952     local saved_postinstall
953     saved_postinstall=$(typeset -f SAVED_postinstall)
954     eval "${saved_postinstall/SAVED_/}"
955     export -f postinstall
956     fi
957    
958     if [[ ! -z $(typeset -f SAVED_preremove) ]]
959     then
960     # rename the old one
961     local saved_preremove
962     saved_preremove=$(typeset -f SAVED_preremove)
963     eval "${saved_preremove/SAVED_/}"
964     export -f preremove
965     fi
966    
967     if [[ ! -z $(typeset -f SAVED_postremove) ]]
968     then
969     # rename the old one
970     local saved_postremove
971     saved_postremove=$(typeset -f SAVED_postremove)
972     eval "${saved_postremove/SAVED_/}"
973     export -f postremove
974     fi
975    }
976    
977    split_unset_variables()
978    {
979     # unset saved vars; not needed anymore
980     unset SAVED_PNAME
981     unset SAVED_PVER
982     unset SAVED_PBUILD
983     unset SAVED_PCATEGORIE
984     unset SAVED_DESCRIPTION
985     unset SAVED_HOMEPAGE
986     unset SAVED_SPECIAL_VARS
987     unset SAVED_STATE
988     unset SAVED_PKGTYPE
989     unset SAVED_INHERITS
990     unset SAVED_DEPEND
991     unset SAVED_SDEPEND
992     unset SAVED_PROVIDE
993     unset SAVED_BINDIR
994     unset SAVED_PKGTYPE
995     unset SAVED_FEATURE_PKGBUILD
996     unset SAVED_FEATURE_STRIP
997     unset SAVED_FEATURE_LIBTOOL
998     unset SAVED_FEATURE_COMPRESSDOC
999     unset SPLIT_PACKAGE_BASE
1000     unset -f SAVED_preinstall
1001     unset -f SAVED_postinstall
1002     unset -f SAVED_preremove
1003     unset -f SAVED_postremove
1004    }
1005    
1006    split_export_inherits()
1007    {
1008     local subpackage="$1"
1009     local func
1010     local newfunc
1011    
1012     for func in preinstall postinstall preremove postremove
1013     do
1014     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1015     then
1016     newfunc=$(typeset -f ${func}_${subpackage})
1017     newfunc="${newfunc/_${subpackage} (/ (}"
1018     eval "${newfunc}"
1019     fi
1020     done
1021    }
1022    
1023    split_delete_inherits()
1024    {
1025     local subpackage="$1"
1026     local func
1027    
1028     for func in preinstall postinstall preremove postremove
1029     do
1030     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1031     then
1032     unset -f ${func}
1033     fi
1034     done
1035     }
1036    
1037  export_inherits()  export_inherits()
1038  {  {
1039   local include="$1"   local include="$1"
# Line 853  generate_package_md5sum() Line 1099  generate_package_md5sum()
1099   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1100    
1101   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1102   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
1103   then   then
1104   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1105    
# Line 868  generate_package_md5sum() Line 1114  generate_package_md5sum()
1114   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1115    
1116   # setup md5 dir   # setup md5 dir
1117   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1118   install -d ${dest}   install -d ${dest}
1119    
1120   # gen md5sum   # gen md5sum
# Line 906  source_pkg_build() Line 1152  source_pkg_build()
1152   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1153  }  }
1154    
1155    step_by_step()
1156    {
1157     if mqueryfeature stepbystep
1158     then
1159     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1160     echo "Press [enter] to continue"
1161     read
1162     fi
1163    }
1164    
1165    resume_stamp()
1166    {
1167     local step="$1"
1168     [[ ! -d ${BUILDDIR}/.stamps ]] && install -d ${BUILDDIR}/.stamps
1169     touch ${BUILDDIR}/.stamps/smage-${PKGNAME}-${step}
1170    }
1171    
1172    run_resume()
1173    {
1174     local step="$1"
1175    
1176     if mqueryfeature "resume" && [[ -f ${BUILDDIR}/.stamps/smage-${PKGNAME}-${step} ]]
1177     then
1178     echo -e "${COLMAGENTA}${step} already processed; doing nothing${COLDEFAULT}"
1179     return 0
1180     else
1181     return 1
1182     fi
1183    }
1184    
1185  # print out our version  # print out our version
1186  showversion  showversion
# Line 918  then Line 1193  then
1193   exit 1   exit 1
1194  fi  fi
1195    
1196    # load supported mage features
1197    load_mage_features
1198    
1199  # updating smage2-scripts  # updating smage2-scripts
1200  if [[ $1 = update ]]  if [[ $1 = update ]]
1201  then  then
# Line 932  fi Line 1210  fi
1210  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1211  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1212  then  then
1213   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1214   then   then
1215   SMAGENAME="$2"   SMAGENAME="$2"
1216   MD5DIR="$3"   MD5DIR="$3"
1217   source ${SMAGENAME} || die "download source failed"   [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1218    
1219     smagesource ${SMAGENAME} || die "download source failed"
1220    
1221   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
1222   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
# Line 988  then Line 1268  then
1268   echo   echo
1269   else   else
1270   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1271   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1272   echo   echo
1273   echo   echo
1274   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 1010  then Line 1290  then
1290   # get smage   # get smage
1291   SMAGENAME="$2"   SMAGENAME="$2"
1292   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1293   source ${SMAGENAME} || die "download source failed"   smagesource ${SMAGENAME} || die "download source failed"
1294    
1295   download_sources   download_sources
1296   exit 0   exit 0
# Line 1022  then Line 1302  then
1302   # set correct SMAGENAME   # set correct SMAGENAME
1303   SMAGENAME="$2"   SMAGENAME="$2"
1304   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1305   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1306    
1307   regen_mage_tree   regen_mage_tree
1308    
1309   # build md5sum for existing packages   # build several targets
1310   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1311   --pcat "${PCATEGORIE}" \   then
1312   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1313   --pver "${PVER}" \   do
1314   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1315   --parch "${ARCH}" \   generate_package_md5sum \
1316   --target "${target}"   --pcat "${PCATEGORIE}" \
1317     --pname "${PNAME}" \
1318     --pver "${PVER}" \
1319     --pbuild "${PBUILD}" \
1320     --parch "${ARCH}" \
1321     --target "${target}"
1322     done
1323    
1324     # build several subpackages
1325     elif [[ -n ${SPLIT_PACKAGES} ]]
1326     then
1327     split_save_variables
1328     for subpackage in ${SPLIT_PACKAGES}
1329     do
1330     # get the right variables for the split
1331     export PNAME="${subpackage}"
1332     split_info_${subpackage}
1333     # build md5sum for existing packages
1334     generate_package_md5sum \
1335     --pcat "${PCATEGORIE}" \
1336     --pname "${PNAME}" \
1337     --pver "${PVER}" \
1338     --pbuild "${PBUILD}" \
1339     --parch "${ARCH}"
1340     # restore smage environment
1341     split_restore_variables
1342     done
1343     # unset all saved smage variables
1344     split_unset_variables
1345    
1346     else
1347     # build md5sum for existing packages
1348     generate_package_md5sum \
1349     --pcat "${PCATEGORIE}" \
1350     --pname "${PNAME}" \
1351     --pver "${PVER}" \
1352     --pbuild "${PBUILD}" \
1353     --parch "${ARCH}"
1354     fi
1355    
1356   exit 0   exit 0
1357  fi  fi
# Line 1046  then Line 1364  then
1364    
1365   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
1366    
1367   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1368    
1369   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1370   then   then
# Line 1062  fi Line 1380  fi
1380  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1381  then  then
1382   SRCPKGTARBALL="${2}"   SRCPKGTARBALL="${2}"
1383   USE_SRC_PKG_TARBALL=true   msetfeature "srcpkgtarball"
1384    
1385   # abort if given file is not a source pkg   # abort if given file is not a source pkg
1386   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
# Line 1083  then Line 1401  then
1401   [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"   [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1402  fi  fi
1403    
1404    if [ "$1" == "--resume" -a -n "$2" ]
1405    then
1406     msetfeature "resume"
1407     SMAGENAME="$2"
1408    fi
1409    
1410  [ ! -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."
1411  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
# Line 1095  fi Line 1418  fi
1418  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1419  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1420    
1421  source ${SMAGENAME} || die "source failed"  smagesource ${SMAGENAME} || die "source failed"
1422  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1423  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1424    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1425    
1426  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1427  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1105  echo -e "${COLGREEN}Compiling ${PKGNAME} Line 1429  echo -e "${COLGREEN}Compiling ${PKGNAME}
1429  # auto regen mage tree if requested  # auto regen mage tree if requested
1430  regen_mage_tree  regen_mage_tree
1431    
1432  if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]  if mqueryfeature "srcpkgbuild"
1433  then  then
1434   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1435   then   then
# Line 1115  then Line 1439  then
1439  fi  fi
1440    
1441  # download sources  # download sources
1442  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources  mqueryfeature "srcpkgtarball" || download_sources
1443    
1444  # fixes some issues with these functions  # fixes some issues with these functions
1445  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
1446  export -f src_compile || die "src_compile export failed"  export -f src_compile || die "src_compile export failed"
1447    export -f src_check || die "src_check export failed"
1448  export -f src_install || die "src_install export failed"  export -f src_install || die "src_install export failed"
1449    
1450  # fixes some compile issues  # fixes some compile issues
1451  export CHOST="${CHOST}" || die "CHOST export failed"  export CHOST="${CHOST}" || die "CHOST export failed"
1452  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"
1453  export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"  if [[ -z ${CXXFLAGS} ]]
1454    then
1455     export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"
1456    else
1457     export CXXFLAGS="${CXXFLAGS}" || die "CXXFLAGS export failed"
1458    fi
1459    export LDFLAGS="${LDFLAGS}" || die "LDFLAGS export failed"
1460  export BINDIR="${BINDIR}" || die "BINDIR export failed"  export BINDIR="${BINDIR}" || die "BINDIR export failed"
1461  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"
1462    
   
1463  # setup distcc  # setup distcc
1464  # 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
1465  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment  mqueryfeature "distcc" && setup_distcc_environment
1466    
1467  # setup ccache  # setup ccache
1468  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  mqueryfeature "ccache" && setup_ccache_environment
1469    
1470  # small sleep to show our settings  if mqueryfeature "resume"
 sleep 1  
   
 # cleans up build if a previously one exists  
 if [ -d ${BUILDDIR} ]  
1471  then  then
1472   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   echo -e "${COLMAGENTA}Resume requested; continuing previous build${COLDEFAULT}"
 fi  
 install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  
1473    
1474  # cleans up srcdir if a previously unpacked one exists   # setup build logging
1475  if [ -d ${SRCDIR} ]   [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1476  then   if [[ -f /var/log/smage/${PKGNAME}.log.bz2 ]]
1477   rm -rf ${SRCDIR}   then
1478     bunzip2 -f /var/log/smage/${PKGNAME}.log.bz2
1479     fi
1480     echo -e "### Resume started on $(date) ###\n" >> /var/log/smage/${PKGNAME}.log
1481    
1482    else
1483     # clean up builddir if a previously one exist
1484     if [ -d ${BUILDDIR} ]
1485     then
1486     rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1487     fi
1488     install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1489    
1490     # clean up srcdir if a previously unpacked one exist
1491     if [ -d ${SRCDIR} ]
1492     then
1493     rm -rf ${SRCDIR}
1494     fi
1495    
1496     # clean up bindir if a previous build exist or create a new one
1497     if [ -d ${BINDIR} ]
1498     then
1499     rm -rf ${BINDIR}
1500     fi
1501     install -d ${BINDIR} || die "couldn't create \$BINDIR."
1502    
1503     # clean up package temp dir if a previous build exist
1504     if [ -d ${BUILDDIR}/${PKGNAME} ]
1505     then
1506     rm -rf ${BUILDDIR}/${PKGNAME}
1507     fi
1508    
1509     # clean up stamps dir
1510     if [ -d ${BUILDDIR}/.stamps ]
1511     then
1512     rm -rf ${BUILDDIR}/.stamps
1513     fi
1514    
1515     # setup build logging
1516     [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1517     echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1518  fi  fi
1519    
1520  # cleans up bindir if a previous build exists or creates a new one  if [[ ${PKGTYPE} = virtual ]]
 if [ -d ${BINDIR} ]  
1521  then  then
1522   rm -rf ${BINDIR}   echo "virtual package detected; nothing will be build ..."
1523     # automatically set !pkgbuild here too
1524     msetfeature "!pkgbuild"
1525    else
1526     ( run_resume src_prepare || src_prepare ) | ${SMAGE_LOG_CMD}
1527     die_pipestatus 0 "src_prepare failed"
1528     resume_stamp src_prepare
1529     step_by_step src_prepare
1530    
1531     ( run_resume src_compile || src_compile ) | ${SMAGE_LOG_CMD}
1532     die_pipestatus 0 "src_compile failed"
1533     resume_stamp src_compile
1534     step_by_step src_compile
1535    
1536     # only run checks if requested
1537     if mqueryfeature "!check"
1538     then
1539     echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1540     else
1541     ( run_resume src_check || src_check ) | ${SMAGE_LOG_CMD}
1542     die_pipestatus 0 "src_check failed"
1543     resume_stamp src_check
1544     fi
1545     step_by_step src_check
1546    
1547     # build several subpackages
1548     if [[ -n ${SPLIT_PACKAGES} ]]
1549     then
1550     # save bindir & pname
1551     split_save_variables
1552     export SAVED_BINDIR="${BINDIR}"
1553     for subpackage in ${SPLIT_PACKAGES}
1554     do
1555     if typeset -f src_install_${subpackage} > /dev/null
1556     then
1557     # export subpackage bindir
1558     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1559     # export PNAME, several internal function and include
1560     # rely on this variable
1561     export PNAME="${subpackage}"
1562    
1563     echo
1564     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1565     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1566     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1567     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1568    
1569     ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD}
1570     die_pipestatus 0 "src_install_${subpackage} failed"
1571     resume_stamp src_install_${subpackage}
1572     step_by_step src_install_${subpackage}
1573     fi
1574     done
1575     # restore bindir & pname
1576     split_restore_variables
1577     # unset all saved smage variables
1578     split_unset_variables
1579     else
1580     ( run_resume src_install || src_install ) | ${SMAGE_LOG_CMD}
1581     die_pipestatus 0 "src_install failed"
1582     resume_stamp src_install
1583     step_by_step src_install
1584     fi
1585  fi  fi
 install -d ${BINDIR} || die "couldn't create \$BINDIR."  
1586    
1587  # cleans up package temp dir if a previous build exists  # echo for sake of good-looking
1588  if [ -d ${BUILDDIR}/${PKGNAME} ]  echo
1589    
1590    if mqueryfeature "!compressdoc"
1591  then  then
1592   rm -rf ${BUILDDIR}/${PKGNAME}   echo -e "!compressdoc detected; documentation will not be compressed ..."
1593    elif mqueryfeature "!pkgbuild"
1594    then
1595     echo "!pkgbuild detected; skipping documentation compression..."
1596    else
1597     # compressing doc, info & man files
1598     if [[ -n ${SPLIT_PACKAGES} ]]
1599     then
1600     for subpackage in ${SPLIT_PACKAGES}
1601     do
1602     run_resume post-mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage}
1603     resume_stamp post-mcompressdoc_${subpackage}
1604     done
1605     else
1606     run_resume post-mcompressdoc || mcompressdocs ${BINDIR}
1607     resume_stamp post-mcompressdoc
1608     fi
1609  fi  fi
1610    
1611  # cleans up timestamp if one exists  if mqueryfeature "!libtool"
 if [ -f /var/tmp/timestamp ]  
1612  then  then
1613   mage rmstamp   if mqueryfeature "!pkgbuild"
1614     then
1615     echo "!pkgbuild detected; skipping libtool archive stripping ..."
1616     else
1617     if [[ -n ${SPLIT_PACKAGES} ]]
1618     then
1619     for subpackage in ${SPLIT_PACKAGES}
1620     do
1621     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}"
1622     run_resume post-mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage}
1623     resume_stamp post-mstriplibtoolarchive_${subpackage}
1624     done
1625     else
1626     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"
1627     run_resume post-mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR}
1628     resume_stamp post-mstriplibtoolarchive
1629     fi
1630     fi
1631  fi  fi
1632    
1633  src_prepare || die "src_prepare failed"  if mqueryfeature "purge"
 src_compile || die "src_compile failed"  
 src_install || die "src_install failed"  
   
   
 # compressing doc, info & man files  
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1634  then  then
1635   echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"   if mqueryfeature "!pkgbuild"
1636   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   then
1637     echo "!pkgbuild detected; skipping file purgation..."
1638     else
1639     if [[ -n ${SPLIT_PACKAGES} ]]
1640     then
1641     for subpackage in ${SPLIT_PACKAGES}
1642     do
1643     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}"
1644     run_resume post-mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage}
1645     resume_stamp post-mpurgetargets_${subpackage}
1646     done
1647     else
1648     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"
1649     run_resume post-mpurgetargets || mpurgetargets ${BINDIR}
1650     resume_stamp post-mpurgetargets
1651     fi
1652     fi
1653  fi  fi
1654    
1655  if [ -d ${BUILDDIR}/builded/usr/share/info ]  # stripping all bins and libs
1656    if mqueryfeature "!strip"
1657  then  then
1658   echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"   echo -e "!strip detected; Package will not be stripped ..."
1659   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info  elif mqueryfeature "!pkgbuild"
1660    then
1661     echo "!pkgbuild detected; skipping stripping of the package ..."
1662    else
1663     if [[ -n ${SPLIT_PACKAGES} ]]
1664     then
1665     for subpackage in ${SPLIT_PACKAGES}
1666     do
1667     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1668     run_resume post-mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage}
1669     resume_stamp post-mstripbins_${subpackage}
1670     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1671     run_resume post-mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage}
1672     resume_stamp post-mstriplibs_${subpackage}
1673     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1674     run_resume post-mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage}
1675     resume_stamp post-mstripstatic_${subpackage}
1676     done
1677     else
1678     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1679     run_resume post-mstripbins || mstripbins ${BINDIR}
1680     resume_stamp post-mstripbins
1681     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1682     run_resume post-mstriplibs || mstriplibs ${BINDIR}
1683     resume_stamp post-mstriplibs
1684     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1685     run_resume post-mstripstatic || mstripstatic ${BINDIR}
1686     resume_stamp post-mstripstatic
1687     fi
1688  fi  fi
1689    
1690  # stripping all bins and libs  if mqueryfeature "!pkgbuild"
1691  case ${NOSTRIP} in  then
1692   true|TRUE|yes|y)   echo -e "!pkgbuild detected; Package will not be build ..."
1693   echo -e "NOSTRIP=true detected; Package will not be stripped ..."  else
  ;;  
  *)  
  echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"  
  mstripbins ${BINDIR}  
  echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"  
  mstriplibs ${BINDIR}  
  ;;  
 esac  
   
 # the new buildpkg command  
 case ${NOPKGBUILD} in  
  true|TRUE|yes|y)  
  echo -e "NOPGKBUILD=true detected; Package will not be build ..."  
  ;;  
  *)  
1694   # build several targets   # build several targets
1695   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1696   then   then
1697   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1698   do   do
1699   # check if an special target_pkgbuild exists   # check if a special target_pkgbuild exists
1700   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1701   then   then
1702   # run it   # run it
1703   ${target}_pkgbuild   run_resume post-${target}_pkgbuild || ${target}_pkgbuild
1704     resume_stamp post-${target}_pkgbuild
1705   fi   fi
1706   # now create the target package   # now create the target package
1707   ${MLIBDIR}/pkgbuild_dir.sh \   run_resume post-pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \
1708   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \
1709   ${BINDIR} || die "target: ${target} package-build failed"   ${BINDIR} || die "target: ${target} package-build failed"
1710     resume_stamp post-pkg_builddir_${target}
1711    
1712   # build pkg-md5-sum if requested   # build pkg-md5-sum if requested
1713   generate_package_md5sum \   run_resume post-md5sum_${target} || generate_package_md5sum \
1714   --pcat "${PCATEGORIE}" \   --pcat "${PCATEGORIE}" \
1715   --pname "${PNAME}" \   --pname "${PNAME}" \
1716   --pver "${PVER}" \   --pver "${PVER}" \
1717   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1718   --parch "${ARCH}" \   --parch "${ARCH}" \
1719   --target "${target}"   --target "${target}"
1720     resume_stamp post-md5sum_${target}
1721    
1722   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1723   done   done
1724    
1725     # build several subpackages
1726     elif [[ -n ${SPLIT_PACKAGES} ]]
1727     then
1728     split_save_variables
1729     for subpackage in ${SPLIT_PACKAGES}
1730     do
1731     # get the right variables for the split
1732     export PNAME="${subpackage}"
1733     split_info_${PNAME}
1734    
1735     # jump to next one if !pkgbuild is set in split_info
1736     mqueryfeature "!pkgbuild" && continue
1737    
1738     # check if an special subpackage_pkgbuild exists
1739     if typeset -f ${PNAME}_pkgbuild > /dev/null
1740     then
1741     # run it
1742     run_resume post-${PNAME}_pkgbuild || ${PNAME}_pkgbuild
1743     resume_stamp post-${PNAME}_pkgbuild
1744     fi
1745     # now create the target package
1746     run_resume post-pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \
1747     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1748     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1749     resume_stamp post-pkg_builddir_${PNAME}
1750    
1751     # build pkg-md5-sum if requested
1752     run_resume post-md5sum_${PNAME} || generate_package_md5sum \
1753     --pcat "${PCATEGORIE}" \
1754     --pname "${PNAME}" \
1755     --pver "${PVER}" \
1756     --pbuild "${PBUILD}" \
1757     --parch "${ARCH}"
1758     resume_stamp post-md5sum_${PNAME}
1759    
1760     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1761    
1762     # restore smage environment
1763     split_restore_variables
1764     done
1765     # unset all saved smage variables
1766     split_unset_variables
1767    
1768   else   else
1769   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   run_resume post-pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1770     resume_stamp post-pkg_builddir
1771    
1772   # build pkg-md5-sum if requested   # build pkg-md5-sum if requested
1773   generate_package_md5sum \   run_resume post-md5sum || generate_package_md5sum \
1774   --pcat "${PCATEGORIE}" \   --pcat "${PCATEGORIE}" \
1775   --pname "${PNAME}" \   --pname "${PNAME}" \
1776   --pver "${PVER}" \   --pver "${PVER}" \
1777   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1778   --parch "${ARCH}"   --parch "${ARCH}"
1779     resume_stamp post-md5sum
1780    
1781   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1782   fi   fi
1783    
1784   # build src-pkg-tarball if requested   # build src-pkg-tarball if requested
1785   [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}   if mqueryfeature "srcpkgbuild"
1786   ;;   then
1787  esac   run_resume post-srcpkgbuild || source_pkg_build ${SMAGENAME}
1788     resume_stamp post-srcpkgbuild
1789  # for sure   fi
1790  unset NOPKGBUILD  fi
1791  unset NOSTRIP  
1792    if mqueryfeature "buildlog"
1793    then
1794     bzip2 -9f /var/log/smage/${PKGNAME}.log
1795    else
1796     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1797    fi
1798    
1799  xtitleclean  xtitleclean

Legend:
Removed from v.477  
changed lines
  Added in v.1639