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 1085 by niro, Mon Jun 28 18:15:44 2010 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 73  die() Line 73  die()
73   exit 1   exit 1
74  }  }
75    
76    die_pipestatus()
77    {
78     # the status change if we do any parameter declarations!!
79     # dont do this anymore, keep this in mind!
80     #
81     # local pos="$1"
82     # local comment="$2"
83     #
84     # [ ${PIPESTATUS[${pos}]} -ne 0 ] && die "${comment}"
85     #
86     [ ${PIPESTATUS[$1]} -ne 0 ] && die "$2"
87    }
88    
89  xtitle()  xtitle()
90  {  {
91   if [[ ${TERM} = xterm ]]   if [[ ${TERM} = xterm ]]
# Line 171  download_sources() Line 184  download_sources()
184   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"   my_SOURCEDIR="${SOURCEDIR}/${PNAME}"
185   fi   fi
186    
187     # create the SOURCEDIR
188     install -d ${my_SOURCEDIR}
189    
190   # if an mirrored file than replace first the mirror uri   # if an mirrored file than replace first the mirror uri
191   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]   if [[ -n $(echo ${my_SRC_URI} | grep 'mirror://') ]]
192   then   then
# Line 182  download_sources() Line 198  download_sources()
198   then   then
199   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
200   wget \   wget \
201   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
202   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
203   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
204   if [[ $? = 0 ]]   if [[ $? = 0 ]]
205   then   then
# Line 206  download_sources() Line 219  download_sources()
219   then   then
220   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
221   wget \   wget \
222   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
223   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
224   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
225   if [[ $? = 0 ]]   if [[ $? = 0 ]]
226   then   then
# Line 230  download_sources() Line 240  download_sources()
240   then   then
241   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
242   wget \   wget \
243   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
244   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
245   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
246   if [[ $? = 0 ]]   if [[ $? = 0 ]]
247   then   then
# Line 254  download_sources() Line 261  download_sources()
261   then   then
262   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
263   wget \   wget \
264   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
265   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
266   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
267   if [[ $? = 0 ]]   if [[ $? = 0 ]]
268   then   then
# Line 278  download_sources() Line 282  download_sources()
282   then   then
283   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI_MIRROR}${COLDEFAULT}"
284   wget \   wget \
285   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
286   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI_MIRROR})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
287   "${my_SRC_URI_MIRROR}"   "${my_SRC_URI_MIRROR}"
288   if [[ $? = 0 ]]   if [[ $? = 0 ]]
289   then   then
# Line 297  download_sources() Line 298  download_sources()
298   then   then
299   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${my_SRC_URI}${COLDEFAULT}"
300   wget \   wget \
301   --passive-ftp \   ${WGET_FETCH_OPTIONS} \
302   --tries 3 \   --output-document="${my_SOURCEDIR}/$(basename ${my_SRC_URI})" \
  --continue \  
  --progress bar \  
  --directory-prefix="${my_SOURCEDIR}" \  
303   "${my_SRC_URI}"   "${my_SRC_URI}"
304   fi   fi
305   fi   fi
# Line 362  mconfigure() Line 360  mconfigure()
360   ./configure \   ./configure \
361   --prefix=/usr \   --prefix=/usr \
362   --host=${CHOST} \   --host=${CHOST} \
363     --build=${CHOST} \
364   --mandir=/usr/share/man \   --mandir=/usr/share/man \
365   --infodir=/usr/share/info \   --infodir=/usr/share/info \
366   --datadir=/usr/share \   --datadir=/usr/share \
# Line 452  munpack() Line 451  munpack()
451   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
452   ;;   ;;
453   rpm)   rpm)
454   pushd ${BUILDDIR} > /dev/null   pushd ${DEST} > /dev/null
455   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."   rpm2targz ${SOURCEDIR}/${PNAME}/${SRCFILE} || die "rpm2targz: .rpm unpack failed."
456   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."
457   [[ -f ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/} ]] && rm ${BUILDDIR}/${SRCFILE/.rpm/.tar.gz/}   if [[ -f ${DEST}/${SRCFILE/.rpm/.tar.gz} ]]
458     then
459     rm ${DEST}/${SRCFILE/.rpm/.tar.gz}
460     fi
461   ;;   ;;
462   *)   *)
463   die "munpack failed"   die "munpack failed"
# Line 510  minstalldocs() Line 512  minstalldocs()
512   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
513   fi   fi
514    
515     local i
516   for i in ${docfiles}   for i in ${docfiles}
517   do   do
518   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if [ -f ${i} ]
519   install -m 0644 ${SRCDIR}/${i}.gz \   then
520   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."
521     install -m 0644 ${SRCDIR}/${i}.gz \
522     ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."
523     fi
524   done   done
525  }  }
526    
# Line 534  mstripbins() Line 540  mstripbins()
540   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
541  }  }
542    
543    mcompressdocs()
544    {
545     local bindir="$@"
546    
547     if [ -d ${bindir}/usr/share/man ]
548     then
549     echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"
550     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/man
551     fi
552    
553     if [ -d ${bindir}/usr/share/info ]
554     then
555     echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"
556     ${MLIBDIR}/compressdoc -g -9 ${bindir}/usr/share/info
557     fi
558    }
559    
560  sminclude()  sminclude()
561  {  {
562   local i   local i
# Line 647  EOF Line 670  EOF
670  # special tags:  # special tags:
671  #   PKGTYPE               type of pkg  #   PKGTYPE               type of pkg
672  #   INHERITS              which functions get included  #   INHERITS              which functions get included
673  #   SPECIAL_FUNCTIONS     special functions wich should also be added  #   SPECIAL_FUNCTIONS     special functions which should also be added
674  #                         warning: they get killed before the build starts !  #                         warning: they get killed before the build starts !
675    #   SPLIT_PACKAGES        names of all subpackages which are splitted from parent
676    #   SPLIT_PACKAGE_BASE    base package name for splitpackages
677    #                         (only in the resulting magefile}
678  #  #
679  #   MAGE_TREE_DEST        target destination of the generated tree  #   MAGE_TREE_DEST        target destination of the generated tree
680  #   REGEN_MAGE_TREE       set to 'true' to enable this  #   REGEN_MAGE_TREE       set to 'true' to enable this
# Line 659  build_mage_script() Line 685  build_mage_script()
685   local magefile   local magefile
686   local dest   local dest
687   local target   local target
688     local split_pkg_base
689   local sym   local sym
690   local depname   local depname
691    
# Line 666  build_mage_script() Line 693  build_mage_script()
693   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
694    
695   # determinate which suffix this mage file should get, if any   # determinate which suffix this mage file should get, if any
696   [ -n "$1" ] && target="-$1"   [[ $1 = --target ]] && shift && target="-$1"
697    
698     # mark package as splitpackage
699     [[ $1 = --split-pkg-base ]] && shift && split_pkg_base="$1"
700    
701   # name of magefile   # name of magefile
702   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"   magefile="${PNAME}${target}-${PVER}-${PBUILD}.mage"
# Line 683  build_mage_script() Line 713  build_mage_script()
713   > ${dest}   > ${dest}
714    
715   # header   # header
716   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}
717   echo  >> ${dest}   echo  >> ${dest}
718    
719   # pgkname and state   # pgkname and state
# Line 703  build_mage_script() Line 733  build_mage_script()
733   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}   echo "MAGE_TARGETS=\"${target}\"" >> ${dest}
734   echo >> ${dest}   echo >> ${dest}
735    
736     # split package base
737     echo "SPLIT_PACKAGE_BASE=\"${split_pkg_base}\"" >> ${dest}
738     echo >> ${dest}
739    
740   # add special vars   # add special vars
741   if [ -n "${SPECIAL_VARS}" ]   if [ -n "${SPECIAL_VARS}" ]
742   then   then
# Line 770  regen_mage_tree() Line 804  regen_mage_tree()
804   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
805   then   then
806   # run it without targets   # run it without targets
807   if [ -z "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
808   then   then
809     # build for each target a mage file
810     # run it with several targets
811   echo   echo
812   build_mage_script   for i in ${MAGE_TARGETS}
813     do
814     build_mage_script --target "${i}"
815     done
816   echo   echo
  else  
817    
818   # build for each target an mage file   # run it for splitpackages
819     elif [[ -n ${SPLIT_PACKAGES} ]]
820     then
821     local split_pkg_base="${PNAME}"
822     # save smage environment
823     split_save_variables
824     # build for each subpackage a mage file
825   # run it with several targets   # run it with several targets
826   for i in ${MAGE_TARGETS}   echo
827     for i in ${SPLIT_PACKAGES}
828   do   do
829   echo   # get the right variables for the split
830   build_mage_script "${i}"   export PNAME="${i}"
831   echo   split_info_${i}
832     build_mage_script --split-pkg-base "${split_pkg_base}"
833     # restore smage environment
834     split_restore_variables
835   done   done
836     echo
837     # unset all saved smage variables
838     split_unset_variables
839    
840     else
841     echo
842     build_mage_script
843     echo
844   fi   fi
845   fi   fi
846    
# Line 815  regen_mage_tree() Line 871  regen_mage_tree()
871   unset postremove   unset postremove
872  }  }
873    
874    split_save_variables()
875    {
876     export SAVED_PNAME="${PNAME}"
877     export SAVED_PVER="${PVER}"
878     export SAVED_PBUILD="${PBUILD}"
879     export SAVED_PCATEGORIE="${PCATEGORIE}"
880     export SAVED_DESCRIPTION="${DESCRIPTION}"
881     export SAVED_HOMEPAGE="${HOMEPAGE}"
882     export SAVED_SPECIAL_VARS="${SPECIAL_VARS}"
883     export SAVED_STATE="${STATE}"
884     export SAVED_PKGTYPE="${PKGTYPE}"
885     export SAVED_INHERITS="${INHERITS}"
886     export SAVED_DEPEND="${DEPEND}"
887     export SAVED_SDEPEND="${SDEPEND}"
888     export SAVED_PROVIDE="${PROVIDE}"
889     export SAVED_NOPKGBUILD="${NOPKGBUILD}"
890    
891     # bindir too
892     export SAVED_BINDIR="${BINDIR}"
893    
894     # export the SPLIT_PACKAGE_BASE
895     export SPLIT_PACKAGE_BASE="${SAVED_PNAME}"
896    
897     # functions
898     if [[ ! -z $(typeset -f preinstall) ]]
899     then
900     # rename the old one
901     local saved_preinstall
902     saved_preinstall=SAVED_$(typeset -f preinstall)
903     eval "${saved_preinstall}"
904     export -f SAVED_preinstall
905     fi
906    
907     if [[ ! -z $(typeset -f postinstall) ]]
908     then
909     # rename the old one
910     local saved_postinstall
911     saved_postinstall=SAVED_$(typeset -f postinstall)
912     eval "${saved_postinstall}"
913     export -f SAVED_postinstall
914     fi
915    
916     if [[ ! -z $(typeset -f preremove) ]]
917     then
918     # rename the old one
919     local saved_preremove
920     saved_preremove=SAVED_$(typeset -f preremove)
921     eval "${saved_preremove}"
922     export -f SAVED_preremove
923     fi
924    
925     if [[ ! -z $(typeset -f postremove) ]]
926     then
927     # rename the old one
928     local saved_postremove
929     saved_postremove=SAVED_$(typeset -f postremove)
930     eval "${saved_postremove}"
931     export -f SAVED_postremove
932     fi
933    }
934    
935    split_restore_variables()
936    {
937     export PNAME="${SAVED_PNAME}"
938     export PVER="${SAVED_PVER}"
939     export PBUILD="${SAVED_PBUILD}"
940     export PCATEGORIE="${SAVED_PCATEGORIE}"
941     export DESCRIPTION="${SAVED_DESCRIPTION}"
942     export HOMEPAGE="${SAVED_HOMEPAGE}"
943     export SPECIAL_VARS="${SAVED_SPECIAL_VARS}"
944     export STATE="${SAVED_STATE}"
945     export PKGTYPE="${SAVED_PKGTYPE}"
946     export INHERITS="${SAVED_INHERITS}"
947     export DEPEND="${SAVED_DEPEND}"
948     export SDEPEND="${SAVED_SDEPEND}"
949     export PROVIDE="${SAVED_PROVIDE}"
950     export NOPKGBUILD="${SAVED_NOPKGBUILD}"
951    
952     # bindir too
953     export BINDIR="${SAVED_BINDIR}"
954    
955     # functions
956     if [[ ! -z $(typeset -f SAVED_preinstall) ]]
957     then
958     # rename the old one
959     local saved_preinstall
960     saved_preinstall=$(typeset -f SAVED_preinstall)
961     eval "${saved_preinstall/SAVED_/}"
962     export -f preinstall
963     fi
964    
965     if [[ ! -z $(typeset -f SAVED_postinstall) ]]
966     then
967     # rename the old one
968     local saved_postinstall
969     saved_postinstall=$(typeset -f SAVED_postinstall)
970     eval "${saved_postinstall/SAVED_/}"
971     export -f postinstall
972     fi
973    
974     if [[ ! -z $(typeset -f SAVED_preremove) ]]
975     then
976     # rename the old one
977     local saved_preremove
978     saved_preremove=$(typeset -f SAVED_preremove)
979     eval "${saved_preremove/SAVED_/}"
980     export -f preremove
981     fi
982    
983     if [[ ! -z $(typeset -f SAVED_postremove) ]]
984     then
985     # rename the old one
986     local saved_postremove
987     saved_postremove=$(typeset -f SAVED_postremove)
988     eval "${saved_postremove/SAVED_/}"
989     export -f postremove
990     fi
991    }
992    
993    split_unset_variables()
994    {
995     # unset saved vars; not needed anymore
996     unset SAVED_PNAME
997     unset SAVED_PVER
998     unset SAVED_PBUILD
999     unset SAVED_PCATEGORIE
1000     unset SAVED_DESCRIPTION
1001     unset SAVED_HOMEPAGE
1002     unset SAVED_SPECIAL_VARS
1003     unset SAVED_STATE
1004     unset SAVED_PKGTYPE
1005     unset SAVED_INHERITS
1006     unset SAVED_DEPEND
1007     unset SAVED_SDEPEND
1008     unset SAVED_PROVIDE
1009     unset SAVED_BINDIR
1010     unset SAVED_NOPKGBUILD
1011     unset SPLIT_PACKAGE_BASE
1012     unset -f SAVED_preinstall
1013     unset -f SAVED_postinstall
1014     unset -f SAVED_preremove
1015     unset -f SAVED_postremove
1016    }
1017    
1018  export_inherits()  export_inherits()
1019  {  {
1020   local include="$1"   local include="$1"
# Line 876  generate_package_md5sum() Line 1076  generate_package_md5sum()
1076   # fix target as it may be empty !   # fix target as it may be empty !
1077   [ -n "${target}" ] && target="-${target}"   [ -n "${target}" ] && target="-${target}"
1078    
1079    
1080   # build pkgname   # build pkgname
1081   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1082    
# Line 895  generate_package_md5sum() Line 1096  generate_package_md5sum()
1096   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}   : ${MAGE_TREE_DEST=${BUILDDIR}/mage-tree}
1097    
1098   # setup md5 dir   # setup md5 dir
1099   dest="${MAGE_TREE_DEST}/${pcat}/${pname}/md5"   dest="${MAGE_TREE_DEST}/${pcat}/${pname}${target}/md5"
1100   install -d ${dest}   install -d ${dest}
1101    
1102   # gen md5sum   # gen md5sum
# Line 933  source_pkg_build() Line 1134  source_pkg_build()
1134   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}"
1135  }  }
1136    
1137    step_by_step()
1138    {
1139     if [[ ${STEP_BY_STEP} = true ]]
1140     then
1141     echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1142     echo "Press [enter] to continue"
1143     read
1144     fi
1145    }
1146    
1147    
1148  # print out our version  # print out our version
1149  showversion  showversion
# Line 1053  then Line 1264  then
1264    
1265   regen_mage_tree   regen_mage_tree
1266    
1267   # build md5sum for existing packages   # build several targets
1268   generate_package_md5sum \   if [[ -n ${MAGE_TARGETS} ]]
1269   --pcat "${PCATEGORIE}" \   then
1270   --pname "${PNAME}" \   for target in ${MAGE_TARGETS}
1271   --pver "${PVER}" \   do
1272   --pbuild "${PBUILD}" \   # build md5sum for existing packages
1273   --parch "${ARCH}" \   generate_package_md5sum \
1274   --target "${target}"   --pcat "${PCATEGORIE}" \
1275     --pname "${PNAME}" \
1276     --pver "${PVER}" \
1277     --pbuild "${PBUILD}" \
1278     --parch "${ARCH}" \
1279     --target "${target}"
1280     done
1281    
1282     # build several subpackages
1283     elif [[ -n ${SPLIT_PACKAGES} ]]
1284     then
1285     split_save_variables
1286     for subpackage in ${SPLIT_PACKAGES}
1287     do
1288     # get the right variables for the split
1289     export PNAME="${subpackage}"
1290     split_info_${subpackage}
1291     # build md5sum for existing packages
1292     generate_package_md5sum \
1293     --pcat "${PCATEGORIE}" \
1294     --pname "${PNAME}" \
1295     --pver "${PVER}" \
1296     --pbuild "${PBUILD}" \
1297     --parch "${ARCH}"
1298     # restore smage environment
1299     split_restore_variables
1300     done
1301     # unset all saved smage variables
1302     split_unset_variables
1303    
1304     else
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     fi
1313    
1314   exit 0   exit 0
1315  fi  fi
# Line 1125  fi Line 1374  fi
1374  source ${SMAGENAME} || die "source failed"  source ${SMAGENAME} || die "source failed"
1375  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"  PKGNAME="${PNAME}-${PVER}-${ARCH}-${PBUILD}"
1376  MD5DIR="$(dirname ${SMAGENAME})/md5"  MD5DIR="$(dirname ${SMAGENAME})/md5"
1377    SMAGE_LOG_CMD="tee -a /var/log/smage/${PKGNAME}.log"
1378    
1379  xtitle "Compiling ${PKGNAME}"  xtitle "Compiling ${PKGNAME}"
1380  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"  echo -e "${COLGREEN}Compiling ${PKGNAME}${COLDEFAULT}"
# Line 1199  then Line 1449  then
1449   mage rmstamp   mage rmstamp
1450  fi  fi
1451    
1452  src_prepare || die "src_prepare failed"  # setup build loggins
1453  src_compile || die "src_compile failed"  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1454  src_install || die "src_install failed"  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1455    
1456    src_prepare | ${SMAGE_LOG_CMD}
1457    die_pipestatus 0 "src_prepare failed"
1458    step_by_step $_
1459    
1460    src_compile | ${SMAGE_LOG_CMD}
1461    die_pipestatus 0 "src_compile failed"
1462    step_by_step $_
1463    
1464  # compressing doc, info & man files  # build several subpackages
1465  if [ -d ${BUILDDIR}/builded/usr/share/man ]  if [[ -n ${SPLIT_PACKAGES} ]]
1466  then  then
1467   echo -e "${COLBLUE}===${COLGREEN} compressing man-pages ...${COLDEFAULT}"   # save bindir & pname
1468   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/man   split_save_variables
1469     export SAVED_BINDIR="${BINDIR}"
1470     for subpackage in ${SPLIT_PACKAGES}
1471     do
1472     if typeset -f src_install_${subpackage} > /dev/null
1473     then
1474     # export subpackage bindir
1475     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1476     # export PNAME, several internal function and include
1477     # rely on this variable
1478     export PNAME="${subpackage}"
1479    
1480     echo
1481     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1482     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1483     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1484     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1485    
1486     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1487     die_pipestatus 0 "src_install_${subpackage} failed"
1488     step_by_step $_
1489     fi
1490     done
1491     # restore bindir & pname
1492     split_restore_variables
1493     # unset all saved smage variables
1494     split_unset_variables
1495    else
1496     src_install | ${SMAGE_LOG_CMD}
1497     die_pipestatus 0 "src_install failed"
1498     step_by_step $_
1499  fi  fi
1500    
1501  if [ -d ${BUILDDIR}/builded/usr/share/info ]  # compressing doc, info & man files
1502    if [[ -n ${SPLIT_PACKAGES} ]]
1503  then  then
1504   echo -e "${COLBLUE}===${COLGREEN} compressing info-pages ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1505   ${MLIBDIR}/compressdoc -g -9 ${BUILDDIR}/builded/usr/share/info   do
1506     mcompressdocs ${BINDIR}_${subpackage}
1507     done
1508    else
1509     mcompressdocs ${BINDIR}
1510  fi  fi
1511    
1512    
1513  # stripping all bins and libs  # stripping all bins and libs
1514  case ${NOSTRIP} in  case ${NOSTRIP} in
1515   true|TRUE|yes|y)   true|TRUE|yes|y)
1516   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "NOSTRIP=true detected; Package will not be stripped ..."
1517   ;;   ;;
1518   *)   *)
1519   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   if [[ -n ${SPLIT_PACKAGES} ]]
1520   mstripbins ${BINDIR}   then
1521   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1522   mstriplibs ${BINDIR}   do
1523     echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1524     mstripbins ${BINDIR}_${subpackage}
1525     echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"
1526     mstriplibs ${BINDIR}_${subpackage}
1527     done
1528     else
1529     echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1530     mstripbins ${BINDIR}
1531     echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"
1532     mstriplibs ${BINDIR}
1533     fi
1534   ;;   ;;
1535  esac  esac
1536    
# Line 1237  case ${NOPKGBUILD} in Line 1541  case ${NOPKGBUILD} in
1541   ;;   ;;
1542   *)   *)
1543   # build several targets   # build several targets
1544   if [ -n "${MAGE_TARGETS}" ]   if [[ -n ${MAGE_TARGETS} ]]
1545   then   then
1546   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1547   do   do
# Line 1263  case ${NOPKGBUILD} in Line 1567  case ${NOPKGBUILD} in
1567    
1568   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}"
1569   done   done
1570    
1571     # build several subpackages
1572     elif [[ -n ${SPLIT_PACKAGES} ]]
1573     then
1574     split_save_variables
1575     for subpackage in ${SPLIT_PACKAGES}
1576     do
1577     # get the right variables for the split
1578     export PNAME="${subpackage}"
1579     split_info_${PNAME}
1580    
1581     # jump to next one if NOPKGBUILD is set in split_info
1582     case ${NOPKGBUILD} in
1583     true|TRUE|yes|y) continue ;;
1584     esac
1585    
1586     # check if an special subpackage_pkgbuild exists
1587     if typeset -f ${PNAME}_pkgbuild > /dev/null
1588     then
1589     # run it
1590     ${PNAME}_pkgbuild
1591     fi
1592     # now create the target package
1593     ${MLIBDIR}/pkgbuild_dir.sh \
1594     "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1595     "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1596    
1597     # build pkg-md5-sum if requested
1598     generate_package_md5sum \
1599     --pcat "${PCATEGORIE}" \
1600     --pname "${PNAME}" \
1601     --pver "${PVER}" \
1602     --pbuild "${PBUILD}" \
1603     --parch "${ARCH}"
1604    
1605     echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1606    
1607     # restore smage environment
1608     split_restore_variables
1609     done
1610     # unset all saved smage variables
1611     split_unset_variables
1612    
1613   else   else
1614   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1615    
# Line 1282  case ${NOPKGBUILD} in Line 1629  case ${NOPKGBUILD} in
1629   ;;   ;;
1630  esac  esac
1631    
1632    if [[ ${SMAGE_BUILD_LOGGING} != false ]]
1633    then
1634     bzip2 -9f /var/log/smage/${PKGNAME}.log
1635    else
1636     [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1637    fi
1638    
1639  # for sure  # for sure
1640  unset NOPKGBUILD  unset NOPKGBUILD
1641  unset NOSTRIP  unset NOSTRIP

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