Annotation of /trunk/include/multilib.sminc
Parent Directory | Revision Log
Revision 29786 -
(hide annotations)
(download)
Thu Oct 12 07:24:27 2017 UTC (7 years ago) by niro
File size: 16112 byte(s)
Thu Oct 12 07:24:27 2017 UTC (7 years ago) by niro
File size: 16112 byte(s)
-added meson multilib handlers
1 | niro | 6346 | # $Id$ |
2 | niro | 2 | # multilib abis |
3 | |||
4 | niro | 11547 | # tell the buildsystem that we are doing a multilib build |
5 | export MULTILIB_BUILD="true" | ||
6 | niro | 11544 | |
7 | niro | 8334 | # be verbose or nor (true|false} |
8 | : ${MULTILIB_VERBOSE="true"} | ||
9 | |||
10 | niro | 11029 | # multilib should call all dependant includes, which gets overridden |
11 | niro | 11030 | sminclude mtools |
12 | niro | 11029 | |
13 | niro | 2 | # do not define EMUL_LINUX_32 after inherit of multlib !! |
14 | # it may break i*86 builds | ||
15 | |||
16 | # default ABIs to be build | ||
17 | case ${ARCH} in | ||
18 | x86_64) | ||
19 | : ${MULTILIB_ABIS="m32 m64"} | ||
20 | # default false | ||
21 | : ${EMUL_LINUX_32="false"} | ||
22 | |||
23 | # add linux32 to the dependencies | ||
24 | if [[ ${EMUL_LINUX_32} = true ]] | ||
25 | then | ||
26 | niro | 7554 | EMUL_LINUX_32_SDEPEND_x86_64=">= sys-apps/util-linux-2.19" |
27 | niro | 6406 | SPECIAL_VARS="${SPECIAL_VARS} EMUL_LINUX_32_SDEPEND_x86_64" |
28 | niro | 2 | fi |
29 | ;; | ||
30 | i*86) | ||
31 | : ${MULTILIB_ABIS="m32"} | ||
32 | # always false | ||
33 | EMUL_LINUX_32="false" | ||
34 | ;; | ||
35 | esac | ||
36 | |||
37 | # add linux32 to the dependencies | ||
38 | if [[ ${EMUL_LINUX_32} = true ]] | ||
39 | then | ||
40 | # very dirty trick to get the dependencies right | ||
41 | # ; is the IFS, tr replaces ; with an crlfs | ||
42 | # the var ist decided with our common eval+echo magic | ||
43 | if [[ -z ${SDEPEND} ]] | ||
44 | then | ||
45 | niro | 22297 | SDEPEND="$(marchsdepend EMUL_LINUX_32_SDEPEND)" |
46 | niro | 2 | else |
47 | SDEPEND="${SDEPEND} | ||
48 | niro | 22297 | $(marchsdepend EMUL_LINUX_32_SDEPEND)" |
49 | niro | 2 | fi |
50 | fi | ||
51 | |||
52 | ## | ||
53 | # overide some defaults to respect ABI_LIBDIR | ||
54 | ## | ||
55 | mlibdir() | ||
56 | { | ||
57 | local libdir=lib | ||
58 | [[ ${ARCH} = x86_64 ]] && libdir=lib64 | ||
59 | [[ -n ${ABI_LIBDIR} ]] && libdir="${ABI_LIBDIR}" | ||
60 | |||
61 | echo "${libdir}" | ||
62 | } | ||
63 | |||
64 | ## | ||
65 | # multilib abi changers | ||
66 | ## | ||
67 | abi-m32() | ||
68 | { | ||
69 | export ABI="m32" | ||
70 | export CC="gcc -${ABI}" | ||
71 | export CXX="g++ -${ABI}" | ||
72 | export ABI_LIBDIR="lib" | ||
73 | niro | 307 | if [[ ${EXPORT_ABI_LDFLAGS} != false ]] |
74 | then | ||
75 | niro | 11300 | local saved_ldflags="${LDFLAGS}" |
76 | export LDFLAGS="${LDFLAGS} -L/${ABI_LIBDIR} -L/usr/${ABI_LIBDIR}" | ||
77 | niro | 307 | fi |
78 | niro | 5371 | # keep pkgconfig clean |
79 | local orig_pkg_config_path="${PKG_CONFIG_PATH}" | ||
80 | export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" | ||
81 | niro | 2 | |
82 | niro | 8334 | if [[ ${MULTILIB_VERBOSE} = true ]] |
83 | niro | 307 | then |
84 | niro | 8334 | echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
85 | echo -e "${COLBLUE}*** ${COLGREEN} ABI${COLDEFAULT}='${ABI}'" | ||
86 | echo -e "${COLBLUE}*** ${COLGREEN} CC${COLDEFAULT}='${CC}'" | ||
87 | echo -e "${COLBLUE}*** ${COLGREEN} CXX${COLDEFAULT}='${CXX}'" | ||
88 | echo -e "${COLBLUE}*** ${COLGREEN} ABI_LIBDIR${COLDEFAULT}='${ABI_LIBDIR}'" | ||
89 | if [[ ${EXPORT_ABI_LDFLAGS} != false ]] | ||
90 | then | ||
91 | echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${LDFLAGS}'" | ||
92 | else | ||
93 | echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${COLYELLOW}not exported${COLDEFAULT}'" | ||
94 | fi | ||
95 | niro | 11525 | echo -e "${COLBLUE}*** ${COLGREEN} CHOST${COLDEFAULT}='${CHOST}'" |
96 | echo -e "${COLBLUE}*** ${COLGREEN} SRCDIR${COLDEFAULT}='${SRCDIR}/${SRCSUBDIR}'" | ||
97 | niro | 8334 | echo -e "${COLBLUE}*** ${COLGREEN} PKG_CONFIG_PATH${COLDEFAULT}='${PKG_CONFIG_PATH}'" |
98 | niro | 307 | fi |
99 | niro | 2 | |
100 | # configure a linux32 emulated build | ||
101 | if [[ ${EMUL_LINUX_32} = true ]] | ||
102 | then | ||
103 | niro | 8334 | if [[ ${MULTILIB_VERBOSE} = true ]] |
104 | then | ||
105 | echo -e "${COLBLUE}*** ${COLGREEN} EMUL_LINUX_32${COLDEFAULT}='${EMUL_LINUX_32}'" | ||
106 | fi | ||
107 | niro | 2 | uname(){ linux32 uname $@; } && export -f uname |
108 | niro | 11830 | local orig_chost="${CHOST}" && export CHOST="i686-pc-linux-gnu" |
109 | niro | 2 | fi |
110 | niro | 8334 | if [[ ${MULTILIB_VERBOSE} = true ]] |
111 | then | ||
112 | echo -e "${COLBLUE}*** ${COLGREEN} CHOST${COLDEFAULT}='${CHOST}'" | ||
113 | fi | ||
114 | niro | 2 | |
115 | # run any given command | ||
116 | niro | 13974 | eval $@ || die |
117 | niro | 2 | |
118 | niro | 11300 | unset ABI CC CXX ABI_LIBDIR |
119 | niro | 5371 | # keep pkgconfig clean |
120 | export PKG_CONFIG_PATH="${orig_pkg_config_path}" | ||
121 | niro | 11300 | export LDFLAGS="${saved_ldflags}" |
122 | niro | 2 | |
123 | # restore original settings | ||
124 | if [[ ${EMUL_LINUX_32} = true ]] | ||
125 | then | ||
126 | unset uname | ||
127 | niro | 11830 | export CHOST="${orig_chost}" && unset orig_chost |
128 | niro | 2 | fi |
129 | } | ||
130 | |||
131 | abi-m64() | ||
132 | { | ||
133 | export ABI="m64" | ||
134 | export CC="gcc -${ABI}" | ||
135 | export CXX="g++ -${ABI}" | ||
136 | export ABI_LIBDIR="lib64" | ||
137 | niro | 307 | if [[ ${EXPORT_ABI_LDFLAGS} != false ]] |
138 | then | ||
139 | niro | 11300 | local saved_ldflags="${LDFLAGS}" |
140 | niro | 307 | export LDFLAGS="-L/${ABI_LIBDIR} -L/usr/${ABI_LIBDIR}" |
141 | fi | ||
142 | niro | 5371 | # keep pkgconfig clean |
143 | local orig_pkg_config_path="${PKG_CONFIG_PATH}" | ||
144 | export PKG_CONFIG_PATH="/usr/${ABI_LIBDIR}/pkgconfig:${PKG_CONFIG_PATH}" | ||
145 | niro | 2 | |
146 | niro | 8334 | if [[ ${MULTILIB_VERBOSE} = true ]] |
147 | niro | 307 | then |
148 | niro | 8334 | echo -e "${COLBLUE}*** ${COLGREEN}running with -${ABI} ABI${COLDEFAULT}" |
149 | echo -e "${COLBLUE}*** ${COLGREEN} ABI${COLDEFAULT}='${ABI}'" | ||
150 | echo -e "${COLBLUE}*** ${COLGREEN} CC${COLDEFAULT}='${CC}'" | ||
151 | echo -e "${COLBLUE}*** ${COLGREEN} CXX${COLDEFAULT}='${CXX}'" | ||
152 | echo -e "${COLBLUE}*** ${COLGREEN} ABI_LIBDIR${COLDEFAULT}='${ABI_LIBDIR}'" | ||
153 | if [[ ${EXPORT_ABI_LDFLAGS} != false ]] | ||
154 | then | ||
155 | echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${LDFLAGS}'" | ||
156 | else | ||
157 | echo -e "${COLBLUE}*** ${COLGREEN} LDFLAGS${COLDEFAULT}='${COLYELLOW}not exported${COLDEFAULT}'" | ||
158 | fi | ||
159 | echo -e "${COLBLUE}*** ${COLGREEN} CHOST${COLDEFAULT}='${CHOST}'" | ||
160 | niro | 11525 | echo -e "${COLBLUE}*** ${COLGREEN} SRCDIR${COLDEFAULT}='${SRCDIR}/${SRCSUBDIR}'" |
161 | niro | 8334 | echo -e "${COLBLUE}*** ${COLGREEN} PKG_CONFIG_PATH${COLDEFAULT}='${PKG_CONFIG_PATH}'" |
162 | niro | 307 | fi |
163 | niro | 2 | |
164 | # run any given command | ||
165 | eval $@ || die | ||
166 | |||
167 | niro | 11300 | unset ABI CC CXX ABI_LIBDIR |
168 | niro | 5371 | # keep pkgconfig clean |
169 | export PKG_CONFIG_PATH="${orig_pkg_config_path}" | ||
170 | niro | 11300 | export LDFLAGS="${saved_ldflags}" |
171 | niro | 2 | } |
172 | |||
173 | only-m32() | ||
174 | { | ||
175 | local abi=m32 | ||
176 | local i | ||
177 | |||
178 | for i in ${MULTILIB_ABIS} | ||
179 | do | ||
180 | if [[ ${i} = ${abi} ]] | ||
181 | then | ||
182 | # export this for mpatch etc (to repect only-${abi}) | ||
183 | export MULTILIB_ONLY_ABI=${abi} | ||
184 | |||
185 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
186 | niro | 2 | abi-${abi} $@ || die |
187 | |||
188 | # unset this is very important | ||
189 | unset MULTILIB_ONLY_ABI | ||
190 | fi | ||
191 | done | ||
192 | } | ||
193 | |||
194 | only-m64() | ||
195 | { | ||
196 | local abi=m64 | ||
197 | local i | ||
198 | |||
199 | for i in ${MULTILIB_ABIS} | ||
200 | do | ||
201 | if [[ ${i} = ${abi} ]] | ||
202 | then | ||
203 | # export this for mpatch etc (to repect only-${abi}) | ||
204 | export MULTILIB_ONLY_ABI=${abi} | ||
205 | |||
206 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
207 | niro | 2 | abi-${abi} $@ || die |
208 | |||
209 | # unset this is very important | ||
210 | unset MULTILIB_ONLY_ABI | ||
211 | fi | ||
212 | done | ||
213 | } | ||
214 | |||
215 | all-abis() | ||
216 | { | ||
217 | local abi | ||
218 | for abi in ${MULTILIB_ABIS} | ||
219 | do | ||
220 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
221 | niro | 2 | abi-${abi} $@ || die |
222 | done | ||
223 | } | ||
224 | |||
225 | niro | 6346 | mabi() |
226 | { | ||
227 | echo \${ABI} | ||
228 | } | ||
229 | |||
230 | niro | 11825 | mabi-cc() |
231 | { | ||
232 | niro | 20903 | echo "gcc -\${ABI}" |
233 | niro | 11825 | } |
234 | |||
235 | mabi-cxx() | ||
236 | { | ||
237 | niro | 20903 | echo "g++ -\${ABI}" |
238 | niro | 11825 | } |
239 | |||
240 | niro | 11828 | mabi-cflags() |
241 | { | ||
242 | niro | 20903 | echo "\${CFLAGS}" |
243 | niro | 11828 | } |
244 | |||
245 | mabi-cxxflags() | ||
246 | { | ||
247 | niro | 20903 | echo "\${CXXFLAGS}" |
248 | niro | 11828 | } |
249 | |||
250 | mabi-ldflags() | ||
251 | { | ||
252 | niro | 20903 | echo "\${LDFLAGS}" |
253 | niro | 11828 | } |
254 | |||
255 | niro | 2 | ## |
256 | # multilib compile functions | ||
257 | ## | ||
258 | |||
259 | niro | 3671 | if [[ ! -z $(typeset -f mconfigure) ]] |
260 | then | ||
261 | # rename the old one | ||
262 | old_mconfigure=old$(typeset -f mconfigure) | ||
263 | niro | 4783 | eval "${old_mconfigure}" |
264 | niro | 20987 | |
265 | niro | 2 | mconfigure() |
266 | { | ||
267 | local abi | ||
268 | local abis_to_run="${MULTILIB_ABIS}" | ||
269 | |||
270 | # respect MULTILIB_ONLY_ABI variable | ||
271 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
272 | |||
273 | for abi in ${abis_to_run} | ||
274 | do | ||
275 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
276 | niro | 2 | abi-${abi} oldmconfigure $@ || die |
277 | done | ||
278 | } | ||
279 | niro | 20987 | fi |
280 | niro | 2 | |
281 | niro | 4780 | if [[ ! -z $(typeset -f cmake_configure) ]] |
282 | then | ||
283 | # rename the old one | ||
284 | old_cmake_configure=old$(typeset -f cmake_configure) | ||
285 | niro | 4783 | eval "${old_cmake_configure}" |
286 | niro | 20987 | |
287 | niro | 4780 | cmake_configure() |
288 | { | ||
289 | local abi | ||
290 | local abis_to_run="${MULTILIB_ABIS}" | ||
291 | |||
292 | # respect MULTILIB_ONLY_ABI variable | ||
293 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
294 | |||
295 | local saved_SRCDIR="${SRCDIR}" | ||
296 | for abi in ${abis_to_run} | ||
297 | do | ||
298 | SRCDIR="${saved_SRCDIR}-${abi}" | ||
299 | niro | 21293 | # honor inside and outside build-dir builds |
300 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
301 | then | ||
302 | cd ${BUILDDIR}/build-${abi} | ||
303 | else | ||
304 | niro | 22068 | cd ${SRCDIR} |
305 | niro | 21293 | fi |
306 | niro | 4780 | abi-${abi} oldcmake_configure $@ || die |
307 | done | ||
308 | niro | 9367 | # restore SRCDIR |
309 | SRCDIR="${saved_SRCDIR}" | ||
310 | niro | 4780 | } |
311 | niro | 20987 | fi |
312 | niro | 4780 | |
313 | niro | 20977 | if [[ ! -z $(typeset -f cmake_src_compile) ]] |
314 | then | ||
315 | # rename the old one | ||
316 | old_cmake_src_compile=old$(typeset -f cmake_src_compile) | ||
317 | eval "${old_cmake_src_compile}" | ||
318 | niro | 20987 | |
319 | niro | 20977 | cmake_src_compile() |
320 | { | ||
321 | local abi | ||
322 | local abis_to_run="${MULTILIB_ABIS}" | ||
323 | |||
324 | # respect MULTILIB_ONLY_ABI variable | ||
325 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
326 | |||
327 | for abi in ${abis_to_run} | ||
328 | do | ||
329 | # remove build dir if exist | ||
330 | [[ -d ${BUILDDIR}/build-${abi} ]] && rm -rf ${BUILDDIR}/build-${abi} | ||
331 | |||
332 | # build outside of the source dir | ||
333 | install -d ${BUILDDIR}/build-${abi} || die | ||
334 | cd ${BUILDDIR}/build-${abi} | ||
335 | done | ||
336 | |||
337 | cmake_configure || die | ||
338 | |||
339 | for abi in ${abis_to_run} | ||
340 | do | ||
341 | cd ${BUILDDIR}/build-${abi} | ||
342 | abi-${abi} oldmmake $@ || die | ||
343 | done | ||
344 | } | ||
345 | niro | 20987 | fi |
346 | niro | 20977 | |
347 | niro | 20978 | if [[ ! -z $(typeset -f cmake_src_check) ]] |
348 | then | ||
349 | # rename the old one | ||
350 | old_cmake_src_check=old$(typeset -f cmake_src_check) | ||
351 | eval "${old_cmake_check}" | ||
352 | niro | 20987 | |
353 | niro | 20978 | cmake_src_check() |
354 | { | ||
355 | local abi | ||
356 | local abis_to_run="${MULTILIB_ABIS}" | ||
357 | |||
358 | # respect MULTILIB_ONLY_ABI variable | ||
359 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
360 | |||
361 | for abi in ${abis_to_run} | ||
362 | do | ||
363 | niro | 22066 | # honor inside and outside build-dir builds |
364 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
365 | then | ||
366 | cd ${BUILDDIR}/build-${abi} | ||
367 | else | ||
368 | niro | 22067 | cd ${SRCDIR}-${abi} |
369 | niro | 22066 | fi |
370 | niro | 20978 | mmake -j1 -k check || die |
371 | done | ||
372 | } | ||
373 | niro | 20987 | fi |
374 | niro | 20978 | |
375 | niro | 20977 | if [[ ! -z $(typeset -f cmake_src_install) ]] |
376 | then | ||
377 | # rename the old one | ||
378 | old_cmake_src_install=old$(typeset -f cmake_src_install) | ||
379 | eval "${old_cmake_install}" | ||
380 | niro | 20987 | |
381 | niro | 20977 | cmake_src_install() |
382 | { | ||
383 | local abi | ||
384 | local abis_to_run="${MULTILIB_ABIS}" | ||
385 | |||
386 | # respect MULTILIB_ONLY_ABI variable | ||
387 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
388 | |||
389 | for abi in ${abis_to_run} | ||
390 | do | ||
391 | niro | 22066 | # honor inside and outside build-dir builds |
392 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
393 | then | ||
394 | cd ${BUILDDIR}/build-${abi} | ||
395 | else | ||
396 | niro | 22067 | cd ${SRCDIR}-${abi} |
397 | niro | 22066 | fi |
398 | niro | 20977 | abi-${abi} oldmmake DESTDIR=${BINDIR} $@ install || die |
399 | done | ||
400 | } | ||
401 | niro | 20987 | fi |
402 | niro | 20977 | |
403 | niro | 29786 | |
404 | if [[ ! -z $(typeset -f meson_configure) ]] | ||
405 | then | ||
406 | # rename the old one | ||
407 | old_meson_configure=old$(typeset -f meson_configure) | ||
408 | eval "${old_meson_configure}" | ||
409 | |||
410 | meson_configure() | ||
411 | { | ||
412 | local abi | ||
413 | local abis_to_run="${MULTILIB_ABIS}" | ||
414 | |||
415 | # respect MULTILIB_ONLY_ABI variable | ||
416 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
417 | |||
418 | local saved_SRCDIR="${SRCDIR}" | ||
419 | for abi in ${abis_to_run} | ||
420 | do | ||
421 | SRCDIR="${saved_SRCDIR}-${abi}" | ||
422 | # honor inside and outside build-dir builds | ||
423 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
424 | then | ||
425 | cd ${BUILDDIR}/build-${abi} | ||
426 | else | ||
427 | cd ${SRCDIR} | ||
428 | fi | ||
429 | abi-${abi} oldmeson_configure $@ || die | ||
430 | done | ||
431 | # restore SRCDIR | ||
432 | SRCDIR="${saved_SRCDIR}" | ||
433 | } | ||
434 | fi | ||
435 | |||
436 | if [[ ! -z $(typeset -f meson_src_compile) ]] | ||
437 | then | ||
438 | # rename the old one | ||
439 | old_meson_src_compile=old$(typeset -f meson_src_compile) | ||
440 | eval "${old_meson_src_compile}" | ||
441 | |||
442 | meson_src_compile() | ||
443 | { | ||
444 | local abi | ||
445 | local abis_to_run="${MULTILIB_ABIS}" | ||
446 | |||
447 | # respect MULTILIB_ONLY_ABI variable | ||
448 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
449 | |||
450 | for abi in ${abis_to_run} | ||
451 | do | ||
452 | # remove build dir if exist | ||
453 | [[ -d ${BUILDDIR}/build-${abi} ]] && rm -rf ${BUILDDIR}/build-${abi} | ||
454 | |||
455 | # build outside of the source dir | ||
456 | install -d ${BUILDDIR}/build-${abi} || die | ||
457 | cd ${BUILDDIR}/build-${abi} | ||
458 | done | ||
459 | |||
460 | meson_configure || die | ||
461 | |||
462 | for abi in ${abis_to_run} | ||
463 | do | ||
464 | cd ${BUILDDIR}/build-${abi} | ||
465 | abi-${abi} ninja $@ || die | ||
466 | done | ||
467 | } | ||
468 | fi | ||
469 | |||
470 | if [[ ! -z $(typeset -f meson_src_check) ]] | ||
471 | then | ||
472 | # rename the old one | ||
473 | old_meson_src_check=old$(typeset -f meson_src_check) | ||
474 | eval "${old_meson_check}" | ||
475 | |||
476 | meson_src_check() | ||
477 | { | ||
478 | local abi | ||
479 | local abis_to_run="${MULTILIB_ABIS}" | ||
480 | |||
481 | # respect MULTILIB_ONLY_ABI variable | ||
482 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
483 | |||
484 | for abi in ${abis_to_run} | ||
485 | do | ||
486 | # honor inside and outside build-dir builds | ||
487 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
488 | then | ||
489 | cd ${BUILDDIR}/build-${abi} | ||
490 | else | ||
491 | cd ${SRCDIR}-${abi} | ||
492 | fi | ||
493 | meson test || die | ||
494 | done | ||
495 | } | ||
496 | fi | ||
497 | |||
498 | if [[ ! -z $(typeset -f meson_src_install) ]] | ||
499 | then | ||
500 | # rename the old one | ||
501 | old_meson_src_install=old$(typeset -f meson_src_install) | ||
502 | eval "${old_meson_install}" | ||
503 | |||
504 | meson_src_install() | ||
505 | { | ||
506 | local abi | ||
507 | local abis_to_run="${MULTILIB_ABIS}" | ||
508 | |||
509 | # respect MULTILIB_ONLY_ABI variable | ||
510 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
511 | |||
512 | for abi in ${abis_to_run} | ||
513 | do | ||
514 | # honor inside and outside build-dir builds | ||
515 | if [ -d ${BUILDDIR}/build-${abi} ] | ||
516 | then | ||
517 | cd ${BUILDDIR}/build-${abi} | ||
518 | else | ||
519 | cd ${SRCDIR}-${abi} | ||
520 | fi | ||
521 | abi-${abi} DESTDIR=${BINDIR} ninja $@ install || die | ||
522 | done | ||
523 | } | ||
524 | fi | ||
525 | |||
526 | |||
527 | niro | 3671 | if [[ ! -z $(typeset -f munpack) ]] |
528 | then | ||
529 | # rename the old one | ||
530 | old_munpack=old$(typeset -f munpack) | ||
531 | eval "${old_munpack}" | ||
532 | niro | 20987 | |
533 | niro | 2 | munpack() |
534 | { | ||
535 | local abi | ||
536 | local abis_to_run="${MULTILIB_ABIS}" | ||
537 | |||
538 | # respect MULTILIB_ONLY_ABI variable | ||
539 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
540 | |||
541 | for abi in ${abis_to_run} | ||
542 | do | ||
543 | echo -e "${COLBLUE}*** ${COLGREEN}unpacking for ABI -${abi}${COLDEFAULT}" | ||
544 | niro | 13488 | oldmunpack $@ || die |
545 | niro | 2 | mv ${SRCDIR} ${SRCDIR}-${abi} || die |
546 | done | ||
547 | } | ||
548 | niro | 20987 | fi |
549 | niro | 2 | |
550 | niro | 3671 | if [[ ! -z $(typeset -f mmake) ]] |
551 | then | ||
552 | # rename the old one | ||
553 | old_mmake=old$(typeset -f mmake) | ||
554 | eval "${old_mmake}" | ||
555 | niro | 20987 | |
556 | niro | 2 | mmake() |
557 | { | ||
558 | local abi | ||
559 | local abis_to_run="${MULTILIB_ABIS}" | ||
560 | |||
561 | # respect MULTILIB_ONLY_ABI variable | ||
562 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
563 | |||
564 | for abi in ${abis_to_run} | ||
565 | do | ||
566 | echo -e "${COLBLUE}*** ${COLGREEN}compiling for ABI -${abi}${COLDEFAULT}" | ||
567 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
568 | niro | 2 | abi-${abi} oldmmake $@ || die |
569 | done | ||
570 | } | ||
571 | niro | 20987 | fi |
572 | niro | 2 | |
573 | niro | 3671 | if [[ ! -z $(typeset -f minstall) ]] |
574 | then | ||
575 | # rename the old one | ||
576 | old_minstall=old$(typeset -f minstall) | ||
577 | eval "${old_minstall}" | ||
578 | niro | 20987 | |
579 | niro | 2 | minstall() |
580 | { | ||
581 | local abi | ||
582 | local abis_to_run="${MULTILIB_ABIS}" | ||
583 | |||
584 | # respect MULTILIB_ONLY_ABI variable | ||
585 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
586 | |||
587 | for abi in ${abis_to_run} | ||
588 | do | ||
589 | echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" | ||
590 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
591 | niro | 2 | abi-${abi} oldminstall $@ || die |
592 | done | ||
593 | } | ||
594 | niro | 20987 | fi |
595 | niro | 2 | |
596 | minstall_destdir() | ||
597 | { | ||
598 | local abi | ||
599 | local abis_to_run="${MULTILIB_ABIS}" | ||
600 | |||
601 | # respect MULTILIB_ONLY_ABI variable | ||
602 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
603 | |||
604 | for abi in ${abis_to_run} | ||
605 | do | ||
606 | echo -e "${COLBLUE}*** ${COLGREEN}installing for ABI -${abi}${COLDEFAULT}" | ||
607 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
608 | niro | 2 | make DESTDIR=${BINDIR} $@ install || die |
609 | done | ||
610 | } | ||
611 | |||
612 | niro | 3671 | if [[ ! -z $(typeset -f mpatch) ]] |
613 | then | ||
614 | # rename the old one | ||
615 | old_mpatch=old$(typeset -f mpatch) | ||
616 | eval "${old_mpatch}" | ||
617 | niro | 20987 | |
618 | niro | 2 | mpatch() |
619 | { | ||
620 | local abi | ||
621 | local abis_to_run="${MULTILIB_ABIS}" | ||
622 | |||
623 | # respect MULTILIB_ONLY_ABI variable | ||
624 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
625 | |||
626 | for abi in ${abis_to_run} | ||
627 | do | ||
628 | echo -e "${COLBLUE}*** ${COLGREEN}appling patch for ABI -${abi}${COLDEFAULT}" | ||
629 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
630 | niro | 2 | oldmpatch $@ || die |
631 | done | ||
632 | } | ||
633 | niro | 20987 | fi |
634 | niro | 2 | |
635 | niro | 3671 | if [[ ! -z $(typeset -f mlibtoolize) ]] |
636 | then | ||
637 | # rename the old one | ||
638 | old_mlibtoolize=old$(typeset -f mlibtoolize) | ||
639 | eval "${old_mlibtoolize}" | ||
640 | niro | 20987 | |
641 | niro | 2 | mlibtoolize() |
642 | { | ||
643 | local abi | ||
644 | local abis_to_run="${MULTILIB_ABIS}" | ||
645 | |||
646 | # respect MULTILIB_ONLY_ABI variable | ||
647 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
648 | |||
649 | for abi in ${abis_to_run} | ||
650 | do | ||
651 | echo -e "${COLBLUE}*** ${COLGREEN}running mlibtoolize for ABI -${abi}${COLDEFAULT}" | ||
652 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
653 | niro | 2 | oldmlibtoolize $@ || die |
654 | done | ||
655 | } | ||
656 | niro | 20987 | fi |
657 | niro | 2 | |
658 | niro | 9334 | if [[ ! -z $(typeset -f mautoreconf) ]] |
659 | then | ||
660 | # rename the old one | ||
661 | old_mautoreconf=old$(typeset -f mautoreconf) | ||
662 | eval "${old_mautoreconf}" | ||
663 | niro | 20987 | |
664 | niro | 9334 | mautoreconf() |
665 | { | ||
666 | local abi | ||
667 | local abis_to_run="${MULTILIB_ABIS}" | ||
668 | |||
669 | # respect MULTILIB_ONLY_ABI variable | ||
670 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
671 | |||
672 | for abi in ${abis_to_run} | ||
673 | do | ||
674 | echo -e "${COLBLUE}*** ${COLGREEN}running mautoreconf for ABI -${abi}${COLDEFAULT}" | ||
675 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
676 | niro | 9334 | oldmautoreconf $@ || die |
677 | done | ||
678 | } | ||
679 | niro | 20987 | fi |
680 | niro | 9334 | |
681 | niro | 9333 | if [[ ! -z $(typeset -f minstalldocs) ]] |
682 | then | ||
683 | # rename the old one | ||
684 | old_minstalldocs=old$(typeset -f minstalldocs) | ||
685 | eval "${old_minstalldocs}" | ||
686 | niro | 20987 | |
687 | niro | 2 | minstalldocs() |
688 | { | ||
689 | local abi | ||
690 | local docfiles | ||
691 | |||
692 | local abis_to_run="${MULTILIB_ABIS}" | ||
693 | |||
694 | # respect MULTILIB_ONLY_ABI variable | ||
695 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" | ||
696 | |||
697 | for abi in ${abis_to_run} | ||
698 | do | ||
699 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
700 | niro | 9756 | oldminstalldocs $@ || die |
701 | niro | 2 | done |
702 | } | ||
703 | niro | 20987 | fi |
704 | niro | 2 | |
705 | ## | ||
706 | # multilib mbuild wrappers | ||
707 | ## | ||
708 | multilib_src_prepare() | ||
709 | { | ||
710 | niro | 20903 | munpack ${SRCFILE} || die |
711 | niro | 2 | } |
712 | |||
713 | multilib_src_compile() | ||
714 | { | ||
715 | niro | 20977 | if [[ ! -z $(typeset -f cmake_src_compile) ]] |
716 | then | ||
717 | cmake_src_compile || die | ||
718 | else | ||
719 | mconfigure || die | ||
720 | mmake || die | ||
721 | fi | ||
722 | niro | 2 | } |
723 | |||
724 | niro | 9902 | multilib_src_check() |
725 | { | ||
726 | niro | 20977 | if [[ ! -z $(typeset -f cmake_src_check) ]] |
727 | then | ||
728 | cmake_src_check || die | ||
729 | else | ||
730 | mmake -j1 -k check || die | ||
731 | fi | ||
732 | niro | 9902 | } |
733 | |||
734 | niro | 2 | multilib_src_install() |
735 | { | ||
736 | niro | 20977 | if [[ ! -z $(typeset -f cmake_src_install) ]] |
737 | then | ||
738 | niro | 20980 | cmake_src_install || die |
739 | niro | 20977 | else |
740 | mmake DESTDIR=${BINDIR} install || die | ||
741 | fi | ||
742 | niro | 2 | |
743 | local i | ||
744 | for abi in ${MULTILIB_ABIS} | ||
745 | do | ||
746 | niro | 11522 | cd ${SRCDIR}-${abi}/${SRCSUBDIR} |
747 | niro | 2 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
748 | FAQ LICENSE NEWS README TODO | ||
749 | do | ||
750 | if [ -f ${SRCDIR}-${abi}/${i} ] | ||
751 | then | ||
752 | minstalldocs ${i} || die | ||
753 | fi | ||
754 | done | ||
755 | done | ||
756 | } | ||
757 | |||
758 | niro | 9902 | export_inherits multilib src_prepare src_compile src_check src_install |