Magellan Linux

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

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

revision 600 by niro, Mon Nov 5 17:08:33 2007 UTC revision 1291 by niro, Fri May 27 12:54:34 2011 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.60 2007-11-05 17:08:33 niro Exp $  # $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $
8    
9  #01.10.2004  #01.10.2004
10  # added ccache support  # added ccache support
# Line 50  export LC_ALL=C Line 50  export LC_ALL=C
50    
51  source /etc/mage.rc.global  source /etc/mage.rc.global
52  source ${MAGERC}  source ${MAGERC}
53    source ${MLIBDIR}/mage4.functions.sh
54    
55  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
56  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
# Line 73  die() Line 74  die()
74   exit 1   exit 1
75  }  }
76    
77    die_pipestatus()
78    {
79     # the status change if we do any parameter declarations!!
80     # dont do this anymore, keep this in mind!
81     #
82     # local pos="$1"
83     # local comment="$2"
84     #
85     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
86     #
87     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
88    }
89    
90  xtitle()  xtitle()
91  {  {
92   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 140  download_sources() Line 154  download_sources()
154   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"   local DB_MD5_SUM_FILE="${MD5DIR}/$(basename ${SMAGENAME} .${SMAGESUFFIX}).md5"
155   local FETCHING   local FETCHING
156   local i mirror   local i mirror
157     local wget_opts
158    
159     # filter wget command if busybox was found
160     wget_opts="$(busybox_filter_wget_options ${WGET_FETCH_OPTIONS})"
161    
162   # install SRCDIR/PNAME if not exist   # install SRCDIR/PNAME if not exist
163   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}   [ ! -d ${SOURCEDIR}/${PNAME} ] && install -d ${SOURCEDIR}/${PNAME}
164    
165   # check if FETCHING is needed   # check if FETCHING is needed
166   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} &> /dev/null )   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} &> /dev/null )
167   if [[ $? = 0 ]]   if [[ $? = 0 ]]
168   then   then
169   # md5's ok, no fetching needed   # md5's ok, no fetching needed
# Line 171  download_sources() Line 188  download_sources()
188   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
189   fi   fi
190    
191     # create the SOURCEDIR
192     install -d ${my_SOURCEDIR}
193    
194   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
195   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
196   then   then
# Line 182  download_sources() Line 202  download_sources()
202   then   then
203   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
204   wget \   wget \
205   --passive-ftp \   ${wget_opts} \
206   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
207   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
208   if [[ $? = 0 ]]   if [[ $? = 0 ]]
209   then   then
# Line 206  download_sources() Line 223  download_sources()
223   then   then
224   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
225   wget \   wget \
226   --passive-ftp \   ${wget_opts} \
227   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
228   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
229   if [[ $? = 0 ]]   if [[ $? = 0 ]]
230   then   then
# Line 230  download_sources() Line 244  download_sources()
244   then   then
245   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
246   wget \   wget \
247   --passive-ftp \   ${wget_opts} \
248   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
249   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
250   if [[ $? = 0 ]]   if [[ $? = 0 ]]
251   then   then
# Line 254  download_sources() Line 265  download_sources()
265   then   then
266   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
267   wget \   wget \
268   --passive-ftp \   ${wget_opts} \
269   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
270   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
271   if [[ $? = 0 ]]   if [[ $? = 0 ]]
272   then   then
# Line 278  download_sources() Line 286  download_sources()
286   then   then
287   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
288   wget \   wget \
289   --passive-ftp \   ${wget_opts} \
290   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
291   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
292   if [[ $? = 0 ]]   if [[ $? = 0 ]]
293   then   then
# Line 297  download_sources() Line 302  download_sources()
302   then   then
303   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
304   wget \   wget \
305   --passive-ftp \   ${wget_opts} \
306   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
307   "${my_SRC_URI}"   "${my_SRC_URI}"
308   fi   fi
309   fi   fi
# Line 316  download_sources() Line 318  download_sources()
318   # recheck md5 sums   # recheck md5 sums
319   echo   echo
320   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} Checking MD5 sums:${COLDEFAULT}"
321   ( cd ${SOURCEDIR}/${PNAME}; md5sum --check ${DB_MD5_SUM_FILE} ) || die "md5 failed"   ( cd ${SOURCEDIR}/${PNAME}; md5sum -c ${DB_MD5_SUM_FILE} ) || die "md5 failed"
322   echo   echo
323    
324   # not needed anymore   # not needed anymore
# Line 362  mconfigure() Line 364  mconfigure()
364   ./configure \   ./configure \
365   --prefix=/usr \   --prefix=/usr \
366   --host=${CHOST} \   --host=${CHOST} \
367     --build=${CHOST} \
368   --mandir=/usr/share/man \   --mandir=/usr/share/man \
369   --infodir=/usr/share/info \   --infodir=/usr/share/info \
370   --datadir=/usr/share \   --datadir=/usr/share \
# Line 452  munpack() Line 455  munpack()
455   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
456   ;;   ;;
457   rpm)   rpm)
458   pushd ${BUILDDIR} > /dev/null   pushd ${DEST} > /dev/null
459   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
460   tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz/} || die "tar: .rpm unpack failed."   tar --no-same-owner -xvzf ${SRCFILE/.rpm/.tar.gz} || die "tar: .rpm unpack failed."
461   [[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/}   if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
462     then
463     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
464     fi
465   ;;   ;;
466   *)   *)
467   die "munpack failed"   die "munpack failed"
# Line 500  mlibtoolize() Line 506  mlibtoolize()
506   libtoolize ${opts} || die "running: mlibtoolize ${opts}"   libtoolize ${opts} || die "running: mlibtoolize ${opts}"
507  }  }
508    
509    mautoreconf()
510    {
511     local opts="$@"
512     [[ -z ${opts} ]] && opts="--verbose --install --force"
513    
514     autoreconf ${opts} || die "running: mautoreconf ${opts}"
515    }
516    
517  minstalldocs()  minstalldocs()
518  {  {
519   local docfiles   local docfiles
# Line 510  minstalldocs() Line 524  minstalldocs()
524   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
525   fi   fi
526    
527     local i
528   for i in ${docfiles}   for i in ${docfiles}
529   do   do
530   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
531   install -m 0644 ${SRCDIR}/${i}.gz \   then
532   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
533     install -m 0644 ${SRCDIR}/${i}.gz \
534     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
535     fi
536   done   done
537  }  }
538    
# Line 534  mstripbins() Line 552  mstripbins()
552   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "executable" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null
553  }  }
554    
555    mcompressdocs()
556    {
557     local bindir="$@"
558    
559     if [ -d ${bindir}/usr/share/man ]
560     then
561     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
562     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
563     fi
564    
565     if [ -d ${bindir}/usr/share/info ]
566     then
567     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
568     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
569     fi
570    }
571    
572  sminclude()  sminclude()
573  {  {
574   local i   local i
# Line 647  EOF Line 682  EOF
682  # special tags:  # special tags:
683  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
684  #   INHERITS              which functions get included  #   INHERITS              which functions get included
685  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
686  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
687    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
688    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
689    #                         (only in the resulting magefile}
690  #  #
691  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
692  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 659  build_mage_script() Line 697  build_mage_script()
697   local magefile   local magefile
698   local dest   local dest
699   local target   local target
700     local split_pkg_base
701   local sym   local sym
702   local depname   local depname
703    
# Line 666  build_mage_script() Line 705  build_mage_script()
705   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
706    
707   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
708   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
709    
710     # mark package as splitpackage
711     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
712    
713   # name of magefile   # name of magefile
714   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 683  build_mage_script() Line 725  build_mage_script()
725   > ${dest}   > ${dest}
726    
727   # header   # header
728   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.60 2007-11-05 17:08:33 niro Exp $' >> ${dest}   echo '# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/smage2.sh,v 1.62 2007-11-28 10:47:50 niro Exp $' >> ${dest}
729   echo  >> ${dest}   echo  >> ${dest}
730    
731   # pgkname and state   # pgkname and state
# Line 703  build_mage_script() Line 745  build_mage_script()
745   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
746   echo >> ${dest}   echo >> ${dest}
747    
748     # split package base
749     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
750     echo >> ${dest}
751    
752   # add special vars   # add special vars
753   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
754   then   then
# Line 770  regen_mage_tree() Line 816  regen_mage_tree()
816   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
817   then   then
818   # run it without targets   # run it without targets
819   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
820   then   then
821     # build for each target a mage file
822     # run it with several targets
823   echo   echo
824   build_mage_script   for i in ${MAGE_TARGETS}
825     do
826     build_mage_script --target "${i}"
827     done
828   echo   echo
  else  
829    
830   # build for each target an mage file   # run it for splitpackages
831     elif [[ -n ${SPLIT_PACKAGES} ]]
832     then
833     local split_pkg_base="${PNAME}"
834     # save smage environment
835     split_save_variables
836     # build for each subpackage a mage file
837   # run it with several targets   # run it with several targets
838   for i in ${MAGE_TARGETS}   echo
839     for i in ${SPLIT_PACKAGES}
840   do   do
841   echo   # get the right variables for the split
842   build_mage_script "${i}"   export PNAME="${i}"
843   echo   split_info_${i}
844     build_mage_script --split-pkg-base "${split_pkg_base}"
845     # restore smage environment
846     split_restore_variables
847   done   done
848     echo
849     # unset all saved smage variables
850     split_unset_variables
851    
852     else
853     echo
854     build_mage_script
855     echo
856   fi   fi
857   fi   fi
858    
# Line 815  regen_mage_tree() Line 883  regen_mage_tree()
883   unset postremove   unset postremove
884  }  }
885    
886    split_save_variables()
887    {
888     export SAVED_PNAME="${PNAME}"
889     export SAVED_PVER="${PVER}"
890     export SAVED_PBUILD="${PBUILD}"
891     export SAVED_PCATEGORIE="${PCATEGORIE}"
892     export SAVED_DESCRIPTION="${DESCRIPTION}"
893     export SAVED_HOMEPAGE="${HOMEPAGE}"
894     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
895     export SAVED_STATE="${STATE}"
896     export SAVED_PKGTYPE="${PKGTYPE}"
897     export SAVED_INHERITS="${INHERITS}"
898     export SAVED_DEPEND="${DEPEND}"
899     export SAVED_SDEPEND="${SDEPEND}"
900     export SAVED_PROVIDE="${PROVIDE}"
901     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
902    
903     # bindir too
904     export SAVED_BINDIR="${BINDIR}"
905    
906     # export the SPLIT_PACKAGE_BASE
907     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
908    
909     # functions
910     if [[ ! -z $(typeset -f preinstall) ]]
911     then
912     # rename the old one
913     local saved_preinstall
914     saved_preinstall=SAVED_$(typeset -f preinstall)
915     eval "${saved_preinstall}"
916     export -f SAVED_preinstall
917     fi
918    
919     if [[ ! -z $(typeset -f postinstall) ]]
920     then
921     # rename the old one
922     local saved_postinstall
923     saved_postinstall=SAVED_$(typeset -f postinstall)
924     eval "${saved_postinstall}"
925     export -f SAVED_postinstall
926     fi
927    
928     if [[ ! -z $(typeset -f preremove) ]]
929     then
930     # rename the old one
931     local saved_preremove
932     saved_preremove=SAVED_$(typeset -f preremove)
933     eval "${saved_preremove}"
934     export -f SAVED_preremove
935     fi
936    
937     if [[ ! -z $(typeset -f postremove) ]]
938     then
939     # rename the old one
940     local saved_postremove
941     saved_postremove=SAVED_$(typeset -f postremove)
942     eval "${saved_postremove}"
943     export -f SAVED_postremove
944     fi
945    }
946    
947    split_restore_variables()
948    {
949     export PNAME="${SAVED_PNAME}"
950     export PVER="${SAVED_PVER}"
951     export PBUILD="${SAVED_PBUILD}"
952     export PCATEGORIE="${SAVED_PCATEGORIE}"
953     export DESCRIPTION="${SAVED_DESCRIPTION}"
954     export HOMEPAGE="${SAVED_HOMEPAGE}"
955     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
956     export STATE="${SAVED_STATE}"
957     export PKGTYPE="${SAVED_PKGTYPE}"
958     export INHERITS="${SAVED_INHERITS}"
959     export DEPEND="${SAVED_DEPEND}"
960     export SDEPEND="${SAVED_SDEPEND}"
961     export PROVIDE="${SAVED_PROVIDE}"
962     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
963    
964     # bindir too
965     export BINDIR="${SAVED_BINDIR}"
966    
967     # functions
968     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
969     then
970     # rename the old one
971     local saved_preinstall
972     saved_preinstall=$(typeset -f SAVED_preinstall)
973     eval "${saved_preinstall/SAVED_/}"
974     export -f preinstall
975     fi
976    
977     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
978     then
979     # rename the old one
980     local saved_postinstall
981     saved_postinstall=$(typeset -f SAVED_postinstall)
982     eval "${saved_postinstall/SAVED_/}"
983     export -f postinstall
984     fi
985    
986     if [[ ! -z $(typeset -f SAVED_preremove) ]]
987     then
988     # rename the old one
989     local saved_preremove
990     saved_preremove=$(typeset -f SAVED_preremove)
991     eval "${saved_preremove/SAVED_/}"
992     export -f preremove
993     fi
994    
995     if [[ ! -z $(typeset -f SAVED_postremove) ]]
996     then
997     # rename the old one
998     local saved_postremove
999     saved_postremove=$(typeset -f SAVED_postremove)
1000     eval "${saved_postremove/SAVED_/}"
1001     export -f postremove
1002     fi
1003    }
1004    
1005    split_unset_variables()
1006    {
1007     # unset saved vars; not needed anymore
1008     unset SAVED_PNAME
1009     unset SAVED_PVER
1010     unset SAVED_PBUILD
1011     unset SAVED_PCATEGORIE
1012     unset SAVED_DESCRIPTION
1013     unset SAVED_HOMEPAGE
1014     unset SAVED_SPECIAL_VARS
1015     unset SAVED_STATE
1016     unset SAVED_PKGTYPE
1017     unset SAVED_INHERITS
1018     unset SAVED_DEPEND
1019     unset SAVED_SDEPEND
1020     unset SAVED_PROVIDE
1021     unset SAVED_BINDIR
1022     unset SAVED_NOPKGBUILD
1023     unset SPLIT_PACKAGE_BASE
1024     unset -f SAVED_preinstall
1025     unset -f SAVED_postinstall
1026     unset -f SAVED_preremove
1027     unset -f SAVED_postremove
1028    }
1029    
1030  export_inherits()  export_inherits()
1031  {  {
1032   local include="$1"   local include="$1"
# Line 876  generate_package_md5sum() Line 1088  generate_package_md5sum()
1088   # fix target as it may be empty !   # fix target as it may be empty !
1089   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1090    
1091    
1092   # build pkgname   # build pkgname
1093   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1094    
# Line 895  generate_package_md5sum() Line 1108  generate_package_md5sum()
1108   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1109    
1110   # setup md5 dir   # setup md5 dir
1111   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1112   install -d ${dest}   install -d ${dest}
1113    
1114   # gen md5sum   # gen md5sum
# Line 933  source_pkg_build() Line 1146  source_pkg_build()
1146   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"   echo -e "${COLGREEN}Source package ${COLBLUE}${PNAME}-${PVER}-${PBUILD}.${SRCPKGSUFFIX} ${COLGREEN}successfully builded.${COLDEFAULT}"
1147  }  }
1148    
1149    step_by_step()
1150    {
1151     if [[ ${STEP_BY_STEP} = true ]]
1152     then
1153     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1154     echo "Press [enter] to continue"
1155     read
1156     fi
1157    }
1158    
1159    
1160  # print out our version  # print out our version
1161  showversion  showversion
# Line 959  fi Line 1182  fi
1182  # creates md5sums for smages to given dir  # creates md5sums for smages to given dir
1183  if [[ $1 = calcmd5 ]]  if [[ $1 = calcmd5 ]]
1184  then  then
1185   if [ $# -ge 3 ]   if [ $# -ge 2 ]
1186   then   then
1187   SMAGENAME="$2"   SMAGENAME="$2"
1188   MD5DIR="$3"   MD5DIR="$3"
1189     [[ -z ${MD5DIR} ]] && MD5DIR="$(dirname ${SMAGENAME})/md5"
1190    
1191   source ${SMAGENAME} || die "download source failed"   source ${SMAGENAME} || die "download source failed"
1192    
1193   # overridable sourcedir; must be declared after source of the smage2   # overridable sourcedir; must be declared after source of the smage2
# Line 1015  then Line 1240  then
1240   echo   echo
1241   else   else
1242   echo "Usage: Calculating MD5 Sums:"   echo "Usage: Calculating MD5 Sums:"
1243   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME /path/to/MD5DIR"   echo "    $(basename $0) calcmd5 /path/to/SMAGENAME [/path/to/MD5DIR]"
1244   echo   echo
1245   echo   echo
1246   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."   echo "Export the CALC_SOURCEDIR variable to override current SOURCEDIRs."
# Line 1053  then Line 1278  then
1278    
1279   regen_mage_tree   regen_mage_tree
1280    
1281   # build md5sum for existing packages   # build several targets
1282   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1283   --pcat "${PCATEGORIE}" \   then
1284   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1285   --pver "${PVER}" \   do
1286   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1287   --parch "${ARCH}" \   generate_package_md5sum \
1288   --target "${target}"   --pcat "${PCATEGORIE}" \
1289     --pname "${PNAME}" \
1290     --pver "${PVER}" \
1291     --pbuild "${PBUILD}" \
1292     --parch "${ARCH}" \
1293     --target "${target}"
1294     done
1295    
1296     # build several subpackages
1297     elif [[ -n ${SPLIT_PACKAGES} ]]
1298     then
1299     split_save_variables
1300     for subpackage in ${SPLIT_PACKAGES}
1301     do
1302     # get the right variables for the split
1303     export PNAME="${subpackage}"
1304     split_info_${subpackage}
1305     # build md5sum for existing packages
1306     generate_package_md5sum \
1307     --pcat "${PCATEGORIE}" \
1308     --pname "${PNAME}" \
1309     --pver "${PVER}" \
1310     --pbuild "${PBUILD}" \
1311     --parch "${ARCH}"
1312     # restore smage environment
1313     split_restore_variables
1314     done
1315     # unset all saved smage variables
1316     split_unset_variables
1317    
1318     else
1319     # build md5sum for existing packages
1320     generate_package_md5sum \
1321     --pcat "${PCATEGORIE}" \
1322     --pname "${PNAME}" \
1323     --pver "${PVER}" \
1324     --pbuild "${PBUILD}" \
1325     --parch "${ARCH}"
1326     fi
1327    
1328   exit 0   exit 0
1329  fi  fi
# Line 1125  fi Line 1388  fi
1388  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1389  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1390  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1391    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1392    
1393  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1394  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1199  then Line 1463  then
1463   mage rmstamp   mage rmstamp
1464  fi  fi
1465    
1466  src_prepare || die "src_prepare failed"  # setup build loggins
1467  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1468  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1469    
1470    src_prepare | ${SMAGE_LOG_CMD}
1471    die_pipestatus 0 "src_prepare failed"
1472    step_by_step $_
1473    
1474    src_compile | ${SMAGE_LOG_CMD}
1475    die_pipestatus 0 "src_compile failed"
1476    step_by_step $_
1477    
1478    # build several subpackages
1479  # compressing doc, info & man files  if [[ -n ${SPLIT_PACKAGES} ]]
 if [ -d ${BUILDDIR}/builded/usr/share/man ]  
1480  then  then
1481   echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"   # save bindir & pname
1482   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   split_save_variables
1483     export SAVED_BINDIR="${BINDIR}"
1484     for subpackage in ${SPLIT_PACKAGES}
1485     do
1486     if typeset -f src_install_${subpackage} > /dev/null
1487     then
1488     # export subpackage bindir
1489     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1490     # export PNAME, several internal function and include
1491     # rely on this variable
1492     export PNAME="${subpackage}"
1493    
1494     echo
1495     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1496     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1497     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1498     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1499    
1500     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1501     die_pipestatus 0 "src_install_${subpackage} failed"
1502     step_by_step $_
1503     fi
1504     done
1505     # restore bindir & pname
1506     split_restore_variables
1507     # unset all saved smage variables
1508     split_unset_variables
1509    else
1510     src_install | ${SMAGE_LOG_CMD}
1511     die_pipestatus 0 "src_install failed"
1512     step_by_step $_
1513  fi  fi
1514    
1515  if [ -d ${BUILDDIR}/builded/usr/share/info ]  # compressing doc, info & man files
1516    if [[ -n ${SPLIT_PACKAGES} ]]
1517  then  then
1518   echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1519   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   do
1520     mcompressdocs ${BINDIR}_${subpackage}
1521     done
1522    else
1523     mcompressdocs ${BINDIR}
1524  fi  fi
1525    
1526    
1527  # stripping all bins and libs  # stripping all bins and libs
1528  case ${NOSTRIP} in  case ${NOSTRIP} in
1529   true|TRUE|yes|y)   true|TRUE|yes|y)
1530   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1531   ;;   ;;
1532   *)   *)
1533   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   if [[ -n ${SPLIT_PACKAGES} ]]
1534   mstripbins ${BINDIR}   then
1535   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1536   mstriplibs ${BINDIR}   do
1537     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1538     mstripbins ${BINDIR}_${subpackage}
1539     echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"
1540     mstriplibs ${BINDIR}_${subpackage}
1541     done
1542     else
1543     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1544     mstripbins ${BINDIR}
1545     echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1546     mstriplibs ${BINDIR}
1547     fi
1548   ;;   ;;
1549  esac  esac
1550    
# Line 1237  case ${NOPKGBUILD} in Line 1555  case ${NOPKGBUILD} in
1555   ;;   ;;
1556   *)   *)
1557   # build several targets   # build several targets
1558   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1559   then   then
1560   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1561   do   do
# Line 1263  case ${NOPKGBUILD} in Line 1581  case ${NOPKGBUILD} in
1581    
1582   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1583   done   done
1584    
1585     # build several subpackages
1586     elif [[ -n ${SPLIT_PACKAGES} ]]
1587     then
1588     split_save_variables
1589     for subpackage in ${SPLIT_PACKAGES}
1590     do
1591     # get the right variables for the split
1592     export PNAME="${subpackage}"
1593     split_info_${PNAME}
1594    
1595     # jump to next one if NOPKGBUILD is set in split_info
1596     case ${NOPKGBUILD} in
1597     true|TRUE|yes|y) continue ;;
1598     esac
1599    
1600     # check if an special subpackage_pkgbuild exists
1601     if typeset -f ${PNAME}_pkgbuild > /dev/null
1602     then
1603     # run it
1604     ${PNAME}_pkgbuild
1605     fi
1606     # now create the target package
1607     ${MLIBDIR}/pkgbuild_dir.sh \
1608     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1609     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1610    
1611     # build pkg-md5-sum if requested
1612     generate_package_md5sum \
1613     --pcat "${PCATEGORIE}" \
1614     --pname "${PNAME}" \
1615     --pver "${PVER}" \
1616     --pbuild "${PBUILD}" \
1617     --parch "${ARCH}"
1618    
1619     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1620    
1621     # restore smage environment
1622     split_restore_variables
1623     done
1624     # unset all saved smage variables
1625     split_unset_variables
1626    
1627   else   else
1628   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1629    
# Line 1282  case ${NOPKGBUILD} in Line 1643  case ${NOPKGBUILD} in
1643   ;;   ;;
1644  esac  esac
1645    
1646    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1647    then
1648     bzip2 -9f /var/log/smage/${PKGNAME}.log
1649    else
1650     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1651    fi
1652    
1653  # for sure  # for sure
1654  unset NOPKGBUILD  unset NOPKGBUILD
1655  unset NOSTRIP  unset NOSTRIP

Legend:
Removed from v.600  
changed lines
  Added in v.1291