Magellan Linux

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

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

revision 891 by niro, Tue Aug 4 19:51:42 2009 UTC revision 1579 by niro, Wed Dec 28 10:56:10 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.62 2007-11-28 10:47:50 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    
13  ## setup ##  ## setup ##
 PKGSUFFIX="mpk"  
 SRCPKGSUFFIX="mpks"  
14  SMAGENAME="$1"  SMAGENAME="$1"
 SMAGESUFFIX="smage2"  
 MLIBDIR=/usr/lib/mage  
15  SMAGEVERSION="$( < ${MLIBDIR}/version)"  SMAGEVERSION="$( < ${MLIBDIR}/version)"
 SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"  
   
   
 ## 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  
16    
17  # export default C locale  # export default C locale
18  export LC_ALL=C  export LC_ALL=C
19    
20  source /etc/mage.rc.global  source /etc/mage.rc.global
21  source ${MAGERC}  source ${MAGERC}
22    source ${MLIBDIR}/mage4.functions.sh
23    
24  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
25  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 61  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 75  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 142  download_sources() Line 150  download_sources()
150   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
151   local FETCHING   local FETCHING
152   local i mirror   local i mirror
153     local wget_opts
154    
155     # filter wget command if busybox was found
156     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
157    
158   # install SRCDIR/PNAME if not exist   # install SRCDIR/PNAME if not exist
159   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
160    
161   # check if FETCHING is needed   # check if FETCHING is needed
162   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null )
163   if [[ $? = 0 ]]   if [[ $? = 0 ]]
164   then   then
165   # md5's ok, no fetching needed   # md5's ok, no fetching needed
# Line 187  download_sources() Line 198  download_sources()
198   then   then
199   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
200   wget \   wget \
201   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
202   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
203   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
204   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 211  download_sources() Line 219  download_sources()
219   then   then
220   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
221   wget \   wget \
222   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
223   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
224   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
225   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 235  download_sources() Line 240  download_sources()
240   then   then
241   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
242   wget \   wget \
243   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
244   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
245   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
246   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 259  download_sources() Line 261  download_sources()
261   then   then
262   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
263   wget \   wget \
264   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
265   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
266   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
267   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 283  download_sources() Line 282  download_sources()
282   then   then
283   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
284   wget \   wget \
285   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
286   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
287   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
288   if [[ $? = 0 ]]   if [[ $? = 0 ]]
# Line 302  download_sources() Line 298  download_sources()
298   then   then
299   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
300   wget \   wget \
301   --passive-ftp \   ${wget_opts} \
  --tries 3 \  
  --continue \  
  --progress bar \  
302   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
303   "${my_SRC_URI}"   "${my_SRC_URI}"
304   fi   fi
# Line 321  download_sources() Line 314  download_sources()
314   # recheck md5 sums   # recheck md5 sums
315   echo   echo
316   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
317   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed"
318   echo   echo
319    
320   # not needed anymore   # not needed anymore
321   unset SRC_URI   unset SRC_URI
322  }  }
323    
324  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
325  src_prepare()  src_prepare()
326  {  {
327   echo "no src_prepare defined"   echo "no src_prepare defined"
  sleep 2  
328   return 0   return 0
329  }  }
330    
331  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
332  src_compile()  src_compile()
333  {  {
334   echo "no src_compile defined"   echo "no src_compile defined"
  sleep 2  
335   return 0   return 0
336  }  }
337    
338  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
339    src_check()
340    {
341     echo "no src_check defined"
342     return 0
343    }
344    
345    # dummy function, used if that does not exist in smage file
346  src_install()  src_install()
347  {  {
348   echo "no src_install defined"   echo "no src_install defined"
  sleep 2  
349   return 0   return 0
350  }  }
351    
# Line 445  munpack() Line 442  munpack()
442   popd > /dev/null   popd > /dev/null
443   fi   fi
444   ;;   ;;
445     xz)
446     IFTAR="$(basename $SRCFILE .xz)"
447     IFTAR="${IFTAR##*.}"
448     if [[ ${IFTAR} = tar ]]
449     then
450     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
451     else
452     pushd ${DEST} > /dev/null
453     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
454     popd > /dev/null
455     fi
456     ;;
457   tbz2|mpks|mpk)   tbz2|mpks|mpk)
458   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
459   ;;   ;;
460   tgz)   tgz)
461   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
462   ;;   ;;
463     txz|mpkzs|mpkz)
464     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
465     ;;
466   rar)   rar)
467   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
468   ;;   ;;
# Line 504  mpatch() Line 516  mpatch()
516  mlibtoolize()  mlibtoolize()
517  {  {
518   local opts="$@"   local opts="$@"
519   [[ -z ${opts} ]] && opts="--copy --force"   [[ -z ${opts} ]] && opts="--verbose --install --force"
520    
521   libtoolize ${opts} || die "running: mlibtoolize ${opts}"   libtoolize ${opts} || die "running: mlibtoolize ${opts}"
522  }  }
523    
524    mautoreconf()
525    {
526     local opts="$@"
527     [[ -z ${opts} ]] && opts="--verbose --install --force"
528    
529     autoreconf ${opts} || die "running: mautoreconf ${opts}"
530    }
531    
532  minstalldocs()  minstalldocs()
533  {  {
534   local docfiles   local docfiles
# Line 519  minstalldocs() Line 539  minstalldocs()
539   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
540   fi   fi
541    
542     local i
543   for i in ${docfiles}   for i in ${docfiles}
544   do   do
545   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
546   install -m 0644 ${SRCDIR}/${i}.gz \   then
547   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
548     install -m 0644 ${SRCDIR}/${i}.gz \
549     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
550     fi
551   done   done
552  }  }
553    
# Line 531  mstriplibs() Line 555  mstriplibs()
555  {  {
556   local stripdir="$@"   local stripdir="$@"
557    
558   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
559   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"
560     find ${stripdir} ! -type d | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_LIB} 2> /dev/null
561  }  }
562    
563  mstripbins()  mstripbins()
564  {  {
565   local stripdir="$@"   local stripdir="$@"
566    
567   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
568   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"
569     find ${stripdir} ! -type d | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_DYN_BIN} 2> /dev/null
570    }
571    
572    mstripstatic()
573    {
574     local stripdir="$@"
575    
576     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
577     [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug"
578     find ${stripdir} ! -type d | xargs file | grep "ar archive" | cut -f 1 -d : | xargs --no-run-if-empty strip ${STRIP_STATIC_LIB} 2> /dev/null
579    }
580    
581    mcompressdocs()
582    {
583     local bindir="$@"
584    
585     if [ -d ${bindir}/usr/share/man ]
586     then
587     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
588     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
589     fi
590    
591     if [ -d ${bindir}/usr/share/info ]
592     then
593     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
594     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
595     fi
596  }  }
597    
598  sminclude()  sminclude()
# Line 658  EOF Line 710  EOF
710  #   INHERITS              which functions get included  #   INHERITS              which functions get included
711  #   SPECIAL_FUNCTIONS     special functions which should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
712  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
713    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
714    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
715    #                         (only in the resulting magefile}
716  #  #
717  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
718  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 668  build_mage_script() Line 723  build_mage_script()
723   local magefile   local magefile
724   local dest   local dest
725   local target   local target
726     local split_pkg_base
727   local sym   local sym
728   local depname   local depname
729    
# Line 675  build_mage_script() Line 731  build_mage_script()
731   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
732    
733   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
734   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
735    
736     # mark package as splitpackage
737     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
738    
739   # name of magefile   # name of magefile
740   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 691  build_mage_script() Line 750  build_mage_script()
750   # now build the mage file   # now build the mage file
751   > ${dest}   > ${dest}
752    
  # header  
  echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest}  
  echo  >> ${dest}  
   
753   # pgkname and state   # pgkname and state
754   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}   echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
755   echo "STATE=\"${STATE}\"" >> ${dest}   echo "STATE=\"${STATE}\"" >> ${dest}
  echo >> ${dest}  
756    
757   # description and homepage   # description and homepage
758   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}   echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
759   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}   echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
  echo >> ${dest}  
760    
761   # special tags and vars   # special tags and vars
762   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}   echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
763    
764   # echo MAGE_TARGETS ## note -target is needed !   # echo MAGE_TARGETS ## note -target is needed !
765   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
766   echo >> ${dest}  
767     # split package base
768     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
769    
770   # add special vars   # add special vars
771   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
# Line 721  build_mage_script() Line 776  build_mage_script()
776   # being tricky here :)   # being tricky here :)
777   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}   echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
778   done   done
  echo  >> ${dest}  
779   fi   fi
780    
781   # add at least all includes   # add at least all includes
# Line 733  build_mage_script() Line 787  build_mage_script()
787   do   do
788   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
789   done   done
790   echo  >> ${dest}   # a CRLF is needed here!
791     echo >> ${dest}
792   fi   fi
  echo >> ${dest}  
793    
794   # deps and provides   # deps and provides
795   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}   echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
  echo >> ${dest}  
796   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}   echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
  echo >> ${dest}  
797   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}   echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
  echo >> ${dest}  
798    
799   # add special functions   # add special functions
800   if [ -n "${SPECIAL_FUNCTIONS}" ]   if [ -n "${SPECIAL_FUNCTIONS}" ]
# Line 753  build_mage_script() Line 804  build_mage_script()
804   do   do
805   # add to mage (quotes needed !)   # add to mage (quotes needed !)
806   typeset -f "${i}" >> ${dest}   typeset -f "${i}" >> ${dest}
  echo >> ${dest}  
807   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
808   #unset "${i}" <-- later to get every target built   #unset "${i}" <-- later to get every target built
809   done   done
  echo  >> ${dest}  
810   fi   fi
811    
812   # pre|post-install|removes   # pre|post-install|removes
813   typeset -f preinstall >> ${dest}   typeset -f preinstall >> ${dest}
  echo  >> ${dest}  
814   typeset -f postinstall >> ${dest}   typeset -f postinstall >> ${dest}
  echo  >> ${dest}  
815   typeset -f preremove >> ${dest}   typeset -f preremove >> ${dest}
  echo  >> ${dest}  
816   typeset -f postremove >> ${dest}   typeset -f postremove >> ${dest}
  echo  >> ${dest}  
817  }  }
818    
819  regen_mage_tree()  regen_mage_tree()
820  {  {
821   local i   local subpackage
822    
823   # build them only if requested   # build them only if requested
824   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
825   then   then
826   # run it without targets   # run it without targets
827   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
828   then   then
829     # build for each target a mage file
830     # run it with several targets
831   echo   echo
832   build_mage_script   for subpackage in ${MAGE_TARGETS}
833     do
834     build_mage_script --target "${subpackage}"
835     done
836   echo   echo
  else  
837    
838   # build for each target an mage file   # run it for splitpackages
839     elif [[ -n ${SPLIT_PACKAGES} ]]
840     then
841     local split_pkg_base="${PNAME}"
842     # save smage environment
843     split_save_variables
844     # build for each subpackage a mage file
845   # run it with several targets   # run it with several targets
846   for i in ${MAGE_TARGETS}   echo
847     for subpackage in ${SPLIT_PACKAGES}
848   do   do
849   echo   # get the right variables for the split
850   build_mage_script "${i}"   export PNAME="${subpackage}"
851   echo   split_info_${subpackage}
852     # get the preinstall etc
853     split_export_inherits ${subpackage}
854     build_mage_script --split-pkg-base "${split_pkg_base}"
855     # delete split preinstall etc
856     split_delete_inherits ${subpackage}
857     # restore smage environment
858     split_restore_variables
859   done   done
860     echo
861     # unset all saved smage variables
862     split_unset_variables
863    
864     else
865     echo
866     build_mage_script
867     echo
868   fi   fi
869   fi   fi
870    
# Line 824  regen_mage_tree() Line 895  regen_mage_tree()
895   unset postremove   unset postremove
896  }  }
897    
898    split_save_variables()
899    {
900     export SAVED_PNAME="${PNAME}"
901     export SAVED_PVER="${PVER}"
902     export SAVED_PBUILD="${PBUILD}"
903     export SAVED_PCATEGORIE="${PCATEGORIE}"
904     export SAVED_DESCRIPTION="${DESCRIPTION}"
905     export SAVED_HOMEPAGE="${HOMEPAGE}"
906     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
907     export SAVED_STATE="${STATE}"
908     export SAVED_PKGTYPE="${PKGTYPE}"
909     export SAVED_INHERITS="${INHERITS}"
910     export SAVED_DEPEND="${DEPEND}"
911     export SAVED_SDEPEND="${SDEPEND}"
912     export SAVED_PROVIDE="${PROVIDE}"
913     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
914    
915     # bindir too
916     export SAVED_BINDIR="${BINDIR}"
917    
918     # export the SPLIT_PACKAGE_BASE
919     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
920    
921     # functions
922     if [[ ! -z $(typeset -f preinstall) ]]
923     then
924     # rename the old one
925     local saved_preinstall
926     saved_preinstall=SAVED_$(typeset -f preinstall)
927     eval "${saved_preinstall}"
928     export -f SAVED_preinstall
929     fi
930    
931     if [[ ! -z $(typeset -f postinstall) ]]
932     then
933     # rename the old one
934     local saved_postinstall
935     saved_postinstall=SAVED_$(typeset -f postinstall)
936     eval "${saved_postinstall}"
937     export -f SAVED_postinstall
938     fi
939    
940     if [[ ! -z $(typeset -f preremove) ]]
941     then
942     # rename the old one
943     local saved_preremove
944     saved_preremove=SAVED_$(typeset -f preremove)
945     eval "${saved_preremove}"
946     export -f SAVED_preremove
947     fi
948    
949     if [[ ! -z $(typeset -f postremove) ]]
950     then
951     # rename the old one
952     local saved_postremove
953     saved_postremove=SAVED_$(typeset -f postremove)
954     eval "${saved_postremove}"
955     export -f SAVED_postremove
956     fi
957    }
958    
959    split_restore_variables()
960    {
961     export PNAME="${SAVED_PNAME}"
962     export PVER="${SAVED_PVER}"
963     export PBUILD="${SAVED_PBUILD}"
964     export PCATEGORIE="${SAVED_PCATEGORIE}"
965     export DESCRIPTION="${SAVED_DESCRIPTION}"
966     export HOMEPAGE="${SAVED_HOMEPAGE}"
967     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
968     export STATE="${SAVED_STATE}"
969     export PKGTYPE="${SAVED_PKGTYPE}"
970     export INHERITS="${SAVED_INHERITS}"
971     export DEPEND="${SAVED_DEPEND}"
972     export SDEPEND="${SAVED_SDEPEND}"
973     export PROVIDE="${SAVED_PROVIDE}"
974     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
975    
976     # bindir too
977     export BINDIR="${SAVED_BINDIR}"
978    
979     # functions
980     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
981     then
982     # rename the old one
983     local saved_preinstall
984     saved_preinstall=$(typeset -f SAVED_preinstall)
985     eval "${saved_preinstall/SAVED_/}"
986     export -f preinstall
987     fi
988    
989     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
990     then
991     # rename the old one
992     local saved_postinstall
993     saved_postinstall=$(typeset -f SAVED_postinstall)
994     eval "${saved_postinstall/SAVED_/}"
995     export -f postinstall
996     fi
997    
998     if [[ ! -z $(typeset -f SAVED_preremove) ]]
999     then
1000     # rename the old one
1001     local saved_preremove
1002     saved_preremove=$(typeset -f SAVED_preremove)
1003     eval "${saved_preremove/SAVED_/}"
1004     export -f preremove
1005     fi
1006    
1007     if [[ ! -z $(typeset -f SAVED_postremove) ]]
1008     then
1009     # rename the old one
1010     local saved_postremove
1011     saved_postremove=$(typeset -f SAVED_postremove)
1012     eval "${saved_postremove/SAVED_/}"
1013     export -f postremove
1014     fi
1015    }
1016    
1017    split_unset_variables()
1018    {
1019     # unset saved vars; not needed anymore
1020     unset SAVED_PNAME
1021     unset SAVED_PVER
1022     unset SAVED_PBUILD
1023     unset SAVED_PCATEGORIE
1024     unset SAVED_DESCRIPTION
1025     unset SAVED_HOMEPAGE
1026     unset SAVED_SPECIAL_VARS
1027     unset SAVED_STATE
1028     unset SAVED_PKGTYPE
1029     unset SAVED_INHERITS
1030     unset SAVED_DEPEND
1031     unset SAVED_SDEPEND
1032     unset SAVED_PROVIDE
1033     unset SAVED_BINDIR
1034     unset SAVED_NOPKGBUILD
1035     unset SPLIT_PACKAGE_BASE
1036     unset -f SAVED_preinstall
1037     unset -f SAVED_postinstall
1038     unset -f SAVED_preremove
1039     unset -f SAVED_postremove
1040    }
1041    
1042    split_export_inherits()
1043    {
1044     local subpackage="$1"
1045     local func
1046     local newfunc
1047    
1048     for func in preinstall postinstall preremove postremove
1049     do
1050     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1051     then
1052     newfunc=$(typeset -f ${func}_${subpackage})
1053     newfunc="${newfunc/_${subpackage} (/ (}"
1054     eval "${newfunc}"
1055     fi
1056     done
1057    }
1058    
1059    split_delete_inherits()
1060    {
1061     local subpackage="$1"
1062     local func
1063    
1064     for func in preinstall postinstall preremove postremove
1065     do
1066     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1067     then
1068     unset -f ${func}
1069     fi
1070     done
1071     }
1072    
1073  export_inherits()  export_inherits()
1074  {  {
1075   local include="$1"   local include="$1"
# Line 947  step_by_step() Line 1193  step_by_step()
1193  {  {
1194   if [[ ${STEP_BY_STEP} = true ]]   if [[ ${STEP_BY_STEP} = true ]]
1195   then   then
1196   echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"   echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1197   echo "Press [enter] to continue"   echo "Press [enter] to continue"
1198   read   read
1199   fi   fi
# Line 979  fi Line 1225  fi
1225  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1226  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1227  then  then
1228   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1229   then   then
1230   SMAGENAME="$2"   SMAGENAME="$2"
1231   MD5DIR="$3"   MD5DIR="$3"
1232   source ${SMAGENAME} || die "download source failed"   [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1233    
1234     smagesource ${SMAGENAME} || die "download source failed"
1235    
1236   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
1237   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"   CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
# Line 1035  then Line 1283  then
1283   echo   echo
1284   else   else
1285   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1286   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1287   echo   echo
1288   echo   echo
1289   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 1057  then Line 1305  then
1305   # get smage   # get smage
1306   SMAGENAME="$2"   SMAGENAME="$2"
1307   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1308   source ${SMAGENAME} || die "download source failed"   smagesource ${SMAGENAME} || die "download source failed"
1309    
1310   download_sources   download_sources
1311   exit 0   exit 0
# Line 1069  then Line 1317  then
1317   # set correct SMAGENAME   # set correct SMAGENAME
1318   SMAGENAME="$2"   SMAGENAME="$2"
1319   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1320   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1321    
1322   regen_mage_tree   regen_mage_tree
1323    
1324   # build several targets   # build several targets
1325   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1326   then   then
1327   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1328   do   do
# Line 1087  then Line 1335  then
1335   --parch "${ARCH}" \   --parch "${ARCH}" \
1336   --target "${target}"   --target "${target}"
1337   done   done
1338    
1339     # build several subpackages
1340     elif [[ -n ${SPLIT_PACKAGES} ]]
1341     then
1342     split_save_variables
1343     for subpackage in ${SPLIT_PACKAGES}
1344     do
1345     # get the right variables for the split
1346     export PNAME="${subpackage}"
1347     split_info_${subpackage}
1348     # build md5sum for existing packages
1349     generate_package_md5sum \
1350     --pcat "${PCATEGORIE}" \
1351     --pname "${PNAME}" \
1352     --pver "${PVER}" \
1353     --pbuild "${PBUILD}" \
1354     --parch "${ARCH}"
1355     # restore smage environment
1356     split_restore_variables
1357     done
1358     # unset all saved smage variables
1359     split_unset_variables
1360    
1361   else   else
1362   # build md5sum for existing packages   # build md5sum for existing packages
1363   generate_package_md5sum \   generate_package_md5sum \
# Line 1094  then Line 1365  then
1365   --pname "${PNAME}" \   --pname "${PNAME}" \
1366   --pver "${PVER}" \   --pver "${PVER}" \
1367   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1368   --parch "${ARCH}" \   --parch "${ARCH}"
  --target "${target}"  
1369   fi   fi
1370    
1371   exit 0   exit 0
# Line 1109  then Line 1379  then
1379    
1380   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
1381    
1382   source ${SMAGENAME} || die "regen: smage2 not found"   smagesource ${SMAGENAME} || die "regen: smage2 not found"
1383    
1384   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1385   then   then
# Line 1158  fi Line 1428  fi
1428  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1429  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1430    
1431  source ${SMAGENAME} || die "source failed"  smagesource ${SMAGENAME} || die "source failed"
1432  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1433  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1434    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1435    
1436  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1437  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1183  fi Line 1454  fi
1454  # fixes some issues with these functions  # fixes some issues with these functions
1455  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
1456  export -f src_compile || die "src_compile export failed"  export -f src_compile || die "src_compile export failed"
1457    export -f src_check || die "src_check export failed"
1458  export -f src_install || die "src_install export failed"  export -f src_install || die "src_install export failed"
1459    
1460  # fixes some compile issues  # fixes some compile issues
# Line 1200  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1472  export MAKEOPTS="${MAKEOPTS}" || die "MA
1472  # setup ccache  # setup ccache
1473  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
1474    
1475  # small sleep to show our settings  # clean up builddir if a previously one exist
 sleep 1  
   
 # cleans up build if a previously one exists  
1476  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1477  then  then
1478   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1479  fi  fi
1480  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1481    
1482  # cleans up srcdir if a previously unpacked one exists  # clean up srcdir if a previously unpacked one exist
1483  if [ -d ${SRCDIR} ]  if [ -d ${SRCDIR} ]
1484  then  then
1485   rm -rf ${SRCDIR}   rm -rf ${SRCDIR}
1486  fi  fi
1487    
1488  # cleans up bindir if a previous build exists or creates a new one  # clean up bindir if a previous build exist or create a new one
1489  if [ -d ${BINDIR} ]  if [ -d ${BINDIR} ]
1490  then  then
1491   rm -rf ${BINDIR}   rm -rf ${BINDIR}
1492  fi  fi
1493  install -d ${BINDIR} || die "couldn't create \$BINDIR."  install -d ${BINDIR} || die "couldn't create \$BINDIR."
1494    
1495  # cleans up package temp dir if a previous build exists  # clean up package temp dir if a previous build exist
1496  if [ -d ${BUILDDIR}/${PKGNAME} ]  if [ -d ${BUILDDIR}/${PKGNAME} ]
1497  then  then
1498   rm -rf ${BUILDDIR}/${PKGNAME}   rm -rf ${BUILDDIR}/${PKGNAME}
1499  fi  fi
1500    
1501  # cleans up timestamp if one exists  # setup build logging
 if [ -f /var/tmp/timestamp ]  
 then  
  mage rmstamp  
 fi  
   
 # setup build loggins  
1502  [[ ! -d /var/log/smage ]] && install -d /var/log/smage  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1503  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1504    
1505  src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD}  src_prepare | ${SMAGE_LOG_CMD}
1506    die_pipestatus 0 "src_prepare failed"
1507  step_by_step $_  step_by_step $_
1508  src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD}  
1509  step_by_step $_  src_compile | ${SMAGE_LOG_CMD}
1510  src_install || die "src_install failed" | ${SMAGE_LOG_CMD}  die_pipestatus 0 "src_compile failed"
1511  step_by_step $_  step_by_step $_
1512    
1513    # only run checks if requested
1514    if [[ ${MAGE_CHECK} != true ]]
1515    then
1516     echo "MAGE_CHECK not requested; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1517     step_by_step src_check
1518    else
1519     src_check | ${SMAGE_LOG_CMD}
1520     die_pipestatus 0 "src_check failed"
1521     step_by_step $_
1522    fi
1523    
1524  # compressing doc, info & man files  # build several subpackages
1525  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [[ -n ${SPLIT_PACKAGES} ]]
1526  then  then
1527   echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"   # save bindir & pname
1528   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   split_save_variables
1529     export SAVED_BINDIR="${BINDIR}"
1530     for subpackage in ${SPLIT_PACKAGES}
1531     do
1532     if typeset -f src_install_${subpackage} > /dev/null
1533     then
1534     # export subpackage bindir
1535     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1536     # export PNAME, several internal function and include
1537     # rely on this variable
1538     export PNAME="${subpackage}"
1539    
1540     echo
1541     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1542     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1543     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1544     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1545    
1546     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1547     die_pipestatus 0 "src_install_${subpackage} failed"
1548     step_by_step $_
1549     fi
1550     done
1551     # restore bindir & pname
1552     split_restore_variables
1553     # unset all saved smage variables
1554     split_unset_variables
1555    else
1556     src_install | ${SMAGE_LOG_CMD}
1557     die_pipestatus 0 "src_install failed"
1558     step_by_step $_
1559  fi  fi
1560    
1561  if [ -d ${BUILDDIR}/builded/usr/share/info ]  # compressing doc, info & man files
1562    if [[ -n ${SPLIT_PACKAGES} ]]
1563  then  then
1564   echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1565   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   do
1566     mcompressdocs ${BINDIR}_${subpackage}
1567     done
1568    else
1569     mcompressdocs ${BINDIR}
1570  fi  fi
1571    
1572    
1573  # stripping all bins and libs  # stripping all bins and libs
1574  case ${NOSTRIP} in  case ${NOSTRIP} in
1575   true|TRUE|yes|y)   true|TRUE|yes|y)
1576   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1577   ;;   ;;
1578   *)   *)
1579   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   if [[ -n ${SPLIT_PACKAGES} ]]
1580   mstripbins ${BINDIR}   then
1581   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1582   mstriplibs ${BINDIR}   do
1583     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1584     mstripbins ${BINDIR}_${subpackage}
1585     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1586     mstriplibs ${BINDIR}_${subpackage}
1587     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1588     mstripstatic ${BINDIR}_${subpackage}
1589     done
1590     else
1591     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1592     mstripbins ${BINDIR}
1593     echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1594     mstriplibs ${BINDIR}
1595     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1596     mstripstatic ${BINDIR}
1597     fi
1598   ;;   ;;
1599  esac  esac
1600    
# Line 1280  case ${NOPKGBUILD} in Line 1605  case ${NOPKGBUILD} in
1605   ;;   ;;
1606   *)   *)
1607   # build several targets   # build several targets
1608   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1609   then   then
1610   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1611   do   do
1612   # check if an special target_pkgbuild exists   # check if a special target_pkgbuild exists
1613   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1614   then   then
1615   # run it   # run it
# Line 1306  case ${NOPKGBUILD} in Line 1631  case ${NOPKGBUILD} in
1631    
1632   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}"
1633   done   done
1634    
1635     # build several subpackages
1636     elif [[ -n ${SPLIT_PACKAGES} ]]
1637     then
1638     split_save_variables
1639     for subpackage in ${SPLIT_PACKAGES}
1640     do
1641     # get the right variables for the split
1642     export PNAME="${subpackage}"
1643     split_info_${PNAME}
1644    
1645     # jump to next one if NOPKGBUILD is set in split_info
1646     case ${NOPKGBUILD} in
1647     true|TRUE|yes|y) continue ;;
1648     esac
1649    
1650     # check if an special subpackage_pkgbuild exists
1651     if typeset -f ${PNAME}_pkgbuild > /dev/null
1652     then
1653     # run it
1654     ${PNAME}_pkgbuild
1655     fi
1656     # now create the target package
1657     ${MLIBDIR}/pkgbuild_dir.sh \
1658     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1659     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1660    
1661     # build pkg-md5-sum if requested
1662     generate_package_md5sum \
1663     --pcat "${PCATEGORIE}" \
1664     --pname "${PNAME}" \
1665     --pver "${PVER}" \
1666     --pbuild "${PBUILD}" \
1667     --parch "${ARCH}"
1668    
1669     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1670    
1671     # restore smage environment
1672     split_restore_variables
1673     done
1674     # unset all saved smage variables
1675     split_unset_variables
1676    
1677   else   else
1678   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1679    

Legend:
Removed from v.891  
changed lines
  Added in v.1579