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 6048 by niro, Thu Mar 19 15:33:48 2015 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  # add custom alx injection files to SRC_URI (required for proper spkg-tarball support)
11  target_alx_dev()  # requires >=mage-0.4.109
12    if [ -d ${SMAGENAME%/*}/alx/files ]
13    then
14     alxfiles=$(find ${SMAGENAME%/*}/alx/files -mindepth 1 | sed "s:${SMAGENAME%/*}/alx/files/::g")
15     for alxitem in ${alxfiles}
16     do
17     if [[ ! -z ${alxitem} ]]
18     then
19     SRC_URI+=( "file://${SMAGENAME%/*}/alx/files/${alxitem} alx/files" )
20     fi
21     done
22    fi
23    
24    # injects files to given path (defaults to /usr/bin)
25    # mcinjectfile file {/path/to/dest}
26    mcinjectfile()
27  {  {
28   local i   local file
29     local dest
30    
31     [[ -z $1 ]] && die "No etc file given"
32    
33   if [ -n "${MAGE_TARGETS}" ]   file="${SMAGENAME%/*}/alx/files/$1"
34     dest="$2"
35     if [[ -z $2 ]]
36   then   then
37   for i in ${MAGE_TARGETS}   dest=/usr/bin
38   do   fi
  [[ ${i} = alx_dev ]] && return 0  
39    
40   # alx-dev will always build when building target alx,   # needed directory
41   # so target alx ist also allowed to be alx-dev   #minstalldir ${dest} || die
  [[ ${i} = alx ]] && return 0  
42    
43   # same for alx_livecd   # install our configfile
44   [[ ${i} = alx_livecd ]] && return 0   minstallfile ${file} ${dest} || die
45   done  }
46    
47    # injects executables to given path
48    # mcinjectexec exec {/path/to/dest}
49    mcinjectexec()
50    {
51     local file
52     local dest
53    
54     [[ -z $1 ]] && die "No etc file given"
55    
56     file="${SMAGENAME%/*}/alx/files/$1"
57     dest="$2"
58     if [[ -z $2 ]]
59     then
60     dest=/usr/bin
61   fi   fi
62    
63   # nothing match, we are *not* on alx linux   # needed directory
64   return 1   #minstalldir ${dest} || die
65    
66     # install our configfile
67     minstallexec ${file} ${dest} || die
68  }  }
69    
70  # check if compilation should be against stripped down alx for livecds  # injects a patch to the sourcecode
71  target_alx_livecd()  # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
72    # mcinjectpatch patch
73    mcinjectpatch()
74  {  {
75   if [ -n "${MAGE_TARGETS}" ]   local PATCHOPTS
76     local PATCHFILE
77     local i
78    
79     PATCHOPTS=$1
80     PATCHFILE=$2
81    
82     if [[ -z $2 ]]
83   then   then
84   for i in ${MAGE_TARGETS}   PATCHFILE=$1
85    
86     ## patch level auto-detection, get patch level
87     for ((i=0; i < 10; i++))
88   do   do
89   [[ ${i} = alx_livecd ]] && return 0   patch --dry-run -Np${i} -i ${SMAGENAME%/*}/alx/files/${PATCHFILE} > /dev/null
90     if [[ $? = 0 ]]
91     then
92     PATCHOPTS="-Np${i}"
93     break
94     fi
95   done   done
96   fi   fi
97    
98   # nothing match, we are *not* on alx linux   echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
99   return 1   patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
100  }  }
101    
102  # check if compilation should be against stripped down alx  #############################
103  target_alx()  ##### compile functions ####
104    #############################
105    
106    # respect multilib!
107    if [[ -z $(typeset -f oldconfigure) ]]
108    then
109     alx_old_mconfigure=alx_old$(typeset -f mconfigure)
110    else
111     alx_old_mconfigure=alx_old$(typeset -f oldmconfigure)
112    fi
113    eval "${alx_old_mconfigure}"
114    mconfigure()
115  {  {
116   if [ -n "${MAGE_TARGETS}" ]   local myconf
117     local configurefile
118    
119     # get configure instructions from smage dir
120     if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]]
121     then
122     # version specific configure files
123     configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg
124     elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]]
125   then   then
126   for i in ${MAGE_TARGETS}   # generic configure files for a package
127     configurefile=${SMAGENAME%/*}/alx/${PNAME}.cfg
128     else
129     configurefile=""
130     fi
131    
132     # now read the content
133     if [[ -f ${configurefile} ]]
134     then
135     echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}"
136     local line
137     while read line
138   do   do
139   [[ ${i} = alx ]] && return 0   # ignore empty and commeted lines
140   done   case "${line}" in
141     \#*|"") continue ;;
142     esac
143    
144     echo -e "     adding ${COLGREEN}${line}${COLDEFAULT} to ALX_CONFIGURE_OPTS"
145     ALX_CONFIGURE_OPTS+=" ${line}"
146     done < ${configurefile}
147   fi   fi
148    
149   # nothing match, we are *not* on alx linux   alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
  return 1  
150  }  }
151    
152    # get custom mcore functions
153    if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom ]]
154    then
155     echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}"
156     source ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.custom
157    elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.custom ]]
158    then
159     echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/alx/${PNAME}.custom${COLDEFAULT}"
160     source ${SMAGENAME%/*}/alx/${PNAME}.custom
161    fi

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