Annotation of /trunk/include/cmake.sminc
Parent Directory | Revision Log
Revision 29886 -
(hide annotations)
(download)
Tue Oct 17 08:53:12 2017 UTC (6 years, 11 months ago) by niro
File size: 4629 byte(s)
Tue Oct 17 08:53:12 2017 UTC (6 years, 11 months ago) by niro
File size: 4629 byte(s)
-fixed multilib issues
1 | niro | 2 | # $Header: /magellan-cvs/smage/include/cmake.sminc,v 1.9 2008/04/20 17:40:19 niro Exp $ |
2 | # cmake config tools | ||
3 | |||
4 | SDEPEND="${SDEPEND} | ||
5 | >= dev-util/cmake-2.4.7" | ||
6 | |||
7 | # enables features like --enable-blah with make | ||
8 | cmake_enable() | ||
9 | { | ||
10 | local feature="$1" | ||
11 | local option="$2" | ||
12 | [[ -z ${option} ]] && option=ON | ||
13 | |||
14 | echo "-DENABLE_${feature}=${option}" | ||
15 | } | ||
16 | |||
17 | # disables features like --disable-blah with make | ||
18 | cmake_disable() | ||
19 | { | ||
20 | local feature="$1" | ||
21 | echo "-DENABLE_${feature}=OFF" | ||
22 | } | ||
23 | |||
24 | # enables features like --with-blah with make | ||
25 | cmake_with() | ||
26 | { | ||
27 | local feature="$1" | ||
28 | local option="$2" | ||
29 | [[ -z ${option} ]] && option=ON | ||
30 | |||
31 | echo "-DWITH_${feature}=${option}" | ||
32 | } | ||
33 | |||
34 | # enables features like --with-blah with make | ||
35 | cmake_without() | ||
36 | { | ||
37 | local feature="$1" | ||
38 | echo "-DWITH_${feature}=OFF" | ||
39 | } | ||
40 | |||
41 | # tell cmake that we support a feature | ||
42 | cmake_have() | ||
43 | { | ||
44 | local feature="$1" | ||
45 | local option="$2" | ||
46 | [[ -z ${option} ]] && option=ON | ||
47 | |||
48 | echo "-DHAVE_${feature}=${option}" | ||
49 | } | ||
50 | |||
51 | # tell cmake that we don't support a feature | ||
52 | cmake_have_not() | ||
53 | { | ||
54 | local feature="$1" | ||
55 | echo "-DHAVE_${feature}=OFF" | ||
56 | } | ||
57 | |||
58 | # tell cmake that we want a feature | ||
59 | cmake_want() | ||
60 | { | ||
61 | local feature="$1" | ||
62 | local option="$2" | ||
63 | [[ -z ${option} ]] && option=ON | ||
64 | |||
65 | echo "-DWANT_${feature}=${option}" | ||
66 | } | ||
67 | |||
68 | # tell cmake that we don't want a feature | ||
69 | cmake_want_not() | ||
70 | { | ||
71 | local feature="$1" | ||
72 | echo "-DWANT_${feature}=OFF" | ||
73 | } | ||
74 | |||
75 | # tell cmake that we don't want a feature using -DNO | ||
76 | cmake_no() | ||
77 | { | ||
78 | local feature="$1" | ||
79 | echo "-DNO_${feature}=1" | ||
80 | } | ||
81 | |||
82 | # tell cmake that we forcefully build a feature | ||
83 | cmake_build() | ||
84 | { | ||
85 | local feature="$1" | ||
86 | local option="$2" | ||
87 | [[ -z ${option} ]] && option=ON | ||
88 | |||
89 | echo "-DBUILD_${feature}=${option}" | ||
90 | } | ||
91 | |||
92 | # tell cmake that we don't build a feature | ||
93 | cmake_build_not() | ||
94 | { | ||
95 | local feature="$1" | ||
96 | echo "-DBUILD_${feature}=OFF" | ||
97 | } | ||
98 | |||
99 | niro | 8012 | # install cmake opts |
100 | cmake_install() | ||
101 | { | ||
102 | local feature="$1" | ||
103 | local option="$2" | ||
104 | niro | 8018 | echo "-DINSTALL_${feature}=${option}" |
105 | niro | 8012 | } |
106 | |||
107 | # generic cmake opts | ||
108 | cmake_opt() | ||
109 | { | ||
110 | local feature="$1" | ||
111 | local option="$2" | ||
112 | niro | 8018 | echo "-D${feature}=${option}" |
113 | niro | 8012 | } |
114 | |||
115 | niro | 2 | cmake_src_prepare() |
116 | { | ||
117 | munpack ${SRCFILE} || die | ||
118 | } | ||
119 | |||
120 | cmake_configure() | ||
121 | { | ||
122 | local configure_opts="$@" | ||
123 | niro | 29802 | local default_opts |
124 | niro | 2 | local libsuffix="$(mlibdir)" |
125 | local libsuffix="${libsuffix/lib}" | ||
126 | |||
127 | # disable colors if requested | ||
128 | if [[ ${NOCOLORS} = true ]] | ||
129 | then | ||
130 | niro | 29802 | default_opts+=" -DCMAKE_COLOR_MAKEFILE=OFF" |
131 | niro | 2 | fi |
132 | |||
133 | niro | 29802 | default_opts+=" -DCMAKE_VERBOSE_MAKEFILE=ON" |
134 | default_opts+=" -DCMAKE_BUILD_TYPE=Release" | ||
135 | default_opts+=" -DCMAKE_INSTALL_PREFIX=${PREFIX:-/usr}" | ||
136 | default_opts+=" -DLIB_SUFFIX=${libsuffix}" | ||
137 | niro | 29810 | default_opts+=' -DLIB_INSTALL_DIR=${PREFIX:-/usr}/$(mlibdir)' |
138 | niro | 29802 | |
139 | if [[ ${MULTILIB_BUILD} = true ]] | ||
140 | then | ||
141 | local abi | ||
142 | local abis_to_run="${MULTILIB_ABIS}" | ||
143 | |||
144 | # respect MULTILIB_ONLY_ABI variable | ||
145 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
146 | for abi in ${abis_to_run} | ||
147 | do | ||
148 | niro | 29886 | cd ${BUILDDIR}/build-${abi} |
149 | cmake ${default_opts} ${configure_opts} ${SRCDIR}-${abi}/${SRCSUBDIR} || die | ||
150 | niro | 29802 | done |
151 | else | ||
152 | cd ${BUILDDIR}/build | ||
153 | cmake ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} || die | ||
154 | fi | ||
155 | niro | 2 | } |
156 | |||
157 | niro | 29802 | cmake_setup_builddir() |
158 | { | ||
159 | if [[ ${MULTILIB_BUILD} = true ]] | ||
160 | then | ||
161 | all-abis install -d ${BUILDDIR}/build-$(mabi) || die | ||
162 | else | ||
163 | install -d ${BUILDDIR}/build || die | ||
164 | fi | ||
165 | } | ||
166 | |||
167 | niro | 2 | cmake_src_compile() |
168 | { | ||
169 | cd ${SRCDIR} | ||
170 | |||
171 | niro | 29802 | cmake_setup_builddir || die |
172 | niro | 2 | cmake_configure || die |
173 | mmake || die | ||
174 | } | ||
175 | |||
176 | niro | 20976 | cmake_src_check() |
177 | { | ||
178 | niro | 21166 | #cd ${BUILDDIR}/build |
179 | #mmake -j1 -k check || die | ||
180 | return 0 | ||
181 | niro | 20976 | } |
182 | |||
183 | niro | 29802 | cmake_multilib_src_check() |
184 | { | ||
185 | #local abi | ||
186 | #local abis_to_run="${MULTILIB_ABIS}" | ||
187 | # | ||
188 | ## respect MULTILIB_ONLY_ABI variable | ||
189 | #[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
190 | #for abi in ${abis_to_run} | ||
191 | #do | ||
192 | # cd ${BUILDDIR}/build-${abi} | ||
193 | # mmake -j1 -k check || die | ||
194 | #done | ||
195 | return 0 | ||
196 | } | ||
197 | |||
198 | niro | 2 | cmake_src_install() |
199 | { | ||
200 | niro | 4858 | cd ${BUILDDIR}/build |
201 | niro | 2 | make DESTDIR=${BINDIR} install || die |
202 | |||
203 | niro | 4859 | cd ${SRCDIR} |
204 | niro | 2 | local i |
205 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
206 | FAQ LICENSE NEWS README TODO | ||
207 | do | ||
208 | if [ -f ${SRCDIR}/${i} ] | ||
209 | then | ||
210 | minstalldocs ${i} || die | ||
211 | fi | ||
212 | done | ||
213 | } | ||
214 | |||
215 | niro | 29802 | cmake_multilib_src_install() |
216 | { | ||
217 | local abi | ||
218 | local abis_to_run="${MULTILIB_ABIS}" | ||
219 | |||
220 | # respect MULTILIB_ONLY_ABI variable | ||
221 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
222 | for abi in ${abis_to_run} | ||
223 | do | ||
224 | cd ${BUILDDIR}/build-${abi} | ||
225 | make DESTDIR=${BINDIR} install || die | ||
226 | |||
227 | cd ${SRCDIR}-${abi} | ||
228 | local i | ||
229 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ | ||
230 | FAQ LICENSE NEWS README TODO | ||
231 | do | ||
232 | if [ -f ${SRCDIR}-${abi}/${i} ] | ||
233 | then | ||
234 | minstalldocs ${i} || die | ||
235 | fi | ||
236 | done | ||
237 | done | ||
238 | } | ||
239 | |||
240 | export_inherits cmake src_prepare src_compile | ||
241 | if [[ ${MULTILIB_BUILD} = true ]] | ||
242 | then | ||
243 | export_inherits cmake_multilib src_check src_install | ||
244 | else | ||
245 | export_inherits cmake src_check src_install | ||
246 | fi |