Magellan Linux

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

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

revision 384 by niro, Mon Jul 17 20:44:44 2006 UTC revision 881 by niro, Mon Jun 29 18:56:32 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.43 2006-07-17 20:44:44 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"
19  SMAGENAME="$1"  SMAGENAME="$1"
20  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
21  MLIBDIR=/usr/lib/mage  MLIBDIR=/usr/lib/mage
22  SMAGEVERSION="$( < ${MLIBDIR}/version)"  SMAGEVERSION="$( < ${MLIBDIR}/version)"
23    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
24    
25    
26  ## only for tests -> normally in /etc/rc.d/init.d/functions  ## only for tests -> normally in /etc/rc.d/init.d/functions
27  COLRED="\033[1;6m\033[31m"  COLRED="\033[1;6m\033[31m"
# Line 44  fi Line 50  fi
50  # export default C locale  # export default C locale
51  export LC_ALL=C  export LC_ALL=C
52    
53  source /etc/mage.rc  source /etc/mage.rc.global
54    source ${MAGERC}
55    
56  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
57  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 63  showversion() Line 70  showversion()
70  die()  die()
71  {  {
72   xtitleclean   xtitleclean
73     echo -e ${COLRED}"Exited ${BASH_SOURCE} at line no ${BASH_LINENO}."${COLDEFAULT}
74   echo "SMAGE failed: $@"   echo "SMAGE failed: $@"
75   exit 1   exit 1
76  }  }
# Line 91  syncsmage2() Line 99  syncsmage2()
99   local i   local i
100   for i in ${SMAGE2RSYNC}   for i in ${SMAGE2RSYNC}
101   do   do
102   rsync \   rsync ${RSYNC_FETCH_OPTIONS} ${i} ${SMAGESCRIPTSDIR}
  --recursive \  
  --links \  
  --perms \  
  --times \  
  --devices \  
  --timeout=600 \  
  --verbose \  
  --compress \  
  --progress \  
  --stats \  
  --delete \  
  --delete-after \  
  ${i} ${SMAGESCRIPTSDIR}  
   
103   if [[ $? = 0 ]]   if [[ $? = 0 ]]
104   then   then
105   break   break
106   else   else
107   continue   continue
108   fi   fi
   
109   done   done
110    
111   # clean up backup files (foo~)   # clean up backup files (foo~)
# Line 158  download_sources() Line 151  download_sources()
151   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
152   if [[ $? = 0 ]]   if [[ $? = 0 ]]
153   then   then
154   # md5's ok, not fetching needed   # md5's ok, no fetching needed
155   FETCHING=false   FETCHING=false
156   else   else
157   FETCHING=true   FETCHING=true
# Line 181  download_sources() Line 174  download_sources()
174   fi   fi
175    
176   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
177   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
178   then   then
179   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
180   do   do
# Line 189  download_sources() Line 182  download_sources()
182    
183   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
184   then   then
185   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
186     wget \
187     --passive-ftp \
188     --tries 3 \
189     --continue \
190     --progress bar \
191     --directory-prefix="${my_SOURCEDIR}" \
192     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
193     "${my_SRC_URI_MIRROR}"
194     if [[ $? = 0 ]]
195     then
196     break
197     else
198     continue
199     fi
200     fi
201     done
202     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
203     then
204     for mirror in ${SOURCEFORGE_MIRRORS}
205     do
206     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
207    
208     if [[ ${FETCHING} = true ]]
209     then
210     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
211     wget \
212     --passive-ftp \
213     --tries 3 \
214     --continue \
215     --progress bar \
216     --directory-prefix="${my_SOURCEDIR}" \
217     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
218     "${my_SRC_URI_MIRROR}"
219     if [[ $? = 0 ]]
220     then
221     break
222     else
223     continue
224     fi
225     fi
226     done
227     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
228     then
229     for mirror in ${GNU_MIRRORS}
230     do
231     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
232    
233     if [[ ${FETCHING} = true ]]
234     then
235     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
236   wget \   wget \
237   --passive-ftp \   --passive-ftp \
238   --tries 3 \   --tries 3 \
239   --continue \   --continue \
240   --progress bar \   --progress bar \
241   --directory-prefix="${my_SOURCEDIR}" \   --directory-prefix="${my_SOURCEDIR}" \
242     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
243     "${my_SRC_URI_MIRROR}"
244     if [[ $? = 0 ]]
245     then
246     break
247     else
248     continue
249     fi
250     fi
251     done
252     elif [[ -n $(echo ${my_SRC_URI} | grep 'kde://') ]]
253     then
254     for mirror in ${KDE_MIRRORS}
255     do
256     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|kde:/|${mirror}|g")"
257    
258     if [[ ${FETCHING} = true ]]
259     then
260     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
261     wget \
262     --passive-ftp \
263     --tries 3 \
264     --continue \
265     --progress bar \
266     --directory-prefix="${my_SOURCEDIR}" \
267     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
268     "${my_SRC_URI_MIRROR}"
269     if [[ $? = 0 ]]
270     then
271     break
272     else
273     continue
274     fi
275     fi
276     done
277     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnome://') ]]
278     then
279     for mirror in ${GNOME_MIRRORS}
280     do
281     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnome:/|${mirror}|g")"
282    
283     if [[ ${FETCHING} = true ]]
284     then
285     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
286     wget \
287     --passive-ftp \
288     --tries 3 \
289     --continue \
290     --progress bar \
291     --directory-prefix="${my_SOURCEDIR}" \
292     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
293   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
294   if [[ $? = 0 ]]   if [[ $? = 0 ]]
295   then   then
# Line 208  download_sources() Line 302  download_sources()
302   else   else
303   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
304   then   then
305   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
306   wget \   wget \
307   --passive-ftp \   --passive-ftp \
308   --tries 3 \   --tries 3 \
309   --continue \   --continue \
310   --progress bar \   --progress bar \
311   --directory-prefix="${my_SOURCEDIR}" \   --directory-prefix="${my_SOURCEDIR}" \
312     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
313   "${my_SRC_URI}"   "${my_SRC_URI}"
314   fi   fi
315   fi   fi
# Line 228  download_sources() Line 323  download_sources()
323    
324   # recheck md5 sums   # recheck md5 sums
325   echo   echo
326   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
327   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"
328   echo   echo
329    
# Line 275  mconfigure() Line 370  mconfigure()
370   ./configure \   ./configure \
371   --prefix=/usr \   --prefix=/usr \
372   --host=${CHOST} \   --host=${CHOST} \
373     --build=${CHOST} \
374   --mandir=/usr/share/man \   --mandir=/usr/share/man \
375   --infodir=/usr/share/info \   --infodir=/usr/share/info \
376   --datadir=/usr/share \   --datadir=/usr/share \
# Line 318  munpack() Line 414  munpack()
414    
415   SRCFILE=$1   SRCFILE=$1
416    
417   if [ -z "$2" ]   if [[ -z $2 ]]
418   then   then
419   DEST=${BUILDDIR}   DEST=${BUILDDIR}
420   else   else
421   DEST=$2   DEST=$2
422   fi   fi
423    
424     [[ ! -d ${DEST} ]] && install -d ${DEST}
425    
426   case "${SRCFILE##*.}" in   case "${SRCFILE##*.}" in
427   bz2)   bz2)
428   IFTAR="$(basename $SRCFILE .bz2)"   IFTAR="$(basename $SRCFILE .bz2)"
429   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
430   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
431   then   then
432   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."
433     else
434     pushd ${DEST} > /dev/null
435     bzcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .bz2) || die ".bz2 unpack failed."
436     popd > /dev/null
437   fi   fi
438   ;;   ;;
439   gz)   gz)
# Line 339  munpack() Line 441  munpack()
441   IFTAR="${IFTAR##*.}"   IFTAR="${IFTAR##*.}"
442   if [[ ${IFTAR} = tar ]]   if [[ ${IFTAR} = tar ]]
443   then   then
444   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."
445     else
446     pushd ${DEST} > /dev/null
447     zcat ${SOURCEDIR}/${PNAME}/${SRCFILE} > ${DEST}/$(basename ${SRCFILE} .gz) || die ".gz unpack failed."
448     popd > /dev/null
449   fi   fi
450   ;;   ;;
451   tbz2)   tbz2|mpks|mpk)
452   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvjf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tbz2 unpack failed."
453   ;;   ;;
454   tgz)   tgz)
455   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST}   tar --no-same-owner -xvzf ${SOURCEDIR}/${PNAME}/${SRCFILE} -C ${DEST} || die ".tgz unpack failed."
456     ;;
457     rar)
458     unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
459     ;;
460     zip|xpi)
461     unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
462     ;;
463     rpm)
464     pushd ${DEST} > /dev/null
465     rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
466     tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
467     if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
468     then
469     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
470     fi
471   ;;   ;;
472   *)   *)
473   die "munpack failed"   die "munpack failed"
# Line 358  mpatch() Line 479  mpatch()
479  {  {
480   local PATCHOPTS   local PATCHOPTS
481   local PATCHFILE   local PATCHFILE
482     local i
483    
484   PATCHOPTS=$1   PATCHOPTS=$1
485   PATCHFILE=$2   PATCHFILE=$2
486    
487     if [[ -z $2 ]]
488     then
489     PATCHFILE=$1
490    
491     ## patch level auto-detection, get patch level
492     for ((i=0; i < 10; i++))
493     do
494     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
495     if [[ $? = 0 ]]
496     then
497     PATCHOPTS="-Np${i}"
498     break
499     fi
500     done
501     fi
502    
503   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
504   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
505  }  }
506    
507    mlibtoolize()
508    {
509     local opts="$@"
510     [[ -z ${opts} ]] && opts="--copy --force"
511    
512     libtoolize ${opts} || die "running: mlibtoolize ${opts}"
513    }
514    
515  minstalldocs()  minstalldocs()
516  {  {
# Line 420  setup_distcc_environment() Line 565  setup_distcc_environment()
565  {  {
566   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
567   then   then
568   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
569   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"
570    
571   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
# Line 435  setup_ccache_environment() Line 580  setup_ccache_environment()
580  {  {
581   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
582   then   then
583   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
584   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"
585   fi   fi
586  }  }
# Line 459  fix_mage_deps() Line 604  fix_mage_deps()
604   # fix DEPEND   # fix DEPEND
605   while read sym dep   while read sym dep
606   do   do
607     # ignore empty lines
608     [[ -z ${dep} ]] && continue
609    
610   cat="$(dirname ${dep})"   cat="$(dirname ${dep})"
611   # change if not virtual   # change if not virtual
612   if [[ ${cat} = virtual ]]   if [[ ${cat} = virtual ]]
# Line 511  EOF Line 659  EOF
659  # special tags:  # special tags:
660  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
661  #   INHERITS              which functions get included  #   INHERITS              which functions get included
662  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
663  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
664  #  #
665  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
# Line 539  build_mage_script() Line 687  build_mage_script()
687   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
688    
689   # show what we are doing   # show what we are doing
690   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
691   echo "  ${dest}"   echo "${dest}"
692    
693   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
694   # now build the mage file   # now build the mage file
695   > ${dest}   > ${dest}
696    
697   # header   # header
698   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.43 2006-07-17 20:44:44 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}
699   echo  >> ${dest}   echo  >> ${dest}
700    
701   # pgkname and state   # pgkname and state
# Line 655  regen_mage_tree() Line 803  regen_mage_tree()
803   # now unset all uneeded vars to be safe   # now unset all uneeded vars to be safe
804   # unset PKGNAME <-- don't do that; smage needs this var   # unset PKGNAME <-- don't do that; smage needs this var
805   # unset to be safe (quotes needed !)   # unset to be safe (quotes needed !)
806   for i in ${SPECIAL_FUNCTIONS}  # for i in ${SPECIAL_FUNCTIONS}
807   do  # do
808   unset "${i}"  # unset "${i}"
809   done  # done
810   unset SPECIAL_FUNCTIONS   unset SPECIAL_FUNCTIONS
811   for i in ${SPECIAL_VARS}  # for i in ${SPECIAL_VARS}
812   do  # do
813   unset "${i}"  # unset "${i}"
814   done  # done
815   unset SPECIAL_VARS   unset SPECIAL_VARS
816   unset STATE   unset STATE
817   unset DESCRIPTION   unset DESCRIPTION
# Line 746  generate_package_md5sum() Line 894  generate_package_md5sum()
894   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
895   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
896   then   then
897   echo -n "Generating a md5sum for ${pkgname}.${PKGSUFFIX} ... "   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
898    
899   # abort if not exist   # abort if not exist
900   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
901   then   then
902   echo "! exists"   echo -e "${COLRED}! exists${COLDEFAULT}"
903   return 0   return 0
904   fi   fi
905    
# Line 765  generate_package_md5sum() Line 913  generate_package_md5sum()
913   # gen md5sum   # gen md5sum
914   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
915   > ${dest}/${pkgname}.md5   > ${dest}/${pkgname}.md5
916   echo "done"   echo -e "${COLGREEN}done${COLDEFAULT}"
917     fi
918    }
919    
920    source_pkg_build()
921    {
922     if [[ ${PKGTYPE} = virtual ]]
923     then
924     echo "Virtual package detected; src-pkg-tarball not necessary ..."
925     return 0
926   fi   fi
927    
928     if [[ ! -d ${SOURCEDIR}/${PNAME} ]]
929     then
930     echo "No SRC_URI defined; src-pkg-tarball not necessary ..."
931     return 0
932     fi
933    
934     [ -z "${SRCPKGDIR}" ] && die "\$SRCPKGDIR not found. Please setup your ${MAGERC} correctly."
935    
936     echo -e "${COLGREEN}Creating source package tarball ... ${COLDEFAULT}"
937    
938     # include the smage2 file
939     cp ${SMAGENAME} ${SOURCEDIR}/${PNAME}
940    
941     ( cd ${SOURCEDIR}; tar cvjf ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${PNAME}; )
942     [[ ! -d ${SRCPKGDIR} ]] && install -d ${SRCPKGDIR}
943     mv ${BUILDDIR}/${PNAME}-${PVER}-${PBUILD}.tar.bz2 ${SRCPKGDIR}/${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX}
944    
945     echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
946  }  }
947    
948    step_by_step()
949    {
950     if [[ ${STEP_BY_STEP} = true ]]
951     then
952     echo "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
953     echo "Press [enter] to continue"
954     read
955     fi
956    }
957    
958    
959  # print out our version  # print out our version
960  showversion  showversion
961  echo  echo
# Line 900  then Line 1087  then
1087   exit 0   exit 0
1088  fi  fi
1089    
1090    if [ "$1" == "--create-src-tarball" -a -n "$2" ]
1091    then
1092     # set correct SMAGENAME
1093     SMAGENAME="$2"
1094     MD5DIR="$(dirname ${SMAGENAME})/md5"
1095    
1096     echo -e "${COLGREEN}create-src-tarball called for ${COLBLUE}${SMAGENAME}${COLGREEN} ...${COLDEFAULT}"
1097    
1098     source ${SMAGENAME} || die "regen: smage2 not found"
1099    
1100     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1101     then
1102     echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1103     rm -rf ${SOURCEDIR}/${PKGNAME}
1104     fi
1105    
1106     download_sources
1107     source_pkg_build ${SMAGENAME}
1108     exit 0
1109    fi
1110    
1111    if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1112    then
1113     SRCPKGTARBALL="${2}"
1114     USE_SRC_PKG_TARBALL=true
1115    
1116     # abort if given file is not a source pkg
1117     [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
1118    
1119     # set correct SMAGENAME; use the one that the src_pkg provide
1120     # /path/to/SOURCEDIR/PNAME/SMAGENAME
1121     SMAGENAME="${SOURCEDIR}/$(basename ${SRCPKGTARBALL%-*-*})/$(basename ${SRCPKGTARBALL} .${SRCPKGSUFFIX}).${SMAGESUFFIX}"
1122    
1123     echo -e "${COLGREEN}Using src-tarball ${COLBLUE}${SRCPKGTARBALL}${COLGREEN} ...${COLDEFAULT}"
1124    
1125     [[ ! -d ${SOURCEDIR} ]] && install -d ${SOURCEDIR}
1126    
1127     # unpack srctarball
1128     [[ ! -f ${SRCPKGTARBALL} ]] && die "Error: ${SRCPKGTARBALL} does not exist. Aborting."
1129    
1130     tar xvjf ${SRCPKGTARBALL} -C ${SOURCEDIR} || die  "Error unpackung src-tarball ${SRCPKGTARBALL}"
1131    
1132     [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1133    fi
1134    
1135    
1136  [ ! -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."
1137  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
1138   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."   die "File '$(basename ${SMAGENAME})' is not a sMage v${SMAGEVERSION} file. Aborting."
1139  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your mage.rc correctly."  [ -z "${SOURCEDIR}" ] && die "\$SOURCEDIR not found. Please setup your ${MAGERC} correctly."
1140  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your mage.rc correctly."  [ -z "${SMAGESCRIPTSDIR}" ] && die "\$SMAGESCRIPTSDIR not found. Please setup your ${MAGERC} correctly."
1141  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your mage.rc correctly."  [ -z "${SMAGE2RSYNC}" ] && die "\$SMAGE2RSYNC not found. Please setup your ${MAGERC} correctly."
1142  [ -z "${BINDIR}" ] && die "no BINDIR variable found in /etc/mage.rc"  [ -z "${BINDIR}" ] && die "no BINDIR variable found in ${MAGERC}"
1143  [ -z "${CHOST}" ] && die "no CHOST variable found in /etc/mage.rc"  [ -z "${CHOST}" ] && die "no CHOST variable found in ${MAGERC}"
1144  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in /etc/mage.rc"  [ -z "${CFLAGS}" ] && die "no CFLAGS variable found in ${MAGERC}"
1145  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in /etc/mage.rc"  [ -z "${CXXFLAGS}" ] && die "no CXXFLAGS variable found in ${MAGERC}"
1146    
1147  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1148  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1149  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1150    
1151  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1152  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1153    
1154  # auto regen mage tree if requested  # auto regen mage tree if requested
1155  regen_mage_tree  regen_mage_tree
1156    
1157    if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]
1158    then
1159     if [[ -d ${SOURCEDIR}/${PNAME} ]]
1160     then
1161     echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1162     rm -rf ${SOURCEDIR}/${PNAME}
1163     fi
1164    fi
1165    
1166  # download sources  # download sources
1167  download_sources  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources
1168    
1169  # fixes some issues with these functions  # fixes some issues with these functions
1170  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
# Line 979  then Line 1221  then
1221   mage rmstamp   mage rmstamp
1222  fi  fi
1223    
1224  src_prepare || die "src_prepare failed"  # setup build loggins
1225  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1226  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1227    
1228    src_prepare || die "src_prepare failed" | ${SMAGE_LOG_CMD}
1229    step_by_step $_
1230    src_compile || die "src_compile failed" | ${SMAGE_LOG_CMD}
1231    step_by_step $_
1232    src_install || die "src_install failed" | ${SMAGE_LOG_CMD}
1233    step_by_step $_
1234    
1235    
1236  # compressing doc, info & man files  # compressing doc, info & man files
 echo -e "Compressing man-pages ..."  
1237  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [ -d ${BUILDDIR}/builded/usr/share/man ]
1238  then  then
1239     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
1240   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man
1241  fi  fi
1242    
 echo -e "Compressing info-pages ..."  
1243  if [ -d ${BUILDDIR}/builded/usr/share/info ]  if [ -d ${BUILDDIR}/builded/usr/share/info ]
1244  then  then
1245     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
1246   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
1247  fi  fi
1248    
# Line 1003  case ${NOSTRIP} in Line 1252  case ${NOSTRIP} in
1252   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1253   ;;   ;;
1254   *)   *)
1255   echo -e "Stripping binaries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1256   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1257   echo -e "Stripping libraries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1258   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1259   ;;   ;;
1260  esac  esac
# Line 1041  case ${NOPKGBUILD} in Line 1290  case ${NOPKGBUILD} in
1290   --parch "${ARCH}" \   --parch "${ARCH}" \
1291   --target "${target}"   --target "${target}"
1292    
1293   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1294   done   done
1295   else   else
1296   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
# Line 1054  case ${NOPKGBUILD} in Line 1303  case ${NOPKGBUILD} in
1303   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1304   --parch "${ARCH}"   --parch "${ARCH}"
1305    
1306   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1307   fi   fi
1308    
1309     # build src-pkg-tarball if requested
1310     [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}
1311   ;;   ;;
1312  esac  esac
1313    
1314    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1315    then
1316     bzip2 -9f /var/log/smage/${PKGNAME}.log
1317    else
1318     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1319    fi
1320    
1321  # for sure  # for sure
1322  unset NOPKGBUILD  unset NOPKGBUILD
1323  unset NOSTRIP  unset NOSTRIP

Legend:
Removed from v.384  
changed lines
  Added in v.881