Magellan Linux

Contents of /smage/trunk/include/mcore.sminc

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1911 - (show annotations) (download)
Wed Nov 9 12:47:46 2011 UTC (12 years, 5 months ago) by niro
File size: 3435 byte(s)
-do not reset any inherits
1 # $Id$
2 # mcore specific functions
3
4 # some global includes
5 sminclude cleanutils mtools
6
7 INHERITS="${INHERITS} mcore"
8
9 # injects files to given path (defaults to /usr/bin)
10 # mcinjectfile file {/path/to/dest}
11 mcinjectfile()
12 {
13 local file
14 local dest
15
16 [[ -z $1 ]] && die "No etc file given"
17
18 file="${SMAGENAME%/*}/mcore/files/$1"
19 dest="$2"
20 if [[ -z $2 ]]
21 then
22 dest=/usr/bin
23 install -d ${BINDIR}/${dest} || die
24 fi
25
26 # install our configfile
27 install -m 0644 -o root -g root ${file} ${BINDIR}/${dest} || die
28 }
29
30 # injects executables to given path
31 # mcinjectexec exec {/path/to/dest}
32 mcinjectexec()
33 {
34 local file
35 local dest
36
37 [[ -z $1 ]] && die "No etc file given"
38
39 file="${SMAGENAME%/*}/mcore/files/$1"
40 dest="$2"
41 if [[ -z $2 ]]
42 then
43 dest=/usr/bin
44 install -d ${BINDIR}/${dest} || die
45 fi
46
47 # install our configfile
48 install -m 0755 -o root -g root ${file} ${BINDIR}/${dest} || die
49 }
50
51 # injects a patch to the sourcecode
52 # - basically the same like mpatch() but uses patches from ${SMAGENAME%/*}/mcore/files
53 # mcinjectpatch patch
54 mcinjectpatch()
55 {
56 local PATCHOPTS
57 local PATCHFILE
58 local i
59
60 PATCHOPTS=$1
61 PATCHFILE=$2
62
63 if [[ -z $2 ]]
64 then
65 PATCHFILE=$1
66
67 ## patch level auto-detection, get patch level
68 for ((i=0; i < 10; i++))
69 do
70 patch --dry-run -Np${i} -i ${SMAGENAME%/*}/mcore/files/${PATCHFILE} > /dev/null
71 if [[ $? = 0 ]]
72 then
73 PATCHOPTS="-Np${i}"
74 break
75 fi
76 done
77 fi
78
79 echo -e "${COLBLUE}*** ${COLGREEN}Applying mCore patch '${PATCHFILE}'${COLDEFAULT}"
80 patch "${PATCHOPTS}" -i ${SMAGENAME%/*}/mcore/files/${PATCHFILE}
81 }
82
83 #############################
84 ##### compile functions ####
85 #############################
86
87 # respect multilib!
88 if [[ -z $(typeset -f oldconfigure) ]]
89 then
90 mc_old_mconfigure=mc_old$(typeset -f mconfigure)
91 else
92 mc_old_mconfigure=mc_old$(typeset -f oldmconfigure)
93 fi
94 eval ${mc_old_mconfigure}
95 mconfigure()
96 {
97 local myconf
98 local configurefile
99
100 # get configure instructions from smage dir
101 if [[ -f ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.cfg ]]
102 then
103 # version specific configure files
104 configurefile=${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.cfg
105 elif [[ -f ${SMAGENAME%/*}/mcore/${PNAME}.cfg ]]
106 then
107 # generic configure files for a package
108 configurefile=${SMAGENAME%/*}/mcore/${PNAME}.cfg
109 else
110 configurefile=""
111 fi
112
113 # now read the content
114 if [[ -f ${configurefile} ]]
115 then
116 echo -e "${COLBLUE}*** ${COLGREEN}Using configure info from ${configurefile}${COLDEFAULT}"
117 local line
118 while read line
119 do
120 # ignore empty and commeted lines
121 case "${line}" in
122 \#*|"") continue ;;
123 esac
124
125 echo -e " adding ${COLGREEN}${line}${COLDEFAULT} to MCORE_CONFIGURE_OPTS"
126 MCORE_CONFIGURE_OPTS+=" ${line}"
127 done < ${configurefile}
128 fi
129
130 case "${MCORE_NO_DISABLE_NLS}" in
131 1|true|TRUE|yes|YES) ;;
132 *) myconf="${myconf} --disable-nls" ;;
133 esac
134
135 mc_oldmconfigure ${myconf} $@ ${MCORE_CONFIGURE_OPTS} || die
136 }
137
138 # get custom mcore functions
139 if [[ -f ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom ]]
140 then
141 echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom${COLDEFAULT}"
142 source ${SMAGENAME%/*}/mcore/${PNAME}-${PVER}-${PBUILD}.custom
143 elif [[ -f ${SMAGENAME%/*}/mcore/${PNAME}.custom ]]
144 then
145 echo -e "${COLBLUE}*** ${COLGREEN}Using custom build info from ${SMAGENAME%/*}/mcore/${PNAME}.custom${COLDEFAULT}"
146 source ${SMAGENAME%/*}/mcore/${PNAME}.custom
147 fi