2017-04-28 09:28:42 +02:00
|
|
|
#
|
2017-11-24 07:43:34 +01:00
|
|
|
# This helper is for templates using meson.
|
2017-04-28 09:28:42 +02:00
|
|
|
#
|
2019-02-26 15:56:47 +01:00
|
|
|
do_patch() {
|
2017-09-24 01:42:47 +02:00
|
|
|
: ${meson_crossfile:=xbps_meson.cross}
|
|
|
|
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
|
|
|
_MESON_TARGET_ENDIAN=little
|
2018-07-28 13:49:47 +02:00
|
|
|
# drop the -musl suffix to the target cpu, meson doesn't recognize it
|
|
|
|
_MESON_TARGET_CPU=${XBPS_TARGET_MACHINE/-musl/}
|
2017-09-24 01:42:47 +02:00
|
|
|
case "$XBPS_TARGET_MACHINE" in
|
2017-11-14 19:39:02 +01:00
|
|
|
mips|mips-musl|mipshf-musl)
|
2017-09-24 01:42:47 +02:00
|
|
|
_MESON_TARGET_ENDIAN=big
|
2018-07-28 13:49:47 +02:00
|
|
|
_MESON_CPU_FAMILY=mips
|
|
|
|
;;
|
|
|
|
armv*)
|
|
|
|
_MESON_CPU_FAMILY=arm
|
|
|
|
;;
|
|
|
|
i686*)
|
|
|
|
_MESON_CPU_FAMILY=x86
|
|
|
|
;;
|
2019-04-27 13:58:16 +02:00
|
|
|
ppc64le*)
|
2019-11-27 21:41:55 +01:00
|
|
|
_MESON_CPU_FAMILY=ppc64
|
2019-01-01 00:24:00 +01:00
|
|
|
;;
|
2019-04-27 13:58:16 +02:00
|
|
|
ppc64*)
|
2019-01-01 00:24:00 +01:00
|
|
|
_MESON_TARGET_ENDIAN=big
|
|
|
|
_MESON_CPU_FAMILY=ppc64
|
|
|
|
;;
|
2020-04-30 01:05:23 +02:00
|
|
|
ppcle*)
|
|
|
|
_MESON_CPU_FAMILY=ppc
|
|
|
|
;;
|
|
|
|
ppc*)
|
|
|
|
_MESON_TARGET_ENDIAN=big
|
|
|
|
_MESON_CPU_FAMILY=ppc
|
|
|
|
;;
|
2018-07-28 13:49:47 +02:00
|
|
|
*)
|
|
|
|
# if we reached here that means that the cpu and cpu_family
|
|
|
|
# are the same like 'x86_64' and 'aarch64'
|
|
|
|
_MESON_CPU_FAMILY=${_MESON_TARGET_CPU}
|
2017-09-24 01:42:47 +02:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Record cross-compiling information in cross file.
|
|
|
|
# CFLAGS and LDFLAGS must be set as c_args and c_link_args.
|
|
|
|
cat > ${meson_crossfile} <<EOF
|
|
|
|
[binaries]
|
|
|
|
c = '${CC}'
|
|
|
|
cpp = '${CXX}'
|
2018-09-16 11:29:40 +02:00
|
|
|
ar = '${XBPS_CROSS_TRIPLET}-gcc-ar'
|
2018-09-10 06:29:52 +02:00
|
|
|
nm = '${NM}'
|
2017-09-24 01:42:47 +02:00
|
|
|
ld = '${LD}'
|
|
|
|
strip = '${STRIP}'
|
|
|
|
readelf = '${READELF}'
|
2019-02-25 17:27:42 +01:00
|
|
|
objcopy = '${OBJCOPY}'
|
2020-05-07 19:43:49 +02:00
|
|
|
pkgconfig = '${PKG_CONFIG}'
|
2021-02-20 13:12:20 +01:00
|
|
|
rust = ['rustc', '--target', '${RUST_TARGET}' ,'--sysroot', '${XBPS_CROSS_BASE}/usr']
|
2019-01-29 19:57:37 +01:00
|
|
|
g-ir-scanner = '${XBPS_CROSS_BASE}/usr/bin/g-ir-scanner'
|
|
|
|
g-ir-compiler = '${XBPS_CROSS_BASE}/usr/bin/g-ir-compiler'
|
|
|
|
g-ir-generate = '${XBPS_CROSS_BASE}/usr/bin/g-ir-generate'
|
2020-07-13 19:09:35 +02:00
|
|
|
llvm-config = '/usr/bin/llvm-config'
|
|
|
|
cups-config = '${XBPS_CROSS_BASE}/usr/bin/cups-config'
|
2017-09-24 01:42:47 +02:00
|
|
|
|
|
|
|
[properties]
|
|
|
|
needs_exe_wrapper = true
|
2021-02-20 13:12:20 +01:00
|
|
|
|
|
|
|
[built-in options]
|
2017-09-24 01:42:47 +02:00
|
|
|
c_args = ['$(echo ${CFLAGS} | sed -r "s/\s+/','/g")']
|
|
|
|
c_link_args = ['$(echo ${LDFLAGS} | sed -r "s/\s+/','/g")']
|
2017-09-30 12:09:47 +02:00
|
|
|
|
|
|
|
cpp_args = ['$(echo ${CXXFLAGS} | sed -r "s/\s+/','/g")']
|
|
|
|
cpp_link_args = ['$(echo ${LDFLAGS} | sed -r "s/\s+/','/g")']
|
2017-09-24 01:42:47 +02:00
|
|
|
|
|
|
|
[host_machine]
|
|
|
|
system = 'linux'
|
2018-07-28 13:49:47 +02:00
|
|
|
cpu_family = '${_MESON_CPU_FAMILY}'
|
2017-09-24 01:42:47 +02:00
|
|
|
cpu = '${_MESON_TARGET_CPU}'
|
|
|
|
endian = '${_MESON_TARGET_ENDIAN}'
|
|
|
|
EOF
|
2019-10-19 15:25:45 +02:00
|
|
|
if [[ $build_helper = *"qemu"* ]]; then
|
2019-10-16 23:40:47 +02:00
|
|
|
sed -e "/\[binaries\]/ a exe_wrapper = '/usr/bin/qemu-${XBPS_TARGET_QEMU_MACHINE}-static'" \
|
|
|
|
-i ${meson_crossfile}
|
|
|
|
fi
|
2019-02-26 15:56:47 +01:00
|
|
|
|
|
|
|
unset _MESON_CPU_FAMILY _MESON_TARGET_CPU _MESON_TARGET_ENDIAN
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
do_configure() {
|
|
|
|
: ${meson_cmd:=meson}
|
|
|
|
: ${meson_builddir:=build}
|
2019-02-28 13:42:55 +01:00
|
|
|
: ${meson_crossfile:=xbps_meson.cross}
|
2019-02-26 15:56:47 +01:00
|
|
|
|
|
|
|
if [ "$CROSS_BUILD" ]; then
|
2017-09-24 01:42:47 +02:00
|
|
|
configure_args+=" --cross-file=${meson_crossfile}"
|
|
|
|
fi
|
2017-04-28 09:28:42 +02:00
|
|
|
|
2021-01-13 21:37:28 +01:00
|
|
|
# binutils ar needs a plugin when LTO is used on static libraries, so we
|
|
|
|
# have to use the gcc-ar wrapper that calls the correct plugin.
|
|
|
|
# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
|
|
|
|
# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
|
|
|
|
# issues with static libraries + LTO by defaulting to gcc-ar themselves.
|
|
|
|
# We also force gcc-ar usage in the crossfile above.
|
|
|
|
export AR="gcc-ar"
|
|
|
|
|
2018-10-09 12:13:52 +02:00
|
|
|
${meson_cmd} \
|
|
|
|
--prefix=/usr \
|
2020-12-22 22:06:08 +01:00
|
|
|
--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \
|
2018-10-09 12:13:52 +02:00
|
|
|
--libexecdir=/usr/libexec \
|
|
|
|
--bindir=/usr/bin \
|
|
|
|
--sbindir=/usr/bin \
|
|
|
|
--includedir=/usr/include \
|
|
|
|
--datadir=/usr/share \
|
|
|
|
--mandir=/usr/share/man \
|
|
|
|
--infodir=/usr/share/info \
|
|
|
|
--localedir=/usr/share/locale \
|
|
|
|
--sysconfdir=/etc \
|
|
|
|
--localstatedir=/var \
|
|
|
|
--sharedstatedir=/var/lib \
|
|
|
|
--buildtype=plain \
|
2020-10-15 00:03:31 +02:00
|
|
|
--auto-features=auto \
|
2018-10-09 12:13:52 +02:00
|
|
|
--wrap-mode=nodownload \
|
|
|
|
-Db_lto=true -Db_ndebug=true \
|
2019-02-05 07:40:31 +01:00
|
|
|
-Db_staticpic=true \
|
2018-10-09 12:13:52 +02:00
|
|
|
${configure_args} . ${meson_builddir}
|
2017-04-28 09:28:42 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
: ${make_cmd:=ninja}
|
|
|
|
: ${make_build_target:=all}
|
|
|
|
: ${meson_builddir:=build}
|
|
|
|
|
|
|
|
${make_cmd} -C ${meson_builddir} ${makejobs} ${make_build_args} ${make_build_target}
|
|
|
|
}
|
|
|
|
|
2017-11-27 23:22:24 +01:00
|
|
|
do_check() {
|
|
|
|
: ${make_cmd:=ninja}
|
|
|
|
: ${make_check_target:=test}
|
|
|
|
: ${meson_builddir:=build}
|
|
|
|
|
|
|
|
${make_cmd} -C ${meson_builddir} ${makejobs} ${make_check_args} ${make_check_target}
|
|
|
|
}
|
|
|
|
|
2017-04-28 09:28:42 +02:00
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=ninja}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
: ${meson_builddir:=build}
|
|
|
|
|
|
|
|
DESTDIR=${DESTDIR} ${make_cmd} -C ${meson_builddir} ${make_install_args} ${make_install_target}
|
|
|
|
}
|