Magellan Linux

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

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

revision 255 by niro, Mon Oct 3 20:54:14 2005 UTC revision 1571 by niro, Wed Dec 28 10:30:50 2011 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.38 2005-10-03 20:54:14 niro Exp $  
8    
9  #01.10.2004  
10  # added ccache support  # set default user mage.rc
11  # added distcc support  : ${MAGERC="/etc/mage.rc"}
12    
13  ## setup ##  ## setup ##
14  PKGSUFFIX="mpk"  PKGSUFFIX="mpk"
15    SRCPKGSUFFIX="mpks"
16  SMAGENAME="$1"  SMAGENAME="$1"
17  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
 #SOURCEDIR="/bootstrap/sources"  
 #SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts"  
 #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"  
18  MLIBDIR=/usr/lib/mage  MLIBDIR=/usr/lib/mage
19  SMAGEVERSION="$( < ${MLIBDIR}/version)"  SMAGEVERSION="$( < ${MLIBDIR}/version)"
20    
21    ## only for tests -> normally in /etc/rc.d/init.d/functions
22    COLRED="\033[1;6m\033[31m"
23    COLGREEN="\033[1;6m\033[32m"
24    COLYELLOW="\033[1;6m\033[33m"
25    COLBLUE="\033[1;6m\033[34m"
26    COLMAGENTA="\033[1;6m\033[35m"
27    COLWHITE="\033[1;6m\033[37m"
28    COLGRAY="\033[0;6m\033[37m"
29    COLBOLD="\033[1m"
30    COLDEFAULT="\033[0m"
31    
32    if [[ ${NOCOLORS} = true ]]
33    then
34     COLRED=""
35     COLGREEN=""
36     COLYELLOW=""
37     COLBLUE=""
38     COLMAGENTA=""
39     COLWHITE=""
40     COLGRAY=""
41     COLBOLD=""
42     COLDEFAULT=""
43    fi
44    
45  # export default C locale  # export default C locale
46  export LC_ALL=C  export LC_ALL=C
47    
48  source /etc/mage.rc  source /etc/mage.rc.global
49    source ${MAGERC}
50    source ${MLIBDIR}/mage4.functions.sh
51    
52    # set PKGDIR and BUILDDIR and BINDIR to MROOT
53    if [[ -n ${MROOT} ]]
54    then
55     export PKGDIR=${MROOT}/${PKGDIR}
56     export BUILDDIR=${MROOT}/${BUILDDIR}
57     export BINDIR=${MROOT}/${BINDIR}
58    fi
59    
60    # sources the smage file and uses state from distribution file if exist
61    # may helpful for repository support later on
62    smagesource()
63    {
64     local file="$1"
65     local mystate
66     local mycodename
67    
68     source ${file}
69    
70     [[ -n ${STATE} ]] && mystate="${STATE}"
71    
72     # do not overide if local state was broken or disabled!
73     case ${STATE} in
74     broken) return ;;
75     disabled) return ;;
76     esac
77    
78  showversion() {   if [ -f ${SMAGESCRIPTSDIR}/distribution ]
79     then
80     source ${SMAGESCRIPTSDIR}/distribution
81     [[ -n ${STATE} ]] && mystate="${STATE}"
82     fi
83     # now switch state and export it
84     STATE="${mystate}"
85    }
86    
87    showversion()
88    {
89   echo -en "Magellan Source Install v${SMAGEVERSION} "   echo -en "Magellan Source Install v${SMAGEVERSION} "
90   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"   echo -e  "-- Niels Rogalla (niro@magellan-linux.de)"
91  }  }
92    
93  die() {  die()
94    {
95   xtitleclean   xtitleclean
96     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
97   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
98   exit 1   exit 1
99  }  }
100    
101  xtitle() {  die_pipestatus()
102   if [ ${TERM} == "xterm" ]  {
103     # the status change if we do any parameter declarations!!
104     # dont do this anymore, keep this in mind!
105     #
106     # local pos="$1"
107     # local comment="$2"
108     #
109     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
110     #
111     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
112    }
113    
114    xtitle()
115    {
116     if [[ ${TERM} = xterm ]]
117   then   then
118   echo -ne "\033]0;[sMage: $@]\007"   echo -ne "\033]0;[sMage: $@]\007"
119   fi   fi
120   return 0   return 0
121  }  }
122    
123  xtitleclean() {  xtitleclean()
124   if [ ${TERM} == "xterm" ]  {
125     if [[ ${TERM} = xterm ]]
126   then   then
127   echo -ne "\033]0;\007"   echo -ne "\033]0;\007"
128   fi   fi
129   return 0   return 0
130  }  }
131    
132  syncsmage2() {  syncsmage2()
133    {
134   xtitle "Updating smage2-script tree ..."   xtitle "Updating smage2-script tree ..."
135   local i   local i
136   for i in ${SMAGE2RSYNC}   for i in ${SMAGE2RSYNC}
137   do   do
138   rsync \   rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR}
139   --recursive \   if [[ $? = 0 ]]
  --links \  
  --perms \  
  --times \  
  --devices \  
  --timeout=600 \  
  --verbose \  
  --compress \  
  --progress \  
  --stats \  
  --delete \  
  --delete-after \  
  ${i} ${SMAGESCRIPTSDIR}  
   
  if [ "$?" == "0" ]  
140   then   then
141   break   break
142   else   else
143   continue   continue
144   fi   fi
   
145   done   done
146    
147   #clean up backup files (foo~)   # clean up backup files (foo~)
148   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'   find ${SMAGESCRIPTSDIR} -name *~ -exec rm '{}' ';'
149    
150   xtitleclean   xtitleclean
151  }  }
152    
153  # $1 filename  # $1 filename
154  get_db_md5_sum() {  get_db_md5_sum()
155    {
156   local DB_FILE   local DB_FILE
157   local MD5_FILE   local MD5_FILE
158   local i   local i
# Line 101  get_db_md5_sum() { Line 165  get_db_md5_sum() {
165   echo "${i}"   echo "${i}"
166  }  }
167    
168  download_sources() {  download_sources()
169    {
170    
171   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
172    
# Line 113  download_sources() { Line 178  download_sources() {
178   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
179   local FETCHING   local FETCHING
180   local i mirror   local i mirror
181     local wget_opts
182    
183   #install SRCDIR/PNAME if not exist   # filter wget command if busybox was found
184     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
185    
186     # install SRCDIR/PNAME if not exist
187   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
188    
189   # check if FETCHING is needed   # check if FETCHING is needed
190   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null )
191   if [[ $? == 0 ]]   if [[ $? = 0 ]]
192   then   then
193   # md5's ok, not fetching needed   # md5's ok, no fetching needed
194   FETCHING=false   FETCHING=false
195   else   else
196   FETCHING=true   FETCHING=true
197   fi   fi
198    
199   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
200   do   do
201   # url to file   # url to file
# Line 144  download_sources() { Line 212  download_sources() {
212   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
213   fi   fi
214    
215     # create the SOURCEDIR
216     install -d ${my_SOURCEDIR}
217    
218   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
219   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
220   then   then
221   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
222   do   do
223   my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"   my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"
224    
225   #echo "DEBUG: ${MY_SRC_URI}"   if [[ ${FETCHING} = true ]]
226   if [[ ${FETCHING} == true ]]   then
227     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
228     wget \
229     ${wget_opts} \
230     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
231     "${my_SRC_URI_MIRROR}"
232     if [[ $? = 0 ]]
233     then
234     break
235     else
236     continue
237     fi
238     fi
239     done
240     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
241     then
242     for mirror in ${SOURCEFORGE_MIRRORS}
243     do
244     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
245    
246     if [[ ${FETCHING} = true ]]
247   then   then
248   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
249   wget \   wget \
250   --passive-ftp \   ${wget_opts} \
251   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
252   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
253   if [ "$?" == "0" ]   if [[ $? = 0 ]]
254     then
255     break
256     else
257     continue
258     fi
259     fi
260     done
261     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
262     then
263     for mirror in ${GNU_MIRRORS}
264     do
265     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
266    
267     if [[ ${FETCHING} = true ]]
268     then
269     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
270     wget \
271     ${wget_opts} \
272     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
273     "${my_SRC_URI_MIRROR}"
274     if [[ $? = 0 ]]
275     then
276     break
277     else
278     continue
279     fi
280     fi
281     done
282     elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]
283     then
284     for mirror in ${KDE_MIRRORS}
285     do
286     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"
287    
288     if [[ ${FETCHING} = true ]]
289     then
290     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
291     wget \
292     ${wget_opts} \
293     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
294     "${my_SRC_URI_MIRROR}"
295     if [[ $? = 0 ]]
296     then
297     break
298     else
299     continue
300     fi
301     fi
302     done
303     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]
304     then
305     for mirror in ${GNOME_MIRRORS}
306     do
307     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"
308    
309     if [[ ${FETCHING} = true ]]
310     then
311     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
312     wget \
313     ${wget_opts} \
314     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
315     "${my_SRC_URI_MIRROR}"
316     if [[ $? = 0 ]]
317   then   then
318   break   break
319   else   else
# Line 171  download_sources() { Line 322  download_sources() {
322   fi   fi
323   done   done
324   else   else
325   #echo "DEBUG: ${SRC_URI[${i}]}"   if [[ ${FETCHING} = true ]]
  if [[ ${FETCHING} == true ]]  
326   then   then
327   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
328   wget \   wget \
329   --passive-ftp \   ${wget_opts} \
330   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
331   "${my_SRC_URI}"   "${my_SRC_URI}"
 # only needed to run through a list of mirrors  
 # if [ "$?" == "0" ]  
 # then  
 # break  
 # else  
 # continue  
 # fi  
332   fi   fi
333   fi   fi
334    
335   # unset them to be shure   # unset them to be shure
336   unset my_SRC_URI   unset my_SRC_URI
337   unset my_SRC_URI_DEST   unset my_SRC_URI_DEST
# Line 201  download_sources() { Line 341  download_sources() {
341    
342   # recheck md5 sums   # recheck md5 sums
343   echo   echo
344   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
345   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed"
346   echo   echo
347    
348   # not needed anymore   # not needed anymore
# Line 210  download_sources() { Line 350  download_sources() {
350  }  }
351    
352  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
353  src_prepare() {  src_prepare()
354    {
355   echo "no src_prepare defined"   echo "no src_prepare defined"
356   sleep 2   sleep 2
357   return 0   return 0
358  }  }
359    
360  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
361  src_compile() {  src_compile()
362    {
363   echo "no src_compile defined"   echo "no src_compile defined"
364   sleep 2   sleep 2
365   return 0   return 0
366  }  }
367    
368  # dummy function, used if that not exist in smage file  # dummy function, used if that not exist in smage file
369  src_install() {  src_install()
370    {
371   echo "no src_install defined"   echo "no src_install defined"
372   sleep 2   sleep 2
373   return 0   return 0
374  }  }
375    
376  mconfigure() {  mlibdir()
377    {
378     local libdir=lib
379     [[ ${ARCH} = x86_64 ]] && libdir=lib64
380    
381     echo "${libdir}"
382    }
383    
384    mconfigure()
385    {
386   if [ -x ./configure ]   if [ -x ./configure ]
387   then   then
388   ./configure \   ./configure \
389   --prefix=/usr \   --prefix=/usr \
390   --host=${CHOST} \   --host=${CHOST} \
391   --mandir=/usr/share/man \   --build=${CHOST} \
392   --infodir=/usr/share/info \   --mandir=/usr/share/man \
393   --datadir=/usr/share \   --infodir=/usr/share/info \
394   --sysconfdir=/etc \   --datadir=/usr/share \
395   --localstatedir=/var/lib \   --sysconfdir=/etc \
396   "$@" || die "mconfigure failed"   --localstatedir=/var/lib \
397     --libdir=/usr/$(mlibdir) \
398     "$@" || die "mconfigure failed"
399   else   else
400   echo "configure is not an executable ..."   echo "configure is not an executable ..."
401   exit 1   exit 1
402   fi   fi
403  }  }
404    
405  minstall() {  minstall()
406   if [ -f ./[mM]akefile -o -f ./GNUmakefile ] ; then  {
407     if [ -f ./[mM]akefile -o -f ./GNUmakefile ]
408     then
409   make prefix=${BINDIR}/usr \   make prefix=${BINDIR}/usr \
410   datadir=${BINDIR}/usr/share \   datadir=${BINDIR}/usr/share \
411   infodir=${BINDIR}/usr/share/info \   infodir=${BINDIR}/usr/share/info \
412   localstatedir=${BINDIR}/var/lib \   localstatedir=${BINDIR}/var/lib \
413   mandir=${BINDIR}/usr/share/man \   mandir=${BINDIR}/usr/share/man \
414   sysconfdir=${BINDIR}/etc \   sysconfdir=${BINDIR}/etc \
415     libdir=${BINDIR}/usr/$(mlibdir) \
416   "$@" install || die "minstall failed"   "$@" install || die "minstall failed"
417          else          else
418                  die "no Makefile found"                  die "no Makefile found"
419          fi          fi
420  }  }
421    
422  mmake() {  mmake()
423    {
424   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"   make ${MAKEOPTS} ${EXTRA_EMAKE} "$@"
425  }  }
426    
427  munpack() {  munpack()
428    {
429   local SRCFILE   local SRCFILE
430   local IFTAR   local IFTAR
431   local DEST   local DEST
432    
433   SRCFILE=$1   SRCFILE=$1
434    
435   if [ -z "$2" ]   if [[ -z $2 ]]
436   then   then
437   DEST=${BUILDDIR}   DEST=${BUILDDIR}
438   else   else
439   DEST=$2   DEST=$2
440   fi   fi
441    
442     [[ ! -d ${DEST} ]] && install -d ${DEST}
443    
444   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
445   bz2)   bz2)
446   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
447   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
448   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
449   then   then
450   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."
451     else
452     pushd ${DEST} > /dev/null
453     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
454     popd > /dev/null
455   fi   fi
456   ;;   ;;
457   gz)   gz)
458   IFTAR="$(basename $SRCFILE .gz)"   IFTAR="$(basename $SRCFILE .gz)"
459   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
460   if [ "${IFTAR}" == "tar" ]   if [[ ${IFTAR} = tar ]]
461   then   then
462   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."
463     else
464     pushd ${DEST} > /dev/null
465     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
466     popd > /dev/null
467     fi
468     ;;
469     xz)
470     IFTAR="$(basename $SRCFILE .xz)"
471     IFTAR="${IFTAR##*.}"
472     if [[ ${IFTAR} = tar ]]
473     then
474     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
475     else
476     pushd ${DEST} > /dev/null
477     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
478     popd > /dev/null
479   fi   fi
480   ;;   ;;
481   tbz2)   tbz2|mpks|mpk)
482   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
483   ;;   ;;
484   tgz)   tgz)
485   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
486     ;;
487     txz|mpkzs|mpkz)
488     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
489     ;;
490     rar)
491     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
492     ;;
493     zip|xpi)
494     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
495     ;;
496     rpm)
497     pushd ${DEST} > /dev/null
498     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
499     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
500     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
501     then
502     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
503     fi
504   ;;   ;;
505   *)   *)
506   die "munpack failed"   die "munpack failed"
# Line 309  munpack() { Line 508  munpack() {
508   esac   esac
509  }  }
510    
511  mpatch() {  mpatch()
512    {
513   local PATCHOPTS   local PATCHOPTS
514   local PATCHFILE   local PATCHFILE
515     local i
516    
517   PATCHOPTS=$1   PATCHOPTS=$1
518   PATCHFILE=$2   PATCHFILE=$2
519    
520     if [[ -z $2 ]]
521     then
522     PATCHFILE=$1
523    
524     ## patch level auto-detection, get patch level
525     for ((i=0; i < 10; i++))
526     do
527     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
528     if [[ $? = 0 ]]
529     then
530     PATCHOPTS="-Np${i}"
531     break
532     fi
533     done
534     fi
535    
536     echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
537   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
538  }  }
539    
540    mlibtoolize()
541    {
542     local opts="$@"
543     [[ -z ${opts} ]] && opts="--verbose --install --force"
544    
545  minstalldocs() {   libtoolize ${opts} || die "running: mlibtoolize ${opts}"
546    }
547    
548    mautoreconf()
549    {
550     local opts="$@"
551     [[ -z ${opts} ]] && opts="--verbose --install --force"
552    
553     autoreconf ${opts} || die "running: mautoreconf ${opts}"
554    }
555    
556    minstalldocs()
557    {
558   local docfiles   local docfiles
   
559   docfiles="$@"   docfiles="$@"
560    
561   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
562   then   then
563   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
564   fi   fi
565    
566     local i
567   for i in ${docfiles}   for i in ${docfiles}
568   do   do
569   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
570   install -m 0644 ${SRCDIR}/${i}.gz \   then
571   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
572     install -m 0644 ${SRCDIR}/${i}.gz \
573     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
574     fi
575   done   done
576  }  }
577    
578  mstriplibs() {  mstriplibs()
579    {
580     local stripdir="$@"
581    
582     [ -z "${stripdir}" ] && stripdir=${BINDIR}
583     find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_LIB} 2> /dev/null
584    }
585    
586    mstripbins()
587    {
588   local stripdir="$@"   local stripdir="$@"
589    
590   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
591   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_BIN} 2> /dev/null
592  }  }
593    
594  mstripbins() {  mstripstatic()
595    {
596   local stripdir="$@"   local stripdir="$@"
597    
598   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
599   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip ${STRIP_STATIC_LIB} 2> /dev/null
600  }  }
601    
602  sminclude() {  mcompressdocs()
603    {
604     local bindir="$@"
605    
606     if [ -d ${bindir}/usr/share/man ]
607     then
608     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
609     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
610     fi
611    
612     if [ -d ${bindir}/usr/share/info ]
613     then
614     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
615     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
616     fi
617    }
618    
619    sminclude()
620    {
621   local i   local i
622    
623   if [[ -n "$@" ]]   if [[ -n "$@" ]]
# Line 366  sminclude() { Line 631  sminclude() {
631   fi   fi
632  }  }
633    
634  setup_distcc_environment(){  setup_distcc_environment()
635    {
636   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
637   then   then
638   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
639   export PATH=/usr/lib/distcc/bin:${PATH} || die "distcc: could not export new $PATH"   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"
   
  #export distcc as compiler  
 # export CC="distcc"  
 # export CXX=distcc  
640    
641   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
642    
643     # creating distcc tempdir
  #ccache + distcc together  
  if [ "${SMAGE_USE_CCACHE}" == "true" ]  
  then  
  if [ -x /usr/bin/ccache ]  
  then  
  echo "Preparing DistCC to work together with CCache ..."  
  #export CCACHE_PREFIX="distcc" || die "distcc: could not set ccach_prefix"  
 # export CC="ccache distcc"  
 # export CXX="ccache distcc"  
  fi  
  fi  
   
  #creating distcc tempdir  
644   install -o distcc -g daemon -d ${DISTCC_DIR}   install -o distcc -g daemon -d ${DISTCC_DIR}
645   chmod 1777 ${DISTCC_DIR}   chmod 1777 ${DISTCC_DIR}
646   fi   fi
647  }  }
648    
649  setup_ccache_environment(){  setup_ccache_environment()
650    {
651   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
652   then   then
653   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
654   export PATH=/usr/lib/ccache/bin:${PATH} || die "ccache: could not export new $PATH"   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"
  #unset CC CXX  
655   fi   fi
656  }  }
657    
658    
659  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
660  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
661  fix_mage_deps() {  fix_mage_deps()
662    {
663   local target="$1"   local target="$1"
664   local depend="$2"   local depend="$2"
665   local NDEPEND   local NDEPEND
# Line 424  fix_mage_deps() { Line 674  fix_mage_deps() {
674   # fix DEPEND   # fix DEPEND
675   while read sym dep   while read sym dep
676   do   do
677     # ignore empty lines
678     [[ -z ${dep} ]] && continue
679    
680   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
681   # change if not virtual   # change if not virtual
682   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 476  EOF Line 729  EOF
729  # special tags:  # special tags:
730  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
731  #   INHERITS              which functions get included  #   INHERITS              which functions get included
732  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
733  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
734    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
735    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
736    #                         (only in the resulting magefile}
737  #  #
738  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
739  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 488  build_mage_script() Line 744  build_mage_script()
744   local magefile   local magefile
745   local dest   local dest
746   local target   local target
747     local split_pkg_base
748   local sym   local sym
749   local depname   local depname
750    
# Line 495  build_mage_script() Line 752  build_mage_script()
752   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
753    
754   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
755   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
756    
757     # mark package as splitpackage
758     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
759    
760   # name of magefile   # name of magefile
761   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 504  build_mage_script() Line 764  build_mage_script()
764   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
765    
766   # show what we are doing   # show what we are doing
767   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
768   echo "  ${dest}"   echo "${dest}"
769    
770   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
771   # now build the mage file   # now build the mage file
772   > ${dest}   > ${dest}
773    
  # header  
  echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.38 2005-10-03 20:54:14 niro Exp $' >> ${dest}  
  echo  >> ${dest}  
   
774   # pgkname and state   # pgkname and state
775   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
776   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
  echo >> ${dest}  
777    
778   # description and homepage   # description and homepage
779   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
780   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
  echo >> ${dest}  
781    
782   # special tags and vars   # special tags and vars
783   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
784    
785   # echo MAGE_TARGETS ## note -target is needed !   # echo MAGE_TARGETS ## note -target is needed !
786   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
787   echo >> ${dest}  
788     # split package base
789     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
790    
791   # add special vars   # add special vars
792   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
# Line 541  build_mage_script() Line 797  build_mage_script()
797   # being tricky here :)   # being tricky here :)
798   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
799   done   done
  echo  >> ${dest}  
800   fi   fi
801    
802   # add at least all includes   # add at least all includes
# Line 553  build_mage_script() Line 808  build_mage_script()
808   do   do
809   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
810   done   done
811   echo  >> ${dest}   # a CRLF is needed here!
812     echo >> ${dest}
813   fi   fi
  echo >> ${dest}  
814    
815   # deps and provides   # deps and provides
816   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
  echo >> ${dest}  
817   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
  echo >> ${dest}  
818   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
  echo >> ${dest}  
819    
820   # add special functions   # add special functions
821   if [ -n "${SPECIAL_FUNCTIONS}" ]   if [ -n "${SPECIAL_FUNCTIONS}" ]
# Line 573  build_mage_script() Line 825  build_mage_script()
825   do   do
826   # add to mage (quotes needed !)   # add to mage (quotes needed !)
827   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  echo >> ${dest}  
828   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
829   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
830   done   done
  echo  >> ${dest}  
831   fi   fi
832    
833   # pre|post-install|removes   # pre|post-install|removes
834   typeset -f preinstall >> ${dest}   typeset -f preinstall >> ${dest}
  echo  >> ${dest}  
835   typeset -f postinstall >> ${dest}   typeset -f postinstall >> ${dest}
  echo  >> ${dest}  
836   typeset -f preremove >> ${dest}   typeset -f preremove >> ${dest}
  echo  >> ${dest}  
837   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
  echo  >> ${dest}  
838  }  }
839    
840  regen_mage_tree()  regen_mage_tree()
841  {  {
842   local i   local subpackage
843    
844   # build them only if requested   # build them only if requested
845   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
846   then   then
847   # run it without targets   # run it without targets
848   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
849   then   then
850     # build for each target a mage file
851     # run it with several targets
852   echo   echo
853   build_mage_script   for subpackage in ${MAGE_TARGETS}
854     do
855     build_mage_script --target "${subpackage}"
856     done
857   echo   echo
  else  
858    
859   # build for each target an mage file   # run it for splitpackages
860     elif [[ -n ${SPLIT_PACKAGES} ]]
861     then
862     local split_pkg_base="${PNAME}"
863     # save smage environment
864     split_save_variables
865     # build for each subpackage a mage file
866   # run it with several targets   # run it with several targets
867   for i in ${MAGE_TARGETS}   echo
868     for subpackage in ${SPLIT_PACKAGES}
869   do   do
870   echo   # get the right variables for the split
871   build_mage_script "${i}"   export PNAME="${subpackage}"
872   echo   split_info_${subpackage}
873     # get the preinstall etc
874     split_export_inherits ${subpackage}
875     build_mage_script --split-pkg-base "${split_pkg_base}"
876     # delete split preinstall etc
877     split_delete_inherits ${subpackage}
878     # restore smage environment
879     split_restore_variables
880   done   done
881     echo
882     # unset all saved smage variables
883     split_unset_variables
884    
885     else
886     echo
887     build_mage_script
888     echo
889   fi   fi
890   fi   fi
891    
892   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
893   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
894   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
895   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
896   do  # do
897   unset "${i}"  # unset "${i}"
898   done  # done
899   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
900   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
901   do  # do
902   unset "${i}"  # unset "${i}"
903   done  # done
904   unset SPECIAL_VARS   unset SPECIAL_VARS
905   unset STATE   unset STATE
906   unset DESCRIPTION   unset DESCRIPTION
# Line 644  regen_mage_tree() Line 916  regen_mage_tree()
916   unset postremove   unset postremove
917  }  }
918    
919    split_save_variables()
920    {
921     export SAVED_PNAME="${PNAME}"
922     export SAVED_PVER="${PVER}"
923     export SAVED_PBUILD="${PBUILD}"
924     export SAVED_PCATEGORIE="${PCATEGORIE}"
925     export SAVED_DESCRIPTION="${DESCRIPTION}"
926     export SAVED_HOMEPAGE="${HOMEPAGE}"
927     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
928     export SAVED_STATE="${STATE}"
929     export SAVED_PKGTYPE="${PKGTYPE}"
930     export SAVED_INHERITS="${INHERITS}"
931     export SAVED_DEPEND="${DEPEND}"
932     export SAVED_SDEPEND="${SDEPEND}"
933     export SAVED_PROVIDE="${PROVIDE}"
934     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
935    
936     # bindir too
937     export SAVED_BINDIR="${BINDIR}"
938    
939     # export the SPLIT_PACKAGE_BASE
940     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
941    
942     # functions
943     if [[ ! -z $(typeset -f preinstall) ]]
944     then
945     # rename the old one
946     local saved_preinstall
947     saved_preinstall=SAVED_$(typeset -f preinstall)
948     eval "${saved_preinstall}"
949     export -f SAVED_preinstall
950     fi
951    
952     if [[ ! -z $(typeset -f postinstall) ]]
953     then
954     # rename the old one
955     local saved_postinstall
956     saved_postinstall=SAVED_$(typeset -f postinstall)
957     eval "${saved_postinstall}"
958     export -f SAVED_postinstall
959     fi
960    
961     if [[ ! -z $(typeset -f preremove) ]]
962     then
963     # rename the old one
964     local saved_preremove
965     saved_preremove=SAVED_$(typeset -f preremove)
966     eval "${saved_preremove}"
967     export -f SAVED_preremove
968     fi
969    
970     if [[ ! -z $(typeset -f postremove) ]]
971     then
972     # rename the old one
973     local saved_postremove
974     saved_postremove=SAVED_$(typeset -f postremove)
975     eval "${saved_postremove}"
976     export -f SAVED_postremove
977     fi
978    }
979    
980    split_restore_variables()
981    {
982     export PNAME="${SAVED_PNAME}"
983     export PVER="${SAVED_PVER}"
984     export PBUILD="${SAVED_PBUILD}"
985     export PCATEGORIE="${SAVED_PCATEGORIE}"
986     export DESCRIPTION="${SAVED_DESCRIPTION}"
987     export HOMEPAGE="${SAVED_HOMEPAGE}"
988     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
989     export STATE="${SAVED_STATE}"
990     export PKGTYPE="${SAVED_PKGTYPE}"
991     export INHERITS="${SAVED_INHERITS}"
992     export DEPEND="${SAVED_DEPEND}"
993     export SDEPEND="${SAVED_SDEPEND}"
994     export PROVIDE="${SAVED_PROVIDE}"
995     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
996    
997     # bindir too
998     export BINDIR="${SAVED_BINDIR}"
999    
1000     # functions
1001     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
1002     then
1003     # rename the old one
1004     local saved_preinstall
1005     saved_preinstall=$(typeset -f SAVED_preinstall)
1006     eval "${saved_preinstall/SAVED_/}"
1007     export -f preinstall
1008     fi
1009    
1010     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
1011     then
1012     # rename the old one
1013     local saved_postinstall
1014     saved_postinstall=$(typeset -f SAVED_postinstall)
1015     eval "${saved_postinstall/SAVED_/}"
1016     export -f postinstall
1017     fi
1018    
1019     if [[ ! -z $(typeset -f SAVED_preremove) ]]
1020     then
1021     # rename the old one
1022     local saved_preremove
1023     saved_preremove=$(typeset -f SAVED_preremove)
1024     eval "${saved_preremove/SAVED_/}"
1025     export -f preremove
1026     fi
1027    
1028     if [[ ! -z $(typeset -f SAVED_postremove) ]]
1029     then
1030     # rename the old one
1031     local saved_postremove
1032     saved_postremove=$(typeset -f SAVED_postremove)
1033     eval "${saved_postremove/SAVED_/}"
1034     export -f postremove
1035     fi
1036    }
1037    
1038    split_unset_variables()
1039    {
1040     # unset saved vars; not needed anymore
1041     unset SAVED_PNAME
1042     unset SAVED_PVER
1043     unset SAVED_PBUILD
1044     unset SAVED_PCATEGORIE
1045     unset SAVED_DESCRIPTION
1046     unset SAVED_HOMEPAGE
1047     unset SAVED_SPECIAL_VARS
1048     unset SAVED_STATE
1049     unset SAVED_PKGTYPE
1050     unset SAVED_INHERITS
1051     unset SAVED_DEPEND
1052     unset SAVED_SDEPEND
1053     unset SAVED_PROVIDE
1054     unset SAVED_BINDIR
1055     unset SAVED_NOPKGBUILD
1056     unset SPLIT_PACKAGE_BASE
1057     unset -f SAVED_preinstall
1058     unset -f SAVED_postinstall
1059     unset -f SAVED_preremove
1060     unset -f SAVED_postremove
1061    }
1062    
1063    split_export_inherits()
1064    {
1065     local subpackage="$1"
1066     local func
1067     local newfunc
1068    
1069     for func in preinstall postinstall preremove postremove
1070     do
1071     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1072     then
1073     newfunc=$(typeset -f ${func}_${subpackage})
1074     newfunc="${newfunc/_${subpackage} (/ (}"
1075     eval "${newfunc}"
1076     fi
1077     done
1078    }
1079    
1080    split_delete_inherits()
1081    {
1082     local subpackage="$1"
1083     local func
1084    
1085     for func in preinstall postinstall preremove postremove
1086     do
1087     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1088     then
1089     unset -f ${func}
1090     fi
1091     done
1092     }
1093    
1094  export_inherits()  export_inherits()
1095  {  {
1096   local include="$1"   local include="$1"
# Line 705  generate_package_md5sum() Line 1152  generate_package_md5sum()
1152   # fix target as it may be empty !   # fix target as it may be empty !
1153   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1154    
1155    
1156   # build pkgname   # build pkgname
1157   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1158    
1159   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1160   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
1161   then   then
1162   echo -n "Generating a md5sum for ${pkgname}.${PKGSUFFIX} ... "   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1163    
1164   # abort if not exist   # abort if not exist
1165   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
1166   then   then
1167   echo "! exists"   echo -e "${COLRED}! exists${COLDEFAULT}"
1168   return 0   return 0
1169   fi   fi
1170    
# Line 724  generate_package_md5sum() Line 1172  generate_package_md5sum()
1172   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1173    
1174   # setup md5 dir   # setup md5 dir
1175   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1176   install -d ${dest}   install -d ${dest}
1177    
1178   # gen md5sum   # gen md5sum
1179   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
1180   >> ${dest}/${pkgname}.md5   > ${dest}/${pkgname}.md5
1181   echo "done"   echo -e "${COLGREEN}done${COLDEFAULT}"
1182     fi
1183    }
1184    
1185    source_pkg_build()
1186    {
1187     if [[ ${PKGTYPE} = virtual ]]
1188     then
1189     echo "Virtual package detected; src-pkg-tarball not necessary ..."
1190     return 0
1191     fi
1192    
1193     if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
1194     then
1195     echo "No SRC_URI defined; src-pkg-tarball not necessary ..."
1196     return 0
1197     fi
1198    
1199     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
1200    
1201     echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
1202    
1203     # include the smage2 file
1204     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
1205    
1206     ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
1207     [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1208     mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1209    
1210     echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1211    }
1212    
1213    step_by_step()
1214    {
1215     if [[ ${STEP_BY_STEP} = true ]]
1216     then
1217     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1218     echo "Press [enter] to continue"
1219     read
1220   fi   fi
1221  }  }
1222    
1223    
1224  # print out our version  # print out our version
1225  showversion  showversion
1226  echo  echo
# Line 746  then Line 1233  then
1233  fi  fi
1234    
1235  # updating smage2-scripts  # updating smage2-scripts
1236  if [ "$1" == "update" ]  if [[ $1 = update ]]
1237  then  then
1238   if [ ! -d ${SOURCEDIR} ]   if [ ! -d ${SOURCEDIR} ]
1239   then   then
# Line 757  then Line 1244  then
1244  fi  fi
1245    
1246  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1247  if [ "$1" == "calcmd5" ]  if [[ $1 = calcmd5 ]]
1248  then  then
1249   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1250   then   then
1251   SMAGENAME="$2"   SMAGENAME="$2"
1252   MD5DIR="$3"   MD5DIR="$3"
1253   source ${SMAGENAME} || die "download source failed"   [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1254    
1255     smagesource ${SMAGENAME} || die "download source failed"
1256    
1257   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
1258   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
# Line 809  then Line 1298  then
1298   unset my_SRC_URI_MIRROR   unset my_SRC_URI_MIRROR
1299   unset my_SOURCEDIR   unset my_SOURCEDIR
1300   done   done
1301    
1302   echo   echo
1303   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."   echo "Calculating of md5 sums for '$(basename ${SMAGENAME} .${SMAGESUFFIX})' done."
1304   echo   echo
1305   else   else
1306   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1307   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1308   echo   echo
1309   echo   echo
1310   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
1311   echo   echo
1312   exit 1   exit 1
1313   fi   fi
1314    
1315   exit 0   exit 0
1316  fi  fi
1317    
# Line 837  then Line 1326  then
1326   # get smage   # get smage
1327   SMAGENAME="$2"   SMAGENAME="$2"
1328   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1329   source ${SMAGENAME} || die "download source failed"   smagesource ${SMAGENAME} || die "download source failed"
1330    
1331   download_sources   download_sources
1332   exit 0   exit 0
# Line 849  then Line 1338  then
1338   # set correct SMAGENAME   # set correct SMAGENAME
1339   SMAGENAME="$2"   SMAGENAME="$2"
1340   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1341   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1342    
1343   regen_mage_tree   regen_mage_tree
1344    
1345   # build md5sum for existing packages   # build several targets
1346   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1347   --pcat "${PCATEGORIE}" \   then
1348   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1349   --pver "${PVER}" \   do
1350   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1351   --parch "${ARCH}" \   generate_package_md5sum \
1352   --target "${target}"   --pcat "${PCATEGORIE}" \
1353     --pname "${PNAME}" \
1354     --pver "${PVER}" \
1355     --pbuild "${PBUILD}" \
1356     --parch "${ARCH}" \
1357     --target "${target}"
1358     done
1359    
1360     # build several subpackages
1361     elif [[ -n ${SPLIT_PACKAGES} ]]
1362     then
1363     split_save_variables
1364     for subpackage in ${SPLIT_PACKAGES}
1365     do
1366     # get the right variables for the split
1367     export PNAME="${subpackage}"
1368     split_info_${subpackage}
1369     # build md5sum for existing packages
1370     generate_package_md5sum \
1371     --pcat "${PCATEGORIE}" \
1372     --pname "${PNAME}" \
1373     --pver "${PVER}" \
1374     --pbuild "${PBUILD}" \
1375     --parch "${ARCH}"
1376     # restore smage environment
1377     split_restore_variables
1378     done
1379     # unset all saved smage variables
1380     split_unset_variables
1381    
1382     else
1383     # build md5sum for existing packages
1384     generate_package_md5sum \
1385     --pcat "${PCATEGORIE}" \
1386     --pname "${PNAME}" \
1387     --pver "${PVER}" \
1388     --pbuild "${PBUILD}" \
1389     --parch "${ARCH}"
1390     fi
1391    
1392   exit 0   exit 0
1393  fi  fi
1394    
1395  if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ]  if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1396  then  then
1397   die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."   # set correct SMAGENAME
1398  fi   SMAGENAME="$2"
1399     MD5DIR="$(dirname ${SMAGENAME})/md5"
1400    
1401  if [ -z "`basename ${SMAGENAME}|grep .${SMAGESUFFIX}`" ]   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
 then  
  die "File '`basename ${SMAGENAME}`' is not a sMage v${SMAGEVERSION} file. Aborting."  
 fi  
1402    
1403  if [ -z "${SOURCEDIR}" ]   smagesource ${SMAGENAME} || die "regen: smage2 not found"
 then  
  die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  
 fi  
1404    
1405  if [ -z "${SMAGESCRIPTSDIR}" ]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1406  then   then
1407   die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."   echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1408  fi   rm -rf ${SOURCEDIR}/${PKGNAME}
1409     fi
1410    
1411  if [ -z "${SMAGE2RSYNC}" ]   download_sources
1412  then   source_pkg_build ${SMAGENAME}
1413   echo "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."   exit 0
  exit 1  
1414  fi  fi
1415    
1416  if [ -z "${BINDIR}" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1417  then  then
1418   die "no BINDIR variable found in /etc/mage.rc"   SRCPKGTARBALL="${2}"
1419  fi   USE_SRC_PKG_TARBALL=true
1420    
1421  if [ -z "${CHOST}" ]   # abort if given file is not a source pkg
1422  then   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
  die "no CHOST variable found in /etc/mage.rc"  
 fi  
1423    
1424  if [ -z "${CFLAGS}" ]   # set correct SMAGENAME; use the one that the src_pkg provide
1425  then   # /path/to/SOURCEDIR/PNAME/SMAGENAME
1426   die "no CFLAGS variable found in /etc/mage.rc"   SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
 fi  
1427    
1428  if [ -z "${CXXFLAGS}" ]   echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1429  then  
1430   die "no CXXFLAGS variable found in /etc/mage.rc"   [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
1431    
1432     # unpack srctarball
1433     [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1434    
1435     tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1436    
1437     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1438  fi  fi
1439    
1440    
1441  source ${SMAGENAME} || die "source failed"  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1442    [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1443     die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1444    [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1445    [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1446    [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1447    [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1448    [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1449    [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1450    [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1451    
1452    smagesource ${SMAGENAME} || die "source failed"
1453  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1454  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1455    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1456    
1457  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1458  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1459    
1460  # auto regen mage tree if requested  # auto regen mage tree if requested
1461  regen_mage_tree  regen_mage_tree
1462    
1463    if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]
1464    then
1465     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1466     then
1467     echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1468     rm -rf ${SOURCEDIR}/${PNAME}
1469     fi
1470    fi
1471    
1472  # download sources  # download sources
1473  download_sources  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources
1474    
1475  # fixes some issues with these functions  # fixes some issues with these functions
1476  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
# Line 939  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1486  export MAKEOPTS="${MAKEOPTS}" || die "MA
1486    
1487    
1488  # setup distcc  # setup distcc
1489  # distcc mus be setup *before* ccache, as ccache need to be before distcc in path  # setup for distcc goes *before* ccache, so ccache comes before distcc in path
1490  if [ "${SMAGE_USE_DISTCC}" == "true" ]  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment
 then  
  setup_distcc_environment  
 fi  
1491    
1492  # setup ccache  # setup ccache
1493  if [ "${SMAGE_USE_CCACHE}" == "true" ]  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
 then  
  setup_ccache_environment  
 fi  
   
1494    
1495  # small sleep to show our settings  # small sleep to show our settings
1496  sleep 1  sleep 1
1497    
 #debug  
 #echo "CC=${CC}"  
 #echo "CXX=${CXX}"  
 #echo "DISTCC_DIR=${DISTCC_DIR}"  
 #echo "PATH: ${PATH}"  
 #echo "--------------------------------------"  
 #env  
 #echo "--------------------------------------"  
 #read  
 #debug end  
   
1498  # cleans up build if a previously one exists  # cleans up build if a previously one exists
1499  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1500  then  then
# Line 998  then Line 1527  then
1527   mage rmstamp   mage rmstamp
1528  fi  fi
1529    
1530  src_prepare || die "src_prepare failed"  # setup build loggins
1531  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1532  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1533    
1534    src_prepare | ${SMAGE_LOG_CMD}
1535    die_pipestatus 0 "src_prepare failed"
1536    step_by_step $_
1537    
1538    src_compile | ${SMAGE_LOG_CMD}
1539    die_pipestatus 0 "src_compile failed"
1540    step_by_step $_
1541    
1542    # build several subpackages
1543    if [[ -n ${SPLIT_PACKAGES} ]]
1544    then
1545     # save bindir & pname
1546     split_save_variables
1547     export SAVED_BINDIR="${BINDIR}"
1548     for subpackage in ${SPLIT_PACKAGES}
1549     do
1550     if typeset -f src_install_${subpackage} > /dev/null
1551     then
1552     # export subpackage bindir
1553     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1554     # export PNAME, several internal function and include
1555     # rely on this variable
1556     export PNAME="${subpackage}"
1557    
1558     echo
1559     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1560     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1561     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1562     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1563    
1564     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1565     die_pipestatus 0 "src_install_${subpackage} failed"
1566     step_by_step $_
1567     fi
1568     done
1569     # restore bindir & pname
1570     split_restore_variables
1571     # unset all saved smage variables
1572     split_unset_variables
1573    else
1574     src_install | ${SMAGE_LOG_CMD}
1575     die_pipestatus 0 "src_install failed"
1576     step_by_step $_
1577    fi
1578    
1579  # compressing doc, info & man files  # compressing doc, info & man files
1580  echo -e "Compressing man-pages ..."  if [[ -n ${SPLIT_PACKAGES} ]]
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1581  then  then
1582   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   for subpackage in ${SPLIT_PACKAGES}
1583     do
1584     mcompressdocs ${BINDIR}_${subpackage}
1585     done
1586    else
1587     mcompressdocs ${BINDIR}
1588  fi  fi
1589    
 echo -e "Compressing info-pages ..."  
 if [ -d ${BUILDDIR}/builded/usr/share/info ]  
 then  
  ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info  
 fi  
1590    
1591  # stripping all bins and libs  # stripping all bins and libs
1592  case ${NOSTRIP} in  case ${NOSTRIP} in
# Line 1022  case ${NOSTRIP} in Line 1594  case ${NOSTRIP} in
1594   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1595   ;;   ;;
1596   *)   *)
1597   echo -e "Stripping binaries ..."   if [[ -n ${SPLIT_PACKAGES} ]]
1598   mstripbins ${BINDIR}   then
1599   echo -e "Stripping libraries ..."   for subpackage in ${SPLIT_PACKAGES}
1600   mstriplibs ${BINDIR}   do
1601     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1602     mstripbins ${BINDIR}_${subpackage}
1603     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1604     mstriplibs ${BINDIR}_${subpackage}
1605     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1606     mstripstatic ${BINDIR}_${subpackage}
1607     done
1608     else
1609     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1610     mstripbins ${BINDIR}
1611     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1612     mstriplibs ${BINDIR}
1613     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1614     mstripstatic ${BINDIR}
1615     fi
1616   ;;   ;;
1617  esac  esac
1618    
# Line 1035  case ${NOPKGBUILD} in Line 1622  case ${NOPKGBUILD} in
1622   echo -e "NOPGKBUILD=true detected; Package will not be build ..."   echo -e "NOPGKBUILD=true detected; Package will not be build ..."
1623   ;;   ;;
1624   *)   *)
1625   # build serveral targets   # build several targets
1626   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1627   then   then
1628   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1629   do   do
# Line 1060  case ${NOPKGBUILD} in Line 1647  case ${NOPKGBUILD} in
1647   --parch "${ARCH}" \   --parch "${ARCH}" \
1648   --target "${target}"   --target "${target}"
1649    
1650   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1651   done   done
1652    
1653     # build several subpackages
1654     elif [[ -n ${SPLIT_PACKAGES} ]]
1655     then
1656     split_save_variables
1657     for subpackage in ${SPLIT_PACKAGES}
1658     do
1659     # get the right variables for the split
1660     export PNAME="${subpackage}"
1661     split_info_${PNAME}
1662    
1663     # jump to next one if NOPKGBUILD is set in split_info
1664     case ${NOPKGBUILD} in
1665     true|TRUE|yes|y) continue ;;
1666     esac
1667    
1668     # check if an special subpackage_pkgbuild exists
1669     if typeset -f ${PNAME}_pkgbuild > /dev/null
1670     then
1671     # run it
1672     ${PNAME}_pkgbuild
1673     fi
1674     # now create the target package
1675     ${MLIBDIR}/pkgbuild_dir.sh \
1676     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1677     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1678    
1679     # build pkg-md5-sum if requested
1680     generate_package_md5sum \
1681     --pcat "${PCATEGORIE}" \
1682     --pname "${PNAME}" \
1683     --pver "${PVER}" \
1684     --pbuild "${PBUILD}" \
1685     --parch "${ARCH}"
1686    
1687     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1688    
1689     # restore smage environment
1690     split_restore_variables
1691     done
1692     # unset all saved smage variables
1693     split_unset_variables
1694    
1695   else   else
1696   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1697    
# Line 1073  case ${NOPKGBUILD} in Line 1703  case ${NOPKGBUILD} in
1703   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1704   --parch "${ARCH}"   --parch "${ARCH}"
1705    
1706   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1707   fi   fi
1708    
1709     # build src-pkg-tarball if requested
1710     [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}
1711   ;;   ;;
1712  esac  esac
1713    
1714    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1715    then
1716     bzip2 -9f /var/log/smage/${PKGNAME}.log
1717    else
1718     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1719    fi
1720    
1721  # for sure  # for sure
1722  unset NOPKGBUILD  unset NOPKGBUILD
1723  unset NOSTRIP  unset NOSTRIP
1724    
1725  xtitleclean  xtitleclean
 #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  

Legend:
Removed from v.255  
changed lines
  Added in v.1571