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

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