Magellan Linux

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

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

revision 63 by niro, Wed Feb 16 01:00:39 2005 UTC revision 167 by niro, Fri Jul 29 14:28:43 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.15 2005-07-29 14:28:39 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 103  download_sources() { Line 103  download_sources() {
103   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
104    
105   local EOA=${#SRC_URI[*]}   local EOA=${#SRC_URI[*]}
106   local MY_SRC_URI   local my_SRC_URI
107     local my_SRC_URI_DEST
108     local my_SRC_URI_MIRROR
109     local my_SOURCEDIR
110   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
111   local FETCHING   local FETCHING
112   local i mirror   local i mirror
# Line 113  download_sources() { Line 116  download_sources() {
116   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
117    
118   # check if FETCHING is needed   # check if FETCHING is needed
119   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} > /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
120   if [[ $? == 0 ]]   if [[ $? == 0 ]]
121   then   then
122   # md5's ok, not fetching needed   # md5's ok, not fetching needed
# Line 124  download_sources() { Line 127  download_sources() {
127    
128   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
129   do   do
130   # get MD5 sum from database   # url to file
131     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
132    
133     # subdir in sources dir; the my_SRCI_URI file goes to there
134     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
135    
136     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
137     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
138     then
139     my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}"
140     else
141     my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
142     fi
143    
   
144   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
145   if [ -n "$(echo ${SRC_URI[${i}]} | grep 'mirror://')" ]   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]
146   then   then
147   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
148   do   do
149   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")"
150    
151   #echo "DEBUG: ${MY_SRC_URI}"   #echo "DEBUG: ${MY_SRC_URI}"
152   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
153   then   then
154   echo "==> fetching ${MY_SRC_URI}"   echo "==> fetching ${my_SRC_URI_MIRROR}"
155   wget \   wget \
156   --passive-ftp \   --passive-ftp \
157   --tries 3 \   --tries 3 \
158   --continue \   --continue \
159   --progress bar \   --progress bar \
160   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
161   "${MY_SRC_URI}"   "${my_SRC_URI_MIRROR}"
162   if [ "$?" == "0" ]   if [ "$?" == "0" ]
163   then   then
164   break   break
# Line 157  download_sources() { Line 171  download_sources() {
171   #echo "DEBUG: ${SRC_URI[${i}]}"   #echo "DEBUG: ${SRC_URI[${i}]}"
172   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
173   then   then
174   echo "==> fetching ${SRC_URI[${i}]}"   echo "==> fetching ${my_SRC_URI}"
175   wget \   wget \
176   --passive-ftp \   --passive-ftp \
177   --tries 3 \   --tries 3 \
178   --continue \   --continue \
179   --progress bar \   --progress bar \
180   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
181   "${MY_SRC_URI}"   "${my_SRC_URI}"
182   if [ "$?" == "0" ]  # only needed to run through a list of mirrors
183   then  # if [ "$?" == "0" ]
184   break  # then
185   else  # break
186   continue  # else
187   fi  # continue
188    # fi
189   fi   fi
190   fi   fi
191    
192     # unset them to be shure
193     unset my_SRC_URI
194     unset my_SRC_URI_DEST
195     unset my_SRC_URI_MIRROR
196     unset my_SOURCEDIR
197   done   done
198    
199   # recheck md5 sums   # recheck md5 sums
# Line 320  minstalldocs() { Line 340  minstalldocs() {
340   done   done
341  }  }
342    
343    mstriplibs() {
344     local stripdir="$@"
345    
346     [ -z "${stripdir}" ] && stripdir=${BINDIR}
347     find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
348    }
349    
350    mstripbins() {
351     local stripdir="$@"
352    
353     [ -z "${stripdir}" ] && stripdir=${BINDIR}
354     find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
355    }
356    
357  setup_distcc_environment(){  setup_distcc_environment(){
358   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
359   then   then
# Line 387  if [ "$1" == "calcmd5" ] Line 421  if [ "$1" == "calcmd5" ]
421  then  then
422   if [ $# -ge 3 ]   if [ $# -ge 3 ]
423   then   then
  # overridable sourcedir  
  CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"  
   
424   SMAGENAME="$2"   SMAGENAME="$2"
425   MD5DIR="$3"   MD5DIR="$3"
426   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
427    
428     # overridable sourcedir; must be declared after source of the smage2
429     CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
430    
431   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."
432    
433   # end of array   # end of array
# Line 407  then Line 441  then
441    
442   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
443   do   do
444   MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"   # url to file
445     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
446    
447     # subdir in sources dir; the my_SRCI_URI file goes to there
448     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
449    
450     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
451     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
452     then
453     MY_SRC_FILE="${my_SRC_URI_DEST}/$(basename ${SRC_URI[${i}]})"
454     else
455     MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"
456     fi
457    
458   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]
459   then   then
460   echo "calculating $(basename ${MY_SRC_FILE}) ..."   echo "calculating $(basename ${MY_SRC_FILE}) ..."
# Line 415  then Line 462  then
462   else   else
463   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."
464   fi   fi
465    
466     # unset them to be shure
467     unset my_SRC_URI
468     unset my_SRC_URI_DEST
469     unset my_SRC_URI_MIRROR
470     unset my_SOURCEDIR
471   done   done
472    
473   echo   echo
# Line 599  then Line 652  then
652   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
653  fi  fi
654    
655    # stripping all bins and libs
656    case ${NOSTRIP} in
657     true|TRUE|yes|y)
658     echo -e "NOSTRIP=true detected; Package will not be stripped ..."
659     ;;
660     *)
661     echo -e "Stripping binaries ..."
662     mstripbins ${BINDIR}
663     echo -e "Stripping libraries ..."
664     mstriplibs ${BINDIR}
665     ;;
666    esac
667    
668  #the new buildpkg command  #the new buildpkg command
669  case ${NOPKGBUILD} in  case ${NOPKGBUILD} in
670   true|TRUE|yes|y)   true|TRUE|yes|y)
# Line 612  esac Line 678  esac
678    
679  #for sure  #for sure
680  unset NOPKGBUILD  unset NOPKGBUILD
681    unset NOSTRIP
682    
683  xtitleclean  xtitleclean
684  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"

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