Magellan Linux

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

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

revision 1435 by niro, Mon Jul 25 11:01:48 2011 UTC revision 1571 by niro, Wed Dec 28 10:30:50 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"}
# Line 583  mstriplibs() Line 580  mstriplibs()
580   local stripdir="$@"   local stripdir="$@"
581    
582   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
583   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
584  }  }
585    
586  mstripbins()  mstripbins()
# Line 591  mstripbins() Line 588  mstripbins()
588   local stripdir="$@"   local stripdir="$@"
589    
590   [ -z "${stripdir}" ] && stripdir=${BINDIR}   [ -z "${stripdir}" ] && stripdir=${BINDIR}
591   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
592    }
593    
594    mstripstatic()
595    {
596     local stripdir="$@"
597    
598     [ -z "${stripdir}" ] && stripdir=${BINDIR}
599     find ${stripdir} | xargs file | grep "ar archive" | cut -f 1 -d : | xargs strip ${STRIP_STATIC_LIB} 2> /dev/null
600  }  }
601    
602  mcompressdocs()  mcompressdocs()
# Line 834  build_mage_script() Line 839  build_mage_script()
839    
840  regen_mage_tree()  regen_mage_tree()
841  {  {
842   local i   local subpackage
843    
844   # build them only if requested   # build them only if requested
845   if [[ ${REGEN_MAGE_TREE} = true ]]   if [[ ${REGEN_MAGE_TREE} = true ]]
# Line 845  regen_mage_tree() Line 850  regen_mage_tree()
850   # build for each target a mage file   # build for each target a mage file
851   # run it with several targets   # run it with several targets
852   echo   echo
853   for i in ${MAGE_TARGETS}   for subpackage in ${MAGE_TARGETS}
854   do   do
855   build_mage_script --target "${i}"   build_mage_script --target "${subpackage}"
856   done   done
857   echo   echo
858    
# Line 860  regen_mage_tree() Line 865  regen_mage_tree()
865   # build for each subpackage a mage file   # build for each subpackage a mage file
866   # run it with several targets   # run it with several targets
867   echo   echo
868   for i in ${SPLIT_PACKAGES}   for subpackage in ${SPLIT_PACKAGES}
869   do   do
870   # get the right variables for the split   # get the right variables for the split
871   export PNAME="${i}"   export PNAME="${subpackage}"
872   split_info_${i}   split_info_${subpackage}
873     # get the preinstall etc
874     split_export_inherits ${subpackage}
875   build_mage_script --split-pkg-base "${split_pkg_base}"   build_mage_script --split-pkg-base "${split_pkg_base}"
876     # delete split preinstall etc
877     split_delete_inherits ${subpackage}
878   # restore smage environment   # restore smage environment
879   split_restore_variables   split_restore_variables
880   done   done
# Line 1051  split_unset_variables() Line 1060  split_unset_variables()
1060   unset -f SAVED_postremove   unset -f SAVED_postremove
1061  }  }
1062    
1063    split_export_inherits()
1064    {
1065     local subpackage="$1"
1066     local func
1067     local newfunc
1068    
1069     for func in preinstall postinstall preremove postremove
1070     do
1071     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1072     then
1073     newfunc=$(typeset -f ${func}_${subpackage})
1074     newfunc="${newfunc/_${subpackage} (/ (}"
1075     eval "${newfunc}"
1076     fi
1077     done
1078    }
1079    
1080    split_delete_inherits()
1081    {
1082     local subpackage="$1"
1083     local func
1084    
1085     for func in preinstall postinstall preremove postremove
1086     do
1087     if [[ ! -z $(typeset -f ${func}_${subpackage}) ]]
1088     then
1089     unset -f ${func}
1090     fi
1091     done
1092     }
1093    
1094  export_inherits()  export_inherits()
1095  {  {
1096   local include="$1"   local include="$1"
# Line 1560  case ${NOSTRIP} in Line 1600  case ${NOSTRIP} in
1600   do   do
1601   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries for '${subpackage}' ...${COLDEFAULT}"
1602   mstripbins ${BINDIR}_${subpackage}   mstripbins ${BINDIR}_${subpackage}
1603   echo -e "${COLBLUE}===${COLGREEN} stripping libraries for '${subpackage}' ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries for '${subpackage}' ...${COLDEFAULT}"
1604   mstriplibs ${BINDIR}_${subpackage}   mstriplibs ${BINDIR}_${subpackage}
1605     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries for '${subpackage}' ...${COLDEFAULT}"
1606     mstripstatic ${BINDIR}_${subpackage}
1607   done   done
1608   else   else
1609   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping binaries ...${COLDEFAULT}"
1610   mstripbins ${BINDIR}   mstripbins ${BINDIR}
1611   echo -e "${COLBLUE}===${COLGREEN} stripping libraries ...${COLDEFAULT}"   echo -e "${COLBLUE}===${COLGREEN} stripping dynamic libraries ...${COLDEFAULT}"
1612   mstriplibs ${BINDIR}   mstriplibs ${BINDIR}
1613     echo -e "${COLBLUE}===${COLGREEN} stripping static libraries ...${COLDEFAULT}"
1614     mstripstatic ${BINDIR}
1615   fi   fi
1616   ;;   ;;
1617  esac  esac

Legend:
Removed from v.1435  
changed lines
  Added in v.1571