Magellan Linux

Diff of /branches/mage-0_3_7-r6/mage/usr/lib/mage/smage2.sh

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

trunk/mage/usr/lib/mage/smage2.sh revision 59 by niro, Tue Feb 15 22:58:43 2005 UTC branches/mage-0_3_7-r6/mage/usr/lib/mage/smage2.sh revision 398 by niro, Mon Nov 20 12:48:17 2006 UTC
# Line 4  Line 4 
4  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
5    
6  # SMAGE2  # SMAGE2
7  # version: 0.3.6-r13  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.36.2.1 2006-11-20 12:48:17 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 ##
 SMAGEVERSION=0.3.6-r13  
14  PKGSUFFIX="mpk"  PKGSUFFIX="mpk"
15  SMAGENAME="$1"  SMAGENAME="$1"
16  SMAGESUFFIX="smage2"  SMAGESUFFIX="smage2"
# Line 19  SMAGESUFFIX="smage2" Line 18  SMAGESUFFIX="smage2"
18  #SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts"  #SMAGESCRIPTSDIR="/bootstrap/smage2-install-scripts"
19  #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"  #SMAGE2RSYNC="rsync://192.168.0.2/smage2-scripts"
20  MLIBDIR=/usr/lib/mage  MLIBDIR=/usr/lib/mage
21    SMAGEVERSION="$( < ${MLIBDIR}/version)"
22    
23    # export default C locale
24    export LC_ALL=C
25    
26  source /etc/mage.rc  source /etc/mage.rc
27    source ${MLIBDIR}/mage3.functions.sh
28    
29  showversion() {  showversion() {
30   echo -en "Magellan Source Install v${SMAGEVERSION} "   echo -en "Magellan Source Install v${SMAGEVERSION} "
# Line 100  get_db_md5_sum() { Line 104  get_db_md5_sum() {
104    
105  download_sources() {  download_sources() {
106    
107   [ -z "${SRC_URI}" ] && echo "Nothing declared to download." && return 0   [ -z "${SRC_URI}" ] && echo -e "\nNothing declared to download.\n" && return 0
108    
109   local EOA=${#SRC_URI[*]}   local EOA=${#SRC_URI[*]}
110   local MY_SRC_URI   local my_SRC_URI
111     local my_SRC_URI_DEST
112     local my_SRC_URI_MIRROR
113     local my_SOURCEDIR
114   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
115   local FETCHING   local FETCHING
116   local i mirror   local i mirror
# Line 113  download_sources() { Line 120  download_sources() {
120   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
121    
122   # check if FETCHING is needed   # check if FETCHING is needed
123   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} > /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )
124   if [[ $? == 0 ]]   if [[ $? == 0 ]]
125   then   then
126   # md5's ok, not fetching needed   # md5's ok, not fetching needed
# Line 124  download_sources() { Line 131  download_sources() {
131    
132   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
133   do   do
134   # get MD5 sum from database   # url to file
135     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
136    
137     # subdir in sources dir; the my_SRCI_URI file goes to there
138     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
139    
140     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
141     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
142     then
143     my_SOURCEDIR="${SOURCEDIR}/${PNAME}/${my_SRC_URI_DEST}"
144     else
145     my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
146     fi
147    
   
148   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
149   if [ -n "$(echo ${SRC_URI[${i}]} | grep 'mirror://')" ]   if [ -n "$(echo ${my_SRC_URI} | grep 'mirror://')" ]
150   then   then
151   for mirror in ${MIRRORS}   for mirror in ${MIRRORS}
152   do   do
153   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")"
154    
155   #echo "DEBUG: ${MY_SRC_URI}"   #echo "DEBUG: ${MY_SRC_URI}"
156   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
157   then   then
158   echo "==> fetching ${MY_SRC_URI}"   echo "==> fetching ${my_SRC_URI_MIRROR}"
159   wget \   wget \
160   --passive-ftp \   --passive-ftp \
161   --tries 3 \   --tries 3 \
162   --continue \   --continue \
163   --progress bar \   --progress bar \
164   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
165   "${MY_SRC_URI}"   "${my_SRC_URI_MIRROR}"
166   if [ "$?" == "0" ]   if [ "$?" == "0" ]
167   then   then
168   break   break
# Line 157  download_sources() { Line 175  download_sources() {
175   #echo "DEBUG: ${SRC_URI[${i}]}"   #echo "DEBUG: ${SRC_URI[${i}]}"
176   if [[ ${FETCHING} == true ]]   if [[ ${FETCHING} == true ]]
177   then   then
178   echo "==> fetching ${SRC_URI[${i}]}"   echo "==> fetching ${my_SRC_URI}"
179   wget \   wget \
180   --passive-ftp \   --passive-ftp \
181   --tries 3 \   --tries 3 \
182   --continue \   --continue \
183   --progress bar \   --progress bar \
184   --directory-prefix="${SOURCEDIR}/${PNAME}" \   --directory-prefix="${my_SOURCEDIR}" \
185   "${MY_SRC_URI}"   "${my_SRC_URI}"
186   if [ "$?" == "0" ]  # only needed to run through a list of mirrors
187   then  # if [ "$?" == "0" ]
188   break  # then
189   else  # break
190   continue  # else
191   fi  # continue
192    # fi
193   fi   fi
194   fi   fi
195    
196     # unset them to be shure
197     unset my_SRC_URI
198     unset my_SRC_URI_DEST
199     unset my_SRC_URI_MIRROR
200     unset my_SOURCEDIR
201   done   done
202    
203   # recheck md5 sums   # recheck md5 sums
204   echo   echo
205   echo ">== Checking MD5 sums:"   echo ">== Checking MD5 sums:"
206   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} || die "md5 failed")   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"
207   echo   echo
208    
209   # not needed anymore   # not needed anymore
# Line 207  src_install() { Line 231  src_install() {
231   return 0   return 0
232  }  }
233    
   
 build_mage_script() {  
  return 0  
 }  
   
234  mconfigure() {  mconfigure() {
235   if [ -x ./configure ]   if [ -x ./configure ]
236   then   then
# 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    sminclude() {
357     local i
358    
359     if [[ -n "$@" ]]
360     then
361     for i in $@
362     do
363     echo "--- Including ${SMAGESCRIPTSDIR}/include/${i}.sminc"
364     source ${SMAGESCRIPTSDIR}/include/${i}.sminc
365     done
366     echo
367     fi
368    }
369    
370  setup_distcc_environment(){  setup_distcc_environment(){
371   if [ -x /usr/bin/distcc ]   if [ -x /usr/bin/distcc ]
372   then   then
# Line 360  setup_ccache_environment(){ Line 407  setup_ccache_environment(){
407   fi   fi
408  }  }
409    
410    
411    # fixes given dependencies to match a MAGE_TARGET
412    # fix_mage_deps -target s/depend # <-- note -target !
413    fix_mage_deps() {
414     local target="$1"
415     local depend="$2"
416     local NDEPEND
417     local sym dep cat pver pname
418    
419     # deps and provides are special
420     # they must be fixed to match the target
421    
422     # run this only if target and depend is not empty
423     if [ -n "${target}" ] && [ -n "${depend}" ]
424     then
425     # fix DEPEND
426     while read sym dep
427     do
428     cat="$(dirname ${dep})"
429     # change if not virtual
430     if [[ ${cat} = virtual ]]
431     then
432     pname="$(basename ${dep})"
433     else
434     # fix pver to target-pver
435     # to get pname-target-pver
436    
437     # doing it backwards !
438     pver="${dep##*-}"
439     # full pver
440     pname="$(basename ${dep/-${pver}/})${target}-${pver}"
441     fi
442    
443     # do not add empty lines
444     if [ -z "${NDEPEND}" ]
445     then
446     NDEPEND="${sym} ${cat}/${pname}"
447     else
448     NDEPEND="${NDEPEND}
449     ${sym} ${cat}/${pname}"
450     fi
451    
452     unset cat pname pver
453     done << EOF
454    ${depend}
455    EOF
456     # set NDEPEND to DEPEND
457     depend="${NDEPEND}"
458     fi
459    
460     echo "${depend}"
461    }
462    
463    # build_mage_script(): helper functions for regen_mage_tree()
464    # generates an mage file with given information in smage file
465    # needs at least:
466    #   PNAME                 name of pkg
467    #   PVER                  version
468    #   PBUILD                revision
469    #   PCATEGORIE            categorie of the pkg
470    #   STATE                 state of pkg stable|unstable|old
471    #   DESCRIPTION           va short description (opt)
472    #   HOMEPAGE              homepage (opt)
473    #   DEPEND                runtime dependencies (opt)
474    #   SDEPEND               add. needed deps to build the pkg (opt)
475    #   PROVIDE               provides a virtual (opt)
476    #
477    # special tags:
478    #   PKGTYPE               type of pkg
479    #   INHERITS              which functions get included
480    #   SPECIAL_FUNCTIONS     special functions wich should also be added
481    #                         warning: they get killed before the build starts !
482    #
483    #   MAGE_TREE_DEST        target destination of the generated tree
484    #   REGEN_MAGE_TREE       set to 'true' to enable this
485    #
486    # gets called with build_mage_script target
487    build_mage_script()
488    {
489     local magefile
490     local dest
491     local target
492     local sym
493     local depname
494    
495     # if MAGE_TREE_DEST not set use BUILDDIR
496     : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
497    
498     # determinate which suffix this mage file should get, if any
499     [ -n "$1" ] && target="-$1"
500    
501     # name of magefile
502     magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
503    
504     # destination to magefile
505     dest="${MAGE_TREE_DEST}/${PCATEGORIE}/${PNAME}${target}/${magefile}"
506    
507     # show what we are doing
508     echo "Generating Mage file:"
509     echo "  ${dest}"
510    
511     install -d "$(dirname ${dest})"
512     # now build the mage file
513     > ${dest}
514    
515     # header
516     echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.36.2.1 2006-11-20 12:48:17 niro Exp $' >> ${dest}
517     echo  >> ${dest}
518    
519     # pgkname and state
520     echo "PKGNAME=\"${PNAME}${target}-${PVER}-\${ARCH}-${PBUILD}\"" >> ${dest}
521     echo "STATE=\"${STATE}\"" >> ${dest}
522     echo >> ${dest}
523    
524     # description and homepage
525     echo "DESCRIPTION=\"${DESCRIPTION}\"" >> ${dest}
526     echo "HOMEPAGE=\"${HOMEPAGE}\"" >> ${dest}
527     echo >> ${dest}
528    
529     # special tags and vars
530     echo "PKGTYPE=\"${PKGTYPE}\""  >> ${dest}
531    
532     # echo MAGE_TARGETS ## note -target is needed !
533     echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
534     echo >> ${dest}
535    
536     # add special vars
537     if [ -n "${SPECIAL_VARS}" ]
538     then
539     local i
540     for i in ${SPECIAL_VARS}
541     do
542     # being tricky here :)
543     echo "${i}=\"$(eval echo \$${i})\"" >> ${dest}
544     done
545     echo  >> ${dest}
546     fi
547    
548     # add at least all includes
549     if [ -n "${INHERITS}" ]
550     then
551     echo -n "minclude"  >> ${dest}
552     local i
553     for i in ${INHERITS}
554     do
555     echo -n " ${i}"  >> ${dest}
556     done
557     echo  >> ${dest}
558     fi
559     echo >> ${dest}
560    
561     # deps and provides
562     echo "DEPEND=\"$(fix_mage_deps "${target}" "${DEPEND}")\"" >> ${dest}
563     echo >> ${dest}
564     echo "SDEPEND=\"$(fix_mage_deps "${target}" "${SDEPEND}")\"" >> ${dest}
565     echo >> ${dest}
566     echo "PROVIDE=\"${PROVIDE}\"" >> ${dest}
567     echo >> ${dest}
568    
569     # add special functions
570     if [ -n "${SPECIAL_FUNCTIONS}" ]
571     then
572     local i
573     for i in ${SPECIAL_FUNCTIONS}
574     do
575     # add to mage (quotes needed !)
576     typeset -f "${i}" >> ${dest}
577     echo >> ${dest}
578     # unset to be safe (quotes needed !)
579     #unset "${i}" <-- later to get every target built
580     done
581     echo  >> ${dest}
582     fi
583    
584     # pre|post-install|removes
585     typeset -f preinstall >> ${dest}
586     echo  >> ${dest}
587     typeset -f postinstall >> ${dest}
588     echo  >> ${dest}
589     typeset -f preremove >> ${dest}
590     echo  >> ${dest}
591     typeset -f postremove >> ${dest}
592     echo  >> ${dest}
593    }
594    
595    regen_mage_tree()
596    {
597     local i
598    
599     # build them only if requested
600     if [[ ${REGEN_MAGE_TREE} = true ]]
601     then
602     # run it without targets
603     if [ -z "${MAGE_TARGETS}" ]
604     then
605     echo
606     build_mage_script
607     echo
608     else
609    
610     # build for each target an mage file
611     # run it with several targets
612     for i in ${MAGE_TARGETS}
613     do
614     echo
615     build_mage_script "${i}"
616     echo
617     done
618     fi
619     fi
620    
621     # now unset all uneeded vars to be safe
622     # unset PKGNAME <-- don't do that; smage needs this var
623     # unset to be safe (quotes needed !)
624     for i in ${SPECIAL_FUNCTIONS}
625     do
626     unset "${i}"
627     done
628     unset SPECIAL_FUNCTIONS
629     for i in ${SPECIAL_VARS}
630     do
631     unset "${i}"
632     done
633     unset SPECIAL_VARS
634     unset STATE
635     unset DESCRIPTION
636     unset HOMEPAGE
637     unset PKGTYPE
638     unset INHERITS
639     unset DEPEND
640     unset SDEPEND
641     unset PROVIDE
642     unset preinstall
643     unset postinstall
644     unset preremove
645     unset postremove
646    }
647    
648  # print out our version  # print out our version
649  showversion  showversion
650  echo  echo
# Line 371  then Line 656  then
656   exit 1   exit 1
657  fi  fi
658    
659  #updating smage2-scripts  # updating smage2-scripts
660  if [ "$1" == "update" ]  if [ "$1" == "update" ]
661  then  then
662   if [ ! -d ${SOURCEDIR} ]   if [ ! -d ${SOURCEDIR} ]
# Line 382  then Line 667  then
667   exit 0   exit 0
668  fi  fi
669    
670  #creates md5sums for smages to given dir  # creates md5sums for smages to given dir
671  if [ "$1" == "calcmd5" ]  if [ "$1" == "calcmd5" ]
672  then  then
673   if [ $# -ge 3 ]   if [ $# -ge 3 ]
674   then   then
  # overridable sourcedir  
  CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"  
   
675   SMAGENAME="$2"   SMAGENAME="$2"
676   MD5DIR="$3"   MD5DIR="$3"
677   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
678    
679     # overridable sourcedir; must be declared after source of the smage2
680     CALC_SOURCEDIR="${CALC_SOURCEDIR:="${SOURCEDIR}/${PNAME}"}"
681    
682   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."   [ -z "${SRC_URI}" ] && die "Nothing declared to calculate."
683    
684   # end of array   # end of array
# Line 407  then Line 692  then
692    
693   for ((i=0; i < EOA; i++))   for ((i=0; i < EOA; i++))
694   do   do
695   MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"   # url to file
696     my_SRC_URI="$(echo ${SRC_URI[${i}]} | cut -d' ' -f1)"
697    
698     # subdir in sources dir; the my_SRCI_URI file goes to there
699     my_SRC_URI_DEST="$(echo ${SRC_URI[${i}]} | cut -d' ' -f2)"
700    
701     # if my_src_uri_dest is not equal my_src_uri; than an other dir is used
702     if [[ ${my_SRC_URI_DEST} != ${my_SRC_URI} ]]
703     then
704     MY_SRC_FILE="${my_SRC_URI_DEST}/$(basename ${SRC_URI[${i}]})"
705     else
706     MY_SRC_FILE="$(basename ${SRC_URI[${i}]})"
707     fi
708    
709   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]   if [ -e "${CALC_SOURCEDIR}/${MY_SRC_FILE}" ]
710   then   then
711   echo "calculating $(basename ${MY_SRC_FILE}) ..."   echo "calculating $(basename ${MY_SRC_FILE}) ..."
# Line 415  then Line 713  then
713   else   else
714   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."   echo "WARNING: File '$(basename ${MY_SRC_FILE}) not found in ${CALC_SOURCEDIR}."
715   fi   fi
716    
717     # unset them to be shure
718     unset my_SRC_URI
719     unset my_SRC_URI_DEST
720     unset my_SRC_URI_MIRROR
721     unset my_SOURCEDIR
722   done   done
723    
724   echo   echo
# Line 433  then Line 737  then
737   exit 0   exit 0
738  fi  fi
739    
740  #download sources  # download sources
741  if [ "$1" == "download" -a -n "$2" ]  if [ "$1" == "download" -a -n "$2" ]
742  then  then
  showversion  
743   if [ ! -d ${SMAGESCRIPTSDIR} ]   if [ ! -d ${SMAGESCRIPTSDIR} ]
744   then   then
745   install -d ${SMAGESCRIPTSDIR}   install -d ${SMAGESCRIPTSDIR}
# Line 451  then Line 754  then
754   exit 0   exit 0
755  fi  fi
756    
757    # regen-mage-tree
758    if [ "$1" == "only-regen-tree" -a -n "$2" ]
759    then
760     # set correct SMAGENAME
761     SMAGENAME="$2"
762     MD5DIR="$(dirname ${SMAGENAME})/md5"
763     source ${SMAGENAME} || die "regen: smage2 not found"
764    
765     regen_mage_tree
766     exit 0
767    fi
768    
769  if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ]  if [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ]
770  then  then
771   die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."   die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
# Line 505  MD5DIR="$(dirname ${SMAGENAME})/md5" Line 820  MD5DIR="$(dirname ${SMAGENAME})/md5"
820  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
821  echo "Compiling ${PKGNAME}"  echo "Compiling ${PKGNAME}"
822    
823  #download sources  # auto regen mage tree if requested
824    regen_mage_tree
825    
826    # download sources
827  download_sources  download_sources
828    
829  #fixes some issues with these functions  # fixes some issues with these functions
830  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
831  export -f src_compile || die "src_compile export failed"  export -f src_compile || die "src_compile export failed"
832  export -f src_install || die "src_install export failed"  export -f src_install || die "src_install export failed"
833    
834  #fixes some compile issues  # fixes some compile issues
835  export CHOST="${CHOST}" || die "CHOST export failed"  export CHOST="${CHOST}" || die "CHOST export failed"
836  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"
837  export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"  export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"
# Line 521  export BINDIR="${BINDIR}" || die "BINDIR Line 839  export BINDIR="${BINDIR}" || die "BINDIR
839  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"
840    
841    
842  #setup distcc  # setup distcc
843  #distcc mus be setup *before* ccache, as ccache need to be before distcc in path  # distcc mus be setup *before* ccache, as ccache need to be before distcc in path
844  if [ "${SMAGE_USE_DISTCC}" == "true" ]  if [ "${SMAGE_USE_DISTCC}" == "true" ]
845  then  then
846   setup_distcc_environment   setup_distcc_environment
847  fi  fi
848    
849  #setup ccache  # setup ccache
850  if [ "${SMAGE_USE_CCACHE}" == "true" ]  if [ "${SMAGE_USE_CCACHE}" == "true" ]
851  then  then
852   setup_ccache_environment   setup_ccache_environment
# Line 549  sleep 1 Line 867  sleep 1
867  #read  #read
868  #debug end  #debug end
869    
870  #cleans up build if a previously one exists  # cleans up build if a previously one exists
871  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
872  then  then
873   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
874  fi  fi
875  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
876    
877  #cleans up srcdir if a previously unpacked one exists  # cleans up srcdir if a previously unpacked one exists
878  if [ -d ${SRCDIR} ]  if [ -d ${SRCDIR} ]
879  then  then
880   rm -rf ${SRCDIR}   rm -rf ${SRCDIR}
881  fi  fi
882    
883  #cleans up bindir if a previous build exists or creates a new one  # cleans up bindir if a previous build exists or creates a new one
884  if [ -d ${BINDIR} ]  if [ -d ${BINDIR} ]
885  then  then
886   rm -rf ${BINDIR}   rm -rf ${BINDIR}
887  fi  fi
888  install -d ${BINDIR} || die "couldn't create \$BINDIR."  install -d ${BINDIR} || die "couldn't create \$BINDIR."
889    
890  #cleans up package temp dir if a previous build exists  # cleans up package temp dir if a previous build exists
891  if [ -d ${BUILDDIR}/${PKGNAME} ]  if [ -d ${BUILDDIR}/${PKGNAME} ]
892  then  then
893   rm -rf ${BUILDDIR}/${PKGNAME}   rm -rf ${BUILDDIR}/${PKGNAME}
894  fi  fi
895    
896  #cleans up timestamp if one exists  # cleans up timestamp if one exists
897  if [ -f /var/tmp/timestamp ]  if [ -f /var/tmp/timestamp ]
898  then  then
899   mage rmstamp   mage rmstamp
# Line 586  src_compile || die "src_compile failed" Line 904  src_compile || die "src_compile failed"
904  src_install || die "src_install failed"  src_install || die "src_install failed"
905    
906    
907  #compressing doc, info & man files  # compressing doc, info & man files
908  echo -e "Compressing man-pages ..."  echo -e "Compressing man-pages ..."
909  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [ -d ${BUILDDIR}/builded/usr/share/man ]
910  then  then
# Line 599  then Line 917  then
917   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info
918  fi  fi
919    
920  #the new buildpkg command  # stripping all bins and libs
921    case ${NOSTRIP} in
922     true|TRUE|yes|y)
923     echo -e "NOSTRIP=true detected; Package will not be stripped ..."
924     ;;
925     *)
926     echo -e "Stripping binaries ..."
927     mstripbins ${BINDIR}
928     echo -e "Stripping libraries ..."
929     mstriplibs ${BINDIR}
930     ;;
931    esac
932    
933    # the new buildpkg command
934  case ${NOPKGBUILD} in  case ${NOPKGBUILD} in
935   true|TRUE|yes|y)   true|TRUE|yes|y)
936   echo -e "NOPGKBUILD=true detected; Package will not be build ..."   echo -e "NOPGKBUILD=true detected; Package will not be build ..."
937   ;;   ;;
938   *)   *)
939   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   # build serveral targets
940   echo -e "\nPackage ${PKGNAME} successfully builded.\n"   if [ -n "${MAGE_TARGETS}" ]
941     then
942     for target in ${MAGE_TARGETS}
943     do
944     # check if an special target_pkgbuild exists
945     if typeset -f ${target}_pkgbuild > /dev/null
946     then
947     # run it
948     ${target}_pkgbuild
949     fi
950     # now create the target package
951     ${MLIBDIR}/pkgbuild_dir.sh \
952     "${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD}" \
953     ${BINDIR} || die "target: ${target} package-build failed"
954     echo -e "\nPackage ${PNAME}-${target}-${PVER}-${CHOST%%-*}-${PBUILD} successfully builded.\n"
955     done
956     else
957     ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
958     echo -e "\nPackage ${PKGNAME} successfully builded.\n"
959     fi
960   ;;   ;;
961  esac  esac
962    
963  #for sure  # for sure
964  unset NOPKGBUILD  unset NOPKGBUILD
965    unset NOSTRIP
966    
967  xtitleclean  xtitleclean
968  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"  #echo -e "\nPackage ${PKGNAME} successfully builded.\n"

Legend:
Removed from v.59  
changed lines
  Added in v.398