Magellan Linux

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

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

revision 1349 by niro, Sat Jun 4 09:45:04 2011 UTC revision 1582 by niro, Wed Dec 28 12:04:33 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)"
16    
 ## 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  
   
17  # export default C locale  # export default C locale
18  export LC_ALL=C  export LC_ALL=C
19    
# Line 170  get_db_md5_sum() Line 139  get_db_md5_sum()
139    
140  download_sources()  download_sources()
141  {  {
   
142   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
143    
144   local EOA=${#SRC_URI[*]}   local count=${#SRC_URI[*]}
145   local my_SRC_URI   local uri
146   local my_SRC_URI_DEST   local subdir
147   local my_SRC_URI_MIRROR   local outputdir
148   local my_SOURCEDIR   local db_md5_file="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
149   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local fetching
150   local FETCHING   local i
  local i mirror  
  local wget_opts  
   
  # filter wget command if busybox was found  
  wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"  
   
  # install SRCDIR/PNAME if not exist  
  [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}  
151    
152   # check if FETCHING is needed   # check if FETCHING is needed
153   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null )   if mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5
  if [[ $? = 0 ]]  
154   then   then
155   # md5's ok, no fetching needed   # md5's ok, no fetching needed
156   FETCHING=false   fetching=false
157   else   else
158   FETCHING=true   fetching=true
159   fi   fi
160    
161   for ((i=0; i < EOA; i++))   if [[ ${fetching} = true ]]
162   do   then
163   # url to file   for ((i=0; i < count; i++))
164   my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"   do
165     # url to file
166   # subdir in sources dir; the my_SRCI_URI file goes to there   uri="${SRC_URI[${i}]%%' '*}"
  my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"  
   
  # if my_src_uri_dest is not equal my_src_uri; than an other dir is used  
  if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]  
  then  
  my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}"  
  else  
  my_SOURCEDIR="${SOURCEDIR}/${PNAME}"  
  fi  
   
  # create the SOURCEDIR  
  install -d ${my_SOURCEDIR}  
   
  # if an mirrored file than replace first the mirror uri  
  if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]  
  then  
  for mirror in ${MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  wget \  
  ${wget_opts} \  
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]  
  then  
  for mirror in ${SOURCEFORGE_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  wget \  
  ${wget_opts} \  
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]  
  then  
  for mirror in ${GNU_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"  
   
  if [[ ${FETCHING} = true ]]  
  then  
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  wget \  
  ${wget_opts} \  
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]  
  then  
  for mirror in ${KDE_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"  
167    
168   if [[ ${FETCHING} = true ]]   # subdir in sources dir; the my_SRCI_URI file goes to there
169   then   subdir="${SRC_URI[${i}]##*' '}"
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  wget \  
  ${wget_opts} \  
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]  
  then  
  for mirror in ${GNOME_MIRRORS}  
  do  
  my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"  
170    
171   if [[ ${FETCHING} = true ]]   # if $subdir is not equal with $uri then an other dir is used
172   then   if [[ ${uri} != ${subdir} ]]
  echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"  
  wget \  
  ${wget_opts} \  
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \  
  "${my_SRC_URI_MIRROR}"  
  if [[ $? = 0 ]]  
  then  
  break  
  else  
  continue  
  fi  
  fi  
  done  
  else  
  if [[ ${FETCHING} = true ]]  
173   then   then
174   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   outputdir="${SOURCEDIR}/${PNAME}/${subdir}"
175   wget \   else
176   ${wget_opts} \   outputdir="${SOURCEDIR}/${PNAME}"
  --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \  
  "${my_SRC_URI}"  
177   fi   fi
  fi  
178    
179   # unset them to be shure   echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}"
180   unset my_SRC_URI   mdownload --uri "${uri}" --dir "${outputdir}" || die "Could not download '${uri}'"
  unset my_SRC_URI_DEST  
  unset my_SRC_URI_MIRROR  
  unset my_SOURCEDIR  
  done  
181    
182   # recheck md5 sums   # unset them to be sure
183   echo   unset uri
184   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"   unset subdir
185   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed"   unset outputdir
186   echo   done
187    
188     # recheck md5 sums after download
189     echo
190     echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
191     mchecksum --rundir "${SOURCEDIR}/${PNAME}" --file "${db_md5_file}" --method md5 || die "md5 failed"
192     echo
193     else
194     echo -e "${COLBLUE}===${COLGREEN} All sources already fetched, nothing to do${COLDEFAULT}"
195     fi
196    
197   # not needed anymore   # not needed anymore
198   unset SRC_URI   unset SRC_URI
199  }  }
200    
201  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
202  src_prepare()  src_prepare()
203  {  {
204   echo "no src_prepare defined"   echo "no src_prepare defined"
  sleep 2  
205   return 0   return 0
206  }  }
207    
208  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
209  src_compile()  src_compile()
210  {  {
211   echo "no src_compile defined"   echo "no src_compile defined"
  sleep 2  
212   return 0   return 0
213  }  }
214    
215  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
216    src_check()
217    {
218     echo "no src_check defined"
219     return 0
220    }
221    
222    # dummy function, used if that does not exist in smage file
223  src_install()  src_install()
224  {  {
225   echo "no src_install defined"   echo "no src_install defined"
  sleep 2  
226   return 0   return 0
227  }  }
228    
# Line 469  munpack() Line 319  munpack()
319   popd > /dev/null   popd > /dev/null
320   fi   fi
321   ;;   ;;
322     xz)
323     IFTAR="$(basename $SRCFILE .xz)"
324     IFTAR="${IFTAR##*.}"
325     if [[ ${IFTAR} = tar ]]
326     then
327     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tar.xz unpack failed."
328     else
329     pushd ${DEST} > /dev/null
330     xzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .xz) || die ".xz unpack failed."
331     popd > /dev/null
332     fi
333     ;;
334   tbz2|mpks|mpk)   tbz2|mpks|mpk)
335   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."
336   ;;   ;;
337   tgz)   tgz)
338   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."
339   ;;   ;;
340     txz|mpkzs|mpkz)
341     tar --no-same-owner -xvJf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".txz unpack failed."
342     ;;
343   rar)   rar)
344   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
345   ;;   ;;
# Line 528  mpatch() Line 393  mpatch()
393  mlibtoolize()  mlibtoolize()
394  {  {
395   local opts="$@"   local opts="$@"
396   [[ -z ${opts} ]] && opts="--copy --force"   [[ -z ${opts} ]] && opts="--verbose --install --force"
397    
398   libtoolize ${opts} || die "running: mlibtoolize ${opts}"   libtoolize ${opts} || die "running: mlibtoolize ${opts}"
399  }  }
# Line 544  mautoreconf() Line 409  mautoreconf()
409  minstalldocs()  minstalldocs()
410  {  {
411   local docfiles   local docfiles
412     local doc
413   docfiles="$@"   docfiles="$@"
414    
415   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
# Line 551  minstalldocs() Line 417  minstalldocs()
417   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
418   fi   fi
419    
420   local i   for doc in ${docfiles}
  for i in ${docfiles}  
421   do   do
422   if [ -f ${i} ]   if [ -f ${doc} ]
423   then   then
424   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [[ ${SMAGE_COMPRESSDOC} = true ]]
425   install -m 0644 ${SRCDIR}/${i}.gz \   then
426   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}."
427     chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "fixing permissions of ${doc}."
428     else
429     install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."
430     fi
431   fi   fi
432   done   done
433  }  }
# Line 567  mstriplibs() Line 436  mstriplibs()
436  {  {
437   local stripdir="$@"   local stripdir="$@"
438    
439   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
440   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"
441     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
442  }  }
443    
444  mstripbins()  mstripbins()
445  {  {
446   local stripdir="$@"   local stripdir="$@"
447    
448   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
449   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"
450     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
451    }
452    
453    mstripstatic()
454    {
455     local stripdir="$@"
456    
457     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
458     [[ -z ${STRIP_STATIC_LIB} ]] && STRIP_STATIC_LIB="--strip-debug"
459     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
460    }
461    
462    mstriplibtoolarchive()
463    {
464     local stripdir="$@"
465    
466     [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
467     find ${stripdir} ! -type d -name \*.la | xargs file | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null
468    }
469    
470    mpurgetargets()
471    {
472     local stripdir="$@"
473     local target
474    
475     [[ -z ${stripdir} ]] && stripdir=${BINDIR}
476     # nothing to do in this case
477     [[ -z ${PURGE_TARGETS[*]} ]] && return
478    
479     for target in ${PURGE_TARGETS[*]}
480     do
481     # check if target is a regex pattern without any slashes
482     if [[ ${target} = ${target//\/} ]]
483     then
484     find ${BINDIR} -type f -name "${target}" | xargs --no-run-if-empty rm -f -- 2> /dev/null
485     else
486     rm -f -- ${target} 2> /dev/null
487     fi
488     done
489  }  }
490    
491  mcompressdocs()  mcompressdocs()
# Line 788  build_mage_script() Line 697  build_mage_script()
697   do   do
698   echo -n " ${i}"  >> ${dest}   echo -n " ${i}"  >> ${dest}
699   done   done
700     # a CRLF is needed here!
701     echo >> ${dest}
702   fi   fi
703    
704   # deps and provides   # deps and provides
# Line 817  build_mage_script() Line 728  build_mage_script()
728    
729  regen_mage_tree()  regen_mage_tree()
730  {  {
731   local i   local subpackage
732    
733   # build them only if requested   # build them only if requested
734   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
# Line 828  regen_mage_tree() Line 739  regen_mage_tree()
739   # build for each target a mage file   # build for each target a mage file
740   # run it with several targets   # run it with several targets
741   echo   echo
742   for i in ${MAGE_TARGETS}   for subpackage in ${MAGE_TARGETS}
743   do   do
744   build_mage_script --target "${i}"   build_mage_script --target "${subpackage}"
745   done   done
746   echo   echo
747    
# Line 843  regen_mage_tree() Line 754  regen_mage_tree()
754   # build for each subpackage a mage file   # build for each subpackage a mage file
755   # run it with several targets   # run it with several targets
756   echo   echo
757   for i in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
758   do   do
759   # get the right variables for the split   # get the right variables for the split
760   export PNAME="${i}"   export PNAME="${subpackage}"
761   split_info_${i}   split_info_${subpackage}
762     # get the preinstall etc
763     split_export_inherits ${subpackage}
764   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
765     # delete split preinstall etc
766     split_delete_inherits ${subpackage}
767   # restore smage environment   # restore smage environment
768   split_restore_variables   split_restore_variables
769   done   done
# Line 906  split_save_variables() Line 821  split_save_variables()
821   export SAVED_SDEPEND="${SDEPEND}"   export SAVED_SDEPEND="${SDEPEND}"
822   export SAVED_PROVIDE="${PROVIDE}"   export SAVED_PROVIDE="${PROVIDE}"
823   export SAVED_NOPKGBUILD="${NOPKGBUILD}"   export SAVED_NOPKGBUILD="${NOPKGBUILD}"
824     export SAVED_PKGTYPE="${PKGTYPE}"
825    
826   # bindir too   # bindir too
827   export SAVED_BINDIR="${BINDIR}"   export SAVED_BINDIR="${BINDIR}"
# Line 967  split_restore_variables() Line 883  split_restore_variables()
883   export SDEPEND="${SAVED_SDEPEND}"   export SDEPEND="${SAVED_SDEPEND}"
884   export PROVIDE="${SAVED_PROVIDE}"   export PROVIDE="${SAVED_PROVIDE}"
885   export NOPKGBUILD="${SAVED_NOPKGBUILD}"   export NOPKGBUILD="${SAVED_NOPKGBUILD}"
886     export PKGTYPE="${SAVED_PKGTYPE}"
887    
888   # bindir too   # bindir too
889   export BINDIR="${SAVED_BINDIR}"   export BINDIR="${SAVED_BINDIR}"
# Line 1027  split_unset_variables() Line 944  split_unset_variables()
944   unset SAVED_PROVIDE   unset SAVED_PROVIDE
945   unset SAVED_BINDIR   unset SAVED_BINDIR
946   unset SAVED_NOPKGBUILD   unset SAVED_NOPKGBUILD
947     unset SAVED_PKGTYPE
948   unset SPLIT_PACKAGE_BASE   unset SPLIT_PACKAGE_BASE
949   unset -f SAVED_preinstall   unset -f SAVED_preinstall
950   unset -f SAVED_postinstall   unset -f SAVED_postinstall
# Line 1034  split_unset_variables() Line 952  split_unset_variables()
952   unset -f SAVED_postremove   unset -f SAVED_postremove
953  }  }
954    
955    split_export_inherits()
956    {
957     local subpackage="$1"
958     local func
959     local newfunc
960    
961     for func in preinstall postinstall preremove postremove
962     do
963     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
964     then
965     newfunc=$(typeset -f ${func}_${subpackage})
966     newfunc="${newfunc/_${subpackage} (/ (}"
967     eval "${newfunc}"
968     fi
969     done
970    }
971    
972    split_delete_inherits()
973    {
974     local subpackage="$1"
975     local func
976    
977     for func in preinstall postinstall preremove postremove
978     do
979     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
980     then
981     unset -f ${func}
982     fi
983     done
984     }
985    
986  export_inherits()  export_inherits()
987  {  {
988   local include="$1"   local include="$1"
# Line 1418  fi Line 1367  fi
1367  # fixes some issues with these functions  # fixes some issues with these functions
1368  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
1369  export -f src_compile || die "src_compile export failed"  export -f src_compile || die "src_compile export failed"
1370    export -f src_check || die "src_check export failed"
1371  export -f src_install || die "src_install export failed"  export -f src_install || die "src_install export failed"
1372    
1373  # fixes some compile issues  # fixes some compile issues
# Line 1435  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1385  export MAKEOPTS="${MAKEOPTS}" || die "MA
1385  # setup ccache  # setup ccache
1386  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
1387    
1388  # small sleep to show our settings  # clean up builddir if a previously one exist
 sleep 1  
   
 # cleans up build if a previously one exists  
1389  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1390  then  then
1391   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1392  fi  fi
1393  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1394    
1395  # cleans up srcdir if a previously unpacked one exists  # clean up srcdir if a previously unpacked one exist
1396  if [ -d ${SRCDIR} ]  if [ -d ${SRCDIR} ]
1397  then  then
1398   rm -rf ${SRCDIR}   rm -rf ${SRCDIR}
1399  fi  fi
1400    
1401  # 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
1402  if [ -d ${BINDIR} ]  if [ -d ${BINDIR} ]
1403  then  then
1404   rm -rf ${BINDIR}   rm -rf ${BINDIR}
1405  fi  fi
1406  install -d ${BINDIR} || die "couldn't create \$BINDIR."  install -d ${BINDIR} || die "couldn't create \$BINDIR."
1407    
1408  # cleans up package temp dir if a previous build exists  # clean up package temp dir if a previous build exist
1409  if [ -d ${BUILDDIR}/${PKGNAME} ]  if [ -d ${BUILDDIR}/${PKGNAME} ]
1410  then  then
1411   rm -rf ${BUILDDIR}/${PKGNAME}   rm -rf ${BUILDDIR}/${PKGNAME}
1412  fi  fi
1413    
1414  # cleans up timestamp if one exists  # setup build logging
 if [ -f /var/tmp/timestamp ]  
 then  
  mage rmstamp  
 fi  
   
 # setup build loggins  
1415  [[ ! -d /var/log/smage ]] && install -d /var/log/smage  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1416  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1417    
# Line 1482  src_compile | ${SMAGE_LOG_CMD} Line 1423  src_compile | ${SMAGE_LOG_CMD}
1423  die_pipestatus 0 "src_compile failed"  die_pipestatus 0 "src_compile failed"
1424  step_by_step $_  step_by_step $_
1425    
1426    # only run checks if requested
1427    if [[ ${MAGE_CHECK} != true ]]
1428    then
1429     echo "MAGE_CHECK not requested; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1430     step_by_step src_check
1431    else
1432     src_check | ${SMAGE_LOG_CMD}
1433     die_pipestatus 0 "src_check failed"
1434     step_by_step $_
1435    fi
1436    
1437  # build several subpackages  # build several subpackages
1438  if [[ -n ${SPLIT_PACKAGES} ]]  if [[ -n ${SPLIT_PACKAGES} ]]
1439  then  then
# Line 1530  else Line 1482  else
1482   mcompressdocs ${BINDIR}   mcompressdocs ${BINDIR}
1483  fi  fi
1484    
1485    if [[ ${SMAGE_STRIP_LIBTOOL} = true ]]
1486    then
1487     if [[ -n ${SPLIT_PACKAGES} ]]
1488     then
1489     for subpackage in ${SPLIT_PACKAGES}
1490     do
1491     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}"
1492     mstriplibtoolarchive ${BINDIR}_${subpackage}
1493     done
1494     else
1495     echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"
1496     mstriplibtoolarchive ${BINDIR}
1497     fi
1498    fi
1499    
1500    if [[ ${SMAGE_PURGE} = true ]]
1501    then
1502     if [[ -n ${SPLIT_PACKAGES} ]]
1503     then
1504     for subpackage in ${SPLIT_PACKAGES}
1505     do
1506     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}"
1507     mpurgetargets ${BINDIR}_${subpackage}
1508     done
1509     else
1510     echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"
1511     mpurgetargets ${BINDIR}
1512     fi
1513    fi
1514    
1515  # stripping all bins and libs  # stripping all bins and libs
1516  case ${NOSTRIP} in  case ${NOSTRIP} in
# Line 1543  case ${NOSTRIP} in Line 1524  case ${NOSTRIP} in
1524   do   do
1525   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1526   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1527   echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1528   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1529     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1530     mstripstatic ${BINDIR}_${subpackage}
1531   done   done
1532   else   else
1533   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1534   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1535   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1536   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1537     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1538     mstripstatic ${BINDIR}
1539   fi   fi
1540   ;;   ;;
1541  esac  esac
# Line 1566  case ${NOPKGBUILD} in Line 1551  case ${NOPKGBUILD} in
1551   then   then
1552   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1553   do   do
1554   # check if an special target_pkgbuild exists   # check if a special target_pkgbuild exists
1555   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1556   then   then
1557   # run it   # run it

Legend:
Removed from v.1349  
changed lines
  Added in v.1582