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