Magellan Linux

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

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

revision 1589 by niro, Wed Dec 28 15:08:52 2011 UTC revision 1616 by niro, Mon Jan 9 20:11:08 2012 UTC
# 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 423  minstalldocs() Line 431  minstalldocs()
431   then   then
432   if mqueryfeature "compressdoc"   if mqueryfeature "compressdoc"
433   then   then
434   cat ${doc} | gzip -9c > ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/${doc}.gz || die "gzipping +installing ${doc}."   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}/${doc}.gz || die "fixing permissions of ${doc}."   chmod 0644 ${BINDIR}/usr/share/doc/${PNAME}-${PVER}/$(basename ${doc}).gz || die "fixing permissions of ${doc}."
436   else   else
437   install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."   install -m 0644 ${SRCDIR}/${i} ${BINDIR}/usr/share/doc/${PNAME}-${PVER} || die "installing ${doc}."
438   fi   fi
# Line 464  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 793  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 898  split_restore_variables() Line 906  split_restore_variables()
906    
907   # special handling needed for mage features   # special handling needed for mage features
908   # pkgbuild   # pkgbuild
909   msetfeature "${SAVED_FEATURE_PKGBUILD}"   FVERBOSE=off msetfeature "${SAVED_FEATURE_PKGBUILD}"
910   # strip   # strip
911   msetfeature "${SAVED_FEATURE_STRIP}"   FVERBOSE=off msetfeature "${SAVED_FEATURE_STRIP}"
912   # libtool   # libtool
913   msetfeature "${SAVED_FEATURE_LIBTOOL}"   FVERBOSE=off msetfeature "${SAVED_FEATURE_LIBTOOL}"
914   # compressdoc   # compressdoc
915   msetfeature "${SAVED_FEATURE_COMPRESSDOC}"   FVERBOSE=off msetfeature "${SAVED_FEATURE_COMPRESSDOC}"
916    
917   # bindir too   # bindir too
918   export BINDIR="${SAVED_BINDIR}"   export BINDIR="${SAVED_BINDIR}"
# Line 1399  export -f src_install || die "src_instal Line 1407  export -f src_install || die "src_instal
1407  # fixes some compile issues  # fixes some compile issues
1408  export CHOST="${CHOST}" || die "CHOST export failed"  export CHOST="${CHOST}" || die "CHOST export failed"
1409  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"  export CFLAGS="${CFLAGS}" || die "CFLAGS export failed"
1410  export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"  if [[ -z ${CXXFLAGS} ]]
1411    then
1412     export CXXFLAGS="${CFLAGS}" || die "CXXFLAGS export failed"
1413    else
1414     export CXXFLAGS="${CXXFLAGS}" || die "CXXFLAGS export failed"
1415    fi
1416    export LDFLAGS="${LDFLAGS}" || die "LDFLAGS export failed"
1417  export BINDIR="${BINDIR}" || die "BINDIR export failed"  export BINDIR="${BINDIR}" || die "BINDIR export failed"
1418  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"  export MAKEOPTS="${MAKEOPTS}" || die "MAKEOPTS export failed"
1419    
# Line 1440  fi Line 1454  fi
1454  [[ ! -d /var/log/smage ]] && install -d /var/log/smage  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1455  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1456    
1457  src_prepare | ${SMAGE_LOG_CMD}  if [[ ${PKGTYPE} = virtual ]]
 die_pipestatus 0 "src_prepare failed"  
 step_by_step $_  
   
 src_compile | ${SMAGE_LOG_CMD}  
 die_pipestatus 0 "src_compile failed"  
 step_by_step $_  
   
 # only run checks if requested  
 if mqueryfeature "!check"  
1458  then  then
1459   echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD}   echo "virtual package detected; nothing will be build ..."
1460   step_by_step src_check   # automatically set !pkgbuild here too
1461     msetfeature "!pkgbuild"
1462  else  else
1463   src_check | ${SMAGE_LOG_CMD}   src_prepare | ${SMAGE_LOG_CMD}
1464   die_pipestatus 0 "src_check failed"   die_pipestatus 0 "src_prepare failed"
1465   step_by_step $_   step_by_step $_
 fi  
1466    
1467  # build several subpackages   src_compile | ${SMAGE_LOG_CMD}
1468  if [[ -n ${SPLIT_PACKAGES} ]]   die_pipestatus 0 "src_compile failed"
 then  
  # save bindir & pname  
  split_save_variables  
  export SAVED_BINDIR="${BINDIR}"  
  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  
 else  
  src_install | ${SMAGE_LOG_CMD}  
  die_pipestatus 0 "src_install failed"  
1469   step_by_step $_   step_by_step $_
1470    
1471     # only run checks if requested
1472     if mqueryfeature "!check"
1473     then
1474     echo "!check detected; src_check() will not be run!" | ${SMAGE_LOG_CMD}
1475     step_by_step src_check
1476     else
1477     src_check | ${SMAGE_LOG_CMD}
1478     die_pipestatus 0 "src_check failed"
1479     step_by_step $_
1480     fi
1481    
1482     # build several subpackages
1483     if [[ -n ${SPLIT_PACKAGES} ]]
1484     then
1485     # save bindir & pname
1486     split_save_variables
1487     export SAVED_BINDIR="${BINDIR}"
1488     for subpackage in ${SPLIT_PACKAGES}
1489     do
1490     if typeset -f src_install_${subpackage} > /dev/null
1491     then
1492     # export subpackage bindir
1493     export BINDIR="${SAVED_BINDIR}_${subpackage}"
1494     # export PNAME, several internal function and include
1495     # rely on this variable
1496     export PNAME="${subpackage}"
1497    
1498     echo
1499     echo -en "${COLBLUE}*** ${COLDEFAULT}"
1500     echo -en "  Running ${COLGREEN}split src_install()${COLDEFAULT}"
1501     echo -en " for subpkg: ${COLBLUE}${PNAME}${COLDEFAULT}"
1502     echo -e " - basepkg: ${COLBLUE}${SPLIT_PACKAGE_BASE}${COLDEFAULT} ..."
1503    
1504     src_install_${subpackage} | ${SMAGE_LOG_CMD}
1505     die_pipestatus 0 "src_install_${subpackage} failed"
1506     step_by_step $_
1507     fi
1508     done
1509     # restore bindir & pname
1510     split_restore_variables
1511     # unset all saved smage variables
1512     split_unset_variables
1513     else
1514     src_install | ${SMAGE_LOG_CMD}
1515     die_pipestatus 0 "src_install failed"
1516     step_by_step $_
1517     fi
1518  fi  fi
1519    
1520    # echo for sake of good-looking
1521    echo
1522    
1523  if mqueryfeature "!compressdoc"  if mqueryfeature "!compressdoc"
1524  then  then
1525   echo -e "!compressdoc detected; documentation will not be compressed ..."   echo -e "!compressdoc detected; documentation will not be compressed ..."
1526    elif mqueryfeature "!pkgbuild"
1527    then
1528     echo "!pkgbuild detected; skipping documentation compression..."
1529  else  else
1530   # compressing doc, info & man files   # compressing doc, info & man files
1531   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
# Line 1514  fi Line 1541  fi
1541    
1542  if mqueryfeature "!libtool"  if mqueryfeature "!libtool"
1543  then  then
1544     if mqueryfeature "!pkgbuild"
1545     then
1546     echo "!pkgbuild detected; skipping libtool archive stripping ..."
1547     else
1548   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1549   then   then
1550   for subpackage in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
# Line 1525  then Line 1556  then
1556   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping libtool archives ...${COLDEFAULT}"
1557   mstriplibtoolarchive ${BINDIR}   mstriplibtoolarchive ${BINDIR}
1558   fi   fi
1559     fi
1560  fi  fi
1561    
1562  if mqueryfeature "purge"  if mqueryfeature "purge"
1563  then  then
1564     if mqueryfeature "!pkgbuild"
1565     then
1566     echo "!pkgbuild detected; skipping file purgation..."
1567     else
1568   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1569   then   then
1570   for subpackage in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
# Line 1540  then Line 1576  then
1576   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} purging all purge targets ...${COLDEFAULT}"
1577   mpurgetargets ${BINDIR}   mpurgetargets ${BINDIR}
1578   fi   fi
1579     fi
1580  fi  fi
1581    
1582  # stripping all bins and libs  # stripping all bins and libs
1583  if mqueryfeature "!strip"  if mqueryfeature "!strip"
1584  then  then
1585   echo -e "!strip detected; Package will not be stripped ..."   echo -e "!strip detected; Package will not be stripped ..."
1586    elif mqueryfeature "!pkgbuild"
1587    then
1588     echo "!pkgbuild detected; skipping stripping of the package ..."
1589  else  else
1590   if [[ -n ${SPLIT_PACKAGES} ]]   if [[ -n ${SPLIT_PACKAGES} ]]
1591   then   then
1592   for subpackage in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
1593   do   do
1594   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1595   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1596   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1597   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1598   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1599   mstripstatic ${BINDIR}_${subpackage}   mstripstatic ${BINDIR}_${subpackage}
1600   done   done
1601   else   else
1602   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1603   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1604   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1605   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1606   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1607   mstripstatic ${BINDIR}   mstripstatic ${BINDIR}
1608   fi   fi
1609  fi  fi
1610    
1611  if mqueryfeature "!buildpkg"  if mqueryfeature "!pkgbuild"
1612  then  then
1613   echo -e "!buildpkg detected; Package will not be build ..."   echo -e "!pkgbuild detected; Package will not be build ..."
1614  else  else
1615   # build several targets   # build several targets
1616   if [[ -n ${MAGE_TARGETS} ]]   if [[ -n ${MAGE_TARGETS} ]]
# Line 1610  else Line 1650  else
1650   export PNAME="${subpackage}"   export PNAME="${subpackage}"
1651   split_info_${PNAME}   split_info_${PNAME}
1652    
1653   # jump to next one if !buildpkg is set in split_info   # jump to next one if !pkgbuild is set in split_info
1654   mqueryfeature "!buildpkg" && continue   mqueryfeature "!pkgbuild" && continue
1655    
1656   # check if an special subpackage_pkgbuild exists   # check if an special subpackage_pkgbuild exists
1657   if typeset -f ${PNAME}_pkgbuild > /dev/null   if typeset -f ${PNAME}_pkgbuild > /dev/null

Legend:
Removed from v.1589  
changed lines
  Added in v.1616