Magellan Linux

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

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

revision 63 by niro, Wed Feb 16 01:00:39 2005 UTC revision 169 by niro, Sun Jul 31 11:57:05 2005 UTC
# Line 4  Line 4 
4  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
5    
6  # SMAGE2  # SMAGE2
7  # version: 0.3.6-r14  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.16 2005-07-31 11:57:05 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  ## setup ##  ## setup ##
14  SMAGEVERSION=0.3.6-r14  SMAGEVERSION=0.3.6-r19
15  PKGSUFFIX="mpk"  PKGSUFFIX="mpk"
16  SMAGENAME="$1"  SMAGENAME="$1"
17  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
# Line 20  SMAGESUFFIX="smage2" Line 20  SMAGESUFFIX="smage2"
20  #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"  #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"
21  MLIBDIR=/usr/lib/mage  MLIBDIR=/usr/lib/mage
22    
23    # export default C locale
24    export LC_ALL=C
25    
26  source /etc/mage.rc  source /etc/mage.rc
27    
28  showversion() {  showversion() {
# Line 103  download_sources() { Line 106  download_sources() {
106   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
107    
108   local EOA=${#SRC_URI[*]}   local EOA=${#SRC_URI[*]}
109   local MY_SRC_URI   local my_SRC_URI
110     local my_SRC_URI_DEST
111     local my_SRC_URI_MIRROR
112     local my_SOURCEDIR
113   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
114   local FETCHING   local FETCHING
115   local i mirror   local i mirror
# Line 113  download_sources() { Line 119  download_sources() {
119   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
120    
121   # check if FETCHING is needed   # check if FETCHING is needed
122   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} > /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
123   if [[ $? == 0 ]]   if [[ $? == 0 ]]
124   then   then
125   # md5's ok, not fetching needed   # md5's ok, not fetching needed
# Line 124  download_sources() { Line 130  download_sources() {
130    
131   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
132   do   do
133   # get MD5 sum from database   # url to file
134     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
135    
136     # subdir in sources dir; the my_SRCI_URI file goes to there
137     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
138    
139     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
140     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
141     then
142     my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}"
143     else
144     my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
145     fi
146    
   
147   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
148   if [ -n "$(echo ${SRC_URI[${i}]} | grep 'mirror://')" ]   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]
149   then   then
150   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
151   do   do
152   MY_SRC_URI="$(echo ${SRC_URI[${i}]} | sed "s|mirror:/|${mirror}/sources|g")"   my_SRC_URI_MIRROR="$(echo ${my_SRC_URI} | sed "s|mirror:/|${mirror}/sources|g")"
153    
154   #echo "DEBUG: ${MY_SRC_URI}"   #echo "DEBUG: ${MY_SRC_URI}"
155   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
156   then   then
157   echo "==> fetching ${MY_SRC_URI}"   echo "==> fetching ${my_SRC_URI_MIRROR}"
158   wget \   wget \
159   --passive-ftp \   --passive-ftp \
160   --tries 3 \   --tries 3 \
161   --continue \   --continue \
162   --progress bar \   --progress bar \
163   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
164   "${MY_SRC_URI}"   "${my_SRC_URI_MIRROR}"
165   if [ "$?" == "0" ]   if [ "$?" == "0" ]
166   then   then
167   break   break
# Line 157  download_sources() { Line 174  download_sources() {
174   #echo "DEBUG: ${SRC_URI[${i}]}"   #echo "DEBUG: ${SRC_URI[${i}]}"
175   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
176   then   then
177   echo "==> fetching ${SRC_URI[${i}]}"   echo "==> fetching ${my_SRC_URI}"
178   wget \   wget \
179   --passive-ftp \   --passive-ftp \
180   --tries 3 \   --tries 3 \
181   --continue \   --continue \
182   --progress bar \   --progress bar \
183   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
184   "${MY_SRC_URI}"   "${my_SRC_URI}"
185   if [ "$?" == "0" ]  # only needed to run through a list of mirrors
186   then  # if [ "$?" == "0" ]
187   break  # then
188   else  # break
189   continue  # else
190   fi  # continue
191    # fi
192   fi   fi
193   fi   fi
194    
195     # unset them to be shure
196     unset my_SRC_URI
197     unset my_SRC_URI_DEST
198     unset my_SRC_URI_MIRROR
199     unset my_SOURCEDIR
200   done   done
201    
202   # recheck md5 sums   # recheck md5 sums
# Line 320  minstalldocs() { Line 343  minstalldocs() {
343   done   done
344  }  }
345    
346    mstriplibs() {
347     local stripdir="$@"
348    
349     [ -z "${stripdir}" ] && stripdir=${BINDIR}
350     find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
351    }
352    
353    mstripbins() {
354     local stripdir="$@"
355    
356     [ -z "${stripdir}" ] && stripdir=${BINDIR}
357     find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
358    }
359    
360  setup_distcc_environment(){  setup_distcc_environment(){
361   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
362   then   then
# Line 387  if [ "$1" == "calcmd5" ] Line 424  if [ "$1" == "calcmd5" ]
424  then  then
425   if [ $# -ge 3 ]   if [ $# -ge 3 ]
426   then   then
  # overridable sourcedir  
  CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"  
   
427   SMAGENAME="$2"   SMAGENAME="$2"
428   MD5DIR="$3"   MD5DIR="$3"
429   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
430    
431     # overridable sourcedir; must be declared after source of the smage2
432     CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
433    
434   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."
435    
436   # end of array   # end of array
# Line 407  then Line 444  then
444    
445   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
446   do   do
447   MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"   # url to file
448     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
449    
450     # subdir in sources dir; the my_SRCI_URI file goes to there
451     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
452    
453     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
454     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
455     then
456     MY_SRC_FILE="${my_SRC_URI_DEST}/$(basename ${SRC_URI[${i}]})"
457     else
458     MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"
459     fi
460    
461   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]
462   then   then
463   echo "calculating $(basename ${MY_SRC_FILE}) ..."   echo "calculating $(basename ${MY_SRC_FILE}) ..."
# Line 415  then Line 465  then
465   else   else
466   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."
467   fi   fi
468    
469     # unset them to be shure
470     unset my_SRC_URI
471     unset my_SRC_URI_DEST
472     unset my_SRC_URI_MIRROR
473     unset my_SOURCEDIR
474   done   done
475    
476   echo   echo
# Line 599  then Line 655  then
655   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
656  fi  fi
657    
658    # stripping all bins and libs
659    case ${NOSTRIP} in
660     true|TRUE|yes|y)
661     echo -e "NOSTRIP=true detected; Package will not be stripped ..."
662     ;;
663     *)
664     echo -e "Stripping binaries ..."
665     mstripbins ${BINDIR}
666     echo -e "Stripping libraries ..."
667     mstriplibs ${BINDIR}
668     ;;
669    esac
670    
671  #the new buildpkg command  #the new buildpkg command
672  case ${NOPKGBUILD} in  case ${NOPKGBUILD} in
673   true|TRUE|yes|y)   true|TRUE|yes|y)
# Line 612  esac Line 681  esac
681    
682  #for sure  #for sure
683  unset NOPKGBUILD  unset NOPKGBUILD
684    unset NOSTRIP
685    
686  xtitleclean  xtitleclean
687  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"

Legend:
Removed from v.63  
changed lines
  Added in v.169