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

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