19 |
meson_disable() |
meson_disable() |
20 |
{ |
{ |
21 |
local feature="$1" |
local feature="$1" |
22 |
echo "-Denable_${feature}=false" |
echo "-Denable-${feature}=false" |
23 |
} |
} |
24 |
|
|
25 |
# enables features like --with-blah with make |
# enables features like --with-blah with make |
36 |
meson_without() |
meson_without() |
37 |
{ |
{ |
38 |
local feature="$1" |
local feature="$1" |
39 |
echo "-Dwith-{feature}=false" |
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 |
# generic meson opts |
67 |
meson_configure() |
meson_configure() |
68 |
{ |
{ |
69 |
local configure_opts="$@" |
local configure_opts="$@" |
70 |
|
local default_opts |
71 |
|
|
72 |
meson setup \ |
default_opts+=" --buildtype=release" |
73 |
--buildtype=release \ |
default_opts+=" --prefix=/usr" |
74 |
--prefix=/usr \ |
default_opts+=" --sysconfdir=/etc" |
75 |
--sysconfdir=/etc \ |
default_opts+=" --localstatedir=/var/lib" |
76 |
--localstatedir=/var/lib \ |
|
77 |
--libdir=/usr/$(mlibdir) \ |
if [[ ${MULTILIB_BUILD} = true ]] |
78 |
--libexecdir=/usr/$(mlibdir)/${PNAME} \ |
then |
79 |
${configure_opts} \ |
# must be escaped so the mlibdir variable gets evaluated later |
80 |
${SRCDIR}/${SRCSUBDIR} \ |
default_opts+=' --libdir=/usr/$(mlibdir)' |
81 |
|| die |
default_opts+=' --libexecdir=/usr/$(mlibdir)/${PNAME}' |
82 |
|
: ${MESON_SRCDIR="${SRCDIR}-$(mabi)/${SRCSUBDIR}"} |
83 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build-$(mabi)"} |
84 |
|
all-abis meson setup ${default_opts} ${configure_opts} ${MESON_SRCDIR} ${MESON_BUILDDIR} || die |
85 |
|
else |
86 |
|
# the mlibdir variable gets right now evaluated |
87 |
|
default_opts+=" --libdir=/usr/$(mlibdir)" |
88 |
|
default_opts+=" --libexecdir=/usr/$(mlibdir)/${PNAME}" |
89 |
|
: ${MESON_SRCDIR="${SRCDIR}/${SRCSUBDIR}"} |
90 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build"} |
91 |
|
meson setup ${default_opts} ${configure_opts} ${MESON_SRCDIR} ${MESON_BUILDDIR} || die |
92 |
|
fi |
93 |
} |
} |
94 |
|
|
95 |
mninja() |
mninja() |
96 |
{ |
{ |
97 |
ninja -v ${MAKEOPTS} "$@" |
local abi |
98 |
|
local abis_to_run="${MULTILIB_ABIS}" |
99 |
|
|
100 |
|
# respect MULTILIB_ONLY_ABI variable |
101 |
|
[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
102 |
|
|
103 |
|
if [[ ${MULTILIB_BUILD} = true ]] |
104 |
|
then |
105 |
|
for abi in ${abis_to_run} |
106 |
|
do |
107 |
|
echo -e "${COLBLUE}*** ${COLGREEN}running ninja for ABI -${abi}${COLDEFAULT}" |
108 |
|
: ${MESON_SRCDIR="${SRCDIR}-$(mabi)/${SRCSUBDIR}"} |
109 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build-$(mabi)"} |
110 |
|
abi-${abi} ninja -C ${MESON_SRCDIR} -C ${MESON_BUILDDIR} -v ${MAKEOPTS} "$@" |
111 |
|
done |
112 |
|
else |
113 |
|
: ${MESON_SRCDIR="${SRCDIR}/${SRCSUBDIR}"} |
114 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build"} |
115 |
|
ninja -C ${MESON_SRCDIR} -C ${MESON_BUILDDIR} -v ${MAKEOPTS} "$@" |
116 |
|
fi |
117 |
|
} |
118 |
|
|
119 |
|
meson_setup_builddir() |
120 |
|
{ |
121 |
|
local abi |
122 |
|
local abis_to_run="${MULTILIB_ABIS}" |
123 |
|
|
124 |
|
# respect MULTILIB_ONLY_ABI variable |
125 |
|
[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
126 |
|
|
127 |
|
if [[ ${MULTILIB_BUILD} = true ]] |
128 |
|
then |
129 |
|
for abi in ${abis_to_run} |
130 |
|
do |
131 |
|
echo -e "${COLBLUE}*** ${COLGREEN}running ninja for ABI -${abi}${COLDEFAULT}" |
132 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build-$(mabi)"} |
133 |
|
abi-${abi} install -d ${MESON_BUILDDIR} || die |
134 |
|
done |
135 |
|
else |
136 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build"} |
137 |
|
install -d ${MESON_BUILDDIR} || die |
138 |
|
fi |
139 |
} |
} |
140 |
|
|
141 |
meson_src_compile() |
meson_src_compile() |
142 |
{ |
{ |
143 |
cd ${SRCDIR} |
if [[ ${MULTILIB_BUILD} != true ]] |
144 |
|
then |
145 |
|
: ${MESON_SRCDIR="${SRCDIR}"} |
146 |
|
cd ${MESON_SRCDIR} |
147 |
|
fi |
148 |
|
|
149 |
# remove build dir if exist |
meson_setup_builddir || die |
150 |
[[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build |
meson_configure "$@" || die |
|
|
|
|
# build outside of the source dir |
|
|
install -d ${BUILDDIR}/build || die |
|
|
cd ${BUILDDIR}/build |
|
|
|
|
|
meson_configure || die |
|
151 |
mninja || die |
mninja || die |
152 |
} |
} |
153 |
|
|
154 |
meson_src_check() |
meson_src_check() |
155 |
{ |
{ |
156 |
cd ${BUILDDIR}/build |
: ${MESON_BUILDDIR="${BUILDDIR}/build"} |
157 |
|
cd ${MESON_BUILDDIR} |
158 |
meson test || die |
meson test || die |
159 |
} |
} |
160 |
|
|
161 |
|
meson_multilib_src_check() |
162 |
|
{ |
163 |
|
local abi |
164 |
|
local abis_to_run="${MULTILIB_ABIS}" |
165 |
|
|
166 |
|
# respect MULTILIB_ONLY_ABI variable |
167 |
|
[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
168 |
|
for abi in ${abis_to_run} |
169 |
|
do |
170 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build-${abi}"} |
171 |
|
cd ${MESON_BUILDDIR} |
172 |
|
meson test || die |
173 |
|
done |
174 |
|
} |
175 |
|
|
176 |
meson_src_install() |
meson_src_install() |
177 |
{ |
{ |
178 |
cd ${BUILDDIR}/build |
: ${MESON_SRCDIR="${SRCDIR}"} |
179 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build"} |
180 |
|
|
181 |
|
cd ${MESON_BUILDDIR} |
182 |
DESTDIR=${BINDIR} ninja install || die |
DESTDIR=${BINDIR} ninja install || die |
183 |
|
|
184 |
cd ${SRCDIR} |
cd ${MESON_SRCDIR} |
185 |
local i |
local i |
186 |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
187 |
FAQ LICENSE NEWS README TODO |
FAQ LICENSE NEWS README TODO |
188 |
do |
do |
189 |
if [ -f ${SRCDIR}/${i} ] |
if [ -f ${MESON_SRCDIR}/${i} ] |
190 |
then |
then |
191 |
minstalldocs ${i} || die |
minstalldocs ${i} || die |
192 |
fi |
fi |
193 |
done |
done |
194 |
} |
} |
195 |
|
|
196 |
export_inherits meson src_prepare src_compile src_check src_install |
meson_multilib_src_install() |
197 |
|
{ |
198 |
|
local abi |
199 |
|
local abis_to_run="${MULTILIB_ABIS}" |
200 |
|
|
201 |
|
# respect MULTILIB_ONLY_ABI variable |
202 |
|
[[ ! -z ${MULTILIB_ONLY_ABI} ]] && abis_to_run="${MULTILIB_ONLY_ABI}" |
203 |
|
for abi in ${abis_to_run} |
204 |
|
do |
205 |
|
: ${MESON_SRCDIR="${SRCDIR}-${abi}"} |
206 |
|
: ${MESON_BUILDDIR="${BUILDDIR}/build-${abi}"} |
207 |
|
|
208 |
|
cd ${MESON_BUILDDIR} |
209 |
|
DESTDIR=${BINDIR} ninja install || die |
210 |
|
|
211 |
|
cd ${MESON_SRCDIR} |
212 |
|
local i |
213 |
|
for i in ABOUT-NLS AUTHORS BUGS CHANGES ChangeLog COPYING \ |
214 |
|
FAQ LICENSE NEWS README TODO |
215 |
|
do |
216 |
|
if [ -f ${MESON_SRCDIR}/${i} ] |
217 |
|
then |
218 |
|
minstalldocs ${i} || die |
219 |
|
fi |
220 |
|
done |
221 |
|
done |
222 |
|
} |
223 |
|
|
224 |
|
export_inherits meson src_prepare src_compile |
225 |
|
if [[ ${MULTILIB_BUILD} = true ]] |
226 |
|
then |
227 |
|
export_inherits meson_multilib src_check src_install |
228 |
|
else |
229 |
|
export_inherits meson src_check src_install |
230 |
|
fi |