Magellan Linux

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

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

revision 459 by niro, Tue Apr 10 09:22:22 2007 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.56 2007-04-10 09:22: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
# Line 20  SMAGENAME="$1" Line 20  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 187  download_sources() Line 189  download_sources()
189   --continue \   --continue \
190   --progress bar \   --progress bar \
191   --directory-prefix="${my_SOURCEDIR}" \   --directory-prefix="${my_SOURCEDIR}" \
192     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
193   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
194   if [[ $? = 0 ]]   if [[ $? = 0 ]]
195   then   then
# Line 211  download_sources() Line 214  download_sources()
214   --continue \   --continue \
215   --progress bar \   --progress bar \
216   --directory-prefix="${my_SOURCEDIR}" \   --directory-prefix="${my_SOURCEDIR}" \
217     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
218   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
219   if [[ $? = 0 ]]   if [[ $? = 0 ]]
220   then   then
# Line 235  download_sources() Line 239  download_sources()
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}"   "${my_SRC_URI_MIRROR}"
244   if [[ $? = 0 ]]   if [[ $? = 0 ]]
245   then   then
# Line 259  download_sources() Line 264  download_sources()
264   --continue \   --continue \
265   --progress bar \   --progress bar \
266   --directory-prefix="${my_SOURCEDIR}" \   --directory-prefix="${my_SOURCEDIR}" \
267     --output-document="$(basename ${my_SRC_URI_MIRROR})" \
268   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
269   if [[ $? = 0 ]]   if [[ $? = 0 ]]
270   then   then
# Line 283  download_sources() Line 289  download_sources()
289   --continue \   --continue \
290   --progress bar \   --progress bar \
291   --directory-prefix="${my_SOURCEDIR}" \   --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 302  download_sources() Line 309  download_sources()
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 362  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 405  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
# Line 420  munpack() Line 429  munpack()
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 428  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 472  mpatch() Line 504  mpatch()
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 620  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 656  build_mage_script() Line 695  build_mage_script()
695   > ${dest}   > ${dest}
696    
697   # header   # header
698   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.56 2007-04-10 09:22: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}
699   echo  >> ${dest}   echo  >> ${dest}
700    
701   # pgkname and state   # pgkname and state
# Line 764  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 906  source_pkg_build() Line 945  source_pkg_build()
945   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}"
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
# Line 1172  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
# Line 1255  case ${NOPKGBUILD} in Line 1311  case ${NOPKGBUILD} in
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.459  
changed lines
  Added in v.881