Magellan Linux

Diff of /branches/mage-next/src/smage2.sh

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

revision 1580 by niro, Wed Dec 28 11:58:28 2011 UTC revision 1617 by niro, Mon Jan 9 20:13:34 2012 UTC
# Line 10  Line 10 
10  # set default user mage.rc  # set default user mage.rc
11  : ${MAGERC="/etc/mage.rc"}  : ${MAGERC="/etc/mage.rc"}
12    
 ## setup ##  
 SMAGENAME="$1"  
 SMAGEVERSION="$( < ${MLIBDIR}/version)"  
   
13  # export default C locale  # export default C locale
14  export LC_ALL=C  export LC_ALL=C
15    
# Line 21  source /etc/mage.rc.global Line 17  source /etc/mage.rc.global
17  source ${MAGERC}  source ${MAGERC}
18  source ${MLIBDIR}/mage4.functions.sh  source ${MLIBDIR}/mage4.functions.sh
19    
20    ## setup ##
21    SMAGENAME="$1"
22    SMAGEVERSION="$(< ${MLIBDIR}/version)"
23    
24  # set PKGDIR and BUILDDIR and BINDIR to MROOT  # set PKGDIR and BUILDDIR and BINDIR to MROOT
25  if [[ -n ${MROOT} ]]  if [[ -n ${MROOT} ]]
26  then  then
# Line 177  download_sources() Line 177  download_sources()
177   fi   fi
178    
179   echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}"   echo -e "${COLBLUE}==>${COLGREEN} fetching ${uri}${COLDEFAULT}"
180   mdownload --uri "${uri}" --dir "${outputdir}" || die "Could not download '${uri}'"   # do not die here, mchecksum catches download errors
181     mdownload --uri "${uri}" --dir "${outputdir}"
182    
183   # unset them to be sure   # unset them to be sure
184   unset uri   unset uri
# Line 201  download_sources() Line 202  download_sources()
202  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
203  src_prepare()  src_prepare()
204  {  {
205   echo "no src_prepare defined"   echo "no src_prepare defined; doing nothing ..."
206   return 0   return 0
207  }  }
208    
209  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
210  src_compile()  src_compile()
211  {  {
212   echo "no src_compile defined"   echo "no src_compile defined; doing nothing ..."
213   return 0   return 0
214  }  }
215    
216  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
217  src_check()  src_check()
218  {  {
219   echo "no src_check defined"   echo "no src_check defined; doing nothing ..."
220   return 0   return 0
221  }  }
222    
223  # dummy function, used if that does not exist in smage file  # dummy function, used if that does not exist in smage file
224  src_install()  src_install()
225  {  {
226   echo "no src_install defined"   echo "no src_install defined; doing nothing ..."
227   return 0   return 0
228  }  }
229    
# Line 236  mlibdir() Line 237  mlibdir()
237    
238  mconfigure()  mconfigure()
239  {  {
240     local myopts
241     if [[ ! -z ${CTARGET} ]]
242     then
243     myopts="--target=${CTARGET}"
244     fi
245    
246   if [ -x ./configure ]   if [ -x ./configure ]
247   then   then
248   ./configure \   ./configure \
# Line 248  mconfigure() Line 255  mconfigure()
255   --sysconfdir=/etc \   --sysconfdir=/etc \
256   --localstatedir=/var/lib \   --localstatedir=/var/lib \
257   --libdir=/usr/$(mlibdir) \   --libdir=/usr/$(mlibdir) \
258     ${myopts} \
259   "$@" || die "mconfigure failed"   "$@" || die "mconfigure failed"
260   else   else
261   echo "configure is not an executable ..."   echo "configure is not an executable ..."
# Line 343  munpack() Line 351  munpack()
351   rar)   rar)
352   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."   unrar x ${SOURCEDIR}/${PNAME}/${SRCFILE} ${DEST}  || die ".rar unpack failed."
353   ;;   ;;
354   zip|xpi)   zip|xpi|jar)
355   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."   unzip ${SOURCEDIR}/${PNAME}/${SRCFILE} -d ${DEST} || die ".zip unpack failed."
356   ;;   ;;
357   rpm)   rpm)
# Line 409  mautoreconf() Line 417  mautoreconf()
417  minstalldocs()  minstalldocs()
418  {  {
419   local docfiles   local docfiles
420     local doc
421   docfiles="$@"   docfiles="$@"
422    
423   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]   if [ ! -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} ]
# Line 416  minstalldocs() Line 425  minstalldocs()
425   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."   install -d ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "creating doc dirs."
426   fi   fi
427    
428   local i   for doc in ${docfiles}
  for i in ${docfiles}  
429   do   do
430   if [ -f ${i} ]   if [ -f ${doc} ]
431   then   then
432   cat ${i} | gzip -9c > ${i}.gz || die "gzipping docs."   if mqueryfeature "compressdoc"
433   install -m 0644 ${SRCDIR}/${i}.gz \   then
434   ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "coping docs."   cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "gzipping +installing ${doc}."
435     chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "fixing permissions of ${doc}."
436     else
437     install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."
438     fi
439   fi   fi
440   done   done
441  }  }
# Line 460  mstriplibtoolarchive() Line 472  mstriplibtoolarchive()
472   local stripdir="$@"   local stripdir="$@"
473    
474   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"   [[ -z ${stripdir} ]] && stripdir="${BINDIR}"
475   find ${stripdir} ! -type d -name \*.la | xargs file | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null   find ${stripdir} ! -type d -name \*.la | xargs | grep "libtool library" | cut -f 1 -d : | xargs --no-run-if-empty rm -f -- 2> /dev/null
476  }  }
477    
478  mpurgetargets()  mpurgetargets()
# Line 540  setup_ccache_environment() Line 552  setup_ccache_environment()
552   fi   fi
553  }  }
554    
   
555  # fixes given dependencies to match a MAGE_TARGET  # fixes given dependencies to match a MAGE_TARGET
556  # fix_mage_deps -target s/depend # <-- note -target !  # fix_mage_deps -target s/depend # <-- note -target !
557  fix_mage_deps()  fix_mage_deps()
# Line 727  regen_mage_tree() Line 738  regen_mage_tree()
738   local subpackage   local subpackage
739    
740   # build them only if requested   # build them only if requested
741   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
742   then   then
743   # run it without targets   # run it without targets
744   if [[ -n ${MAGE_TARGETS} ]]   if [[ -n ${MAGE_TARGETS} ]]
# Line 790  regen_mage_tree() Line 801  regen_mage_tree()
801   unset STATE   unset STATE
802   unset DESCRIPTION   unset DESCRIPTION
803   unset HOMEPAGE   unset HOMEPAGE
804   unset PKGTYPE   # unset PKGTYPE <-- don't do that either; smage needs this var
805   unset INHERITS   unset INHERITS
806   unset DEPEND   unset DEPEND
807   unset SDEPEND   unset SDEPEND
# Line 816  split_save_variables() Line 827  split_save_variables()
827   export SAVED_DEPEND="${DEPEND}"   export SAVED_DEPEND="${DEPEND}"
828   export SAVED_SDEPEND="${SDEPEND}"   export SAVED_SDEPEND="${SDEPEND}"
829   export SAVED_PROVIDE="${PROVIDE}"   export SAVED_PROVIDE="${PROVIDE}"
830   export SAVED_NOPKGBUILD="${NOPKGBUILD}"   export SAVED_PKGTYPE="${PKGTYPE}"
831    
832     # special handling needed for mage features
833     # pkgbuild
834     mqueryfeature "pkgbuild" && export SAVED_FEATURE_PKGBUILD="pkgbuild"
835     mqueryfeature "!pkgbuild" && export SAVED_FEATURE_PKGBUILD="!pkgbuild"
836     # strip
837     mqueryfeature "strip" && export SAVED_FEATURE_STRIP="strip"
838     mqueryfeature "!strip" && export SAVED_FEATURE_STRIP="!strip"
839     # libtool
840     mqueryfeature "libtool" && export SAVED_FEATURE_LIBTOOL="libtool"
841     mqueryfeature "!libtool" && export SAVED_FEATURE_LIBTOOL="!libtool"
842     # compressdoc
843     mqueryfeature "compressdoc" && export SAVED_FEATURE_COMPRESSDOC="compressdoc"
844     mqueryfeature "!compressdoc" && export SAVED_FEATURE_COMPRESSDOC="!compressdoc"
845    
846   # bindir too   # bindir too
847   export SAVED_BINDIR="${BINDIR}"   export SAVED_BINDIR="${BINDIR}"
# Line 877  split_restore_variables() Line 902  split_restore_variables()
902   export DEPEND="${SAVED_DEPEND}"   export DEPEND="${SAVED_DEPEND}"
903   export SDEPEND="${SAVED_SDEPEND}"   export SDEPEND="${SAVED_SDEPEND}"
904   export PROVIDE="${SAVED_PROVIDE}"   export PROVIDE="${SAVED_PROVIDE}"
905   export NOPKGBUILD="${SAVED_NOPKGBUILD}"   export PKGTYPE="${SAVED_PKGTYPE}"
906    
907     # special handling needed for mage features
908     # pkgbuild
909     FVERBOSE=off msetfeature "${SAVED_FEATURE_PKGBUILD}"
910     # strip
911     FVERBOSE=off msetfeature "${SAVED_FEATURE_STRIP}"
912     # libtool
913     FVERBOSE=off msetfeature "${SAVED_FEATURE_LIBTOOL}"
914     # compressdoc
915     FVERBOSE=off msetfeature "${SAVED_FEATURE_COMPRESSDOC}"
916    
917   # bindir too   # bindir too
918   export BINDIR="${SAVED_BINDIR}"   export BINDIR="${SAVED_BINDIR}"
# Line 937  split_unset_variables() Line 972  split_unset_variables()
972   unset SAVED_SDEPEND   unset SAVED_SDEPEND
973   unset SAVED_PROVIDE   unset SAVED_PROVIDE
974   unset SAVED_BINDIR   unset SAVED_BINDIR
975   unset SAVED_NOPKGBUILD   unset SAVED_PKGTYPE
976     unset SAVED_FEATURE_PKGBUILD
977     unset SAVED_FEATURE_STRIP
978     unset SAVED_FEATURE_LIBTOOL
979     unset SAVED_FEATURE_COMPRESSDOC
980   unset SPLIT_PACKAGE_BASE   unset SPLIT_PACKAGE_BASE
981   unset -f SAVED_preinstall   unset -f SAVED_preinstall
982   unset -f SAVED_postinstall   unset -f SAVED_postinstall
# Line 1037  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   # build pkgname   # build pkgname
1080   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"   pkgname="${pname}${target}-${pver}-${parch}-${pbuild}"
1081    
1082   # build pkg-md5-sum only if requested   # build pkg-md5-sum only if requested
1083   if [[ ${REGEN_MAGE_TREE} = true ]]   if mqueryfeature regentree
1084   then   then
1085   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"   echo -ne "${COLBLUE}===${COLGREEN} generating md5's for ${pkgname}.${PKGSUFFIX} ... ${COLDEFAULT}"
1086    
# Line 1097  source_pkg_build() Line 1135  source_pkg_build()
1135    
1136  step_by_step()  step_by_step()
1137  {  {
1138   if [[ ${STEP_BY_STEP} = true ]]   if mqueryfeature stepbystep
1139   then   then
1140   echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"   echo -e "${COLRED}Step-by-step enabled! Paused after $1.${COLDEFAULT}"
1141   echo "Press [enter] to continue"   echo "Press [enter] to continue"
# Line 1105  step_by_step() Line 1143  step_by_step()
1143   fi   fi
1144  }  }
1145    
1146    resume_stamp()
1147    {
1148     local step="$1"
1149     touch ${BUILDDIR}/.smage-${PKGNAME}-${step}
1150    }
1151    
1152    run_resume()
1153    {
1154     local step="$1"
1155    
1156     if mqueryfeature "resume" && [[ -f ${BUILDDIR}/.smage-${PKGNAME}-${step} ]]
1157     then
1158     echo -e "${COLMAGENTA}${step} already processed; doing nothing${COLDEFAULT}"
1159     return 0
1160     else
1161     return 1
1162     fi
1163    }
1164    
1165  # print out our version  # print out our version
1166  showversion  showversion
# Line 1117  then Line 1173  then
1173   exit 1   exit 1
1174  fi  fi
1175    
1176    # load supported mage features
1177    load_mage_features
1178    
1179  # updating smage2-scripts  # updating smage2-scripts
1180  if [[ $1 = update ]]  if [[ $1 = update ]]
1181  then  then
# Line 1301  fi Line 1360  fi
1360  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]  if [ "$1" == "--src-tarball" -a -n "$2" ] || [ "$1" == "-st" -a -n "$2" ]
1361  then  then
1362   SRCPKGTARBALL="${2}"   SRCPKGTARBALL="${2}"
1363   USE_SRC_PKG_TARBALL=true   msetfeature "srcpkgtarball"
1364    
1365   # abort if given file is not a source pkg   # abort if given file is not a source pkg
1366   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."   [[ ${SRCPKGTARBALL##*.} != ${SRCPKGSUFFIX} ]] && die "${SRCPKGTARBALL} is not a valid src-pkg file."
# Line 1322  then Line 1381  then
1381   [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"   [[ ! -f ${SMAGENAME} ]] && die "Included smage2 file in src-tarball not found: ${SMAGENAME}"
1382  fi  fi
1383    
1384    if [ "$1" == "--resume" -a -n "$2" ]
1385    then
1386     msetfeature "resume"
1387     SMAGENAME="$2"
1388    fi
1389    
1390  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."  [ ! -e ${MLIBDIR}/pkgbuild_dir.sh ] && die "Error: ${MLIBDIR}/pkgbuild_dir.sh not found. Aborting."
1391  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&  [ -z "$(basename ${SMAGENAME} | grep .${SMAGESUFFIX})" ] &&
# Line 1345  echo -e "${COLGREEN}Compiling ${PKGNAME} Line 1409  echo -e "${COLGREEN}Compiling ${PKGNAME}
1409  # auto regen mage tree if requested  # auto regen mage tree if requested
1410  regen_mage_tree  regen_mage_tree
1411    
1412  if [[ ${CREATE_SRC_PKG_TARBALL} = true ]]  if mqueryfeature "srcpkg"
1413  then  then
1414   if [[ -d ${SOURCEDIR}/${PNAME} ]]   if [[ -d ${SOURCEDIR}/${PNAME} ]]
1415   then   then
# Line 1355  then Line 1419  then
1419  fi  fi
1420    
1421  # download sources  # download sources
1422  [[ ${USE_SRC_PKG_TARBALL} != true ]] && download_sources  mqueryfeature "srcpkgtarball" || download_sources
1423    
1424  # fixes some issues with these functions  # fixes some issues with these functions
1425  export -f src_prepare || die "src_prepare export failed"  export -f src_prepare || die "src_prepare export failed"
# Line 1366  export -f src_install || die "src_instal Line 1430  export -f src_install || die "src_instal
1430  # fixes some compile issues  # fixes some compile issues
1431  export CHOST="${CHOST}" || die "CHOST export failed"  export CHOST="${CHOST}" || die "CHOST export failed"
1432  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"
1433  export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"  if [[ -z ${CXXFLAGS} ]]
1434    then
1435     export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"
1436    else
1437     export CXXFLAGS="${CXXFLAGS}" || die "CXXFLAGS export failed"
1438    fi
1439    export LDFLAGS="${LDFLAGS}" || die "LDFLAGS export failed"
1440  export BINDIR="${BINDIR}" || die "BINDIR export failed"  export BINDIR="${BINDIR}" || die "BINDIR export failed"
1441  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"
1442    
   
1443  # setup distcc  # setup distcc
1444  # setup for distcc goes *before* ccache, so ccache comes before distcc in path  # setup for distcc goes *before* ccache, so ccache comes before distcc in path
1445  [[ ${SMAGE_USE_DISTCC} = true ]] && setup_distcc_environment  mqueryfeature "distcc" && setup_distcc_environment
1446    
1447  # setup ccache  # setup ccache
1448  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  mqueryfeature "ccache" && setup_ccache_environment
1449    
1450  # clean up builddir if a previously one exist  if mqueryfeature "resume"
 if [ -d ${BUILDDIR} ]  
1451  then  then
1452   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   echo -e "${COLMAGENTA}Resume requested; continuing previous build${COLDEFAULT}"
 fi  
 install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  
1453    
1454  # clean up srcdir if a previously unpacked one exist   # setup build logging
1455  if [ -d ${SRCDIR} ]   [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1456  then   if [[ -f /var/log/smage/${PKGNAME}.log.bz2 ]]
1457   rm -rf ${SRCDIR}   then
1458  fi   bunzip2 -f /var/log/smage/${PKGNAME}.log.bz2
1459     fi
1460     echo -e "### Resume started on $(date) ###\n" >> /var/log/smage/${PKGNAME}.log
1461    
1462  # clean up bindir if a previous build exist or create a new one  else
1463  if [ -d ${BINDIR} ]   # clean up builddir if a previously one exist
1464  then   if [ -d ${BUILDDIR} ]
1465   rm -rf ${BINDIR}   then
1466  fi   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1467  install -d ${BINDIR} || die "couldn't create \$BINDIR."   fi
1468     install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1469    
1470  # clean up package temp dir if a previous build exist   # clean up srcdir if a previously unpacked one exist
1471  if [ -d ${BUILDDIR}/${PKGNAME} ]   if [ -d ${SRCDIR} ]
1472  then   then
1473   rm -rf ${BUILDDIR}/${PKGNAME}   rm -rf ${SRCDIR}
1474  fi   fi
1475    
1476  # setup build logging   # clean up bindir if a previous build exist or create a new one
1477  [[ ! -d /var/log/smage ]] && install -d /var/log/smage   if [ -d ${BINDIR} ]
1478  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log   then
1479     rm -rf ${BINDIR}
1480  src_prepare | ${SMAGE_LOG_CMD}   fi
1481  die_pipestatus 0 "src_prepare failed"   install -d ${BINDIR} || die "couldn't create \$BINDIR."
 step_by_step $_  
   
 src_compile | ${SMAGE_LOG_CMD}  
 die_pipestatus 0 "src_compile failed"  
 step_by_step $_  
1482    
1483  # only run checks if requested   # clean up package temp dir if a previous build exist
1484  if [[ ${MAGE_CHECK} != true ]]   if [ -d ${BUILDDIR}/${PKGNAME} ]
1485  then   then
1486   echo "MAGE_CHECK not requested; src_check() will not be run!" | ${SMAGE_LOG_CMD}   rm -rf ${BUILDDIR}/${PKGNAME}
1487   step_by_step src_check   fi
1488  else  
1489   src_check | ${SMAGE_LOG_CMD}   # setup build logging
1490   die_pipestatus 0 "src_check failed"   [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1491   step_by_step $_   echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1492  fi  fi
1493    
1494  # build several subpackages  if [[ ${PKGTYPE} = virtual ]]
 if [[ -n ${SPLIT_PACKAGES} ]]  
1495  then  then
1496   # save bindir & pname   echo "virtual package detected; nothing will be build ..."
1497   split_save_variables   # automatically set !pkgbuild here too
1498   export SAVED_BINDIR="${BINDIR}"   msetfeature "!pkgbuild"
  for subpackage in ${SPLIT_PACKAGES}  
  do  
  if typeset -f src_install_${subpackage} > /dev/null  
  then  
  # export subpackage bindir  
  export BINDIR="${SAVED_BINDIR}_${subpackage}"  
  # export PNAME, several internal function and include  
  # rely on this variable  
  export PNAME="${subpackage}"  
   
  echo  
  echo -en "${COLBLUE}*** ${COLDEFAULT}"  
  echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"  
  echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"  
  echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."  
   
  src_install_${subpackage} | ${SMAGE_LOG_CMD}  
  die_pipestatus 0 "src_install_${subpackage} failed"  
  step_by_step $_  
  fi  
  done  
  # restore bindir & pname  
  split_restore_variables  
  # unset all saved smage variables  
  split_unset_variables  
1499  else  else
1500   src_install | ${SMAGE_LOG_CMD}   ( run_resume src_prepare || src_prepare ) | ${SMAGE_LOG_CMD}
1501   die_pipestatus 0 "src_install failed"   die_pipestatus 0 "src_prepare failed"
1502   step_by_step $_   resume_stamp src_prepare
1503     step_by_step src_prepare
1504    
1505     ( run_resume src_compile || src_compile ) | ${SMAGE_LOG_CMD}
1506     die_pipestatus 0 "src_compile failed"
1507     resume_stamp src_compile
1508     step_by_step src_compile
1509    
1510     # only run checks if requested
1511     if mqueryfeature "!check"
1512     then
1513     echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1514     else
1515     ( run_resume src_check || src_check ) | ${SMAGE_LOG_CMD}
1516     die_pipestatus 0 "src_check failed"
1517     resume_stamp src_check
1518     fi
1519     step_by_step src_check
1520    
1521     # build several subpackages
1522     if [[ -n ${SPLIT_PACKAGES} ]]
1523     then
1524     # save bindir & pname
1525     split_save_variables
1526     export SAVED_BINDIR="${BINDIR}"
1527     for subpackage in ${SPLIT_PACKAGES}
1528     do
1529     if typeset -f src_install_${subpackage} > /dev/null
1530     then
1531     # export subpackage bindir
1532     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1533     # export PNAME, several internal function and include
1534     # rely on this variable
1535     export PNAME="${subpackage}"
1536    
1537     echo
1538     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1539     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1540     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1541     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1542    
1543     ( run_resume src_install_${subpackage} || src_install_${subpackage} ) | ${SMAGE_LOG_CMD}
1544     die_pipestatus 0 "src_install_${subpackage} failed"
1545     resume_stamp src_install_${subpackage}
1546     step_by_step src_install_${subpackage}
1547     fi
1548     done
1549     # restore bindir & pname
1550     split_restore_variables
1551     # unset all saved smage variables
1552     split_unset_variables
1553     else
1554     ( run_resume src_install || src_install ) | ${SMAGE_LOG_CMD}
1555     die_pipestatus 0 "src_install failed"
1556     resume_stamp src_install
1557     step_by_step src_install
1558     fi
1559  fi  fi
1560    
1561  # compressing doc, info & man files  # echo for sake of good-looking
1562  if [[ -n ${SPLIT_PACKAGES} ]]  echo
1563    
1564    if mqueryfeature "!compressdoc"
1565  then  then
1566   for subpackage in ${SPLIT_PACKAGES}   echo -e "!compressdoc detected; documentation will not be compressed ..."
1567   do  elif mqueryfeature "!pkgbuild"
1568   mcompressdocs ${BINDIR}_${subpackage}  then
1569   done   echo "!pkgbuild detected; skipping documentation compression..."
1570  else  else
1571   mcompressdocs ${BINDIR}   # compressing doc, info & man files
1572     if [[ -n ${SPLIT_PACKAGES} ]]
1573     then
1574     for subpackage in ${SPLIT_PACKAGES}
1575     do
1576     run_resume mcompressdoc_${subpackage} || mcompressdocs ${BINDIR}_${subpackage}
1577     resume_stamp mcompressdoc_${subpackage}
1578     done
1579     else
1580     run_resume mcompressdoc || mcompressdocs ${BINDIR}
1581     resume_stamp mcompressdoc
1582     fi
1583  fi  fi
1584    
1585  if [[ ${SMAGE_STRIP_LIBTOOL} = true ]]  if mqueryfeature "!libtool"
1586  then  then
1587     if mqueryfeature "!pkgbuild"
1588     then
1589     echo "!pkgbuild detected; skipping libtool archive stripping ..."
1590     else
1591   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1592   then   then
1593   for subpackage in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
1594   do   do
1595   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives for '${subpackage}' ...${COLDEFAULT}"
1596   mstriplibtoolarchive ${BINDIR}_${subpackage}   run_resume mstriplibtoolarchive_${subpackage} || mstriplibtoolarchive ${BINDIR}_${subpackage}
1597     resume_stamp mstriplibtoolarchive_${subpackage}
1598   done   done
1599   else   else
1600   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"
1601   mstriplibtoolarchive ${BINDIR}   run_resume mstriplibtoolarchive || mstriplibtoolarchive ${BINDIR}
1602     resume_stamp mstriplibtoolarchive
1603   fi   fi
1604     fi
1605  fi  fi
1606    
1607  if [[ ${SMAGE_PURGE} = true ]]  if mqueryfeature "purge"
1608  then  then
1609     if mqueryfeature "!pkgbuild"
1610     then
1611     echo "!pkgbuild detected; skipping file purgation..."
1612     else
1613   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1614   then   then
1615   for subpackage in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
1616   do   do
1617   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets in '${subpackage}' ...${COLDEFAULT}"
1618   mpurgetargets ${BINDIR}_${subpackage}   run_resume mpurgetargets_${subpackage} || mpurgetargets ${BINDIR}_${subpackage}
1619     resume_stamp mpurgetargets_${subpackage}
1620   done   done
1621   else   else
1622   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"
1623   mpurgetargets ${BINDIR}   run_resume mpurgetargets || mpurgetargets ${BINDIR}
1624     resume_stamp mpurgetargets
1625   fi   fi
1626     fi
1627  fi  fi
1628    
1629  # stripping all bins and libs  # stripping all bins and libs
1630  case ${NOSTRIP} in  if mqueryfeature "!strip"
1631   true|TRUE|yes|y)  then
1632   echo -e "NOSTRIP=true detected; Package will not be stripped ..."   echo -e "!strip detected; Package will not be stripped ..."
1633   ;;  elif mqueryfeature "!pkgbuild"
1634   *)  then
1635   if [[ -n ${SPLIT_PACKAGES} ]]   echo "!pkgbuild detected; skipping stripping of the package ..."
1636   then  else
1637   for subpackage in ${SPLIT_PACKAGES}   if [[ -n ${SPLIT_PACKAGES} ]]
1638   do   then
1639   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"   for subpackage in ${SPLIT_PACKAGES}
1640   mstripbins ${BINDIR}_${subpackage}   do
1641   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1642   mstriplibs ${BINDIR}_${subpackage}   run_resume mstripbins_${subpackage} || mstripbins ${BINDIR}_${subpackage}
1643   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"   resume_stamp mstripbins_${subpackage}
1644   mstripstatic ${BINDIR}_${subpackage}   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1645   done   run_resume mstriplibs_${subpackage} || mstriplibs ${BINDIR}_${subpackage}
1646   else   resume_stamp mstriplibs_${subpackage}
1647   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1648   mstripbins ${BINDIR}   run_resume mstripstatic_${subpackage} || mstripstatic ${BINDIR}_${subpackage}
1649   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"   resume_stamp mstripstatic_${subpackage}
1650   mstriplibs ${BINDIR}   done
1651   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"   else
1652   mstripstatic ${BINDIR}   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1653   fi   run_resume mstripbins || mstripbins ${BINDIR}
1654   ;;   resume_stamp mstripbins
1655  esac   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1656     run_resume mstriplibs || mstriplibs ${BINDIR}
1657     resume_stamp mstriplibs
1658     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1659     run_resume mstripstatic || mstripstatic ${BINDIR}
1660     resume_stamp mstripstatic
1661     fi
1662    fi
1663    
1664  # the new buildpkg command  if mqueryfeature "!pkgbuild"
1665  case ${NOPKGBUILD} in  then
1666   true|TRUE|yes|y)   echo -e "!pkgbuild detected; Package will not be build ..."
1667   echo -e "NOPGKBUILD=true detected; Package will not be build ..."  else
  ;;  
  *)  
1668   # build several targets   # build several targets
1669   if [[ -n ${MAGE_TARGETS} ]]   if [[ -n ${MAGE_TARGETS} ]]
1670   then   then
# Line 1548  case ${NOPKGBUILD} in Line 1674  case ${NOPKGBUILD} in
1674   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1675   then   then
1676   # run it   # run it
1677   ${target}_pkgbuild   run_resume ${target}_pkgbuild || ${target}_pkgbuild
1678     resume_stamp ${target}_pkgbuild
1679   fi   fi
1680   # now create the target package   # now create the target package
1681   ${MLIBDIR}/pkgbuild_dir.sh \   run_resume pkg_builddir_${target} || ${MLIBDIR}/pkgbuild_dir.sh \
1682   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \   "${PNAME}-${target}-${PVER}-${ARCH}-${PBUILD}" \
1683   ${BINDIR} || die "target: ${target} package-build failed"   ${BINDIR} || die "target: ${target} package-build failed"
1684     resume_stamp pkg_builddir_${target}
1685    
1686   # build pkg-md5-sum if requested   # build pkg-md5-sum if requested
1687   generate_package_md5sum \   run_resume md5sum_${target} || generate_package_md5sum \
1688   --pcat "${PCATEGORIE}" \   --pcat "${PCATEGORIE}" \
1689   --pname "${PNAME}" \   --pname "${PNAME}" \
1690   --pver "${PVER}" \   --pver "${PVER}" \
1691   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1692   --parch "${ARCH}" \   --parch "${ARCH}" \
1693   --target "${target}"   --target "${target}"
1694     resume_stamp md5sum_${target}
1695    
1696   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}"
1697   done   done
# Line 1577  case ${NOPKGBUILD} in Line 1706  case ${NOPKGBUILD} in
1706   export PNAME="${subpackage}"   export PNAME="${subpackage}"
1707   split_info_${PNAME}   split_info_${PNAME}
1708    
1709   # jump to next one if NOPKGBUILD is set in split_info   # jump to next one if !pkgbuild is set in split_info
1710   case ${NOPKGBUILD} in   mqueryfeature "!pkgbuild" && continue
  true|TRUE|yes|y) continue ;;  
  esac  
1711    
1712   # check if an special subpackage_pkgbuild exists   # check if an special subpackage_pkgbuild exists
1713   if typeset -f ${PNAME}_pkgbuild > /dev/null   if typeset -f ${PNAME}_pkgbuild > /dev/null
1714   then   then
1715   # run it   # run it
1716   ${PNAME}_pkgbuild   run_resume ${PNAME}_pkgbuild || ${PNAME}_pkgbuild
1717     resume_stamp ${PNAME}_pkgbuild
1718   fi   fi
1719   # now create the target package   # now create the target package
1720   ${MLIBDIR}/pkgbuild_dir.sh \   run_resume pkg_builddir_${PNAME} || ${MLIBDIR}/pkgbuild_dir.sh \
1721   "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \   "${PNAME}-${PVER}-${ARCH}-${PBUILD}" \
1722   "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"   "${BINDIR}_${PNAME}" || die "split_package: ${PNAME} package-build failed"
1723     resume_stamp pkg_builddir_${PNAME}
1724    
1725   # build pkg-md5-sum if requested   # build pkg-md5-sum if requested
1726   generate_package_md5sum \   run_resume md5sum_${PNAME} || generate_package_md5sum \
1727   --pcat "${PCATEGORIE}" \   --pcat "${PCATEGORIE}" \
1728   --pname "${PNAME}" \   --pname "${PNAME}" \
1729   --pver "${PVER}" \   --pver "${PVER}" \
1730   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1731   --parch "${ARCH}"   --parch "${ARCH}"
1732     resume_stamp md5sum_${PNAME}
1733    
1734   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PNAME}-${PVER}-${ARCH}-${PBUILD} successfully builded.\n${COLDEFAULT}"
1735    
# Line 1610  case ${NOPKGBUILD} in Line 1740  case ${NOPKGBUILD} in
1740   split_unset_variables   split_unset_variables
1741    
1742   else   else
1743   ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"   run_resume pkg_builddir || ${MLIBDIR}/pkgbuild_dir.sh ${PKGNAME} ${BINDIR} || die "package-build failed"
1744     resume_stamp pkg_builddir
1745    
1746   # build pkg-md5-sum if requested   # build pkg-md5-sum if requested
1747   generate_package_md5sum \   run_resume md5sum || generate_package_md5sum \
1748   --pcat "${PCATEGORIE}" \   --pcat "${PCATEGORIE}" \
1749   --pname "${PNAME}" \   --pname "${PNAME}" \
1750   --pver "${PVER}" \   --pver "${PVER}" \
1751   --pbuild "${PBUILD}" \   --pbuild "${PBUILD}" \
1752   --parch "${ARCH}"   --parch "${ARCH}"
1753     resume_stamp md5sum
1754    
1755   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"   echo -e "${COLGREEN}\nPackage ${PKGNAME} successfully builded.\n${COLDEFAULT}"
1756   fi   fi
1757    
1758   # build src-pkg-tarball if requested   # build src-pkg-tarball if requested
1759   [[ ${CREATE_SRC_PKG_TARBALL} = true ]] && source_pkg_build ${SMAGENAME}   if mqueryfeature "srcpkg"
1760   ;;   then
1761  esac   resume_stamp srcpkgbuild || source_pkg_build ${SMAGENAME}
1762     resume_stamp srcpkgbuild
1763     fi
1764    fi
1765    
1766  if [[ ${SMAGE_BUILD_LOGGING} != false ]]  if mqueryfeature "buildlog"
1767  then  then
1768   bzip2 -9f /var/log/smage/${PKGNAME}.log   bzip2 -9f /var/log/smage/${PKGNAME}.log
1769  else  else
1770   [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log   [[ -f /var/log/smage/${PKGNAME}.log ]] && rm /var/log/smage/${PKGNAME}.log
1771  fi  fi
1772    
 # for sure  
 unset NOPKGBUILD  
 unset NOSTRIP  
   
1773  xtitleclean  xtitleclean

Legend:
Removed from v.1580  
changed lines
  Added in v.1617