Magellan Linux

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

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

revision 403 by niro, Fri Dec 29 22:42:22 2006 UTC revision 951 by niro, Sat Nov 21 14:31:50 2009 UTC
# Line 4  Line 4 
4  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
5    
6  # SMAGE2  # SMAGE2
7  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.45 2006-12-29 22:42:22 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
11  # added distcc support  # added distcc support
12    
13    # set default user mage.rc
14    : ${MAGERC="/etc/mage.rc"}
15    
16  ## setup ##  ## setup ##
17  PKGSUFFIX="mpk"  PKGSUFFIX="mpk"
18  SRCPKGSUFFIX="mpks"  SRCPKGSUFFIX="mpks"
# Line 45  fi Line 48  fi
48  # export default C locale  # export default C locale
49  export LC_ALL=C  export LC_ALL=C
50    
51  source /etc/mage.rc  source /etc/mage.rc.global
52    source ${MAGERC}
53    
54  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
55  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 64  showversion() Line 68  showversion()
68  die()  die()
69  {  {
70   xtitleclean   xtitleclean
71     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
72   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
73   exit 1   exit 1
74  }  }
75    
76    die_pipestatus()
77    {
78     # the status change if we do any parameter declarations!!
79     # dont do this anymore, keep this in mind!
80     #
81     # local pos="$1"
82     # local comment="$2"
83     #
84     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
85     #
86     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
87    }
88    
89  xtitle()  xtitle()
90  {  {
91   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 144  download_sources() Line 162  download_sources()
162   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
163   if [[ $? = 0 ]]   if [[ $? = 0 ]]
164   then   then
165   # md5's ok, not fetching needed   # md5's ok, no fetching needed
166   FETCHING=false   FETCHING=false
167   else   else
168   FETCHING=true   FETCHING=true
# Line 166  download_sources() Line 184  download_sources()
184   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
185   fi   fi
186    
187     # create the SOURCEDIR
188     install -d ${my_SOURCEDIR}
189    
190   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
191   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
192   then   then
193   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
194   do   do
# Line 175  download_sources() Line 196  download_sources()
196    
197   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
198   then   then
199   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
200     wget \
201     --passive-ftp \
202     --tries 3 \
203     --continue \
204     --progress bar \
205     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
206     "${my_SRC_URI_MIRROR}"
207     if [[ $? = 0 ]]
208     then
209     break
210     else
211     continue
212     fi
213     fi
214     done
215     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
216     then
217     for mirror in ${SOURCEFORGE_MIRRORS}
218     do
219     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
220    
221     if [[ ${FETCHING} = true ]]
222     then
223     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
224     wget \
225     --passive-ftp \
226     --tries 3 \
227     --continue \
228     --progress bar \
229     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
230     "${my_SRC_URI_MIRROR}"
231     if [[ $? = 0 ]]
232     then
233     break
234     else
235     continue
236     fi
237     fi
238     done
239     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
240     then
241     for mirror in ${GNU_MIRRORS}
242     do
243     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
244    
245     if [[ ${FETCHING} = true ]]
246     then
247     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
248     wget \
249     --passive-ftp \
250     --tries 3 \
251     --continue \
252     --progress bar \
253     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
254     "${my_SRC_URI_MIRROR}"
255     if [[ $? = 0 ]]
256     then
257     break
258     else
259     continue
260     fi
261     fi
262     done
263     elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]
264     then
265     for mirror in ${KDE_MIRRORS}
266     do
267     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"
268    
269     if [[ ${FETCHING} = true ]]
270     then
271     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
272   wget \   wget \
273   --passive-ftp \   --passive-ftp \
274   --tries 3 \   --tries 3 \
275   --continue \   --continue \
276   --progress bar \   --progress bar \
277   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
278     "${my_SRC_URI_MIRROR}"
279     if [[ $? = 0 ]]
280     then
281     break
282     else
283     continue
284     fi
285     fi
286     done
287     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]
288     then
289     for mirror in ${GNOME_MIRRORS}
290     do
291     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"
292    
293     if [[ ${FETCHING} = true ]]
294     then
295     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
296     wget \
297     --passive-ftp \
298     --tries 3 \
299     --continue \
300     --progress bar \
301     --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
302   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
303   if [[ $? = 0 ]]   if [[ $? = 0 ]]
304   then   then
# Line 194  download_sources() Line 311  download_sources()
311   else   else
312   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
313   then   then
314   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
315   wget \   wget \
316   --passive-ftp \   --passive-ftp \
317   --tries 3 \   --tries 3 \
318   --continue \   --continue \
319   --progress bar \   --progress bar \
320   --directory-prefix="${my_SOURCEDIR}" \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
321   "${my_SRC_URI}"   "${my_SRC_URI}"
322   fi   fi
323   fi   fi
# Line 214  download_sources() Line 331  download_sources()
331    
332   # recheck md5 sums   # recheck md5 sums
333   echo   echo
334   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
335   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"
336   echo   echo
337    
# Line 261  mconfigure() Line 378  mconfigure()
378   ./configure \   ./configure \
379   --prefix=/usr \   --prefix=/usr \
380   --host=${CHOST} \   --host=${CHOST} \
381     --build=${CHOST} \
382   --mandir=/usr/share/man \   --mandir=/usr/share/man \
383   --infodir=/usr/share/info \   --infodir=/usr/share/info \
384   --datadir=/usr/share \   --datadir=/usr/share \
# Line 304  munpack() Line 422  munpack()
422    
423   SRCFILE=$1   SRCFILE=$1
424    
425   if [ -z "$2" ]   if [[ -z $2 ]]
426   then   then
427   DEST=${BUILDDIR}   DEST=${BUILDDIR}
428   else   else
429   DEST=$2   DEST=$2
430   fi   fi
431    
432     [[ ! -d ${DEST} ]] && install -d ${DEST}
433    
434   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
435   bz2)   bz2)
436   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
437   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
438   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
439   then   then
440   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."
441     else
442     pushd ${DEST} > /dev/null
443     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
444     popd > /dev/null
445   fi   fi
446   ;;   ;;
447   gz)   gz)
# Line 325  munpack() Line 449  munpack()
449   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
450   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
451   then   then
452   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."
453     else
454     pushd ${DEST} > /dev/null
455     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
456     popd > /dev/null
457   fi   fi
458   ;;   ;;
459   tbz2)   tbz2|mpks|mpk)
460   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
461   ;;   ;;
462   tgz)   tgz)
463   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
464     ;;
465     rar)
466     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
467     ;;
468     zip|xpi)
469     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
470     ;;
471     rpm)
472     pushd ${DEST} > /dev/null
473     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
474     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
475     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
476     then
477     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
478     fi
479   ;;   ;;
480   *)   *)
481   die "munpack failed"   die "munpack failed"
# Line 344  mpatch() Line 487  mpatch()
487  {  {
488   local PATCHOPTS   local PATCHOPTS
489   local PATCHFILE   local PATCHFILE
490     local i
491    
492   PATCHOPTS=$1   PATCHOPTS=$1
493   PATCHFILE=$2   PATCHFILE=$2
494    
495     if [[ -z $2 ]]
496     then
497     PATCHFILE=$1
498    
499     ## patch level auto-detection, get patch level
500     for ((i=0; i < 10; i++))
501     do
502     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
503     if [[ $? = 0 ]]
504     then
505     PATCHOPTS="-Np${i}"
506     break
507     fi
508     done
509     fi
510    
511   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
512   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
513  }  }
514    
515    mlibtoolize()
516    {
517     local opts="$@"
518     [[ -z ${opts} ]] && opts="--copy --force"
519    
520     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
521    }
522    
523  minstalldocs()  minstalldocs()
524  {  {
# Line 387  mstripbins() Line 554  mstripbins()
554   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
555  }  }
556    
557    mcompressdocs()
558    {
559     local bindir="$@"
560    
561     if [ -d ${bindir}/usr/share/man ]
562     then
563     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
564     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
565     fi
566    
567     if [ -d ${bindir}/usr/share/info ]
568     then
569     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
570     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
571     fi
572    }
573    
574  sminclude()  sminclude()
575  {  {
576   local i   local i
# Line 406  setup_distcc_environment() Line 590  setup_distcc_environment()
590  {  {
591   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
592   then   then
593   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
594   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"   export PATH=/usr/$(mlibdir)/distcc/bin:${PATH} || die "distcc: could not export new $PATH"
595    
596   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
# Line 421  setup_ccache_environment() Line 605  setup_ccache_environment()
605  {  {
606   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
607   then   then
608   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
609   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"   export PATH=/usr/$(mlibdir)/ccache/bin:${PATH} || die "ccache: could not export new $PATH"
610   fi   fi
611  }  }
# Line 445  fix_mage_deps() Line 629  fix_mage_deps()
629   # fix DEPEND   # fix DEPEND
630   while read sym dep   while read sym dep
631   do   do
632     # ignore empty lines
633     [[ -z ${dep} ]] && continue
634    
635   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
636   # change if not virtual   # change if not virtual
637   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 497  EOF Line 684  EOF
684  # special tags:  # special tags:
685  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
686  #   INHERITS              which functions get included  #   INHERITS              which functions get included
687  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
688  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
689    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
690    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
691    #                         (only in the resulting magefile}
692  #  #
693  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
694  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 509  build_mage_script() Line 699  build_mage_script()
699   local magefile   local magefile
700   local dest   local dest
701   local target   local target
702     local split_pkg_base
703   local sym   local sym
704   local depname   local depname
705    
# Line 516  build_mage_script() Line 707  build_mage_script()
707   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
708    
709   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
710   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
711    
712     # mark package as splitpackage
713     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
714    
715   # name of magefile   # name of magefile
716   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 525  build_mage_script() Line 719  build_mage_script()
719   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
720    
721   # show what we are doing   # show what we are doing
722   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
723   echo "  ${dest}"   echo "${dest}"
724    
725   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
726   # now build the mage file   # now build the mage file
727   > ${dest}   > ${dest}
728    
729   # header   # header
730   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.45 2006-12-29 22:42:22 niro Exp $' >> ${dest}   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}
731   echo  >> ${dest}   echo  >> ${dest}
732    
733   # pgkname and state   # pgkname and state
# Line 553  build_mage_script() Line 747  build_mage_script()
747   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
748   echo >> ${dest}   echo >> ${dest}
749    
750     # split package base
751     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
752     echo >> ${dest}
753    
754   # add special vars   # add special vars
755   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
756   then   then
# Line 620  regen_mage_tree() Line 818  regen_mage_tree()
818   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
819   then   then
820   # run it without targets   # run it without targets
821   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
822   then   then
823     # build for each target a mage file
824     # run it with several targets
825   echo   echo
826   build_mage_script   for i in ${MAGE_TARGETS}
827     do
828     build_mage_script --target "${i}"
829     done
830   echo   echo
  else  
831    
832   # build for each target an mage file   # run it for splitpackages
833     elif [[ -n ${SPLIT_PACKAGES} ]]
834     then
835     local split_pkg_base="${PNAME}"
836     # save smage environment
837     split_save_variables
838     # build for each subpackage a mage file
839   # run it with several targets   # run it with several targets
840   for i in ${MAGE_TARGETS}   echo
841     for i in ${SPLIT_PACKAGES}
842   do   do
843   echo   # get the right variables for the split
844   build_mage_script "${i}"   export PNAME="${i}"
845   echo   split_info_${i}
846     build_mage_script --split-pkg-base "${split_pkg_base}"
847     # restore smage environment
848     split_restore_variables
849   done   done
850     echo
851     # unset all saved smage variables
852     split_unset_variables
853    
854     else
855     echo
856     build_mage_script
857     echo
858   fi   fi
859   fi   fi
860    
861   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
862   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
863   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
864   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
865   do  # do
866   unset "${i}"  # unset "${i}"
867   done  # done
868   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
869   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
870   do  # do
871   unset "${i}"  # unset "${i}"
872   done  # done
873   unset SPECIAL_VARS   unset SPECIAL_VARS
874   unset STATE   unset STATE
875   unset DESCRIPTION   unset DESCRIPTION
# Line 665  regen_mage_tree() Line 885  regen_mage_tree()
885   unset postremove   unset postremove
886  }  }
887    
888    split_save_variables()
889    {
890     export SAVED_PNAME="${PNAME}"
891     export SAVED_PVER="${PVER}"
892     export SAVED_PBUILD="${PBUILD}"
893     export SAVED_PCATEGORIE="${PCATEGORIE}"
894     export SAVED_DESCRIPTION="${DESCRIPTION}"
895     export SAVED_HOMEPAGE="${HOMEPAGE}"
896     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
897     export SAVED_STATE="${STATE}"
898     export SAVED_PKGTYPE="${PKGTYPE}"
899     export SAVED_INHERITS="${INHERITS}"
900     export SAVED_DEPEND="${DEPEND}"
901     export SAVED_SDEPEND="${SDEPEND}"
902     export SAVED_PROVIDE="${PROVIDE}"
903     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
904    
905     # bindir too
906     export SAVED_BINDIR="${BINDIR}"
907    
908     # export the SPLIT_PACKAGE_BASE
909     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
910    
911     # functions
912     if [[ ! -z $(typeset -f preinstall) ]]
913     then
914     # rename the old one
915     local saved_preinstall
916     saved_preinstall=SAVED_$(typeset -f preinstall)
917     eval "${saved_preinstall}"
918     export -f SAVED_preinstall
919     fi
920    
921     if [[ ! -z $(typeset -f postinstall) ]]
922     then
923     # rename the old one
924     local saved_postinstall
925     saved_postinstall=SAVED_$(typeset -f postinstall)
926     eval "${saved_postinstall}"
927     export -f SAVED_postinstall
928     fi
929    
930     if [[ ! -z $(typeset -f preremove) ]]
931     then
932     # rename the old one
933     local saved_preremove
934     saved_preremove=SAVED_$(typeset -f preremove)
935     eval "${saved_preremove}"
936     export -f SAVED_preremove
937     fi
938    
939     if [[ ! -z $(typeset -f postremove) ]]
940     then
941     # rename the old one
942     local saved_postremove
943     saved_postremove=SAVED_$(typeset -f postremove)
944     eval "${saved_postremove}"
945     export -f SAVED_postremove
946     fi
947    }
948    
949    split_restore_variables()
950    {
951     export PNAME="${SAVED_PNAME}"
952     export PVER="${SAVED_PVER}"
953     export PBUILD="${SAVED_PBUILD}"
954     export PCATEGORIE="${SAVED_PCATEGORIE}"
955     export DESCRIPTION="${SAVED_DESCRIPTION}"
956     export HOMEPAGE="${SAVED_HOMEPAGE}"
957     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
958     export STATE="${SAVED_STATE}"
959     export PKGTYPE="${SAVED_PKGTYPE}"
960     export INHERITS="${SAVED_INHERITS}"
961     export DEPEND="${SAVED_DEPEND}"
962     export SDEPEND="${SAVED_SDEPEND}"
963     export PROVIDE="${SAVED_PROVIDE}"
964     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
965    
966     # bindir too
967     export BINDIR="${SAVED_BINDIR}"
968    
969     # functions
970     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
971     then
972     # rename the old one
973     local saved_preinstall
974     saved_preinstall=$(typeset -f SAVED_preinstall)
975     eval "${saved_preinstall/SAVED_/}"
976     export -f preinstall
977     fi
978    
979     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
980     then
981     # rename the old one
982     local saved_postinstall
983     saved_postinstall=$(typeset -f SAVED_postinstall)
984     eval "${saved_postinstall/SAVED_/}"
985     export -f postinstall
986     fi
987    
988     if [[ ! -z $(typeset -f SAVED_preremove) ]]
989     then
990     # rename the old one
991     local saved_preremove
992     saved_preremove=$(typeset -f SAVED_preremove)
993     eval "${saved_preremove/SAVED_/}"
994     export -f preremove
995     fi
996    
997     if [[ ! -z $(typeset -f SAVED_postremove) ]]
998     then
999     # rename the old one
1000     local saved_postremove
1001     saved_postremove=$(typeset -f SAVED_postremove)
1002     eval "${saved_postremove/SAVED_/}"
1003     export -f postremove
1004     fi
1005    }
1006    
1007    split_unset_variables()
1008    {
1009     # unset saved vars; not needed anymore
1010     unset SAVED_PNAME
1011     unset SAVED_PVER
1012     unset SAVED_PBUILD
1013     unset SAVED_PCATEGORIE
1014     unset SAVED_DESCRIPTION
1015     unset SAVED_HOMEPAGE
1016     unset SAVED_SPECIAL_VARS
1017     unset SAVED_STATE
1018     unset SAVED_PKGTYPE
1019     unset SAVED_INHERITS
1020     unset SAVED_DEPEND
1021     unset SAVED_SDEPEND
1022     unset SAVED_PROVIDE
1023     unset SAVED_BINDIR
1024     unset SAVED_NOPKGBUILD
1025     unset SPLIT_PACKAGE_BASE
1026     unset -f SAVED_preinstall
1027     unset -f SAVED_postinstall
1028     unset -f SAVED_preremove
1029     unset -f SAVED_postremove
1030    }
1031    
1032  export_inherits()  export_inherits()
1033  {  {
1034   local include="$1"   local include="$1"
# Line 726  generate_package_md5sum() Line 1090  generate_package_md5sum()
1090   # fix target as it may be empty !   # fix target as it may be empty !
1091   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1092    
1093    
1094   # build pkgname   # build pkgname
1095   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1096    
1097   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1098   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
1099   then   then
1100   echo -n "Generating a md5sum for ${pkgname}.${PKGSUFFIX} ... "   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1101    
1102   # abort if not exist   # abort if not exist
1103   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
1104   then   then
1105   echo "! exists"   echo -e "${COLRED}! exists${COLDEFAULT}"
1106   return 0   return 0
1107   fi   fi
1108    
# Line 745  generate_package_md5sum() Line 1110  generate_package_md5sum()
1110   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1111    
1112   # setup md5 dir   # setup md5 dir
1113   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1114   install -d ${dest}   install -d ${dest}
1115    
1116   # gen md5sum   # gen md5sum
1117   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
1118   > ${dest}/${pkgname}.md5   > ${dest}/${pkgname}.md5
1119   echo "done"   echo -e "${COLGREEN}done${COLDEFAULT}"
1120   fi   fi
1121  }  }
1122    
# Line 769  source_pkg_build() Line 1134  source_pkg_build()
1134   return 0   return 0
1135   fi   fi
1136    
1137     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
1138    
1139   echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"   echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
1140    
1141     # include the smage2 file
1142     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
1143    
1144   ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )   ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
1145   [[ ! -d ${PKGDIR}/sources ]] && install -d ${PKGDIR}/sources   [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
1146   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PKGDIR}/sources/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}   mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
1147    
1148   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1149  }  }
1150    
1151    step_by_step()
1152    {
1153     if [[ ${STEP_BY_STEP} = true ]]
1154     then
1155     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1156     echo "Press [enter] to continue"
1157     read
1158     fi
1159    }
1160    
1161    
1162  # print out our version  # print out our version
1163  showversion  showversion
# Line 897  then Line 1278  then
1278    
1279   regen_mage_tree   regen_mage_tree
1280    
1281   # build md5sum for existing packages   # build several targets
1282   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1283   --pcat "${PCATEGORIE}" \   then
1284   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1285   --pver "${PVER}" \   do
1286   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1287   --parch "${ARCH}" \   generate_package_md5sum \
1288   --target "${target}"   --pcat "${PCATEGORIE}" \
1289     --pname "${PNAME}" \
1290     --pver "${PVER}" \
1291     --pbuild "${PBUILD}" \
1292     --parch "${ARCH}" \
1293     --target "${target}"
1294     done
1295    
1296     # build several subpackages
1297     elif [[ -n ${SPLIT_PACKAGES} ]]
1298     then
1299     split_save_variables
1300     for subpackage in ${SPLIT_PACKAGE}
1301     do
1302     # get the right variables for the split
1303     export PNAME="${subpackage}"
1304     split_info_${subpackage}
1305     # build md5sum for existing packages
1306     generate_package_md5sum \
1307     --pcat "${PCATEGORIE}" \
1308     --pname "${PNAME}" \
1309     --pver "${PVER}" \
1310     --pbuild "${PBUILD}" \
1311     --parch "${ARCH}"
1312     # restore smage environment
1313     split_restore_variables
1314     done
1315     # unset all saved smage variables
1316     split_unset_variables
1317    
1318     else
1319     # build md5sum for existing packages
1320     generate_package_md5sum \
1321     --pcat "${PCATEGORIE}" \
1322     --pname "${PNAME}" \
1323     --pver "${PVER}" \
1324     --pbuild "${PBUILD}" \
1325     --parch "${ARCH}"
1326     fi
1327    
1328   exit 0   exit 0
1329  fi  fi
1330    
1331  if [ "$1" == "only-src-pkg" -a -n "$2" ]  if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1332  then  then
1333   # set correct SMAGENAME   # set correct SMAGENAME
1334   SMAGENAME="$2"   SMAGENAME="$2"
1335   MD5DIR="$(dirname ${SMAGENAME})/md5"   MD5DIR="$(dirname ${SMAGENAME})/md5"
1336    
1337   echo -e "${COLGREEN}only-src-pkg called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
1338    
1339   source ${SMAGENAME} || die "regen: smage2 not found"   source ${SMAGENAME} || die "regen: smage2 not found"
1340    
# Line 930  then Line 1349  then
1349   exit 0   exit 0
1350  fi  fi
1351    
1352  if [ "$1" == "--src-tarball" -a -n "$2" -a -n "$3" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1353  then  then
1354   # set correct SMAGENAME   SRCPKGTARBALL="${2}"
  SMAGENAME="$3"  
  SRCPKGTARBALL="$2"  
1355   USE_SRC_PKG_TARBALL=true   USE_SRC_PKG_TARBALL=true
1356    
1357     # abort if given file is not a source pkg
1358     [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
1359    
1360     # set correct SMAGENAME; use the one that the src_pkg provide
1361     # /path/to/SOURCEDIR/PNAME/SMAGENAME
1362     SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
1363    
1364   echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1365    
1366   [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}   [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
# Line 945  then Line 1369  then
1369   [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."   [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1370    
1371   tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"   tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1372    
1373     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1374  fi  fi
1375    
1376    
1377  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1378  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1379   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1380  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1381  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1382  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1383  [ -z "${BINDIR}" ] && die "no BINDIR variable found in /etc/mage.rc"  [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1384  [ -z "${CHOST}" ] && die "no CHOST variable found in /etc/mage.rc"  [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1385  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in /etc/mage.rc"  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1386  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in /etc/mage.rc"  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1387    
1388  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1389  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1390  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1391    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1392    
1393  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1394  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1395    
1396  # auto regen mage tree if requested  # auto regen mage tree if requested
1397  regen_mage_tree  regen_mage_tree
# Line 973  if [[ ${CREATE_SRC_PKG_TARBALL} = true ] Line 1400  if [[ ${CREATE_SRC_PKG_TARBALL} = true ]
1400  then  then
1401   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1402   then   then
1403   echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1404   rm -rf ${SOURCEDIR}/${PKGNAME}   rm -rf ${SOURCEDIR}/${PNAME}
1405   fi   fi
1406  fi  fi
1407    
# Line 1036  then Line 1463  then
1463   mage rmstamp   mage rmstamp
1464  fi  fi
1465    
1466  src_prepare || die "src_prepare failed"  # setup build loggins
1467  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1468  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1469    
1470    src_prepare | ${SMAGE_LOG_CMD}
1471    die_pipestatus 0 "src_prepare failed"
1472    step_by_step $_
1473    
1474    src_compile | ${SMAGE_LOG_CMD}
1475    die_pipestatus 0 "src_compile failed"
1476    step_by_step $_
1477    
1478  # compressing doc, info & man files  # build several subpackages
1479  echo -e "Compressing man-pages ..."  if [[ -n ${SPLIT_PACKAGES} ]]
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1480  then  then
1481   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   # save bindir & pname
1482     split_save_variables
1483     export SAVED_BINDIR="${BINDIR}"
1484     for subpackage in ${SPLIT_PACKAGES}
1485     do
1486     if typeset -f src_install_${subpackage} > /dev/null
1487     then
1488     # export subpackage bindir
1489     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1490     # export PNAME, several internal function and include
1491     # rely on this variable
1492     export PNAME="${subpackage}"
1493    
1494     echo
1495     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1496     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1497     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1498     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1499    
1500     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1501     die_pipestatus 0 "src_install_${subpackage} failed"
1502     step_by_step $_
1503     fi
1504     done
1505     # restore bindir & pname
1506     split_restore_variables
1507     # unset all saved smage variables
1508     split_unset_variables
1509    else
1510     src_install | ${SMAGE_LOG_CMD}
1511     die_pipestatus 0 "src_install failed"
1512     step_by_step $_
1513  fi  fi
1514    
1515  echo -e "Compressing info-pages ..."  # compressing doc, info & man files
1516  if [ -d ${BUILDDIR}/builded/usr/share/info ]  if [[ -n ${SPLIT_PACKAGES} ]]
1517  then  then
1518   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   for subpackage in ${SPLIT_PACKAGE}
1519     do
1520     mcompressdocs ${BINDIR}_${subpackage}
1521     done
1522    else
1523     mcompressdocs ${BINDIR}
1524  fi  fi
1525    
1526    
1527  # stripping all bins and libs  # stripping all bins and libs
1528  case ${NOSTRIP} in  case ${NOSTRIP} in
1529   true|TRUE|yes|y)   true|TRUE|yes|y)
1530   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1531   ;;   ;;
1532   *)   *)
1533   echo -e "Stripping binaries ..."   if [[ -n ${SPLIT_PACKAGES} ]]
1534   mstripbins ${BINDIR}   then
1535   echo -e "Stripping libraries ..."   for subpackage in ${SPLIT_PACKAGE}
1536   mstriplibs ${BINDIR}   do
1537     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1538     mstripbins ${BINDIR}_${subpackage}
1539     echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1540     mstriplibs ${BINDIR}_${subpackage}
1541     done
1542     else
1543     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1544     mstripbins ${BINDIR}
1545     echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1546     mstriplibs ${BINDIR}
1547     fi
1548   ;;   ;;
1549  esac  esac
1550    
# Line 1074  case ${NOPKGBUILD} in Line 1555  case ${NOPKGBUILD} in
1555   ;;   ;;
1556   *)   *)
1557   # build several targets   # build several targets
1558   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1559   then   then
1560   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1561   do   do
# Line 1098  case ${NOPKGBUILD} in Line 1579  case ${NOPKGBUILD} in
1579   --parch "${ARCH}" \   --parch "${ARCH}" \
1580   --target "${target}"   --target "${target}"
1581    
1582   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1583     done
1584    
1585     # build several subpackages
1586     elif [[ -n ${SPLIT_PACKAGES} ]]
1587     then
1588     split_save_variables
1589     for subpackage in ${SPLIT_PACKAGES}
1590     do
1591     # get the right variables for the split
1592     export PNAME="${subpackage}"
1593     split_info_${PNAME}
1594    
1595     # jump to next one if NOPKGBUILD is set in split_info
1596     case ${NOPKGBUILD} in
1597     true|TRUE|yes|y) continue ;;
1598     esac
1599    
1600     # check if an special subpackage_pkgbuild exists
1601     if typeset -f ${PNAME}_pkgbuild > /dev/null
1602     then
1603     # run it
1604     ${PNAME}_pkgbuild
1605     fi
1606     # now create the target package
1607     ${MLIBDIR}/pkgbuild_dir.sh \
1608     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1609     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1610    
1611     # build pkg-md5-sum if requested
1612     generate_package_md5sum \
1613     --pcat "${PCATEGORIE}" \
1614     --pname "${PNAME}" \
1615     --pver "${PVER}" \
1616     --pbuild "${PBUILD}" \
1617     --parch "${ARCH}"
1618    
1619     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1620    
1621     # restore smage environment
1622     split_restore_variables
1623   done   done
1624     # unset all saved smage variables
1625     split_unset_variables
1626    
1627   else   else
1628   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1629    
# Line 1111  case ${NOPKGBUILD} in Line 1635  case ${NOPKGBUILD} in
1635   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1636   --parch "${ARCH}"   --parch "${ARCH}"
1637    
1638   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1639   fi   fi
1640    
1641   # build src-pkg-tarball if requested   # build src-pkg-tarball if requested
# Line 1119  case ${NOPKGBUILD} in Line 1643  case ${NOPKGBUILD} in
1643   ;;   ;;
1644  esac  esac
1645    
1646    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1647    then
1648     bzip2 -9f /var/log/smage/${PKGNAME}.log
1649    else
1650     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1651    fi
1652    
1653  # for sure  # for sure
1654  unset NOPKGBUILD  unset NOPKGBUILD
1655  unset NOSTRIP  unset NOSTRIP

Legend:
Removed from v.403  
changed lines
  Added in v.951