Magellan Linux

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5213 - (hide annotations) (download)
Mon Dec 16 10:18:28 2013 UTC (10 years, 5 months ago) by niro
File size: 3280 byte(s)
-use mtools functions
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 1667 # injects files to given path (defaults to /usr/bin)
11     # mcinjectfile file {/path/to/dest}
12     mcinjectfile()
13 niro 1661 {
14 niro 1667 local file
15     local dest
16 niro 1661
17 niro 1667 [[ -z $1 ]] && die "No etc file given"
18    
19     file="${SMAGENAME%/*}/alx/files/$1"
20     dest="$2"
21     if [[ -z $2 ]]
22 niro 1661 then
23 niro 1667 dest=/usr/bin
24     fi
25 niro 1661
26 niro 5213 # needed directory
27     minstalldir ${dest} || die
28    
29 niro 1667 # install our configfile
30 niro 5213 minstallfile ${file} ${dest} || die
31 niro 1667 }
32 niro 1661
33 niro 1667 # 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 niro 1661 fi
48    
49 niro 5213 # needed directory
50     minstalldir ${dest} || die
51    
52 niro 1667 # install our configfile
53 niro 5213 minstallexec ${file} ${dest} || die
54 niro 1661 }
55    
56 niro 1667 # injects a patch to the sourcecode
57     # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
58     # mcinjectpatch patch
59     mcinjectpatch()
60 niro 1661 {
61 niro 1667 local PATCHOPTS
62     local PATCHFILE
63     local i
64    
65     PATCHOPTS=$1
66     PATCHFILE=$2
67    
68     if [[ -z $2 ]]
69 niro 1661 then
70 niro 1667 PATCHFILE=$1
71    
72     ## patch level auto-detection, get patch level
73     for ((i=0; i < 10; i++))
74 niro 1661 do
75 niro 1667 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 niro 1661 done
82     fi
83    
84 niro 1667 echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
85     patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
86 niro 1661 }
87    
88 niro 1667 #############################
89     ##### 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 niro 1661 {
102 niro 1667 local myconf
103     local configurefile
104    
105     # get configure instructions from smage dir
106     if [[ -f ${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg ]]
107 niro 1661 then
108 niro 1667 # version specific configure files
109     configurefile=${SMAGENAME%/*}/alx/${PNAME}-${PVER}-${PBUILD}.cfg
110     elif [[ -f ${SMAGENAME%/*}/alx/${PNAME}.cfg ]]
111     then
112     # 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 niro 1661 do
125 niro 1667 # ignore empty and commeted lines
126     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 niro 1661 fi
134    
135 niro 3884 alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
136 niro 1661 }
137 niro 1667
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