Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 6048 - (hide annotations) (download)
Thu Mar 19 15:33:48 2015 UTC (9 years, 2 months ago) by niro
File size: 3687 byte(s)
-add injection files to SRC_URI
1 niro 1667 # $Id$
2     # alx specific functions
3 niro 1661
4 niro 1667 # some global includes
5     sminclude cleanutils mtools
6 niro 1661
7 niro 2066 # include alx functions
8 niro 2076 INHERITS="${INHERITS} alx"
9 niro 2066
10 niro 6048 # add custom alx injection files to SRC_URI (required for proper spkg-tarball support)
11     # 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 niro 1667 # injects files to given path (defaults to /usr/bin)
25     # mcinjectfile file {/path/to/dest}
26     mcinjectfile()
27 niro 1661 {
28 niro 1667 local file
29     local dest
30 niro 1661
31 niro 1667 [[ -z $1 ]] && die "No etc file given"
32    
33     file="${SMAGENAME%/*}/alx/files/$1"
34     dest="$2"
35     if [[ -z $2 ]]
36 niro 1661 then
37 niro 1667 dest=/usr/bin
38     fi
39 niro 1661
40 niro 5213 # needed directory
41 niro 5305 #minstalldir ${dest} || die
42 niro 5213
43 niro 1667 # install our configfile
44 niro 5213 minstallfile ${file} ${dest} || die
45 niro 1667 }
46 niro 1661
47 niro 1667 # 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 niro 1661 fi
62    
63 niro 5213 # needed directory
64 niro 5305 #minstalldir ${dest} || die
65 niro 5213
66 niro 1667 # install our configfile
67 niro 5213 minstallexec ${file} ${dest} || die
68 niro 1661 }
69    
70 niro 1667 # injects a patch to the sourcecode
71     # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
72     # mcinjectpatch patch
73     mcinjectpatch()
74 niro 1661 {
75 niro 1667 local PATCHOPTS
76     local PATCHFILE
77     local i
78    
79     PATCHOPTS=$1
80     PATCHFILE=$2
81    
82     if [[ -z $2 ]]
83 niro 1661 then
84 niro 1667 PATCHFILE=$1
85    
86     ## patch level auto-detection, get patch level
87     for ((i=0; i < 10; i++))
88 niro 1661 do
89 niro 1667 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 niro 1661 done
96     fi
97    
98 niro 1667 echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
99     patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
100 niro 1661 }
101    
102 niro 1667 #############################
103     ##### 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 niro 5462 eval "${alx_old_mconfigure}"
114 niro 1667 mconfigure()
115 niro 1661 {
116 niro 1667 local myconf
117     local configurefile
118    
119     # get configure instructions from smage dir
120     if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]]
121 niro 1661 then
122 niro 1667 # version specific configure files
123     configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg
124     elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]]
125     then
126     # 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 niro 1661 do
139 niro 1667 # ignore empty and commeted lines
140     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 niro 1661 fi
148    
149 niro 3884 alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
150 niro 1661 }
151 niro 1667
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