Contents of /trunk/include/meson.sminc
Parent Directory
|
Revision Log
Revision 30917 -
(show annotations)
(download)
Wed May 16 08:06:56 2018 UTC (5 years, 11 months ago) by niro
File size: 3722 byte(s)
Wed May 16 08:06:56 2018 UTC (5 years, 11 months ago) by niro
File size: 3722 byte(s)
-meson_with(): fixed broken feature variable evalutation
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 | meson_bool_true() |
43 | { |
44 | local feature="$1" |
45 | meson_opt "${feature}" "true" |
46 | } |
47 | |
48 | meson_bool_false() |
49 | { |
50 | local feature="$1" |
51 | meson_opt "${feature}" "false" |
52 | } |
53 | |
54 | # generic meson opts |
55 | meson_opt() |
56 | { |
57 | local feature="$1" |
58 | local option="$2" |
59 | echo "-D${feature}=${option}" |
60 | } |
61 | |
62 | meson_src_prepare() |
63 | { |
64 | munpack ${SRCFILE} || die |
65 | } |
66 | |
67 | meson_configure() |
68 | { |
69 | local configure_opts="$@" |
70 | local default_opts |
71 | |
72 | default_opts+=" --buildtype=release" |
73 | default_opts+=" --prefix=/usr" |
74 | default_opts+=" --sysconfdir=/etc" |
75 | default_opts+=" --localstatedir=/var/lib" |
76 | |
77 | if [[ ${MULTILIB_BUILD} = true ]] |
78 | then |
79 | # must be escaped so the mlibdir variable gets evaluated later |
80 | default_opts+=' --libdir=/usr/$(mlibdir)' |
81 | default_opts+=' --libexecdir=/usr/$(mlibdir)/${PNAME}' |
82 | all-abis meson setup ${default_opts} ${configure_opts} ${SRCDIR}-$(mabi)/${SRCSUBDIR} ${BUILDDIR}/build-$(mabi) || die |
83 | else |
84 | # the mlibdir variable gets right now evaluated |
85 | default_opts+=" --libdir=/usr/$(mlibdir)" |
86 | default_opts+=" --libexecdir=/usr/$(mlibdir)/${PNAME}" |
87 | meson setup ${default_opts} ${configure_opts} ${SRCDIR}/${SRCSUBDIR} ${BUILDDIR}/build || die |
88 | fi |
89 | } |
90 | |
91 | mninja() |
92 | { |
93 | if [[ ${MULTILIB_BUILD} = true ]] |
94 | then |
95 | all-abis ninja -C ${SRCDIR}-$(mabi)/${SRCSUBDIR} -C ${BUILDDIR}/build-$(mabi) -v ${MAKEOPTS} "$@" |
96 | else |
97 | ninja -C ${SRCDIR}/${SRCSUBDIR} -C ${BUILDDIR}/build -v ${MAKEOPTS} "$@" |
98 | fi |
99 | } |
100 | |
101 | meson_setup_builddir() |
102 | { |
103 | if [[ ${MULTILIB_BUILD} = true ]] |
104 | then |
105 | all-abis install -d ${BUILDDIR}/build-$(mabi) || die |
106 | else |
107 | install -d ${BUILDDIR}/build || die |
108 | fi |
109 | } |
110 | |
111 | meson_src_compile() |
112 | { |
113 | if [[ ${MULTILIB_BUILD} != true ]] |
114 | then |
115 | cd ${SRCDIR} |
116 | fi |
117 | |
118 | meson_setup_builddir || die |
119 | meson_configure "$@" || die |
120 | mninja || die |
121 | } |
122 | |
123 | meson_src_check() |
124 | { |
125 | cd ${BUILDDIR}/build |
126 | meson test || die |
127 | } |
128 | |
129 | meson_multilib_src_check() |
130 | { |
131 | local abi |
132 | local abis_to_run="${MULTILIB_ABIS}" |
133 | |
134 | # respect MULTILIB_ONLY_ABI variable |
135 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
136 | for abi in ${abis_to_run} |
137 | do |
138 | cd ${BUILDDIR}/build-${abi} |
139 | meson test || die |
140 | done |
141 | } |
142 | |
143 | meson_src_install() |
144 | { |
145 | cd ${BUILDDIR}/build |
146 | DESTDIR=${BINDIR} ninja install || die |
147 | |
148 | cd ${SRCDIR} |
149 | local i |
150 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
151 | FAQ LICENSE NEWS README TODO |
152 | do |
153 | if [ -f ${SRCDIR}/${i} ] |
154 | then |
155 | minstalldocs ${i} || die |
156 | fi |
157 | done |
158 | } |
159 | |
160 | meson_multilib_src_install() |
161 | { |
162 | local abi |
163 | local abis_to_run="${MULTILIB_ABIS}" |
164 | |
165 | # respect MULTILIB_ONLY_ABI variable |
166 | [[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
167 | for abi in ${abis_to_run} |
168 | do |
169 | cd ${BUILDDIR}/build-${abi} |
170 | DESTDIR=${BINDIR} ninja install || die |
171 | |
172 | cd ${SRCDIR}-${abi} |
173 | local i |
174 | for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
175 | FAQ LICENSE NEWS README TODO |
176 | do |
177 | if [ -f ${SRCDIR}-${abi}/${i} ] |
178 | then |
179 | minstalldocs ${i} || die |
180 | fi |
181 | done |
182 | done |
183 | } |
184 | |
185 | export_inherits meson src_prepare src_compile |
186 | if [[ ${MULTILIB_BUILD} = true ]] |
187 | then |
188 | export_inherits meson_multilib src_check src_install |
189 | else |
190 | export_inherits meson src_check src_install |
191 | fi |