Magellan Linux

Contents of /smage/branches/alx-0_7/include/alx.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 4439 - (show annotations) (download)
Thu Nov 22 15:03:44 2012 UTC (11 years, 6 months ago) by niro
File size: 3316 byte(s)
-moved files to the right place
1 # $Id$
2 # alx specific functions
3
4 # some global includes
5 sminclude cleanutils mtools
6
7 # include alx functions
8 INHERITS="${INHERITS} alx"
9
10 # injects files to given path (defaults to /usr/bin)
11 # mcinjectfile file {/path/to/dest}
12 mcinjectfile()
13 {
14 local file
15 local dest
16
17 [[ -z $1 ]] && die "No etc file given"
18
19 file="${SMAGENAME%/*}/alx/files/$1"
20 dest="$2"
21 if [[ -z $2 ]]
22 then
23 dest=/usr/bin
24 install -d ${BINDIR}/${dest} || die
25 fi
26
27 # install our configfile
28 install -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die
29 }
30
31 # injects executables to given path
32 # mcinjectexec exec {/path/to/dest}
33 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
47
48 # install our configfile
49 install -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
50 }
51
52 # injects a patch to the sourcecode
53 # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
54 # mcinjectpatch patch
55 mcinjectpatch()
56 {
57 local PATCHOPTS
58 local PATCHFILE
59 local i
60
61 PATCHOPTS=$1
62 PATCHFILE=$2
63
64 if [[ -z $2 ]]
65 then
66 PATCHFILE=$1
67
68 ## patch level auto-detection, get patch level
69 for ((i=0; i < 10; i++))
70 do
71 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
78 fi
79
80 echo -e "${COLBLUE}*** ${COLGREEN}Applying ALX patch '${PATCHFILE}'${COLDEFAULT}"
81 patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/alx/files/${PATCHFILE}
82 }
83
84 #############################
85 ##### 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 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
108 # 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
121 # ignore empty and commeted lines
122 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
130
131 alx_oldmconfigure ${myconf} $@ ${ALX_CONFIGURE_OPTS} || die
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