Magellan Linux

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

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

revision 1436 by niro, Mon Jul 25 11:59:49 2011 UTC revision 1574 by niro, Wed Dec 28 10:44:37 2011 UTC
# Line 1  Line 1 
1  #!/bin/bash  #!/bin/bash
2    # $Id$
3    
4  # compiles/installs .smage2 source install scripts  # compiles/installs .smage2 source install scripts
5  # needs pkgbuild_dir (mage)  # needs pkgbuild_dir (mage)
6    
7  # SMAGE2  # TODO: record dynlib, gz | xz database
 # $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    
 #01.10.2004  
 # added ccache support  
 # added distcc support  
9    
10  # set default user mage.rc  # set default user mage.rc
11  : ${MAGERC="/etc/mage.rc"}  : ${MAGERC="/etc/mage.rc"}
12    
13  ## setup ##  ## setup ##
 PKGSUFFIX="mpk"  
 SRCPKGSUFFIX="mpks"  
14  SMAGENAME="$1"  SMAGENAME="$1"
 SMAGESUFFIX="smage2"  
 MLIBDIR=/usr/lib/mage  
15  SMAGEVERSION="$( < ${MLIBDIR}/version)"  SMAGEVERSION="$( < ${MLIBDIR}/version)"
16    
 ## only for tests -> normally in /etc/rc.d/init.d/functions  
 COLRED="\033[1;6m\033[31m"  
 COLGREEN="\033[1;6m\033[32m"  
 COLYELLOW="\033[1;6m\033[33m"  
 COLBLUE="\033[1;6m\033[34m"  
 COLMAGENTA="\033[1;6m\033[35m"  
 COLWHITE="\033[1;6m\033[37m"  
 COLGRAY="\033[0;6m\033[37m"  
 COLBOLD="\033[1m"  
 COLDEFAULT="\033[0m"  
   
 if [[ ${NOCOLORS} = true ]]  
 then  
  COLRED=""  
  COLGREEN=""  
  COLYELLOW=""  
  COLBLUE=""  
  COLMAGENTA=""  
  COLWHITE=""  
  COLGRAY=""  
  COLBOLD=""  
  COLDEFAULT=""  
 fi  
   
17  # export default C locale  # export default C locale
18  export LC_ALL=C  export LC_ALL=C
19    
# Line 352  download_sources() Line 321  download_sources()
321   unset SRC_URI   unset SRC_URI
322  }  }
323    
324  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
325  src_prepare()  src_prepare()
326  {  {
327   echo "no src_prepare defined"   echo "no src_prepare defined"
  sleep 2  
328   return 0   return 0
329  }  }
330    
331  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
332  src_compile()  src_compile()
333  {  {
334   echo "no src_compile defined"   echo "no src_compile defined"
  sleep 2  
335   return 0   return 0
336  }  }
337    
338  # dummy function, used if that not exist in smage file  # dummy function, used if that does not exist in smage file
339  src_install()  src_install()
340  {  {
341   echo "no src_install defined"   echo "no src_install defined"
  sleep 2  
342   return 0   return 0
343  }  }
344    
# Line 583  mstriplibs() Line 549  mstriplibs()
549   local stripdir="$@"   local stripdir="$@"
550    
551   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
552   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null   find ${stripdir} | xargs file | grep "shared object" | grep ELF | cut -f 1 -d : | xargs strip ${STRIP_DYN_LIB} 2> /dev/null
553  }  }
554    
555  mstripbins()  mstripbins()
# Line 591  mstripbins() Line 557  mstripbins()
557   local stripdir="$@"   local stripdir="$@"
558    
559   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
560   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_DYN_BIN} 2> /dev/null
561    }
562    
563    mstripstatic()
564    {
565     local stripdir="$@"
566    
567     [ -z "${stripdir}" ] && stripdir=${BINDIR}
568     find ${stripdir} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip ${STRIP_STATIC_LIB} 2> /dev/null
569  }  }
570    
571  mcompressdocs()  mcompressdocs()
# Line 1487  export MAKEOPTS="${MAKEOPTS}" || die "MA Line 1461  export MAKEOPTS="${MAKEOPTS}" || die "MA
1461  # setup ccache  # setup ccache
1462  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment  [[ ${SMAGE_USE_CCACHE} = true ]] && setup_ccache_environment
1463    
1464  # small sleep to show our settings  # clean up builddir if a previously one exist
 sleep 1  
   
 # cleans up build if a previously one exists  
1465  if [ -d ${BUILDDIR} ]  if [ -d ${BUILDDIR} ]
1466  then  then
1467   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."   rm -rf ${BUILDDIR}/* || die "couldn't cleanup \$BUILDDIR."
1468  fi  fi
1469  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."  install -d ${BUILDDIR} || die "couldn't create \$BUILDDIR."
1470    
1471  # cleans up srcdir if a previously unpacked one exists  # clean up srcdir if a previously unpacked one exist
1472  if [ -d ${SRCDIR} ]  if [ -d ${SRCDIR} ]
1473  then  then
1474   rm -rf ${SRCDIR}   rm -rf ${SRCDIR}
1475  fi  fi
1476    
1477  # cleans up bindir if a previous build exists or creates a new one  # clean up bindir if a previous build exist or create a new one
1478  if [ -d ${BINDIR} ]  if [ -d ${BINDIR} ]
1479  then  then
1480   rm -rf ${BINDIR}   rm -rf ${BINDIR}
# Line 1522  then Line 1493  then
1493   mage rmstamp   mage rmstamp
1494  fi  fi
1495    
1496  # setup build loggins  # setup build logging
1497  [[ ! -d /var/log/smage ]] && install -d /var/log/smage  [[ ! -d /var/log/smage ]] && install -d /var/log/smage
1498  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log  echo -e "### Build started on $(date) ###\n" > /var/log/smage/${PKGNAME}.log
1499    
# Line 1595  case ${NOSTRIP} in Line 1566  case ${NOSTRIP} in
1566   do   do
1567   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1568   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1569   echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1570   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1571     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1572     mstripstatic ${BINDIR}_${subpackage}
1573   done   done
1574   else   else
1575   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1576   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1577   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1578   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1579     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1580     mstripstatic ${BINDIR}
1581   fi   fi
1582   ;;   ;;
1583  esac  esac
# Line 1618  case ${NOPKGBUILD} in Line 1593  case ${NOPKGBUILD} in
1593   then   then
1594   for target in ${MAGE_TARGETS}   for target in ${MAGE_TARGETS}
1595   do   do
1596   # check if an special target_pkgbuild exists   # check if a special target_pkgbuild exists
1597   if typeset -f ${target}_pkgbuild > /dev/null   if typeset -f ${target}_pkgbuild > /dev/null
1598   then   then
1599   # run it   # run it

Legend:
Removed from v.1436  
changed lines
  Added in v.1574