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 |
|
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() |
mninja() |
92 |
{ |
{ |
93 |
ninja -v ${MAKEOPTS} "$@" |
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() |
meson_src_compile() |
112 |
{ |
{ |
113 |
cd ${SRCDIR} |
if [[ ${MULTILIB_BUILD} != true ]] |
114 |
|
then |
115 |
# remove build dir if exist |
cd ${SRCDIR} |
116 |
[[ -d ${BUILDDIR}/build ]] && rm -rf ${BUILDDIR}/build |
fi |
117 |
|
|
118 |
# build outside of the source dir |
meson_setup_builddir || die |
119 |
install -d ${BUILDDIR}/build || die |
meson_configure "$@" || die |
|
cd ${BUILDDIR}/build |
|
|
|
|
|
meson_configure || die |
|
120 |
mninja || die |
mninja || die |
121 |
} |
} |
122 |
|
|
126 |
meson test || die |
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() |
meson_src_install() |
144 |
{ |
{ |
145 |
cd ${BUILDDIR}/build |
cd ${BUILDDIR}/build |
157 |
done |
done |
158 |
} |
} |
159 |
|
|
160 |
export_inherits meson src_prepare src_compile src_check src_install |
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 |