mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-26 21:10:42 +00:00
configure: integrate Meson in the build system
The Meson build system is integrated in the existing configure/make steps by invoking Meson from the configure script and converting Meson's build.ninja rules to an included Makefile. build.ninja already provides tags/ctags/cscope rules, so they are removed. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
parent
dedad02720
commit
a56650518f
50
Makefile
50
Makefile
@ -49,6 +49,25 @@ git-submodule-update:
|
||||
endif
|
||||
endif
|
||||
|
||||
export NINJA=./ninjatool
|
||||
|
||||
# Running meson regenerates both build.ninja and ninjatool, and that is
|
||||
# enough to prime the rest of the build.
|
||||
ninjatool: build.ninja
|
||||
|
||||
# Only needed in case Makefile.ninja does not exist.
|
||||
.PHONY: ninja-clean ninja-distclean clean-ctlist
|
||||
clean-ctlist:
|
||||
ninja-clean::
|
||||
ninja-distclean::
|
||||
build.ninja: config-host.mak
|
||||
|
||||
Makefile.ninja: build.ninja ninjatool
|
||||
./ninjatool -t ninja2make --omit clean dist uninstall < $< > $@
|
||||
-include Makefile.ninja
|
||||
|
||||
${ninja-targets-c_COMPILER} ${ninja-targets-cpp_COMPILER}: .var.command += -MP
|
||||
|
||||
.git-submodule-status: git-submodule-update config-host.mak
|
||||
|
||||
# Check that we're not trying to do an out-of-tree build from
|
||||
@ -70,7 +89,11 @@ CONFIG_ALL=y
|
||||
|
||||
config-host.mak: $(SRC_PATH)/configure $(SRC_PATH)/pc-bios $(SRC_PATH)/VERSION
|
||||
@echo $@ is out-of-date, running configure
|
||||
@./config.status
|
||||
@if test -f meson-private/coredata.dat; then \
|
||||
./config.status --skip-meson; \
|
||||
else \
|
||||
./config.status; \
|
||||
fi
|
||||
|
||||
# Force configure to re-run if the API symbols are updated
|
||||
ifeq ($(CONFIG_PLUGIN),y)
|
||||
@ -762,7 +785,8 @@ clean-coverage:
|
||||
"CLEAN", "coverage files")
|
||||
endif
|
||||
|
||||
clean: recurse-clean
|
||||
clean: recurse-clean ninja-clean clean-ctlist
|
||||
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean
|
||||
# avoid old build problems by removing potentially incorrect old files
|
||||
rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
|
||||
rm -f qemu-options.def
|
||||
@ -799,7 +823,8 @@ rm -rf $(MANUAL_BUILDDIR)/$1/_static
|
||||
rm -f $(MANUAL_BUILDDIR)/$1/objects.inv $(MANUAL_BUILDDIR)/$1/searchindex.js $(MANUAL_BUILDDIR)/$1/*.html
|
||||
endef
|
||||
|
||||
distclean: clean
|
||||
distclean: clean ninja-distclean
|
||||
-test -f ninjatool && ./ninjatool $(if $(V),-v,) -t clean -g
|
||||
rm -f config-host.mak config-host.h* $(DOCS)
|
||||
rm -f tests/tcg/config-*.mak
|
||||
rm -f config-all-devices.mak config-all-disas.mak config.status
|
||||
@ -807,6 +832,8 @@ distclean: clean
|
||||
rm -f po/*.mo tests/qemu-iotests/common.env
|
||||
rm -f roms/seabios/config.mak roms/vgabios/config.mak
|
||||
rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
|
||||
rm -rf meson-private meson-logs meson-info compile_commands.json
|
||||
rm -f Makefile.ninja ninjatool ninjatool.stamp
|
||||
rm -f config.log
|
||||
rm -f linux-headers/asm
|
||||
rm -f docs/version.texi
|
||||
@ -933,6 +960,8 @@ ICON_SIZES=16x16 24x24 32x32 48x48 64x64 128x128 256x256 512x512
|
||||
install-includedir:
|
||||
$(INSTALL_DIR) "$(DESTDIR)$(includedir)"
|
||||
|
||||
# Needed by "meson install"
|
||||
export DESTDIR
|
||||
install: all $(if $(BUILD_DOCS),install-doc) \
|
||||
install-datadir install-localstatedir install-includedir \
|
||||
$(if $(INSTALL_BLOBS),$(edk2-decompressed)) \
|
||||
@ -1006,21 +1035,6 @@ endif
|
||||
done
|
||||
$(INSTALL_DATA) $(BUILD_DIR)/trace-events-all "$(DESTDIR)$(qemu_datadir)/trace-events-all"
|
||||
|
||||
.PHONY: ctags
|
||||
ctags:
|
||||
rm -f tags
|
||||
find "$(SRC_PATH)" -name '*.[hc]' -exec ctags --append {} +
|
||||
|
||||
.PHONY: TAGS
|
||||
TAGS:
|
||||
rm -f TAGS
|
||||
find "$(SRC_PATH)" -name '*.[hc]' -exec etags --append {} +
|
||||
|
||||
cscope:
|
||||
rm -f "$(SRC_PATH)"/cscope.*
|
||||
find "$(SRC_PATH)/" -name "*.[chsS]" -print | sed 's,^\./,,' > "$(SRC_PATH)/cscope.files"
|
||||
cscope -b -i"$(SRC_PATH)/cscope.files"
|
||||
|
||||
# opengl shader programs
|
||||
ui/shader/%-vert.h: $(SRC_PATH)/ui/shader/%.vert $(SRC_PATH)/scripts/shaderinclude.pl
|
||||
@mkdir -p $(dir $@)
|
||||
|
52
configure
vendored
52
configure
vendored
@ -552,6 +552,8 @@ fuzzing="no"
|
||||
rng_none="no"
|
||||
secret_keyring=""
|
||||
libdaxctl=""
|
||||
meson=""
|
||||
skip_meson=no
|
||||
|
||||
supported_cpu="no"
|
||||
supported_os="no"
|
||||
@ -1048,6 +1050,10 @@ for opt do
|
||||
;;
|
||||
--sphinx-build=*) sphinx_build="$optarg"
|
||||
;;
|
||||
--skip-meson) skip_meson=yes
|
||||
;;
|
||||
--meson=*) meson="$optarg"
|
||||
;;
|
||||
--gcov=*) gcov_tool="$optarg"
|
||||
;;
|
||||
--smbd=*) smbd="$optarg"
|
||||
@ -1813,6 +1819,7 @@ Advanced options (experts only):
|
||||
--install=INSTALL use specified install [$install]
|
||||
--python=PYTHON use specified python [$python]
|
||||
--sphinx-build=SPHINX use specified sphinx-build [$sphinx_build]
|
||||
--meson=MESON use specified meson [$meson]
|
||||
--smbd=SMBD use specified smbd [$smbd]
|
||||
--with-git=GIT use specified git [$git]
|
||||
--static enable static build [$static]
|
||||
@ -2020,6 +2027,16 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
|
||||
# Suppress writing compiled files
|
||||
python="$python -B"
|
||||
|
||||
if ! has "$meson"
|
||||
then
|
||||
error_exit "Meson not found. Use --meson=/path/to/meson"
|
||||
fi
|
||||
meson=$(command -v $meson)
|
||||
|
||||
if ! $python -c 'import pkg_resources' > /dev/null 2>&1; then
|
||||
error_exit "Python setuptools not found"
|
||||
fi
|
||||
|
||||
# Check that the C compiler works. Doing this here before testing
|
||||
# the host CPU ensures that we had a valid CC to autodetect the
|
||||
# $cpu var (and we should bail right here if that's not the case).
|
||||
@ -6550,13 +6567,13 @@ elif test "$fortify_source" = "yes" ; then
|
||||
QEMU_CFLAGS="-U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 $QEMU_CFLAGS"
|
||||
debug=no
|
||||
fi
|
||||
if test "$debug" = "no"; then
|
||||
CFLAGS="-O2 $CFLAGS"
|
||||
fi
|
||||
if test "$debug_info" = "yes"; then
|
||||
CFLAGS="-g $CFLAGS"
|
||||
LDFLAGS="-g $LDFLAGS"
|
||||
fi
|
||||
if test "$debug" = "no"; then
|
||||
CFLAGS="-O2 $CFLAGS"
|
||||
fi
|
||||
|
||||
case "$ARCH" in
|
||||
alpha)
|
||||
@ -8001,6 +8018,7 @@ echo "PYTHON=$python" >> $config_host_mak
|
||||
echo "SPHINX_BUILD=$sphinx_build" >> $config_host_mak
|
||||
echo "SPHINX_WERROR=$sphinx_werror" >> $config_host_mak
|
||||
echo "GENISOIMAGE=$genisoimage" >> $config_host_mak
|
||||
echo "MESON=$meson" >> $config_host_mak
|
||||
echo "CC=$cc" >> $config_host_mak
|
||||
if $iasl -h > /dev/null 2>&1; then
|
||||
echo "IASL=$iasl" >> $config_host_mak
|
||||
@ -8611,6 +8629,30 @@ echo "# Automatically generated by configure - do not modify" > "$iotests_common
|
||||
echo >> "$iotests_common_env"
|
||||
echo "export PYTHON='$python'" >> "$iotests_common_env"
|
||||
|
||||
if test "$skip_meson" = no; then
|
||||
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" \
|
||||
-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) \
|
||||
"$PWD" "$source_path"
|
||||
|
||||
if test "$?" -ne 0 ; then
|
||||
error_exit "meson setup failed"
|
||||
fi
|
||||
touch ninjatool.stamp
|
||||
fi
|
||||
|
||||
# Save the configure command line for later reuse.
|
||||
cat <<EOD >config.status
|
||||
#!/bin/sh
|
||||
@ -8659,7 +8701,9 @@ preserve_env STRIP
|
||||
preserve_env WINDRES
|
||||
|
||||
printf "exec" >>config.status
|
||||
printf " '%s'" "$0" "$@" >>config.status
|
||||
for i in "$0" "$@"; do
|
||||
test "$i" = --skip-meson || printf " '%s'" "$i" >>config.status
|
||||
done
|
||||
echo ' "$@"' >>config.status
|
||||
chmod +x config.status
|
||||
|
||||
|
25
meson.build
Normal file
25
meson.build
Normal file
@ -0,0 +1,25 @@
|
||||
project('qemu', ['c'], meson_version: '>=0.55.0',
|
||||
default_options: ['warning_level=1', 'c_std=gnu99', 'cpp_std=gnu++11', 'b_lundef=false'],
|
||||
version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
|
||||
|
||||
not_found = dependency('', required: false)
|
||||
keyval = import('unstable-keyval')
|
||||
config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
|
||||
|
||||
add_project_arguments(config_host['QEMU_CFLAGS'].split(),
|
||||
native: false, language: ['c', 'objc'])
|
||||
add_project_arguments(config_host['QEMU_CXXFLAGS'].split(),
|
||||
native: false, language: 'cpp')
|
||||
add_project_link_arguments(config_host['QEMU_LDFLAGS'].split(),
|
||||
native: false, language: ['c', 'cpp', 'objc'])
|
||||
add_project_arguments(config_host['QEMU_INCLUDES'].split(),
|
||||
language: ['c', 'cpp', 'objc'])
|
||||
|
||||
add_languages('cpp', required: false, native: false)
|
||||
if host_machine.system() == 'darwin'
|
||||
add_languages('objc', required: false, native: false)
|
||||
endif
|
||||
|
||||
configure_file(input: files('scripts/ninjatool.py'),
|
||||
output: 'ninjatool',
|
||||
configuration: config_host)
|
1002
scripts/ninjatool.py
Executable file
1002
scripts/ninjatool.py
Executable file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user