Contents of /trunk/include/meson.sminc
Parent Directory | Revision Log
Revision 29787 -
(show annotations)
(download)
Thu Oct 12 08:47:05 2017 UTC (6 years, 11 months ago) by niro
File size: 1862 byte(s)
Thu Oct 12 08:47:05 2017 UTC (6 years, 11 months ago) by niro
File size: 1862 byte(s)
-added meson build functions
1 | # $Id$ |
2 | # meson config tools |
3 | |
4 | SDEPEND="${SDEPEND} |
5 | >= dev-util/meson-0.43 |
6 | >= dev-util/ninja-1.8" |
7 | |
8 | # enables features like --enable-blah with make |
9 | meson_enable() |
10 | { |
11 | local feature="$1" |
12 | local option="$2" |
13 | [[ -z ${option} ]] && option="true" |
14 | |
15 | echo "-Denable-${feature}=${option}" |
16 | } |
17 | |
18 | # disables features like --disable-blah with make |
19 | meson_disable() |
20 | { |
21 | local feature="$1" |
22 | echo "-Denable_${feature}=false" |
23 | } |
24 | |
25 | # enables features like --with-blah with make |
26 | meson_with() |
27 | { |
28 | local feature="$1" |
29 | local option="$2" |
30 | [[ -z ${option} ]] && option="true" |
31 | |
32 | echo "-Dwith-${feature}=${option}" |
33 | } |
34 | |
35 | # enables features like --with-blah with make |
36 | meson_without() |
37 | { |
38 | local feature="$1" |
39 | echo "-Dwith-{feature}=false" |
40 | } |
41 | |
42 | # generic meson opts |
43 | meson_opt() |
44 | { |
45 | local feature="$1" |
46 | local option="$2" |
47 | echo "-D${feature}=${option}" |
48 | } |
49 | |
50 | meson_src_prepare() |
51 | { |
52 | munpack ${SRCFILE} || die |
53 | } |
54 | |
55 | meson_configure() |
56 | { |
57 | local configure_opts="$@" |
58 | |
59 | meson setup \ |
60 | --buildtype=release \ |
61 | --prefix=/usr \ |
62 | --sysconfdir=/etc \ |
63 | --localstatedir=/var/lib \ |
64 | --libdir=/usr/$(mlibdir) \ |
65 | --libexecdir=/usr/$(mlibdir)/${PNAME} \ |
66 | ${configure_opts} \ |
67 | ${SRCDIR}/${SRCSUBDIR} \ |
68 | || die |
69 | } |
70 | |
71 | mninja() |
72 | { |
73 | ninja -v ${MAKEOPTS} "$@" |
74 | } |
75 | |
76 | meson_src_compile() |
77 | { |
78 | cd ${SRCDIR} |
79 | |
80 | # remove build dir if exist |
81 | [[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build |
82 | |
83 | # build outside of the source dir |
84 | install -d ${BUILDDIR}/build || die |
85 | cd ${BUILDDIR}/build |
86 | |
87 | meson_configure || die |
88 | mninja || die |
89 | } |
90 | |
91 | meson_src_check() |
92 | { |
93 | cd ${BUILDDIR}/build |
94 | meson test || die |
95 | } |
96 | |
97 | meson_src_install() |
98 | { |
99 | cd ${BUILDDIR}/build |
100 | DESTDIR=${BINDIR} ninja install || die |
101 | |
102 | cd ${SRCDIR} |
103 | local i |
104 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
105 | FAQ LICENSE NEWS README TODO |
106 | do |
107 | if [ -f ${SRCDIR}/${i} ] |
108 | then |
109 | minstalldocs ${i} || die |
110 | fi |
111 | done |
112 | } |
113 | |
114 | export_inherits meson src_prepare src_compile src_check src_install |