Magellan Linux

Diff of /branches/mage-next/src/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 85 by niro, Wed Jun 1 16:10:19 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.11 2005-06-01 16:10:19 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-r16
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" ]   if [ "$?" == "0" ]
183   then   then
184   break   break
# Line 173  download_sources() { Line 187  download_sources() {
187   fi   fi
188   fi   fi
189   fi   fi
190    
191     # unset them to be shure
192     unset my_SRC_URI
193     unset my_SRC_URI_DEST
194     unset my_SRC_URI_MIRROR
195     unset my_SOURCEDIR
196   done   done
197    
198   # recheck md5 sums   # recheck md5 sums
# Line 320  minstalldocs() { Line 339  minstalldocs() {
339   done   done
340  }  }
341    
342    mstriplibs() {
343     local stripdir="$@"
344    
345     [ -z "${stripdir}" ] && stripdir=${BINDIR}
346     find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
347    }
348    
349    mstripbins() {
350     local stripdir="$@"
351    
352     [ -z "${stripdir}" ] && stripdir=${BINDIR}
353     find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
354    }
355    
356  setup_distcc_environment(){  setup_distcc_environment(){
357   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
358   then   then
# Line 387  if [ "$1" == "calcmd5" ] Line 420  if [ "$1" == "calcmd5" ]
420  then  then
421   if [ $# -ge 3 ]   if [ $# -ge 3 ]
422   then   then
  # overridable sourcedir  
  CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"  
   
423   SMAGENAME="$2"   SMAGENAME="$2"
424   MD5DIR="$3"   MD5DIR="$3"
425   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
426    
427     # overridable sourcedir; must be declared after source of the smage2
428     CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
429    
430   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."
431    
432   # end of array   # end of array
# Line 407  then Line 440  then
440    
441   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
442   do   do
443   MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"   # url to file
444     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
445    
446     # subdir in sources dir; the my_SRCI_URI file goes to there
447     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
448    
449     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
450     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
451     then
452     MY_SRC_FILE="${my_SRC_URI_DEST}/$(basename ${SRC_URI[${i}]})"
453     else
454     MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"
455     fi
456    
457   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]
458   then   then
459   echo "calculating $(basename ${MY_SRC_FILE}) ..."   echo "calculating $(basename ${MY_SRC_FILE}) ..."
# Line 415  then Line 461  then
461   else   else
462   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."
463   fi   fi
464    
465     # unset them to be shure
466     unset my_SRC_URI
467     unset my_SRC_URI_DEST
468     unset my_SRC_URI_MIRROR
469     unset my_SOURCEDIR
470   done   done
471    
472   echo   echo
# Line 599  then Line 651  then
651   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
652  fi  fi
653    
654    # stripping all bins and libs
655    case ${NOSTRIP} in
656     true|TRUE|yes|y)
657     echo -e "NOSTRIP=true detected; Package will not be stripped ..."
658     ;;
659     *)
660     echo -e "Stripping binaries ..."
661     mstripbins ${BINDIR}
662     echo -e "Stripping libraries ..."
663     mstriplibs ${BINDIR}
664     ;;
665    esac
666    
667  #the new buildpkg command  #the new buildpkg command
668  case ${NOPKGBUILD} in  case ${NOPKGBUILD} in
669   true|TRUE|yes|y)   true|TRUE|yes|y)
# Line 612  esac Line 677  esac
677    
678  #for sure  #for sure
679  unset NOPKGBUILD  unset NOPKGBUILD
680    unset NOSTRIP
681    
682  xtitleclean  xtitleclean
683  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"

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