Magellan Linux

Diff of /smage/trunk/include/alx.sminc

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

smage/branches/alx-0_6_0/include/alx.sminc revision 1661 by niro, Sat Jan 22 23:14:38 2011 UTC smage/trunk/include/alx.sminc revision 2792 by niro, Mon Aug 29 20:03:18 2011 UTC
# Line 1  Line 1 
1  # $Header: /alx-cvs/smage/include/alx.sminc,v 1.3 2006/04/03 20:04:47 niro Exp $  # $Id$
2  # alx functions  # alx specific functions
3    
4  # to build a stripped down package version  # some global includes
5  # you must call 'package_all_targets' in src_install().  sminclude cleanutils mtools
 # be sure you have the strip-target-alx() function defined,  
 # get stuff stripped from the package.  
 #  
 # the dev version will be always build when including this file  
 #  
 # The only way to change the bevavior is to set ALX_PKGTYPE  
 #  ALX_PKGTYPE=only-alx-dev -> means that *only* the alx-dev package gets build  
 #  ALX_PKGTYPE=only-alx     -> means that *only* the stripped alx package gets build  
 #  
   
 # all targets for alx  
 MAGE_TARGETS="alx_dev alx_livecd alx"  
   
 # overrides  
 [[ ${ALX_PKGTYPE} = only-alx-dev ]] && MAGE_TARGETS="alx_dev"  
 [[ ${ALX_PKGTYPE} = only-alx-livecd ]] && MAGE_TARGETS="alx_livecd"  
 [[ ${ALX_PKGTYPE} = only-alx ]] && MAGE_TARGETS="alx"  
   
 # dummy functions, should be overrided in smage  
 alx_dev_pkgbuild() { return 0; }  
 alx_livecd_pkgbuild() { return 0; }  
 alx_pkgbuild() { return 0; }  
6    
7    # include alx functions
8    INHERITS="${INHERITS} alx"
9    
10  # checks if compilation should be against alx  # all deprecated mage-targets
11  target_alx_dev()  DEPRECATED_MAGE_TARGETS="alx_dev alx_livecd alx"
12    
13    # variable to save pname
14    _PNAME="${PNAME}"
15    
16    SPECIAL_VARS="${SPECIAL_VARS} DEPRECATED_MAGE_TARGETS REMOVE_DEPRECATED_MAGE_TARGETS _PNAME"
17    SPECIAL_FUNCTIONS="${SPECIAL_FUNCTIONS} alx_postinstall"
18    
19    alx_postinstall()
20  {  {
21   local i   local target
22    
23     case ${REMOVE_DEPRECATED_MAGE_TARGETS} in
24     1|yes|true|TRUE)
25     for target in ${DEPRECATED_MAGE_TARGETS}
26     do
27     if [[ ! -z $(magequery -n ${_PNAME}-${target}) ]]
28     then
29     echo "removing deprecated mage-target '${_PNAME}-${target}'"
30     mage uninstall ${_PNAME}-${target} || die
31     fi
32     done
33     ;;
34     esac
35    }
36    
37    # injects files to given path (defaults to /usr/bin)
38    # mcinjectfile file {/path/to/dest}
39    mcinjectfile()
40    {
41     local file
42     local dest
43    
44   if [ -n "${MAGE_TARGETS}" ]   [[ -z $1 ]] && die "No etc file given"
45    
46     file="${SMAGENAME%/*}/alx/files/$1"
47     dest="$2"
48     if [[ -z $2 ]]
49   then   then
50   for i in ${MAGE_TARGETS}   dest=/usr/bin
51   do   install -d ${BINDIR}/${dest} || die
52   [[ ${i} = alx_dev ]] && return 0   fi
53    
54   # alx-dev will always build when building target alx,   # install our configfile
55   # so target alx ist also allowed to be alx-dev   install -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die
56   [[ ${i} = alx ]] && return 0  }
57    
58   # same for alx_livecd  # injects executables to given path
59   [[ ${i} = alx_livecd ]] && return 0  # mcinjectexec exec {/path/to/dest}
60   done  mcinjectexec()
61    {
62     local file
63     local dest
64    
65     [[ -z $1 ]] && die "No etc file given"
66    
67     file="${SMAGENAME%/*}/alx/files/$1"
68     dest="$2"
69     if [[ -z $2 ]]
70     then
71     dest=/usr/bin
72     install -d ${BINDIR}/${dest} || die
73   fi   fi
74    
75   # nothing match, we are *not* on alx linux   # install our configfile
76   return 1   install -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
77  }  }
78    
79  # check if compilation should be against stripped down alx for livecds  # injects a patch to the sourcecode
80  target_alx_livecd()  # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
81    # mcinjectpatch patch
82    mcinjectpatch()
83  {  {
84   if [ -n "${MAGE_TARGETS}" ]   local PATCHOPTS
85     local PATCHFILE
86     local i
87    
88     PATCHOPTS=$1
89     PATCHFILE=$2
90    
91     if [[ -z $2 ]]
92   then   then
93   for i in ${MAGE_TARGETS}   PATCHFILE=$1
94    
95     ## patch level auto-detection, get patch level
96     for ((i=0; i < 10; i++))
97   do   do
98   [[ ${i} = alx_livecd ]] && return 0   patch --dry-run -Np${i} -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} > /dev/null
99     if [[ $? = 0 ]]
100     then
101     PATCHOPTS="-Np${i}"
102     break
103     fi
104   done   done
105   fi   fi
106    
107   # nothing match, we are *not* on alx linux   echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
108   return 1   patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
109  }  }
110    
111  # check if compilation should be against stripped down alx  #############################
112  target_alx()  ##### compile functions ####
113    #############################
114    
115    # respect multilib!
116    if [[ -z $(typeset -f oldconfigure) ]]
117    then
118     alx_old_mconfigure=alx_old$(typeset -f mconfigure)
119    else
120     alx_old_mconfigure=alx_old$(typeset -f oldmconfigure)
121    fi
122    eval ${alx_old_mconfigure}
123    mconfigure()
124  {  {
125   if [ -n "${MAGE_TARGETS}" ]   local myconf
126     local configurefile
127    
128     # get configure instructions from smage dir
129     if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]]
130   then   then
131   for i in ${MAGE_TARGETS}   # version specific configure files
132     configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg
133     elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]]
134     then
135     # generic configure files for a package
136     configurefile=${SMAGENAME%/*}/alx/${PNAME}.cfg
137     else
138     configurefile=""
139     fi
140    
141     # now read the content
142     if [[ -f ${configurefile} ]]
143     then
144     echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}"
145     local line
146     while read line
147   do   do
148   [[ ${i} = alx ]] && return 0   # ignore empty and commeted lines
149   done   case "${line}" in
150     \#*|"") continue ;;
151     esac
152    
153     echo -e "     adding ${COLGREEN}${line}${COLDEFAULT} to ALX_CONFIGURE_OPTS"
154     ALX_CONFIGURE_OPTS+=" ${line}"
155     done < ${configurefile}
156   fi   fi
157    
158   # nothing match, we are *not* on alx linux   alx_oldmconfigure --disable-nls ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
  return 1  
159  }  }
160    
161    # get custom mcore functions
162    if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom ]]
163    then
164     echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}"
165     source ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom
166    elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.custom ]]
167    then
168     echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}.custom${COLDEFAULT}"
169     source ${SMAGENAME%/*}/alx/${PNAME}.custom
170    fi
171    
172    export_inherits alx postinstall

Legend:
Removed from v.1661  
changed lines
  Added in v.2792