[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v8 018/152] configure: generate Meson cross file
From: |
Paolo Bonzini |
Subject: |
[PULL v8 018/152] configure: generate Meson cross file |
Date: |
Fri, 21 Aug 2020 06:21:15 -0400 |
From: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configure | 72 ++++++++++++++++++++++++++++++++++++++++++++++-------
meson.build | 7 +++++-
2 files changed, 69 insertions(+), 10 deletions(-)
diff --git a/configure b/configure
index ce32c568f8..a82045352c 100755
--- a/configure
+++ b/configure
@@ -8626,21 +8626,75 @@ echo >> "$iotests_common_env"
echo "export PYTHON='$python'" >> "$iotests_common_env"
if test "$skip_meson" = no; then
+cross="config-meson.cross.new"
+meson_quote() {
+ echo "['$(echo $* | sed "s/ /','/g")']"
+}
+
+echo "# Automatically generated by configure - do not modify" > $cross
+echo "[properties]" >> $cross
+test -z "$cxx" && echo "link_language = 'c'" >> $cross
+echo "[binaries]" >> $cross
+echo "c = $(meson_quote $cc)" >> $cross
+test -n "$cxx" && echo "cpp = $(meson_quote $cxx)" >> $cross
+echo "ar = $(meson_quote $ar)" >> $cross
+echo "nm = $(meson_quote $nm)" >> $cross
+echo "pkgconfig = $(meson_quote $pkg_config_exe)" >> $cross
+echo "ranlib = $(meson_quote $ranlib)" >> $cross
+echo "strip = $(meson_quote $strip)" >> $cross
+echo "windres = $(meson_quote $windres)" >> $cross
+if test -n "$cross_prefix"; then
+ cross_arg="--cross-file config-meson.cross"
+ # Hack: Meson expects an absolute path for the *build* machine
+ # for the prefix, so add a slash in front of a Windows path that
+ # includes a drive letter.
+ #
+ # See https://github.com/mesonbuild/meson/issues/7577.
+ echo "[host_machine]" >> $cross
+ if test "$mingw32" = "yes" ; then
+ echo "system = 'windows'" >> $cross
+ case $prefix in
+ ?:*) pre_prefix=/ ;;
+ esac
+ fi
+ case "$ARCH" in
+ i386|x86_64)
+ echo "cpu_family = 'x86'" >> $cross
+ ;;
+ ppc64le)
+ echo "cpu_family = 'ppc64'" >> $cross
+ ;;
+ *)
+ echo "cpu_family = '$ARCH'" >> $cross
+ ;;
+ esac
+ echo "cpu = '$cpu'" >> $cross
+ if test "$bigendian" = "yes" ; then
+ echo "endian = 'big'" >> $cross
+ else
+ echo "endian = 'little'" >> $cross
+ fi
+else
+ cross_arg="--native-file config-meson.cross"
+fi
+mv $cross config-meson.cross
+
rm -rf meson-private meson-info meson-logs
NINJA=$PWD/ninjatool $meson setup \
- --prefix "$prefix" \
- --libdir "$libdir" \
- --libexecdir "$libexecdir" \
- --bindir "$bindir" \
- --includedir "$includedir" \
- --datadir "$datadir" \
- --mandir "$mandir" \
- --sysconfdir "$sysconfdir" \
- --localstatedir "$local_statedir" \
+ --prefix "${pre_prefix}$prefix" \
+ --libdir "${pre_prefix}$libdir" \
+ --libexecdir "${pre_prefix}$libexecdir" \
+ --bindir "${pre_prefix}$bindir" \
+ --includedir "${pre_prefix}$includedir" \
+ --datadir "${pre_prefix}$datadir" \
+ --mandir "${pre_prefix}$mandir" \
+ --sysconfdir "${pre_prefix}$sysconfdir" \
+ --localstatedir "${pre_prefix}$local_statedir" \
-Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi)
\
-Ddebug=$(if test "$debug_info" = yes; then echo true; else echo
false; fi) \
-Dwerror=$(if test "$werror" = yes; then echo true; else echo false;
fi) \
-Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false;
fi) \
+ $cross_arg \
"$PWD" "$source_path"
if test "$?" -ne 0 ; then
diff --git a/meson.build b/meson.build
index 613983e464..5ad85a7314 100644
--- a/meson.build
+++ b/meson.build
@@ -15,7 +15,12 @@
add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
add_project_arguments(config_host['QEMU_INCLUDES'].split(),
language: ['c', 'cpp', 'objc'])
-add_languages('cpp', required: false, native: false)
+python = import('python').find_installation()
+
+link_language = meson.get_external_property('link_language', 'cpp')
+if link_language == 'cpp'
+ add_languages('cpp', required: true, native: false)
+endif
if host_machine.system() == 'darwin'
add_languages('objc', required: false, native: false)
endif
--
2.26.2
- [PULL v8 010/152] tests/docker: add test script for static linux-user builds, (continued)
- [PULL v8 010/152] tests/docker: add test script for static linux-user builds, Paolo Bonzini, 2020/08/21
- [PULL v8 005/152] meson: rename included C source files to .c.inc, Paolo Bonzini, 2020/08/21
- [PULL v8 012/152] configure: do not include $(...) variables in config-host.mak, Paolo Bonzini, 2020/08/21
- [PULL v8 011/152] nsis: use "make DESTDIR=" instead of "make prefix=", Paolo Bonzini, 2020/08/21
- [PULL v8 009/152] tests/vm: check for Python YAML parser in the Makefile, Paolo Bonzini, 2020/08/21
- [PULL v8 013/152] configure: expand path variables for meson configure, Paolo Bonzini, 2020/08/21
- [PULL v8 015/152] tests/vm: include setuptools, Paolo Bonzini, 2020/08/21
- [PULL v8 016/152] configure: add support for pseudo-"in source tree" builds, Paolo Bonzini, 2020/08/21
- [PULL v8 014/152] configure: prepare CFLAGS/CXXFLAGS/LDFLAGS for Meson, Paolo Bonzini, 2020/08/21
- [PULL v8 019/152] build-sys hack: link with whole .fa archives, Paolo Bonzini, 2020/08/21
- [PULL v8 018/152] configure: generate Meson cross file,
Paolo Bonzini <=
- [PULL v8 022/152] meson: enable pie, Paolo Bonzini, 2020/08/21
- [PULL v8 021/152] meson: move summary to meson.build, Paolo Bonzini, 2020/08/21
- [PULL v8 020/152] build-sys: add meson submodule, Paolo Bonzini, 2020/08/21
- [PULL v8 025/152] meson: add testsuite Makefile generator, Paolo Bonzini, 2020/08/21
- [PULL v8 024/152] meson: add sparse support, Paolo Bonzini, 2020/08/21
- [PULL v8 023/152] meson: use coverage option, Paolo Bonzini, 2020/08/21
- [PULL v8 028/152] meson: add version.o, Paolo Bonzini, 2020/08/21
- [PULL v8 027/152] meson: add remaining generated tcg trace helpers, Paolo Bonzini, 2020/08/21
- [PULL v8 029/152] contrib/libvhost-user: convert to Meson, Paolo Bonzini, 2020/08/21
- [PULL v8 017/152] configure: integrate Meson in the build system, Paolo Bonzini, 2020/08/21