Magellan Linux

Diff of /branches/mage-next/src/smage2.sh

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

revision 427 by niro, Fri Feb 23 14:42:17 2007 UTC revision 447 by niro, Tue Mar 20 01:15:31 2007 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.52 2007-02-23 14:42:17 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.55 2007-03-20 01:15:31 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
# Line 48  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.global
52  source ${MAGERC}  source ${MAGERC}
53    
54  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
# Line 148  download_sources() Line 149  download_sources()
149   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
150   if [[ $? = 0 ]]   if [[ $? = 0 ]]
151   then   then
152   # md5's ok, not fetching needed   # md5's ok, no fetching needed
153   FETCHING=false   FETCHING=false
154   else   else
155   FETCHING=true   FETCHING=true
# Line 171  download_sources() Line 172  download_sources()
172   fi   fi
173    
174   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
175   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
176   then   then
177   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
178   do   do
# Line 179  download_sources() Line 180  download_sources()
180    
181   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
182   then   then
183   echo "==> fetching ${my_SRC_URI_MIRROR}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
184     wget \
185     --passive-ftp \
186     --tries 3 \
187     --continue \
188     --progress bar \
189     --directory-prefix="${my_SOURCEDIR}" \
190     "${my_SRC_URI_MIRROR}"
191     if [[ $? = 0 ]]
192     then
193     break
194     else
195     continue
196     fi
197     fi
198     done
199     elif [[ -n $(echo ${my_SRC_URI} | grep 'sourceforge://') ]]
200     then
201     for mirror in ${SOURCEFORGE_MIRRORS}
202     do
203     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|sourceforge:/|${mirror}|g")"
204    
205     if [[ ${FETCHING} = true ]]
206     then
207     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
208     wget \
209     --passive-ftp \
210     --tries 3 \
211     --continue \
212     --progress bar \
213     --directory-prefix="${my_SOURCEDIR}" \
214     "${my_SRC_URI_MIRROR}"
215     if [[ $? = 0 ]]
216     then
217     break
218     else
219     continue
220     fi
221     fi
222     done
223     elif [[ -n $(echo ${my_SRC_URI} | grep 'gnu://') ]]
224     then
225     for mirror in ${GNU_MIRRORS}
226     do
227     my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|gnu:/|${mirror}|g")"
228    
229     if [[ ${FETCHING} = true ]]
230     then
231     echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
232   wget \   wget \
233   --passive-ftp \   --passive-ftp \
234   --tries 3 \   --tries 3 \
# Line 198  download_sources() Line 247  download_sources()
247   else   else
248   if [[ ${FETCHING} = true ]]   if [[ ${FETCHING} = true ]]
249   then   then
250   echo "==> fetching ${my_SRC_URI}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
251   wget \   wget \
252   --passive-ftp \   --passive-ftp \
253   --tries 3 \   --tries 3 \
# Line 218  download_sources() Line 267  download_sources()
267    
268   # recheck md5 sums   # recheck md5 sums
269   echo   echo
270   echo ">== Checking MD5 sums:"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
271   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"
272   echo   echo
273    
# Line 350  mpatch() Line 399  mpatch()
399  {  {
400   local PATCHOPTS   local PATCHOPTS
401   local PATCHFILE   local PATCHFILE
402     local i
403    
404   PATCHOPTS=$1   PATCHOPTS=$1
405   PATCHFILE=$2   PATCHFILE=$2
406    
407     if [[ -z $2 ]]
408     then
409     PATCHFILE=$1
410    
411     ## patch level auto-detection, get patch level
412     for ((i=0; i < 10; i++))
413     do
414     patch --dry-run -Np${i} -i ${SOURCEDIR}/${PNAME}/${PATCHFILE} > /dev/null
415     if [[ $? = 0 ]]
416     then
417     PATCHOPTS="-Np${i}"
418     break
419     fi
420     done
421     fi
422    
423   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"   echo -e "${COLBLUE}*** ${COLGREEN}Applying patch '${PATCHFILE}'${COLDEFAULT}"
424   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}   patch "${PATCHOPTS}" -i ${SOURCEDIR}/${PNAME}/${PATCHFILE}
425  }  }
# Line 412  setup_distcc_environment() Line 478  setup_distcc_environment()
478  {  {
479   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
480   then   then
481   echo "Using DistCC for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using DistCC for compilation ...${COLDEFAULT}"
482   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"
483    
484   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"   export DISTCC_DIR="${DISTCC_DIR}" || die "distcc_dir export failed"
# Line 427  setup_ccache_environment() Line 493  setup_ccache_environment()
493  {  {
494   if [ -x /usr/bin/ccache ]   if [ -x /usr/bin/ccache ]
495   then   then
496   echo "Using CCache for compilation ..."   echo -e "${COLBLUE}---${COLGREEN} Using CCache for compilation ...${COLDEFAULT}"
497   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"
498   fi   fi
499  }  }
# Line 534  build_mage_script() Line 600  build_mage_script()
600   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"   dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
601    
602   # show what we are doing   # show what we are doing
603   echo "Generating Mage file:"   echo -e "${COLBLUE}===${COLGREEN} generating mage file:${COLDEFAULT}"
604   echo "  ${dest}"   echo "${dest}"
605    
606   install -d "$(dirname ${dest})"   install -d "$(dirname ${dest})"
607   # now build the mage file   # now build the mage file
608   > ${dest}   > ${dest}
609    
610   # header   # header
611   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.52 2007-02-23 14:42:17 niro Exp $' >> ${dest}   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.55 2007-03-20 01:15:31 niro Exp $' >> ${dest}
612   echo  >> ${dest}   echo  >> ${dest}
613    
614   # pgkname and state   # pgkname and state
# Line 741  generate_package_md5sum() Line 807  generate_package_md5sum()
807   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
808   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
809   then   then
810   echo -n "Generating a md5sum for ${pkgname}.${PKGSUFFIX} ... "   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
811    
812   # abort if not exist   # abort if not exist
813   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]   if [ ! -f ${PKGDIR}/${pkgname}.${PKGSUFFIX} ]
814   then   then
815   echo "! exists"   echo -e "${COLRED}! exists${COLDEFAULT}"
816   return 0   return 0
817   fi   fi
818    
# Line 760  generate_package_md5sum() Line 826  generate_package_md5sum()
826   # gen md5sum   # gen md5sum
827   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \   ( cd ${PKGDIR}; md5sum "${pkgname}.${PKGSUFFIX}" ) \
828   > ${dest}/${pkgname}.md5   > ${dest}/${pkgname}.md5
829   echo "done"   echo -e "${COLGREEN}done${COLDEFAULT}"
830   fi   fi
831  }  }
832    
# Line 986  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUI Line 1052  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUI
1052  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1053    
1054  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1055  echo "Compiling ${PKGNAME}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
1056    
1057  # auto regen mage tree if requested  # auto regen mage tree if requested
1058  regen_mage_tree  regen_mage_tree
# Line 995  if [[ ${CREATE_SRC_PKG_TARBALL} = true ] Line 1061  if [[ ${CREATE_SRC_PKG_TARBALL} = true ]
1061  then  then
1062   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1063   then   then
1064   echo -e "${COLGREEN}Deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} deleting old sourcefiles ${COLBLUE}${SOURCEDIR}/${PNAME}${COLGREEN} ...${COLDEFAULT}"
1065   rm -rf ${SOURCEDIR}/${PNAME}   rm -rf ${SOURCEDIR}/${PNAME}
1066   fi   fi
1067  fi  fi
# Line 1064  src_install || die "src_install failed" Line 1130  src_install || die "src_install failed"
1130    
1131    
1132  # compressing doc, info & man files  # compressing doc, info & man files
 echo -e "Compressing man-pages ..."  
1133  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [ -d ${BUILDDIR}/builded/usr/share/man ]
1134  then  then
1135     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
1136   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man
1137  fi  fi
1138    
 echo -e "Compressing info-pages ..."  
1139  if [ -d ${BUILDDIR}/builded/usr/share/info ]  if [ -d ${BUILDDIR}/builded/usr/share/info ]
1140  then  then
1141     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
1142   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
1143  fi  fi
1144    
# Line 1082  case ${NOSTRIP} in Line 1148  case ${NOSTRIP} in
1148   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1149   ;;   ;;
1150   *)   *)
1151   echo -e "Stripping binaries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1152   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1153   echo -e "Stripping libraries ..."   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1154   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1155   ;;   ;;
1156  esac  esac
# Line 1120  case ${NOPKGBUILD} in Line 1186  case ${NOPKGBUILD} in
1186   --parch "${ARCH}" \   --parch "${ARCH}" \
1187   --target "${target}"   --target "${target}"
1188    
1189   echo -e "\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1190   done   done
1191   else   else
1192   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
# Line 1133  case ${NOPKGBUILD} in Line 1199  case ${NOPKGBUILD} in
1199   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1200   --parch "${ARCH}"   --parch "${ARCH}"
1201    
1202   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1203   fi   fi
1204    
1205   # build src-pkg-tarball if requested   # build src-pkg-tarball if requested

Legend:
Removed from v.427  
changed lines
  Added in v.447