Remove the embedded meson distribution. 13/322513/1
authorwanchao.xu <wanchao.xu@samsung.com>
Thu, 10 Apr 2025 07:53:28 +0000 (15:53 +0800)
committerwanchao.xu <wanchao.xu@samsung.com>
Thu, 10 Apr 2025 07:53:28 +0000 (15:53 +0800)
Change-Id: I86fec93bac6f80c9e0f42a71afee79e9f5770a79
Signed-off-by: wanchao.xu <wanchao.xu@samsung.com>
451 files changed:
meson/.coveragerc [deleted file]
meson/.editorconfig [deleted file]
meson/.flake8 [deleted file]
meson/.gitattributes [deleted file]
meson/.github/ISSUE_TEMPLATE/bug_report.md [deleted file]
meson/.github/workflows/ci_frameworks.yml [deleted file]
meson/.github/workflows/images.yml [deleted file]
meson/.github/workflows/lint_mypy.yml [deleted file]
meson/.github/workflows/os_comp.yml [deleted file]
meson/.github/workflows/unusedargs_missingreturn.yml [deleted file]
meson/.gitignore [deleted file]
meson/.mailmap [deleted file]
meson/.mypy.ini [deleted file]
meson/.pylintrc [deleted file]
meson/.travis.yml [deleted file]
meson/CODEOWNERS [deleted file]
meson/COPYING [deleted file]
meson/MANIFEST.in [deleted file]
meson/README.md [deleted file]
meson/__main__.py [deleted file]
meson/azure-pipelines.yml [deleted file]
meson/ci/azure-steps.yml [deleted file]
meson/ci/ciimage/.gitignore [deleted file]
meson/ci/ciimage/arch/image.json [deleted file]
meson/ci/ciimage/arch/install.sh [deleted file]
meson/ci/ciimage/bionic/image.json [deleted file]
meson/ci/ciimage/bionic/install.sh [deleted file]
meson/ci/ciimage/build.py [deleted file]
meson/ci/ciimage/common.sh [deleted file]
meson/ci/ciimage/cuda/image.json [deleted file]
meson/ci/ciimage/cuda/install.sh [deleted file]
meson/ci/ciimage/eoan/image.json [deleted file]
meson/ci/ciimage/eoan/install.sh [deleted file]
meson/ci/ciimage/eoan/test.sh [deleted file]
meson/ci/ciimage/fedora/image.json [deleted file]
meson/ci/ciimage/fedora/install.sh [deleted file]
meson/ci/ciimage/opensuse/image.json [deleted file]
meson/ci/ciimage/opensuse/install.sh [deleted file]
meson/ci/run.ps1 [deleted file]
meson/ci/travis_install.sh [deleted file]
meson/ci/travis_script.sh [deleted file]
meson/contributing.md [deleted file]
meson/cross/armcc.txt [deleted file]
meson/cross/armclang-linux.txt [deleted file]
meson/cross/armclang.txt [deleted file]
meson/cross/c2000.txt [deleted file]
meson/cross/ccrx.txt [deleted file]
meson/cross/iphone.txt [deleted file]
meson/cross/linux-mingw-w64-32bit.txt [deleted file]
meson/cross/linux-mingw-w64-64bit.txt [deleted file]
meson/cross/ownstdlib.txt [deleted file]
meson/cross/tvos.txt [deleted file]
meson/cross/ubuntu-armhf.txt [deleted file]
meson/cross/ubuntu-faketarget.txt [deleted file]
meson/cross/wasm.txt [deleted file]
meson/cross/xc16.txt [deleted file]
meson/data/com.mesonbuild.install.policy [deleted file]
meson/data/macros.meson [deleted file]
meson/data/schema.xsd [deleted file]
meson/data/shell-completions/bash/meson [deleted file]
meson/data/shell-completions/zsh/_meson [deleted file]
meson/data/syntax-highlighting/emacs/meson.el [deleted file]
meson/data/syntax-highlighting/vim/README [deleted file]
meson/data/syntax-highlighting/vim/ftdetect/meson.vim [deleted file]
meson/data/syntax-highlighting/vim/ftplugin/meson.vim [deleted file]
meson/data/syntax-highlighting/vim/indent/meson.vim [deleted file]
meson/data/syntax-highlighting/vim/syntax/meson.vim [deleted file]
meson/data/test.schema.json [deleted file]
meson/docs/.editorconfig [deleted file]
meson/docs/README.md [deleted file]
meson/docs/genrelnotes.py [deleted file]
meson/docs/markdown/ARM-performance-test.md [deleted file]
meson/docs/markdown/Adding-arguments.md [deleted file]
meson/docs/markdown/Adding-new-projects-to-wrapdb.md [deleted file]
meson/docs/markdown/Additional.md [deleted file]
meson/docs/markdown/Build-options.md [deleted file]
meson/docs/markdown/Build-system-converters.md [deleted file]
meson/docs/markdown/Build-targets.md [deleted file]
meson/docs/markdown/Builtin-options.md [deleted file]
meson/docs/markdown/CMake-module.md [deleted file]
meson/docs/markdown/Comparisons.md [deleted file]
meson/docs/markdown/Compiler-properties.md [deleted file]
meson/docs/markdown/Conference-presentations.md [deleted file]
meson/docs/markdown/Configuration.md [deleted file]
meson/docs/markdown/Configuring-a-build-directory.md [deleted file]
meson/docs/markdown/Contact-information.md [deleted file]
meson/docs/markdown/Continuous-Integration.md [deleted file]
meson/docs/markdown/Contributing.md [deleted file]
meson/docs/markdown/Creating-Linux-binaries.md [deleted file]
meson/docs/markdown/Creating-OSX-packages.md [deleted file]
meson/docs/markdown/Creating-releases.md [deleted file]
meson/docs/markdown/Cross-compilation.md [deleted file]
meson/docs/markdown/Cuda-module.md [deleted file]
meson/docs/markdown/Custom-build-targets.md [deleted file]
meson/docs/markdown/D.md [deleted file]
meson/docs/markdown/Dependencies.md [deleted file]
meson/docs/markdown/Design-rationale.md [deleted file]
meson/docs/markdown/Disabler.md [deleted file]
meson/docs/markdown/Dlang-module.md [deleted file]
meson/docs/markdown/External-commands.md [deleted file]
meson/docs/markdown/FAQ.md [deleted file]
meson/docs/markdown/Feature-autodetection.md [deleted file]
meson/docs/markdown/Fs-module.md [deleted file]
meson/docs/markdown/Generating-sources.md [deleted file]
meson/docs/markdown/Getting-meson.md [deleted file]
meson/docs/markdown/Gnome-module.md [deleted file]
meson/docs/markdown/Hotdoc-module.md [deleted file]
meson/docs/markdown/IDE-integration.md [deleted file]
meson/docs/markdown/Icestorm-module.md [deleted file]
meson/docs/markdown/In-the-press.md [deleted file]
meson/docs/markdown/Include-directories.md [deleted file]
meson/docs/markdown/IndepthTutorial.md [deleted file]
meson/docs/markdown/Installing.md [deleted file]
meson/docs/markdown/Java.md [deleted file]
meson/docs/markdown/Keyval-module.md [deleted file]
meson/docs/markdown/Localisation.md [deleted file]
meson/docs/markdown/Machine-files.md [deleted file]
meson/docs/markdown/Manual.md [deleted file]
meson/docs/markdown/Meson-sample.md [deleted file]
meson/docs/markdown/MesonCI.md [deleted file]
meson/docs/markdown/Mixing-build-systems.md [deleted file]
meson/docs/markdown/Modules.md [deleted file]
meson/docs/markdown/Native-environments.md [deleted file]
meson/docs/markdown/Overview.md [deleted file]
meson/docs/markdown/Performance-comparison.md [deleted file]
meson/docs/markdown/Pkg-config-files.md [deleted file]
meson/docs/markdown/Pkgconfig-module.md [deleted file]
meson/docs/markdown/Playground.md [deleted file]
meson/docs/markdown/Porting-from-autotools.md [deleted file]
meson/docs/markdown/Precompiled-headers.md [deleted file]
meson/docs/markdown/Project-templates.md [deleted file]
meson/docs/markdown/Python-3-module.md [deleted file]
meson/docs/markdown/Python-module.md [deleted file]
meson/docs/markdown/Qt4-module.md [deleted file]
meson/docs/markdown/Qt5-module.md [deleted file]
meson/docs/markdown/Quick-guide.md [deleted file]
meson/docs/markdown/RPM-module.md [deleted file]
meson/docs/markdown/Reference-manual.md [deleted file]
meson/docs/markdown/Reference-tables.md [deleted file]
meson/docs/markdown/Release-notes-for-0.37.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.38.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.39.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.40.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.41.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.42.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.43.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.44.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.45.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.46.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.47.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.48.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.49.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.50.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.51.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.52.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.53.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.54.0.md [deleted file]
meson/docs/markdown/Release-notes-for-0.55.0.md [deleted file]
meson/docs/markdown/Release-notes.md [deleted file]
meson/docs/markdown/Release-procedure.md [deleted file]
meson/docs/markdown/Reproducible-builds.md [deleted file]
meson/docs/markdown/Rewriter.md [deleted file]
meson/docs/markdown/Run-targets.md [deleted file]
meson/docs/markdown/Running-Meson.md [deleted file]
meson/docs/markdown/Shipping-prebuilt-binaries-as-wraps.md [deleted file]
meson/docs/markdown/Simd-module.md [deleted file]
meson/docs/markdown/Simple-comparison.md [deleted file]
meson/docs/markdown/SourceSet-module.md [deleted file]
meson/docs/markdown/Style-guide.md [deleted file]
meson/docs/markdown/Subprojects.md [deleted file]
meson/docs/markdown/Syntax.md [deleted file]
meson/docs/markdown/Threads.md [deleted file]
meson/docs/markdown/Tutorial.md [deleted file]
meson/docs/markdown/Unit-tests.md [deleted file]
meson/docs/markdown/Unity-builds.md [deleted file]
meson/docs/markdown/Use-of-Python.md [deleted file]
meson/docs/markdown/Users.md [deleted file]
meson/docs/markdown/Using-multiple-build-directories.md [deleted file]
meson/docs/markdown/Using-the-WrapDB.md [deleted file]
meson/docs/markdown/Using-with-Visual-Studio.md [deleted file]
meson/docs/markdown/Using-wraptool.md [deleted file]
meson/docs/markdown/Vala.md [deleted file]
meson/docs/markdown/Videos.md [deleted file]
meson/docs/markdown/Vs-External.md [deleted file]
meson/docs/markdown/Windows-module.md [deleted file]
meson/docs/markdown/Wrap-best-practices-and-tips.md [deleted file]
meson/docs/markdown/Wrap-dependency-system-manual.md [deleted file]
meson/docs/markdown/Wrap-maintainer-tools.md [deleted file]
meson/docs/markdown/Wrap-review-guidelines.md [deleted file]
meson/docs/markdown/_Sidebar.md [deleted file]
meson/docs/markdown/fallback-wraptool.md [deleted file]
meson/docs/markdown/howtox.md [deleted file]
meson/docs/markdown/i18n-module.md [deleted file]
meson/docs/markdown/images/buildtime.png [deleted file]
meson/docs/markdown/images/conftime.png [deleted file]
meson/docs/markdown/images/emptytime.png [deleted file]
meson/docs/markdown/images/glib_build.png [deleted file]
meson/docs/markdown/images/glib_conf.png [deleted file]
meson/docs/markdown/images/glib_empty.png [deleted file]
meson/docs/markdown/images/glib_link.png [deleted file]
meson/docs/markdown/images/gtksample.png [deleted file]
meson/docs/markdown/images/py3-install-1.png [deleted file]
meson/docs/markdown/images/py3-install-2.png [deleted file]
meson/docs/markdown/images/py3-install-3.png [deleted file]
meson/docs/markdown/index.md [deleted file]
meson/docs/markdown/legal.md [deleted file]
meson/docs/markdown/snippets/add_release_note_snippets_here [deleted file]
meson/docs/markdown_dynamic/Commands.md [deleted file]
meson/docs/meson.build [deleted file]
meson/docs/sitemap.txt [deleted file]
meson/docs/theme/extra/images/favicon.png [deleted file]
meson/docs/theme/extra/images/meson_logo.png [deleted file]
meson/docs/theme/extra/prism_components/prism-meson.js [deleted file]
meson/docs/theme/extra/prism_components/prism-meson.min.js [deleted file]
meson/docs/theme/extra/templates/brand-logo.html [deleted file]
meson/docs/theme/extra/templates/extra_head.html [deleted file]
meson/docs/theme/extra/templates/license.html [deleted file]
meson/docs/theme/extra/templates/navbar_center.html [deleted file]
meson/docs/theme/extra/templates/navbar_links.html [deleted file]
meson/ghwt.py [deleted file]
meson/graphics/meson_logo.svg [deleted file]
meson/graphics/meson_logo_big.png [deleted file]
meson/graphics/wrap_logo.svg [deleted file]
meson/lgtm.yml [deleted file]
meson/man/meson.1 [deleted file]
meson/manual tests/1 wrap/main.c [deleted file]
meson/manual tests/1 wrap/meson.build [deleted file]
meson/manual tests/1 wrap/subprojects/sqlite.wrap [deleted file]
meson/manual tests/10 svn wrap/meson.build [deleted file]
meson/manual tests/10 svn wrap/prog.c [deleted file]
meson/manual tests/10 svn wrap/subprojects/samplesubproject.wrap [deleted file]
meson/manual tests/11 wrap imposter/meson.build [deleted file]
meson/manual tests/11 wrap imposter/subprojects/zlib.wrap [deleted file]
meson/manual tests/12 wrap mirror/meson.build [deleted file]
meson/manual tests/12 wrap mirror/subprojects/zlib.wrap [deleted file]
meson/manual tests/2 multiwrap/meson.build [deleted file]
meson/manual tests/2 multiwrap/prog.c [deleted file]
meson/manual tests/2 multiwrap/subprojects/libpng.wrap [deleted file]
meson/manual tests/2 multiwrap/subprojects/lua.wrap [deleted file]
meson/manual tests/2 multiwrap/subprojects/zlib.wrap [deleted file]
meson/manual tests/3 git wrap/meson.build [deleted file]
meson/manual tests/3 git wrap/prog.c [deleted file]
meson/manual tests/3 git wrap/subprojects/samplesubproject.wrap [deleted file]
meson/manual tests/4 standalone binaries/Info.plist [deleted file]
meson/manual tests/4 standalone binaries/build_linux_package.sh [deleted file]
meson/manual tests/4 standalone binaries/build_osx_package.sh [deleted file]
meson/manual tests/4 standalone binaries/build_windows_package.py [deleted file]
meson/manual tests/4 standalone binaries/linux_bundler.sh [deleted file]
meson/manual tests/4 standalone binaries/meson.build [deleted file]
meson/manual tests/4 standalone binaries/myapp.cpp [deleted file]
meson/manual tests/4 standalone binaries/myapp.icns [deleted file]
meson/manual tests/4 standalone binaries/myapp.iss [deleted file]
meson/manual tests/4 standalone binaries/myapp.sh [deleted file]
meson/manual tests/4 standalone binaries/osx_bundler.sh [deleted file]
meson/manual tests/4 standalone binaries/readme.txt [deleted file]
meson/manual tests/4 standalone binaries/template.dmg.gz [deleted file]
meson/manual tests/5 rpm/lib.c [deleted file]
meson/manual tests/5 rpm/lib.h [deleted file]
meson/manual tests/5 rpm/main.c [deleted file]
meson/manual tests/5 rpm/meson.build [deleted file]
meson/manual tests/6 hg wrap/meson.build [deleted file]
meson/manual tests/6 hg wrap/prog.c [deleted file]
meson/manual tests/6 hg wrap/subprojects/samplesubproject.wrap [deleted file]
meson/manual tests/7 vala composite widgets/meson.build [deleted file]
meson/manual tests/7 vala composite widgets/my-resources.xml [deleted file]
meson/manual tests/7 vala composite widgets/mywidget.ui [deleted file]
meson/manual tests/7 vala composite widgets/mywidget.vala [deleted file]
meson/manual tests/8 timeout/meson.build [deleted file]
meson/manual tests/8 timeout/sleepprog.c [deleted file]
meson/manual tests/9 nostdlib/meson.build [deleted file]
meson/manual tests/9 nostdlib/prog.c [deleted file]
meson/manual tests/9 nostdlib/subprojects/mylibc/libc.c [deleted file]
meson/manual tests/9 nostdlib/subprojects/mylibc/meson.build [deleted file]
meson/manual tests/9 nostdlib/subprojects/mylibc/stdio.h [deleted file]
meson/manual tests/9 nostdlib/subprojects/mylibc/stubstart.s [deleted file]
meson/meson.py [deleted file]
meson/mesonbuild/__init__.py [deleted file]
meson/mesonbuild/arglist.py [deleted file]
meson/mesonbuild/ast/__init__.py [deleted file]
meson/mesonbuild/ast/interpreter.py [deleted file]
meson/mesonbuild/ast/introspection.py [deleted file]
meson/mesonbuild/ast/postprocess.py [deleted file]
meson/mesonbuild/ast/printer.py [deleted file]
meson/mesonbuild/ast/visitor.py [deleted file]
meson/mesonbuild/backend/__init__.py [deleted file]
meson/mesonbuild/backend/backends.py [deleted file]
meson/mesonbuild/backend/ninjabackend.py [deleted file]
meson/mesonbuild/backend/vs2010backend.py [deleted file]
meson/mesonbuild/backend/vs2015backend.py [deleted file]
meson/mesonbuild/backend/vs2017backend.py [deleted file]
meson/mesonbuild/backend/vs2019backend.py [deleted file]
meson/mesonbuild/backend/xcodebackend.py [deleted file]
meson/mesonbuild/build.py [deleted file]
meson/mesonbuild/cmake/__init__.py [deleted file]
meson/mesonbuild/cmake/client.py [deleted file]
meson/mesonbuild/cmake/common.py [deleted file]
meson/mesonbuild/cmake/data/preload.cmake [deleted file]
meson/mesonbuild/cmake/executor.py [deleted file]
meson/mesonbuild/cmake/fileapi.py [deleted file]
meson/mesonbuild/cmake/generator.py [deleted file]
meson/mesonbuild/cmake/interpreter.py [deleted file]
meson/mesonbuild/cmake/traceparser.py [deleted file]
meson/mesonbuild/compilers/__init__.py [deleted file]
meson/mesonbuild/compilers/c.py [deleted file]
meson/mesonbuild/compilers/c_function_attributes.py [deleted file]
meson/mesonbuild/compilers/compilers.py [deleted file]
meson/mesonbuild/compilers/cpp.py [deleted file]
meson/mesonbuild/compilers/cs.py [deleted file]
meson/mesonbuild/compilers/cuda.py [deleted file]
meson/mesonbuild/compilers/d.py [deleted file]
meson/mesonbuild/compilers/fortran.py [deleted file]
meson/mesonbuild/compilers/java.py [deleted file]
meson/mesonbuild/compilers/mixins/__init__.py [deleted file]
meson/mesonbuild/compilers/mixins/arm.py [deleted file]
meson/mesonbuild/compilers/mixins/c2000.py [deleted file]
meson/mesonbuild/compilers/mixins/ccrx.py [deleted file]
meson/mesonbuild/compilers/mixins/clang.py [deleted file]
meson/mesonbuild/compilers/mixins/clike.py [deleted file]
meson/mesonbuild/compilers/mixins/elbrus.py [deleted file]
meson/mesonbuild/compilers/mixins/emscripten.py [deleted file]
meson/mesonbuild/compilers/mixins/gnu.py [deleted file]
meson/mesonbuild/compilers/mixins/intel.py [deleted file]
meson/mesonbuild/compilers/mixins/islinker.py [deleted file]
meson/mesonbuild/compilers/mixins/pgi.py [deleted file]
meson/mesonbuild/compilers/mixins/visualstudio.py [deleted file]
meson/mesonbuild/compilers/mixins/xc16.py [deleted file]
meson/mesonbuild/compilers/objc.py [deleted file]
meson/mesonbuild/compilers/objcpp.py [deleted file]
meson/mesonbuild/compilers/rust.py [deleted file]
meson/mesonbuild/compilers/swift.py [deleted file]
meson/mesonbuild/compilers/vala.py [deleted file]
meson/mesonbuild/coredata.py [deleted file]
meson/mesonbuild/dependencies/__init__.py [deleted file]
meson/mesonbuild/dependencies/base.py [deleted file]
meson/mesonbuild/dependencies/boost.py [deleted file]
meson/mesonbuild/dependencies/coarrays.py [deleted file]
meson/mesonbuild/dependencies/cuda.py [deleted file]
meson/mesonbuild/dependencies/data/CMakeLists.txt [deleted file]
meson/mesonbuild/dependencies/data/CMakeListsLLVM.txt [deleted file]
meson/mesonbuild/dependencies/data/CMakePathInfo.txt [deleted file]
meson/mesonbuild/dependencies/dev.py [deleted file]
meson/mesonbuild/dependencies/hdf5.py [deleted file]
meson/mesonbuild/dependencies/misc.py [deleted file]
meson/mesonbuild/dependencies/mpi.py [deleted file]
meson/mesonbuild/dependencies/platform.py [deleted file]
meson/mesonbuild/dependencies/scalapack.py [deleted file]
meson/mesonbuild/dependencies/ui.py [deleted file]
meson/mesonbuild/depfile.py [deleted file]
meson/mesonbuild/envconfig.py [deleted file]
meson/mesonbuild/environment.py [deleted file]
meson/mesonbuild/interpreter.py [deleted file]
meson/mesonbuild/interpreterbase.py [deleted file]
meson/mesonbuild/linkers.py [deleted file]
meson/mesonbuild/mcompile.py [deleted file]
meson/mesonbuild/mconf.py [deleted file]
meson/mesonbuild/mdist.py [deleted file]
meson/mesonbuild/mesondata.py [deleted file]
meson/mesonbuild/mesonlib.py [deleted file]
meson/mesonbuild/mesonmain.py [deleted file]
meson/mesonbuild/minit.py [deleted file]
meson/mesonbuild/minstall.py [deleted file]
meson/mesonbuild/mintro.py [deleted file]
meson/mesonbuild/mlog.py [deleted file]
meson/mesonbuild/modules/__init__.py [deleted file]
meson/mesonbuild/modules/cmake.py [deleted file]
meson/mesonbuild/modules/dlang.py [deleted file]
meson/mesonbuild/modules/fs.py [deleted file]
meson/mesonbuild/modules/gnome.py [deleted file]
meson/mesonbuild/modules/hotdoc.py [deleted file]
meson/mesonbuild/modules/i18n.py [deleted file]
meson/mesonbuild/modules/modtest.py [deleted file]
meson/mesonbuild/modules/pkgconfig.py [deleted file]
meson/mesonbuild/modules/python.py [deleted file]
meson/mesonbuild/modules/python3.py [deleted file]
meson/mesonbuild/modules/qt.py [deleted file]
meson/mesonbuild/modules/qt4.py [deleted file]
meson/mesonbuild/modules/qt5.py [deleted file]
meson/mesonbuild/modules/rpm.py [deleted file]
meson/mesonbuild/modules/sourceset.py [deleted file]
meson/mesonbuild/modules/unstable_cuda.py [deleted file]
meson/mesonbuild/modules/unstable_icestorm.py [deleted file]
meson/mesonbuild/modules/unstable_keyval.py [deleted file]
meson/mesonbuild/modules/unstable_simd.py [deleted file]
meson/mesonbuild/modules/windows.py [deleted file]
meson/mesonbuild/mparser.py [deleted file]
meson/mesonbuild/msetup.py [deleted file]
meson/mesonbuild/msubprojects.py [deleted file]
meson/mesonbuild/mtest.py [deleted file]
meson/mesonbuild/munstable_coredata.py [deleted file]
meson/mesonbuild/optinterpreter.py [deleted file]
meson/mesonbuild/rewriter.py [deleted file]
meson/mesonbuild/scripts/__init__.py [deleted file]
meson/mesonbuild/scripts/clangformat.py [deleted file]
meson/mesonbuild/scripts/clangtidy.py [deleted file]
meson/mesonbuild/scripts/cleantrees.py [deleted file]
meson/mesonbuild/scripts/cmake_run_ctgt.py [deleted file]
meson/mesonbuild/scripts/commandrunner.py [deleted file]
meson/mesonbuild/scripts/coverage.py [deleted file]
meson/mesonbuild/scripts/delwithsuffix.py [deleted file]
meson/mesonbuild/scripts/depfixer.py [deleted file]
meson/mesonbuild/scripts/dirchanger.py [deleted file]
meson/mesonbuild/scripts/gettext.py [deleted file]
meson/mesonbuild/scripts/gtkdochelper.py [deleted file]
meson/mesonbuild/scripts/hotdochelper.py [deleted file]
meson/mesonbuild/scripts/meson_exe.py [deleted file]
meson/mesonbuild/scripts/msgfmthelper.py [deleted file]
meson/mesonbuild/scripts/regen_checker.py [deleted file]
meson/mesonbuild/scripts/scanbuild.py [deleted file]
meson/mesonbuild/scripts/symbolextractor.py [deleted file]
meson/mesonbuild/scripts/tags.py [deleted file]
meson/mesonbuild/scripts/uninstall.py [deleted file]
meson/mesonbuild/scripts/vcstagger.py [deleted file]
meson/mesonbuild/scripts/yelphelper.py [deleted file]
meson/mesonbuild/templates/__init__.py [deleted file]
meson/mesonbuild/templates/cpptemplates.py [deleted file]
meson/mesonbuild/templates/cstemplates.py [deleted file]
meson/mesonbuild/templates/ctemplates.py [deleted file]
meson/mesonbuild/templates/cudatemplates.py [deleted file]
meson/mesonbuild/templates/dlangtemplates.py [deleted file]
meson/mesonbuild/templates/fortrantemplates.py [deleted file]
meson/mesonbuild/templates/javatemplates.py [deleted file]
meson/mesonbuild/templates/mesontemplates.py [deleted file]
meson/mesonbuild/templates/objcpptemplates.py [deleted file]
meson/mesonbuild/templates/objctemplates.py [deleted file]
meson/mesonbuild/templates/rusttemplates.py [deleted file]
meson/mesonbuild/templates/samplefactory.py [deleted file]
meson/mesonbuild/templates/sampleimpl.py [deleted file]
meson/mesonbuild/wrap/__init__.py [deleted file]
meson/mesonbuild/wrap/wrap.py [deleted file]
meson/mesonbuild/wrap/wraptool.py [deleted file]
meson/msi/License.rtf [deleted file]
meson/msi/createmsi.py [deleted file]
meson/pyproject.toml [deleted file]
meson/run_cross_test.py [deleted file]
meson/run_meson_command_tests.py [deleted file]
meson/run_project_tests.py [deleted file]
meson/run_tests.py [deleted file]
meson/run_unittests.py [deleted file]
meson/setup.cfg [deleted file]
meson/setup.py [deleted file]
meson/sider.yml [deleted file]
meson/skip_ci.py [deleted file]
meson/tools/ac_converter.py [deleted file]
meson/tools/boost_names.py [deleted file]
meson/tools/build_website.py [deleted file]
meson/tools/cmake2meson.py [deleted file]
meson/tools/copy_files.py [deleted file]
meson/tools/dircondenser.py [deleted file]
meson/tools/gen_data.py [deleted file]
meson/tools/regenerate_docs.py [deleted file]
packaging/qemu-tools.spec

diff --git a/meson/.coveragerc b/meson/.coveragerc
deleted file mode 100644 (file)
index c3d41d4..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-[run]
-branch = True
-concurrency =
-    multiprocessing
-data_file = .coverage/coverage
-parallel = True
-source =
-    meson.py
-    mesonbuild/
-    mesonconf.py
-    mesonintrospect.py
-    mesonrewriter.py
-    mesontest.py
-    run_cross_test.py
-    run_project_tests.py
-    run_tests.py
-    run_unittests.py
-
-# Aliases to /root/ are needed because Travis runs in docker at /root/.
-[paths]
-meson =
-    meson.py
-    /root/meson.py
-mesonbuild =
-    mesonbuild/
-    /root/mesonbuild/
-mesonconf =
-    mesonconf.py
-    /root/mesonconf.py
-mesonintrospect =
-    mesonintrospect.py
-    /root/mesonintrospect.py
-mesonrewriter =
-    mesonrewriter.py
-    /root/mesonrewriter.py
-mesontest =
-    mesontest.py
-    /root/mesontest.py
-run_cross_test =
-    run_cross_test.py
-    /root/run_cross_test.py
-run_project_tests =
-    run_project_tests.py
-    /root/run_project_tests.py
-run_tests =
-    run_tests.py
-    /root/run_tests.py
-run_unittests =
-    run_unittests.py
-    /root/run_unittests.py
diff --git a/meson/.editorconfig b/meson/.editorconfig
deleted file mode 100644 (file)
index c2dd5d0..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-root = true
-
-[*]
-charset = utf-8
-end_of_line = lf
-indent_style = space
-
-[*.[ch]]
-indent_size = 4
-
-[*.cpp]
-indent_size = 4
-
-[*.py]
-indent_size = 4
-
-[*.vala]
-indent_size = 4
-
-[*.xml]
-indent_size = 2
-
-[meson.build]
-indent_size = 2
-
-[*.json]
-indent_size = 2
diff --git a/meson/.flake8 b/meson/.flake8
deleted file mode 100644 (file)
index ff38c0f..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-[flake8]
-ignore =
-    # E241: multiple spaces after ':'
-    E241,
-    # E251: unexpected spaces around keyword / parameter equals
-    E251,
-    # E261: at least two spaces before inline comment
-    E261,
-    # E265: block comment should start with '# '
-    E265,
-    # E501: line too long
-    E501,
-    # E302: expected 2 blank lines, found 1
-    E302,
-    # E305: expected 2 blank lines after class or function definition, found 1
-    E305,
-    # E401: multiple imports on one line
-    E401,
-    # E266: too many leading '#' for block comment
-    E266,
-    # E402: module level import not at top of file
-    E402,
-    # E731: do not assign a lambda expression, use a def (too many false positives)
-    E731,
-    # E741: ambiguous variable name 'l'
-    E741,
-    # E722: do not use bare except'
-    E722,
-    # W504: line break after binary operator
-    W504,
-    # A003: builtin class attribute
-    A003
-max-line-length = 120
diff --git a/meson/.gitattributes b/meson/.gitattributes
deleted file mode 100644 (file)
index 7fd80e2..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-.gitignore export-ignore
-.gitattributes export-ignore
-* text eol=lf
-*.png binary
-*.icns binary
diff --git a/meson/.github/ISSUE_TEMPLATE/bug_report.md b/meson/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644 (file)
index 4bc3fe6..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
----
-name: Bug report
-about: Meson bug report
-title: ''
-labels: ''
-assignees: ''
-
----
-
-**Describe the bug**
-A clear and concise description of what the bug is.
-
-**To Reproduce**
-Please include your `meson.build` files, preferably as a minimal toy example showing the issue.
-You may need to create simple source code files (don't include private/proprietary code).
-
-**Expected behavior**
-A clear and concise description of what you expected to happen.
-
-**system parameters**
-* Is this a [cross build](https://mesonbuild.com/Cross-compilation.html) or just a plain native build (for the same computer)?
-* what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)
-* what Python version are you using e.g. 3.8.0
-* what `meson --version`
-* what `ninja --version` if it's a Ninja build
diff --git a/meson/.github/workflows/ci_frameworks.yml b/meson/.github/workflows/ci_frameworks.yml
deleted file mode 100644 (file)
index 12d41f8..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-name: ci_frameworks
-
-on:
-  push:
-    paths:
-      - "mesonbuild/dependencies/**"
-      - "test cases/frameworks/**"
-      - ".github/workflows/ci_frameworks.yml"
-  pull_request:
-    paths:
-      - "mesonbuild/dependencies/**"
-      - "test cases/frameworks/**"
-      - ".github/workflows/ci_frameworks.yml"
-
-jobs:
-
-  scalapackMacOS:
-    runs-on: macos-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: python -m pip install -e .
-    - run: brew install pkg-config ninja gcc openmpi lapack scalapack
-    - run: meson setup "test cases/frameworks/30 scalapack" build
-    - run: ninja -C build
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Scalapack_Mac_build
-        path: build/meson-logs/meson-log.txt
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Scalapack_Mac_test
-        path: build/meson-logs/testlog.txt
-
-  HDF5macos:
-    runs-on: macos-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: python -m pip install -e .
-    - run: brew install pkg-config ninja gcc hdf5
-    - run: meson setup "test cases/frameworks/25 hdf5" build
-    - run: ninja -C build
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: HDF5_Mac_build
-        path: build/meson-logs/meson-log.txt
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: HDF5_Mac_test
-        path: build/meson-logs/testlog.txt
-
-  Qt4macos:
-    runs-on: macos-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: python -m pip install -e .
-    - run: brew install pkg-config ninja gcc
-    - run: brew tap cartr/qt4
-    - run: brew install qt@4
-    - run: meson setup "test cases/frameworks/4 qt" build -Drequired=qt4
-    - run: ninja -C build
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Qt4_Mac_build
-        path: build/meson-logs/meson-log.txt
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Qt4_Mac_test
-        path: build/meson-logs/testlog.txt
diff --git a/meson/.github/workflows/images.yml b/meson/.github/workflows/images.yml
deleted file mode 100644 (file)
index 0cf9156..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-name: CI image builder
-
-on:
-  push:
-    branches:
-      - master
-    paths:
-      - 'ci/ciimage/**'
-      - '.github/workflows/images.yml'
-
-  pull_request:
-    branches:
-      - master
-    paths:
-      - 'ci/ciimage/**'
-      - '.github/workflows/images.yml'
-
-  # Rebuild the images every week (Sunday)
-  schedule:
-    - cron: '0 0 * * 0'
-
-jobs:
-  build:
-    name: ${{ matrix.cfg.name }}
-    runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        cfg:
-          - { name: Arch Linux,       id: arch     }
-          - { name: CUDA (on Arch),   id: cuda     }
-          - { name: Fedora,           id: fedora   }
-          - { name: OpenSUSE,         id: opensuse }
-          - { name: Ubuntu Bionic,    id: bionic   }
-          - { name: Ubuntu Eoan,      id: eoan     }
-    steps:
-      - uses: actions/checkout@v2
-
-      # Login to dockerhub
-      - name: Docker login
-        if:   github.event_name == 'push' || github.event_name == 'schedule'
-        uses: azure/docker-login@v1
-        with:
-          username: ${{ secrets.DOCKER_USERNAME }}
-          password: ${{ secrets.DOCKER_PASSWORD }}
-
-      # Build and test
-      - name: Building the ${{ matrix.cfg.id }} image
-        run:  ./ci/ciimage/build.py -t build ${{ matrix.cfg.id }}
-      - name: Testing the ${{ matrix.cfg.id }} image
-        run:  ./ci/ciimage/build.py -t test  ${{ matrix.cfg.id }}
-
-      # Publish
-      - name: Push the ${{ matrix.cfg.id }} image
-        if:   github.event_name == 'push' || github.event_name == 'schedule'
-        run:  docker push mesonbuild/${{ matrix.cfg.id }}
diff --git a/meson/.github/workflows/lint_mypy.yml b/meson/.github/workflows/lint_mypy.yml
deleted file mode 100644 (file)
index 056f96e..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-name: LintMypy
-
-on:
-  push:
-    paths:
-    - "**.py"
-    - ".github/workflows/lint_mypy.yml"
-  pull_request:
-    paths:
-    - "**.py"
-    - ".github/workflows/lint_mypy.yml"
-
-jobs:
-
-  lint:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    # pylint version constraint can be removed when https://github.com/PyCQA/pylint/issues/3524 is resolved
-    - run: python -m pip install pylint==2.4.4
-    - run: pylint mesonbuild
-
-  mypy:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: python -m pip install mypy
-    - run: mypy --follow-imports=skip mesonbuild/interpreterbase.py mesonbuild/mtest.py mesonbuild/minit.py mesonbuild/mintro.py mesonbuild/mparser.py mesonbuild/msetup.py mesonbuild/ast mesonbuild/wrap tools/ mesonbuild/modules/fs.py mesonbuild/dependencies/boost.py mesonbuild/dependencies/mpi.py mesonbuild/dependencies/hdf5.py mesonbuild/compilers/mixins/intel.py mesonbuild/mlog.py mesonbuild/mcompile.py mesonbuild/mesonlib.py mesonbuild/arglist.py
diff --git a/meson/.github/workflows/os_comp.yml b/meson/.github/workflows/os_comp.yml
deleted file mode 100644 (file)
index a5abf7d..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-name: OS Comp Tests
-
-on:
-  push:
-    branches:
-      - master
-  pull_request:
-
-jobs:
-  xenial:
-    name: Ubuntu 16.04
-    runs-on: ubuntu-16.04
-    steps:
-    - uses: actions/checkout@v2
-    - name: Install Dependencies
-      run: |
-        sudo apt update -yq
-        sudo apt install -yq --no-install-recommends python3-setuptools python3-pip g++ gfortran gobjc gobjc++ zlib1g-dev python-dev python3-dev python3-jsonschema
-    - name: Install ninja-build tool
-      uses: seanmiddleditch/gha-setup-ninja@v1
-    - name: Python version
-      run: python3 --version
-    - name: Ninja version
-      run: ninja --version
-    - name: Run tests
-      run: LD_LIBRARY_PATH=/usr/local/share/boost/1.69.0/lib/:$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH python3 run_tests.py
-      env:
-        CI: '1'
-        XENIAL: '1'
-
-  arch:
-    name: ${{ matrix.cfg.name }}
-    runs-on: ubuntu-latest
-    strategy:
-      fail-fast: false
-      matrix:
-        cfg:
-          - { name: Arch Linux,       id: arch     }
-          - { name: CUDA (on Arch),   id: cuda     }
-          - { name: Fedora,           id: fedora   }
-          - { name: OpenSUSE,         id: opensuse }
-          - { name: Ubuntu Bionic,    id: bionic   }
-    container: mesonbuild/${{ matrix.cfg.id }}:latest
-    steps:
-    - uses: actions/checkout@v2
-    - name: Run tests
-      # All environment variables are stored inside the docker image in /ci/env_vars.sh
-      # They are defined in the `env` section in each image.json. CI_ARGS should be set
-      # via the `args` array ub the image.json
-      run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS'
diff --git a/meson/.github/workflows/unusedargs_missingreturn.yml b/meson/.github/workflows/unusedargs_missingreturn.yml
deleted file mode 100644 (file)
index 859dec2..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-name: UnusedMissingReturn
-# this workflow checks for
-# * unused input arguments
-# * missing return values
-# * strict prototypes
-# some users have default configs that will needlessly fail Meson self-tests due to these syntax.
-
-on:
-  push:
-    paths:
-    - ".github/workflows/unusedargs_missingreturn.yml"
-    - "test cases/cmake/**"
-    - "test cases/common/**"
-    - "test cases/fortran/**"
-    - "test cases/linuxlike/**"
-    - "test cases/objc/**"
-    - "test cases/objcpp/**"
-    - "test caes/windows/**"
-
-  pull_request:
-    paths:
-    - ".github/workflows/unusedargs_missingreturn.yml"
-    - "test cases/cmake/**"
-    - "test cases/common/**"
-    - "test cases/fortran/**"
-    - "test cases/linuxlike/**"
-    - "test cases/objc/**"
-    - "test cases/objcpp/**"
-    - "test caes/windows/**"
-
-jobs:
-
-  linux:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - name: Install Compilers
-      run: |
-        sudo apt update -yq
-        sudo apt install -yq --no-install-recommends g++ gfortran ninja-build gobjc gobjc++
-    - run: python run_project_tests.py --only cmake common fortran platform-linux "objective c" "objective c++"
-      env:
-        CI: "1"
-        CFLAGS: "-Werror=unused-parameter -Werror=return-type -Werror=strict-prototypes"
-        CPPFLAGS: "-Werror=unused-parameter -Werror=return-type"
-        FFLAGS: "-fimplicit-none"
-
-  windows:
-    runs-on: windows-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    # ninja==1.10 pypi release didn't ship with windows binaries, which causes
-    # pip to try to build it which fails on Windows. Pin the previous version
-    # for now. We can update once that's fixed.
-    # https://pypi.org/project/ninja/1.10.0/#files
-    - run: pip install ninja==1.9.0.post1 pefile
-    - run: python run_project_tests.py --only platform-windows
-      env:
-        CI: "1"
-        CFLAGS: "-Werror=unused-parameter -Werror=return-type -Werror=strict-prototypes"
-        CPPFLAGS: "-Werror=unused-parameter -Werror=return-type"
-        FFLAGS: "-fimplicit-none"
-        CC: gcc
-        CXX: g++
-        FC: gfortran
diff --git a/meson/.gitignore b/meson/.gitignore
deleted file mode 100644 (file)
index fea337e..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-.mypy_cache/
-.pytest_cache/
-/.project
-/.pydevproject
-/.settings
-/.cproject
-/.idea
-/.vscode
-
-__pycache__
-.coverage
-/install dir
-/work area
-
-/meson-test-run.txt
-/meson-test-run.xml
-/meson-cross-test-run.txt
-/meson-cross-test-run.xml
-
-.DS_Store
-*~
-*.swp
-packagecache
-/MANIFEST
-/build
-/dist
-/meson.egg-info
-
-/docs/built_docs
-/docs/hotdoc-private*
-
-*.pyc
-/*venv*
diff --git a/meson/.mailmap b/meson/.mailmap
deleted file mode 100644 (file)
index 8298afb..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-Alexandre Foley <Alexandre.foley@usherbrooke.ca> AlexandreFoley <alexandre.foley@usherbrooke.ca>
-Igor Gnatenko <i.gnatenko.brain@gmail.com> Igor Gnatenko <ignatenko@redhat.com>
-Jussi Pakkanen <jpakkane@gmail.com> Jussi Pakkanen <jpakkane@brash.local>
-Jussi Pakkanen <jpakkane@gmail.com> jpakkane <jpakkane@gmail.com>
-Nirbheek Chauhan <nirbheek@centricular.com> Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
-Nicolas Schneider <nioncode+git@gmail.com>  Nicolas Schneider <nioncode+github@gmail.com>
-Patrick Griffis <tingping@tingping.se> TingPing <tingping@tingping.se>
-Thibault Saunier <thibault.saunier@osg.samsung.com> Thibault Saunier <saunierthibault@gmail.com>
-Thibault Saunier <thibault.saunier@osg.samsung.com> Saunier Thibault <saunierthibault@gmail.com>
-Tim-Philipp Müller <tim@centricular.com> Tim-Philipp Müller <tim@centricular.net>
diff --git a/meson/.mypy.ini b/meson/.mypy.ini
deleted file mode 100644 (file)
index b8dad03..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-[mypy]
-strict_optional = False
-show_error_context = False
-show_column_numbers = True
-ignore_missing_imports = True
diff --git a/meson/.pylintrc b/meson/.pylintrc
deleted file mode 100644 (file)
index 10483d3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-[MASTER]
-jobs=0
-
-[REPORTS]
-score=no
-
-[MESSAGES CONTROL]
-disable=all
-enable=unreachable
\ No newline at end of file
diff --git a/meson/.travis.yml b/meson/.travis.yml
deleted file mode 100644 (file)
index 22d76e7..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-sudo: false
-
-branches:
-  only:
-  - master
-  # Release branches
-  - /^[0-9]+\.[0-9]+$/
-
-os:
-  - linux
-  - osx
-
-compiler:
-  - gcc
-  - clang
-
-env:
-  - MESON_ARGS=""
-  - RUN_TESTS_ARGS="--no-unittests" MESON_ARGS="--unity=on"
-
-language:
-  - cpp
-
-services:
-  - docker
-
-matrix:
-  exclude:
-  # On OS X gcc is just a wrapper around clang, so don't waste time testing that
-  - os: osx
-    compiler: gcc
-  include:
-  # Test cross builds separately, they do not use the global compiler
-  # Also hijack one cross build to test long commandline handling codepath (and avoid overloading Travis)
-  - os: linux
-    compiler: gcc
-    env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_RSP_THRESHOLD=0
-  - os: linux
-    compiler: gcc
-    env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_ARGS="--unity=on"
-
-before_install:
-  - python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST
-  - ./ci/travis_install.sh
-
-script:
-  - ./ci/travis_script.sh
diff --git a/meson/CODEOWNERS b/meson/CODEOWNERS
deleted file mode 100644 (file)
index e361e83..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-* @jpakkane
-/mesonbuild/modules/pkgconfig.py @xclaesse
-/mesonbuild/modules/cmake.py @mensinda
-/mesonbuild/ast/* @mensinda
-/mesonbuild/cmake/* @mensinda
diff --git a/meson/COPYING b/meson/COPYING
deleted file mode 100644 (file)
index d645695..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
-
-                                 Apache License
-                           Version 2.0, January 2004
-                        http://www.apache.org/licenses/
-
-   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
-   1. Definitions.
-
-      "License" shall mean the terms and conditions for use, reproduction,
-      and distribution as defined by Sections 1 through 9 of this document.
-
-      "Licensor" shall mean the copyright owner or entity authorized by
-      the copyright owner that is granting the License.
-
-      "Legal Entity" shall mean the union of the acting entity and all
-      other entities that control, are controlled by, or are under common
-      control with that entity. For the purposes of this definition,
-      "control" means (i) the power, direct or indirect, to cause the
-      direction or management of such entity, whether by contract or
-      otherwise, or (ii) ownership of fifty percent (50%) or more of the
-      outstanding shares, or (iii) beneficial ownership of such entity.
-
-      "You" (or "Your") shall mean an individual or Legal Entity
-      exercising permissions granted by this License.
-
-      "Source" form shall mean the preferred form for making modifications,
-      including but not limited to software source code, documentation
-      source, and configuration files.
-
-      "Object" form shall mean any form resulting from mechanical
-      transformation or translation of a Source form, including but
-      not limited to compiled object code, generated documentation,
-      and conversions to other media types.
-
-      "Work" shall mean the work of authorship, whether in Source or
-      Object form, made available under the License, as indicated by a
-      copyright notice that is included in or attached to the work
-      (an example is provided in the Appendix below).
-
-      "Derivative Works" shall mean any work, whether in Source or Object
-      form, that is based on (or derived from) the Work and for which the
-      editorial revisions, annotations, elaborations, or other modifications
-      represent, as a whole, an original work of authorship. For the purposes
-      of this License, Derivative Works shall not include works that remain
-      separable from, or merely link (or bind by name) to the interfaces of,
-      the Work and Derivative Works thereof.
-
-      "Contribution" shall mean any work of authorship, including
-      the original version of the Work and any modifications or additions
-      to that Work or Derivative Works thereof, that is intentionally
-      submitted to Licensor for inclusion in the Work by the copyright owner
-      or by an individual or Legal Entity authorized to submit on behalf of
-      the copyright owner. For the purposes of this definition, "submitted"
-      means any form of electronic, verbal, or written communication sent
-      to the Licensor or its representatives, including but not limited to
-      communication on electronic mailing lists, source code control systems,
-      and issue tracking systems that are managed by, or on behalf of, the
-      Licensor for the purpose of discussing and improving the Work, but
-      excluding communication that is conspicuously marked or otherwise
-      designated in writing by the copyright owner as "Not a Contribution."
-
-      "Contributor" shall mean Licensor and any individual or Legal Entity
-      on behalf of whom a Contribution has been received by Licensor and
-      subsequently incorporated within the Work.
-
-   2. Grant of Copyright License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      copyright license to reproduce, prepare Derivative Works of,
-      publicly display, publicly perform, sublicense, and distribute the
-      Work and such Derivative Works in Source or Object form.
-
-   3. Grant of Patent License. Subject to the terms and conditions of
-      this License, each Contributor hereby grants to You a perpetual,
-      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
-      (except as stated in this section) patent license to make, have made,
-      use, offer to sell, sell, import, and otherwise transfer the Work,
-      where such license applies only to those patent claims licensable
-      by such Contributor that are necessarily infringed by their
-      Contribution(s) alone or by combination of their Contribution(s)
-      with the Work to which such Contribution(s) was submitted. If You
-      institute patent litigation against any entity (including a
-      cross-claim or counterclaim in a lawsuit) alleging that the Work
-      or a Contribution incorporated within the Work constitutes direct
-      or contributory patent infringement, then any patent licenses
-      granted to You under this License for that Work shall terminate
-      as of the date such litigation is filed.
-
-   4. Redistribution. You may reproduce and distribute copies of the
-      Work or Derivative Works thereof in any medium, with or without
-      modifications, and in Source or Object form, provided that You
-      meet the following conditions:
-
-      (a) You must give any other recipients of the Work or
-          Derivative Works a copy of this License; and
-
-      (b) You must cause any modified files to carry prominent notices
-          stating that You changed the files; and
-
-      (c) You must retain, in the Source form of any Derivative Works
-          that You distribute, all copyright, patent, trademark, and
-          attribution notices from the Source form of the Work,
-          excluding those notices that do not pertain to any part of
-          the Derivative Works; and
-
-      (d) If the Work includes a "NOTICE" text file as part of its
-          distribution, then any Derivative Works that You distribute must
-          include a readable copy of the attribution notices contained
-          within such NOTICE file, excluding those notices that do not
-          pertain to any part of the Derivative Works, in at least one
-          of the following places: within a NOTICE text file distributed
-          as part of the Derivative Works; within the Source form or
-          documentation, if provided along with the Derivative Works; or,
-          within a display generated by the Derivative Works, if and
-          wherever such third-party notices normally appear. The contents
-          of the NOTICE file are for informational purposes only and
-          do not modify the License. You may add Your own attribution
-          notices within Derivative Works that You distribute, alongside
-          or as an addendum to the NOTICE text from the Work, provided
-          that such additional attribution notices cannot be construed
-          as modifying the License.
-
-      You may add Your own copyright statement to Your modifications and
-      may provide additional or different license terms and conditions
-      for use, reproduction, or distribution of Your modifications, or
-      for any such Derivative Works as a whole, provided Your use,
-      reproduction, and distribution of the Work otherwise complies with
-      the conditions stated in this License.
-
-   5. Submission of Contributions. Unless You explicitly state otherwise,
-      any Contribution intentionally submitted for inclusion in the Work
-      by You to the Licensor shall be under the terms and conditions of
-      this License, without any additional terms or conditions.
-      Notwithstanding the above, nothing herein shall supersede or modify
-      the terms of any separate license agreement you may have executed
-      with Licensor regarding such Contributions.
-
-   6. Trademarks. This License does not grant permission to use the trade
-      names, trademarks, service marks, or product names of the Licensor,
-      except as required for reasonable and customary use in describing the
-      origin of the Work and reproducing the content of the NOTICE file.
-
-   7. Disclaimer of Warranty. Unless required by applicable law or
-      agreed to in writing, Licensor provides the Work (and each
-      Contributor provides its Contributions) on an "AS IS" BASIS,
-      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
-      implied, including, without limitation, any warranties or conditions
-      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
-      PARTICULAR PURPOSE. You are solely responsible for determining the
-      appropriateness of using or redistributing the Work and assume any
-      risks associated with Your exercise of permissions under this License.
-
-   8. Limitation of Liability. In no event and under no legal theory,
-      whether in tort (including negligence), contract, or otherwise,
-      unless required by applicable law (such as deliberate and grossly
-      negligent acts) or agreed to in writing, shall any Contributor be
-      liable to You for damages, including any direct, indirect, special,
-      incidental, or consequential damages of any character arising as a
-      result of this License or out of the use or inability to use the
-      Work (including but not limited to damages for loss of goodwill,
-      work stoppage, computer failure or malfunction, or any and all
-      other commercial damages or losses), even if such Contributor
-      has been advised of the possibility of such damages.
-
-   9. Accepting Warranty or Additional Liability. While redistributing
-      the Work or Derivative Works thereof, You may choose to offer,
-      and charge a fee for, acceptance of support, warranty, indemnity,
-      or other liability obligations and/or rights consistent with this
-      License. However, in accepting such obligations, You may act only
-      on Your own behalf and on Your sole responsibility, not on behalf
-      of any other Contributor, and only if You agree to indemnify,
-      defend, and hold each Contributor harmless for any liability
-      incurred by, or claims asserted against, such Contributor by reason
-      of your accepting any such warranty or additional liability.
-
-   END OF TERMS AND CONDITIONS
-
-   APPENDIX: How to apply the Apache License to your work.
-
-      To apply the Apache License to your work, attach the following
-      boilerplate notice, with the fields enclosed by brackets "[]"
-      replaced with your own identifying information. (Don't include
-      the brackets!)  The text should be enclosed in the appropriate
-      comment syntax for the file format. We also recommend that a
-      file or class name and description of purpose be included on the
-      same "printed page" as the copyright notice for easier
-      identification within third-party archives.
-
-   Copyright [yyyy] [name of copyright owner]
-
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
-
-       http://www.apache.org/licenses/LICENSE-2.0
-
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
diff --git a/meson/MANIFEST.in b/meson/MANIFEST.in
deleted file mode 100644 (file)
index 11c804a..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-graft test?cases
-graft manual?tests
-graft cross
-graft data
-graft graphics
-graft man
-graft tools
-
-include contributing.md
-include COPYING
-include README.md
-include run_cross_test.py
-include run_tests.py
-include run_unittests.py
-include run_meson_command_tests.py
-include run_project_tests.py
-include ghwt.py
-include __main__.py
-include meson.py
diff --git a/meson/README.md b/meson/README.md
deleted file mode 100644 (file)
index 9df015c..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-<p align="center">
-<img src="https://mesonbuild.com/assets/images/meson_logo.png">
-</p>
-Meson® is a project to create the best possible next-generation
-build system.
-
-#### Status
-
-[![PyPI](https://img.shields.io/pypi/v/meson.svg)](https://pypi.python.org/pypi/meson)
-[![Travis](https://travis-ci.org/mesonbuild/meson.svg?branch=master)](https://travis-ci.org/mesonbuild/meson)
-[![Build Status](https://dev.azure.com/jussi0947/jussi/_apis/build/status/mesonbuild.meson)](https://dev.azure.com/jussi0947/jussi/_build/latest?definitionId=1)
-[![Codecov](https://codecov.io/gh/mesonbuild/meson/coverage.svg?branch=master)](https://codecov.io/gh/mesonbuild/meson/branch/master)
-[![Code Quality: Python](https://img.shields.io/lgtm/grade/python/g/mesonbuild/meson.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mesonbuild/meson/context:python)
-[![Total Alerts](https://img.shields.io/lgtm/alerts/g/mesonbuild/meson.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/mesonbuild/meson/alerts)
-
-#### Dependencies
-
- - [Python](https://python.org) (version 3.5 or newer)
- - [Ninja](https://ninja-build.org) (version 1.7 or newer)
-
-#### Installing from source
-
-Meson is available on [PyPi](https://pypi.python.org/pypi/meson), so
-it can be installed with `pip3 install meson`.  The exact command to
-type to install with `pip` can vary between systems, be sure to use
-the Python 3 version of `pip`.
-
-If you wish you can install it locally with the standard Python command:
-
-```console
-python3 -m pip install meson
-```
-
-For builds using Ninja, Ninja can be downloaded directly from Ninja
-[GitHub release page](https://github.com/ninja-build/ninja/releases)
-or via [PyPi](https://pypi.python.org/pypi/ninja)
-
-```console
-python3 -m pip install ninja
-```
-
-More on Installing Meson build can be found at the
-[getting meson page](https://mesonbuild.com/Getting-meson.html).
-
-#### Running
-
-Meson requires that you have a source directory and a build directory
-and that these two are different. In your source root must exist a
-file called `meson.build`. To generate the build system run this
-command:
-
-`meson setup <source directory> <build directory>`
-
-Depending on how you obtained Meson the command might also be called
-`meson.py` instead of plain `meson`. In the rest of this document we
-are going to use the latter form.
-
-You can omit either of the two directories, and Meson will substitute
-the current directory and autodetect what you mean. This allows you to
-do things like this:
-
-```console
-cd <source root>
-meson setup builddir
-```
-
-To compile, cd into your build directory and type `ninja`. To run unit
-tests, type `ninja test`.
-
-More on running Meson build system commands can be found at the
-[running meson page](https://mesonbuild.com/Running-Meson.html)
-or by typing `meson --help`.
-
-#### Contributing
-
-We love code contributions. See the [contribution
-page](https://mesonbuild.com/Contributing.html) on the website for
-details.
-
-
-#### IRC
-
-The irc channel for Meson is `#mesonbuild` over at Freenode.
-
-You can use [FreeNode's official webchat][meson_irc]
-to connect to this channel.
-
-[meson_irc]: https://webchat.freenode.net/?channels=%23mesonbuild
-
-#### Further info
-
-More information about the Meson build system can be found at the
-[project's home page](https://mesonbuild.com).
-
-Meson is a registered trademark of ***Jussi Pakkanen***.
diff --git a/meson/__main__.py b/meson/__main__.py
deleted file mode 100644 (file)
index 27cd4c0..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from mesonbuild import mesonmain
-import sys
-
-sys.exit(mesonmain.main())
diff --git a/meson/azure-pipelines.yml b/meson/azure-pipelines.yml
deleted file mode 100644 (file)
index 1ff542a..0000000
+++ /dev/null
@@ -1,218 +0,0 @@
-name: $(BuildID)
-
-trigger:
-  branches:
-    include:
-    - 'master'
-    # Release branches
-    - '0.*'
-
-variables:
-  CI: 1
-
-jobs:
-
-- job: vs2017
-  timeoutInMinutes: 120
-  pool:
-    vmImage: VS2017-Win2016
-
-  strategy:
-    matrix:
-        vc2017x86ninja:
-          arch: x86
-          compiler: msvc2017
-          backend: ninja
-          MESON_RSP_THRESHOLD: 0
-        vc2017x64vs:
-          arch: x64
-          compiler: msvc2017
-          backend: vs2017
-        clangclx64ninja:
-          arch: x64
-          compiler: clang-cl
-          backend: ninja
-
-  steps:
-  - task: UsePythonVersion@0
-    inputs:
-      versionSpec: '3.5'
-      addToPath: true
-      architecture: 'x64'
-  - template: ci/azure-steps.yml
-
-- job: vs2019
-  timeoutInMinutes: 120
-  pool:
-    vmImage: windows-2019
-
-  strategy:
-    matrix:
-        vc2019x64ninja:
-          arch: x64
-          compiler: msvc2019
-          backend: ninja
-        vc2019x64vs:
-          arch: x64
-          compiler: msvc2019
-          backend: vs2019
-
-  steps:
-  - task: UsePythonVersion@0
-    inputs:
-      versionSpec: '3.7'
-      addToPath: true
-      architecture: 'x64'
-  - template: ci/azure-steps.yml
-
-- job: cygwin
-  timeoutInMinutes: 120
-  pool:
-    vmImage: VS2017-Win2016
-  strategy:
-    matrix:
-        gccx64ninja: {}
-  variables:
-    CYGWIN_ROOT: $(System.Workfolder)\cygwin
-    CYGWIN_MIRROR: http://cygwin.mirror.constant.com
-  steps:
-    - script: |
-        choco install cygwin --params="/InstallDir:%CYGWIN_ROOT%"
-      displayName: Install Cygwin
-    - script: |
-        %CYGWIN_ROOT%\cygwinsetup.exe -qnNdO -R "%CYGWIN_ROOT%" -s "%CYGWIN_MIRROR%" -g -P ^
-        gcc-fortran,^
-        gcc-objc++,^
-        gcc-objc,^
-        git,^
-        gobject-introspection,^
-        gtk-doc,^
-        libarchive13,^
-        libboost-devel,^
-        libglib2.0-devel,^
-        libgtk3-devel,^
-        libjsoncpp19,^
-        librhash0,^
-        libuv1,^
-        libxml2,^
-        libxml2-devel,^
-        libxslt,^
-        libxslt-devel,^
-        ninja,^
-        python2-devel,^
-        python3-devel,^
-        python3-libxml2,^
-        python3-libxslt,^
-        python36-pip,^
-        vala,^
-        wget,^
-        cmake,^
-        zlib-devel
-      displayName: Install Dependencies
-    - script: |
-        set PATH=%CYGWIN_ROOT%\bin;%SYSTEMROOT%\system32
-        env.exe -- python3 -m pip --disable-pip-version-check install gcovr pefile jsonschema
-      displayName: "pip install gcovr pefile jsonschema (pytest-xdist broken, skipped: CHECK ME AGAIN)"
-    - script: |
-        set BOOST_ROOT=
-        set PATH=%CYGWIN_ROOT%\bin;%SYSTEMROOT%\system32
-        set SKIP_STATIC_BOOST=1
-        env.exe -- python3 run_tests.py --backend=ninja
-      # Cygwin's static boost installation is broken (some static library
-      # variants such as boost_thread are not present)
-      displayName: Run Tests
-    - task: CopyFiles@2
-      condition: not(canceled())
-      inputs:
-        contents: 'meson-test-run.*'
-        targetFolder: $(Build.ArtifactStagingDirectory)
-    - task: PublishBuildArtifacts@1
-      inputs:
-        artifactName: $(System.JobName)
-      # publishing artifacts from PRs from a fork is currently blocked
-      condition: and(eq(variables['system.pullrequest.isfork'], false), not(canceled()))
-    - task: PublishTestResults@2
-      condition: not(canceled())
-      inputs:
-        testResultsFiles: meson-test-run.xml
-        testRunTitle: $(System.JobName)
-
-- job: msys2
-  pool:
-    vmImage: VS2017-Win2016
-  strategy:
-    matrix:
-      gccx86ninja:
-        MSYSTEM: MINGW32
-        MSYS2_ARCH: i686
-        compiler: gcc
-      gccx64ninja:
-        MSYSTEM: MINGW64
-        MSYS2_ARCH: x86_64
-        MESON_RSP_THRESHOLD: 0
-        compiler: gcc
-      clangx64ninja:
-        MSYSTEM: MINGW64
-        MSYS2_ARCH: x86_64
-        compiler: clang
-  variables:
-    MSYS2_ROOT: $(System.Workfolder)\msys64
-  steps:
-    - script: |
-        choco install msys2 --params="/InstallDir:%MSYS2_ROOT% /NoUpdate /NoPath"
-      displayName: Install MSYS2
-    - script: |
-        set PATH=%MSYS2_ROOT%\usr\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
-        # Remove this line when https://github.com/msys2/MSYS2-packages/pull/2022 is merged
-        %MSYS2_ROOT%\usr\bin\pacman --noconfirm -Sy dash
-        echo Updating msys2
-        %MSYS2_ROOT%\usr\bin\pacman --noconfirm -Syuu || echo system update failed, ignoring
-        echo Killing all msys2 processes
-        taskkill /F /FI "MODULES eq msys-2.0.dll"
-        echo Updating msys2 (again)
-        %MSYS2_ROOT%\usr\bin\pacman --noconfirm -Syuu
-      displayName: Update MSYS2
-    - script: |
-        set PATH=%MSYS2_ROOT%\usr\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
-        if %compiler%==gcc ( set "TOOLCHAIN=mingw-w64-$(MSYS2_ARCH)-toolchain" ) else ( set "TOOLCHAIN=mingw-w64-$(MSYS2_ARCH)-clang" )
-        %MSYS2_ROOT%\usr\bin\pacman --noconfirm --needed -S ^
-        base-devel ^
-        git ^
-        mercurial ^
-        mingw-w64-$(MSYS2_ARCH)-cmake ^
-        mingw-w64-$(MSYS2_ARCH)-lcov ^
-        mingw-w64-$(MSYS2_ARCH)-libxml2 ^
-        mingw-w64-$(MSYS2_ARCH)-ninja ^
-        mingw-w64-$(MSYS2_ARCH)-pkg-config ^
-        mingw-w64-$(MSYS2_ARCH)-python2 ^
-        mingw-w64-$(MSYS2_ARCH)-python3 ^
-        mingw-w64-$(MSYS2_ARCH)-python3-lxml ^
-        mingw-w64-$(MSYS2_ARCH)-python3-setuptools ^
-        mingw-w64-$(MSYS2_ARCH)-python3-pip ^
-        %TOOLCHAIN%
-        %MSYS2_ROOT%\usr\bin\bash -lc "python3 -m pip --disable-pip-version-check install gcovr jsonschema pefile"
-      displayName: Install Dependencies
-    - script: |
-        set BOOST_ROOT=
-        set PATH=%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem
-        set PATHEXT=%PATHEXT%;.py
-        if %compiler%==clang ( set CC=clang && set CXX=clang++ && set OBJC=clang && set OBJCXX=clang++ )
-        %MSYS2_ROOT%\usr\bin\bash -lc "MSYSTEM= python3 run_tests.py --backend=ninja"
-      env:
-        CHERE_INVOKING: yes
-      displayName: Run Tests
-    - task: CopyFiles@2
-      condition: not(canceled())
-      inputs:
-        contents: 'meson-test-run.*'
-        targetFolder: $(Build.ArtifactStagingDirectory)
-    - task: PublishBuildArtifacts@1
-      inputs:
-        artifactName: $(System.JobName)
-      # publishing artifacts from PRs from a fork is currently blocked
-      condition: and(eq(variables['system.pullrequest.isfork'], false), not(canceled()))
-    - task: PublishTestResults@2
-      condition: not(canceled())
-      inputs:
-        testResultsFiles: meson-test-run.xml
-        testRunTitle: $(System.JobName)
diff --git a/meson/ci/azure-steps.yml b/meson/ci/azure-steps.yml
deleted file mode 100644 (file)
index 233bbfa..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-steps:
-- task: PowerShell@2
-  inputs:
-    targetType: 'filePath'
-    filePath: .\ci\run.ps1
-
-- task: PublishTestResults@2
-  inputs:
-    testResultsFiles: meson-test-run.xml
-    testRunTitle: $(System.JobName)
-    publishRunAttachments: true
-  condition: not(canceled())
-
-- task: CopyFiles@2
-  inputs:
-    contents: 'meson-test-run.*'
-    targetFolder: $(Build.ArtifactStagingDirectory)
-  condition: not(canceled())
-
-- task: PublishBuildArtifacts@1
-  inputs:
-    artifactName: $(System.JobName)
-  condition: not(canceled())
diff --git a/meson/ci/ciimage/.gitignore b/meson/ci/ciimage/.gitignore
deleted file mode 100644 (file)
index 02a0319..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/build_*
-/test_*
diff --git a/meson/ci/ciimage/arch/image.json b/meson/ci/ciimage/arch/image.json
deleted file mode 100644 (file)
index 5254073..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-{
-  "base_image": "archlinux:latest",
-  "env": {
-    "CI": "1"
-  }
-}
diff --git a/meson/ci/ciimage/arch/install.sh b/meson/ci/ciimage/arch/install.sh
deleted file mode 100755 (executable)
index fb27c26..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-#!/bin/bash
-
-set -e
-
-# Inspired by https://github.com/greyltc/docker-archlinux-aur/blob/master/add-aur.sh
-
-pkgs=(
-  python python-setuptools python-wheel python-pip python-pytest-xdist python-gobject python-jsonschema
-  ninja make git sudo fakeroot autoconf automake patch
-  libelf gcc gcc-fortran gcc-objc vala rust bison flex cython go dlang-dmd
-  mono boost qt5-base gtkmm3 gtest gmock protobuf wxgtk gobject-introspection
-  itstool gtk3 java-environment=8 gtk-doc llvm clang sdl2 graphviz
-  doxygen vulkan-validation-layers openssh mercurial gtk-sharp-2 qt5-tools
-  libwmf valgrind cmake netcdf-fortran openmpi nasm gnustep-base gettext
-  python-jsonschema python-lxml
-  # cuda
-)
-
-aur_pkgs=(scalapack)
-pip_pkgs=(hotdoc gcovr)
-cleanup_pkgs=(go)
-
-AUR_USER=docker
-PACMAN_OPTS='--needed --noprogressbar --noconfirm'
-
-# Patch config files
-sed -i 's/#Color/Color/g'                            /etc/pacman.conf
-sed -i 's,#MAKEFLAGS="-j2",MAKEFLAGS="-j$(nproc)",g' /etc/makepkg.conf
-sed -i "s,PKGEXT='.pkg.tar.xz',PKGEXT='.pkg.tar',g"  /etc/makepkg.conf
-
-# Install packages
-pacman -Syu $PACMAN_OPTS "${pkgs[@]}"
-python -m pip install "${pip_pkgs[@]}"
-
-# Setup the user
-useradd -m $AUR_USER
-echo "${AUR_USER}:" | chpasswd -e
-echo "$AUR_USER      ALL = NOPASSWD: ALL" >> /etc/sudoers
-
-# Install yay
-su $AUR_USER -c 'cd; git clone https://aur.archlinux.org/yay.git'
-su $AUR_USER -c 'cd; cd yay; makepkg'
-pushd /home/$AUR_USER/yay/
-pacman -U *.pkg.tar --noprogressbar --noconfirm
-popd
-rm -rf /home/$AUR_USER/yay
-
-# Install yay deps
-su $AUR_USER -c "yay -S $PACMAN_OPTS ${aur_pkgs[*]}"
-
-# cleanup
-pacman -Rs --noconfirm "${cleanup_pkgs[@]}"
-su $AUR_USER -c "yes | yay -Scc"
diff --git a/meson/ci/ciimage/bionic/image.json b/meson/ci/ciimage/bionic/image.json
deleted file mode 100644 (file)
index 6a3d723..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "base_image": "ubuntu:bionic",
-  "env": {
-    "CI": "1",
-    "SKIP_SCIENTIFIC": "1",
-    "DC": "gdc"
-  }
-}
diff --git a/meson/ci/ciimage/bionic/install.sh b/meson/ci/ciimage/bionic/install.sh
deleted file mode 100755 (executable)
index 0bfcdfb..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-set -e
-
-export DEBIAN_FRONTEND=noninteractive
-export LANG='C.UTF-8'
-export DC=gdc
-
-pkgs=(
-  python3-pytest-xdist
-  python3-pip libxml2-dev libxslt1-dev libyaml-dev libjson-glib-dev
-  wget unzip cmake doxygen
-  clang
-  pkg-config-arm-linux-gnueabihf
-  qt4-linguist-tools qt5-default qtbase5-private-dev
-  python-dev
-  libomp-dev
-  llvm lcov
-  ldc
-  libclang-dev
-  libgcrypt20-dev
-  libgpgme-dev
-  libhdf5-dev openssh-server
-  libboost-python-dev libboost-regex-dev
-  libblocksruntime-dev
-  libperl-dev libscalapack-mpi-dev libncurses-dev
-)
-
-boost_pkgs=(atomic chrono date-time filesystem log regex serialization system test thread)
-
-sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
-apt-get -y update
-apt-get -y upgrade
-apt-get -y install eatmydata
-
-# Base stuff
-eatmydata apt-get -y build-dep meson
-
-# Add boost packages
-for i in "${boost_pkgs[@]}"; do
-  for j in "1.62.0" "1.65.1"; do
-    pkgs+=("libboost-${i}${j}")
-  done
-done
-
-# packages
-eatmydata apt-get -y install "${pkgs[@]}"
-
-eatmydata python3 -m pip install codecov gcovr jsonschema
-
-# Install the ninja 0.10
-wget https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-linux.zip
-unzip ninja-linux.zip -d /ci
-
-# cleanup
-apt-get -y remove ninja-build
-apt-get -y clean
-apt-get -y autoclean
-rm ninja-linux.zip
diff --git a/meson/ci/ciimage/build.py b/meson/ci/ciimage/build.py
deleted file mode 100755 (executable)
index e623a7e..0000000
+++ /dev/null
@@ -1,193 +0,0 @@
-#!/usr/bin/env python3
-
-import json
-import argparse
-import stat
-import textwrap
-import shutil
-import subprocess
-from tempfile import TemporaryDirectory
-from pathlib import Path
-import typing as T
-
-image_namespace = 'mesonbuild'
-
-image_def_file = 'image.json'
-install_script = 'install.sh'
-
-class ImageDef:
-    def __init__(self, image_dir: Path) -> None:
-        path = image_dir / image_def_file
-        data = json.loads(path.read_text())
-
-        assert isinstance(data, dict)
-        assert all([x in data for x in ['base_image', 'env']])
-        assert isinstance(data['base_image'], str)
-        assert isinstance(data['env'],  dict)
-
-        self.base_image: str = data['base_image']
-        self.args: T.List[str] = data.get('args', [])
-        self.env: T.Dict[str, str] = data['env']
-
-class BuilderBase():
-    def __init__(self, data_dir: Path, temp_dir: Path) -> None:
-        self.data_dir = data_dir
-        self.temp_dir = temp_dir
-
-        self.common_sh = self.data_dir.parent / 'common.sh'
-        self.common_sh = self.common_sh.resolve(strict=True)
-        self.validate_data_dir()
-
-        self.image_def = ImageDef(self.data_dir)
-
-        self.docker = shutil.which('docker')
-        self.git = shutil.which('git')
-        if self.docker is None:
-            raise RuntimeError('Unable to find docker')
-        if self.git is None:
-            raise RuntimeError('Unable to find git')
-
-    def validate_data_dir(self) -> None:
-        files = [
-            self.data_dir / image_def_file,
-            self.data_dir / install_script,
-        ]
-        if not self.data_dir.exists():
-            raise RuntimeError(f'{self.data_dir.as_posix()} does not exist')
-        for i in files:
-            if not i.exists():
-                raise RuntimeError(f'{i.as_posix()} does not exist')
-            if not i.is_file():
-                raise RuntimeError(f'{i.as_posix()} is not a regular file')
-
-class Builder(BuilderBase):
-    def gen_bashrc(self) -> None:
-        out_file = self.temp_dir / 'env_vars.sh'
-        out_data = ''
-
-        # run_tests.py parameters
-        self.image_def.env['CI_ARGS'] = ' '.join(self.image_def.args)
-
-        for key, val in self.image_def.env.items():
-            out_data += f'export {key}="{val}"\n'
-
-        # Also add /ci to PATH
-        out_data += 'export PATH="/ci:$PATH"\n'
-
-        out_file.write_text(out_data)
-
-        # make it executable
-        mode = out_file.stat().st_mode
-        out_file.chmod(mode | stat.S_IEXEC)
-
-    def gen_dockerfile(self) -> None:
-        out_file = self.temp_dir / 'Dockerfile'
-        out_data = textwrap.dedent(f'''\
-            FROM {self.image_def.base_image}
-
-            ADD install.sh  /ci/install.sh
-            ADD common.sh   /ci/common.sh
-            ADD env_vars.sh /ci/env_vars.sh
-            RUN /ci/install.sh
-        ''')
-
-        out_file.write_text(out_data)
-
-    def do_build(self) -> None:
-        # copy files
-        for i in self.data_dir.iterdir():
-            shutil.copy(str(i), str(self.temp_dir))
-        shutil.copy(str(self.common_sh), str(self.temp_dir))
-
-        self.gen_bashrc()
-        self.gen_dockerfile()
-
-        cmd_git = [self.git, 'rev-parse', '--short', 'HEAD']
-        res = subprocess.run(cmd_git, cwd=self.data_dir, stdout=subprocess.PIPE)
-        if res.returncode != 0:
-            raise RuntimeError('Failed to get the current commit hash')
-        commit_hash = res.stdout.decode().strip()
-
-        cmd = [
-            self.docker, 'build',
-            '-t', f'{image_namespace}/{self.data_dir.name}:latest',
-            '-t', f'{image_namespace}/{self.data_dir.name}:{commit_hash}',
-            '--pull',
-            self.temp_dir.as_posix(),
-        ]
-        if subprocess.run(cmd).returncode != 0:
-            raise RuntimeError('Failed to build the docker image')
-
-class ImageTester(BuilderBase):
-    def __init__(self, data_dir: Path, temp_dir: Path, ci_root: Path) -> None:
-        super().__init__(data_dir, temp_dir)
-        self.meson_root = ci_root.parent.parent.resolve()
-
-    def gen_dockerfile(self) -> None:
-        out_file = self.temp_dir / 'Dockerfile'
-        out_data = textwrap.dedent(f'''\
-            FROM {image_namespace}/{self.data_dir.name}
-
-            ADD meson /meson
-        ''')
-
-        out_file.write_text(out_data)
-
-    def copy_meson(self) -> None:
-        shutil.copytree(
-            self.meson_root,
-            self.temp_dir / 'meson',
-            ignore=shutil.ignore_patterns(
-                '.git',
-                '*_cache',
-                'work area',
-                self.temp_dir.name,
-            )
-        )
-
-    def do_test(self):
-        self.copy_meson()
-        self.gen_dockerfile()
-
-        try:
-            build_cmd = [
-                self.docker, 'build',
-                '-t', 'meson_test_image',
-                self.temp_dir.as_posix(),
-            ]
-            if subprocess.run(build_cmd).returncode != 0:
-                raise RuntimeError('Failed to build the test docker image')
-
-            test_cmd = [
-                self.docker, 'run', '--rm', '-t', 'meson_test_image',
-                '/bin/bash', '-c', 'source /ci/env_vars.sh; cd meson; ./run_tests.py $CI_ARGS'
-            ]
-            if subprocess.run(test_cmd).returncode != 0:
-                raise RuntimeError('Running tests failed')
-        finally:
-            cleanup_cmd = [self.docker, 'rmi', '-f', 'meson_test_image']
-            subprocess.run(cleanup_cmd).returncode
-
-def main() -> None:
-    parser = argparse.ArgumentParser(description='Meson CI image builder')
-    parser.add_argument('what', type=str, help='Which image to build / test')
-    parser.add_argument('-t', '--type', choices=['build', 'test'], help='What to do', required=True)
-
-    args = parser.parse_args()
-
-    ci_root = Path(__file__).parent
-    ci_data = ci_root / args.what
-
-    with TemporaryDirectory(prefix=f'{args.type}_{args.what}_', dir=ci_root) as td:
-        ci_build = Path(td)
-        print(f'Build dir: {ci_build}')
-
-        if args.type == 'build':
-            builder = Builder(ci_data, ci_build)
-            builder.do_build()
-        elif args.type == 'test':
-            tester = ImageTester(ci_data, ci_build, ci_root)
-            tester.do_test()
-
-if __name__ == '__main__':
-    main()
diff --git a/meson/ci/ciimage/common.sh b/meson/ci/ciimage/common.sh
deleted file mode 100644 (file)
index c8940df..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-###
-### Common functions for CI builder files.
-### All functions can be accessed in install.sh via:
-###
-### $ source /ci/common.sh
-###
-
-set -e
-
-dub_fetch() {
-  set +e
-  for (( i=1; i<=24; ++i )); do
-    dub fetch "$@"
-    (( $? == 0 )) && break
-
-    echo "Dub Fetch failed. Retrying in $((i*5))s"
-    sleep $((i*5))
-  done
-  set -e
-}
diff --git a/meson/ci/ciimage/cuda/image.json b/meson/ci/ciimage/cuda/image.json
deleted file mode 100644 (file)
index d395e71..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{
-  "base_image": "archlinux:latest",
-  "args": ["--only", "cuda"],
-  "env": {}
-}
diff --git a/meson/ci/ciimage/cuda/install.sh b/meson/ci/ciimage/cuda/install.sh
deleted file mode 100755 (executable)
index 011099d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/bash
-
-set -e
-
-pkgs=(
-  python python-setuptools python-wheel python-pytest-xdist python-jsonschema
-  ninja gcc gcc-objc git cmake
-  cuda zlib pkgconf
-)
-
-PACMAN_OPTS='--needed --noprogressbar --noconfirm'
-
-pacman -Syu $PACMAN_OPTS "${pkgs[@]}"
-
-# Manually remove cache to avoid GitHub space restrictions
-rm -rf /var/cache/pacman
-
-echo "source /etc/profile.d/cuda.sh" >> /ci/env_vars.sh
diff --git a/meson/ci/ciimage/eoan/image.json b/meson/ci/ciimage/eoan/image.json
deleted file mode 100644 (file)
index cbf86c3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-{
-  "base_image": "ubuntu:eoan",
-  "env": {
-    "CI": "1",
-    "DC": "gdc"
-  }
-}
diff --git a/meson/ci/ciimage/eoan/install.sh b/meson/ci/ciimage/eoan/install.sh
deleted file mode 100755 (executable)
index 36dec72..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-#!/bin/bash
-
-set -e
-
-source /ci/common.sh
-
-export DEBIAN_FRONTEND=noninteractive
-export LANG='C.UTF-8'
-export DC=gdc
-
-pkgs=(
-  python3-pytest-xdist
-  python3-pip libxml2-dev libxslt1-dev libyaml-dev libjson-glib-dev
-  python3-lxml
-  wget unzip
-  qt5-default clang
-  pkg-config-arm-linux-gnueabihf
-  qt4-linguist-tools
-  python-dev
-  libomp-dev
-  llvm lcov
-  dub ldc
-  mingw-w64 mingw-w64-tools nim
-  libclang-dev
-  libgcrypt20-dev
-  libgpgme-dev
-  libhdf5-dev
-  libboost-python-dev libboost-regex-dev
-  libblocksruntime-dev
-  libperl-dev
-  liblapack-dev libscalapack-mpi-dev
-)
-
-sed -i '/^#\sdeb-src /s/^#//' "/etc/apt/sources.list"
-apt-get -y update
-apt-get -y upgrade
-apt-get -y install eatmydata
-
-# Base stuff
-eatmydata apt-get -y build-dep meson
-
-# packages
-eatmydata apt-get -y install "${pkgs[@]}"
-eatmydata apt-get -y install --no-install-recommends wine-stable  # Wine is special
-
-eatmydata python3 -m pip install hotdoc codecov gcovr jsonschema
-
-# dub stuff
-dub_fetch urld
-dub build urld --compiler=gdc
-dub_fetch dubtestproject
-dub build dubtestproject:test1 --compiler=ldc2
-dub build dubtestproject:test2 --compiler=ldc2
-
-# cleanup
-apt-get -y clean
-apt-get -y autoclean
diff --git a/meson/ci/ciimage/eoan/test.sh b/meson/ci/ciimage/eoan/test.sh
deleted file mode 100755 (executable)
index d00df6f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/bash
-
-set -e
-
-testFN() {
-  set +e
-  false
-}
-
-testFN
-false
-exit 0
\ No newline at end of file
diff --git a/meson/ci/ciimage/fedora/image.json b/meson/ci/ciimage/fedora/image.json
deleted file mode 100644 (file)
index ae9ff4f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-{
-  "base_image": "fedora:latest",
-  "env": {
-    "CI":                "1",
-    "SKIP_SCIENTIFIC":   "1",
-    "SKIP_STATIC_BOOST": "1"
-  }
-}
diff --git a/meson/ci/ciimage/fedora/install.sh b/meson/ci/ciimage/fedora/install.sh
deleted file mode 100755 (executable)
index 3beb11c..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/bin/bash
-
-set -e
-
-pkgs=(
-  python python-setuptools python-wheel python-pip python-pytest-xdist pygobject3 python3-devel python2-devel
-  ninja-build make git autoconf automake patch python3-Cython python2-Cython python3-jsonschema
-  elfutils gcc gcc-c++ gcc-fortran gcc-objc gcc-objc++ vala rust bison flex ldc libasan libasan-static
-  mono-core boost-devel gtkmm30 gtest-devel gmock-devel protobuf-devel wxGTK3-devel gobject-introspection
-  boost-python3-devel boost-python2-devel
-  itstool gtk3-devel java-latest-openjdk-devel gtk-doc llvm-devel clang-devel SDL2-devel graphviz-devel zlib zlib-devel zlib-static
-  #hdf5-openmpi-devel hdf5-devel netcdf-openmpi-devel netcdf-devel netcdf-fortran-openmpi-devel netcdf-fortran-devel scalapack-openmpi-devel
-  doxygen vulkan-devel vulkan-validation-layers-devel openssh mercurial gtk-sharp2-devel libpcap-devel gpgme-devel
-  qt5-qtbase-devel qt5-qttools-devel qt5-linguist qt5-qtbase-private-devel
-  libwmf-devel valgrind cmake openmpi-devel nasm gnustep-base-devel gettext-devel ncurses-devel
-  libxml2-devel libxslt-devel libyaml-devel glib2-devel json-glib-devel python3-lxml
-)
-
-# Sys update
-dnf -y upgrade
-
-# Install deps
-dnf -y install "${pkgs[@]}"
-python3 -m pip install hotdoc gcovr gobject PyGObject
-
-# Cleanup
-dnf -y clean all
diff --git a/meson/ci/ciimage/opensuse/image.json b/meson/ci/ciimage/opensuse/image.json
deleted file mode 100644 (file)
index 74acbe5..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-{
-  "base_image": "opensuse/tumbleweed:latest",
-  "env": {
-    "CI":                  "1",
-    "SKIP_SCIENTIFIC":     "1",
-    "SKIP_STATIC_BOOST":   "1",
-    "SINGLE_DUB_COMPILER": "1"
-  }
-}
diff --git a/meson/ci/ciimage/opensuse/install.sh b/meson/ci/ciimage/opensuse/install.sh
deleted file mode 100755 (executable)
index 4c8e770..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-#!/bin/bash
-
-set -e
-
-source /ci/common.sh
-
-pkgs=(
-  python3-setuptools python3-wheel python3-pip python3-pytest-xdist python3 python3-lxml
-  ninja make git autoconf automake patch python3-Cython python3-jsonschema
-  elfutils gcc gcc-c++ gcc-fortran gcc-objc gcc-obj-c++ vala rust bison flex curl lcov
-  mono-core gtkmm3-devel gtest gmock protobuf-devel wxGTK3-3_2-devel gobject-introspection-devel
-  itstool gtk3-devel java-15-openjdk-devel gtk-doc llvm-devel clang-devel libSDL2-devel graphviz-devel zlib-devel zlib-devel-static
-  #hdf5-devel netcdf-devel libscalapack2-openmpi3-devel libscalapack2-gnu-openmpi3-hpc-devel openmpi3-devel
-  doxygen vulkan-devel vulkan-validationlayers openssh mercurial gtk-sharp3-complete gtk-sharp2-complete libpcap-devel libgpgme-devel
-  libqt5-qtbase-devel libqt5-qttools-devel libqt5-linguist libqt5-qtbase-private-headers-devel
-  libwmf-devel valgrind cmake nasm gnustep-base-devel gettext-tools gettext-runtime gettext-csharp ncurses-devel
-  libxml2-devel libxslt-devel libyaml-devel glib2-devel json-glib-devel
-  boost-devel libboost_date_time-devel libboost_filesystem-devel libboost_locale-devel libboost_system-devel
-  libboost_test-devel libboost_log-devel libboost_regex-devel
-  libboost_python3-devel libboost_regex-devel
-)
-
-# Sys update
-zypper --non-interactive patch --with-update --with-optional
-zypper --non-interactive update
-
-# Install deps
-zypper install -y "${pkgs[@]}"
-python3 -m pip install hotdoc gcovr gobject PyGObject
-
-echo 'export PKG_CONFIG_PATH="/usr/lib64/mpi/gcc/openmpi3/lib64/pkgconfig:$PKG_CONFIG_PATH"' >> /ci/env_vars.sh
-
-# dmd is very special on OpenSUSE (as in the packages do not work)
-# see https://bugzilla.opensuse.org/show_bug.cgi?id=1162408
-curl -fsS https://dlang.org/install.sh | bash -s dmd | tee dmd_out.txt
-cat dmd_out.txt | grep source | sed 's/^[^`]*`//g' | sed 's/`.*//g' >> /ci/env_vars.sh
-chmod +x /ci/env_vars.sh
-
-source /ci/env_vars.sh
-
-dub_fetch urld
-dub build urld --compiler=dmd
-dub_fetch dubtestproject
-dub build dubtestproject:test1 --compiler=dmd
-dub build dubtestproject:test2 --compiler=dmd
-
-# Cleanup
-zypper --non-interactive clean --all
diff --git a/meson/ci/run.ps1 b/meson/ci/run.ps1
deleted file mode 100644 (file)
index 5065b87..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-python ./skip_ci.py --base-branch-env=SYSTEM_PULLREQUEST_TARGETBRANCH --is-pull-env=SYSTEM_PULLREQUEST_PULLREQUESTID --base-branch-origin
-if ($LastExitCode -ne 0) {
-  exit 0
-}
-
-# remove Chocolately, MinGW, Strawberry Perl from path, so we don't find gcc/gfortran and try to use it
-# remove PostgreSQL from path so we don't pickup a broken zlib from it
-$env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberry|Chocolatey|PostgreSQL' }) -join ';'
-
-# Rust puts its shared stdlib in a secret place, but it is needed to run tests.
-$env:Path += ";$HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin"
-
-# Set the CI env var for the meson test framework
-$env:CI = '1'
-
-# download and install prerequisites
-function DownloadFile([String] $Source, [String] $Destination) {
-  $retries = 10
-  echo "Downloading $Source"
-  for ($i = 1; $i -le $retries; $i++) {
-      try {
-          (New-Object net.webclient).DownloadFile($Source, $Destination)
-          break # succeeded
-      } catch [net.WebException] {
-          if ($i -eq $retries) {
-              throw # fail on last retry
-          }
-          $backoff = (10 * $i) # backoff 10s, 20s, 30s...
-          echo ('{0}: {1}' -f $Source, $_.Exception.Message)
-          echo ('Retrying in {0}s...' -f $backoff)
-          Start-Sleep -m ($backoff * 1000)
-        }
-    }
-}
-
-
-if ($env:backend -eq 'ninja') { $dmd = $true } else { $dmd = $false }
-
-DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci2/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip
-echo "Extracting  ci_data.zip"
-Expand-Archive $env:AGENT_WORKFOLDER\ci_data.zip -DestinationPath $env:AGENT_WORKFOLDER\ci_data
-& "$env:AGENT_WORKFOLDER\ci_data\install.ps1" -Arch $env:arch -Compiler $env:compiler -Boost $true -DMD $dmd
-
-
-echo "=== PATH BEGIN ==="
-echo ($env:Path).Replace(';',"`n")
-echo "=== PATH END ==="
-echo ""
-
-$progs = @("python","ninja","pkg-config","cl","rc","link")
-foreach ($prog in $progs) {
-  echo ""
-  echo "Locating ${prog}:"
-  where.exe $prog
-}
-
-echo ""
-echo "Ninja / MSBuld version:"
-if ($env:backend -eq 'ninja') {
-  ninja --version
-} else {
-  MSBuild /version
-}
-
-echo ""
-echo "Python version:"
-python --version
-
-# Needed for running unit tests in parallel.
-echo ""
-python -m pip --disable-pip-version-check install --upgrade pefile pytest-xdist jsonschema
-
-echo ""
-echo "=== Start running tests ==="
-# Starting from VS2019 Powershell(?) will fail the test run
-# if it prints anything to stderr. Python's test runner
-# does that by default so we need to forward it.
-cmd /c 'python 2>&1' run_tests.py --backend $env:backend
diff --git a/meson/ci/travis_install.sh b/meson/ci/travis_install.sh
deleted file mode 100755 (executable)
index d9d308a..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-#!/bin/bash
-
-set -e
-
-msg() { echo -e "\x1b[1;32mINFO:  \x1b[37m$*\x1b[0m"; }
-
-if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then
-  msg "Running OSX setup"
-  brew update
-  # Run one macOS build with pkg-config available (pulled in by qt), and the
-  # other (unity=on) without pkg-config
-  brew install qt ldc llvm ninja
-  if [[ "$MESON_ARGS" =~ .*unity=on.* ]]; then
-    which pkg-config && rm -f $(which pkg-config)
-  fi
-  python3 -m pip install jsonschema
-elif [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-  msg "Running Linux setup"
-  docker pull mesonbuild/eoan
-fi
-
-msg "Setup finished"
diff --git a/meson/ci/travis_script.sh b/meson/ci/travis_script.sh
deleted file mode 100755 (executable)
index bdfd4c2..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-#!/bin/bash
-
-set -e
-
-msg() { echo -e "\x1b[1;32mINFO:  \x1b[37m$*\x1b[0m"; }
-
-if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then
-  # TODO enable coverage
-  #curl -s https://codecov.io/bash > upload.sh
-  #chmod +x upload.sh
-
-  # We need to copy the current checkout inside the Docker container,
-  # because it has the MR id to be tested checked out.
-
-  msg "Generating runner:"
-  cat <<EOF | tee run.sh
-#!/bin/bash
-
-set -e
-
-export CC=$CC
-export CXX=$CXX
-export OBJC=$CC
-export OBJCXX=$CXX
-export PATH=/root/tools:$PATH
-if test "$MESON_RSP_THRESHOLD" != ""
-then
-  export MESON_RSP_THRESHOLD=$MESON_RSP_THRESHOLD
-fi
-
-source /ci/env_vars.sh
-cd /root
-
-./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS
-#./upload.sh
-
-EOF
-
-  chmod +x run.sh
-
-  msg "Generating Dockerfile:"
-  cat <<EOF | tee Dockerfile
-FROM mesonbuild/eoan
-ADD . /root
-
-EOF
-
-  msg "Building the docker image..."
-  docker build -t test_img .
-
-  msg "Start running tests"
-  #ci_env=`bash <(curl -s https://codecov.io/env)`
-  docker run --security-opt seccomp:unconfined test_img /root/run.sh
-
-elif [[ "$TRAVIS_OS_NAME" == "osx"   ]]; then
-  # Ensure that llvm is added after $PATH, otherwise the clang from that llvm install will be used instead of the native apple clang.
-  export SDKROOT=$(xcodebuild -version -sdk macosx Path)
-  export CPPFLAGS=-I/usr/local/include LDFLAGS=-L/usr/local/lib
-  export OBJC=$CC
-  export OBJCXX=$CXX
-  export PATH=$HOME/tools:/usr/local/opt/qt/bin:$PATH:$(brew --prefix llvm)/bin
-  if test "$MESON_RSP_THRESHOLD" != ""
-  then
-    export MESON_RSP_THRESHOLD=$MESON_RSP_THRESHOLD
-  fi
-  ./run_tests.py $RUN_TESTS_ARGS --backend=ninja -- $MESON_ARGS
-fi
diff --git a/meson/contributing.md b/meson/contributing.md
deleted file mode 100644 (file)
index 3d1f4bc..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-## Contributing to the Meson build system
-
-Thank you for your interest in participating to the development!
-A large fraction of Meson is contributed by people outside
-the core team and we are *excited* to see what you do.
-
-**Contribution instructions can be found on the website**
- @ https://mesonbuild.com/Contributing.html
diff --git a/meson/cross/armcc.txt b/meson/cross/armcc.txt
deleted file mode 100644 (file)
index c884ffa..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file assumes that path to the arm compiler toolchain is added
-# to the environment(PATH) variable, so that Meson can find
-# the armcc, armlink and armar while building.
-[binaries]
-c = 'armcc'
-cpp = 'armcc'
-ar = 'armar'
-strip = 'armar'
-
-[properties]
-# The '--cpu' option with the appropriate target type should be mentioned
-# to cross compile c/c++ code with armcc,.
-c_args      = ['--cpu=Cortex-M0plus']
-cpp_args    = ['--cpu=Cortex-M0plus']
-
-[host_machine]
-system = 'bare metal'      # Update with your system name - bare metal/OS.
-cpu_family = 'arm'
-cpu = 'Cortex-M0+'
-endian = 'little'
diff --git a/meson/cross/armclang-linux.txt b/meson/cross/armclang-linux.txt
deleted file mode 100644 (file)
index 6df78d6..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# Using ARM compilers from Linux command line is tricky and
-# not really well documented because they want you to use
-# their IDE instead.
-#
-# First you need to do the full install with the IDE and set
-# up license files et al. This may be possible from the command
-# line.
-#
-# Then you need to do the following:
-#
-# Select toolchain by running /opt/arm/developmentstudio-2019.0/bin/select_default_toolchain
-# Armcc is only available in toolchain version 5.
-# Armclang is only available in toolchain version 6.
-# Start shell with /opt/arm/developmentstudio-2019.0/bin/suite_exec zsh
-# Now the compilers will work. 
-
-[binaries]
-# we could set exe_wrapper = qemu-arm-static but to test the case
-# when cross compiled binaries can't be run we don't do that
-c = '/opt/arm/developmentstudio-2019.0/sw/ARMCompiler6.12/bin/armclang'
-#c = '/opt/arm/developmentstudio-2019.0/sw/ARMCompiler5.06u6/bin/armcc'
-#cpp = '/usr/bin/arm-linux-gnueabihf-g++'
-ar = '/opt/arm/developmentstudio-2019.0/sw/ARMCompiler6.12/bin/armar'
-#strip = '/usr/arm-linux-gnueabihf/bin/strip'
-#pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
-
-[properties]
-
-c_args = ['--target=aarch64-arm-none-eabi']
-
-[host_machine]
-system = 'baremetal'
-cpu_family = 'arm'
-cpu = 'armv7' # Not sure if correct.
-endian = 'little'
diff --git a/meson/cross/armclang.txt b/meson/cross/armclang.txt
deleted file mode 100644 (file)
index 955b7ef..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# This file assumes that path to the arm compiler toolchain is added
-# to the environment(PATH) variable, so that Meson can find
-# the armclang, armlink and armar while building.
-[binaries]
-c = 'armclang'
-cpp = 'armclang'
-ar = 'armar'
-strip = 'armar'
-
-[properties]
-# The '--target', '-mcpu' options with the appropriate values should be mentioned
-# to cross compile c/c++ code with armclang.
-c_args      = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
-cpp_args    = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
-
-[host_machine]
-system = 'bare metal'      # Update with your system name - bare metal/OS.
-cpu_family = 'arm'
-cpu = 'Cortex-M0+'
-endian = 'little'
diff --git a/meson/cross/c2000.txt b/meson/cross/c2000.txt
deleted file mode 100644 (file)
index e624f25..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# This file assumes that path to the Texas Instruments C20000 toolchain is added
-# to the environment(PATH) variable, so that Meson can find
-# cl2000 and ar2000 while building.
-[binaries]
-c = 'cl2000'
-ar = 'ar2000'
-strip = 'cl2000'
-
-[host_machine]
-system = 'bare metal'
-cpu_family = 'c2000'
-cpu = 'c28x'
-endian = 'little'
-
-[properties]
-needs_exe_wrapper = true
-c_args = [
-    '-v28',
-    '-ml',
-    '-mt']
-c_link_args = [
-    '-z',
-    '--rom_model',
-    '\f28004x_flash.cmd']
-cpp_args = []
-cpp_link_args = []
diff --git a/meson/cross/ccrx.txt b/meson/cross/ccrx.txt
deleted file mode 100644 (file)
index 097ec06..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-# This file assumes that path to the Renesas CC-RX toolchain is added
-# to the environment(PATH) variable, so that Meson can find
-# ccrx and rlink while building.
-[binaries]
-c = 'ccrx'
-cpp = 'ccrx'
-ar = 'rlink'
-strip = 'rlink'
-
-[properties]
-# The '--cpu' option with the appropriate target type should be mentioned
-# to cross compile c/c++ code with ccrx,.
-c_args      = ['-cpu=rx600']
-cpp_args    = ['-cpu=rx600']
-c_link_args = []
-cpp_link_args = []
-
-[host_machine]
-system = 'bare metal'
-cpu_family = 'rx'
-cpu = 'rx600'
-endian = 'little'
diff --git a/meson/cross/iphone.txt b/meson/cross/iphone.txt
deleted file mode 100644 (file)
index e714da5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# This is a cross compilation file from OSX Yosemite to iPhone
-# Apple keeps changing the location and names of files so
-# these might not work for you. Use the googels and xcrun.
-
-[binaries]
-c = 'clang'
-cpp = 'clang++'
-ar = 'ar'
-strip = 'strip'
-
-[properties]
-root = '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer'
-
-c_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
-cpp_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
-c_link_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
-cpp_link_args = ['-arch', 'armv7', '-miphoneos-version-min=8.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS8.4.sdk']
-
-has_function_printf = true
-has_function_hfkerhisadf = false
-
-[host_machine]
-system = 'darwin'
-cpu_family = 'arm'
-cpu = 'armv7'
-endian = 'little'
-
diff --git a/meson/cross/linux-mingw-w64-32bit.txt b/meson/cross/linux-mingw-w64-32bit.txt
deleted file mode 100644 (file)
index c2ea605..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-[binaries]
-c = '/usr/bin/i686-w64-mingw32-gcc'
-cpp = '/usr/bin/i686-w64-mingw32-g++'
-ar = '/usr/bin/i686-w64-mingw32-ar'
-strip = '/usr/bin/i686-w64-mingw32-strip'
-pkgconfig = '/usr/bin/i686-w64-mingw32-pkg-config'
-windres = '/usr/bin/i686-w64-mingw32-windres'
-exe_wrapper = 'wine'
-ld = '/usr/bin/i686-w64-mingw32-ld'
-
-[properties]
-# Directory that contains 'bin', 'lib', etc
-root = '/usr/i686-w64-mingw32'
-# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries
-sys_root = '/usr/i686-w64-mingw32/sys-root/mingw'
-
-[host_machine]
-system = 'windows'
-cpu_family = 'x86'
-cpu = 'i686'
-endian = 'little'
diff --git a/meson/cross/linux-mingw-w64-64bit.txt b/meson/cross/linux-mingw-w64-64bit.txt
deleted file mode 100644 (file)
index 1c5c002..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-[binaries]
-c = '/usr/bin/x86_64-w64-mingw32-gcc'
-cpp = '/usr/bin/x86_64-w64-mingw32-g++'
-ar = '/usr/bin/x86_64-w64-mingw32-ar'
-strip = '/usr/bin/x86_64-w64-mingw32-strip'
-pkgconfig = '/usr/bin/x86_64-w64-mingw32-pkg-config'
-windres = '/usr/bin/x86_64-w64-mingw32-windres'
-exe_wrapper = 'wine64'
-
-[properties]
-# Directory that contains 'bin', 'lib', etc
-root = '/usr/x86_64-w64-mingw32'
-# Directory that contains 'bin', 'lib', etc for the toolchain and system libraries
-sys_root = '/usr/x86_64-w64-mingw32/sys-root/mingw'
-
-[host_machine]
-system = 'windows'
-cpu_family = 'x86_64'
-cpu = 'x86_64'
-endian = 'little'
diff --git a/meson/cross/ownstdlib.txt b/meson/cross/ownstdlib.txt
deleted file mode 100644 (file)
index 46e99f7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# This is a setup for compiling a program that runs natively
-# but uses a custom std lib. This test will only work on
-# x86_64.
-
-[target_machine]
-system = 'linux'
-cpu_family = 'x86_64'
-cpu = 'x86_64'
-endian = 'little'
-
-[properties]
-
-c_stdlib = ['mylibc', 'mylibc_dep'] # Subproject name, dependency name
diff --git a/meson/cross/tvos.txt b/meson/cross/tvos.txt
deleted file mode 100644 (file)
index dd6d5c1..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# This is a cross compilation file from OSX Yosemite to Apple tvOS
-# Apple keeps changing the location and names of files so
-# these might not work for you. Use the googels and xcrun.
-
-[binaries]
-c = 'clang'
-cpp = 'clang++'
-ar = 'ar'
-strip = 'strip'
-
-[properties]
-root = '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer'
-
-c_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk']
-cpp_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk']
-c_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk']
-cpp_link_args = ['-arch', 'arm64', '-mtvos-version-min=12.0', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk']
-
-has_function_printf = true
-has_function_hfkerhisadf = false
-
-[host_machine]
-system = 'darwin'
-cpu_family = 'arm'
-cpu = 'arm64'
-endian = 'little'
-
diff --git a/meson/cross/ubuntu-armhf.txt b/meson/cross/ubuntu-armhf.txt
deleted file mode 100644 (file)
index 4600c22..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-[binaries]
-# we could set exe_wrapper = qemu-arm-static but to test the case
-# when cross compiled binaries can't be run we don't do that
-c = '/usr/bin/arm-linux-gnueabihf-gcc'
-cpp = '/usr/bin/arm-linux-gnueabihf-g++'
-rust = ['rustc', '--target', 'arm-unknown-linux-gnueabihf', '-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7']
-ar = '/usr/arm-linux-gnueabihf/bin/ar'
-strip = '/usr/arm-linux-gnueabihf/bin/strip'
-pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
-ld = '/usr/bin/arm-linux/gnueabihf-ld'
-
-[properties]
-root = '/usr/arm-linux-gnueabihf'
-# Used in unit test '140 get define'
-c_args = ['-DMESON_TEST_ISSUE_1665=1']
-cpp_args = '-DMESON_TEST_ISSUE_1665=1'
-
-has_function_printf = true
-has_function_hfkerhisadf = false
-
-skip_sanity_check = true
-
-[host_machine]
-system = 'linux'
-cpu_family = 'arm'
-cpu = 'armv7' # Not sure if correct.
-endian = 'little'
diff --git a/meson/cross/ubuntu-faketarget.txt b/meson/cross/ubuntu-faketarget.txt
deleted file mode 100644 (file)
index cc43998..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-# This is a setup for compiling a program that runs natively
-# but produces output that runs on a different platform.
-# That is either a cross compiler or something like binutils.
-
-# We don't need to specify any properties or compilers,
-# for we use the native ones and can run the resulting
-# binaries directly.
-
-[target_machine]
-system = 'linux'
-cpu_family = 'mips'
-cpu = 'mips'
-endian = 'little'
diff --git a/meson/cross/wasm.txt b/meson/cross/wasm.txt
deleted file mode 100644 (file)
index a43636f..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-[binaries]
-c = '/home/jpakkane/emsdk/fastcomp/emscripten/emcc'
-cpp = '/home/jpakkane/emsdk/fastcomp/emscripten/em++'
-ar = '/home/jpakkane/emsdk/fastcomp/emscripten/emar'
-
-[properties]
-
-c_args = ['-s', 'WASM=1', '-s', 'EXPORT_ALL=1']
-c_link_args = ['-s','EXPORT_ALL=1']
-cpp_args = ['-s', 'WASM=1', '-s', 'EXPORT_ALL=1']
-cpp_link_args = ['-s', 'EXPORT_ALL=1']
-
-[host_machine]
-
-system = 'emscripten'
-cpu_family = 'wasm32'
-cpu = 'wasm32'
-endian = 'little'
-
diff --git a/meson/cross/xc16.txt b/meson/cross/xc16.txt
deleted file mode 100644 (file)
index 1e67362..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# This file assumes that path to the Microchip xc16 toolchain is added
-# to the environment(PATH) variable, so that Meson can find
-# xc16-gcc and xc16-ar while building.
-[binaries]
-c = 'xc16-gcc'
-ar = 'xc16-ar'
-strip = 'xc16-gcc'
-
-[host_machine]
-system = 'bare metal'
-cpu_family = 'dspic'
-cpu = '33ep64mc203'
-endian = 'little'
-
-[properties]
-needs_exe_wrapper = true
-c_args = [
-    '-c',
-    '-mcpu=33EP64MC203',
-    '-omf=elf']
-c_link_args = [
-    '-mcpu=33EP64MC203',
-    '-omf=elf',
-    '-Wl,--script=p33EP64MC203.gld,']
diff --git a/meson/data/com.mesonbuild.install.policy b/meson/data/com.mesonbuild.install.policy
deleted file mode 100644 (file)
index 65bf3ef..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE policyconfig PUBLIC "-//freedesktop//DTD polkit Policy Configuration 1.0//EN"
-"http://www.freedesktop.org/software/polkit/policyconfig-1.dtd">
-<policyconfig>
-
-  <vendor>The Meson Build System</vendor>
-  <vendor_url>https://github.com/mesonbuild/meson</vendor_url>
-
-  <action id="com.mesonbuild.install.run">
-    <description>Install the given project via Meson</description>
-    <message>Authentication is required to install this project</message>
-    <icon_name>preferences-system</icon_name>
-    <defaults>
-      <allow_any>no</allow_any>
-      <allow_inactive>no</allow_inactive>
-      <allow_active>auth_admin_keep</allow_active>
-    </defaults>
-    <annotate key="org.freedesktop.policykit.exec.path">/usr/bin/python3</annotate>
-    <annotate key="org.freedesktop.policykit.exec.argv1">/usr/bin/meson</annotate>
-  </action>
-
-</policyconfig>
diff --git a/meson/data/macros.meson b/meson/data/macros.meson
deleted file mode 100644 (file)
index cc4953c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-%__meson %{_bindir}/meson
-%__meson_wrap_mode nodownload
-%__meson_auto_features enabled
-
-%meson \
-    %set_build_flags \
-    %{shrink:%{__meson} \
-        --buildtype=plain \
-        --prefix=%{_prefix} \
-        --libdir=%{_libdir} \
-        --libexecdir=%{_libexecdir} \
-        --bindir=%{_bindir} \
-        --sbindir=%{_sbindir} \
-        --includedir=%{_includedir} \
-        --datadir=%{_datadir} \
-        --mandir=%{_mandir} \
-        --infodir=%{_infodir} \
-        --localedir=%{_datadir}/locale \
-        --sysconfdir=%{_sysconfdir} \
-        --localstatedir=%{_localstatedir} \
-        --sharedstatedir=%{_sharedstatedir} \
-        --wrap-mode=%{__meson_wrap_mode} \
-        --auto-features=%{__meson_auto_features} \
-        %{_vpath_srcdir} %{_vpath_builddir} \
-        %{nil}}
-
-%meson_build \
-    %{shrink:%{__meson} compile \
-        -C %{_vpath_builddir} \
-        -j %{_smp_build_ncpus} \
-        --verbose \
-        %{nil}}
-
-%meson_install \
-    %{shrink:DESTDIR=%{buildroot} %{__meson} install \
-        -C %{_vpath_builddir} \
-        --no-rebuild \
-        %{nil}}
-
-%meson_test \
-    %{shrink:%{__meson} test \
-        -C %{_vpath_builddir} \
-        --num-processes %{_smp_build_ncpus} \
-        --print-errorlogs \
-        %{nil}}
diff --git a/meson/data/schema.xsd b/meson/data/schema.xsd
deleted file mode 100644 (file)
index 58c6bfd..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" ?>
-<!-- from https://svn.jenkins-ci.org/trunk/hudson/dtkit/dtkit-format/dtkit-junit-model/src/main/resources/com/thalesgroup/dtkit/junit/model/xsd/junit-4.xsd -->
-<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
-
-    <xs:element name="failure">
-        <xs:complexType mixed="true">
-            <xs:attribute name="type" type="xs:string" use="optional"/>
-            <xs:attribute name="message" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="error">
-        <xs:complexType mixed="true">
-            <xs:attribute name="type" type="xs:string" use="optional"/>
-            <xs:attribute name="message" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="properties">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element ref="property" maxOccurs="unbounded"/>
-            </xs:sequence>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="property">
-        <xs:complexType>
-            <xs:attribute name="name" type="xs:string" use="required"/>
-            <xs:attribute name="value" type="xs:string" use="required"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="skipped">
-        <xs:complexType mixed="true">
-            <xs:attribute name="message" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="system-err" type="xs:string"/>
-    <xs:element name="system-out" type="xs:string"/>
-
-    <xs:element name="testcase">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element ref="skipped" minOccurs="0" maxOccurs="1"/>
-                <xs:element ref="error" minOccurs="0" maxOccurs="unbounded"/>
-                <xs:element ref="failure" minOccurs="0" maxOccurs="unbounded"/>
-                <xs:element ref="system-out" minOccurs="0" maxOccurs="unbounded"/>
-                <xs:element ref="system-err" minOccurs="0" maxOccurs="unbounded"/>
-            </xs:sequence>
-            <xs:attribute name="name" type="xs:string" use="required"/>
-            <xs:attribute name="assertions" type="xs:string" use="optional"/>
-            <xs:attribute name="time" type="xs:string" use="optional"/>
-            <xs:attribute name="classname" type="xs:string" use="optional"/>
-            <xs:attribute name="status" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="testsuite">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element ref="properties" minOccurs="0" maxOccurs="1"/>
-                <xs:element ref="testcase" minOccurs="0" maxOccurs="unbounded"/>
-                <xs:element ref="system-out" minOccurs="0" maxOccurs="1"/>
-                <xs:element ref="system-err" minOccurs="0" maxOccurs="1"/>
-            </xs:sequence>
-            <xs:attribute name="name" type="xs:string" use="required"/>
-            <xs:attribute name="tests" type="xs:string" use="required"/>
-            <xs:attribute name="failures" type="xs:string" use="optional"/>
-            <xs:attribute name="errors" type="xs:string" use="optional"/>
-            <xs:attribute name="time" type="xs:string" use="optional"/>
-            <xs:attribute name="disabled" type="xs:string" use="optional"/>
-            <xs:attribute name="skipped" type="xs:string" use="optional"/>
-            <xs:attribute name="timestamp" type="xs:string" use="optional"/>
-            <xs:attribute name="hostname" type="xs:string" use="optional"/>
-            <xs:attribute name="id" type="xs:string" use="optional"/>
-            <xs:attribute name="package" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-    <xs:element name="testsuites">
-        <xs:complexType>
-            <xs:sequence>
-                <xs:element ref="testsuite" minOccurs="0" maxOccurs="unbounded"/>
-            </xs:sequence>
-            <xs:attribute name="name" type="xs:string" use="optional"/>
-            <xs:attribute name="time" type="xs:string" use="optional"/>
-            <xs:attribute name="tests" type="xs:string" use="optional"/>
-            <xs:attribute name="failures" type="xs:string" use="optional"/>
-            <xs:attribute name="disabled" type="xs:string" use="optional"/>
-            <xs:attribute name="errors" type="xs:string" use="optional"/>
-        </xs:complexType>
-    </xs:element>
-
-</xs:schema>
diff --git a/meson/data/shell-completions/bash/meson b/meson/data/shell-completions/bash/meson
deleted file mode 100644 (file)
index 993885b..0000000
+++ /dev/null
@@ -1,416 +0,0 @@
-_meson() {
-  command="${COMP_WORDS[1]}"
-  case "$command" in
-    setup |\
-    configure |\
-    install |\
-    introspect |\
-    init |\
-    test |\
-    wrap |\
-    subprojects |\
-    help)
-      _meson-$command "${COMP_WORDS[@]:1}"
-      ;;
-    *)
-      _meson-setup "${COMP_WORDS[@]}"
-      ;;
-  esac
-} &&
-complete -F _meson meson
-
-_meson_complete_option() {
-  option_string=$1
-
-  if [[ $# -eq 2 ]] && ! [[ "$option_string" == *=* ]]; then
-    option_string="$option_string=$2"
-  fi
-
-  if [[ "$option_string" == *=* ]]; then
-    _meson_complete_option_value "$option_string"
-  else
-    _meson_complete_option_name "$option_string"
-  fi
-}
-
-_meson_complete_option_name() {
-  option=$1
-  options=($(python3 -c 'import sys, json
-for option in json.load(sys.stdin):
-  print(option["name"])
-' <<< "$(_meson_get_options)"))
-  compopt -o nospace
-  COMPREPLY=($(compgen -W '${options[@]}' -S= -- "$option"))
-}
-
-_meson_complete_option_value() {
-  cur=$1
-  option_name=${cur%%=*}
-  option_value=${cur#*=}
-
-  if _meson_complete_filedir "$option_name" "$option_value"; then
-    return
-  fi
-
-# TODO: support all the option types
-  options=($(python3 -c 'import sys, json
-for option in json.load(sys.stdin):
-  if option["name"] != "'$option_name'":
-    continue
-  choices = []
-  if option["type"] == "boolean":
-    choices.append("true")
-    choices.append("false")
-  elif option["type"] == "combo":
-    for choice in option["choices"]:
-      choices.append(choice)
-  for choice in choices:
-    if choice.startswith("'$cur'"):
-      print(choice)
-' <<< "$(_meson_get_options)"))
-  COMPREPLY=("${options[@]}")
-}
-
-_meson_get_options() {
-  local options
-  for builddir in "${COMP_WORDS[@]}"; do
-    if [ -d "$builddir" ]; then
-      break
-    fi
-    builddir=.
-  done
-  options=$(meson introspect "$builddir" --buildoptions 2>/dev/null) &&
-  echo "$options" ||
-  echo '[]'
-}
-
-_meson_complete_filedir() {
-  _filedir_in() {
-    pushd "$1" &>/dev/null
-      local COMPREPLY=()
-      _filedir
-      echo "${COMPREPLY[@]}"
-    popd &>/dev/null
-  }
-
-  option=$1
-  cur=$2
-  case $option in
-    prefix |\
-    libdir |\
-    libexecdir |\
-    bindir |\
-    sbindir |\
-    includedir |\
-    datadir |\
-    mandir |\
-    infodir |\
-    localedir |\
-    sysconfdir |\
-    localstatedir |\
-    sharedstatedir)
-      _filedir -d
-      ;;
-    cross-file)
-      _filedir
-      COMPREPLY+=($(_filedir_in "$XDG_DATA_DIRS"/meson/cross))
-      COMPREPLY+=($(_filedir_in /usr/local/share/meson/cross))
-      COMPREPLY+=($(_filedir_in /usr/share/meson/cross))
-      COMPREPLY+=($(_filedir_in "$XDG_DATA_HOME"/meson/cross))
-      COMPREPLY+=($(_filedir_in ~/.local/share/meson/cross))
-      ;;
-    *)
-      return 1;;
-  esac
-  return 0
-}
-
-_meson-setup() {
-
-  shortopts=(
-    h
-    D
-    v
-  )
-
-  longopts=(
-    help
-    prefix
-    libdir
-    libexecdir
-    bindir
-    sbindir
-    includedir
-    datadir
-    mandir
-    infodir
-    localedir
-    sysconfdir
-    localstatedir
-    sharedstatedir
-    backend
-    buildtype
-    strip
-    unity
-    werror
-    layout
-    default-library
-    warnlevel
-    stdsplit
-    errorlogs
-    cross-file
-    version
-    wrap-mode
-  )
-
-  local cur prev
-  if _get_comp_words_by_ref cur prev &>/dev/null &&
-    [ "${prev:0:2}" = '--' ] && _meson_complete_option "${prev:2}" "$cur"; then
-    return
-  elif _get_comp_words_by_ref cur prev &>/dev/null &&
-    [ "${prev:0:1}" = '-' ] && [ "${prev:1:2}" != '-' ] && _meson_complete_option "${prev:1}"; then
-    return
-  elif _get_comp_words_by_ref -n '=' cur prev &>/dev/null; then
-    if [ $prev == -D ]; then
-      _meson_complete_option "$cur"
-      return
-    fi
-  else
-    cur="${COMP_WORDS[COMP_CWORD]}"
-  fi
-
-  if [[ "$cur" == "--"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-  elif [[ "$cur" == "-"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
-  else
-    _filedir -d
-    if [ -z "$cur" ]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}'))
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}'))
-    fi
-
-    if [ $COMP_CWORD -eq 1 ]; then
-      COMPREPLY+=($(compgen -W 'setup configure test introspect' -- "$cur"))
-    fi
-  fi
-}
-
-_meson-configure() {
-
-  shortopts=(
-    h
-    D
-  )
-
-  longopts=(
-    help
-    clearcache
-  )
-
-  local cur prev
-  if _get_comp_words_by_ref -n '=' cur prev &>/dev/null; then
-    if [ $prev == -D ]; then
-      _meson_complete_option "$cur"
-      return
-    fi
-  else
-    cur="${COMP_WORDS[COMP_CWORD]}"
-  fi
-
-  if [[ "$cur" == "--"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-  elif [[ "$cur" == "-"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
-  else
-    for dir in "${COMP_WORDS[@]}"; do
-      if [ -d "$dir" ]; then
-        break
-      fi
-      dir=.
-    done
-    if [ ! -d "$dir/meson-private" ]; then
-      _filedir -d
-    fi
-
-    if [ -z "$cur" ]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}'))
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}'))
-    fi
-  fi
-}
-
-_meson-test() {
-  shortopts=(
-    q
-    v
-    t
-    C
-  )
-
-  longopts=(
-    quiet
-    verbose
-    timeout-multiplier
-    repeat
-    no-rebuild
-    gdb
-    list
-    wrapper --wrap
-    no-suite
-    suite
-    no-stdsplit
-    print-errorlogs
-    benchmark
-    logbase
-    num-processes
-    setup
-    test-args
-  )
-
-  local cur prev
-  if _get_comp_words_by_ref -n ':' cur prev &>/dev/null; then
-    case $prev in
-      --repeat)
-        # number, can't be completed
-        return
-        ;;
-      --wrapper)
-        _command_offset $COMP_CWORD
-        return
-        ;;
-      -C)
-        _filedir -d
-        return
-        ;;
-      --suite | --no-suite)
-        for i in "${!COMP_WORDS[@]}"; do
-          opt="${COMP_WORDS[i]}"
-          dir="${COMP_WORDS[i+1]}"
-          case "$opt" in
-            -C)
-              break
-              ;;
-          esac
-          dir=.
-        done
-        suites=($(python3 -c 'import sys, json;
-for test in json.load(sys.stdin):
-  for suite in test["suite"]:
-    print(suite)
-    ' <<< "$(meson introspect "$dir" --tests)"))
-# TODO
-        COMPREPLY+=($(compgen -W "${suites[*]}" -- "$cur"))
-        return
-        ;;
-      --logbase)
-        # free string, can't be completed
-        return
-        ;;
-      --num-processes)
-        # number, can't be completed
-        return
-        ;;
-      -t | --timeout-multiplier)
-        # number, can't be completed
-        return
-        ;;
-      --setup)
-        # TODO
-        return
-        ;;
-      --test-args)
-        return
-        ;;
-    esac
-  else
-    cur="${COMP_WORDS[COMP_CWORD]}"
-  fi
-
-  if [[ "$cur" == "--"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-  elif [[ "$cur" == "-"* && ${#cur} -gt 1 ]]; then
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
-  else
-    for dir in "${COMP_WORDS[@]}"; do
-      if [ -d "$dir" ]; then
-        break
-      fi
-      dir=.
-    done
-    if [ ! -d "$dir/meson-private" ]; then
-      _filedir -d
-    fi
-
-    for i in "${!COMP_WORDS[@]}"; do
-      opt="${COMP_WORDS[i]}"
-      dir="${COMP_WORDS[i+1]}"
-      case "$opt" in
-        -C)
-          break
-          ;;
-      esac
-      dir=.
-    done
-    tests=($(python3 -c 'import sys, json;
-for test in json.load(sys.stdin):
-  print(test["name"])
-' <<< "$(meson introspect "$dir" --tests)"))
-    COMPREPLY+=($(compgen -W "${tests[*]}" -- "$cur"))
-
-    if [ -z "$cur" ]; then
-      COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-      COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
-    fi
-  fi
-}
-
-_meson-introspect() {
-  shortopts=(
-    h
-  )
-
-  longopts=(
-    targets
-    installed
-    buildsystem-files
-    buildoptions
-    tests
-    benchmarks
-    dependencies
-    projectinfo
-  )
-
-  local cur prev
-  if ! _get_comp_words_by_ref cur prev &>/dev/null; then
-    cur="${COMP_WORDS[COMP_CWORD]}"
-  fi
-
-  if [[ "$cur" == "--"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-  elif [[ "$cur" == "-"* ]]; then
-    COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}' -- "${cur:2}"))
-    COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}' -- "${cur:1}"))
-  else
-    for dir in "${COMP_WORDS[@]}"; do
-      if [ -d "$dir" ]; then
-        break
-      fi
-      dir=.
-    done
-    if [ ! -d "$dir/meson-private" ]; then
-      _filedir -d
-    fi
-
-    if [ -z "$cur" ]; then
-      COMPREPLY+=($(compgen -P '--' -W '${longopts[*]}'))
-      COMPREPLY+=($(compgen -P '-' -W '${shortopts[*]}'))
-    fi
-  fi
-}
-
-_meson-wrap() {
-  : TODO
-}
diff --git a/meson/data/shell-completions/zsh/_meson b/meson/data/shell-completions/zsh/_meson
deleted file mode 100644 (file)
index e7fe968..0000000
+++ /dev/null
@@ -1,212 +0,0 @@
-#compdef meson mesonconf=meson-configure mesontest=meson-test mesonintrospect=meson-introspect
-
-# vim:ts=2 sw=2
-
-# Copyright (c) 2017 Arseny Maslennikov
-# All rights reserved.  Individual authors, whether or not
-# specifically named, retain copyright in all changes; in what follows, they
-# are referred to as `the Meson development team'.  This is for convenience
-# only and this body has no legal status.  This file is distributed under
-# the following licence.
-#
-# Permission is hereby granted, without written agreement and without
-# licence or royalty fees, to use, copy, modify, and distribute this
-# software and to distribute modified versions of this software for any
-# purpose, provided that the above copyright notice and the following
-# two paragraphs appear in all copies of this software.
-#
-# In no event shall the Meson development team be liable to any party for
-# direct, indirect, special, incidental, or consequential damages arising out
-# of the use of this software and its documentation, even if the Meson
-# development team have been advised of the possibility of such damage.
-#
-# The Meson development team specifically disclaim any warranties, including,
-# but not limited to, the implied warranties of merchantability and fitness
-# for a particular purpose.  The software provided hereunder is on an "as is"
-# basis, and the Meson development team have no obligation to provide
-# maintenance, support, updates, enhancements, or modifications.
-
-local curcontext="$curcontext" state line
-local -i ret
-
-local __meson_backends="(ninja xcode ${(j. .)${:-vs{,2010,2015,2017}}})"
-local __meson_build_types="(plain debug debugoptimized minsize release)"
-local __meson_wrap_modes="(WrapMode.{default,nofallback,nodownload,forcefallback})"
-
-local -a meson_commands=(
-'setup:set up a build directory'
-'configure:configure a project'
-'test:run tests'
-'introspect:query project properties'
-'wrap:manage source dependencies'
-)
-
-(( $+functions[__meson_is_build_dir] )) || __meson_is_build_dir() {
-  local mpd="${1:-$PWD}/meson-private"
-  [[ -f "$mpd/build.dat" && -f "$mpd/coredata.dat" ]]
-  return $?
-}
-
-# TODO: implement build option completion
-(( $+functions[__meson_build_options] )) || __meson_build_options() {}
-
-# `meson introspect` currently can provide that information in JSON.
-# We can:
-# 1) pipe its output to python3 -m json.tool | grep "$alovelyregex" | cut <...>
-# 2) teach mintro.py to use a different output format
-#    (or perhaps just to select the fields printed)
-
-(( $+functions[__meson_test_names] )) || __meson_test_names() {
-  local rtests
-  if rtests="$(_call_program meson meson test ${opt_args[-C]:+-C "$opt_args[-C]"} --list)";
-  then
-    local -a tests=(${(@f)rtests})
-    _describe -t "tests" "Meson tests" tests
-  else
-    _message -r "current working directory is not a build directory"
-    _message -r 'use -C $build_dir or cd $build_dir'
-  fi
-}
-
-(( $+functions[_meson_commands] )) || _meson_commands() {
-    _describe -t commands "Meson subcommands" meson_commands
-}
-
-(( $+functions[_meson-setup] )) || _meson-setup() {
-  local firstd secondd
-  if [[ -f "meson.build" ]]; then
-    # if there's no second argument on the command line
-    # cwd will implicitly be substituted:
-    # - as the source directory if it has a file with the name "meson.build";
-    # - as the build directory otherwise
-    # more info in mesonbuild/mesonmain.py
-    firstd="build"
-    secondd="source"
-  else
-    firstd="source"
-    secondd="build"
-  fi
-
-  _arguments \
-  '*-D-[set the value of a build option]:build option:__meson_build_options' \
-  '--prefix=[installation prefix]: :_directories' \
-  '--libdir=[library directory]: :_directories' \
-  '--libexecdir=[library executable directory]: :_directories' \
-  '--bindir=[executable directory]: :_directories' \
-  '--sbindir=[system executable directory]: :_directories' \
-  '--includedir=[header file directory]: :_directories' \
-  '--datadir=[data file directory]: :_directories' \
-  '--mandir=[manual page directory]: :_directories' \
-  '--infodir=[info page directory]: :_directories' \
-  '--localedir=[locale data directory]: :_directories' \
-  '--sysconfdir=[system configuration directory]: :_directories' \
-  '--localstatedir=[local state data directory]: :_directories' \
-  '--sharedstatedir=[arch-independent data directory]: :_directories' \
-  '--backend=[backend to use]:Meson backend:'"$__meson_backends" \
-  '--buildtype=[build type to use]:Meson build type:'"$__meson_build_types" \
-  '--strip[strip targets on install]' \
-  '--unity=[unity builds on/off]:whether to do unity builds:(on off subprojects)' \
-  '--werror[treat warnings as errors]' \
-  '--layout=[build directory layout]:build directory layout:(flat mirror)' \
-  '--default-library=[default library type]:default library type:(shared static)' \
-  '--warnlevel=[compiler warning level]:compiler warning level:warning level:(1 2 3)' \
-  '--stdsplit=[split stdout and stderr in test logs]' \
-  '--errorlogs=[prints the logs from failing tests]' \
-  '--cross-file=[cross-compilation environment description]:cross file:_files' \
-  '--native-file=[build machine compilation environment description]:native file:_files' \
-  '--wrap-mode=[special wrap mode]:wrap mode:'"$__meson_wrap_modes" \
-  ":$firstd directory:_directories" \
-  "::$secondd directory:_directories" \
-  #
-}
-
-(( $+functions[_meson-configure] )) || _meson-configure() {
-  local curcontext="$curcontext"
-  # TODO: implement 'mesonconf @file'
-  local -a specs=(
-  '--clearcache[clear cached state]'
-  '*-D-[set the value of a build option]:build option:__meson_build_options'
-  '::build directory:_directories'
-  )
-
-  _arguments \
-    '(: -)'{'--help','-h'}'[show a help message and quit]' \
-    "${(@)specs}"
-}
-
-(( $+functions[_meson-test] )) || _meson-test() {
-  local curcontext="$curcontext"
-
-  # TODO: complete test suites
-  local -a specs=(
-  '(--quiet -q)'{'--quiet','-q'}'[produce less output to the terminal]'
-  '(--verbose -v)'{'--verbose','-v'}'[do not redirect stdout and stderr]'
-  '(--timeout-multiplier -t)'{'--timeout-multiplier','-t'}'[a multiplier for test timeouts]:Python floating-point number: '
-  '-C[directory to cd into]: :_directories'
-  '--repeat[number of times to run the tests]:number of times to repeat: '
-  '--no-rebuild[do not rebuild before running tests]'
-  '--gdb[run tests under gdb]'
-  '--list[list available tests]'
-  '(--wrapper --wrap)'{'--wrapper=','--wrap='}'[wrapper to run tests with]:wrapper program:_path_commands'
-  '(--no-suite)--suite[only run tests from this suite]:test suite: '
-  '(--suite)--no-suite[do not run tests from this suite]:test suite: '
-  '--no-stdsplit[do not split stderr and stdout in logs]'
-  '--print-errorlogs[print logs for failing tests]'
-  '--benchmark[run benchmarks instead of tests]'
-  '--logbase[base name for log file]:filename: '
-  '--num-processes[how many threads to use]:number of processes: '
-  '--setup[which test setup to use]:test setup: '
-  '--test-args[arguments to pass to the tests]: : '
-  '*:Meson tests:__meson_test_names'
-  )
-
-  _arguments \
-    '(: -)'{'--help','-h'}'[show a help message and quit]' \
-    "${(@)specs}"
-}
-
-(( $+functions[_meson-introspect] )) || _meson-introspect() {
-  local curcontext="$curcontext"
-  local -a specs=(
-  '--targets[list top level targets]'
-  '--installed[list all installed files and directories]'
-  '--buildsystem-files[list files that belong to the build system]'
-  '--buildoptions[list all build options]'
-  '--tests[list all unit tests]'
-  '--benchmarks[list all benchmarks]'
-  '--dependencies[list external dependencies]'
-  '--projectinfo[show project information]'
-  '::build directory:_directories'
-  )
-_arguments \
-  '(: -)'{'--help','-h'}'[show a help message and quit]' \
-  "${(@)specs}"
-}
-
-(( $+functions[_meson-wrap] )) || _meson-wrap() {
-  # TODO
-}
-
-if [[ $service != meson ]]; then
-  _call_function ret _$service
-  return ret
-fi
-
-_arguments -C -R \
-  '(: -)'{'--help','-h'}'[show a help message and quit]' \
-  '(: -)'{'--version','-v'}'[show version information and quit]' \
-  '(-): :_meson_commands' \
-  '*:: :->post-command' \
-#
-ret=$?
-
-[[ $ret = 300 ]] && case "$state" in
-  post-command)
-    service="meson-$words[1]"
-    curcontext=${curcontext%:*:*}:$service:
-    _call_function ret _$service
-    ;;
-esac
-
-return ret
-
diff --git a/meson/data/syntax-highlighting/emacs/meson.el b/meson/data/syntax-highlighting/emacs/meson.el
deleted file mode 100644 (file)
index a640bbe..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-;; keywords for syntax coloring
-(setq meson-keywords
-      `(
-        ( ,(regexp-opt '("elif" "if" "else" "endif" "foreach" "endforeach") 'word) . font-lock-keyword-face)
-        )
-      )
-
-;; syntax table
-(defvar meson-syntax-table nil "Syntax table for `meson-mode'.")
-(setq meson-syntax-table
-      (let ((synTable (make-syntax-table)))
-
-        ;; bash style comment: “# …”
-        (modify-syntax-entry ?# "< b" synTable)
-        (modify-syntax-entry ?\n "> b" synTable)
-
-        synTable))
-
-;; define the major mode.
-(define-derived-mode meson-mode prog-mode
-  "meson-mode is a major mode for editing Meson build definition files."
-  :syntax-table meson-syntax-table
-
-  (setq font-lock-defaults '(meson-keywords))
-  (setq mode-name "meson")
-  (setq-local comment-start "# ")
-  (setq-local comment-end ""))
-
-(add-to-list 'auto-mode-alist '("meson.build" . meson-mode))
-(provide 'meson)
-;;; meson.el ends here
diff --git a/meson/data/syntax-highlighting/vim/README b/meson/data/syntax-highlighting/vim/README
deleted file mode 100644 (file)
index 95188fc..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-ftdetect sets the filetype
-ftplugin sets Meson indentation rules
-indent does Meson indentation
-syntax does Meson syntax highlighting
diff --git a/meson/data/syntax-highlighting/vim/ftdetect/meson.vim b/meson/data/syntax-highlighting/vim/ftdetect/meson.vim
deleted file mode 100644 (file)
index 3233c58..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-au BufNewFile,BufRead meson.build set filetype=meson
-au BufNewFile,BufRead meson_options.txt set filetype=meson
-au BufNewFile,BufRead *.wrap set filetype=dosini
diff --git a/meson/data/syntax-highlighting/vim/ftplugin/meson.vim b/meson/data/syntax-highlighting/vim/ftplugin/meson.vim
deleted file mode 100644 (file)
index e432ebf..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-" Vim filetype plugin file
-" Language:    meson
-" License:     VIM License
-" Original Author:     Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-" Last Change:         2018 Nov 27
-
-if exists("b:did_ftplugin") | finish | endif
-let b:did_ftplugin = 1
-let s:keepcpo= &cpo
-set cpo&vim
-
-setlocal commentstring=#\ %s
-setlocal comments=:#
-
-setlocal shiftwidth=2
-setlocal softtabstop=2
-
-let &cpo = s:keepcpo
-unlet s:keepcpo
diff --git a/meson/data/syntax-highlighting/vim/indent/meson.vim b/meson/data/syntax-highlighting/vim/indent/meson.vim
deleted file mode 100644 (file)
index f73e3b9..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-" Vim indent file
-" Language:            Meson
-" License:             VIM License
-" Maintainer:          Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
-" Original Authors:    David Bustos <bustos@caltech.edu>
-"                      Bram Moolenaar <Bram@vim.org>
-" Last Change:         2015 Feb 23
-
-" Only load this indent file when no other was loaded.
-if exists("b:did_indent")
-  finish
-endif
-let b:did_indent = 1
-
-" Some preliminary settings
-setlocal nolisp                " Make sure lisp indenting doesn't supersede us
-setlocal autoindent    " indentexpr isn't much help otherwise
-
-setlocal indentexpr=GetMesonIndent(v:lnum)
-setlocal indentkeys+==elif,=else,=endforeach,=endif,0)
-
-" Only define the function once.
-if exists("*GetMesonIndent")
-  finish
-endif
-let s:keepcpo= &cpo
-setlocal cpo&vim
-
-" Come here when loading the script the first time.
-
-let s:maxoff = 50      " maximum number of lines to look backwards for ()
-
-function GetMesonIndent(lnum)
-  echom getline(line("."))
-
-  " If this line is explicitly joined: If the previous line was also joined,
-  " line it up with that one, otherwise add two 'shiftwidth'
-  if getline(a:lnum - 1) =~ '\\$'
-    if a:lnum > 1 && getline(a:lnum - 2) =~ '\\$'
-      return indent(a:lnum - 1)
-    endif
-    return indent(a:lnum - 1) + (exists("g:mesonindent_continue") ? eval(g:mesonindent_continue) : (shiftwidth() * 2))
-  endif
-
-  " If the start of the line is in a string don't change the indent.
-  if has('syntax_items')
-       \ && synIDattr(synID(a:lnum, 1, 1), "name") =~ "String$"
-    return -1
-  endif
-
-  " Search backwards for the previous non-empty line.
-  let plnum = prevnonblank(v:lnum - 1)
-
-  if plnum == 0
-    " This is the first non-empty line, use zero indent.
-    return 0
-  endif
-
-  " If the previous line is inside parenthesis, use the indent of the starting
-  " line.
-  " Trick: use the non-existing "dummy" variable to break out of the loop when
-  " going too far back.
-  call cursor(plnum, 1)
-  let parlnum = searchpair('(\|{\|\[', '', ')\|}\|\]', 'nbW',
-         \ "line('.') < " . (plnum - s:maxoff) . " ? dummy :"
-         \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-         \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
-  if parlnum > 0
-    let plindent = indent(parlnum)
-    let plnumstart = parlnum
-  else
-    let plindent = indent(plnum)
-    let plnumstart = plnum
-  endif
-
-
-  " When inside parenthesis: If at the first line below the parenthesis add
-  " a 'shiftwidth', otherwise same as previous line.
-  " i = (a
-  "       + b
-  "       + c)
-  call cursor(a:lnum, 1)
-  let p = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
-         \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
-         \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-         \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
-  if p > 0
-    if p == plnum
-      " When the start is inside parenthesis, only indent one 'shiftwidth'.
-      let pp = searchpair('(\|{\|\[', '', ')\|}\|\]', 'bW',
-         \ "line('.') < " . (a:lnum - s:maxoff) . " ? dummy :"
-         \ . " synIDattr(synID(line('.'), col('.'), 1), 'name')"
-         \ . " =~ '\\(Comment\\|Todo\\|String\\)$'")
-      if pp > 0
-       return indent(plnum) + (exists("g:pyindent_nested_paren") ? eval(g:pyindent_nested_paren) : shiftwidth())
-      endif
-      return indent(plnum) + (exists("g:pyindent_open_paren") ? eval(g:pyindent_open_paren) : shiftwidth())
-    endif
-    if plnumstart == p
-      return indent(plnum)
-    endif
-    return plindent
-  endif
-
-
-  " Get the line and remove a trailing comment.
-  " Use syntax highlighting attributes when possible.
-  let pline = getline(plnum)
-  let pline_len = strlen(pline)
-  if has('syntax_items')
-    " If the last character in the line is a comment, do a binary search for
-    " the start of the comment.  synID() is slow, a linear search would take
-    " too long on a long line.
-    if synIDattr(synID(plnum, pline_len, 1), "name") =~ "\\(Comment\\|Todo\\)$"
-      let min = 1
-      let max = pline_len
-      while min < max
-       let col = (min + max) / 2
-       if synIDattr(synID(plnum, col, 1), "name") =~ "\\(Comment\\|Todo\\)$"
-         let max = col
-       else
-         let min = col + 1
-       endif
-      endwhile
-      let pline = strpart(pline, 0, min - 1)
-    endif
-  else
-    let col = 0
-    while col < pline_len
-      if pline[col] == '#'
-       let pline = strpart(pline, 0, col)
-       break
-      endif
-      let col = col + 1
-    endwhile
-  endif
-
-  " If the previous line ended the conditional/loop
-  if getline(plnum) =~ '^\s*\(endif\|endforeach\)\>\s*'
-    " Maintain indent
-    return -1
-  endif
-
-  " If the previous line ended with a builtin, indent this line
-  if pline =~ '^\s*\(foreach\|if\|else\|elif\)\>\s*'
-    return plindent + shiftwidth()
-  endif
-
-  " If the current line begins with a header keyword, deindent
-  if getline(a:lnum) =~ '^\s*\(else\|elif\|endif\|endforeach\)'
-
-    " Unless the previous line was a one-liner
-    if getline(plnumstart) =~ '^\s*\(foreach\|if\)\>\s*'
-      return plindent
-    endif
-
-    " Or the user has already dedented
-    if indent(a:lnum) <= plindent - shiftwidth()
-      return -1
-    endif
-
-    return plindent - shiftwidth()
-  endif
-
-  " When after a () construct we probably want to go back to the start line.
-  " a = (b
-  "       + c)
-  " here
-  if parlnum > 0
-    return plindent
-  endif
-
-  return -1
-
-endfunction
-
-let &cpo = s:keepcpo
-unlet s:keepcpo
-
-" vim:sw=2
diff --git a/meson/data/syntax-highlighting/vim/syntax/meson.vim b/meson/data/syntax-highlighting/vim/syntax/meson.vim
deleted file mode 100644 (file)
index 1100113..0000000
+++ /dev/null
@@ -1,167 +0,0 @@
-" Vim syntax file
-" Language:    Meson
-" License:     VIM License
-" Maintainer:  Nirbheek Chauhan <nirbheek.chauhan@gmail.com>
-" Last Change: 2016 Dec 7
-" Credits:     Zvezdan Petkovic <zpetkovic@acm.org>
-"              Neil Schemenauer <nas@meson.ca>
-"              Dmitry Vasiliev
-"
-"              This version is copied and edited from python.vim
-"              It's very basic, and doesn't do many things I'd like it to
-"              For instance, it should show errors for syntax that is valid in
-"              Python but not in Meson.
-"
-" Optional highlighting can be controlled using these variables.
-"
-"   let meson_space_error_highlight = 1
-"
-
-" For version 5.x: Clear all syntax items.
-" For version 6.x: Quit when a syntax file was already loaded.
-if version < 600
-  syntax clear
-elseif exists("b:current_syntax")
-  finish
-endif
-
-" We need nocompatible mode in order to continue lines with backslashes.
-" Original setting will be restored.
-let s:cpo_save = &cpo
-set cpo&vim
-
-" http://mesonbuild.com/Syntax.html
-syn keyword mesonConditional   elif else if endif
-syn keyword mesonRepeat                foreach endforeach
-syn keyword mesonOperator      and not or in
-syn keyword mesonStatement     continue break
-
-syn match   mesonComment       "#.*$" contains=mesonTodo,@Spell
-syn keyword mesonTodo          FIXME NOTE NOTES TODO XXX contained
-
-" Strings can either be single quoted or triple counted across multiple lines,
-" but always with a '
-syn region  mesonString
-      \ start="\z('\)" end="\z1" skip="\\\\\|\\\z1"
-      \ contains=mesonEscape,@Spell
-syn region  mesonString
-      \ start="\z('''\)" end="\z1" keepend
-      \ contains=mesonEscape,mesonSpaceError,@Spell
-
-syn match   mesonEscape        "\\[abfnrtv'\\]" contained
-syn match   mesonEscape        "\\\o\{1,3}" contained
-syn match   mesonEscape        "\\x\x\{2}" contained
-syn match   mesonEscape        "\%(\\u\x\{4}\|\\U\x\{8}\)" contained
-" Meson allows case-insensitive Unicode IDs: http://www.unicode.org/charts/
-syn match   mesonEscape        "\\N{\a\+\%(\s\a\+\)*}" contained
-syn match   mesonEscape        "\\$"
-
-" Meson only supports integer numbers
-" http://mesonbuild.com/Syntax.html#numbers
-syn match   mesonNumber        "\<\d\+\>"
-
-" booleans
-syn keyword mesonConstant      false true
-
-" Built-in functions
-syn keyword mesonBuiltin
-  \ add_global_arguments
-  \ add_global_link_arguments
-  \ add_languages
-  \ add_project_arguments
-  \ add_project_link_arguments
-  \ add_test_setup
-  \ alias_target
-  \ assert
-  \ benchmark
-  \ both_libraries
-  \ build_machine
-  \ build_target
-  \ configuration_data
-  \ configure_file
-  \ custom_target
-  \ declare_dependency
-  \ dependency
-  \ disabler
-  \ environment
-  \ error
-  \ executable
-  \ files
-  \ find_library
-  \ find_program
-  \ generator
-  \ get_option
-  \ get_variable
-  \ gettext
-  \ host_machine
-  \ import
-  \ include_directories
-  \ install_data
-  \ install_headers
-  \ install_man
-  \ install_subdir
-  \ is_disabler
-  \ is_variable
-  \ jar
-  \ join_paths
-  \ library
-  \ meson
-  \ message
-  \ option
-  \ project
-  \ run_command
-  \ run_target
-  \ set_variable
-  \ shared_library
-  \ shared_module
-  \ static_library
-  \ subdir
-  \ subdir_done
-  \ subproject
-  \ summary
-  \ target_machine
-  \ test
-  \ vcs_tag
-  \ warning
-
-if exists("meson_space_error_highlight")
-  " trailing whitespace
-  syn match   mesonSpaceError  display excludenl "\s\+$"
-  " mixed tabs and spaces
-  syn match   mesonSpaceError  display " \+\t"
-  syn match   mesonSpaceError  display "\t\+ "
-endif
-
-if version >= 508 || !exists("did_meson_syn_inits")
-  if version <= 508
-    let did_meson_syn_inits = 1
-    command -nargs=+ HiLink hi link <args>
-  else
-    command -nargs=+ HiLink hi def link <args>
-  endif
-
-  " The default highlight links.  Can be overridden later.
-  HiLink mesonStatement                Statement
-  HiLink mesonConditional      Conditional
-  HiLink mesonRepeat           Repeat
-  HiLink mesonOperator         Operator
-  HiLink mesonComment          Comment
-  HiLink mesonTodo             Todo
-  HiLink mesonString           String
-  HiLink mesonEscape           Special
-  HiLink mesonNumber           Number
-  HiLink mesonBuiltin          Function
-  HiLink mesonConstant         Number
-  if exists("meson_space_error_highlight")
-    HiLink mesonSpaceError     Error
-  endif
-
-  delcommand HiLink
-endif
-
-let b:current_syntax = "meson"
-
-let &cpo = s:cpo_save
-unlet s:cpo_save
-
-" vim:set sw=2 sts=2 ts=8 noet:
diff --git a/meson/data/test.schema.json b/meson/data/test.schema.json
deleted file mode 100644 (file)
index aa3cf8f..0000000
+++ /dev/null
@@ -1,131 +0,0 @@
-{
-  "type": "object",
-  "additionalProperties": false,
-  "properties": {
-    "env": {
-      "type": "object",
-      "additionalProperties": {
-        "type": "string"
-      }
-    },
-    "installed": {
-      "type": "array",
-      "items": {
-        "type": "object",
-        "properties": {
-          "file": {
-            "type": "string"
-          },
-          "type": {
-            "type": "string",
-            "enum": [
-              "file",
-              "dir",
-              "exe",
-              "shared_lib",
-              "pdb",
-              "implib",
-              "implibempty",
-              "expr"
-            ]
-          },
-          "platform": {
-            "type": "string",
-            "enum": [
-              "msvc",
-              "gcc",
-              "cygwin",
-              "!cygwin"
-            ]
-          },
-          "version": {
-            "type": "string"
-          },
-          "language": {
-            "type": "string"
-          }
-        },
-        "required": [
-          "file",
-          "type"
-        ]
-      }
-    },
-    "matrix": {
-      "type": "object",
-      "additionalProperties": {
-        "properties": {
-          "options": {
-            "type": "array",
-            "items": {
-              "type": "object",
-              "properties": {
-                "val": {
-                  "type": "string"
-                },
-                "compilers": {
-                  "type": "object",
-                  "additionalProperties": {
-                    "type": "string"
-                  }
-                },
-                "skip_on_env": {
-                  "type": "array",
-                  "items": {
-                    "type": "string"
-                  }
-                }
-              },
-              "required": [
-                "val"
-              ]
-            }
-          },
-          "exclude": {
-            "type": "array",
-            "items": {
-              "type": "object",
-              "additionalProperties": {
-                "type": "string"
-              }
-            }
-          }
-        }
-      }
-    },
-    "do_not_set_opts": {
-      "type": "array",
-      "items": {
-        "type": "string",
-        "enum": [
-          "libdir",
-          "prefix"
-        ]
-      }
-    },
-    "tools": {
-      "type": "object"
-    },
-    "stdout": {
-      "type": "array",
-      "items": {
-        "type": "object",
-        "properties": {
-          "line": {
-            "type": "string"
-          },
-          "match": {
-            "type": "string",
-            "enum": [
-              "literal",
-              "re"
-            ]
-          }
-        },
-        "required": [
-          "line"
-        ]
-      }
-    }
-  }
-}
diff --git a/meson/docs/.editorconfig b/meson/docs/.editorconfig
deleted file mode 100644 (file)
index b5276f1..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[sitemap.txt]
-indent_style = tab
diff --git a/meson/docs/README.md b/meson/docs/README.md
deleted file mode 100644 (file)
index 55fc3ec..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Meson Documentation
-
-## Build dependencies
-
-Meson uses itself and [hotdoc](https://github.com/hotdoc/hotdoc) for generating documentation.
-
-Minimum required version of hotdoc is *0.8.9*.
-
-Instructions on how to install hotdoc are [here](https://hotdoc.github.io/installing.html).
-
-## Building the documentation
-
-From the Meson repository root dir:
-```
-$ cd docs/
-$ meson built_docs
-$ ninja -C built_docs/ upload
-```
-Now you should be able to open the documentation locally
-```
-built_docs/Meson documentation-doc/html/index.html
-```
-
-## Upload
-
-Meson uses the git-upload hotdoc plugin which basically
-removes the html pages and replaces with the new content.
-
-You can simply run:
-```
-$ ninja -C built_docs/ upload
-```
-
-## Contributing to the documentation
-
-Commits that only change documentation should have `[skip ci]` in their commit message, so CI is not run (it is quite slow).
-For example:
-```
-A commit message [skip ci]
-```
diff --git a/meson/docs/genrelnotes.py b/meson/docs/genrelnotes.py
deleted file mode 100755 (executable)
index 70d8915..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2019 The Meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-'''
-  Generates release notes for new releases of Meson build system
-'''
-import subprocess
-import sys
-import os
-from glob import glob
-
-RELNOTE_TEMPLATE = '''---
-title: Release {}
-short-description: Release notes for {}
-...
-
-# New features
-
-'''
-
-
-def add_to_sitemap(from_version, to_version):
-    '''
-       Adds release note entry to sitemap.txt.
-    '''
-    sitemapfile = '../sitemap.txt'
-    s_f = open(sitemapfile)
-    lines = s_f.readlines()
-    s_f.close()
-    with open(sitemapfile, 'w') as s_f:
-        for line in lines:
-            if 'Release-notes' in line and from_version in line:
-                new_line = line.replace(from_version, to_version)
-                s_f.write(new_line)
-            s_f.write(line)
-
-def generate(from_version, to_version):
-    '''
-       Generate notes for Meson build next release.
-    '''
-    ofilename = 'Release-notes-for-{}.md'.format(to_version)
-    with open(ofilename, 'w') as ofile:
-        ofile.write(RELNOTE_TEMPLATE.format(to_version, to_version))
-        for snippetfile in glob('snippets/*.md'):
-            snippet = open(snippetfile).read()
-            ofile.write(snippet)
-            if not snippet.endswith('\n'):
-                ofile.write('\n')
-            ofile.write('\n')
-            subprocess.check_call(['git', 'rm', snippetfile])
-    subprocess.check_call(['git', 'add', ofilename])
-    add_to_sitemap(from_version, to_version)
-
-if __name__ == '__main__':
-    if len(sys.argv) != 3:
-        print(sys.argv[0], 'from_version to_version')
-        sys.exit(1)
-    FROM_VERSION = sys.argv[1]
-    TO_VERSION = sys.argv[2]
-    os.chdir('markdown')
-    generate(FROM_VERSION, TO_VERSION)
diff --git a/meson/docs/markdown/ARM-performance-test.md b/meson/docs/markdown/ARM-performance-test.md
deleted file mode 100644 (file)
index 4be6e4a..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-# Arm performance test
-
-Performance differences in build systems become more apparent on
-slower platforms. To examine this difference we compared the
-performance of Meson with GNU Autotools. We took the GLib software
-project and rewrote its build setup with Meson. GLib was chosen
-because it is a relatively large C code base which requires lots of
-low level configuration.
-
-The Meson version of the build system is not fully equivalent to the
-original Autotools one. It does not do all the same configuration
-steps and does not build all the same targets. The biggest missing
-piece being internationalisation support with Gettext. However it does
-configure the system enough to build all C source and run all unit
-tests.
-
-All measurements were done on a Nexus 4 smart phone running the latest
-Ubuntu touch image (updated on September 9th 2013).
-
-Measurements
-------
-
-The first thing we measured was the time it took to run the configure step.
-
-![GLib config time](images/glib_conf.png)
-
-Meson takes roughly 20 seconds whereas Autotools takes 220. This is a
-difference of one order of magnitude. Autotools' time contains both
-autogen and configure. Again it should be remembered that Meson does
-not do all the configure steps that Autotools does. It does do about
-90% of them and it takes just 10% of the time to do it.
-
-Then we measured the build times. Two parallel compilation processes
-were used for both systems.
-
-![GLib build time](images/glib_build.png)
-
-On desktop machines Ninja based build systems are 10-20% faster than
-Make based ones. On this platform the difference grows to 50%. The
-difference is probably caused by Make's inefficient disk access
-patterns. Ninja is better at keeping both cores running all the time
-which yields impressive performance improvements.
-
-![GLib no-op time](images/glib_empty.png)
-
-Next we measured the "empty build" case. That is, how long does it
-take for the build system to detect that no changes need to be
-made. This is one of the most important metrics of build systems
-because it places a hard limit on how fast you can iterate on your
-code. Autotools takes 14 seconds to determine that no work needs to be
-done. Meson (or, rather, Ninja) takes just one quarter of a second.
-
-![GLib link time](images/glib_link.png)
-
-One step which takes quite a lot of time is linking. A common case is
-that you are working on a library and there are tens of small test
-executables that link to it. Even if the compilation step would be
-fast, relinking all of the test executables takes time. It is common
-for people to manually compile only one test application with a
-command such as `make sometest` rather than rebuild everything.
-
-Meson has an optimization for this case. Whenever a library is
-rebuilt, Meson inspects the ABI it exports. If it has not changed,
-Meson will skip all relinking steps as unnecessary. The difference
-this makes can be clearly seen in the chart above. In that test the
-source was fully built, then the file `glib/gbytes.c` was touched to
-force the rebuild of the base glib shared library. As can be seen,
-Autotools then relinks all test executables that link with glib. Since
-Meson can detect that the ABI is the same it can skip those steps. The
-end result being that Meson is almost one hundred times faster on this
-very common use case.
-
-Conclusions
------
-
-One of the main drawbacks of C and C++ compared to languages such as
-Java are long compilation times. However at least some of the blame
-can be found in the build tools used rather than the languages
-themselves or their compilers. Choosing proper tools can bring C and
-C++ compilation very close to instantaneous rebuilds. This has a
-direct impact on programmer productivity.
diff --git a/meson/docs/markdown/Adding-arguments.md b/meson/docs/markdown/Adding-arguments.md
deleted file mode 100644 (file)
index 8dd8488..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
----
-short-description: Adding compiler arguments
-...
-
-# Adding arguments
-
-Often you need to specify extra compiler arguments. Meson provides two
-different ways to achieve this: global arguments and per-target
-arguments.
-
-Global arguments
---
-
-Global compiler arguments are set with the following command. As an
-example you could do this.
-
-```meson
-add_global_arguments('-DFOO=bar', language : 'c')
-```
-
-This makes Meson add the define to all C compilations. Usually you
-would use this setting for flags for global settings. Note that for
-setting the C/C++ language standard (the `-std=c99` argument in GCC),
-you would probably want to use a default option of the `project()`
-function. For details see the [reference manual](Reference-manual.md).
-
-Global arguments have certain limitations. They all have to be defined
-before any build targets are specified. This ensures that the global
-flags are the same for every single source file built in the entire
-project with one exception. Compilation tests that are run as part of
-your project configuration do not use these flags. The reason for that
-is that you may need to run a test compile with and without a given
-flag to determine your build setup. For this reason tests do not use
-these global arguments.
-
-You should set only the most essential flags with this setting, you
-should *not* set debug or optimization flags. Instead they should be
-specified by selecting an appropriate build type.
-
-Project arguments
---
-
-Project arguments work similar to global arguments except that they
-are valid only within the current subproject. The usage is simple:
-
-```meson
-add_project_arguments('-DMYPROJ=projname', language : 'c')
-```
-
-This would add the compiler flags to all C sources in the current
-project.
-
-Per target arguments
---
-
-Per target arguments are just as simple to define.
-
-```meson
-executable('prog', 'prog.cc', cpp_args : '-DCPPTHING')
-```
-
-Here we create a C++ executable with an extra argument that is used
-during compilation but not for linking.
-
-You can find the parameter name for other languages in the [reference tables](Reference-tables.md).
-
-Specifying extra linker arguments is done in the same way:
-
-```meson
-executable('prog', 'prog.cc', link_args : '-Wl,--linker-option')
-```
diff --git a/meson/docs/markdown/Adding-new-projects-to-wrapdb.md b/meson/docs/markdown/Adding-new-projects-to-wrapdb.md
deleted file mode 100644 (file)
index 25fb61c..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-# Adding new projects to WrapDB
-
-
-## How it works
-
-Each wrap repository has a master branch with only one initial commit and *no* wrap files.
-And that is the only commit ever made on that branch.
-
-For every release of a project a new branch is created. The new branch is named after the
-the upstream release number (e.g. `1.0.0`). This branch holds a wrap file for
-this particular release.
-
-There are two types of wraps on WrapDB - regular wraps and wraps with Meson build
-definition patches. A wrap file in a repository on WrapDB must have a name `upstream.wrap`.
-
-Wraps with Meson build definition patches work in much the same way as Debian:
-we take the unaltered upstream source package and add a new build system to it as a patch.
-These build systems are stored as Git repositories on GitHub. They only contain build definition files.
-You may also think of them as an overlay to upstream source.
-
-Whenever a new commit is pushed into GitHub's project branch, a new wrap is generated
-with an incremented version number. All the old releases remain unaltered.
-New commits are always done via GitHub merge requests and must be reviewed by
-someone other than the submitter.
-
-Note that your Git repo with wrap must not contain the subdirectory of the source
-release. That gets added automatically by the service. You also must not commit
-any source code from the original tarball into the wrap repository.
-
-## Choosing the repository name
-
-Wrapped subprojects are used much like external dependencies. Thus
-they should have the same name as the upstream projects.
-
-NOTE: Repo names must fully match this regexp: `[a-z0-9._]+`.
-
-If the project provides a pkg-config file, then the repository name should be
-the same as the pkg-config name. Usually this is the name of the
-project, such as `libpng`. Sometimes it is slightly different,
-however. As an example the libogg project's chosen pkg-config name is
-`ogg` instead of `libogg`, which is the reason why the repository is
-named plain `ogg`.
-
-If there is no a pkg-config file, the name the project uses/promotes should be used,
-lowercase only (Catch2 -> catch2).
-
-If the project name is too generic or ambiguous (e.g. `benchmark`),
-consider using `organization-project` naming format (e.g. `google-benchmark`).
-
-## How to contribute a new wrap
-
-If the project already uses Meson build system, then only a wrap file - `upstream.wrap`
-should be provided. In other case a Meson build definition patch - a set of `meson.build`
-files - should be also provided.
-
-### Request a new repository
-
-Create an issue on the [wrapdb bug tracker](https://github.com/mesonbuild/wrapdb/issues)
-using *Title* and *Description* below as a template.
-
-*Title:* `new wrap: <project_name>`
-
-*Description:*
-```
-upstream url: <link_to_updastream>
-version: <version_you_have_a_wrap_for>
-```
-
-Wait until the new repository or branch is created. A link to the new repository or branch
-will be posted in a comment to this issue.
-
-NOTE: Requesting a branch is not necessary. WrapDB maintainer can create the branch and
-modify the PR accordingly if the project repository exists.
-
-### Add a new wrap
-
-First you need to fork the repository to your own page.
-Then you can create the first Wrap commit that usually looks something like this.
-
-```
-tar xzf libfoo-1.0.0.tar.gz
-git clone -b 1.0.0 git@github.com:yourusername/libfoo.git tmpdir
-mv tmpdir/.git libfoo-1.0.0
-rm -rf tmpdir
-cd libfoo-1.0.0
-git reset --hard
-emacs upstream.wrap meson.build
-<verify that your project builds and runs>
-git add upstream.wrap meson.build
-git commit -a -m 'Add wrap files for libfoo-1.0.0'
-git push origin 1.0.0
-```
-
-Now you should create a pull request on GitHub. Remember to create it against the
-correct branch rather than master (`1.0.0` branch in this example). GitHub should do
-this automatically.
-
-If the branch doesn't exist file a pull request against master.
-WrapDB maintainers can fix it before merging.
-
-## What is done by WrapDB maintainers
-
-[mesonwrap tools](Wrap-maintainer-tools.md) must be used for the tasks below.
-
-### Adding new project to the Wrap provider service
-
-Each project gets its own repo. It is initialized like this:
-
-```
-mesonwrap new_repo --homepage=$HOMEPAGE --directory=$NEW_LOCAL_PROJECT_DIR $PROJECT_NAME
-```
-
-The command creates a new repository and uploads it to Github.
-
-`--version` flag may be used to create a branch immediately.
-
-### Adding a new branch to an existing project
-
-Create a new branch whose name matches the upstream release number.
-
-```
-git checkout master
-git checkout -b 1.0.0
-git push origin 1.0.0
-(or from GitHub web page, remember to branch from master)
-```
-
-Branch names must fully match this regexp: `[a-z0-9._]+`.
-
-## Changes to original source
-
-The point of a wrap is to provide the upstream project with as few
-changes as possible. Most projects should not contain anything more
-than a few Meson definition files. Sometimes it may be necessary to
-add a template header file or something similar. These should be held
-at a minimum.
-
-It should especially be noted that there must **not** be any patches
-to functionality. All such changes must be submitted to upstream. You
-may also host your own Git repo with the changes if you wish. The Wrap
-system has native support for Git subprojects.
-
-## Reviewing wraps
-
-See [Wrap review guidelines](Wrap-review-guidelines.md).
diff --git a/meson/docs/markdown/Additional.md b/meson/docs/markdown/Additional.md
deleted file mode 100644 (file)
index 2fff488..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
----
-short-description: Misc documentation
-...
-
-# Additional documentation
-
-This section references documents miscellaneous design, benchmarks, or
-basically anything concerning Meson.
diff --git a/meson/docs/markdown/Build-options.md b/meson/docs/markdown/Build-options.md
deleted file mode 100644 (file)
index 429b9b2..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
----
-short-description: Build options to configure project properties
-...
-
-# Build options
-
-Most non-trivial builds require user-settable options. As an example a
-program may have two different data backends that are selectable at
-build time. Meson provides for this by having a option definition
-file. Its name is `meson_options.txt` and it is placed at the root of
-your source tree.
-
-Here is a simple option file.
-
-```meson
-option('someoption', type : 'string', value : 'optval', description : 'An option')
-option('other_one', type : 'boolean', value : false)
-option('combo_opt', type : 'combo', choices : ['one', 'two', 'three'], value : 'three')
-option('integer_opt', type : 'integer', min : 0, max : 5, value : 3) # Since 0.45.0
-option('free_array_opt', type : 'array', value : ['one', 'two'])  # Since 0.44.0
-option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one', 'two'])
-option('some_feature', type : 'feature', value : 'enabled')  # Since 0.47.0
-option('long_desc', type : 'string', value : 'optval',
-       description : 'An option with a very long description' +
-                     'that does something in a specific context') # Since 0.55.0
-```
-
-For built-in options, see [Built-in options][builtin_opts].
-
-## Build option types
-
-All types allow a `description` value to be set describing the option,
-if no description is set then the name of the option will be used instead.
-
-### Strings
-
-The string type is a free form string. If the default value is not set
-then an empty string will be used as the default.
-
-### Booleans
-
-Booleans may have values of either `true` or `false`. If no default
-value is supplied then `true` will be used as the default.
-
-### Combos
-
-A combo allows any one of the values in the `choices` parameter to be
-selected.  If no default value is set then the first value will be the
-default.
-
-### Integers
-
-An integer option contains a single integer with optional upper and
-lower values that are specified with the `min` and `max` keyword
-arguments.
-
-This type is available since Meson version 0.45.0.
-
-### Arrays
-
-Arrays represent an array of strings. By default the array can contain
-arbitrary strings. To limit the possible values that can used set the
-`choices` parameter. Meson will then only allow the value array to
-contain strings that are in the given list. The array may be
-empty. The `value` parameter specifies the default value of the option
-and if it is unset then the values of `choices` will be used as the
-default.
-
-As of 0.47.0 -Dopt= and -Dopt=[] both pass an empty list, before this -Dopt=
-would pass a list with an empty string.
-
-This type is available since version 0.44.0
-
-### Features
-
-A `feature` option has three states: `enabled`, `disabled` or `auto`. It is intended
-to be passed as value for the `required` keyword argument of most functions.
-Currently supported in
-[`dependency()`](Reference-manual.md#dependency),
-[`find_library()`](Reference-manual.md#compiler-object),
-[`find_program()`](Reference-manual.md#find_program) and
-[`add_languages()`](Reference-manual.md#add_languages) functions.
-
-- `enabled` is the same as passing `required : true`.
-- `auto` is the same as passing `required : false`.
-- `disabled` do not look for the dependency and always return 'not-found'.
-
-When getting the value of this type of option using `get_option()`, a special
-[feature option object](Reference-manual.md#feature-option-object)
-is returned instead of the string representation of the option's value.
-This object can be passed to `required`:
-
-```meson
-d = dependency('foo', required : get_option('myfeature'))
-if d.found()
-  app = executable('myapp', 'main.c', dependencies : [d])
-endif
-```
-
-To check the value of the feature, the object has three methods
-returning a boolean and taking no argument:
-
-- `.enabled()`
-- `.disabled()`
-- `.auto()`
-
-This is useful for custom code depending on the feature:
-
-```meson
-if get_option('myfeature').enabled()
-  # ...
-endif
-```
-
-If the value of a `feature` option is set to `auto`, that value is overridden by
-the global `auto_features` option (which defaults to `auto`). This is intended
-to be used by packagers who want to have full control on which dependencies are
-required and which are disabled, and not rely on build-deps being installed
-(at the right version) to get a feature enabled. They could set
-`auto_features=enabled` to enable all features and disable explicitly only the
-few they don't want, if any.
-
-This type is available since version 0.47.0
-
-## Using build options
-
-```meson
-optval = get_option('opt_name')
-```
-
-This function also allows you to query the value of Meson's built-in
-project options. For example, to get the installation prefix you would
-issue the following command:
-
-```meson
-prefix = get_option('prefix')
-```
-
-It should be noted that you can not set option values in your Meson
-scripts. They have to be set externally with the `meson configure`
-command line tool. Running `meson configure` without arguments in a
-build dir shows you all options you can set.
-
-To change their values use the `-D`
-option:
-
-```console
-$ meson configure -Doption=newvalue
-```
-
-Setting the value of arrays is a bit special. If you only pass a
-single string, then it is considered to have all values separated by
-commas. Thus invoking the following command:
-
-```console
-$ meson configure -Darray_opt=foo,bar
-```
-
-would set the value to an array of two elements, `foo` and `bar`.
-
-If you need to have commas in your string values, then you need to
-pass the value with proper shell quoting like this:
-
-```console
-$ meson configure "-Doption=['a,b', 'c,d']"
-```
-
-The inner values must always be single quotes and the outer ones
-double quotes.
-
-To change values in subprojects prepend the name of the subproject and
-a colon:
-
-```console
-$ meson configure -Dsubproject:option=newvalue
-```
-
-**NOTE:** If you cannot call `meson configure` you likely have a old
-  version of Meson. In that case you can call `mesonconf` instead, but
-  that is deprecated in newer versions
-
-## Yielding to superproject option
-
-Suppose you have a master project and a subproject. In some cases it
-might be useful to have an option that has the same value in both of
-them. This can be achieved with the `yield` keyword. Suppose you have
-an option definition like this:
-
-```meson
-option('some_option', type : 'string', value : 'value', yield : true)
-```
-
-If you build this project on its own, this option behaves like
-usual. However if you build this project as a subproject of another
-project which also has an option called `some_option`, then calling
-`get_option` returns the value of the superproject. If the value of
-`yield` is `false`, `get_option` returns the value of the subproject's
-option.
-
-
-## Built-in build options
-
-There are a number of [built-in options][builtin_opts]. To get the current list execute `meson
-configure` in the build directory.
-
-[builtin_opts]: https://mesonbuild.com/Builtin-options.html
-
-### Visual Studio
-
-#### Startup project
-
-The backend\_startup\_project option can be set to define the default project
-that will be executed with the "Start debugging F5" action in visual studio.
-It should be the same name as an executable target name.
-
-```meson
-project('my_project', 'c', default_options: ['backend_startup_project=my_exe'])
-executable('my_exe', ...)
-```
-
-### Ninja
-
-#### Max links
-
-The backend\_max\_links can be set to limit the number of processes that ninja
-will use to link.
diff --git a/meson/docs/markdown/Build-system-converters.md b/meson/docs/markdown/Build-system-converters.md
deleted file mode 100644 (file)
index 1c0b4fc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
----
-short-description: Converting other build systems to Meson
-...
-
-# Build system converters
-
-Moving from one build system into another includes a fair bit of
-work. To make things easier, Meson provides scripts to convert other
-build systems into Meson. At the time of writing, scripts for CMake
-and autotools exist. It can be found in the `tools` subdirectory in
-Meson's source tree.
-
-The scripts do not try to do a perfect conversion. This would be
-extremely difficult because the data models of other build systems are
-very different. The goal of the converter script is to convert as much
-of the low level drudgery as possible. Using the scripts is
-straightforward. We'll use the CMake one as an example but the
-Autotools one works exactly the same way.
-
-    cmake2meson.py path/to/CMake/project/root
-
-This command generates a skeleton Meson project definition that tries
-to mirror CMake's setup as close as possible. Once this is done, you
-need to go through these files manually and finalize the
-conversion. To make this task as simple as possible, the converter
-script will transfer all comments from the CMake definition into Meson
-definition.
diff --git a/meson/docs/markdown/Build-targets.md b/meson/docs/markdown/Build-targets.md
deleted file mode 100644 (file)
index 83f959f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
----
-short-description: Definition of build targets
-...
-
-# Build targets
-
-Meson provides four kinds of build targets: executables, libraries
-(which can be set to be built as static or shared or both of them at
-the build configuration time), static libraries, and shared libraries.
-They are created with the commands `executable`, `library`,
-`static_library` and `shared_library`, respectively. All objects created
-in this way are **immutable**. That is, you can not change any aspect of
-them after they have been constructed. This ensures that all information
-pertaining to a given build target is specified in one well defined
-place.
-
-Libraries and executables
---
-
-As an example, here is how you would build a library.
-
-```meson
-project('shared lib', 'c')
-library('mylib', 'source.c')
-```
-
-It is generally preferred to use the `library` command instead of
-`shared_library` and `static_library` and then configure which
-libraries (static or shared or both of them) will be built at the
-build configuration time using the `default_library`
-[built-in option](Builtin-options.md).
-
-In Unix-like operating systems, shared libraries can be
-versioned. Meson supports this with keyword arguments, which will be
-ignored if the library is configured as static at the compile time.
-
-```meson
-project('shared lib', 'c')
-library('mylib', 'source.c', version : '1.2.3', soversion : '0')
-```
-
-It is common to build a library and then an executable that links
-against it. This is supported as well.
-
-```meson
-project('shared lib', 'c')
-lib = library('mylib', 'source.c')
-executable('program', 'prog.c', link_with : lib)
-```
-
-Meson sets things up so that the resulting executable can be run
-directly from the build directory. There is no need to write shell
-scripts or set environment variables.
-
-One target can have multiple language source files.
-
-```meson
-project('multilang', 'c', 'cpp')
-executable('multiexe', 'file.c', 'file2.cc')
-```
-
-Object files
---
-
-Sometimes you can't build files from sources but need to utilize an
-existing object file. A typical case is using an object file provided
-by a third party. Object files can be specified just like sources.
-
-```meson
-exe = executable('myexe', 'source.cpp', objects : 'third_party_object.o')
-```
-
-A different case is when you want to use object files built in one
-target directly in another. A typical case is when you build a shared
-library and it has an internal class that is not exported in the
-ABI. This means you can't access it even if you link against the
-library. Typical workarounds for this include building both a shared
-and static version of the library or putting the source file in the
-test executable's source list. Both of these approaches cause the
-source to be built twice, which is slow.
-
-In Meson you can extract object files from targets and use them as-is
-on other targets. This is the syntax for it.
-
-```meson
-lib = shared_library('somelib', 'internalclass.cc', 'file.cc', ...)
-eo = lib.extract_objects('internalclass.cc')
-executable('classtest', 'classtest.cpp', objects : eo)
-```
-
-Here we take the internal class object and use it directly in the
-test. The source file is only compiled once.
-
-Note that careless use of this feature may cause strange bugs. As an
-example trying to use objects of an executable or static library in a
-shared library will not work because shared library objects require
-special compiler flags. Getting this right is the user's
-responsibility. For this reason it is strongly recommended that you
-only use this feature for generating unit test executables in the
-manner described above.
diff --git a/meson/docs/markdown/Builtin-options.md b/meson/docs/markdown/Builtin-options.md
deleted file mode 100644 (file)
index e7101d5..0000000
+++ /dev/null
@@ -1,217 +0,0 @@
----
-short-description: Built-in options to configure project properties
-...
-
-# Built-in options
-
-Meson provides two kinds of options: [build options provided by the
-build files](Build-options.md) and built-in options that are either
-universal options, base options, compiler options.
-
-## Universal options
-
-A list of these options can be found by running `meson --help`. All
-these can be set by passing to `meson` (aka `meson setup`) in any of
-these ways: `--option=value`, `--option value`, `-Doption=value`, or
-by setting them inside `default_options` of `project()` in your `meson.build`.
-
-For legacy reasons `--warnlevel` is the cli argument for the `warning_level` option.
-
-They can also be edited after setup using `meson configure`.
-
-Installation options are all relative to the prefix, except:
-
-* When the prefix is `/usr`: `sysconfdir` defaults to `/etc`, `localstatedir` defaults to `/var`, and `sharedstatedir` defaults to `/var/lib`
-* When the prefix is `/usr/local`: `localstatedir` defaults to `/var/local`, and `sharedstatedir` defaults to `/var/local/lib`
-
-### Directories
-
-| Option                               | Default value | Description |
-| ------                               | ------------- | ----------- |
-| prefix                               | see below     | Installation prefix |
-| bindir                               | bin           | Executable directory |
-| datadir                              | share         | Data file directory |
-| includedir                           | include       | Header file directory |
-| infodir                              | share/info    | Info page directory |
-| libdir                               | see below     | Library directory |
-| libexecdir                           | libexec       | Library executable directory |
-| localedir                            | share/locale  | Locale data directory |
-| localstatedir                        | var           | Localstate data directory |
-| mandir                               | share/man     | Manual page directory |
-| sbindir                              | sbin          | System executable directory |
-| sharedstatedir                       | com           | Architecture-independent data directory |
-| sysconfdir                           | etc           | Sysconf data directory |
-
-
-`prefix` defaults to `C:/` on Windows, and `/usr/local` otherwise. You should always
-override this value.
-
-`libdir` is automatically detected based on your platform, it should be
-correct when doing "native" (build machine == host machine) compilation. For
-cross compiles meson will try to guess the correct libdir, but it may not be
-accurate, especially on Linux where different distributions have different
-defaults. Using a [cross file](Cross-compilation.md#defining-the-environment),
-particularly the paths section may be necessary.
-
-### Core options
-
-Options that are labeled "per machine" in the table are set per machine. See
-the [specifying options per machine](#Specifying-options-per-machine) section
-for details.
-
-| Option                               | Default value | Description                                                    | Is per machine |
-| ------                               | ------------- | -----------                                                    | -------------- |
-| auto_features {enabled, disabled, auto} | auto       | Override value of all 'auto' features                          | no             |
-| backend {ninja, vs,<br>vs2010, vs2015, vs2017, vs2019, xcode} | ninja | Backend to use                                | no             |
-| buildtype {plain, debug,<br>debugoptimized, release, minsize, custom} | debug |  Build type to use                    | no             |
-| debug                                | true          | Debug                                                          | no             |
-| default_library {shared, static, both} | shared      | Default library type                                           | no             |
-| errorlogs                            | true          | Whether to print the logs from failing tests.                  | no             |
-| install_umask {preserve, 0000-0777}  | 022           | Default umask to apply on permissions of installed files       | no             |
-| layout {mirror,flat}                 | mirror        | Build directory layout                                         | no             |
-| optimization {0, g, 1, 2, 3, s}      | 0             | Optimization level                                             | no             |
-| pkg_config_path {OS separated path}  | ''            | Additional paths for pkg-config to search before builtin paths | yes            |
-| cmake_prefix_path                    | []            | Additional prefixes for cmake to search before builtin paths   | yes            |
-| stdsplit                             | true          | Split stdout and stderr in test logs                           | no             |
-| strip                                | false         | Strip targets on install                                       | no             |
-| unity {on, off, subprojects}         | off           | Unity build                                                    | no             |
-| unity_size {>=2}                     | 4             | Unity file block size                                          | no             |
-| warning_level {0, 1, 2, 3}           | 1             | Set the warning level. From 0 = none to 3 = highest            | no             |
-| werror                               | false         | Treat warnings as errors                                       | no             |
-| wrap_mode {default, nofallback,<br>nodownload, forcefallback} | default | Wrap mode to use                            | no             |
-| force_fallback_for                   | []            | Force fallback for those dependencies                          | no             |
-
-<a name="build-type-options"></a>
-For setting optimization levels and toggling debug, you can either set the
-`buildtype` option, or you can set the `optimization` and `debug` options which
-give finer control over the same. Whichever you decide to use, the other will
-be deduced from it. For example, `-Dbuildtype=debugoptimized` is the same as
-`-Ddebug=true -Doptimization=2` and vice-versa. This table documents the
-two-way mapping:
-
-| buildtype      | debug | optimization |
-| ---------      | ----- | ------------ |
-| plain          | false | 0            |
-| debug          | true  | 0            |
-| debugoptimized | true  | 2            |
-| release        | false | 3            |
-| minsize        | true  | s            |
-
-All other combinations of `debug` and `optimization` set `buildtype` to `'custom'`.
-
-## Base options
-
-These are set in the same way as universal options, but cannot be shown in the
-output of `meson --help` because they depend on both the current platform and
-the compiler that will be selected. The only way to see them is to setup
-a builddir and then run `meson configure` on it with no options.
-
-The following options are available. Note that they may not be available on all
-platforms or with all compilers:
-
-| Option      | Default value | Possible values         | Description |
-| ----------- | ------------- | ---------------         | ----------- |
-| b_asneeded  | true          | true, false             | Use -Wl,--as-needed when linking |
-| b_bitcode   | false         | true, false             | Embed Apple bitcode, see below |
-| b_colorout  | always        | auto, always, never     | Use colored output |
-| b_coverage  | false         | true, false             | Enable coverage tracking |
-| b_lundef    | true          | true, false             | Don't allow undefined symbols when linking |
-| b_lto       | false         | true, false             | Use link time optimization |
-| b_ndebug    | false         | true, false, if-release | Disable asserts |
-| b_pch       | true          | true, false             | Use precompiled headers |
-| b_pgo       | off           | off, generate, use      | Use profile guided optimization |
-| b_sanitize  | none          | see below               | Code sanitizer to use |
-| b_staticpic | true          | true, false             | Build static libraries as position independent |
-| b_pie       | false         | true, false             | Build position-independent executables (since 0.49.0)|
-| b_vscrt     | from_buildtype| none, md, mdd, mt, mtd, from_buildtype | VS runtime library to use (since 0.48.0) |
-
-The value of `b_sanitize` can be one of: `none`, `address`, `thread`,
-`undefined`, `memory`, `address,undefined`.
-
-<a name="b_vscrt-from_buildtype"></a>
-The default value of `b_vscrt` is `from_buildtype`. In that case, the following
-table is used internally to pick the CRT compiler arguments based on the value
-of the `buildtype` option:
-
-| buildtype      | Visual Studio CRT |
-| --------       | ----------------- |
-| debug          | `/MDd`            |
-| debugoptimized | `/MD`             |
-| release        | `/MD`             |
-| minsize        | `/MD`             |
-| custom         | error!            |
-
-### Notes about Apple Bitcode support
-
-`b_bitcode` will pass `-fembed-bitcode` while compiling and will pass
-`-Wl,-bitcode_bundle` while linking. These options are incompatible with
-`b_asneeded`, so that option will be silently disabled.
-
-[Shared modules](Reference-manual.md#shared_module) will not have bitcode
-embedded because `-Wl,-bitcode_bundle` is incompatible with both `-bundle` and
-`-Wl,-undefined,dynamic_lookup` which are necessary for shared modules to work.
-
-## Compiler options
-
-Same caveats as base options above.
-
-The following options are available. Note that both the options themselves and
-the possible values they can take will depend on the target platform or
-compiler being used:
-
-| Option           | Default value | Possible values                          | Description |
-| ------           | ------------- | ---------------                          | ----------- |
-| c_args           |               | free-form comma-separated list           | C compile arguments to use |
-| c_link_args      |               | free-form comma-separated list           | C link arguments to use |
-| c_std            | none          | none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18 | C language standard to use |
-| c_winlibs        | see below     | free-form comma-separated list           | Standard Windows libs to link against |
-| c_thread_count   | 4             | integer value ≥ 0                        | Number of threads to use with emcc when using threads |
-| cpp_args         |               | free-form comma-separated list           | C++ compile arguments to use |
-| cpp_link_args    |               | free-form comma-separated list           | C++ link arguments to use |
-| cpp_std          | none          | none, c++98, c++03, c++11, c++14, c++17, <br/>c++1z, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, <br/> vc++14, vc++17, vc++latest | C++ language standard to use |
-| cpp_debugstl     | false         | true, false                              | C++ STL debug mode |
-| cpp_eh           | default       | none, default, a, s, sc                  | C++ exception handling type |
-| cpp_rtti         | true          | true, false                              | Whether to enable RTTI (runtime type identification) |
-| cpp_thread_count | 4             | integer value ≥ 0                        | Number of threads to use with emcc when using threads |
-| cpp_winlibs      | see below     | free-form comma-separated list           | Standard Windows libs to link against |
-| fortran_std      | none          | [none, legacy, f95, f2003, f2008, f2018] | Fortran language standard to use |
-
-The default values of `c_winlibs` and `cpp_winlibs` are in compiler-specific
-argument forms, but the libraries are: kernel32, user32, gdi32, winspool,
-shell32, ole32, oleaut32, uuid, comdlg32, advapi32.
-
-All these `<lang>_*` options are specified per machine. See below in the
-[specifying options per machine](#Specifying-options-per-machine) section on
-how to do this in cross builds.
-
-When using MSVC, `cpp_eh=none` will result in no exception flags being passed,
-while the `cpp_eh=[value]` will result in `/EH[value]`.
-Since *0.51.0* `cpp_eh=default` will result in `/EHsc` on MSVC. When using
-gcc-style compilers, nothing is passed (allowing exceptions to work), while
-`cpp_eh=none` passes `-fno-exceptions`.
-
-Since *0.54.0* The `<lang>_thread_count` option can be used to control the
-value passed to `-s PTHREAD_POOL_SIZE` when using emcc. No other c/c++
-compiler supports this option.
-
-## Specifying options per machine
-
-Since *0.51.0*, some options are specified per machine rather than globally for
-all machine configurations. Prefixing the option with `build.` just affects the
-build machine configuration, while unprefixed just affects the host machine
-configuration, respectively. For example:
-
- - `build.pkg_config_path` controls the paths pkg-config will search for just
-   `native: true` dependencies (build machine).
-
- - `pkg_config_path` controls the paths pkg-config will search for just
-   `native: false` dependencies (host machine).
-
-This is useful for cross builds. In the native builds, build = host, and the
-unprefixed option alone will suffice.
-
-Prior to *0.51.0*, these options just effected native builds when specified on
-the command line, as there was no `build.` prefix. Similarly named fields in
-the `[properties]` section of the cross file would effect cross compilers, but
-the code paths were fairly different allowing differences in behavior to crop
-out.
diff --git a/meson/docs/markdown/CMake-module.md b/meson/docs/markdown/CMake-module.md
deleted file mode 100644 (file)
index fc6157e..0000000
+++ /dev/null
@@ -1,239 +0,0 @@
-# CMake module
-
-**Note**: the functionality of this module is governed by [Meson's
-  rules on mixing build systems](Mixing-build-systems.md).
-
-This module provides helper tools for generating cmake package files.
-It also supports the usage of CMake based subprojects, similar to
-the normal [meson subprojects](Subprojects.md).
-
-
-## Usage
-
-To use this module, just do: **`cmake = import('cmake')`**. The
-following functions will then be available as methods on the object
-with the name `cmake`. You can, of course, replace the name `cmake`
-with anything else.
-
-It is generally recommended to use the latest Meson version and
-CMake >=3.17 for best compatibility. CMake subprojects will
-usually also work with older CMake versions. However, this can
-lead to unexpected issues in rare cases.
-
-## CMake subprojects
-
-Using CMake subprojects is similar to using the "normal" meson
-subprojects. They also have to be located in the `subprojects`
-directory.
-
-Example:
-
-```cmake
-add_library(cm_lib SHARED ${SOURCES})
-```
-
-```meson
-cmake = import('cmake')
-
-# Configure the CMake project
-sub_proj = cmake.subproject('libsimple_cmake')
-
-# Fetch the dependency object
-cm_lib = sub_proj.dependency('cm_lib')
-
-executable(exe1, ['sources'], dependencies: [cm_lib])
-```
-
-The `subproject` method is almost identical to the normal meson
-`subproject` function. The only difference is that a CMake project
-instead of a meson project is configured.
-
-The returned `sub_proj` supports the same options as a "normal" subproject.
-Meson automatically detects CMake build targets, which can be accessed with
-the methods listed [below](#subproject-object).
-
-It is usually enough to just use the dependency object returned by the
-`dependency()` method in the build targets. This is almost identical to
-using `declare_dependency()` object from a normal meson subproject.
-
-It is also possible to use executables defined in the CMake project as code
-generators with the `target()` method:
-
-```cmake
-add_executable(cm_exe ${EXE_SRC})
-```
-
-```meson
-cmake = import('cmake')
-
-# Subproject with the "code generator"
-sub_pro = cmake.subproject('cmCodeGen')
-
-# Fetch the code generator exe
-sub_exe = sub_pro.target('cm_exe')
-
-# Use the code generator
-generated = custom_target(
-  'cmake-generated',
-  input: [],
-  output: ['test.cpp'],
-  command: [sub_exe, '@OUTPUT@']
-)
-```
-
-It should be noted that not all projects are guaranteed to work. The
-safest approach would still be to create a `meson.build` for the
-subprojects in question.
-
-### Configuration options
-
-*New in meson 0.55.0*
-
-Meson also supports passing configuration options to CMake and overriding
-certain build details extracted from the CMake subproject.
-
-```meson
-cmake   = import('cmake')
-opt_var = cmake.subproject_options()
-
-# Call CMake with `-DSOME_OTHER_VAR=ON`
-opt_var.add_cmake_defines({'SOME_OTHER_VAR': true})
-
-# Globally override the C++ standard to c++11
-opt_var.set_override_option('cpp_std', 'c++11')
-
-# Override the previous global C++ standard
-# with c++14 only for the CMake target someLib
-opt_var.set_override_option('cpp_std', 'c++14', target: 'someLib')
-
-sub_pro = cmake.subproject('someLibProject', options: opt_var)
-
-# Further changes to opt_var have no effect
-```
-
-See [the CMake options object](#cmake-options-object) for a complete reference
-of all supported functions.
-
-The CMake configuration options object is very similar to the
-[configuration data object](Reference-manual.md#configuration-data-object) object
-returned by [`configuration_data`](Reference-manual.md#configuration_data). It
-is generated by the `subproject_options` function
-
-All configuration options have to be set *before* the subproject is configured
-and must be passed to the `subproject` method via the `options` key. Altering
-the configuration object won't have any effect on previous `cmake.subproject`
-calls.
-
-In earlier meson versions CMake command-line parameters could be set with the
-`cmake_options` kwarg. However, this feature is deprecated since 0.55.0 and only
-kept for compatibility. It will not work together with the `options` kwarg.
-
-### `subproject` object
-
-This object is returned by the `subproject` function described above
-and supports the following methods:
-
- - `dependency(target)` returns a dependency object for any CMake target.
- - `include_directories(target)` returns a meson `include_directories()`
-   object for the specified target. Using this function is not necessary
-   if the dependency object is used.
- - `target(target)` returns the raw build target.
- - `target_type(target)` returns the type of the target as a string
- - `target_list()` returns a list of all target *names*.
- - `get_variable(name)` fetches the specified variable from inside
-   the subproject. Usually `dependency()` or `target()` should be
-   preferred to extract build targets.
- - `found` returns true if the subproject is available, otherwise false
-   *new in meson 0.53.2*
-
-### `cmake options` object
-
-This object is returned by the `subproject_options()` function and consumed by
-the `options` kwarg of the `subproject` function. The following methods are
-supported:
-
- - `add_cmake_defines({'opt1': val1, ...})` add additional CMake commandline defines
- - `set_override_option(opt, val)` set specific [build options](Build-options.md)
-   for targets. This will effectively add `opt=val` to the `override_options`
-   array of the [build target](Reference-manual.md#executable)
- - `set_install(bool)` override wether targets should be installed or not
- - `append_compile_args(lang, arg1, ...)` append compile flags for a specific
-   language to the targets
- - `append_link_args(arg1, ...)` append linger args to the targets
- - `clear()` reset all data in the `cmake options` object
-
-The methods `set_override_option`, `set_install`, `append_compile_args` and
-`append_link_args` support the optional `target` kwarg. If specified, the set
-options affect the specific target. The effect of the option is global for the
-subproject otherwise.
-
-If, for instance, `opt_var.set_install(false)` is called, no target will be
-installed regardless of what is set by CMake. However, it is still possible to
-install specific targets (here `foo`) by setting the `target` kwarg:
-`opt_var.set_install(true, target: 'foo')`
-
-Options that are not set won't affect the generated subproject. So, if for
-instance, `set_install` was not called then the values extracted from CMake will
-be used.
-
-## CMake configuration files
-
-### cmake.write_basic_package_version_file()
-
-This function is the equivalent of the corresponding [CMake function](https://cmake.org/cmake/help/v3.11/module/CMakePackageConfigHelpers.html#generating-a-package-version-file),
-it generates a `name` package version file.
-
-* `name`: the name of the package.
-* `version`: the version of the generated package file.
-* `compatibility`: a string indicating the kind of compatibility, the accepted values are
-`AnyNewerVersion`, `SameMajorVersion`, `SameMinorVersion` or `ExactVersion`.
-It defaults to `AnyNewerVersion`. Depending on your cmake installation some kind of
-compatibility may not be available.
-* `install_dir`: optional installation directory, it defaults to `$(libdir)/cmake/$(name)`
-
-
-Example:
-
-```meson
-cmake = import('cmake')
-
-cmake.write_basic_package_version_file(name: 'myProject', version: '1.0.0')
-```
-
-### cmake.configure_package_config_file()
-
-This function is the equivalent of the corresponding [CMake function](https://cmake.org/cmake/help/v3.11/module/CMakePackageConfigHelpers.html#generating-a-package-configuration-file),
-it generates a `name` package configuration file from the `input` template file. Just like the cmake function
-in this file the `@PACKAGE_INIT@` statement will be replaced by the appropriate piece of cmake code.
-The equivalent `PATH_VARS` argument is given through the `configuration` parameter.
-
-* `name`: the name of the package.
-* `input`: the template file where that will be treated for variable substitutions contained in `configuration`.
-* `install_dir`: optional installation directory, it defaults to `$(libdir)/cmake/$(name)`.
-* `configuration`: a `configuration_data` object that will be used for variable substitution in the template file.
-
-
-Example:
-
-meson.build:
-
-```meson
-cmake = import('cmake')
-
-conf = configuration_data()
-conf.set_quoted('VAR', 'variable value')
-
-cmake.configure_package_config_file(
-    name: 'myProject',
-    input: 'myProject.cmake.in',
-    configuration: conf
-)
-```
-
-myProject.cmake.in:
-
-```text
-@PACKAGE_INIT@
-
-set(MYVAR VAR)
-```
diff --git a/meson/docs/markdown/Comparisons.md b/meson/docs/markdown/Comparisons.md
deleted file mode 100644 (file)
index 1deef69..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
----
-title: Comparisons
-...
-
-# Comparing Meson with other build systems
-
-A common question is *Why should I choose Meson over a different build
-system X?* There is no one true answer to this as it depends on the
-use case. Almost all build systems have all the functionality needed
-to build medium-to-large projects so the decision is usually made on
-other points. Here we list some pros and cons of various build systems
-to help you do the decision yourself.
-
-## GNU Autotools
-
-### Pros
-
-Excellent support for legacy Unix platforms, large selection of
-existing modules.
-
-### Cons
-
-Needlessly slow, complicated, hard to use correctly, unreliable,
-painful to debug, incomprehensible for most people, poor support for
-non-Unix platforms (especially Windows).
-
-## CMake
-
-### Pros
-
-Great support for multiple backends (Visual Studio, XCode, etc).
-
-### Cons
-
-The scripting language is cumbersome to work with. Some simple things
-are more complicated than necessary.
-
-## SCons
-
-### Pros
-
-Full power of Python available for defining your build.
-
-### Cons
-
-Slow. Requires you to pass your configuration settings on every
-invocation. That is, if you do `scons OPT1 OPT2` and then just
-`scons`, it will reconfigure everything without settings `OPT1` and
-`OPT2`. Every other build system remembers build options from the
-previous invocation.
-
-## Bazel
-
-### Pros
-
-Proven to scale to very large projects.
-
-### Cons
-
-Implemented in Java. Poor Windows support. Heavily focused on Google's
-way of doing things (which may be a good or a bad thing). Contributing
-code requires [signing a CLA](https://bazel.build/contributing.html).
-
-## Meson
-
-### Pros
-
-The fastest build system [see
-measurements](Performance-comparison.md), user friendly, designed to
-be as invisible to the developer as possible, native support for
-modern tools (precompiled headers, coverage, Valgrind etc). Not Turing
-complete so build definition files are easy to read and understand.
-
-### Cons
-
-Relatively new so it does not have a large user base yet, and may thus
-contain some unknown bugs. Visual Studio and XCode backends not as
-high quality as Ninja one.
diff --git a/meson/docs/markdown/Compiler-properties.md b/meson/docs/markdown/Compiler-properties.md
deleted file mode 100644 (file)
index 5d29dd1..0000000
+++ /dev/null
@@ -1,230 +0,0 @@
-# Compiler properties
-
-Not all compilers and platforms are alike. Therefore Meson provides
-the tools to detect properties of the system during configure time. To
-get most of this information, you first need to extract the *compiler
-object* from the main *meson* variable.
-
-```meson
-compiler = meson.get_compiler('c')
-```
-
-Here we extract the C compiler. We could also have given the argument
-`cpp` to get the C++ compiler, `objc` to get the objective C compiler
-and so on. The call is valid for all languages specified in the
-*project* declaration. Trying to obtain some other compiler will lead
-to an unrecoverable error.
-
-## System information
-
-This is a bit complex and more thoroughly explained on the page on
-[cross compilation](Cross-compilation.md). But if you just want to
-know the operating system your code will run on, issue this command:
-
-```meson
-host_machine.system()
-```
-
-## Compiler id
-
-The compiler object method `get_id` returns a
-lower case string describing the "family" of the compiler. Since 0.53.0
-`get_linker_id` returns a lower case string with the linker name. Since
-compilers can often choose from multiple linkers depending on operating
-system, `get_linker_id` can be useful for handling or mitigating effects
-of particular linkers.
-
-The compiler object also has a method `get_argument_syntax` which
-returns a lower case string of `gcc`, `msvc`, or another undefined string
-value; identifying whether the compiler arguments use the same syntax as
-either `gcc` or `msvc`, or that its arguments are not like either. This should
-only be used to select the syntax of the arguments, such as those to test
-with `has_argument`.
-
-See [reference tables](Reference-tables.md#compiler-ids) for a list of supported compiler
-ids and their argument type.
-
-## Does code compile?
-
-Sometimes the only way to test the system is to try to compile some
-sample code and see if it works. For example, this can test that a
-"C++17" compiler actually supports a particular C++17 feature,
-without resorting to maintaining a feature list vs. compiler vendor,
-compiler version and operating system.
-Testing that a code snippet runs is a two-phase operation. First
-we define some code using the multiline string operator:
-
-```meson
-code = '''#include<stdio.h>
-void func() { printf("Compile me.\n"); }
-'''
-```
-
-Then we can run the test.
-
-```meson
-result = compiler.compiles(code, name : 'basic check')
-```
-
-The variable *result* will now contain either `true` or `false`
-depending on whether the compilation succeeded or not. The keyword
-argument `name` is optional. If it is specified, Meson will write the
-result of the check to its log.
-
-## Does code compile and link?
-
-Sometimes it is necessary to check whether a certain code fragment not
-only compiles, but also links successfully, e.g. to check if a symbol
-is actually present in a library. This can be done using the
-'''.links()''' method on a compiler object like this:
-
-```meson
-code = '''#include<stdio.h>
-void func() { printf("Compile me.\n"); }
-'''
-```
-
-Then we can run the test.
-
-```meson
-result = compiler.links(code, args : '-lfoo', name : 'link check')
-```
-
-The variable *result* will now contain either `true` or `false`
-depending on whether the compilation and linking succeeded or not. The
-keyword argument `name` is optional. If it is specified, Meson will
-write the result of the check to its log.
-
-## Compile and run test application
-
-Here is how you would compile and run a small test application.
-Testing if a code snippets **runs** versus merely that it links
-is particularly important for some dependencies such as MPI.
-
-```meson
-code = '''#include<stdio.h>
-int main(int argc, char **argv) {
-  printf("%s\n", "stdout");
-  fprintf(stderr, "%s\n", "stderr");
-  return 0;
-}
-'''
-result = compiler.run(code, name : 'basic check')
-```
-
-The `result` variable encapsulates the state of the test, which can be
-extracted with the following methods. The `name` keyword argument
-works the same as with `compiles`.
-
-| Method     | Return value                                                                                |
-| ------     | ------------                                                                                |
-| compiled   | `True` if compilation succeeded. If `false` then all other methods return undefined values. |
-| returncode | The return code of the application as an integer                                            |
-| stdout     | Program's standard out as text.                                                             |
-| stderr     | Program's standard error as text.                                                           |
-
-Here is an example usage:
-
-```meson
-if result.stdout().strip() == 'some_value'
-  # do something
-endif
-```
-
-## Does a header exist?
-
-Header files provided by different platforms vary quite a lot. Meson
-has functionality to detect whether a given header file is available
-on the system. The test is done by trying to compile a simple test
-program that includes the specified header. The following snippet
-describes how this feature can be used.
-
-```meson
-if compiler.has_header('sys/fstat.h')
-  # header exists, do something
-endif
-```
-
-## Expression size
-
-Often you need to determine the size of a particular element (such as
-`int`, `wchar_t` or `char*`). Using the `compiler` variable mentioned
-above, the check can be done like this.
-
-```meson
-wcharsize = compiler.sizeof('wchar_t', prefix : '#include<wchar.h>')
-```
-
-This will put the size of `wchar_t` as reported by sizeof into
-variable `wcharsize`. The keyword argument `prefix` is optional. If
-specified its contents is put at the top of the source file. This
-argument is typically used for setting `#include` directives in
-configuration files.
-
-In older versions (<= 0.30) meson would error out if the size could
-not be determined. Since version 0.31 it returns -1 if the size could
-not be determined.
-
-## Does a function exist?
-
-Just having a header doesn't say anything about its
-contents. Sometimes you need to explicitly check if some function
-exists. This is how we would check whether the function `open_memstream`
-exists in header `stdio.h`
-
-```meson
-if compiler.has_function('open_memstream', prefix : '#include <stdio.h>')
-  # function exists, do whatever is required.
-endif
-```
-
-Note that, on macOS programs can be compiled targeting older macOS
-versions than the one that the program is compiled on. It can't be
-assumed that the OS version that is compiled on matches the OS
-version that the binary will run on.
-
-Therefore when detecting function availability with `has_function`, it
-is important to specify the correct header in the prefix argument.
-
-In the example above, the function `open_memstream` is detected, which
-was introduced in macOS 10.13. When the user builds on macOS 10.13, but
-targeting macOS 10.11 (`-mmacosx-version-min=10.11`), this will correctly
-report the function as missing. Without the header however, it would lack
-the necessary availability information and incorrectly report the function
-as available.
-
-## Does a structure contain a member?
-
-Some platforms have different standard structures. Here's how one
-would check if a struct called `mystruct` from header `myheader.h`
-contains a member called `some_member`.
-
-```meson
-if compiler.has_member('struct mystruct', 'some_member', prefix : '#include<myheader.h>')
-  # member exists, do whatever is required
-endif
-```
-
-## Type alignment
-
-Most platforms can't access some data types at any address. For
-example it is common that a `char` can be at any address but a 32 bit
-integer only at locations which are divisible by four. Determining the
-alignment of data types is simple.
-
-```meson
-int_alignment = compiler.alignment('int') # Will most likely contain the value 4.
-```
-
-## Has argument
-
-This method tests if the compiler supports a given command line
-argument. This is implemented by compiling a small file with the given
-argument.
-
-```meson
-has_special_flags = compiler.has_argument('-Wspecialthing')
-```
-
-*Note*: some compilers silently swallow command line arguments they do
-not understand. Thus this test can not be made 100% reliable.
diff --git a/meson/docs/markdown/Conference-presentations.md b/meson/docs/markdown/Conference-presentations.md
deleted file mode 100644 (file)
index abfc52f..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Conference presentations on Meson
-
-- FOSDEM 2014, [Introducing the Meson build system](https://video.fosdem.org/2014/H2215_Ferrer/Sunday/Introducing_the_Meson_build_system.webm) (jpakkane)
-
-- LCA 2015, [Making build systems not suck](https://www.youtube.com/watch?v=KPi0AuVpxLI) (jpakkane)
-
-- GUADEC 2015, [Improving the way Gnome apps are built](https://www.youtube.com/watch?v=wTf0NjjNwTU) (jpakkane)
-
-- GStreamer conference 2015, [Done in 6.0 seconds](https://gstconf.ubicast.tv/videos/done-in-60-seconds-a-new-build-system-for-gstreamer) (jpakkane)
-
-- LCA 2016, [Builds, dependencies and deployment in the modern multiplatform world](https://www.youtube.com/watch?v=CTJtKtQ8R5k) (jpakkane)
-
-- GUADEC 2016, [Making your GNOME app compile 2.4x faster](https://media.ccc.de/v/44-making_your_gnome_app_compile_24x_faster) (nirbheek)
-
-- Libre Application Summit 2016, [New world, new tools](https://youtu.be/0-gx1qU2pPo) (jpakkane)
-
-- GStreamer conference 2016, [GStreamer Development on Windows and faster builds everywhere with Meson](https://gstconf.ubicast.tv/videos/gstreamer-development-on-windows-ans-faster-builds-everywhere-with-meson/) (tpm)
diff --git a/meson/docs/markdown/Configuration.md b/meson/docs/markdown/Configuration.md
deleted file mode 100644 (file)
index cd1af14..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
----
-short-description: Build-time configuration options
-...
-
-# Configuration
-
-If there are multiple configuration options, passing them through
-compiler flags becomes very burdensome. It also makes the
-configuration settings hard to inspect. To make things easier, Meson
-supports the generation of configure files. This feature is similar to
-one found in other build systems such as CMake.
-
-Suppose we have the following Meson snippet:
-
-```meson
-conf_data = configuration_data()
-conf_data.set('version', '1.2.3')
-configure_file(input : 'config.h.in',
-               output : 'config.h',
-               configuration : conf_data)
-```
-
-and that the contents of `config.h.in` are
-
-```c
-#define VERSION_STR "@version@"
-```
-
-Meson will then create a file called `config.h` in the corresponding
-build directory whose contents are the following.
-
-```c
-#define VERSION_STR "1.2.3"
-```
-
-More specifically, Meson will find all strings of the type `@varname@`
-and replace them with respective values set in `conf_data`. You can
-use a single `configuration_data` object as many times as you like,
-but it becomes immutable after being passed to the `configure_file`
-function. That is, after it has been used once to generate output the
-`set` function becomes unusable and trying to call it causes an error.
-Copy of immutable `configuration_data` is still immutable.
-
-For more complex configuration file generation Meson provides a second
-form. To use it, put a line like this in your configuration file.
-
-    #mesondefine TOKEN
-
-The replacement that happens depends on what the value and type of TOKEN is:
-
-```c
-#define TOKEN     // If TOKEN is set to boolean true.
-#undef TOKEN      // If TOKEN is set to boolean false.
-#define TOKEN 4   // If TOKEN is set to an integer or string value.
-/* undef TOKEN */ // If TOKEN has not been set to any value.
-```
-
-Note that if you want to define a C string, you need to do the quoting
-yourself like this:
-
-```meson
-conf_data.set('TOKEN', '"value"')
-```
-
-Since this is such a common operation, Meson provides a convenience
-method:
-
-```meson
-plain_var = 'value'
-conf_data.set_quoted('TOKEN', plain_var) # becomes #define TOKEN "value"
-```
-
-Often you have a boolean value in Meson but need to define the C/C++
-token as 0 or 1. Meson provides a convenience function for this use
-case.
-
-```meson
-conf_data.set10(token, boolean_value)
-# The line above is equivalent to this:
-if boolean_value
-  conf_data.set(token, 1)
-else
-  conf_data.set(token, 0)
-endif
-```
-
-## Configuring without an input file
-
-If the input file is not defined then Meson will generate a header
-file all the entries in the configuration data object. The
-replacements are the same as when generating `#mesondefine` entries:
-
-```meson
-conf_data.set('FOO', '"string"') => #define FOO "string"
-conf_data.set('FOO', 'a_token')  => #define FOO a_token
-conf_data.set('FOO', true)       => #define FOO
-conf_data.set('FOO', false)      => #undef FOO
-conf_data.set('FOO', 1)          => #define FOO 1
-conf_data.set('FOO', 0)          => #define FOO 0
-```
-
-In this mode, you can also specify a comment which will be placed
-before the value so that your generated files are self-documenting.
-
-```meson
-conf_data.set('BAR', true, description : 'Set BAR if it is available')
-```
-
-Will produce:
-
-```c
-/* Set BAR if it is available */
-#define BAR
-```
-
-## Dealing with file encodings
-
-The default meson file encoding to configure files is utf-8. If you need to
-configure a file that is not utf-8 encoded the encoding keyword will allow
-you to specify which file encoding to use. It is however strongly advised to
-convert your non utf-8 file to utf-8 whenever possible. Supported file
-encodings are those of python3, see [standard-encodings](https://docs.python.org/3/library/codecs.html#standard-encodings).
-
-## Using dictionaries
-
-Since *0.49.0* `configuration_data()` takes an optional dictionary as first
-argument. If provided, each key/value pair is added into the
-`configuration_data` as if `set()` method was called for each of them.
-`configure_file()`'s `configuration` kwarg also accepts a dictionary instead of
-a configuration_data object.
-
-Example:
-```meson
-cdata = configuration_data({
-  'STRING' : '"foo"',
-  'INT' : 42,
-  'DEFINED' : true,
-  'UNDEFINED' : false,
-})
-
-configure_file(output : 'config1.h',
-  configuration : cdata,
-)
-
-configure_file(output : 'config2.h',
-  configuration : {
-    'STRING' : '"foo"',
-    'INT' : 42,
-    'DEFINED' : true,
-    'UNDEFINED' : false,
-  }
-)
-
-```
-
-# A full example
-
-Generating and using a configuration file requires the following steps:
-
- - generate the file
- - create an include directory object for the directory that holds the file
- - use it in a target
-
-We are going to use the traditional approach of generating a header
-file in the top directory. The common name is `config.h` but we're
-going to use an unique name. This avoids the problem of accidentally
-including the wrong header file when building a project with many
-subprojects.
-
-At the top level we generate the file:
-
-```meson
-conf_data = configuration_data()
-# Set data
-configure_file(input : 'projconfig.h.in',
-  output : 'projconfig.h',
-  configuration : conf_data)
-```
-
-Immediately afterwards we generate the include object.
-
-```meson
-configuration_inc = include_directories('.')
-```
-
-Finally we specify this in a target that can be in any subdirectory.
-
-```meson
-executable(..., include_directories : configuration_inc)
-```
-
-Now any source file in this target can include the configuration
-header like this:
-
-```c
-#include<projconfig.h>
-```
diff --git a/meson/docs/markdown/Configuring-a-build-directory.md b/meson/docs/markdown/Configuring-a-build-directory.md
deleted file mode 100644 (file)
index 330899f..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
----
-short-description: Configuring a pre-generated build directory
-...
-
-# Configuring a build directory
-
-Often you want to change the settings of your build after it has been
-generated. For example you might want to change from a debug build
-into a release build, set custom compiler flags, change the build
-options provided in your `meson_options.txt` file and so on.
-
-The main tool for this is the `meson configure` command.
-
-You invoke `meson configure` by giving it the location of your build dir. If
-omitted, the current working directory is used instead. Here's a
-sample output for a simple project.
-
-    Core properties
-
-    Source dir /home/jpakkane/clangdemo/2_address
-    Build dir  /home/jpakkane/clangdemo/2_address/buildmeson
-
-    Core options:
-      Option          Current Value Possible Values                                          Description
-      ------          ------------- ---------------                                          -----------
-      auto_features   auto          [enabled, disabled, auto]                                Override value of all 'auto' features
-      backend         ninja         [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode]       Backend to use
-      buildtype       release       [plain, debug, debugoptimized, release, minsize, custom] Build type to use
-      debug           false         [true, false]                                            Debug
-      default_library shared        [shared, static, both]                                   Default library type
-      install_umask   0022          [preserve, 0000-0777]                                    Default umask to apply on permissions of installed files
-      layout          mirror        [mirror, flat]                                           Build directory layout
-      optimization    3             [0, g, 1, 2, 3, s]                                       Optimization level
-      strip           false         [true, false]                                            Strip targets on install
-      unity           off           [on, off, subprojects]                                   Unity build
-      warning_level   1             [0, 1, 2, 3]                                             Compiler warning level to use
-      werror          false         [true, false]                                            Treat warnings as errors
-
-    Backend options:
-      Option            Current Value Possible Values Description
-      ------            ------------- --------------- -----------
-      backend_max_links 0             >=0             Maximum number of linker processes to run or 0 for no limit
-
-    Base options:
-      Option      Current Value Possible Values                                               Description
-      ------      ------------- ---------------                                               -----------
-      b_asneeded  true          [true, false]                                                 Use -Wl,--as-needed when linking
-      b_colorout  always        [auto, always, never]                                         Use colored output
-      b_coverage  false         [true, false]                                                 Enable coverage tracking.
-      b_lto       false         [true, false]                                                 Use link time optimization
-      b_lundef    true          [true, false]                                                 Use -Wl,--no-undefined when linking
-      b_ndebug    false         [true, false, if-release]                                     Disable asserts
-      b_pch       true          [true, false]                                                 Use precompiled headers
-      b_pgo       off           [off, generate, use]                                          Use profile guided optimization
-      b_sanitize  none          [none, address, thread, undefined, memory, address,undefined] Code sanitizer to use
-      b_staticpic true          [true, false]                                                 Build static libraries as position independent
-
-    Compiler options:
-      Option        Current Value Possible Values                                                                                               Description
-      ------        ------------- ---------------                                                                                               -----------
-      c_args        []                                                                                                                          Extra arguments passed to the C compiler
-      c_link_args   []                                                                                                                          Extra arguments passed to the C linker
-      c_std         c99           [none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, gnu18]                                                                    C language standard to use
-      cpp_args      []                                                                                                                          Extra arguments passed to the C++ compiler
-      cpp_debugstl  false         [true, false]                                                                                                 STL debug mode
-      cpp_link_args []                                                                                                                          Extra arguments passed to the C++ linker
-      cpp_std       c++11         [none, c++98, c++03, c++11, c++14, c++17, c++1z, c++2a, gnu++03, gnu++11, gnu++14, gnu++17, gnu++1z, gnu++2a] C++ language standard to use
-      fortran_std   []            [none, legacy, f95, f2003, f2008, f2018]                                                                      language standard to use
-
-    Directories:
-      Option         Current Value        Description
-      ------         -------------        -----------
-      bindir         bin                  Executable directory
-      datadir        share                Data file directory
-      includedir     include              Header file directory
-      infodir        share/info           Info page directory
-      libdir         lib/x86_64-linux-gnu Library directory
-      libexecdir     libexec              Library executable directory
-      localedir      share/locale         Locale data directory
-      localstatedir  /var/local           Localstate data directory
-      mandir         share/man            Manual page directory
-      prefix         /usr/local           Installation prefix
-      sbindir        sbin                 System executable directory
-      sharedstatedir /var/local/lib       Architecture-independent data directory
-      sysconfdir     etc                  Sysconf data directory
-
-    Project options:
-      Option         Current Value Possible Values           Description
-      ------         ------------- ---------------           -----------
-      array_opt      [one, two]    [one, two, three]         array_opt
-      combo_opt      three         [one, two, three]         combo_opt
-      free_array_opt [one, two]                              free_array_opt
-      integer_opt    3             >=0, <=5                  integer_opt
-      other_one      false         [true, false]             other_one
-      some_feature   enabled       [enabled, disabled, auto] some_feature
-      someoption     optval                                  An option
-
-    Testing options:
-      Option    Current Value Possible Values Description
-      ------    ------------- --------------- -----------
-      errorlogs true          [true, false]   Whether to print the logs from failing tests
-      stdsplit  true          [true, false]   Split stdout and stderr in test logs
-
-These are all the options available for the current project arranged
-into related groups. The first column in every field is the name of
-the option. To set an option you use the `-D` option. For example,
-changing the installation prefix from `/usr/local` to `/tmp/testroot`
-you would issue the following command.
-
-    meson configure -Dprefix=/tmp/testroot
-
-Then you would run your build command (usually `meson compile`), which would
-cause Meson to detect that the build setup has changed and do all the
-work required to bring your build tree up to date.
-
-Since 0.50.0, it is also possible to get a list of all build options
-by invoking [`meson configure`](Commands.md#configure) with the project source directory or
-the path to the root `meson.build`. In this case, meson will print the
-default values of all options similar to the example output from above.
diff --git a/meson/docs/markdown/Contact-information.md b/meson/docs/markdown/Contact-information.md
deleted file mode 100644 (file)
index 87a76a5..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-# Contact information
-
-For general discussion and questions, it is strongly recommended that
-you use the [mailing
-list](https://groups.google.com/forum/#!forum/mesonbuild).
-
-If you find bugs, please file them in the [issue
-tracker](https://github.com/jpakkane/meson/issues).
-
-The maintainer of Meson is Jussi Pakkanen. You should usually not
-contact him privately but rather use the channels listed
-above. However if such a need arises, he can be reached at gmail where
-his username is `jpakkane` (that is not a typo, the last letter is
-indeed *e*).
diff --git a/meson/docs/markdown/Continuous-Integration.md b/meson/docs/markdown/Continuous-Integration.md
deleted file mode 100644 (file)
index 76a05a3..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-# Continuous Integration
-
-Here you will find snippets to use Meson with various CI such as
-Travis and AppVeyor.
-
-Please [file an issue](https://github.com/mesonbuild/meson/issues/new)
-if these instructions don't work for you.
-
-## Travis-CI with Docker
-
-Travis with Docker gives access to newer non-LTS Ubuntu versions with
-pre-installed libraries of your choice.
-
-This `yml` file is derived from the
-[configuration used by Meson](https://github.com/mesonbuild/meson/blob/master/.travis.yml)
-for running its own tests.
-
-```yaml
-os:
-  - linux
-  - osx
-
-language:
-  - cpp
-
-services:
-  - docker
-
-before_install:
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew update; fi
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew install python3 ninja; fi
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then pip3 install meson; fi
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker pull YOUR/REPO:eoan; fi
-
-script:
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo FROM YOUR/REPO:eoan > Dockerfile; fi
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then echo ADD . /root >> Dockerfile; fi
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker build -t withgit .; fi
-  - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then docker run withgit /bin/sh -c "cd /root && TRAVIS=true CC=$CC CXX=$CXX meson builddir && meson test -C builddir"; fi
-  - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then SDKROOT=$(xcodebuild -version -sdk macosx Path) meson builddir && meson test -C builddir; fi
-```
-
-## CircleCi for Linux (with Docker)
-
-[CircleCi](https://circleci.com/) can work for spinning all of the Linux images you wish.
-Here's a sample `yml` file for use with that.
-
-```yaml
-version: 2.1
-
-executors:
-  # Your dependencies would go in the docker images that represent
-  # the Linux distributions you are supporting
-  meson_ubuntu_builder:
-    docker:
-      - image: your_dockerhub_username/ubuntu-sys
-
-  meson_debian_builder:
-    docker:
-      - image: your_dockerhub_username/debian-sys
-
-  meson_fedora_builder:
-    docker:
-      - image: your_dockerhub_username/fedora-sys
-
-jobs:
-  meson_ubuntu_build:
-    executor: meson_ubuntu_builder
-    steps:
-      - checkout
-      - run: meson setup builddir --backend ninja
-      - run: meson compile -C builddir
-      - run: meson test -C builddir
-
-  meson_debian_build:
-    executor: meson_debian_builder
-    steps:
-      - checkout
-      - run: meson setup builddir --backend ninja
-      - run: meson compile -C builddir
-      - run: meson test -C builddir
-
-  meson_fedora_build:
-    executor: meson_fedora_builder
-    steps:
-      - checkout
-      - run: meson setup builddir --backend ninja
-      - run: meson compile -C builddir
-      - run: meson test -C builddir
-
-workflows:
-  version: 2
-  linux_workflow:
-    jobs:
-      - meson_ubuntu_build
-      - meson_debian_build
-      - meson_fedora_build
-```
-
-## AppVeyor for Windows
-
-For CI on Windows, [AppVeyor](https://www.appveyor.com/) has a wide selection of
-[default configurations](https://www.appveyor.com/docs/windows-images-software/).
-AppVeyor also has [MacOS](https://www.appveyor.com/docs/macos-images-software/) and
-[Linux](https://www.appveyor.com/docs/linux-images-software/) CI images.
-This is a sample `appveyor.yml` file for Windows with Visual Studio 2015 and 2017.
-
-```yaml
-image: Visual Studio 2017
-
-environment:
-  matrix:
-    - arch: x86
-      compiler: msvc2015
-    - arch: x64
-      compiler: msvc2015
-    - arch: x86
-      compiler: msvc2017
-    - arch: x64
-      compiler: msvc2017
-
-platform:
-  - x64
-
-install:
-  # Set paths to dependencies (based on architecture)
-  - cmd: if %arch%==x86 (set PYTHON_ROOT=C:\python37) else (set PYTHON_ROOT=C:\python37-x64)
-  # Print out dependency paths
-  - cmd: echo Using Python at %PYTHON_ROOT%
-  # Add necessary paths to PATH variable
-  - cmd: set PATH=%cd%;%PYTHON_ROOT%;%PYTHON_ROOT%\Scripts;%PATH%
-  # Install meson and ninja
-  - cmd: pip install ninja meson
-  # Set up the build environment
-  - cmd: if %compiler%==msvc2015 ( call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" %arch% )
-  - cmd: if %compiler%==msvc2017 ( call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" %arch% )
-
-build_script:
-  - cmd: echo Building on %arch% with %compiler%
-  - cmd: meson --backend=ninja builddir
-  - cmd: meson compile -C builddir
-
-test_script:
-  - cmd: meson test -C builddir
-```
-
-### Qt
-
-For Qt 5, add the following line near the `PYTHON_ROOT` assignment:
-
-```yaml
- - cmd: if %arch%==x86 (set QT_ROOT=C:\Qt\5.11\%compiler%) else (set QT_ROOT=C:\Qt\5.11\%compiler%_64)
-```
-
-And afterwards add `%QT_ROOT%\bin` to the `PATH` variable.
-
-You might have to adjust your build matrix as there are, for example, no msvc2017 32-bit builds. Visit the [Build Environment](https://www.appveyor.com/docs/build-environment/) page in the AppVeyor docs for more details.
-
-### Boost
-
-The following statement is sufficient for meson to find Boost:
-
-```yaml
- - cmd: set BOOST_ROOT=C:\Libraries\boost_1_67_0
-```
-
-## Travis without Docker
-
-Non-Docker Travis-CI builds can use Linux, MacOS or Windows.
-Set the desired compiler(s) in the build **matrix**.
-This example is for **Linux** (Ubuntu 18.04) and **C**.
-
-```yaml
-dist: bionic
-group: travis_latest
-
-os: linux
-language: python
-
-matrix:
-  include:
-    - env: CC=gcc
-    - env: CC=clang
-
-install:
-  - pip install meson ninja
-
-script:
-  - meson builddir
-  - meson compile -C builddir
-  - meson test -C builddir
-```
-
-## GitHub Actions
-
-GitHub Actions are distinct from Azure Pipelines in their workflow syntax.
-It can be easier to setup specific CI tasks in Actions than Pipelines, depending on the particular task.
-This is an example file: .github/workflows/ci_meson.yml  supposing the project is C-based, using GCC on Linux, Mac and Windows.
-The optional `on:` parameters only run this CI when the C code is changed--corresponding ci_python.yml might run only on "**.py" file changes.
-
-```yml
-name: ci_meson
-
-on:
-  push:
-    paths:
-      - "**.c"
-      - "**.h"
-  pull_request:
-    paths:
-      - "**.h"
-      - "**.h"
-
-jobs:
-
-  linux:
-    runs-on: ubuntu-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: pip install meson ninja
-    - run: meson setup build
-      env:
-        CC: gcc
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Linux_Meson_Testlog
-        path: build/meson-logs/testlog.txt
-
-  macos:
-    runs-on: macos-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: brew install gcc
-    - run: pip install meson ninja
-    - run: meson setup build
-      env:
-        CC: gcc
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: MacOS_Meson_Testlog
-        path: build/meson-logs/testlog.txt
-
-  windows:
-    runs-on: windows-latest
-    steps:
-    - uses: actions/checkout@v1
-    - uses: actions/setup-python@v1
-      with:
-        python-version: '3.x'
-    - run: pip install meson ninja
-    - run: meson setup build
-      env:
-        CC: gcc
-    - run: meson test -C build -v
-    - uses: actions/upload-artifact@v1
-      if: failure()
-      with:
-        name: Windows_Meson_Testlog
-        path: build/meson-logs/testlog.txt
-```
diff --git a/meson/docs/markdown/Contributing.md b/meson/docs/markdown/Contributing.md
deleted file mode 100644 (file)
index 07ddc88..0000000
+++ /dev/null
@@ -1,513 +0,0 @@
----
-short-description: Contributing to Meson
-...
-
-# Contributing to Meson
-
-A large fraction of Meson is contributed by people outside the core
-team. This documentation explains some of the design rationales of
-Meson as well as how to create and submit your patches for inclusion
-to Meson.
-
-Thank you for your interest in participating to the development.
-
-## Submitting patches
-
-All changes must be submitted as [pull requests to
-Github](https://github.com/mesonbuild/meson/pulls). This causes them
-to be run through the CI system. All submissions must pass a full CI
-test run before they are even considered for submission.
-
-## Keeping pull requests up to date
-
-It is possible that while your pull request is being reviewed, other
-changes are committed to master that cause merge conflicts that must
-be resolved. The basic rule for this is very simple: keep your pull
-request up to date using rebase _only_.
-
-Do not merge head back to your branch. Any merge commits in your pull
-request make it not acceptable for merging into master and you must
-remove them.
-
-## Special procedure for new features
-
-Every new feature requires some extra steps, namely:
-
-- Must include a project test under `test cases/`, or if that's not
-  possible or if the test requires a special environment, it must go
-  into `run_unittests.py`.
-- Must be registered with the [FeatureChecks framework](Release-notes-for-0.47.0.md#feature-detection-based-on-meson_version-in-project)
-  that will warn the user if they try to use a new feature while
-  targeting an older meson version.
-- Needs a release note snippet inside `docs/markdown/snippets/` with
-  a heading and a brief paragraph explaining what the feature does
-  with an example.
-
-## Acceptance and merging
-
-The kind of review and acceptance any merge proposal gets depends on
-the changes it contains. All pull requests must be reviewed and
-accepted by someone with commit rights who is not the original
-submitter. Merge requests can be roughly split into three different
-categories.
-
-The first one consists of MRs that only change the markdown
-documentation under `docs/markdown`. Anyone with access rights can
-push changes to these directly to master. For major changes it is
-still recommended to create a MR so other people can comment on it.
-
-The second group consists of merges that don't change any
-functionality, fixes to the CI system and bug fixes that have added
-regression tests (see below) and don't change existing
-functionality. Once successfully reviewed anyone with merge rights can
-merge these to master.
-
-The final kind of merges are those that add new functionality or
-change existing functionality in a backwards incompatible way. These
-require the approval of the project lead.
-
-In a simplified list form the split would look like the following:
-
-- members with commit access can do:
-  - documentation changes (directly to master if warranted)
-  - bug fixes that don't change functionality
-  - refactorings
-  - new dependency types
-  - new tool support (e.g. a new Doxygen-kind of tool)
-  - support for new compilers to existing languages
-- project leader decision is needed for:
-  - new modules
-  - new functions in the Meson language
-  - syntax changes for Meson files
-  - changes breaking backwards compatibility
-  - support for new languages
-
-## Strategy for merging pull requests to trunk
-
-Meson's merge strategy should fulfill the following guidelines:
-
-- preserve as much history as possible
-
-- have as little junk in the repo as possible
-
-- everything in the "master lineage" should always pass all tests
-
-These goals are slightly contradictory so the correct thing to do
-often requires some judgement on part of the person doing the
-merge. Github provides three different merge options, The rules of
-thumb for choosing between them goes like this:
-
-- single commit pull requests should always be rebased
-
-- a pull request with one commit and one "fixup" commit (such as
-  testing something to see if it passes CI) should be squashed
-
-- large branches with many commits should be merged with a merge
-  commit, especially if one of the commits does not pass all tests
-  (which happens in e.g. large and difficult refactorings)
-
-If in doubt, ask for guidance on IRC.
-
-## Tests
-
-All new features must come with automatic tests that thoroughly prove
-that the feature is working as expected. Similarly bug fixes must come
-with a unit test that demonstrates the bug, proves that it has been
-fixed and prevents the feature from breaking in the future.
-
-Sometimes it is difficult to create a unit test for a given bug. If
-this is the case, note this in your pull request. We may permit bug
-fix merge requests in these cases. This is done on a case by case
-basis. Sometimes it may be easier to write the test than convince the
-maintainers that one is not needed. Exercise judgment and ask for help
-in problematic cases.
-
-The tests are split into two different parts: unit tests and full
-project tests. To run all tests, execute `./run_tests.py`. Unit tests
-can be run with `./run_unittests.py` and project tests with
-`./run_project_tests.py`.
-
-### Project tests
-
-Subsets of project tests can be selected with
-`./run_project_tests.py --only` option. This can save a great deal of
-time when only a certain part of Meson is being tested.
-For example, a useful and easy contribution to Meson is making
-sure the full set of compilers is supported. One could for example test
-various Fortran compilers by setting `FC=ifort` or `FC=flang` or similar
-with `./run_project_test.py --only fortran`.
-Some families of tests require a particular backend to run.
-For example, all the CUDA project tests run and pass on Windows via
-`./run_project_tests.py --only cuda --backend ninja`
-
-Each project test is a standalone project that can be compiled on its
-own. They are all in the `test cases` subdirectory. The simplest way to
-run a single project test is to do something like `./meson.py test\
-cases/common/1\ trivial builddir`. The one exception to this is `test
-cases/unit` directory discussed below.
-
-The test cases in the `common` subdirectory are meant to be run always
-for all backends. They should only depend on C and C++, without any
-external dependencies such as libraries. Tests that require those are
-in the `test cases/frameworks` directory. If there is a need for an
-external program in the common directory, such as a code generator, it
-should be implemented as a Python script. The goal of test projects is
-also to provide sample projects that end users can use as a base for
-their own projects.
-
-All project tests follow the same pattern: they are configured, compiled, tests
-are run and finally install is run. Passing means that configuring, building and
-tests succeed and that installed files match those expected.
-
-Any tests that require more thorough analysis, such as checking that certain
-compiler arguments can be found in the command line or that the generated
-pkg-config files actually work should be done with a unit test.
-
-Additionally:
-
-* `crossfile.ini` and `nativefile.ini` are passed to the configure step with
-`--cross-file` and `--native-file` options, respectively.
-
-* `mlog.cmd_ci_include()` can be called from anywhere inside meson to capture the
-contents of an additional file into the CI log on failure.
-
-Projects needed by unit tests are in the `test cases/unit`
-subdirectory. They are not run as part of `./run_project_tests.py`.
-
-### Configuring project tests
-
-The (optional) `test.json` file, in the root of a test case, is used
-for configuring the test. All of the following root entries in the `test.json`
-are independent of each other and can be combined as needed.
-
-Exanple `test.json`:
-
-```json
-{
-  "env": {
-    "VAR": "VAL"
-  },
-  "installed": [
-    { "type": "exe", "file": "usr/bin/testexe" },
-    { "type": "pdb", "file": "usr/bin/testexe" },
-    { "type": "shared_lib", "file": "usr/lib/z", "version": "1.2.3" },
-  ],
-  "matrix": {
-    "options": {
-      "opt1": [
-        { "val": "abc"   },
-        { "val": "qwert" },
-        { "val": "bad"   }
-      ],
-      "opt2": [
-        { "val": null    },
-        { "val": "true"  },
-        { "val": "false" },
-      ]
-    },
-    "exclude": [
-      { "opt1": "qwert", "opt2": "false" },
-      { "opt1": "bad"                    }
-    ]
-  },
-  "tools": {
-    "cmake": ">=3.11"
-  }
-}
-```
-
-#### env
-
-The `env` key contains a dictionary which specifies additional
-environment variables to be set during the configure step of the test. `@ROOT@`
-is replaced with the absolute path of the source directory.
-
-#### installed
-
-The `installed` dict contains a list of dicts, describing which files are expected
-to be installed. Each dict contains the following keys:
-
-- `file`
-- `type`
-- `platform` (optional)
-- `version` (optional)
-- `language` (optional)
-
-The `file` entry contains the relative path (from the install root) to the
-actually installed file.
-
-The `type` entry specifies how the `file` path should be interpreted based on the
-current platform. The following values are currently supported:
-
-| type          | Description                                                                                             |
-| ------------- | ------------------------------------------------------------------------------------------------------- |
-| `file`        | No postprocessing, just use the provided path                                                           |
-| `dir`         | To include all files inside the directory (for generated docs, etc). The path must be a valid directory |
-| `exe`         | For executables. On Windows the `.exe` suffix is added to the path in `file`                            |
-| `shared_lib`  | For shared libraries, always written as `name`. The appropriate suffix and prefix are added by platform |
-| `pdb`         | For Windows PDB files. PDB entries are ignored on non Windows platforms                                 |
-| `implib`      | For Windows import libraries. These entries are ignored on non Windows platforms                        |
-| `implibempty` | Like `implib`, but no symbols are exported in the library                                               |
-| `expr`        | `file` is an expression. This type should be avoided and removed if possible                            |
-
-Except for the `file` and `expr` types, all paths should be provided *without* a suffix.
-
-| Argument   | Applies to                 | Description                                                                   |
-| -----------|----------------------------|-------------------------------------------------------------------------------|
-| `version`  | `shared_lib`, `pdb`        | Sets the version to look for appropriately per-platform                       |
-| `language` | `pdb`                      | Determines which compiler/linker determines the existence of this file        |
-
-The `shared_lib` and `pdb` types takes an optional additional parameter, `version`, this is us a string in `X.Y.Z` format that will be applied to the library. Each version to be tested must have a single version. The harness will apply this correctly per platform:
-
-`pdb` takes an optional `language` argument. This determines which compiler/linker should generate the pdb file. Because it's possible to mix compilers that do and don't generate pdb files (dmd's optlink doesn't). Currently this is only needed when mixing D and C code.
-
-```json
-{
-  "type": "shared_lib", "file": "usr/lib/lib",
-  "type": "shared_lib", "file": "usr/lib/lib", "version": "1",
-  "type": "shared_lib", "file": "usr/lib/lib", "version": "1.2.3.",
-}
-```
-
-This will be applied appropriatly per platform. On windows this expects `lib.dll` and `lib-1.dll`. on MacOS it expects `liblib.dylib` and `liblib.1.dylib`. On other Unices it expects `liblib.so`, `liblib.so.1`, and `liblib.so.1.2.3`.
-
-If the `platform` key is present, the installed file entry is only considered if
-the platform matches. The following values for `platform` are currently supported:
-
-| platform   | Description                                                          |
-| ---------- | -------------------------------------------------------------------- |
-| `msvc`     | Matches when a msvc like compiler is used (`msvc`, `clang-cl`, etc.) |
-| `gcc`      | Not `msvc`                                                           |
-| `cygwin`   | Matches when the platform is cygwin                                  |
-| `!cygwin`  | Not `cygwin`                                                         |
-
-#### matrix
-
-The `matrix` section can be used to define a test matrix to run project tests
-with different meson options.
-
-In the `options` dict, all possible options and their values are specified. Each
-key in the `options` dict is a meson option. It stores a list of all potential
-values in a dict format, which allows to skip specific values based on the current
-environment.
-
-Each value must contain the `val` key for the value of the option. `null` can be
-used for adding matrix entries without the current option.
-
-Additionally, the `skip_on_env` key can be used to specify a list of environment
-variables. If at least one environment variable in `skip_on_env` is present, all
-matrix entries containing this value are skipped.
-
-Similarly, the `compilers` key can be used to define a mapping of compilers to languages that are required for this value.
-
-```json
-{
-  "compilers": {
-    "c": "gcc",
-    "cpp": "gcc",
-    "d": "gdc"
-  }
-}
-```
-
-Specific option combinations can be excluded with the `exclude` section. It should
-be noted that `exclude` does not require exact matches. Instead, any matrix entry
-containing all option value combinations in `exclude` will be excluded. Thus
-an empty dict (`{}`) to will match **all** elements in the test matrix.
-
-The above example will produce the following matrix entries:
-- `opt1=abc`
-- `opt1=abc opt2=true`
-- `opt1=abc opt2=false`
-- `opt1=qwert`
-- `opt1=qwert opt2=true`
-
-#### do_not_set_opts
-
-Currently supported values are:
-- `prefix`
-- `libdir`
-
-#### tools
-
-This section specifies a dict of tool requirements in a simple key-value format.
-If a tool is specified, it has to be present in the environment, and the version
-requirement must be fulfilled. Otherwise, the entire test is skipped (including
-every element in the test matrix).
-
-#### stdout
-
-The `stdout` key contains a list of dicts, describing the expected stdout.
-
-Each dict contains the following keys:
-
-- `line`
-- `match` (optional)
-
-Each item in the list is matched, in order, against the remaining actual stdout
-lines, after any previous matches. If the actual stdout is exhausted before
-every item in the list is matched, the expected output has not been seen, and
-the test has failed.
-
-The `match` element of the dict determines how the `line` element is matched:
-
-| Type      | Description             |
-| --------  | ----------------------- |
-| `literal` | Literal match (default) |
-| `re`      | regex match             |
-
-### Skipping integration tests
-
-Meson uses several continuous integration testing systems that have slightly
-different interfaces for indicating a commit should be skipped.
-
-Continuous integration systems currently used:
-- [Travis-CI](https://docs.travis-ci.com/user/customizing-the-build#skipping-a-build)
-  allows `[skip ci]` anywhere in the commit messages.
-- [Azure Pipelines](https://docs.microsoft.com/en-us/azure/devops/pipelines/scripts/git-commands?view=vsts&tabs=yaml#how-do-i-avoid-triggering-a-ci-build-when-the-script-pushes)
-  allows `***NO_CI***` in the commit message.
-- [Sider](https://sider.review)
-  runs Flake8 ([see below](#python-coding-style))
-
-To promote consistent naming policy, use:
-
-- `[skip ci]` in the commit title if you want to disable all integration tests
-
-## Documentation
-
-The `docs` directory contains the full documentation that will be used
-to generate [the Meson web site](http://mesonbuild.com). Every change
-in functionality must change the documentation pages. In most cases
-this means updating the reference documentation page but bigger
-changes might need changes in other documentation, too.
-
-All new functionality needs to have a mention in the release
-notes. These features should be written in standalone files in the
-`docs/markdown/snippets` directory. The release manager will combine
-them into one page when doing the release.
-
-[Integration tests should be disabled](#skipping-integration-tests) for
-documentation-only commits by putting `[skip ci]` into commit title.
-Reviewers should ask contributors to put `[skip ci]` into the title because
-tests are run again after merge for `master`.
-
-## Python Coding style
-
-Meson follows the basic Python coding style. Additional rules are the
-following:
-
-- indent 4 spaces, no tabs ever
-- indent meson.build files with two spaces
-- try to keep the code as simple as possible
-- contact the mailing list before embarking on large scale projects
-  to avoid wasted effort
-
-Meson uses Flake8 for style guide enforcement. The Flake8 options for
-the project are contained in .flake8.
-
-To run Flake8 on your local clone of Meson:
-
-```console
-$ python3 -m pip install flake8
-$ cd meson
-$ flake8
-```
-
-To run it automatically before committing:
-
-```console
-$ flake8 --install-hook=git
-$ git config --bool flake8.strict true
-```
-
-## C/C++ coding style
-
-Meson has a bunch of test code in several languages. The rules for
-those are simple.
-
-- indent 4 spaces, no tabs ever
-- brace always on the same line as if/for/else/function definition
-
-## External dependencies
-
-The goal of Meson is to be as easily usable as possible. The user
-experience should be "get Python3 and Ninja, run", even on
-Windows. Unfortunately this means that we can't have dependencies on
-projects outside of Python's standard library. This applies only to
-core functionality, though. For additional helper programs etc the use
-of external dependencies may be ok. If you feel that you are dealing
-with this kind of case, please contact the developers first with your
-use case.
-
-## Turing completeness
-
-The main design principle of Meson is that the definition language is
-not Turing complete. Any change that would make Meson Turing complete
-is automatically rejected. In practice this means that defining your
-own functions inside `meson.build` files and generalised loops will
-not be added to the language.
-
-## Do I need to sign a CLA in order to contribute?
-
-No you don't. All contributions are welcome.
-
-## No lingering state
-
-Meson operates in much the same way as functional programming
-languages. It has inputs, which include `meson.build` files, values of
-options, compilers and so on. These are passed to a function, which
-generates output build definition. This function is pure, which means that:
-
-- for any given input the output is always the same
-- running Meson twice in a row _always_ produce the same output in both runs
-
-The latter one is important, because it enforces that there is no way
-for "secret state" to pass between consecutive invocations of
-Meson. This is the reason why, for example, there is no `set_option`
-function even though there is a `get_option` one.
-
-If this were not the case, we could never know if the build output is
-"stable". For example suppose there were a `set_option` function and a
-boolean variable `flipflop`. Then you could do this:
-
-```meson
-set_option('flipflop', not get_option('flipflop'))
-```
-
-This piece of code would never converge. Every Meson run would change
-the value of the option and thus the output you get out of this build
-definition would be random.
-
-Meson does not permit this by forbidding these sorts of covert channels.
-
-There is one exception to this rule. Users can call into external
-commands with `run_command`. If the output of that command does not
-behave like a pure function, this problem arises. Meson does not try
-to guard against this case, it is the responsibility of the user to
-make sure the commands they run behave like pure functions.
-
-## Environment variables
-
-Environment variables are like global variables, except that they are
-also hidden by default. Envvars should be avoided whenever possible,
-all functionality should be exposed in better ways such as command
-line switches.
-
-## Random design points that fit nowhere else
-
-- All features should follow the 90/9/1 rule. 90% of all use cases
-  should be easy, 9% should be possible and it is totally fine to not
-  support the final 1% if it would make things too complicated.
-
-- Any build directory will have at most two toolchains: one native and
-  one cross.
-
-- Prefer specific solutions to generic frameworks. Solve the end
-  user's problems rather than providing them tools to do it
-  themselves.
-
-- Never use features of the Unix shell (or Windows shell for that
-  matter). Doing things like forwaring output with `>` or invoking
-  multiple commands with `&&` are not permitted. Whenever these sorts
-  of requirements show up, write an internal Python script with the
-  desired functionality and use that instead.
diff --git a/meson/docs/markdown/Creating-Linux-binaries.md b/meson/docs/markdown/Creating-Linux-binaries.md
deleted file mode 100644 (file)
index c3b4b64..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
----
-short-description: Creating universal Linux binaries
-...
-
-# Creating Linux binaries
-
-Creating Linux binaries that can be downloaded and run on any distro
-(like .dmg packages for OSX or .exe installers for Windows) has
-traditionally been difficult. This is even more tricky if you want to
-use modern compilers and features, which is especially desired in game
-development. There is still no simple turn-key solution for this
-problem but with a bit of setup it can be relatively straightforward.
-
-## Installing system and GCC
-
-First you need to do a fresh operating system install. You can use
-spare hardware, VirtualBox, cloud or whatever you want. Note that the
-distro you install must be *at least as old* as the oldest release you
-wish to support. Debian stable is usually a good choice, though
-immediately after its release you might want to use Debian oldstable
-or the previous Ubuntu LTS. The oldest supported version of CentOS is
-also a good choice.
-
-Once you have installed the system, you need to install
-build-dependencies for GCC. In Debian-based distros this can be done
-with the following commands:
-
-```console
-$ apt-get build-dep g++
-$ apt-get install pkg-config libgmp-dev libmpfr-dev libmpc-dev
-```
-
-Then create a `src` subdirectory in your home directory. Copy-paste
-the following into `install_gcc.sh` and execute it.
-
-```bash
-#!/bin/sh
-
-wget ftp://ftp.fu-berlin.de/unix/languages/gcc/releases/gcc-4.9.2/gcc-4.9.2.tar.bz2
-tar xf gcc-4.9.2.tar.bz2
-
-mkdir objdir
-cd objdir
-../gcc-4.9.2/configure --disable-bootstrap --prefix=${HOME}/devroot \
-                       --disable-multilib --enable-languages=c,c++
-make -j 4
-make install-strip
-ln -s gcc ${HOME}/devroot/bin/cc
-```
-
-Then finally add the following lines to your `.bashrc`.
-
-```console
-$ export LD_LIBRARY_PATH=${HOME}/devroot/lib
-$ export PATH=${HOME}/devroot/bin:$PATH
-$ export PKG_CONFIG_PATH=${HOME}/devroot/lib/pkgconfig
-```
-
-Log out and back in and now your build environment is ready to use.
-
-## Adding other tools
-
-Old distros might have too old versions of some tools. For Meson this
-could include Python 3 and Ninja. If this is the case you need to
-download, build and install new versions into `~/devroot` in the usual
-way.
-
-## Adding dependencies
-
-You want to embed and statically link every dependency you can
-(especially C++ dependencies). Meson's [Wrap package
-manager](Wrap-dependency-system-manual.md) might be of use here. This
-is equivalent to what you would do on Windows, OSX, Android
-etc. Sometimes static linking is not possible. In these cases you need
-to copy the .so files inside your package. Let's use SDL2 as an
-example. First we download and install it as usual giving it our
-custom install prefix (that is, `./configure
---prefix=${HOME}/devroot`). This makes Meson's dependency detector
-pick it up automatically.
-
-## Building and installing
-
-Building happens in much the same way as normally. There are just two
-things to note. First, you must tell GCC to link the C++ standard
-library statically. If you don't then your app is guaranteed to break
-as different distros have binary-incompatible C++ libraries. The
-second thing is that you need to point your install prefix to some
-empty staging area. Here's the meson command to do that:
-
-```console
-$ LDFLAGS=-static-libstdc++ meson --prefix=/tmp/myapp <other args>
-```
-
-The aim is to put the executable in `/tmp/myapp/bin` and shared
-libraries to `/tmp/myapp/lib`. The next thing you need is the
-embedder. It takes your dependencies (in this case only
-`libSDL2-2.0.so.0`) and copies them in the lib directory. Depending on
-your use case you can either copy the files by hand or write a script
-that parses the output of `ldd binary_file`. Be sure not to copy
-system libraries (`libc`, `libpthread`, `libm` etc). For an example,
-see the [sample
-project](https://github.com/jpakkane/meson/tree/master/manual%20tests/4%20standalone%20binaries).
-
-Make the script run during install with this:
-
-```meson
-meson.add_install_script('linux_bundler.sh')
-```
-
-## Final steps
-
-If you try to run the program now it will most likely fail to start or
-crashes. The reason for this is that the system does not know that the
-executable needs libraries from the `lib` directory. The solution for
-this is a simple wrapper script. Create a script called `myapp.sh`
-with the following content:
-
-```bash
-#!/bin/bash
-
-cd "${0%/*}"
-export LD_LIBRARY_PATH="$(pwd)/lib"
-bin/myapp
-```
-
-Install it with this Meson snippet:
-
-```meson
-install_data('myapp.sh', install_dir : '.')
-```
-
-And now you are done. Zip up your `/tmp/myapp` directory and you have
-a working binary ready for deployment. To run the program, just unzip
-the file and run `myapp.sh`.
diff --git a/meson/docs/markdown/Creating-OSX-packages.md b/meson/docs/markdown/Creating-OSX-packages.md
deleted file mode 100644 (file)
index 849d5fd..0000000
+++ /dev/null
@@ -1,158 +0,0 @@
----
-short-description: Tools to create OS X packages
-...
-
-# Creating OSX packages
-
-Meson does not have native support for building OSX packages but it
-does provide all the tools you need to create one yourself. The reason
-for this is that it is a very hard task to write a system that
-provides for all the different ways to do that but it is very easy to
-write simple scripts for each application.
-
-Sample code for this can be found in [the Meson manual test
-suite](https://github.com/jpakkane/meson/tree/master/manual%20tests/4%20standalone%20binaries).
-
-## Creating an app bundle
-
-OSX app bundles are actually extremely simple. They are just a
-directory of files in a certain format. All the details you need to
-know are on [this
-page](https://stackoverflow.com/questions/1596945/building-osx-app-bundle)
-and it is highly recommended that you read it first.
-
-Let's assume that we are creating our app bundle into
-`/tmp/myapp.app`. Suppose we have one executable, so we need to
-install that into `Contents/MacOS`. If we define the executable like
-this:
-
-```meson
-executable('myapp', 'foo1.c', ..., install : true)
-```
-
-then we just need to initialize our build tree with this command:
-
-```console
-$ meson --prefix=/tmp/myapp.app \
-        --bindir=Contents/MacOS \
-        builddir \
-        <other flags you might need>
-```
-
-Now when we do `meson install` the bundle is properly staged. If you
-have any resource files or data, you need to install them into
-`Contents/Resources` either by custom install commands or specifying
-more install paths to the Meson command.
-
-Next we need to install an `Info.plist` file and an icon. For those we
-need the following two Meson definitions.
-
-```meson
-install_data('myapp.icns', install_dir : 'Contents/Resources')
-install_data('Info.plist', install_dir : 'Contents')
-```
-
-The format of `Info.plist` can be found in the link or the sample
-project linked above. The simplest way to get an icon in the `icns`
-format is to save your image as a tiff an then use the `tiff2icns` helper
-application that comes with XCode.
-
-Some applications assume that the working directory of the app process
-is the same where the binary executable is. If this is the case for
-you, then you need to create a wrapper script that looks like this:
-
-```bash
-#!/bin/bash
-
-cd "${0%/*}"
-./myapp
-```
-
-install it with this:
-
-```meson
-install_data('myapp.sh', install_dir : 'Contents/MacOS')
-```
-
-and make sure that you specify `myapp.sh` as the executable to run in
-your `Info.plist`.
-
-If you are not using any external libraries, this is all you need to
-do. You now have a full app bundle in `/tmp/myapp.app` that you can
-use. Most applications use third party frameworks and libraries,
-though, so you need to add them to the bundle so it will work on other
-peoples' machines.
-
-As an example we are going to use the [SDL2](https://libsdl.org/)
-framework. In order to bundle it in our app, we first specify an
-installer script to run.
-
-```meson
-meson.add_install_script('install_script.sh')
-```
-
-The install script does two things. First it copies the whole
-framework into our bundle.
-
-```console
-$ mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks
-$ cp -R /Library/Frameworks/SDL2.framework \
-        ${MESON_INSTALL_PREFIX}/Contents/Frameworks
-```
-
-Then it needs to alter the library search path of our
-executable(s). This tells OSX that the libraries your app needs are
-inside your bundle. In the case of SDL2, the invocation goes like
-this:
-
-```console
-$ install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 \
-    @executable_path/../FrameWorks/SDL2.framework/Versions/A/SDL2 \
-    ${MESON_INSTALL_PREFIX}/Contents/MacOS/myapp
-```
-
-This is the part of OSX app bundling that you must always do
-manually. OSX dependencies come in many shapes and forms and
-unfortunately there is no reliable automatic way to determine how each
-dependency should be handled. Frameworks go to the `Frameworks`
-directory while plain `.dylib` files usually go to
-`Contents/Resources/lib` (but you can put them wherever you like). To
-get this done you have to check what your program links against with
-`otool -L /path/to/binary` and manually add the copy and fix steps to
-your install script. Do not copy system libraries inside your bundle,
-though.
-
-After this you have a fully working, self-contained OSX app bundle
-ready for distribution.
-
-## Creating a .dmg installer
-
-A .dmg installer is similarly quite simple, at its core it is
-basically a fancy compressed archive. A good description can be found
-on [this page](https://el-tramo.be/guides/fancy-dmg/). Please read it
-and create a template image file according to its instructions.
-
-The actual process of creating the installer is very simple: you mount
-the template image, copy your app bundle in it, unmount it and convert
-the image into a compressed archive. The actual commands to do this
-are not particularly interesting, feel free to steal them from either
-the linked page above or from the sample script in Meson's test suite.
-
-## Putting it all together
-
-There are many ways to put the .dmg installer together and different
-people will do it in different ways. The linked sample code does it by
-having two different scripts. This separates the different pieces
-generating the installer into logical pieces.
-
-`install_script.sh` only deals with embedding dependencies and fixing
-the library paths.
-
-`build_osx_installer.sh` sets up the build with the proper paths,
-compiles, installs and generates the .dmg package.
-
-The main reasoning here is that in order to build a complete OSX
-installer package from source, all you need to do is to cd into the
-source tree and run `./build_osx_installer.sh`. To build packages on
-other platforms you would write scripts such as
-`build_windows_installer.bat` and so on.
diff --git a/meson/docs/markdown/Creating-releases.md b/meson/docs/markdown/Creating-releases.md
deleted file mode 100644 (file)
index 040fb53..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
----
-short-description: Creating releases
-...
-
-# Creating releases
-
-In addition to development, almost all projects provide periodical
-source releases. These are standalone packages (usually either in
-tar or zip format) of the source code. They do not contain any
-revision control metadata, only the source code.  Meson provides
-a simple way of generating these, with the `meson dist` command.
-
-Meson provides a simple way of generating these. It consists of a
-single command *(available since 0.52.0)*:
-
-```sh
-meson dist
-```
-
-or alternatively (on older meson versions with `ninja` backend):
-
-```sh
-ninja dist
-```
-
-This creates a file called `projectname-version.tar.xz` in the build
-tree subdirectory `meson-dist`. This archive contains the full contents
-of the latest commit in revision control including all the submodules
-(recursively). All revision control metadata is removed. Meson then
-takes this archive and tests that it works by doing a full 
-`compile` + `test` + `install` cycle. If all these pass, Meson will
-then create a `SHA-256` checksum file next to the archive.
-
-
-## Autotools dist VS Meson dist
-
-Meson behaviour is different from Autotools. The Autotools "dist"
-target packages up the current source tree. Meson packages the latest
-revision control commit. The reason for this is that it prevents developers
-from doing accidental releases where the distributed archive does not match
-any commit in revision control (especially the one tagged for the release).
-
-
-## Include subprojects in your release
-
-The `meson dist` command has `--include-subprojects` command line option.
-When enabled, the source tree of all subprojects used by the current build
-will also be included in the final tarball. This is useful to distribute
-self contained tarball that can be built offline (i.e. `--wrap-mode=nodownload`).
-
-
-## Skip build and test with `--no-tests`
-
-The `meson dist` command has a `--no-tests` option to skip build and
-tests steps of generated packages. It can be used to not waste time
-for example when done in CI that already does its own testing.
-
-So with `--no-tests` you can tell Meson "Do not build and test generated
-packages.".
-
diff --git a/meson/docs/markdown/Cross-compilation.md b/meson/docs/markdown/Cross-compilation.md
deleted file mode 100644 (file)
index d86d417..0000000
+++ /dev/null
@@ -1,330 +0,0 @@
----
-short-description: Setting up cross-compilation
-...
-
-# Cross compilation
-
-Meson has full support for cross compilation. Since cross compiling is
-more complicated than native building, let's first go over some
-nomenclature. The three most important definitions are traditionally
-called *build*, *host* and *target*. This is confusing because those
-terms are used for quite many different things. To simplify the issue,
-we are going to call these the *build machine*, *host machine* and
-*target machine*. Their definitions are the following:
-
-* *build machine* is the computer that is doing the actual compiling.
-* *host machine* is the machine on which the compiled binary will run.
-* *target machine* is the machine on which the compiled binary's
-  output will run, *only meaningful* if the program produces
-  machine-specific output.
-
-The `tl/dr` summary is the following: if you are doing regular cross
-compilation, you only care about `build_machine` and
-`host_machine`. Just ignore `target_machine` altogether and you will
-be correct 99% of the time. Only compilers and similar tools care
-about the target machine. In fact, for so-called "multi-target" tools
-the target machine need not be fixed at build-time like the others but
-chosen at runtime, so `target_machine` *still* doesn't matter. If your
-needs are more complex or you are interested in the actual details, do
-read on.
-
-This might be easier to understand through examples. Let's start with
-the regular, not cross-compiling case. In these cases all of these
-three machines are the same. Simple so far.
-
-Let's next look at the most common cross-compilation setup. Let's
-suppose you are on a 64 bit OSX machine and you are cross compiling a
-binary that will run on a 32 bit ARM Linux board. In this case your
-*build machine* is 64 bit OSX, your *host machine* is 32 bit ARM Linux
-and your *target machine* is irrelevant (but defaults to the same value
-as the *host machine*). This should be quite understandable as well.
-
-The usual mistake in this case is to call the OSX system the *host* and
-the ARM Linux board the *target*. That's because these were their actual
-names when the cross-compiler itself was compiled!  Let's assume the
-cross-compiler was created on OSX too. When that happened the *build*
-and *host machines* were the same OSX and different from the ARM Linux
-*target machine*.
-
-In a nutshell, the typical mistake assumes that the terms *build*,
-*host* and *target* refer to some fixed positions whereas they're
-actually relative to where the current compiler is running. Think of
-*host* as a *child* of the current compiler and *target* as an optional
-*grand-child*. Compilers don't change their terminology when they're
-creating another compiler, that would at the very least make their user
-interface much more complex.
-
-The most complicated case is when you cross-compile a cross
-compiler. As an example you can, on a Linux machine, generate a cross
-compiler that runs on Windows but produces binaries on MIPS Linux. In
-this case *build machine* is x86 Linux, *host machine* is x86 Windows
-and *target machine* is MIPS Linux. This setup is known as the
-[Canadian
-Cross](https://en.wikipedia.org/wiki/Cross_compiler#Canadian_Cross). As
-a side note, be careful when reading cross compilation articles on
-Wikipedia or the net in general. It is very common for them to get
-build, host and target mixed up, even in consecutive sentences, which
-can leave you puzzled until you figure it out.
-
-Again note that when you cross-compile something,
-the 3 systems (*build*, *host*, and *target*) used when
-building the cross compiler don't align with the ones used when
-building something with that newly-built cross compiler. To take our
-Canadian Cross scenario from above (for full generality), since its
-*host machine* is x86 Windows, the *build machine* of anything we
-build with it is *x86 Windows*. And since its *target machine* is MIPS
-Linux, the *host machine* of anything we build with it is *MIPS
-Linux*. Only the *target machine* of whatever we build with it can be
-freely chosen by us, say if we want to build another cross compiler
-that runs on MIPS Linux and targets Aarch64 iOS. As this example
-hopefully makes clear to you, the machine names are relative and
-shifted over to the left by one position.
-
-If you did not understand all of the details, don't worry. For most
-people it takes a while to wrap their head around these
-concepts. Don't panic, it might take a while to click, but you will
-get the hang of it eventually.
-
-## Defining the environment
-
-Meson requires you to write a cross build definition file. It defines
-various properties of the cross build environment. The cross file
-consists of different sections.
-
-There are a number of options shared by cross and native files,
-[here](Machine-files.md). It is assumed that you have read that section already,
-as this documentation will only call out options specific to cross files.
-
-### Binaries
-
-```ini
-[binaries]
-exe_wrapper = 'wine' # A command used to run generated executables.
-```
-
-The `exe_wrapper` option defines a *wrapper command* that can be used to run
-executables for this host. In this case we can use Wine, which runs Windows
-applications on Linux. Other choices include running the application with
-qemu or a hardware simulator. If you have this kind of a wrapper, these lines
-are all you need to write. Meson will automatically use the given wrapper
-when it needs to run host binaries. This happens e.g. when running the
-project's test suite.
-
-### Properties
-
-In addition to the properites allowed in [all machine
-files](Machine-files.md#properties), the cross file may contain specific
-information about the cross compiler or the host machine. It looks like this:
-
-```ini
-[properties]
-sizeof_int = 4
-sizeof_wchar_t = 4
-sizeof_void* = 4
-
-alignment_char = 1
-alignment_void* = 4
-alignment_double = 4
-
-has_function_printf = true
-
-sys_root = '/some/path'
-pkg_config_libdir = '/some/path/lib/pkgconfig'
-```
-
-In most cases you don't need the size and alignment settings, Meson
-will detect all these by compiling and running some sample
-programs. If your build requires some piece of data that is not listed
-here, Meson will stop and write an error message describing how to fix
-the issue. If you need extra compiler arguments to be used during
-cross compilation you can set them with `[langname]_args =
-[args]`. Just remember to specify the args as an array and not as a
-single string (i.e. not as `'-DCROSS=1 -DSOMETHING=3'`).
-
-*Since 0.52.0* The `sys_root` property may point to the root of the host
-system path (the system that will run the compiled binaries). This is used
-internally by Meson to set the PKG_CONFIG_SYSROOT_DIR environment variable
-for pkg-config. If this is unset the host system is assumed to share a root
-with the build system.
-
-*Since 0.54.0* The pkg_config_libdir property may point to a list of path used
-internally by Meson to set the PKG_CONFIG_LIBDIR environment variable for pkg-config.
-This prevents pkg-config from searching cross dependencies in system directories.
-
-One important thing to note, if you did not define an `exe_wrapper` in
-the previous section, is that Meson will make a best-effort guess at
-whether it can run the generated binaries on the build machine. It
-determines whether this is possible by looking at the `system` and
-`cpu_family` of build vs host. There will however be cases where they
-do match up, but the build machine is actually not compatible with the
-host machine. Typically this will happen if the libc used by the build
-and host machines are incompatible, or the code relies on kernel
-features not available on the build machine. One concrete example is a
-macOS build machine producing binaries for an iOS Simulator x86-64
-host. They're both `darwin` and the same architecture, but their
-binaries are not actually compatible. In such cases you may use the
-`needs_exe_wrapper` property to override the auto-detection:
-
-```ini
-[properties]
-needs_exe_wrapper = true
-```
-
-### Machine Entries
-
-The next bit is the definition of host and target machines. Every
-cross build definition must have one or both of them. If it had
-neither, the build would not be a cross build but a native build. You
-do not need to define the build machine, as all necessary information
-about it is extracted automatically. The definitions for host and
-target machines look the same. Here is a sample for host machine.
-
-```ini
-[host_machine]
-system = 'windows'
-cpu_family = 'x86'
-cpu = 'i686'
-endian = 'little'
-```
-
-These values define the machines sufficiently for cross compilation
-purposes. The corresponding target definition would look the same but
-have `target_machine` in the header. These values are available in
-your Meson scripts. There are three predefined variables called,
-surprisingly, `build_machine`, `host_machine` and
-`target_machine`. Determining the operating system of your host
-machine is simply a matter of calling `host_machine.system()`.
-
-There are two different values for the CPU. The first one is `cpu_family`. It
-is a general type of the CPU. This should have a value from [the CPU Family
-table](Reference-tables.md#cpu-families). *Note* that meson does not add
-`el` to end cpu_family value for little endian systems. Big endian and little
-endian mips are both just `mips`, with the `endian` field set approriately.
-
-The second value is `cpu` which is
-a more specific subtype for the CPU. Typical values for a `x86` CPU family
-might include `i386` or `i586` and for `arm` family `armv5` or `armv7hl`.
-Note that CPU type strings are very system dependent. You might get a
-different value if you check its value on the same machine but with different
-operating systems.
-
-If you do not define your host machine, it is assumed to be the build
-machine. Similarly if you do not specify target machine, it is assumed
-to be the host machine.
-
-
-## Starting a cross build
-
-
-Once you have the cross file, starting a build is simple
-
-```console
-$ meson srcdir builddir --cross-file cross_file.txt
-```
-
-Once configuration is done, compilation is started by invoking `meson compile`
-in the usual way.
-
-## Introspection and system checks
-
-The main *meson* object provides two functions to determine cross
-compilation status.
-
-```meson
-meson.is_cross_build()        # returns true when cross compiling
-meson.can_run_host_binaries() # returns true if the host binaries can be run, either with a wrapper or natively
-```
-
-You can run system checks on both the system compiler or the cross
-compiler. You just have to specify which one to use.
-
-```meson
-build_compiler = meson.get_compiler('c', native : true)
-host_compiler = meson.get_compiler('c', native : false)
-
-build_int_size = build_compiler.sizeof('int')
-host_int_size  = host_compiler.sizeof('int')
-```
-
-## Mixing host and build targets
-
-Sometimes you need to build a tool which is used to generate source
-files. These are then compiled for the actual target. For this you
-would want to build some targets with the system's native
-compiler. This requires only one extra keyword argument.
-
-```meson
-native_exe = executable('mygen', 'mygen.c', native : true)
-```
-
-You can then take `native_exe` and use it as part of a generator rule or anything else you might want.
-
-## Using a custom standard library
-
-Sometimes in cross compilation you need to build your own standard
-library instead of using the one provided by the compiler. Meson has
-built-in support for switching standard libraries transparently. The
-invocation to use in your cross file is the following:
-
-```ini
-[properties]
-c_stdlib = ['mylibc', 'mylibc_dep'] # Subproject name, dependency name
-```
-
-This specifies that C standard library is provided in the Meson
-subproject `mylibc` in internal dependency variable `mylibc_dep`. It
-is used on every cross built C target in the entire source tree
-(including subprojects) and the standard library is disabled. The
-build definitions of these targets do not need any modification.
-
-## Changing cross file settings
-
-Cross file settings are only read when the build directory is set up
-the first time. Any changes to them after the fact will be
-ignored. This is the same as regular compiles where you can't change
-the compiler once a build tree has been set up. If you need to edit
-your cross file, then you need to wipe your build tree and recreate it
-from scratch.
-
-## Custom data
-
-You can store arbitrary data in `properties` and access them from your
-Meson files. As an example if you cross file has this:
-
-```ini
-[properties]
-somekey = 'somevalue'
-```
-
-then you can access that using the `meson` object like this:
-
-```meson
-myvar = meson.get_cross_property('somekey')
-# myvar now has the value 'somevalue'
-```
-
-## Cross file locations
-
-As of version 0.44.0 meson supports loading cross files from system locations
-(except on Windows).  This will be $XDG_DATA_DIRS/meson/cross, or if
-XDG_DATA_DIRS is undefined, then /usr/local/share/meson/cross and
-/usr/share/meson/cross will be tried in that order, for system wide cross
-files. User local files can be put in $XDG_DATA_HOME/meson/cross, or
-~/.local/share/meson/cross if that is undefined.
-
-The order of locations tried is as follows:
- - A file relative to the local dir
- - The user local location
- - The system wide locations in order
-
-Distributions are encouraged to ship cross files either with
-their cross compiler toolchain packages or as a standalone package, and put
-them in one of the system paths referenced above.
-
-These files can be loaded automatically without adding a path to the cross
-file. For example, if a ~/.local/share/meson/cross contains a file called x86-linux,
-then the following command would start a cross build using that cross files:
-
-```sh
-meson builddir/ --cross-file x86-linux
-```
diff --git a/meson/docs/markdown/Cuda-module.md b/meson/docs/markdown/Cuda-module.md
deleted file mode 100644 (file)
index f161eac..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
----
-short-description: CUDA module
-authors:
-    - name: Olexa Bilaniuk
-      years: [2019]
-      has-copyright: false
-...
-
-# Unstable CUDA Module
-_Since: 0.50.0_
-
-This module provides helper functionality related to the CUDA Toolkit and
-building code using it.
-
-
-**Note**: this module is unstable. It is only provided as a technology preview.
-Its API may change in arbitrary ways between releases or it might be removed
-from Meson altogether.
-
-
-## Importing the module
-
-The module may be imported as follows:
-
-``` meson
-cuda = import('unstable-cuda')
-```
-
-It offers several useful functions that are enumerated below.
-
-
-## Functions
-
-### `nvcc_arch_flags()`
-_Since: 0.50.0_
-
-``` meson
-cuda.nvcc_arch_flags(nvcc_or_version, ...,
-                     detected: string_or_array)
-```
-
-Returns a list of `-gencode` flags that should be passed to `cuda_args:` in
-order to compile a "fat binary" for the architectures/compute capabilities
-enumerated in the positional argument(s). The flags shall be acceptable to
-the NVCC compiler object `nvcc_or_version`, or its version string.
-
-A set of architectures and/or compute capabilities may be specified by:
-
-- The single positional argument `'All'`, `'Common'` or `'Auto'`
-- As (an array of)
-  - Architecture names (`'Kepler'`, `'Maxwell+Tegra'`, `'Turing'`) and/or
-  - Compute capabilities (`'3.0'`, `'3.5'`, `'5.3'`, `'7.5'`)
-
-A suffix of `+PTX` requests PTX code generation for the given architecture.
-A compute capability given as `A.B(X.Y)` requests PTX generation for an older
-virtual architecture `X.Y` before binary generation for a newer architecture
-`A.B`.
-
-Multiple architectures and compute capabilities may be passed in using
-
-- Multiple positional arguments
-- Lists of strings
-- Space (` `), comma (`,`) or semicolon (`;`)-separated strings
-
-The single-word architectural sets `'All'`, `'Common'` or `'Auto'` cannot be
-mixed with architecture names or compute capabilities. Their interpretation is:
-
-| Name              | Compute Capability |
-|-------------------|--------------------|
-| `'All'`           | All CCs supported by given NVCC compiler. |
-| `'Common'`        | Relatively common CCs supported by given NVCC compiler. Generally excludes Tegra and Tesla devices. |
-| `'Auto'`          | The CCs provided by the `detected:` keyword, filtered for support by given NVCC compiler. |
-
-As a special case, when `nvcc_arch_flags()` is invoked with
-
-- an NVCC `compiler` object `nvcc`,
-- `'Auto'` mode and
-- no `detected:` keyword,
-
-Meson uses `nvcc`'s architecture auto-detection results.
-
-The supported architecture names and their corresponding compute capabilities
-are:
-
-| Name              | Compute Capability |
-|-------------------|--------------------|
-| `'Fermi'`         | 2.0, 2.1(2.0)      |
-| `'Kepler'`        | 3.0, 3.5           |
-| `'Kepler+Tegra'`  | 3.2                |
-| `'Kepler+Tesla'`  | 3.7                |
-| `'Maxwell'`       | 5.0, 5.2           |
-| `'Maxwell+Tegra'` | 5.3                |
-| `'Pascal'`        | 6.0, 6.1           |
-| `'Pascal+Tegra'`  | 6.2                |
-| `'Volta'`         | 7.0                |
-| `'Xavier'`        | 7.2                |
-| `'Turing'`        | 7.5                |
-
-
-Examples:
-
-    cuda.nvcc_arch_flags('10.0', '3.0', '3.5', '5.0+PTX')
-    cuda.nvcc_arch_flags('10.0', ['3.0', '3.5', '5.0+PTX'])
-    cuda.nvcc_arch_flags('10.0', [['3.0', '3.5'], '5.0+PTX'])
-    cuda.nvcc_arch_flags('10.0', '3.0 3.5 5.0+PTX')
-    cuda.nvcc_arch_flags('10.0', '3.0,3.5,5.0+PTX')
-    cuda.nvcc_arch_flags('10.0', '3.0;3.5;5.0+PTX')
-    cuda.nvcc_arch_flags('10.0', 'Kepler 5.0+PTX')
-    # Returns ['-gencode', 'arch=compute_30,code=sm_30',
-    #          '-gencode', 'arch=compute_35,code=sm_35',
-    #          '-gencode', 'arch=compute_50,code=sm_50',
-    #          '-gencode', 'arch=compute_50,code=compute_50']
-
-    cuda.nvcc_arch_flags('10.0', '3.5(3.0)')
-    # Returns ['-gencode', 'arch=compute_30,code=sm_35']
-
-    cuda.nvcc_arch_flags('8.0', 'Common')
-    # Returns ['-gencode', 'arch=compute_30,code=sm_30',
-    #          '-gencode', 'arch=compute_35,code=sm_35',
-    #          '-gencode', 'arch=compute_50,code=sm_50',
-    #          '-gencode', 'arch=compute_52,code=sm_52',
-    #          '-gencode', 'arch=compute_60,code=sm_60',
-    #          '-gencode', 'arch=compute_61,code=sm_61',
-    #          '-gencode', 'arch=compute_61,code=compute_61']
-
-    cuda.nvcc_arch_flags('9.2', 'Auto', detected: '6.0 6.0 6.0 6.0')
-    cuda.nvcc_arch_flags('9.2', 'Auto', detected: ['6.0', '6.0', '6.0', '6.0'])
-    # Returns ['-gencode', 'arch=compute_60,code=sm_60']
-
-    cuda.nvcc_arch_flags(nvcc, 'All')
-    # Returns ['-gencode', 'arch=compute_20,code=sm_20',
-    #          '-gencode', 'arch=compute_20,code=sm_21',
-    #          '-gencode', 'arch=compute_30,code=sm_30',
-    #          '-gencode', 'arch=compute_32,code=sm_32',
-    #          '-gencode', 'arch=compute_35,code=sm_35',
-    #          '-gencode', 'arch=compute_37,code=sm_37',
-    #          '-gencode', 'arch=compute_50,code=sm_50', # nvcc.version()  <  7.0
-    #          '-gencode', 'arch=compute_52,code=sm_52',
-    #          '-gencode', 'arch=compute_53,code=sm_53', # nvcc.version() >=  7.0
-    #          '-gencode', 'arch=compute_60,code=sm_60',
-    #          '-gencode', 'arch=compute_61,code=sm_61', # nvcc.version() >=  8.0
-    #          '-gencode', 'arch=compute_70,code=sm_70',
-    #          '-gencode', 'arch=compute_72,code=sm_72', # nvcc.version() >=  9.0
-    #          '-gencode', 'arch=compute_75,code=sm_75'] # nvcc.version() >= 10.0
-
-_Note:_ This function is intended to closely replicate CMake's FindCUDA module
-function `CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable, [list of CUDA compute architectures])`
-
-
-
-### `nvcc_arch_readable()`
-_Since: 0.50.0_
-
-``` meson
-cuda.nvcc_arch_readable(nvcc_or_version, ...,
-                        detected: string_or_array)
-```
-
-Has precisely the same interface as [`nvcc_arch_flags()`](#nvcc_arch_flags),
-but rather than returning a list of flags, it returns a "readable" list of
-architectures that will be compiled for. The output of this function is solely
-intended for informative message printing.
-
-    archs    = '3.0 3.5 5.0+PTX'
-    readable = cuda.nvcc_arch_readable(nvcc, archs)
-    message('Building for architectures ' + ' '.join(readable))
-
-This will print
-
-    Message: Building for architectures sm30 sm35 sm50 compute50
-
-_Note:_ This function is intended to closely replicate CMake's FindCUDA module function
-`CUDA_SELECT_NVCC_ARCH_FLAGS(out_variable, [list of CUDA compute architectures])`
-
-
-
-### `min_driver_version()`
-_Since: 0.50.0_
-
-``` meson
-cuda.min_driver_version(nvcc_or_version)
-```
-
-Returns the minimum NVIDIA proprietary driver version required, on the host
-system, by kernels compiled with the given NVCC compiler or its version string.
-
-The output of this function is generally intended for informative message
-printing, but could be used for assertions or to conditionally enable
-features known to exist within the minimum NVIDIA driver required.
-
-
diff --git a/meson/docs/markdown/Custom-build-targets.md b/meson/docs/markdown/Custom-build-targets.md
deleted file mode 100644 (file)
index f0b50d8..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
----
-short-description: Build targets for custom languages or corner-cases
-...
-
-# Custom build targets
-
-While Meson tries to support as many languages and tools as possible,
-there is no possible way for it to cover all corner cases. For these
-cases it permits you to define custom build targets. Here is how one
-would use it.
-
-```meson
-comp = find_program('custom_compiler')
-
-infile = 'source_code.txt'
-outfile = 'output.bin'
-
-mytarget = custom_target('targetname',
-  output : outfile,
-  input : infile,
-  command : [comp, '@INPUT@', '@OUTPUT@'],
-  install : true,
-  install_dir : 'subdir')
-```
-
-This would generate the binary `output.bin` and install it to
-`${prefix}/subdir/output.bin`. Variable substitution works just like
-it does for source generation.
-
-See [Generating Sources](Generating-sources.md) for more information on this topic.
-
-## Details on compiler invocations
-
-Meson only permits you to specify one command to run. This is by
-design as writing shell pipelines into build definition files leads to
-code that is very hard to maintain. If your compilation requires
-multiple steps you need to write a wrapper script that does all the
-necessary work. When doing this you need to be mindful of the
-following issues:
-
-* do not assume that the command is invoked in any specific directory
-* a target called `target` file `outfile` defined in subdir `subdir`
-  must be written to `build_dir/subdir/foo.dat`
-* if you need a subdirectory for temporary files, use
-  `build_dir/subdir/target.dir`
diff --git a/meson/docs/markdown/D.md b/meson/docs/markdown/D.md
deleted file mode 100644 (file)
index 39aebc8..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
----
-title: D
-short-description: Compiling D sources
-...
-
-# Compiling D applications
-
-Meson has support for compiling D programs. A minimal `meson.build`
-file for D looks like this:
-
-```meson
-project('myapp', 'd')
-
-executable('myapp', 'app.d')
-```
-
-## [Conditional compilation](https://dlang.org/spec/version.html)
-
-If you are using the [version()](https://dlang.org/spec/version.html#version-specification) feature for conditional compilation,
-you can use it using the `d_module_versions` target property:
-```meson
-project('myapp', 'd')
-executable('myapp', 'app.d', d_module_versions: ['Demo', 'FeatureA'])
-```
-
-For debugging, [debug()](https://dlang.org/spec/version.html#debug) conditions are compiled automatically in debug builds, and extra identifiers can be added with the `d_debug` argument:
-```meson
-project('myapp', 'd')
-executable('myapp', 'app.d', d_debug: [3, 'DebugFeatureA'])
-```
-
-## Using embedded unittests
-
-If you are using embedded [unittest functions](https://dlang.org/spec/unittest.html), your source code needs
-to be compiled twice, once in regular
-mode, and once with unittests active. This is done by setting the
-`d_unittest` target property to `true`.
-Meson will only ever pass the respective compiler's `-unittest` flag,
-and never have the compiler generate an empty main function.
-If you need that feature in a portable way, create an empty `main()`
-function for unittests yourself, since the GNU D compiler
-does not have this feature.
-
-This is an example for using D unittests with Meson:
-```meson
-project('myapp_tested', 'd')
-
-myapp_src = ['app.d', 'alpha.d', 'beta.d']
-executable('myapp', myapp_src)
-
-test_exe = executable('myapp_test', myapp_src, d_unittest: true)
-test('myapptest', test_exe)
-```
-
-# Compiling D libraries and installing them
-
-Building D libraries is a straightforward process, not different from
-how C libraries are built in Meson. You should generate a pkg-config
-file and install it, in order to make other software on the system
-find the dependency once it is installed.
-
-This is an example on how to build a D shared library:
-```meson
-project('mylib', 'd', version: '1.2.0')
-
-project_soversion = 0
-glib_dep = dependency('glib-2.0')
-
-my_lib = library('mylib',
-    ['src/mylib/libfunctions.d'],
-    dependencies: [glib_dep],
-    install: true,
-    version: meson.project_version(),
-    soversion: project_soversion,
-    d_module_versions: ['FeatureA', 'featureB']
-)
-
-pkgc = import('pkgconfig')
-pkgc.generate(name: 'mylib',
-              libraries: my_lib,
-              subdirs: 'd/mylib',
-              version: meson.project_version(),
-              description: 'A simple example D library.',
-              d_module_versions: ['FeatureA']
-)
-install_subdir('src/mylib/', install_dir: 'include/d/mylib/')
-```
-
-It is important to make the D sources install in a subdirectory in the
- include path, in this case `/usr/include/d/mylib/mylib`.
-All D compilers include the `/usr/include/d` directory by default, and
- if your library would be installed into `/usr/include/d/mylib`, there
-is a high chance that, when you compile your project again on a
-machine where you installed it, the compiler will prefer the old
-installed include over the new version in the source tree, leading to
-very confusing errors.
-
-This is an example of how to use the D library we just built and
-installed in an application:
-```meson
-project('myapp', 'd')
-
-mylib_dep = dependency('mylib', version: '>= 1.2.0')
-myapp_src = ['app.d', 'alpha.d', 'beta.d']
-executable('myapp', myapp_src, dependencies: [mylib_dep])
-```
-
-Please keep in mind that the library and executable would both need to
-be built with the exact same D compiler and D compiler version. The D
-ABI is not stable across compilers and their versions, and mixing
-compilers will lead to problems.
-
-# Integrating with DUB
-
-DUB is a fully integrated build system for D, but it is also a way to
-provide dependencies. Adding dependencies from the [D package registry](https://code.dlang.org/)
-is pretty straight forward. You can find how to do this in
-[Dependencies](Dependencies.md#some-notes-on-dub). You can also automatically
-generate a `dub.json` file as explained in [Dlang](Dlang-module.md#generate_dub_file).
diff --git a/meson/docs/markdown/Dependencies.md b/meson/docs/markdown/Dependencies.md
deleted file mode 100644 (file)
index a8f6d8a..0000000
+++ /dev/null
@@ -1,612 +0,0 @@
----
-short-description: Dependencies for external libraries and frameworks
-...
-
-# Dependencies
-
-Very few applications are fully self-contained, but rather they use
-external libraries and frameworks to do their work. Meson makes it
-very easy to find and use external dependencies. Here is how one would
-use the zlib compression library.
-
-```meson
-zdep = dependency('zlib', version : '>=1.2.8')
-exe = executable('zlibprog', 'prog.c', dependencies : zdep)
-```
-
-First Meson is told to find the external library `zlib` and error out
-if it is not found. The `version` keyword is optional and specifies a
-version requirement for the dependency. Then an executable is built
-using the specified dependency. Note how the user does not need to
-manually handle compiler or linker flags or deal with any other
-minutiae.
-
-If you have multiple dependencies, pass them as an array:
-
-```meson
-executable('manydeps', 'file.c', dependencies : [dep1, dep2, dep3, dep4])
-```
-
-If the dependency is optional, you can tell Meson not to error out if
-the dependency is not found and then do further configuration.
-
-```meson
-opt_dep = dependency('somedep', required : false)
-if opt_dep.found()
-  # Do something.
-else
-  # Do something else.
-endif
-```
-
-You can pass the `opt_dep` variable to target construction functions
-whether the actual dependency was found or not. Meson will ignore
-non-found dependencies.
-
-Meson also allows to get variables that are defined in the
-`pkg-config` file. This can be done by using the
-`get_pkgconfig_variable` function.
-
-```meson
-zdep_prefix = zdep.get_pkgconfig_variable('prefix')
-```
-
-These variables can also be redefined by passing the `define_variable`
-parameter, which might be useful in certain situations:
-
-```meson
-zdep_prefix = zdep.get_pkgconfig_variable('libdir', define_variable: ['prefix', '/tmp'])
-```
-
-The dependency detector works with all libraries that provide a
-`pkg-config` file. Unfortunately several packages don't provide
-pkg-config files. Meson has autodetection support for some of these,
-and they are described [later in this
-page](#dependencies-with-custom-lookup-functionality).
-
-# Arbitrary variables from dependencies that can be found multiple ways
-
-*Note* new in 0.51.0
-*new in 0.54.0, the `internal` keyword*
-
-When you need to get an arbitrary variables from a dependency that can be
-found multiple ways and you don't want to constrain the type you can use
-the generic `get_variable` method. This currently supports cmake, pkg-config,
-and config-tool based variables.
-
-```meson
-foo_dep = dependency('foo')
-var = foo_dep.get_variable(cmake : 'CMAKE_VAR', pkgconfig : 'pkg-config-var', configtool : 'get-var', default_value : 'default')
-```
-
-It accepts the keywords 'cmake', 'pkgconfig', 'pkgconfig_define',
-'configtool', 'internal', and 'default_value'. 'pkgconfig_define' works just
-like the 'define_variable' argument to `get_pkgconfig_variable`. When this
-method is invoked the keyword corresponding to the underlying type of the
-dependency will be used to look for a variable. If that variable cannot be
-found or if the caller does not provide an argument for the type of
-dependency, one of the following will happen: If 'default_value' was provided
-that value will be returned, if 'default_value' was not provided then an
-error will be raised.
-
-# Declaring your own
-
-You can declare your own dependency objects that can be used
-interchangeably with dependency objects obtained from the system. The
-syntax is straightforward:
-
-```meson
-my_inc = include_directories(...)
-my_lib = static_library(...)
-my_dep = declare_dependency(link_with : my_lib,
-  include_directories : my_inc)
-```
-
-This declares a dependency that adds the given include directories and
-static library to any target you use it in.
-
-# Building dependencies as subprojects
-
-Many platforms do not provide a system package manager. On these
-systems dependencies must be compiled from source. Meson's subprojects
-make it simple to use system dependencies when they are available and
-to build dependencies manually when they are not.
-
-To make this work, the dependency must have Meson build definitions
-and it must declare its own dependency like this:
-
-```meson
-    foo_dep = declare_dependency(...)
-```
-
-Then any project that wants to use it can write out the following
-declaration in their main `meson.build` file.
-
-```meson
-    foo_dep = dependency('foo', fallback : ['foo', 'foo_dep'])
-```
-
-What this declaration means is that first Meson tries to look up the
-dependency from the system (such as by using pkg-config). If it is not
-available, then it builds subproject named `foo` and from that
-extracts a variable `foo_dep`. That means that the return value of
-this function is either an external or an internal dependency
-object. Since they can be used interchangeably, the rest of the build
-definitions do not need to care which one it is. Meson will take care
-of all the work behind the scenes to make this work.
-
-# Dependency method
-
-You can use the keyword `method` to let meson know what method to use
-when searching for the dependency. The default value is `auto`.
-Additional dependencies methods are `pkg-config`, `config-tool`, `cmake`,
-`system`, `sysconfig`, `qmake`, `extraframework` and `dub`.
-
-```meson
-cups_dep = dependency('cups', method : 'pkg-config')
-```
-
-The dependency method order for `auto` is:
-
-  1. `pkg-config`
-  2. `cmake`
-  3. `extraframework` (OSX only)
-
-## CMake
-
-Meson can use the CMake `find_package()` function to detect
-dependencies with the builtin `Find<NAME>.cmake` modules and exported
-project configurations (usually in `/usr/lib/cmake`). Meson is able
-to use both the old-style `<NAME>_LIBRARIES` variables as well as
-imported targets.
-
-It is possible to manually specify a list of CMake targets that should
-be used with the `modules` property. However, this step is optional
-since meson tries to automatically guess the correct target based on the
-name of the dependency.
-
-Depending on the dependency it may be necessary to explicitly specify
-a CMake target with the `modules` property if meson is unable to guess
-it automatically.
-
-```meson
-    cmake_dep = dependency('ZLIB', method : 'cmake', modules : ['ZLIB::ZLIB'])
-```
-
-Support for adding additional `COMPONENTS` for the CMake `find_package` lookup
-is provided with the `components` kwarg (*introduced in 0.54.0*). All specified
-componets will be passed directly to `find_package(COMPONENTS)`.
-
-It is also possible to reuse existing `Find<name>.cmake` files with the
-`cmake_module_path` property. Using this property is equivalent to setting the
-`CMAKE_MODULE_PATH` variable in CMake. The path(s) given to `cmake_module_path`
-should all be relative to the project source directory. Absolute paths
-should only be used if the CMake files are not stored in the project itself.
-
-Additional CMake parameters can be specified with the `cmake_args` property.
-
-## Dub
-
-Please understand that meson is only able to find dependencies that
-exist in the local Dub repository. You need to manually fetch and
-build the target dependencies.
-
-For `urld`.
-```
-dub fetch urld
-dub build urld
-```
-
-Other thing you need to keep in mind is that both meson and Dub need
-to be using the same compiler. This can be achieved using Dub's
-`-compiler` argument and/or manually setting the `DC` environment
-variable when running meson.
-```
-dub build urld --compiler=dmd
-DC="dmd" meson builddir
-```
-
-# Dependencies with custom lookup functionality
-
-Some dependencies have specific detection logic.
-
-Generic dependency names are case-sensitive<sup>[1](#footnote1)</sup>,
-but these dependency names are matched case-insensitively.  The
-recommended style is to write them in all lower-case.
-
-In some cases, more than one detection method exists, and the `method` keyword
-may be used to select a detection method to use.  The `auto` method uses any
-checking mechanisms in whatever order meson thinks is best.
-
-e.g. libwmf and CUPS provide both pkg-config and config-tool support. You can
-force one or another via the `method` keyword:
-
-```meson
-cups_dep = dependency('cups', method : 'pkg-config')
-wmf_dep = dependency('libwmf', method : 'config-tool')
-```
-
-## Dependencies using config tools
-
-[CUPS](#cups), [LLVM](#llvm), [pcap](#pcap), [WxWidgets](#wxwidgets),
-[libwmf](#libwmf), [GCrypt](#libgcrypt), [GPGME](#gpgme), and GnuStep either do not provide pkg-config
-modules or additionally can be detected via a config tool
-(cups-config, llvm-config, libgcrypt-config, etc). Meson has native support for these
-tools, and they can be found like other dependencies:
-
-```meson
-pcap_dep = dependency('pcap', version : '>=1.0')
-cups_dep = dependency('cups', version : '>=1.4')
-llvm_dep = dependency('llvm', version : '>=4.0')
-libgcrypt_dep = dependency('libgcrypt', version: '>= 1.8')
-gpgme_dep = dependency('gpgme', version: '>= 1.0')
-```
-
-*Since 0.55.0* Meson won't search $PATH any more for a config tool binary when
-cross compiling if the config tool did not have an entry in the cross file.
-
-## AppleFrameworks
-
-Use the `modules` keyword to list frameworks required, e.g.
-
-```meson
-dep = dependency('appleframeworks', modules : 'foundation')
-```
-
-These dependencies can never be found for non-OSX hosts.
-
-## Blocks
-
-Enable support for Clang's blocks extension.
-
-```meson
-dep = dependency('blocks')
-```
-
-*(added 0.52.0)*
-
-## Boost
-
-Boost is not a single dependency but rather a group of different
-libraries. To use Boost headers-only libraries, simply add Boost as a
-dependency.
-
-```meson
-boost_dep = dependency('boost')
-exe = executable('myprog', 'file.cc', dependencies : boost_dep)
-```
-
-To link against boost with Meson, simply list which libraries you
-would like to use.
-
-```meson
-boost_dep = dependency('boost', modules : ['thread', 'utility'])
-exe = executable('myprog', 'file.cc', dependencies : boost_dep)
-```
-
-You can call `dependency` multiple times with different modules and
-use those to link against your targets.
-
-If your boost headers or libraries are in non-standard locations you
-can set the BOOST_ROOT, BOOST_INCLUDEDIR, and/or BOOST_LIBRARYDIR
-environment variables.
-
-You can set the argument `threading` to `single` to use boost
-libraries that have been compiled for single-threaded use instead.
-
-## CUDA
-
-*(added 0.53.0)*
-
-Enables compiling and linking against the CUDA Toolkit. The `version`
-and `modules` keywords may be passed to request the use of a specific
-CUDA Toolkit version and/or additional CUDA libraries, correspondingly:
-
-```meson
-dep = dependency('cuda', version : '>=10', modules : ['cublas'])
-```
-
-Note that explicitly adding this dependency is only necessary if you are
-using CUDA Toolkit from a C/C++ file or project, or if you are utilizing
-additional toolkit libraries that need to be explicitly linked to.
-
-## CUPS
-
-`method` may be `auto`, `config-tool`, `pkg-config`, `cmake` or `extraframework`.
-
-## Fortran Coarrays
-
-*(added 0.50.0)*
-
- Coarrays are a Fortran language intrinsic feature, enabled by
-`dependency('coarray')`.
-
-GCC will use OpenCoarrays if present to implement coarrays, while Intel and NAG
-use internal coarray support.
-
-## GL
-
-This finds the OpenGL library in a way appropriate to the platform.
-
-`method` may be `auto`, `pkg-config` or `system`.
-
-## GTest and GMock
-
-GTest and GMock come as sources that must be compiled as part of your
-project. With Meson you don't have to care about the details, just
-pass `gtest` or `gmock` to `dependency` and it will do everything for
-you. If you want to use GMock, it is recommended to use GTest as well,
-as getting it to work standalone is tricky.
-
-You can set the `main` keyword argument to `true` to use the `main()`
-function provided by GTest:
-
-```meson
-gtest_dep = dependency('gtest', main : true, required : false)
-e = executable('testprog', 'test.cc', dependencies : gtest_dep)
-test('gtest test', e)
-```
-
-## HDF5
-
-*(added 0.50.0)*
-
-HDF5 is supported for C, C++ and Fortran. Because dependencies are
-language-specific, you must specify the requested language using the
-`language` keyword argument, i.e.,
- * `dependency('hdf5', language: 'c')` for the C HDF5 headers and libraries
- * `dependency('hdf5', language: 'cpp')` for the C++ HDF5 headers and libraries
- * `dependency('hdf5', language: 'fortran')` for the Fortran HDF5 headers and libraries
-
-Meson uses pkg-config to find HDF5. The standard low-level HDF5 function and the `HL` high-level HDF5 functions are linked for each language.
-
-
-## libwmf
-
-*(added 0.44.0)*
-
-`method` may be `auto`, `config-tool` or `pkg-config`.
-
-## LLVM
-
-Meson has native support for LLVM going back to version LLVM version 3.5.
-It supports a few additional features compared to other config-tool based
-dependencies.
-
-As of 0.44.0 Meson supports the `static` keyword argument for
-LLVM. Before this LLVM >= 3.9 would always dynamically link, while
-older versions would statically link, due to a quirk in `llvm-config`.
-
-`method` may be `auto`, `config-tool`, or `cmake`.
-
-### Modules, a.k.a. Components
-
-Meson wraps LLVM's concept of components in it's own modules concept.
-When you need specific components you add them as modules as meson
-will do the right thing:
-
-```meson
-llvm_dep = dependency('llvm', version : '>= 4.0', modules : ['amdgpu'])
-```
-
-As of 0.44.0 it can also take optional modules (these will affect the arguments
-generated for a static link):
-
-```meson
-llvm_dep = dependency(
-  'llvm', version : '>= 4.0', modules : ['amdgpu'], optional_modules : ['inteljitevents'],
-)
-```
-
-### Using LLVM tools
-When using LLVM as library but also needing its tools, it is often beneficial to use the same version.
-This can partially be achieved with the `version` argument of `find_program()`.
-However, distributions tend to package different LLVM versions in rather different ways.
-Therefore, it is often better to use the llvm dependency directly to retrieve the tools:
-
-```meson
-llvm_dep = dependency('llvm', version : ['>= 8', '< 9'])
-llvm_link = find_program(llvm_dep.get_variable(configtool: 'bindir') / 'llvm-link')
-```
-
-## MPI
-
-*(added 0.42.0)*
-
-MPI is supported for C, C++ and Fortran. Because dependencies are
-language-specific, you must specify the requested language using the
-`language` keyword argument, i.e.,
- * `dependency('mpi', language: 'c')` for the C MPI headers and libraries
- * `dependency('mpi', language: 'cpp')` for the C++ MPI headers and libraries
- * `dependency('mpi', language: 'fortran')` for the Fortran MPI headers and libraries
-
-Meson prefers pkg-config for MPI, but if your MPI implementation does
-not provide them, it will search for the standard wrapper executables,
-`mpic`, `mpicxx`, `mpic++`, `mpifort`, `mpif90`, `mpif77`. If these
-are not in your path, they can be specified by setting the standard
-environment variables `MPICC`, `MPICXX`, `MPIFC`, `MPIF90`, or
-`MPIF77`, during configuration. It will also try to use the Microsoft
-implementation on windows via the `system` method.
-
-`method` may be `auto`, `config-tool`, `pkg-config` or `system`.
-
-*New in 0.54.0* The `config-tool` and `system` method values. Previous
-versions would always try `pkg-config`, then `config-tool`, then `system`.
-
-## NetCDF
-
-*(added 0.50.0)*
-
-NetCDF is supported for C, C++ and Fortran. Because NetCDF dependencies are
-language-specific, you must specify the requested language using the
-`language` keyword argument, i.e.,
- * `dependency('netcdf', language: 'c')` for the C NetCDF headers and libraries
- * `dependency('netcdf', language: 'cpp')` for the C++ NetCDF headers and libraries
- * `dependency('netcdf', language: 'fortran')` for the Fortran NetCDF headers and libraries
-
-Meson uses pkg-config to find NetCDF.
-
-
-## OpenMP
-
-*(added 0.46.0)*
-
-This dependency selects the appropriate compiler flags and/or libraries to use
-for OpenMP support.
-
-The `language` keyword may used.
-
-## pcap
-
-*(added 0.42.0)*
-
-`method` may be `auto`, `config-tool` or `pkg-config`.
-
-## libgcrypt
-
-*(added 0.49.0)*
-
-`method` may be `auto`, `config-tool` or `pkg-config`.
-
-## GPGME
-
-*(added 0.51.0)*
-
-`method` may be `auto`, `config-tool` or `pkg-config`.
-
-## Python3
-
-Python3 is handled specially by meson:
-1. Meson tries to use `pkg-config`.
-2. If `pkg-config` fails meson uses a fallback:
-    - On Windows the fallback is the current `python3` interpreter.
-    - On OSX the fallback is a framework dependency from `/Library/Frameworks`.
-
-Note that `python3` found by this dependency might differ from the one used in
-`python3` module because modules uses the current interpreter, but dependency tries
-`pkg-config` first.
-
-`method` may be `auto`, `extraframework`, `pkg-config` or `sysconfig`
-
-## Qt4 & Qt5
-
-Meson has native Qt support. Its usage is best demonstrated with an
-example.
-
-```meson
-qt5_mod = import('qt5')
-qt5widgets = dependency('qt5', modules : 'Widgets')
-
-processed = qt5_mod.preprocess(
-  moc_headers : 'mainWindow.h',   # Only headers that need moc should be put here
-  moc_sources : 'helperFile.cpp', # must have #include"moc_helperFile.cpp"
-  ui_files    : 'mainWindow.ui',
-  qresources  : 'resources.qrc',
-)
-
-q5exe = executable('qt5test',
-  sources     : ['main.cpp',
-                 'mainWindow.cpp',
-                 processed],
-  dependencies: qt5widgets)
-```
-
-Here we have an UI file created with Qt Designer and one source and
-header file each that require preprocessing with the `moc` tool. We
-also define a resource file to be compiled with `rcc`. We just have to
-tell Meson which files are which and it will take care of invoking all
-the necessary tools in the correct order, which is done with the
-`preprocess` method of the `qt5` module. Its output is simply put in
-the list of sources for the target. The `modules` keyword of
-`dependency` works just like it does with Boost. It tells which
-subparts of Qt the program uses.
-
-You can set the `main` keyword argument to `true` to use the `WinMain()`
-function provided by qtmain static library (this argument does nothing on platforms
-other than Windows).
-
-Setting the optional `private_headers` keyword to true adds the private header
-include path of the given module(s) to the compiler flags.  (since v0.47.0)
-
-**Note** using private headers in your project is a bad idea, do so at your own
-risk.
-
-`method` may be `auto`, `pkg-config` or `qmake`.
-
-## SDL2
-
-SDL2 can be located using `pkg-confg`, the `sdl2-config` config tool, or as an
-OSX framework.
-
-`method` may be `auto`, `config-tool`, `extraframework` or `pkg-config`.
-
-## Threads
-
-This dependency selects the appropriate compiler flags and/or libraries to use
-for thread support.
-
-See [threads](Threads.md).
-
-## Valgrind
-
-Meson will find valgrind using `pkg-config`, but only uses the compilation flags
-and avoids trying to link with it's non-PIC static libs.
-
-## Vulkan
-
-*(added 0.42.0)*
-
-Vulkan can be located using `pkg-config`, or the `VULKAN_SDK` environment variable.
-
-`method` may be `auto`, `pkg-config` or `system`.
-
-## WxWidgets
-
-Similar to [Boost](#boost), WxWidgets is not a single library but rather
-a collection of modules. WxWidgets is supported via `wx-config`.
-Meson substitutes `modules` to `wx-config` invocation, it generates
-- `compile_args` using `wx-config --cxxflags $modules...`
-- `link_args` using `wx-config --libs $modules...`
-
-### Example
-
-```meson
-wx_dep = dependency(
-  'wxwidgets', version : '>=3.0.0', modules : ['std', 'stc'],
-)
-```
-
-```shell
-# compile_args:
-$ wx-config --cxxflags std stc
-
-# link_args:
-$ wx-config --libs std stc
-```
-
-## Shaderc
-
-*(added 0.51.0)*
-
-Shaderc currently does not ship with any means of detection. Nevertheless, Meson
-can try to detect it using `pkg-config`, but will default to looking for the
-appropriate library manually. If the `static` keyword argument is `true`,
-`shaderc_combined` is preferred. Otherwise, `shaderc_shared` is preferred. Note
-that it is not possible to obtain the shaderc version using this method.
-
-`method` may be `auto`, `pkg-config` or `system`.
-
-## Zlib
-
-Zlib ships with pkg-config and cmake support, but on some operating systems
-(windows, macOs, FreeBSD, dragonflybsd), it is provided as part of the base
-operating system without pkg-config support. The new System finder can be used
-on these OSes to link with the bundled version.
-
-`method` may be `auto`, `pkg-config`, `cmake`, or `system`.
-
-*New in 0.54.0* the `system` method.
-
-<hr>
-<a name="footnote1">1</a>: They may appear to be case-insensitive, if the
-    underlying file system happens to be case-insensitive.
diff --git a/meson/docs/markdown/Design-rationale.md b/meson/docs/markdown/Design-rationale.md
deleted file mode 100644 (file)
index 7121192..0000000
+++ /dev/null
@@ -1,258 +0,0 @@
----
-title: Design rationale
-...
-
-This is the original design rationale for Meson. The syntax it describes does not match the released version
-==
-
-A software developer's most important tool is the editor. If you talk
-to coders about the editors they use, you are usually met with massive
-enthusiasm and praise. You will hear how Emacs is the greatest thing
-ever or how vi is so elegant or how Eclipse's integration features
-make you so much more productive. You can sense the enthusiasm and
-affection that the people feel towards these programs.
-
-The second most important tool, even more important than the compiler,
-is the build system.
-
-Those are pretty much universally despised.
-
-The most positive statement on build systems you can usually get (and
-it might require some coaxing) is something along the lines of *well,
-it's a terrible system, but all other options are even worse*. It is
-easy to see why this is the case. For starters, commonly used free
-build systems have obtuse syntaxes. They use for the most part global
-variables that are set in random locations so you can never really be
-sure what a given line of code does. They do strange and unpredictable
-things at every turn.
-
-Let's illustrate this with a simple example. Suppose we want to run a
-program built with GNU Autotools under GDB. The instinctive thing to
-do is to just run `gdb programname`. The problem is that this may or
-may not work. In some cases the executable file is a binary whereas at
-other times it is a wrapper shell script that invokes the real binary
-which resides in a hidden subdirectory. GDB invocation fails if the
-binary is a script but succeeds if it is not. The user has to remember
-the type of each one of his executables (which is an implementation
-detail of the build system) just to be able to debug them. Several
-other such pain points can be found in [this blog
-post](http://voices.canonical.com/jussi.pakkanen/2011/09/13/autotools/).
-
-Given these idiosyncrasies it is no wonder that most people don't want
-to have anything to do with build systems. They'll just copy-paste
-code that works (somewhat) in one place to another and hope for the
-best. They actively go out of their way not to understand the system
-because the mere thought of it is repulsive. Doing this also provides
-a kind of inverse job security. If you don't know tool X, there's less
-chance of finding yourself responsible for its use in your
-organisation. Instead you get to work on more enjoyable things.
-
-This leads to a vicious circle. Since people avoid the tools and don't
-want to deal with them, very few work on improving them. The result is
-apathy and stagnation.
-
-Can we do better?
---
-
-At its core, building C and C++ code is not a terribly difficult
-task. In fact, writing a text editor is a lot more complicated and
-takes more effort. Yet we have lots of very high quality editors but
-only few build systems with questionable quality and usability.
-
-So, in the grand tradition of own-itch-scratching, I decided to run a
-scientific experiment. The purpose of this experiment was to explore
-what would it take to build a "good" build system. What kind of syntax
-would suit this problem? What sort of problems would this application
-need to solve? What sort of solutions would be the most appropriate?
-
-To get things started, here is a list of requirements any modern cross-platform build system needs to provide.
-
-### 1. Must be simple to use
-
-One of the great virtues of Python is the fact that it is very
-readable. It is easy to see what a given block of code does. It is
-concise, clear and easy to understand. The proposed build system must
-be syntactically and semantically clean. Side effects, global state
-and interrelations must be kept at a minimum or, if possible,
-eliminated entirely.
-
-### 2. Must do the right thing by default
-
-Most builds are done by developers working on the code. Therefore the
-defaults must be tailored towards that use case. As an example the
-system shall build objects without optimization and with debug
-information. It shall make binaries that can be run directly from the
-build directory without linker tricks, shell scripts or magic
-environment variables.
-
-### 3. Must enforce established best practices
-
-There really is no reason to compile source code without the
-equivalent of `-Wall`. So enable it by default. A different kind of
-best practice is the total separation of source and build
-directories. All build artifacts must be stored in the build
-directory. Writing stray files in the source directory is not
-permitted under any circumstances.
-
-### 4. Must have native support for platforms that are in common use
-
-A lot of free software projects can be used on non-free platforms such
-as Windows or OSX. The system must provide native support for the
-tools of choice on those platforms. In practice this means native
-support for Visual Studio and XCode. Having said IDEs invoke external
-builder binaries does not count as native support.
-
-### 5. Must not add complexity due to obsolete platforms
-
-Work on this build system started during the Christmas holidays of 2012.
-This provides a natural hard cutoff line of 2012/12/24. Any
-platform, tool or library that was not in active use at that time is
-explicitly not supported. These include Unixes such as IRIX, SunOS,
-OSF-1, Ubuntu versions older than 12/10, GCC versions older than 4.7
-and so on. If these old versions happen to work, great. If they don't,
-not a single line of code will be added to the system to work around
-their bugs.
-
-### 6. Must be fast
-
-Running the configuration step on a moderate sized project must not
-take more than five seconds. Running the compile command on a fully up
-to date tree of 1000 source files must not take more than 0.1 seconds.
-
-### 7. Must provide easy to use support for modern sw development features
-
-An example is precompiled headers. Currently no free software build
-system provides native support for them. Other examples could include
-easy integration of Valgrind and unit tests, test coverage reporting
-and so on.
-
-### 8. Must allow override of default values
-
-Sometimes you just have to compile files with only given compiler
-flags and no others, or install files in weird places. The system must
-allow the user to do this if he really wants to.
-
-Overview of the solution
---
-
-Going over these requirements it becomes quite apparent that the only
-viable approach is roughly the same as taken by CMake: having a domain
-specific language to declare the build system. Out of this declaration
-a configuration is generated for the backend build system. This can be
-a Makefile, Visual Studio or XCode project or anything else.
-
-The difference between the proposed DSL and existing ones is that the
-new one is declarative. It also tries to work on a higher level of
-abstraction than existing systems. As an example, using external
-libraries in current build systems means manually extracting and
-passing around compiler flags and linker flags. In the proposed system
-the user just declares that a given build target uses a given external
-dependency. The build system then takes care of passing all flags and
-settings to their proper locations. This means that the user can focus
-on his own code rather than marshalling command line arguments from
-one place to another.
-
-A DSL is more work than the approach taken by SCons, which is to
-provide the system as a Python library. However it allows us to make
-the syntax more expressive and prevent certain types of bugs by
-e.g. making certain objects truly immutable. The end result is again
-the same: less work for the user.
-
-The backend for Unix requires a bit more thought. The default choice
-would be Make. However it is extremely slow. It is not uncommon on
-large code bases for Make to take several minutes just to determine
-that nothing needs to be done. Instead of Make we use
-[Ninja](https://ninja-build.org/), which is extremely fast. The
-backend code is abstracted away from the core, so other backends can
-be added with relatively little effort.
-
-Sample code
---
-
-Enough design talk, let's get to the code. Before looking at the
-examples we would like to emphasize that this is not in any way the
-final code. It is proof of concept code that works in the system as it
-currently exists (February 2013), but may change at any time.
-
-Let's start simple. Here is the code to compile a single executable binary.
-
-```meson
-project('compile one', 'c')
-executable('program', 'prog.c')
-```
-
-This is about as simple as one can get. First you declare the project
-name and the languages it uses. Then you specify the binary to build
-and its sources. The build system will do all the rest. It will add
-proper suffixes (e.g. '.exe' on Windows), set the default compiler
-flags and so on.
-
-Usually programs have more than one source file. Listing them all in
-the function call can become unwieldy. That is why the system supports
-keyword arguments. They look like this.
-
-```meson
-project('compile several', 'c')
-sourcelist = ['main.c', 'file1.c', 'file2.c', 'file3.c']
-executable('program', sources : sourcelist)
-```
-
-External dependencies are simple to use.
-
-```meson
-project('external lib', 'c')
-libdep = find_dep('extlibrary', required : true)
-sourcelist = ['main.c', 'file1.c', 'file2.c', 'file3.c']
-executable('program', sources : sourcelist, dep : libdep)
-```
-
-In other build systems you have to manually add the compile and link
-flags from external dependencies to targets. In this system you just
-declare that extlibrary is mandatory and that the generated program
-uses that. The build system does all the plumbing for you.
-
-Here's a slightly more complicated definition. It should still be
-understandable.
-
-```meson
-project('build library', 'c')
-foolib = shared_library('foobar', sources : 'foobar.c',\
-install : true)
-exe = executable('testfoobar', 'tester.c', link : foolib)
-add_test('test library', exe)
-```
-
-First we build a shared library named foobar. It is marked
-installable, so running `meson install` installs it to the library
-directory (the system knows which one so the user does not have to
-care). Then we build a test executable which is linked against the
-library. It will not be installed, but instead it is added to the list
-of unit tests, which can be run with the command `meson test`.
-
-Above we mentioned precompiled headers as a feature not supported by
-other build systems. Here's how you would use them.
-
-```meson
-project('pch demo', 'cxx')
-executable('myapp', 'myapp.cpp', pch : 'pch/myapp.hh')
-```
-
-The main reason other build systems can not provide pch support this
-easily is because they don't enforce certain best practices. Due to
-the way include paths work, it is impossible to provide pch support
-that always works with both in-source and out-of-source
-builds. Mandating separate build and source directories makes this and
-many other problems a lot easier.
-
-Get the code
---
-
-The code for this experiment can be found at [the Meson
-repository](https://sourceforge.net/p/meson/code/). It should be noted
-that it is not a build system. It is only a proposal for one. It does
-not work reliably yet. You probably should not use it as the build
-system of your project.
-
-All that said I hope that this experiment will eventually turn into a
-full blown build system. For that I need your help. Comments and
-especially patches are more than welcome.
diff --git a/meson/docs/markdown/Disabler.md b/meson/docs/markdown/Disabler.md
deleted file mode 100644 (file)
index 4aed7ad..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
----
-short-description: Disabling options
-...
-
-# Disabling parts of the build
-
-*This feature is available since version 0.44.0.*
-
-The following is a common fragment found in many projects:
-
-```meson
-dep = dependency('foo')
-
-# In some different directory
-
-lib = shared_library('mylib', 'mylib.c',
-  dependencies : dep)
-
-# And ín a third directory
-
-exe = executable('mytest', 'mytest.c',
-  link_with : lib)
-test('mytest', exe)
-```
-
-This works fine but gets a bit inflexible when you want to make this
-part of the build optional. Basically it reduces to adding `if/else`
-statements around all target invocations. Meson provides a simpler way
-of achieving the same with a disabler object.
-
-A disabler object is created with the `disabler` function:
-
-```meson
-d = disabler()
-```
-
-The only thing you can do to a disabler object is to ask if it has
-been found:
-
-```meson
-f = d.found() # returns false
-```
-
-Any other statement that uses a disabler object will immediately
-return a disabler. For example assuming that `d` contains a disabler
-object then
-
-```meson
-d2 = some_func(d) # value of d2 will be disabler
-d3 = true or d2   # value of d3 will be true because of short-circuiting
-d4 = false or d2  # value of d4 will be disabler
-if d              # neither branch is evaluated
-```
-
-Thus to disable every target that depends on the dependency given
-above, you can do something like this:
-
-```meson
-if use_foo_feature
-  d = dependency('foo')
-else
-  d = disabler()
-endif
-```
-
-This concentrates the handling of this option in one place and other
-build definition files do not need to be sprinkled with `if`
-statements.
diff --git a/meson/docs/markdown/Dlang-module.md b/meson/docs/markdown/Dlang-module.md
deleted file mode 100644 (file)
index 677359d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# Dlang module
-
-This module provides tools related to the D programming language.
-
-## Usage
-
-To use this module, just do: **`dlang = import('dlang')`**.
-You can, of course, replace the name `dlang` with anything else.
-
-The module only exposes one function, `generate_dub_file`, used to
-automatically generate Dub configuration files.
-
-### generate_dub_file()
-This method only has two required arguments, the project name and the
-source folder. You can pass other arguments with additional keywords,
-they will be automatically translated to json and added to the
-`dub.json` file.
-
-**Structure**
-```meson
-generate_dub_file("project name", "source/folder", key: "value" ...)
-```
-
-**Example**
-```meson
-dlang = import('dlang')
-dlang.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
-                        authors: 'Meson Team',
-                        description: 'Test executable',
-                        copyright: 'Copyright © 2018, Meson Team',
-                        license: 'MIT',
-                        sourceFiles: 'test.d',
-                        targetType: 'executable',
-                        dependencies: my_dep
-)
-```
-
-You can manually edit a meson generated `dub.json` file or provide a
-initial one. The module will only update the values specified in
-`generate_dub_file()`.
-
-Although not required, you will need to have a `description` and
-`license` if you want to publish the package in the [D package registry](https://code.dlang.org/).
diff --git a/meson/docs/markdown/External-commands.md b/meson/docs/markdown/External-commands.md
deleted file mode 100644 (file)
index 272182c..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
----
-short-description: Running external commands
-...
-
-# External commands
-
-As a part of the software configuration, you may want to get extra
-data by running external commands. The basic syntax is the following.
-
-```meson
-r = run_command('command', 'arg1', 'arg2', 'arg3')
-if r.returncode() != 0
-  # it failed
-endif
-output = r.stdout().strip()
-errortxt = r.stderr().strip()
-```
-
-Since 0.52.0, you can pass the command environment as a dictionary:
-
-```meson
-run_command('command', 'arg1', 'arg2', env: {'FOO': 'bar'})
-```
-
-Since 0.50.0, you can also pass the command
-[`environment`](Reference-manual.md#environment-object) object:
-
-```meson
-env = environment()
-env.set('FOO', 'bar')
-run_command('command', 'arg1', 'arg2', env: env)
-```
-
-The `run_command` function returns an object that can be queried for
-return value and text written to stdout and stderr. The `strip` method
-call is used to strip trailing and leading whitespace from
-strings. Usually output from command line programs ends in a newline,
-which is unwanted in string variables. The first argument can be
-either a string or an executable you have detected earlier with
-`find_program`.
-
-Meson will autodetect scripts with a shebang line and run them with
-the executable/interpreter specified in it both on Windows and on Unixes.
-
-Note that you can not pass your command line as a single string. That
-is, calling `run_command('do_something foo bar')` will not work. You
-must either split up the string into separate arguments or pass the
-split command as an array. It should also be noted that Meson will not
-pass the command to the shell, so any command lines that try to use
-things such as environment variables, backticks or pipelines will not
-work. If you require shell semantics, write your command into a script
-file and call that with `run_command`.
diff --git a/meson/docs/markdown/FAQ.md b/meson/docs/markdown/FAQ.md
deleted file mode 100644 (file)
index 7a41443..0000000
+++ /dev/null
@@ -1,502 +0,0 @@
----
-title: FAQ
-...
-# Meson Frequently Asked Questions
-
-See also [How do I do X in Meson](howtox.md).
-
-## Why is it called Meson?
-
-When the name was originally chosen, there were two main limitations:
-there must not exist either a Debian package or a Sourceforge project
-of the given name. This ruled out tens of potential project names. At
-some point the name Gluon was considered. Gluons are elementary
-particles that hold protons and neutrons together, much like a build
-system's job is to take pieces of source code and a compiler and bind
-them to a complete whole.
-
-Unfortunately this name was taken, too. Then the rest of subatomic
-particles were examined and Meson was found to be available.
-
-## What is the correct way to use threads (such as pthreads)?
-
-```meson
-thread_dep = dependency('threads')
-```
-
-This will set up everything on your behalf. People coming from
-Autotools or CMake want to do this by looking for `libpthread.so`
-manually. Don't do that, it has tricky corner cases especially when
-cross compiling.
-
-## How to use Meson on a host where it is not available in system packages?
-
-Starting from version 0.29.0, Meson is available from the [Python
-Package Index](https://pypi.python.org/pypi/meson/), so installing it
-simply a matter of running this command:
-
-```console
-$ pip3 install <your options here> meson
-```
-
-If you don't have access to PyPI, that is not a problem either. Meson
-has been designed to be easily runnable from an extracted source
-tarball or even a git checkout. First you need to download Meson. Then
-use this command to set up you build instead of plain `meson`.
-
-```console
-$ /path/to/meson.py <options>
-```
-
-After this you don't have to care about invoking Meson any more. It
-remembers where it was originally invoked from and calls itself
-appropriately. As a user the only thing you need to do is to `cd` into
-your build directory and invoke `meson compile`.
-
-## Why can't I specify target files with a wildcard?
-
-Instead of specifying files explicitly, people seem to want to do this:
-
-```meson
-executable('myprog', sources : '*.cpp') # This does NOT work!
-```
-
-Meson does not support this syntax and the reason for this is
-simple. This can not be made both reliable and fast. By reliable we
-mean that if the user adds a new source file to the subdirectory,
-Meson should detect that and make it part of the build automatically.
-
-One of the main requirements of Meson is that it must be fast. This
-means that a no-op build in a tree of 10 000 source files must take no
-more than a fraction of a second. This is only possible because Meson
-knows the exact list of files to check. If any target is specified as
-a wildcard glob, this is no longer possible. Meson would need to
-re-evaluate the glob every time and compare the list of files produced
-against the previous list. This means inspecting the entire source
-tree (because the glob pattern could be `src/\*/\*/\*/\*.cpp` or
-something like that). This is impossible to do efficiently.
-
-The main backend of Meson is Ninja, which does not support wildcard
-matches either, and for the same reasons.
-
-Because of this, all source files must be specified explicitly.
-
-## But I really want to use wildcards!
-
-If the tradeoff between reliability and convenience is acceptable to
-you, then Meson gives you all the tools necessary to do wildcard
-globbing. You are allowed to run arbitrary commands during
-configuration. First you need to write a script that locates the files
-to compile. Here's a simple shell script that writes all `.c` files in
-the current directory, one per line.
-
-
-```bash
-#!/bin/sh
-
-for i in *.c; do
-  echo $i
-done
-```
-
-Then you need to run this script in your Meson file, convert the
-output into a string array and use the result in a target.
-
-```meson
-c = run_command('grabber.sh')
-sources = c.stdout().strip().split('\n')
-e = executable('prog', sources)
-```
-
-The script can be any executable, so it can be written in shell,
-Python, Lua, Perl or whatever you wish.
-
-As mentioned above, the tradeoff is that just adding new files to the
-source directory does *not* add them to the build automatically. To
-add them you need to tell Meson to reinitialize itself. The simplest
-way is to touch the `meson.build` file in your source root. Then Meson
-will reconfigure itself next time the build command is run. Advanced
-users can even write a small background script that utilizes a
-filesystem event queue, such as
-[inotify](https://en.wikipedia.org/wiki/Inotify), to do this
-automatically.
-
-## Should I use `subdir` or `subproject`?
-
-The answer is almost always `subdir`. Subproject exists for a very
-specific use case: embedding external dependencies into your build
-process. As an example, suppose we are writing a game and wish to use
-SDL. Let us further suppose that SDL comes with a Meson build
-definition. Let us suppose even further that we don't want to use
-prebuilt binaries but want to compile SDL for ourselves.
-
-In this case you would use `subproject`. The way to do it would be to
-grab the source code of SDL and put it inside your own source
-tree. Then you would do `sdl = subproject('sdl')`, which would cause
-Meson to build SDL as part of your build and would then allow you to
-link against it or do whatever else you may prefer.
-
-For every other use you would use `subdir`. As an example, if you
-wanted to build a shared library in one dir and link tests against it
-in another dir, you would do something like this:
-
-```meson
-project('simple', 'c')
-subdir('src')   # library is built here
-subdir('tests') # test binaries would link against the library here
-```
-
-## Why is there not a Make backend?
-
-Because Make is slow. This is not an implementation issue, Make simply
-can not be made fast. For further info we recommend you read [this
-post](http://neugierig.org/software/chromium/notes/2011/02/ninja.html)
-by Evan Martin, the author of Ninja. Makefiles also have a syntax that
-is very unpleasant to write which makes them a big maintenance burden.
-
-The only reason why one would use Make instead of Ninja is working on
-a platform that does not have a Ninja port. Even in this case it is an
-order of magnitude less work to port Ninja than it is to write a Make
-backend for Meson.
-
-Just use Ninja, you'll be happier that way. I guarantee it.
-
-## Why is Meson not just a Python module so I could code my build setup in Python?
-
-A related question to this is *Why is Meson's configuration language
-not Turing-complete?*
-
-There are many good reasons for this, most of which are summarized on
-this web page: [Against The Use Of Programming Languages in
-Configuration Files](https://taint.org/2011/02/18/001527a.html).
-
-In addition to those reasons, not exposing Python or any other "real"
-programming language makes it possible to port Meson's implementation
-to a different language. This might become necessary if, for example,
-Python turns out to be a performance bottleneck. This is an actual
-problem that has caused complications for GNU Autotools and SCons.
-
-## How do I do the equivalent of Libtools export-symbol and export-regex?
-
-Either by using [GCC symbol
-visibility](https://gcc.gnu.org/wiki/Visibility) or by writing a
-[linker
-script](https://ftp.gnu.org/old-gnu/Manuals/ld-2.9.1/html_mono/ld.html). This
-has the added benefit that your symbol definitions are in a standalone
-file instead of being buried inside your build definitions. An example
-can be found
-[here](https://github.com/jpakkane/meson/tree/master/test%20cases/linuxlike/3%20linker%20script).
-
-## My project works fine on Linux and MinGW but fails to link with MSVC due to a missing .lib file (fatal error LNK1181). Why?
-
-With GCC, all symbols on shared libraries are exported automatically
-unless you specify otherwise. With MSVC no symbols are exported by
-default. If your shared library exports no symbols, MSVC will silently
-not produce an import library file leading to failures. The solution
-is to add symbol visibility definitions [as specified in GCC
-wiki](https://gcc.gnu.org/wiki/Visibility).
-
-## I added some compiler flags and now the build fails with weird errors. What is happening?
-
-You probably did the equivalent to this:
-
-```meson
-executable('foobar', ...
-           c_args : '-some_arg -other_arg')
-```
-
-Meson is *explicit*. In this particular case it will **not**
-automatically split your strings at whitespaces, instead it will take
-it as is and work extra hard to pass it to the compiler unchanged,
-including quoting it properly over shell invocations. This is
-mandatory to make e.g. files with spaces in them work flawlessly. To
-pass multiple command line arguments, you need to explicitly put them
-in an array like this:
-
-```meson
-executable('foobar', ...
-           c_args : ['-some_arg', '-other_arg'])
-```
-
-## Why are changes to default project options ignored?
-
-You probably had a project that looked something like this:
-
-```meson
-project('foobar', 'cpp')
-```
-
-This defaults to `c++11` on GCC compilers. Suppose you want to use
-`c++14` instead, so you change the definition to this:
-
-```meson
-project('foobar', 'cpp', default_options : ['cpp_std=c++14'])
-```
-
-But when you recompile, it still uses `c++11`. The reason for this is
-that default options are only looked at when you are setting up a
-build directory for the very first time. After that the setting is
-considered to have a value and thus the default value is ignored. To
-change an existing build dir to `c++14`, either reconfigure your build
-dir with `meson configure` or delete the build dir and recreate it
-from scratch.
-
-The reason we don't automatically change the option value when the
-default is changed is that it is impossible to know to do that
-reliably. The actual question that we need to solve is "if the
-option's value is foo and the default value is bar, should we change
-the option value to bar also". There are many choices:
-
- - if the user has changed the value themselves from the default, then
-   we must not change it back
-
- - if the user has not changed the value, but changes the default
-   value, then this section's premise would seem to indicate that the
-   value should be changed
-
- - suppose the user changes the value from the default to foo, then
-   back to bar and then changes the default value to bar, the correct
-   step to take is ambiguous by itself
-
-In order to solve the latter question we would need to remember not
-only the current and old value, but also all the times the user has
-changed the value and from which value to which other value. Since
-people don't remember their own actions that far back, toggling
-between states based on long history would be confusing.
-
-Because of this we do the simple and understandable thing: default
-values are only defaults and will never affect the value of an option
-once set.
-
-## Does wrap download sources behind my back?
-
-It does not. In order for Meson to download anything from the net
-while building, two conditions must be met.
-
-First of all there needs to be a `.wrap` file with a download URL in
-the `subprojects` directory. If one does not exist, Meson will not
-download anything.
-
-The second requirement is that there needs to be an explicit
-subproject invocation in your `meson.build` files. Either
-`subproject('foobar')` or `dependency('foobar', fallback : ['foobar',
-'foo_dep'])`. If these declarations either are not in any build file
-or they are not called (due to e.g. `if/else`) then nothing is
-downloaded.
-
-If this is not sufficient for you, starting from release 0.40.0 Meson
-has a option called `wrap-mode` which can be used to disable wrap
-downloads altogether with `--wrap-mode=nodownload`. You can also
-disable dependency fallbacks altogether with `--wrap-mode=nofallback`,
-which also implies the `nodownload` option.
-
-If on the other hand, you want meson to always use the fallback
-for dependencies, even when an external dependency exists and could
-satisfy the version requirements, for example in order to make
-sure your project builds when fallbacks are used, you can use
-`--wrap-mode=forcefallback` since 0.46.0.
-
-## Why is Meson implemented in Python rather than [programming language X]?
-
-Because build systems are special in ways normal applications aren't.
-
-Perhaps the biggest limitation is that because Meson is used to build
-software at the very lowest levels of the OS, it is part of the core
-bootstrap for new systems. Whenever support for a new CPU architecture
-is added, Meson must run on the system before software using it can be
-compiled natively. This requirement adds two hard limitations.
-
-The first one is that Meson must have the minimal amount of
-dependencies, because they must all be built during the bootstrap to
-get Meson to work.
-
-The second is that Meson must support all CPU architectures, both
-existing and future ones. As an example many new programming languages
-have only an LLVM based compiler available. LLVM has limited CPU
-support compared to, say, GCC, and thus bootstrapping Meson on such
-platforms would first require adding new processor support to
-LLVM. This is in most cases unfeasible.
-
-A further limitation is that we want developers on as many platforms
-as possible to submit to Meson development using the default tools
-provided by their operating system. In practice what this means is
-that Windows developers should be able to contribute using nothing but
-Visual Studio.
-
-At the time of writing (April 2018) there are only three languages
-that could fulfill these requirements:
-
- - C
- - C++
- - Python
-
-Out of these we have chosen Python because it is the best fit for our
-needs.
-
-## I have proprietary compiler toolchain X that does not work with Meson, how can I make it work?
-
-Meson needs to know several details about each compiler in order to
-compile code with it. These include things such as which compiler
-flags to use for each option and how to detect the compiler from its
-output. This information can not be input via a configuration file,
-instead it requires changes to Meson's source code that need to be
-submitted to Meson master repository. In theory you can run your own
-forked version with custom patches, but that's not good use of your
-time. Please submit the code upstream so everyone can use the
-toolchain.
-
-The steps for adding a new compiler for an existing language are
-roughly the following. For simplicity we're going to assume a C
-compiler.
-
-- Create a new class with a proper name in
-  `mesonbuild/compilers/c.py`. Look at the methods that other
-  compilers for the same language have and duplicate what they do.
-
-- If the compiler can only be used for cross compilation, make sure to
-  flag it as such (see existing compiler classes for examples).
-
-- Add detection logic to `mesonbuild/environment.py`, look for a
-  method called `detect_c_compiler`.
-
-- Run the test suite and fix issues until the tests pass.
-
-- Submit a pull request, add the result of the test suite to your MR
-  (linking an existing page is fine).
-
-- If the compiler is freely available, consider adding it to the CI
-  system.
-
-## Why does building my project with MSVC output static libraries called `libfoo.a`?
-
-The naming convention for static libraries on Windows is usually
-`foo.lib`.  Unfortunately, import libraries are also called `foo.lib`.
-
-This causes filename collisions with the default library type where we
-build both shared and static libraries, and also causes collisions
-during installation since all libraries are installed to the same
-directory by default.
-
-To resolve this, we decided to default to creating static libraries of
-the form `libfoo.a` when building with MSVC. This has the following
-advantages:
-
-1. Filename collisions are completely avoided.
-1. The format for MSVC static libraries is `ar`, which is the same as the GNU
-   static library format, so using this extension is semantically correct.
-1. The static library filename format is now the same on all platforms and with
-   all toolchains.
-1. Both Clang and GNU compilers can search for `libfoo.a` when specifying
-   a library as `-lfoo`. This does not work for alternative naming schemes for
-   static libraries such as `libfoo.lib`.
-1. Since `-lfoo` works out of the box, pkgconfig files will work correctly for
-   projects built with both MSVC, GCC, and Clang on Windows.
-1. MSVC does not have arguments to search for library filenames, and [it does
-   not care what the extension is](https://docs.microsoft.com/en-us/cpp/build/reference/link-input-files?view=vs-2019),
-   so specifying `libfoo.a` instead of `foo.lib` does not change the workflow,
-   and is an improvement since it's less ambiguous.
-
-If, for some reason, you really need your project to output static libraries of
-the form `foo.lib` when building with MSVC, you can set the
-[`name_prefix:`](https://mesonbuild.com/Reference-manual.html#library)
-kwarg to `''` and the [`name_suffix:`](https://mesonbuild.com/Reference-manual.html#library)
-kwarg to `'lib'`. To get the default behaviour for each, you can either not
-specify the kwarg, or pass `[]` (an empty array) to it.
-
-## Do I need to add my headers to the sources list like in Autotools?
-
-Autotools requires you to add private and public headers to the sources list so
-that it knows what files to include in the tarball generated by `make dist`.
-Meson's `dist` command simply gathers everything committed to your git/hg
-repository and adds it to the tarball, so adding headers to the sources list is
-pointless.
-
-Meson uses Ninja which uses compiler dependency information to automatically
-figure out dependencies between C sources and headers, so it will rebuild
-things correctly when a header changes.
-
-The only exception to this are generated headers, for which you must [declare
-dependencies correctly](#how-do-i-tell-meson-that-my-sources-use-generated-headers).
-
-If, for whatever reason, you do add non-generated headers to the sources list
-of a target, Meson will simply ignore them.
-
-## How do I tell Meson that my sources use generated headers?
-
-Let's say you use a [`custom_target()`](https://mesonbuild.com/Reference-manual.html#custom_target)
-to generate the headers, and then `#include` them in your C code. Here's how
-you ensure that Meson generates the headers before trying to compile any
-sources in the build target:
-
-```meson
-libfoo_gen_headers = custom_target('gen-headers', ..., output: 'foo-gen.h')
-libfoo_sources = files('foo-utils.c', 'foo-lib.c')
-# Add generated headers to the list of sources for the build target
-libfoo = library('foo', sources: [libfoo_sources + libfoo_gen_headers])
-```
-
-Now let's say you have a new target that links to `libfoo`:
-
-```meson
-libbar_sources = files('bar-lib.c')
-libbar = library('bar', sources: libbar_sources, link_with: libfoo)
-```
-
-This adds a **link-time** dependency between the two targets, but note that the
-sources of the targets have **no compile-time** dependencies and can be built
-in any order; which improves parallelism and speeds up builds.
-
-If the sources in `libbar` *also* use `foo-gen.h`, that's a *compile-time*
-dependency, and you'll have to add `libfoo_gen_headers` to `sources:` for
-`libbar` too:
-
-```meson
-libbar_sources = files('bar-lib.c')
-libbar = library('bar', sources: libbar_sources + libfoo_gen_headers, link_with: libfoo)
-```
-
-Alternatively, if you have multiple libraries with sources that link to
-a library and also use its generated headers, this code is equivalent to above:
-
-```meson
-# Add generated headers to the list of sources for the build target
-libfoo = library('foo', sources: libfoo_sources + libfoo_gen_headers)
-
-# Declare a dependency that will add the generated headers to sources
-libfoo_dep = declare_dependency(link_with: libfoo, sources: libfoo_gen_headers)
-
-...
-
-libbar = library('bar', sources: libbar_sources, dependencies: libfoo_dep)
-```
-
-**Note:** You should only add *headers* to `sources:` while declaring
-a dependency. If your custom target outputs both sources and headers, you can
-use the subscript notation to get only the header(s):
-
-```meson
-libfoo_gen_sources = custom_target('gen-headers', ..., output: ['foo-gen.h', 'foo-gen.c'])
-libfoo_gen_headers = libfoo_gen_sources[0]
-
-# Add static and generated sources to the target
-libfoo = library('foo', sources: libfoo_sources + libfoo_gen_sources)
-
-# Declare a dependency that will add the generated *headers* to sources
-libfoo_dep = declare_dependency(link_with: libfoo, sources: libfoo_gen_headers)
-...
-libbar = library('bar', sources: libbar_sources, dependencies: libfoo_dep)
-```
-
-A good example of a generator that outputs both sources and headers is
-[`gnome.mkenums()`](https://mesonbuild.com/Gnome-module.html#gnomemkenums).
-
-## How do I disable exceptions and RTTI in my C++ project?
-
-With the `cpp_eh` and `cpp_rtti` options. A typical invocation would
-look like this:
-
-```
-meson -Dcpp_eh=none -Dcpp_rtti=false <other options>
-```
-
-The RTTI option is only available since Meson version 0.53.0.
diff --git a/meson/docs/markdown/Feature-autodetection.md b/meson/docs/markdown/Feature-autodetection.md
deleted file mode 100644 (file)
index 4d366d9..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
----
-short-description: Auto-detection of features like ccache and code coverage
-...
-
-# Feature autodetection
-
-Meson is designed for high productivity. It tries to do as many things
-automatically as it possibly can.
-
-Ccache
---
-
-[Ccache](https://ccache.dev/) is a cache system designed to make
-compiling faster. When you run Meson for the first time for a given
-project, it checks if Ccache is installed. If it is, Meson will use it
-automatically.
-
-If you do not wish to use Ccache for some reason, just specify your
-compiler with environment variables `CC` and/or `CXX` when first
-running Meson (remember that once specified the compiler can not be
-changed). Meson will then use the specified compiler without Ccache.
-
-Coverage
---
-
-When doing a code coverage build, Meson will check for existence of
-the binaries `gcovr`, `lcov` and `genhtml`. If version 3.3 or higher
-of the first is found, targets called *coverage-text*, *coverage-xml*
-and *coverage-html* are generated. Alternatively, if the latter two
-are found, only the target *coverage-html* is generated. Coverage
-reports can then be produced simply by calling e.g. `meson compile
-coverage-xml`. As a convenience, a high-level *coverage* target is
-also generated which will produce all 3 coverage report types, if
-possible.
-
-Note that generating any of the coverage reports described above
-requires the tests (i.e. `meson test`) to finish running so the
-information about the functions that are called in the tests can be
-gathered for the report.
diff --git a/meson/docs/markdown/Fs-module.md b/meson/docs/markdown/Fs-module.md
deleted file mode 100644 (file)
index e5941a9..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-# FS (filesystem) module
-
-This module provides functions to inspect the file system. It is
-available starting with version 0.53.0.
-
-## File lookup rules
-
-Non-absolute paths are looked up relative to the directory where the
-current `meson.build` file is.
-
-If specified, a leading `~` is expanded to the user home directory.
-Environment variables are not available as is the rule throughout Meson.
-That is, $HOME, %USERPROFILE%, $MKLROOT, etc. have no meaning to the Meson
-filesystem module. If needed, pass such variables into Meson via command
-line options in `meson_options.txt`, native-file or cross-file.
-
-Where possible, symlinks and parent directory notation are resolved to an
-absolute path.
-
-### exists
-
-Takes a single string argument and returns true if an entity with that
-name exists on the file system. This can be a file, directory or a
-special entry such as a device node.
-
-### is_dir
-
-Takes a single string argument and returns true if a directory with
-that name exists on the file system.
-
-### is_file
-
-Takes a single string argument and returns true if an file with that
-name exists on the file system.
-
-### is_symlink
-
-Takes a single string argument and returns true if the path pointed to
-by the string is a symbolic link.
-
-## File Parameters
-
-### is_absolute
-
-*since 0.54.0*
-
-Return a boolean indicating if the path string specified is absolute, WITHOUT expanding `~`.
-
-Examples:
-
-```meson
-fs.is_absolute('~')   # false
-
-home = fs.expanduser('~')
-fs.is_absolute(home)  # true
-
-fs.is_absolute(home / 'foo')  # true, even if ~/foo doesn't exist
-
-fs.is_absolute('foo/bar')  # false, even if ./foo/bar exists
-```
-
-### hash
-
-The `fs.hash(filename, hash_algorithm)` method returns a string containing
-the hexidecimal `hash_algorithm` digest of a file.
-`hash_algorithm` is a string; the available hash algorithms include:
-md5, sha1, sha224, sha256, sha384, sha512.
-
-### size
-
-The `fs.size(filename)` method returns the size of the file in integer bytes.
-
-### is_samepath
-
-The `fs.is_samepath(path1, path2)` returns boolean `true` if both paths resolve to the same path.
-For example, suppose path1 is a symlink and path2 is a relative path.
-If path1 can be resolved to path2, then `true` is returned.
-If path1 is not resolved to path2, `false` is returned.
-If path1 or path2 do not exist, `false` is returned.
-
-Examples:
-
-```meson
-x = 'foo.txt'
-y = 'sub/../foo.txt'
-z = 'bar.txt'  # a symlink pointing to foo.txt
-j = 'notafile.txt'  # non-existant file
-
-fs.is_samepath(x, y)  # true
-fs.is_samepath(x, z)  # true
-fs.is_samepath(x, j)  # false
-
-p = 'foo/bar'
-q = 'foo/bar/baz/..'
-r = 'buz'  # a symlink pointing to foo/bar
-s = 'notapath'  # non-existant directory
-
-fs.is_samepath(p, q)  # true
-fs.is_samepath(p, r)  # true
-fs.is_samepath(p, s)  # false
-```
-
-## Filename modification
-
-The files need not actually exist yet for these path string manipulation methods.
-
-### expanduser
-
-*since 0.54.0*
-
-A path string with a leading `~` is expanded to the user home directory
-
-Examples:
-
-```meson
-fs.expanduser('~')  # user home directory
-
-fs.expanduser('~/foo')  # <homedir>/foo
-```
-
-### as_posix
-
-*since 0.54.0*
-
-`fs.as_posix(path)` assumes a Windows path, even if on a Unix-like system.
-Thus, all `'\'` or `'\\'` are turned to '/', even if you meant to escape a character.
-
-Examples
-
-```meson
-fs.as_posix('\\') == '/'  # true
-fs.as_posix('\\\\') == '/'  # true
-
-fs.as_posix('foo\\bar/baz') == 'foo/bar/baz'  # true
-```
-
-### replace_suffix
-
-The `replace_suffix` method is a *string manipulation* convenient for filename modifications.
-It allows changing the filename suffix like:
-
-#### swap suffix
-
-```meson
-original = '/opt/foo.ini'
-new = fs.replace_suffix(original, '.txt')  # /opt/foo.txt
-```
-
-#### add suffix
-
-```meson
-original = '/opt/foo'
-new = fs.replace_suffix(original, '.txt')  # /opt/foo.txt
-```
-
-#### compound suffix swap
-
-```meson
-original = '/opt/foo.dll.a'
-new = fs.replace_suffix(original, '.so')  # /opt/foo.dll.so
-```
-
-#### delete suffix
-
-```meson
-original = '/opt/foo.dll.a'
-new = fs.replace_suffix(original, '')  # /opt/foo.dll
-```
-
-### parent
-
-Returns the parent directory (i.e. dirname).
-
-```meson
-new = fs.parent('foo/bar')  # foo
-new = fs.parent('foo/bar/baz.dll')  # foo/bar
-```
-
-### name
-
-Returns the last component of the path (i.e. basename).
-
-```meson
-fs.name('foo/bar/baz.dll.a')  # baz.dll.a
-```
-
-### stem
-
-*since 0.54.0*
-
-Returns the last component of the path, dropping the last part of the suffix
-
-```meson
-fs.stem('foo/bar/baz.dll')  # baz
-fs.stem('foo/bar/baz.dll.a')  # baz.dll
-```
diff --git a/meson/docs/markdown/Generating-sources.md b/meson/docs/markdown/Generating-sources.md
deleted file mode 100644 (file)
index e22112f..0000000
+++ /dev/null
@@ -1,202 +0,0 @@
----
-short-description: Generation of source files before compilation
-...
-
-# Generating sources
-
-Sometimes source files need to be preprocessed before they are passed
-to the actual compiler. As an example you might want build an IDL
-compiler and then run some files through that to generate actual
-source files. In Meson this is done with
-[`generator()`](Reference-manual.md#generator) or
-[`custom_target()`](Reference-manual.md#custom_target).
-
-## Using custom_target()
-
-Let's say you have a build target that must be built using sources
-generated by a compiler. The compiler can either be a built target:
-
-```meson
-mycomp = executable('mycompiler', 'compiler.c')
-```
-
-Or an external program provided by the system, or script inside the
-source tree:
-
-```meson
-mycomp = find_program('mycompiler')
-```
-
-Custom targets can take zero or more input files and use them to
-generate one or more output files. Using a custom target, you can run
-this compiler at build time to generate the sources:
-
-```meson
-gen_src = custom_target('gen-output',
-                        input : ['somefile1.c', 'file2.c'],
-                        output : ['out.c', 'out.h'],
-                        command : [mycomp, '@INPUT@',
-                                   '--c-out', '@OUTPUT0@',
-                                   '--h-out', '@OUTPUT1@'])
-```
-
-The `@INPUT@` there will be transformed to `'somefile1.c'
-'file2.c'`. Just like the output, you can also refer to each input
-file individually by index.
-
-Then you just put that in your program and you're done.
-
-### Generating headers
-
-Adding a generated header to a source list will ensure that the header is
-generated and that the proper include paths are created for the target:
-
-```meson
-prog_python = import('python').find_installation('python3')
-
-foo_c = custom_target(
-    'foo.c',
-    output : 'foo.c',
-    input : 'my_gen.py',
-    command : [prog_python, '@INPUT@', '--code', '@OUTPUT@'],
-)
-
-foo_h = custom_target(
-    'foo.h',
-    output : 'foo.h',
-    input : 'my_gen.py',
-    command : [prog_python, '@INPUT@', '--header', '@OUTPUT@'],
-)
-
-libfoo = static_library('foo', [foo_c, foo_h])
-
-executable('myexe', ['main.c', foo_h], link_with : libfoo)
-```
-
-Each target that depends on a generated header should add that header to it's sources,
-as seen above with `libfoo` and `myexe`. This is because there is no way for
-meson or the backend to know that `myexe` depends on `foo.h` just because
-`libfoo` does, it could be a private header.
-
-### Generating multiple files at a time
-
-Sometimes it makes sense for a single generator to create two or more files at
-a time, (perhaps a header and source file), meson has this case covered as
-well. `custom_target`s can be indexed like a list to get each output file
-separately. The order is the same as the order of the output argument to
-`custom_target`
-
-```meson
-prog_python = import('python').find_installation('python3')
-
-foo_ch = custom_target(
-    'foo.[ch]',
-    output : ['foo.c', 'foo.h'],
-    input : 'my_gen.py',
-    command : [prog_python, '@INPUT@', '@OUTPUT@'],
-)
-
-libfoo = static_library('foo', [foo_ch])
-
-executable('myexe', ['main.c', foo_ch[1]], link_with : libfoo)
-```
-
-In this case `libfoo` depends on both `foo.c` and `foo.h` but `myexe` only
-depends on `foo.h`, the second output.
-
-### Using dependencies to manage generated resources
-
-In some cases it might be easier to use `declare_dependency` to "bundle" the header
-and library dependency, especially if there are many generated headers:
-
-```meson
-idep_foo = declare_dependency(
-    sources : [foo_h, bar_h],
-    link_with : [libfoo],
-)
-```
-
-See [dependencies](Dependencies.md#declaring-your-own), and
-[reference](Reference-manual.md#declare_dependency) for more information.
-
-## Using generator()
-
-Generators are similar to custom targets, except that we define a
-*generator*, which defines how to transform an input file into one or
-more output files, and then use that on as many input files as we
-want.
-
-Note that generators should only be used for outputs that will only be
-used as inputs for a build target or a custom target. When you use the
-processed output of a generator in multiple targets, the generator
-will be run multiple times to create outputs for each target. Each
-output will be created in a target-private directory `@BUILD_DIR@`.
-
-If you want to generate files for general purposes such as for
-generating headers to be used by several sources, or data that will be
-installed, and so on, use a
-[`custom_target()`](Reference-manual.md#custom_target) instead.
-
-
-```meson
-gen = generator(mycomp,
-                output  : '@BASENAME@.c',
-                arguments : ['@INPUT@', '@OUTPUT@'])
-```
-
-The first argument is the executable file to run. The next file
-specifies a name generation rule. It specifies how to build the output
-file name for a given input name. `@BASENAME@` is a placeholder for
-the input file name without preceding path or suffix (if any). So if
-the input file name were `some/path/filename.idl`, then the output
-name would be `filename.c`. You can also use `@PLAINNAME@`, which
-preserves the suffix which would result in a file called
-`filename.idl.c`. The last line specifies the command line arguments
-to pass to the executable. `@INPUT@` and `@OUTPUT@` are placeholders
-for the input and output files, respectively, and will be
-automatically filled in by Meson. If your rule produces multiple
-output files and you need to pass them to the command line, append the
-location to the output holder like this: `@OUTPUT0@`, `@OUTPUT1@` and
-so on.
-
-With this rule specified we can generate source files and add them to
-a target.
-
-```meson
-gen_src = gen.process('input1.idl', 'input2.idl')
-executable('program', 'main.c', gen_src)
-```
-
-Generators can also generate multiple output files with unknown names:
-
-```meson
-gen2 = generator(someprog,
-                 output : ['@BASENAME@.c', '@BASENAME@.h'],
-                 arguments : ['--out_dir=@BUILD_DIR@', '@INPUT@'])
-```
-
-In this case you can not use the plain `@OUTPUT@` variable, as it
-would be ambiguous. This program only needs to know the output
-directory, it will generate the file names by itself.
-
-To make passing different additional arguments to the generator
-program at each use possible, you can use the `@EXTRA_ARGS@` string in
-the `arguments` list. Note that this placeholder can only be present
-as a whole string, and not as a substring. The main reason is that it
-represents a list of strings, which may be empty, or contain multiple
-elements; and in either case, interpolating it into the middle of a
-single string would be troublesome. If there are no extra arguments
-passed in from a `process()` invocation, the placeholder is entirely
-omitted from the actual list of arguments, so an empty string won't be
-passed to the generator program because of this. If there are multiple
-elements in `extra_args`, they are inserted into to the actual
-argument list as separate elements.
-
-```meson
-gen3 = generator(genprog,
-                 output : '@BASENAME@.cc',
-                 arguments : ['@INPUT@', '@EXTRA_ARGS@', '@OUTPUT@'])
-gen3_src1 = gen3.process('input1.y')
-gen3_src2 = gen3.process('input2.y', extra_args: '--foo')
-gen3_src3 = gen3.process('input3.y', extra_args: ['--foo', '--bar'])
-```
diff --git a/meson/docs/markdown/Getting-meson.md b/meson/docs/markdown/Getting-meson.md
deleted file mode 100644 (file)
index e0e5722..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-# Getting meson
-
-Meson is implemented in Python 3, and requires 3.5 or newer. If your operating
-system provides a package manager, you should install it with that. For
-platforms that don't have a package manager, you need to download it from
-[Python's home page]. See below for [platform-specific Python3
-quirks](#platformspecific-install-quirks).
-
-## Downloading Meson
-
-Meson releases can be downloaded from the [GitHub release page], and you can
-run `./meson.py` from inside a release or the git repository itself without
-doing anything special.
-
-On Windows, if you did not install Python with the installer options that make
-Python scripts executable, you will have to run `python /path/to/meson.py`,
-where `python` is Python 3.5 or newer.
-
-The newest development code can be obtained directly from [Git], and we strive
-to ensure that it will always be working and usable. All commits go through
-a pull-request process that runs CI and tests several platforms.
-
-## Installing Meson with pip
-
-Meson is available in the [Python Package Index] and can be installed with
-`pip3 install meson` which requires root and will install it system-wide.
-
-Alternatively, you can use `pip3 install --user meson` which will install it
-for your user and does not require any special privileges. This will install
-the package in `~/.local/`, so you will have to add `~/.local/bin` to your
-`PATH`.
-
-## Installing Meson and Ninja with the MSI installer
-
-We provide an MSI installer on the [GitHub release page] that can be used to
-install both Meson and Ninja at once for Windows. It also contains an embedded
-copy of Python, so scripts that use the [Python module](Python-module.md) and
-do not have any external dependencies will continue to work as expected.
-
-Please note that this is a new feature, so bug reports are expected and welcome!
-
-## Dependencies
-
-In the most common case, you will need the [Ninja executable] for using the
-`ninja` backend, which is the default in Meson. This backend can be used on all
-platforms and with all toolchains, including GCC, Clang, Visual Studio, MinGW,
-ICC, ARMCC, etc.
-
-You can use the version provided by your package manager if possible, otherwise
-download the binary executable from the [Ninja project's release
-page](https://github.com/ninja-build/ninja/releases).
-
-If you will only use the Visual Studio backend (`--backend=vs`) to generate
-Visual Studio solutions on Windows or the XCode backend (`--backend=xcode`) to
-generate XCode projects on macOS, you do not need Ninja.
-
-# Platform-specific install quirks
-
-## Windows Python3 quirks
-
-When installing Python 3, it is highly recommended (but not required) that you
-select the installer options as follows:
-
-![installer step 1](images/py3-install-1.png "Enable 'Add Python 3.6 to PATH' and click 'Customize installation'")
-![installer step 2](images/py3-install-2.png "Optional Features: ensure 'pip' is enabled")
-![installer step 3](images/py3-install-3.png "Advanced Options: enable 'Install for all users'")
-
-With this, you will have `python` and `pip` in `PATH`, and you can install
-Meson with pip. You will also be able to directly run `meson` in any shell on
-Windows instead of having to run `py -3` with the full path to the `meson.py`
-script.
-
-## MSYS2 Python3 quirks
-
-If you are using MSYS2 on Windows as your development environment, please make
-sure that you **do not use** the `msys/python` package to provide Python 3. Use
-either `mingw32/mingw-w64-i686-python3` or `mingw64/mingw-w64-x86_64-python3`
-depending on which MinGW target you are building for.
-
-  [GitHub release page]: https://github.com/mesonbuild/meson/releases
-  [Python Package Index]: https://pypi.python.org/pypi/meson/
-  [Git]: https://github.com/mesonbuild/meson
-  [Python's home page]: https://www.python.org/downloads/
-  [Ninja executable]: https://ninja-build.org/
diff --git a/meson/docs/markdown/Gnome-module.md b/meson/docs/markdown/Gnome-module.md
deleted file mode 100644 (file)
index 3d06233..0000000
+++ /dev/null
@@ -1,358 +0,0 @@
-# GNOME module
-
-This module provides helper tools for build operations needed when
-building Gnome/GLib programs.
-
-**Note**: the compilation commands here might not work properly when
-  you change the source files. This is a bug in the respective
-  compilers which do not expose the required dependency
-  information. This has been reported upstream in [this bug]. Until
-  this is fixed you need to be careful when changing your source
-  files.
-
-  [this bug]: https://bugzilla.gnome.org/show_bug.cgi?id=745754
-
-## Usage
-
-To use this module, just do: **`gnome = import('gnome')`**. The
-following functions will then be available as methods on the object
-with the name `gnome`. You can, of course, replace the name `gnome`
-with anything else.
-
-### gnome.compile_resources()
-
-This function compiles resources specified in an XML file into code
-that can be embedded inside the main binary. Similar a build target it
-takes two positional arguments. The first one is the name of the
-resource and the second is the XML file containing the resource
-definitions. If the name is `foobar`, Meson will generate a header
-file called `foobar.h`, which you can then include in your sources.
-
-* `c_name`: passed to the resource compiler as an argument after
-  `--c-name`
-* `dependencies`: extra targets to depend upon for building
-* `export`: (*Added 0.37.0*) if true, export the symbols of the
-  generated sources
-* `extra_args`: extra command line arguments to pass to the resource
-* `gresource_bundle`: (*Added 0.37.0*) if true, output a `.gresource`
-  file instead of source
-* `install`: (*Added 0.37.0*) if true, install the gresource file
-* `install_dir`: (*Added 0.37.0*) location to install the header or
-  bundle depending on previous options
-* `install_header`: (*Added 0.37.0*) if true, install the header file
-* `source_dir`: a list of directories where the resource compiler
-  should look up the files
-
-Returns an array containing: `[c_source, header_file]` or
-`[gresource_bundle]`
-
-Example:
-
-```meson
-gnome = import('gnome')
-
-asresources = gnome.compile_resources(
-    'as-resources', 'data/asresources.gresource.xml',
-    source_dir: 'data',
-    c_name: 'as'
-)
-
-executable(
-    meson.project_name(),
-    asresources,
-    dependencies: my_deps,
-    install: true
-)
-```
-
-### gnome.generate_gir()
-
-Generates GObject introspection data.
-
-Takes one or more positional arguments:
-
-Either one or more library objects you want to build gir data for, or a single
-executable object.
-
-There are several keyword arguments. Many of these map directly to the
-`g-ir-scanner` tool so see its documentation for more information.
-
-* `dependencies`: deps to use during introspection scanning
-* `extra_args`: command line arguments to pass to gir compiler
-* `export_packages`: extra packages the gir file exports
-* `sources`: the list of sources to be scanned for gir data
-* `nsversion`: namespace version
-* `namespace`: the namespace for this gir object which determines
-  output files
-* `identifier_prefix`: the identifier prefix for the gir object,
-  e.g. `Gtk`
-* `includes`: list of gir names to be included, can also be a GirTarget
-* `header`: *(Added 0.43.0)* name of main c header to include for the library, e.g. `glib.h`
-* `include_directories`: extra include paths to look for gir files
-* `install`: if true, install the generated files
-* `install_dir_gir`: (*Added 0.35.0*) which directory to install the
-  gir file into
-* `install_dir_typelib`: (*Added 0.35.0*) which directory to install
-  the typelib file into
-* `link_with`: list of libraries to link with
-* `symbol_prefix`: the symbol prefix for the gir object, e.g. `gtk`,
-  (*Since 0.43.0*) an ordered list of multiple prefixes is allowed
-* `fatal_warnings`: *Since 0.55.0* turn scanner warnings into fatal errors.
-
-Returns an array of two elements which are: `[gir_target,
-typelib_target]`
-
-### gnome.genmarshal()
-
-Generates a marshal file using the `glib-genmarshal` tool. The first
-argument is the basename of the output files.
-
-* `extra_args`: (*Added 0.42.0*) additional command line arguments to
-  pass
-* `install_header`: if true, install the generated header
-* `install_dir`: directory to install header to
-* `nostdinc`: if true, don't include the standard marshallers from
-  glib
-* `internal`: if true, mark generated sources as internal to
-  `glib-genmarshal` (*Requires GLib 2.54*)
-* `prefix`: the prefix to use for symbols
-* `skip_source`: if true, skip source location comments
-* `stdinc`: if true, include the standard marshallers from glib
-* `sources`: the list of sources to use as inputs
-* `valist_marshallers`: if true, generate va_list marshallers
-
-*Added 0.35.0*
-
-Returns an array of two elements which are: `[c_source, header_file]`
-
-### gnome.mkenums()
-
-Generates enum files for GObject using the `glib-mkenums` tool. The
-first argument is the base name of the output files, unless `c_template`
-and `h_template` are specified. In this case, the output files will be
-the base name of the values passed as templates.
-
-This method is essentially a wrapper around the `glib-mkenums` tool's
-command line API. It is the most featureful method for enum creation.
-
-Typically you either provide template files or you specify the various
-template sections manually as strings.
-
-Most libraries and applications will be using the same standard
-template with only minor tweaks, in which case the
-`gnome.mkenums_simple()` convenience method can be used instead.
-
-Note that if you `#include` the generated header in any of the sources
-for a build target, you must add the generated header to the build
-target's list of sources to codify the dependency. This is true for
-all generated sources, not just `mkenums`.
-
-* `c_template`: template to use for generating the source
-* `comments`: comment passed to the command
-* `h_template`: template to use for generating the header
-* `identifier_prefix`: prefix to use for the identifiers
-* `install_header`: if true, install the generated header
-* `install_dir`: directory to install the header
-* `sources`: the list of sources to make enums with
-* `symbol_prefix`: prefix to use for the symbols
-* `eprod`: enum text
-* `fhead`: file header
-* `fprod`: file text
-* `ftail`: file tail
-* `vhead`: value text
-* `vtail`: value tail
-
-*Added 0.35.0*
-
-Returns an array of two elements which are: `[c_source, header_file]`
-
-### gnome.mkenums_simple()
-
-Generates enum `.c` and `.h` files for GObject using the
-`glib-mkenums` tool with the standard template used by most
-GObject-based C libraries. The first argument is the base name of the
-output files.
-
-Note that if you `#include` the generated header in any of the sources
-for a build target, you must add the generated header to the build
-target's list of sources to codify the dependency. This is true for
-all generated sources, not just `mkenums_simple`.
-
-* `body_prefix`: additional prefix at the top of the body file,
-  e.g. for extra includes
-* `decorator`: optional decorator for the function declarations,
-  e.g. `GTK_AVAILABLE` or `GST_EXPORT`
-* `function_prefix`: additional prefix for function names, e.g. in
-  case you want to add a leading underscore to functions used only
-  internally
-* `header_prefix`: additional prefix at the top of the header file,
-  e.g. for extra includes (which may be needed if you specify a
-  decorator for the function declarations)
-* `install_header`: if true, install the generated header
-* `install_dir`: directory to install the header
-* `identifier_prefix`: prefix to use for the identifiers
-* `sources`: the list of sources to make enums with
-* `symbol_prefix`: prefix to use for the symbols
-
-Example:
-
-```meson
-gnome = import('gnome')
-
-my_headers = ['myheader1.h', 'myheader2.h']
-my_sources = ['mysource1.c', 'mysource2.c']
-
-# will generate myenums.c and myenums.h based on enums in myheader1.h and myheader2.h
-enums = gnome.mkenums_simple('myenums', sources : my_headers)
-
-mylib = library('my', my_sources, enums,
-                include_directories: my_incs,
-                dependencies: my_deps,
-                c_args: my_cargs,
-                install: true)
-```
-
-*Added 0.42.0*
-
-Returns an array of two elements which are: `[c_source, header_file]`
-
-### gnome.compile_schemas()
-
-When called, this method will compile the gschemas in the current
-directory. Note that this is not for installing schemas and is only
-useful when running the application locally for example during tests.
-
-* `build_by_default`: causes, when set to true, to have this target be
-  built by default, that is, when invoking plain `meson compile`, the default
-  value is true for all built target types
-* `depend_files`: files ([`string`](Reference-manual.md#string-object),
-  [`files()`](Reference-manual.md#files), or
-  [`configure_file()`](Reference-manual.md#configure_file)) of
-  schema source XML files that should trigger a re-compile if changed.
-
-### gnome.gdbus_codegen()
-
-Compiles the given XML schema into gdbus source code. Takes two
-positional arguments, the first one specifies the base name to use
-while creating the output source and header and the second specifies
-one XML file.
-
-* `sources`: list of XML files
-* `interface_prefix`: prefix for the interface
-* `namespace`: namespace of the interface
-* `extra_args`: (*Added 0.47.0*) additional command line arguments to pass
-* `autocleanup`: *(Added 0.47.0)* if set generates autocleanup code. Can be one of `none`, `objects` or `all`
-* `object_manager`: *(Added 0.40.0)* if true generates object manager code
-* `annotations`: *(Added 0.43.0)* list of lists of 3 strings for the annotation for `'ELEMENT', 'KEY', 'VALUE'`
-* `docbook`: *(Added 0.43.0)* prefix to generate `'PREFIX'-NAME.xml` docbooks
-* `build_by_default`: causes, when set to true, to have this target be
-  built by default, that is, when invoking plain `meson compile`, the default
-  value is true for all built target types
-* `install_dir`: (*Added 0.46.0*) location to install the header or
-  bundle depending on previous options
-* `install_header`: (*Added 0.46.0*) if true, install the header file
-
-Starting *0.46.0*, this function returns a list of at least two custom targets
-(in order): one for the source code and one for the header. The list will
-contain a third custom target for the generated docbook files if that keyword
-argument is passed.
-
-Earlier versions return a single custom target representing all the outputs.
-Generally, you should just add this list of targets to a top level target's
-source list.
-
-Example:
-
-```meson
-gnome = import('gnome')
-
-# The returned source would be passed to another target
-gdbus_src = gnome.gdbus_codegen('example-interface',
-  sources: 'com.example.Sample.xml',
-  interface_prefix : 'com.example.',
-  namespace : 'Sample',
-  annotations : [
-    ['com.example.Hello()', 'org.freedesktop.DBus.Deprecated', 'true']
-  ],
-  docbook : 'example-interface-doc'
-)
-```
-
-### gnome.generate_vapi()
-
-Creates a VAPI file from gir. The first argument is the name of the
-library.
-
-* `gir_dirs`: extra directories to include for gir files
-* `install`: if true, install the VAPI file
-* `install_dir`: location to install the VAPI file (defaults to datadir/vala/vapi)
-* `metadata_dirs`: extra directories to include for metadata files
-* `packages`: VAPI packages that are depended upon
-* `sources`: the gir source to generate the VAPI from
-* `vapi_dirs`: extra directories to include for VAPI files
-
-Returns a custom dependency that can be included when building other
-VAPI or Vala binaries.
-
-*Added 0.36.0*
-
-### gnome.yelp()
-
-Installs help documentation using Yelp. The first argument is the
-project id.
-
-This also creates two targets for translations
-`help-$project-update-po` and `help-$project-pot`.
-
-* `languages`: list of languages for translations
-* `media`: list of media such as images
-* `sources`: list of pages
-* `symlink_media`: if media should be symlinked not copied (defaults to `true` since 0.42.0)
-
-Note that very old versions of yelp may not support symlinked media;
-At least 3.10 should work.
-
-*Added 0.36.0*
-
-### gnome.gtkdoc()
-
-Compiles and installs gtkdoc documentation into
-`prefix/share/gtk-doc/html`. Takes one positional argument: The name
-of the module.
-
-* `content_files`: a list of content files
-* `dependencies`: a list of dependencies
-* `fixxref_args`: a list of arguments to pass to `gtkdoc-fixxref`
-* `gobject_typesfile`: a list of type files
-* `include_directories`: extra include paths to pass to `gtkdoc-scangobj`
-* `ignore_headers`: a list of header files to ignore
-* `html_assets`: a list of assets for the HTML pages
-* `html_args` a list of arguments to pass to `gtkdoc-mkhtml`
-* `install`: if true, installs the generated docs
-* `install_dir`: the directory to install the generated docs relative
-  to the gtk-doc html dir or an absolute path (default: module name)
-* `main_xml`: specifies the main XML file
-* `main_sgml`: equal to `main_xml`
-* `mkdb_args`: a list of arguments to pass to `gtkdoc-mkdb`
-* `namespace`: specifies the name space to pass to `gtkdoc-mkdb`
-* `module_version`: the version of the module, affects the installed location and the devhelp2 file location
-* `scan_args`: a list of arguments to pass to `gtkdoc-scan`
-* `scanobjs_args`: a list of arguments to pass to `gtkdoc-scangobj`
-* `c_args`: (*Added 0.48.0*) additional compile arguments to pass
-* `src_dir`: include_directories to include
-* `check`: (*Since 0.52.0*) if `true` runs `gtkdoc-check` when running unit tests.
-  Note that this has the downside of rebuilding the doc for each build, which is
-  often very slow. It usually should be enabled only in CI.
-
-This also creates a `$module-doc` target that can be run to build documentation.
-Normally the documentation is only built on install.
-
-*Since 0.52.0* Returns a target object that can be passed as dependency to other
-targets using generated doc files (e.g. in `content_files` of another doc).
-
-### gnome.gtkdoc_html_dir()
-
-Takes as argument a module name and returns the path where that
-module's HTML files will be installed. Usually used with
-`install_data` to install extra files, such as images, to the output
-directory.
diff --git a/meson/docs/markdown/Hotdoc-module.md b/meson/docs/markdown/Hotdoc-module.md
deleted file mode 100644 (file)
index 7d9fc55..0000000
+++ /dev/null
@@ -1,79 +0,0 @@
----
-short-description: Hotdoc module
-authors:
-    - name: Thibault Saunier
-      email: tsaunier@igalia.com
-      years: [2018]
-      has-copyright: false
-...
-
-# Hotdoc module
-
-This module provides helper functions for generating documentation using
-[hotdoc].
-
-*Added 0.48.0*
-
-## Usage
-
-To use this module, just do: **`hotdoc = import('hotdoc')`**. The
-following functions will then be available as methods on the object
-with the name `hotdoc`. You can, of course, replace the name `hotdoc`
-with anything else.
-
-### hotdoc.generate_doc()
-
-Generates documentation using [hotdoc] and installs it into `$prefix/share/doc/html`.
-
-**Positional argument:**
-
-* `project_name`: The name of the hotdoc project
-
-**Keyworded arguments:**
-
-* `sitemap` (*[string] or [file]*) (**required**): The hotdoc sitemap file
-* `index` (*[string] or [file]*) (**required**): Location of the index file
-* `dependencies`(*[targets]*): Targets on which the documentation generation depends on.
-* `subprojects`: A list of `HotdocTarget` that are used as subprojects for hotdoc to generate
-  the documentation.
-* ... Any argument of `hotdoc` can be used replacing dashes (`-`) with underscores (`_`).
-  For a full list of available parameters, just have a look at `hotdoc help`.
-
-[file]: Reference-manual.md#files
-[string]: Reference-manual.md#string-object
-[targets]: Reference-manual.md#build-target-object
-
-**Returns:**
-
-`HotdocTarget`: A [`custom_target`](Reference-manual.md#custom-target-object) with the
-following extra methods:
-
-* `config_path`: Path to the generated `hotdoc` configuration file.
-
-### hotdoc.has_extensions()
-
-**Positional arguments:**
-
-* `...`: The hotdoc extension names to look for
-
-**No keyworded arguments**
-
-**Returns:** `true` if all the extensions where found, `false` otherwise.
-
-### Example
-
-``` meson
-hotdoc = import('hotdoc')
-
-hotdoc.generate_doc('foobar',
-  project_version: '0.1',
-  sitemap: 'sitemap.txt',
-  index: 'index.md',
-  c_sources: ['path/to/file.c'],
-  c_smart_index: true,
-  languages: ['c'],
-  install: true,
-)
-```
-
-[hotdoc]: https://hotdoc.github.io/
\ No newline at end of file
diff --git a/meson/docs/markdown/IDE-integration.md b/meson/docs/markdown/IDE-integration.md
deleted file mode 100644 (file)
index 2cc4f4f..0000000
+++ /dev/null
@@ -1,336 +0,0 @@
----
-short-description: Meson's API to integrate Meson support into an IDE
-...
-
-# IDE integration
-
-Meson has exporters for Visual Studio and XCode, but writing a custom backend
-for every IDE out there is not a scalable approach. To solve this problem,
-Meson provides an API that makes it easy for any IDE or build tools to
-integrate Meson builds and provide an experience comparable to a solution
-native to the IDE.
-
-All the resources required for such a IDE integration can be found in
-the `meson-info` directory in the build directory.
-
-The first thing to do when setting up a Meson project in an IDE is to select
-the source and build directories. For this example we assume that the source
-resides in an Eclipse-like directory called `workspace/project` and the build
-tree is nested inside it as `workspace/project/build`. First, we initialize
-Meson by running the following command in the source directory.
-
-    meson builddir
-
-With this command meson will configure the project and also generate
-introspection information that is stored in `intro-*.json` files in the
-`meson-info` directory. The introspection dump will be automatically updated
-when meson is (re)configured, or the build options change. Thus, an IDE can
-watch for changes in this directory to know when something changed.
-
-The `meson-info` directory should contain the following files:
-
-| File                           | Description                                                         |
-| ------------------------------ | ------------------------------------------------------------------- |
-| `intro-benchmarks.json`        | Lists all benchmarks                                                |
-| `intro-buildoptions.json`      | Contains a full list of meson configuration options for the project |
-| `intro-buildsystem_files.json` | Full list of all meson build files                                  |
-| `intro-dependencies.json`      | Lists all dependencies used in the project                          |
-| `intro-installed.json`         | Contains mapping of files to their installed location               |
-| `intro-projectinfo.json`       | Stores basic information about the project (name, version, etc.)    |
-| `intro-targets.json`           | Full list of all build targets                                      |
-| `intro-tests.json`             | Lists all tests with instructions how to run them                   |
-
-The content of the JSON files is further specified in the remainder of this document.
-
-## The `targets` section
-
-The most important file for an IDE is probably `intro-targets.json`. Here each
-target with its sources and compiler parameters is specified. The JSON format
-for one target is defined as follows:
-
-```json
-{
-    "name": "Name of the target",
-    "id": "The internal ID meson uses",
-    "type": "<TYPE>",
-    "defined_in": "/Path/to/the/targets/meson.build",
-    "subproject": null,
-    "filename": ["list", "of", "generated", "files"],
-    "build_by_default": true / false,
-    "target_sources": [],
-    "installed": true / false,
-}
-```
-
-If the key `installed` is set to `true`, the key `install_filename` will also
-be present. It stores the installation location for each file in `filename`.
-If one file in `filename` is not installed, its corresponding install location
-is set to `null`.
-
-The `subproject` key specifies the name of the subproject this target was
-defined in, or `null` if the target was defined in the top level project.
-
-A target usually generates only one file. However, it is possible for custom
-targets to have multiple outputs.
-
-### Target sources
-
-The `intro-targets.json` file also stores a list of all source objects of the
-target in the `target_sources`. With this information, an IDE can provide code
-completion for all source files.
-
-```json
-{
-    "language": "language ID",
-    "compiler": ["The", "compiler", "command"],
-    "parameters": ["list", "of", "compiler", "parameters"],
-    "sources": ["list", "of", "all", "source", "files", "for", "this", "language"],
-    "generated_sources": ["list", "of", "all", "source", "files", "that", "where", "generated", "somewhere", "else"]
-}
-```
-
-It should be noted that the compiler parameters stored in the `parameters`
-differ from the actual parameters used to compile the file. This is because
-the parameters are optimized for the usage in an IDE to provide autocompletion
-support, etc. It is thus not recommended to use this introspection information
-for actual compilation.
-
-### Possible values for `type`
-
-The following table shows all valid types for a target.
-
-| value of `type`  | Description                                                                                   |
-| ---------------- | --------------------------------------------------------------------------------------------- |
-| `executable`     | This target will generate an executable file                                                  |
-| `static library` | Target for a static library                                                                   |
-| `shared library` | Target for a shared library                                                                   |
-| `shared module`  | A shared library that is meant to be used with dlopen rather than linking into something else |
-| `custom`         | A custom target                                                                               |
-| `run`            | A Meson run target                                                                            |
-| `jar`            | A Java JAR target                                                                             |
-
-### Using `--targets` without a build directory
-
-It is also possible to get most targets without a build directory. This can be
-done by running `meson introspect --targets /path/to/meson.build`.
-
-The generated output is similar to running the introspection with a build
-directory or reading the `intro-targets.json`. However, there are some key
-differences:
-
-- The paths in `filename` now are _relative_ to the future build directory
-- The `install_filename` key is completely missing
-- There is only one entry in `target_sources`:
-  - With the language set to `unknown`
-  - Empty lists for `compiler` and `parameters` and `generated_sources`
-  - The `sources` list _should_ contain all sources of the target
-
-There is no guarantee that the sources list in `target_sources` is correct.
-There might be differences, due to internal limitations. It is also not
-guaranteed that all targets will be listed in the output. It might even be
-possible that targets are listed, which won't exist when meson is run normally.
-This can happen if a target is defined inside an if statement.
-Use this feature with care.
-
-## Build Options
-
-The list of all build options (build type, warning level, etc.) is stored in
-the `intro-buildoptions.json` file. Here is the JSON format for each option.
-
-```json
-{
-    "name": "name of the option",
-    "description": "the description",
-    "type": "type ID",
-    "value": "value depends on type",
-    "section": "section ID",
-    "machine": "machine ID"
-}
-```
-
-The supported types are:
-
- - string
- - boolean
- - combo
- - integer
- - array
-
-For the type `combo` the key `choices` is also present. Here all valid values
-for the option are stored.
-
-The possible values for `section` are:
-
- - core
- - backend
- - base
- - compiler
- - directory
- - user
- - test
-
-The `machine` key specifies the machine configuration for the option. Possible
-values are:
-
- - any
- - host
- - build
-
-To set the options, use the `meson configure` command.
-
-Since Meson 0.50.0 it is also possible to get the default buildoptions
-without a build directory by providing the root `meson.build` instead of a
-build directory to `meson introspect --buildoptions`.
-
-Running `--buildoptions` without a build directory produces the same output as
-running it with a freshly configured build directory.
-
-However, this behavior is not guaranteed if subprojects are present. Due to
-internal limitations all subprojects are processed even if they are never used
-in a real meson run. Because of this options for the subprojects can differ.
-
-## The dependencies section
-
-The list of all _found_ dependencies can be acquired from
-`intro-dependencies.json`. Here, the name, version, compiler and linker
-arguments for a dependency are listed.
-
-### Scanning for dependecie with `--scan-dependencies`
-
-It is also possible to get most dependencies used without a build directory.
-This can be done by running `meson introspect --scan-dependencies /path/to/meson.build`.
-
-The output format is as follows:
-
-```json
-[
-  {
-    "name": "The name of the dependency",
-    "required": true,
-    "version": [">=1.2.3"],
-    "conditional": false,
-    "has_fallback": false
-  }
-]
-```
-
-The `required` keyword specifies whether the dependency is marked as required
-in the `meson.build` (all dependencies are required by default). The
-`conditional` key indicates whether the `dependency()` function was called
-inside a conditional block. In a real meson run these dependencies might not be
-used, thus they _may_ not be required, even if the `required` key is set. The
-`has_fallback` key just indicates whether a fallback was directly set in the
-`dependency()` function. The `version` key always contains a list of version
-requirements from the `meson.build` and **not** the actual version of the
-dependency on disc. The version list is empty if no version was specified
-in the `meson.build`.
-
-## Tests
-
-Compilation and unit tests are done as usual by running the `meson compile` and
-`meson test` commands. A JSON formatted result log can be found in
-`workspace/project/builddir/meson-logs/testlog.json`.
-
-When these tests fail, the user probably wants to run the failing test in a
-debugger. To make this as integrated as possible, extract the tests from the
-`intro-tests.json` and `intro-benchmarks.json` files. This provides you with
-all the information needed to run the test: what command to execute, command
-line arguments, environment variable settings and how to process the output.
-
-```json
-{
-    "name": "name of the test",
-    "workdir": "the working directory (can be null)",
-    "timeout": "the test timeout",
-    "suite": ["list", "of", "test", "suites"],
-    "is_parallel": true / false,
-    "protocol": "exitcode" / "tap",
-    "cmd": ["command", "to", "run"],
-    "env": {
-        "VARIABLE1": "value 1",
-        "VARIABLE2": "value 2"
-    }
-}
-```
-
-## Build system files
-
-It is also possible to get Meson build files used in your current project. This
-can be done by running `meson introspect --buildsystem-files /path/to/builddir`.
-
-The output format is as follows:
-
-```json
-[
-    "/Path/to/the/targets/meson.build",
-    "/Path/to/the/targets/meson_options.txt",
-    "/Path/to/the/targets/subdir/meson.build"
-]
-```
-
-# Programmatic interface
-
-Meson also provides the `meson introspect` for project introspection via the
-command line. Use `meson introspect -h` to see all available options.
-
-This API can also work without a build directory for the `--projectinfo` command.
-
-# AST of a `meson.build`
-
-Since meson *0.55.0* it is possible to dump the AST of a `meson.build` as a JSON
-object. The interface for this is `meson introspect --ast /path/to/meson.build`.
-
-Each node of the AST has at least the following entries:
-
-| Key          | Description                                             |
-| ------------ | ------------------------------------------------------- |
-| `node`       | Type of the node (see following table)                  |
-| `lineno`     | Line number of the node in the file                     |
-| `colno`      | Column number of the node in the file                   |
-| `end_lineno` | Marks the end of the node (may be the same as `lineno`) |
-| `end_colno`  | Marks the end of the node (may be the same as `colno`)  |
-
-Possible values for `node` with additional keys:
-
-| Node type            | Additional keys                                  |
-| -------------------- | ------------------------------------------------ |
-| `BooleanNode`        | `value`: bool                                    |
-| `IdNode`             | `value`: str                                     |
-| `NumberNode`         | `value`: int                                     |
-| `StringNode`         | `value`: str                                     |
-| `ContinueNode`       |                                                  |
-| `BreakNode`          |                                                  |
-| `ArgumentNode`       | `positional`: node list; `kwargs`: accept_kwargs |
-| `ArrayNode`          | `args`: node                                     |
-| `DictNode`           | `args`: node                                     |
-| `EmptyNode`          |                                                  |
-| `OrNode`             | `left`: node; `right`: node                      |
-| `AndNode`            | `left`: node; `right`: node                      |
-| `ComparisonNode`     | `left`: node; `right`: node; `ctype`: str        |
-| `ArithmeticNode`     | `left`: node; `right`: node; `op`: str           |
-| `NotNode`            | `right`: node                                    |
-| `CodeBlockNode`      | `lines`: node list                               |
-| `IndexNode`          | `object`: node; `index`: node                    |
-| `MethodNode`         | `object`: node; `args`: node; `name`: str        |
-| `FunctionNode`       | `args`: node; `name`: str                        |
-| `AssignmentNode`     | `value`: node; `var_name`: str                   |
-| `PlusAssignmentNode` | `value`: node; `var_name`: str                   |
-| `ForeachClauseNode`  | `items`: node; `block`: node; `varnames`: list   |
-| `IfClauseNode`       | `ifs`: node list; `else`: node                   |
-| `IfNode`             | `condition`: node; `block`: node                 |
-| `UMinusNode`         | `right`: node                                    |
-| `TernaryNode`        | `condition`: node; `true`: node; `false`: node   |
-
-We do not guarantee the stability of this format since it is heavily linked to
-the internal Meson AST. However, breaking changes (removal of a node type or the
-removal of a key) are unlikely and will be announced in the release notes.
-
-
-# Existing integrations
-
-- [Gnome Builder](https://wiki.gnome.org/Apps/Builder)
-- [KDevelop](https://www.kdevelop.org)
-- [Eclipse CDT](https://www.eclipse.org/cdt/) (experimental)
-- [Meson Cmake Wrapper](https://github.com/prozum/meson-cmake-wrapper) (for cmake IDEs) (currently unmaintained !!)
-- [Meson-UI](https://github.com/michaelbadcrumble/meson-ui) (Meson build GUI)
-- [Meson Syntax Highlighter](https://plugins.jetbrains.com/plugin/13269-meson-syntax-highlighter) plugin for JetBrains IDEs.
diff --git a/meson/docs/markdown/Icestorm-module.md b/meson/docs/markdown/Icestorm-module.md
deleted file mode 100644 (file)
index bc2ad61..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-# Unstable IceStorm module
-
-This module is available since version 0.45.0.
-
-**Note**: this module is unstable. It is only provided as a technology
-preview.  Its API may change in arbitrary ways between releases or it
-might be removed from Meson altogether.
-
-## Usage
-
-This module provides an experimental method to create FPGA bitstreams using
-the [IceStorm](http://www.clifford.at/icestorm/) suite of tools.
-
-The module exposes only one method called `project` and it is used
-like this:
-
-    is.project('projname',
-      <verilog files>,
-      constraint_file : <pcf file>,
-    )
-
-The input to this function is the set of Verilog files and a
-constraint file. This produces output files called `projname.asc`,
-`projname.blif` and `projname.bin`. In addition it creates two run
-targets called `projname-time` for running timing analysis and
-`projname-upload` that uploads the generated bitstream to an FPGA
-device using the `iceprog` programming executable.
diff --git a/meson/docs/markdown/In-the-press.md b/meson/docs/markdown/In-the-press.md
deleted file mode 100644 (file)
index aa6f2a8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-# In the press
-
-This page lists cases where Meson has been presented in the press.
-
-* [Linux Magazin](http://www.linux-magazin.de/Ausgaben/2014/08/), in German, August 2014, and also later in [Linux Magazine](http://www.linux-magazine.com/Issues/2014/166/Meson-Build-System) in English
-* [Admin Magazine](http://www.admin-magazine.com/HPC/Articles/The-Meson-Build-System)
-* [Phoronix](https://www.phoronix.com/scan.php?page=news_item&px=MTc1MDc) regarding compilation of Mesa3D
-* [CppCast](http://cppcast.com/2015/12/jussi-pakkanen/) interviewed Jussi about Meson for C++ development in 12/2015
diff --git a/meson/docs/markdown/Include-directories.md b/meson/docs/markdown/Include-directories.md
deleted file mode 100644 (file)
index c1d4ac1..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
----
-short-description: Instructions on handling include directories
-...
-
-# Include directories
-
-Most `C`/`C++` projects have headers in different directories than sources. Thus you need to specify include directories. Let's assume that we are at some subdirectory and wish to add its `include` subdirectory to some target's search path. To create a include directory object we do this:
-
-```meson
-incdir = include_directories('include')
-```
-
-The `incdir` variable now holds a reference to the `include` subdir. Now we pass that as an argument to a build target:
-
-```meson
-executable('someprog', 'someprog.c', include_directories : incdir)
-```
-
-Note that these two commands can be given in any subdirectories and it will still work. Meson will keep track of the locations and generate proper compiler flags to make it all work.
-
-Another thing to note is that `include_directories` adds both the source directory and corresponding build directory to include path, so you don't have to care.
diff --git a/meson/docs/markdown/IndepthTutorial.md b/meson/docs/markdown/IndepthTutorial.md
deleted file mode 100644 (file)
index d2e2662..0000000
+++ /dev/null
@@ -1,90 +0,0 @@
-# An in-depth tutorial
-
-In this tutorial we set up a project with multiple targets, unit tests and dependencies between targets. Our main product is a shared library called *foo* that is written in `C++11`. We are going to ignore the contents of the source files, as they are not really important from a build definition point of view. The library makes use of the `GLib` library so we need to detect and link it properly. We also make the resulting library installable.
-
-The source tree contains three subdirectories `src`, `include` and `test` that contain, respectively, the source code, headers and unit tests of our project.
-
-To start things up, here is the top level `meson.build` file.
-
-```meson
-project('c++ foolib', 'cpp',
-  version : '1.0.0',
-  license : 'MIT')
-add_global_arguments('-DSOME_TOKEN=value', language : 'cpp')
-glib_dep = dependency('glib-2.0')
-
-inc = include_directories('include')
-
-subdir('include')
-subdir('src')
-subdir('test')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(libraries : foolib,
-                 version : '1.0',
-                 name : 'libfoobar',
-                 filebase : 'foobar',
-                 description : 'A Library to barnicate your foos.')
-```
-
-The definition always starts with a call to the `project` function. In it you must specify the project's name and programming languages to use, in this case only `C++`. We also specify two additional arguments, the project's version and the license it is under. Our project is version `1.0.0` and is specified to be under the MIT license.
-
-Then we find GLib, which is an *external dependency*. The `dependency` function tells Meson to find the library (by default using `pkg-config`). If the library is not found, Meson will raise an error and stop processing the build definition.
-
-Then we add a global compiler argument `-DSOME_TOKEN=value`. This flag is used for *all* C++ source file compilations. It is not possible to unset it for some targets. The reason for this is that it is hard to keep track of what compiler flags are in use if global settings change per target.
-
-Since `include` directory contains the header files, we need a way to tell compilations to add that directory to the compiler command line. This is done with the `include_directories` command that takes a directory and returns an object representing this directory. It is stored in variable `inc` which makes it accessible later on.
-
-After this are three `subdir` commands. These instruct Meson to go to the specified subdirectory, open the `meson.build` file that's in there and execute it. The last few lines are a stanza to generate a `pkg-config` file. We'll skip that for now and come back to it at the end of this document.
-
-The first subdirectory we go into is `include`. In it we have a a header file for the library that we want to install. This requires one line.
-
-```meson
-install_headers('foolib.h')
-```
-
-This installs the given header file to the system's header directory. This is by default `/[install prefix]/include`, but it can be changed with a command line argument.
-
-The Meson definition of `src` subdir is simple.
-
-```meson
-foo_sources = ['source1.cpp', 'source2.cpp']
-foolib = shared_library('foo',
-                        foo_sources,
-                        include_directories : inc,
-                        dependencies : glib_dep,
-                        install : true)
-```
-
-Here we just tell Meson to build the library with the given sources. We also tell it to use the include directories we stored to variable `inc` earlier. Since this library uses GLib, we tell Meson to add all necessary compiler and linker flags with the `dependencies` keyword argument. Its value is `glib_dep` which we set at the top level `meson.build` file. The `install` argument tells Meson to install the result. As with the headers, the shared library is installed to the system's default location (usually `/[install prefix]/lib`) but is again overridable.
-
-The resulting library is stored in variable `foolib` just like the include directory was stored in the previous file.
-
-Once Meson has processed the `src` subdir it returns to the main Meson file and executes the next line that moves it into the `test` subdir. Its contents look like this.
-
-```meson
-testexe = executable('testexe', 'footest.cpp',
-                     include_directories : inc,
-                     link_with : foolib)
-test('foolib test', testexe)
-```
-
-First we build a test executable that has the same include directory as the main library and which also links against the freshly built shared library. Note that you don't need to specify `glib_dep` here just to be able to use the built library `foolib`. If the executable used GLib functionality itself, then we would of course need to add it as a keyword argument here.
-
-Finally we define a test with the name `foolib test`. It consists of running the binary we just built. If the executable exits with a zero return value, the test is considered passed. Nonzero return values mark the test as failed.
-
-At this point we can return to the pkg-config generator line. All shared libraries should provide a pkg-config file, which explains how that library is used. Meson provides this simple generator that should be sufficient for most simple projects. All you need to do is list a few basic pieces of information and Meson takes care of generating an appropriate file. More advanced users might want to create their own pkg-config files using Meson's [configuration file generator system](Configuration.md).
-
-With these four files we are done. To configure, build and run the test suite, we just need to execute the following commands (starting at source tree root directory).
-
-```console
-$ meson builddir && cd builddir
-$ meson compile
-$ meson test
-```
-
-To then install the project you only need one command.
-
-```console
-$ meson install
-```
diff --git a/meson/docs/markdown/Installing.md b/meson/docs/markdown/Installing.md
deleted file mode 100644 (file)
index 9dc2ad4..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
----
-short-description: Installing targets
-...
-
-# Installing
-
-Invoked via the [following command](Commands.md#install) *(available since 0.47.0)*:
-
-```sh
-meson install
-```
-
-or alternatively (on older meson versions with `ninja` backend):
-
-```sh
-ninja install
-```
-
-By default Meson will not install anything. Build targets can be
-installed by tagging them as installable in the definition.
-
-```meson
-project('install', 'c')
-shared_library('mylib', 'libfile.c', install : true)
-```
-
-There is usually no need to specify install paths or the like. Meson
-will automatically install it to the standards-conforming location. In
-this particular case the executable is installed to the `bin`
-subdirectory of the install prefix. However if you wish to override
-the install dir, you can do that with the `install_dir` argument.
-
-```meson
-executable('prog', 'prog.c', install : true, install_dir : 'my/special/dir')
-```
-
-Other install commands are the following.
-
-```meson
-install_headers('header.h', subdir : 'projname') # -> include/projname/header.h
-install_man('foo.1') # -> share/man/man1/foo.1
-install_data('datafile.dat', install_dir : get_option('datadir') / 'progname')
-# -> share/progname/datafile.dat
-```
-
-`install_data()` supports rename of the file *since 0.46.0*.
-
-```meson
-# file.txt -> {datadir}/{projectname}/new-name.txt
-install_data('file.txt', rename : 'new-name.txt')
-
-# file1.txt -> share/myapp/dir1/data.txt
-# file2.txt -> share/myapp/dir2/data.txt
-install_data(['file1.txt', 'file2.txt'],
-             rename : ['dir1/data.txt', 'dir2/data.txt'],
-             install_dir : 'share/myapp')
-```
-
-Sometimes you want to copy an entire subtree directly. For this use
-case there is the `install_subdir` command, which can be used like
-this.
-
-```meson
-install_subdir('mydir', install_dir : 'include') # mydir subtree -> include/mydir
-```
-
-Most of the time you want to install files relative to the install
-prefix. Sometimes you need to go outside of the prefix (such as writing
-files to `/etc` instead of `/usr/etc`. This can be accomplished by
-giving an absolute install path.
-
-```meson
-install_data(sources : 'foo.dat', install_dir : '/etc') # -> /etc/foo.dat
-```
-
-## Custom install behavior
-
-Sometimes you need to do more than just install basic targets. Meson
-makes this easy by allowing you to specify a custom script to execute
-at install time. As an example, here is a script that generates an
-empty file in a custom directory.
-
-```bash
-#!/bin/sh
-
-mkdir "${DESTDIR}/${MESON_INSTALL_PREFIX}/mydir"
-touch "${DESTDIR}/${MESON_INSTALL_PREFIX}/mydir/file.dat"
-```
-
-As you can see, Meson sets up some environment variables to help you
-write your script (`DESTDIR` is not set by Meson, it is inherited from
-the outside environment). In addition to the install prefix, Meson
-also sets the variables `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT`.
-
-Telling Meson to run this script at install time is a one-liner.
-
-```meson
-meson.add_install_script('myscript.sh')
-```
-
-The argument is the name of the script file relative to the current
-subdirectory.
-
-## DESTDIR support
-
-Sometimes you need to install to a different directory than the
-install prefix. This is most common when building rpm or deb
-packages. This is done with the `DESTDIR` environment variable and it
-is used just like with other build systems:
-
-```console
-$ DESTDIR=/path/to/staging/area meson install
-```
-
-## Custom install behaviour
-
-Installation behaviour can be further customized using 
-additional arguments.
-
-For example, if you wish to install the current setup without
-rebuilding the code (which the default install target always does) and
-only installing those files that have changed, you would run this
-command in the build tree:
-
-```console
-$ meson install --no-rebuild --only-changed
-```
-
-## Finer control over install locations
-
-Sometimes it is necessary to only install a subsection of output files
-or install them in different directories. This can be done by
-specifying `install_dir` as an array rather than a single string. The
-array must have as many items as there are outputs and each entry
-specifies how the corresponding output file should be installed. For
-example:
-
-```meson
-custom_target(...
-    output: ['file1', 'file2', 'file3'],
-    install_dir: ['path1', false, 'path3'],
-    ...
-)
-```
-
-In this case `file1` would be installed to `/prefix/path1/file1`,
-`file2` would not be installed at all and `file3` would be installed
-to `/prefix/path3/file3'.
diff --git a/meson/docs/markdown/Java.md b/meson/docs/markdown/Java.md
deleted file mode 100644 (file)
index 9b89304..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
----
-title: Java
-short-description: Compiling Java programs
-...
-
-# Compiling Java applications
-
-Meson has experimental support for compiling Java programs. The basic syntax consists of only one function and would be used like this:
-
-```meson
-project('javaprog', 'java')
-
-myjar = jar('mything', 'com/example/Prog.java',
-            main_class : 'com.example.Prog')
-
-test('javatest', myjar)
-```
-
-However note that Meson places limitations on how you lay out your code.
-
-* all Java files for a jar must be under the subdirectory the jar definition is in
-* all Java files must be in paths specified by their package, e.g. a class called `com.example.Something` must be in a Java file situated at `com/example/Something.java`.
-* Meson only deals with jar files, you cannot poke individual class files (unless you do so manually)
diff --git a/meson/docs/markdown/Keyval-module.md b/meson/docs/markdown/Keyval-module.md
deleted file mode 100644 (file)
index 643265e..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
----
-short-description: Unstable keyval module
-authors:
-    - name: Mark Schulte, Paolo Bonzini
-      years: [2017, 2019]
-      has-copyright: false
-...
-
-# keyval module
-
-This module parses files consisting of a series of `key=value` lines.  One use
-of this module is to load kconfig configurations in meson projects.
-
-**Note**: this does not provide kconfig frontend tooling to generate a
-configuration. You still need something such as kconfig frontends (see
-link below) to parse your Kconfig files, and then (after you've
-chosen the configuration options), output a ".config" file.
-
-  [kconfig-frontends]: http://ymorin.is-a-geek.org/projects/kconfig-frontends
-
-## Usage
-
-The module may be imported as follows:
-
-``` meson
-keyval = import('unstable-keyval')
-```
-
-The following functions will then be available as methods on the object
-with the name `keyval`. You can, of course, replace the name
-`keyval` with anything else.
-
-### keyval.load()
-
-This function loads a file consisting of a series of `key=value` lines
-and returns a dictionary object.
-
-`keyval.load()` makes no attempt at parsing the values in the file.
-In particular boolean and integer values will be represented as strings,
-and strings will keep any quoting that is present in the input file.  It
-can be useful to create a [`configuration_data()`](#configuration_data)
-object from the dictionary and use methods such as `get_unquoted()`.
-
-Kconfig frontends usually have ".config" as the default name for the
-configuration file.  However, placing the configuration file in the source
-directory limits the user to one configuration per source directory.
-In order to allow separate configurations for each build directory, as is
-the Meson standard, `meson.build` should not hardcode ".config" as the
-argument to `kconfig.load()`, and should instead make the argument to
-`kconfig.load()` a [project build option](Build-options.md).
-
-* The first (and only) argument is the path to the configuration file to
-  load (usually ".config").
-
-**Returns**: a [dictionary object](Reference-manual.md#dictionary-object).
diff --git a/meson/docs/markdown/Localisation.md b/meson/docs/markdown/Localisation.md
deleted file mode 100644 (file)
index ed63e13..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
----
-short-description: Localization with GNU Gettext
-...
-
-# Localisation
-
-Localising your application with GNU gettext takes a little effort but is quite straightforward. We'll create a `po` subdirectory at your project root directory for all the localisation info.
-
-## Generating .pot and .po files
-In your main meson.build file include the `po` subdirectory in the build process.
-
-    subdir('po')
-
-In this `po` subdirectory we need:
-- `LINGUAS`: Space separated list of languages
-- `POTFILES`: List of source files to scan for translatable strings.
-- `meson.build`: Localization specific meson file
-
-### LINGUAS
-File with space separated list of languages. A sample LINGUAS might look like this.
-
-    aa ab ae af
-
-### POTFILES
-File that lists all the source files that gettext should scan in order to find strings to translate. The syntax of the file is one line per source file and the line must contain the relative path from source root. A sample POTFILES might look like this.
-
-    src/file1.c
-    src/file2.c
-    src/subdir/file3.c
-    include/mything/somefile.h
-
-### meson.build
-Localization specific meson file. It imports and uses the `i18n` module. If not defined before it needs to define the `GETTEXT_PACKAGE` global.
-```meson
-i18n = import('i18n')
-# define GETTEXT_PACKAGE
-add_project_arguments('-DGETTEXT_PACKAGE="intltest"', language:'c')
-i18n.gettext(meson.project_name(),
-    args: '--directory=' + meson.source_root()
-)
-```
-The first command imports the `i18n` module that provides gettext features. The fourth line does the actual invocation. The first argument is the gettext package name. This causes two things to happen. The first is that Meson will generate binary mo files and put them to their proper locations when doing an install. The second is that it creates a build rule to regenerate the main pot file. If you are using the Ninja backend, this is how you would invoke the rebuild.
-
-### generate .pot file
-
-Then we need to generate the main pot file. The potfile can have any name but is usually the name of the gettext package. Let's say the project is called *intltest*. In this case the corresponding pot file would be called `intltest.pot`.
-
-Run the following command from your build folder to generate the pot file. It is recommended to inspect it manually afterwards and fill in e.g. proper copyright and contact information.
-
-```console
-$ meson compile intltest-pot
-```
-
-### generate .po files
-
-For each language listed in the array above we need a corresponding `.po` file. Those can be generated by running the following command from your build folder.
-
-```console
-$ meson compile intltest-update-po
-```
diff --git a/meson/docs/markdown/Machine-files.md b/meson/docs/markdown/Machine-files.md
deleted file mode 100644 (file)
index 9011f79..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-# Cross and Native File reference
-
-Cross and native files are nearly identical, but not completely. This is the
-documentation on the common values used by both, for the specific values of
-one or the other see the [cross compilation](Cross-compilation.md) and [native
-environments](Native-environments.md).
-
-## Sections
-
-The following sections are allowed:
-- constants
-- binaries
-- paths
-- properties
-
-### constants
-
-*Since 0.55.0*
-
-String and list concatenation is supported using the `+` operator, joining paths
-is supported using the `/` operator.
-Entries defined in the `[constants]` section can be used in any other section
-(they are always parsed first), entries in any other section can be used only
-within that same section and only after it has been defined.
-
-```ini
-[constants]
-toolchain = '/toolchain'
-common_flags = ['--sysroot=' + toolchain / 'sysroot']
-
-[properties]
-c_args = common_flags + ['-DSOMETHING']
-cpp_args = c_args + ['-DSOMETHING_ELSE']
-
-[binaries]
-c = toolchain / 'gcc'
-```
-
-This can be useful with cross file composition as well. A generic cross file
-could be composed with a platform specific file where constants are defined:
-```ini
-# aarch64.ini
-[constants]
-arch = 'aarch64-linux-gnu'
-```
-
-```ini
-# cross.ini
-[binaries]
-c = arch + '-gcc'
-cpp = arch + '-g++'
-strip = arch + '-strip'
-pkgconfig = arch + '-pkg-config'
-...
-```
-
-This can be used as `meson setup --cross-file aarch64.ini --cross-file cross.ini builddir`.
-
-Note that file composition happens before the parsing of values. The example
-below results in `b` being `'HelloWorld'`:
-```ini
-# file1.ini:
-[constants]
-a = 'Foo'
-b = a + 'World'
-```
-
-```ini
-#file2.ini:
-[constants]
-a = 'Hello'
-```
-
-The example below results in an error when file1.ini is included before file2.ini
-because `b` would be defined before `a`:
-```ini
-# file1.ini:
-[constants]
-b = a + 'World'
-```
-
-```ini
-#file2.ini:
-[constants]
-a = 'Hello'
-```
-
-### Binaries
-
-The binaries section contains a list of binaries. These can be used
-internally by meson, or by the `find_program` function:
-
-Compilers and linkers are defined here using `<lang>` and `<lang>_ld`.
-`<lang>_ld` is special because it is compiler specific. For compilers like
-gcc and clang which are used to invoke the linker this is a value to pass to
-their "choose the linker" argument (-fuse-ld= in this case). For compilers
-like MSVC and Clang-Cl, this is the path to a linker for meson to invoke,
-such as `link.exe` or `lld-link.exe`. Support for ls is *new in 0.53.0*
-
-*changed in 0.53.1* the `ld` variable was replaced by `<lang>_ld`, because it
-*regressed a large number of projects. in 0.53.0 the `ld` variable was used
-instead.
-
-Native example:
-
-```ini
-c = '/usr/bin/clang'
-c_ld = 'lld'
-sed = 'C:\\program files\\gnu\\sed.exe'
-llvm-config = '/usr/lib/llvm8/bin/llvm-config'
-```
-
-Cross example:
-
-```ini
-c = '/usr/bin/i586-mingw32msvc-gcc'
-cpp = '/usr/bin/i586-mingw32msvc-g++'
-c_ld = 'gold'
-cpp_ld = 'gold'
-ar = '/usr/i586-mingw32msvc/bin/ar'
-strip = '/usr/i586-mingw32msvc/bin/strip'
-pkgconfig = '/usr/bin/i586-mingw32msvc-pkg-config'
-```
-
-An incomplete list of internally used programs that can be overridden here is:
-- cmake
-- cups-config
-- gnustep-config
-- gpgme-config
-- libgcrypt-config
-- libwmf-config
-- llvm-config
-- pcap-config
-- pkgconfig
-- sdl2-config
-- wx-config (or wx-3.0-config or wx-config-gtk)
-
-### Paths and Directories
-
-As of 0.50.0 paths and directories such as libdir can be defined in the native
-file in a paths section
-
-```ini
-[paths]
-libdir = 'mylibdir'
-prefix = '/my prefix'
-```
-
-These values will only be loaded when not cross compiling. Any arguments on the
-command line will override any options in the native file. For example, passing
-`--libdir=otherlibdir` would result in a prefix of `/my prefix` and a libdir of
-`otherlibdir`.
-
-### Properties
-
-*New in native files in 0.54.0*, always in cross files.
-
-In addition to special data that may be specified in cross files, this
-section may contain random key value pairs accessed using the
-`meson.get_external_property()`
-
-## Properties
-
-*New for native files in 0.54.0*
-
-The properties section can contain any variable you like, and is accessed via
-`meson.get_external_property`, or `meson.get_cross_property`.
-
-## Loading multiple machine files
-
-Native files allow layering (cross files can be layered since meson 0.52.0).
-More than one native file can be loaded, with values from a previous file being
-overridden by the next. The intention of this is not overriding, but to allow
-composing native files. This composition is done by passing the command line
-argument multiple times:
-
-```console
-meson setup builddir/ --cross-file first.ini --cross-file second.ini --cross-file thrid.ini
-```
-
-In this case `first.ini` will be loaded, then `second.ini`, with values from
-`second.ini` replacing `first.ini`, and so on.
-
-For example, if there is a project using C and C++, python 3.4-3.7, and LLVM
-5-7, and it needs to build with clang 5, 6, and 7, and gcc 5.x, 6.x, and 7.x;
-expressing all of these configurations in monolithic configurations would
-result in 81 different native files. By layering them, it can be expressed by
-just 12 native files.
diff --git a/meson/docs/markdown/Manual.md b/meson/docs/markdown/Manual.md
deleted file mode 100644 (file)
index 988efa1..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
----
-short-description: User manual for Meson
-...
-
-# Manual
-
-This is the user manual for Meson. It currently tracks the state of
-Git head. If you are using an older version, some of the information
-here might not work for you.
diff --git a/meson/docs/markdown/Meson-sample.md b/meson/docs/markdown/Meson-sample.md
deleted file mode 100644 (file)
index f98e022..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
----
-short-description: Simple project step by step explanation
-...
-
-# Meson sample
-
-A Meson file that builds an executable looks like this.
-
-```meson
-project('simple', 'c')
-executable('myexe', 'source.c')
-```
-
-All Meson build definitions begin with the `project` command. It specifies the name of the project and what programming languages it uses. Here the project is called *simple* and it uses only the C programming language. All strings are single-quoted.
-
-On the next line we define a *build target*, in this case an executable called *myexe*. It consists of one source file. This is all the code that a user needs to write to compile an executable with Meson.
-
-Variables are fully supported. The above code snippet could also have been declared like this.
-
-```meson
-project('simple', 'c')
-src = 'source.c'
-executable('myexe', src)
-```
-
-Most executables consist of more than one source file. The easiest way to deal with this is to put them in an array.
-
-```meson
-project('simple', 'c')
-src = ['source1.c', 'source2.c', 'source3.c']
-executable('myexe', src)
-```
-
-Meson also supports the notion of *keyword arguments*. Indeed most arguments to functions can only be passed using them. The above snippet could be rewritten like this.
-
-```meson
-project('simple', 'c')
-src = ['source1.c', 'source2.c', 'source3.c']
-executable('myexe', sources : src)
-```
-
-These two formats are equivalent and choosing one over the other is mostly a question of personal preference.
-
-The `executable` command actually returns an *executable object*, which represents the given build target. It can be passed on to other functions, like this.
-
-```meson
-project('simple', 'c')
-src = ['source1.c', 'source2.c', 'source3.c']
-exe = executable('myexe', src)
-test('simple test', exe)
-```
-
-Here we create a unit test called *simple test*, and which uses the built executable. When the tests are run with the `meson test` command, the built executable is run. If it returns zero, the test passes. A non-zero return value indicates an error, which Meson will then report to the user.
-
-A note to Visual Studio users
------
-
-There's a slight terminology difference between Meson and Visual Studio. A Meson *project* is the equivalent to a Visual Studio *solution*. That is, the topmost thing that encompasses all things to be built. A Visual Studio *project* on the other hand is the equivalent of a Meson top level build target, such as an executable or a shared library.
diff --git a/meson/docs/markdown/MesonCI.md b/meson/docs/markdown/MesonCI.md
deleted file mode 100644 (file)
index 73b979b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# Meson CI setup
-
-This document is aimed for Meson contributors and documents
-the CI setup used for testing Meson itself. The Meson
-project uses multiple CI platforms for covering a wide
-range of target systems.
-
-## Travis CI
-
-The travis configuration file is the `.travis.yml` in the
-the project root. This platform tests cross compilation and
-unity builds on a [linux docker image](#docker-images) and
-on OSX.
-
-## GitHub actions
-
-The configuration files for GitHub actions are located in
-`.github/workflows`. Here, all [images](#docker-images)
-are tested  with the full `run_tests.py` run. Additionally,
-some other, smaller, tests are run.
-
-## Docker images
-
-The Linux docker images are automatically built and
-uploaded by GitHub actions. An image rebuild is triggerd
-when any of the image definition files are changed (in
-`ci/ciimage`) in the master branch. Additionally, the
-images are also updated weekly.
-
-Each docker image has one corresponding dirctory in
-`ci/ciimage` with an `image.json` and an `install.sh`.
-
-### Image generation
-
-There are no manual Dockerfiles. Instead the Dockerfile is
-automatically generated by the `build.py` script. This is
-done to ensure that all images have the same layout and can
-all be built and tested automatically.
-
-The Dockerfile is generated from the `image.json` file and
-basically only adds a few common files and runs the
-`install.sh` script which should contain all distribution
-specific setup steps. The `common.sh` can be sourced via
-`source /ci/common.sh` to access some shared functionalety.
-
-To generate the image run `build.py -t build <image>`. A
-generated image can be tested with `build.py -t test <image>`.
-
-### Common image setup
-
-Each docker image has a `/ci` directory with an
-`env_vars.sh` script. This script has to be sourced before
-running the meson test suite.
diff --git a/meson/docs/markdown/Mixing-build-systems.md b/meson/docs/markdown/Mixing-build-systems.md
deleted file mode 100644 (file)
index 98ca0ed..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-# Meson's policy on mixing multiple build systems in one build directory
-
-Meson has been designed with the principle that all dependencies are
-either provided by "the platform" via a mechanism such as Pkg-Config
-or that they are built as Meson subprojects under the main
-project. There are several projects that would like to mix build
-systems, that is, build dependencies in the same build directory as
-the other build system by having one build system call the other. The
-build directories do not necessarily need to be inside each other, but
-that is the common case.
-
-This page lists the Meson project's stance on mixing build
-systems. The tl/dr version is that while we do provide some
-functionality for this use case, it only works for simple
-cases. Anything more complex can not be made reliable and trying to do
-that would burden Meson developers with an effectively infinite
-maintenance burden. Thus these use cases are not guaranteed to work,
-and even if a project using them works today there are no guarantees
-that it will work in any future version.
-
-## The definition of "build system mixing"
-
-For the purposes of this page, mixing build systems means any and all
-mechanisms where one build system uses build artifacts from a
-different build system's build directory in any way.
-
-Note that this definition does not specify what the dependencies are
-and how they are built, only how they are consumed. For example
-suppose you have a standalone dependency library that builds with
-build system X. In this case having Meson call the build system to
-build the dependency at build time would be interpreted as mixing
-build systems. On the other hand a "Flatpak-like" approach of building
-and installing the library with an external mechanism and consuming it
-via a standard build-system agnostic method such as Pkg-Config would
-not be considered build system mixing. Use of uninstalled-pkgconfig
-files is considered mixing, though.
-
-## What does this mean for support and compatibility?
-
-The Meson project will not take on any maintenance burden to ensure
-anything other than the simple builds setups as discussed above will
-work. Nor will we make changes to support these use cases that would
-worsen the user experience of users of plain Meson. This includes, but
-is not limited to, the following:
-
-- Any changes in other build systems that cause mixed project breakage
-  will not be considered a bug in Meson.
-
-- Breakages in mixed build projects will not be considered regressions
-  and such problems will never be considered release blockers,
-  regardless of what the underlying issue is.
-
-- Any use case that would require major changes in Meson to work
-  around missing or broken functionality in the other build system is
-  not supported. These issues must be fixed upstream.
diff --git a/meson/docs/markdown/Modules.md b/meson/docs/markdown/Modules.md
deleted file mode 100644 (file)
index c354169..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
----
-short-description: Meson modules for common build operations
-...
-
-# Modules
-
-In addition to core language features, Meson also provides a module system aimed at providing helper methods for common build operations. Using modules is simple, first you import them:
-
-```meson
-mymod = import('somemodule')
-```
-
-After this you can use the returned object to use the functionality provided:
-
-```meson
-mymod.do_something('text argument')
-```
-
-Meson has a selection of modules to make common requirements easy to
-use. Modules can be thought of like the standard library of a
-programming language. Currently Meson provides the modules listed on
-subpages.
diff --git a/meson/docs/markdown/Native-environments.md b/meson/docs/markdown/Native-environments.md
deleted file mode 100644 (file)
index 8dcce2a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
----
-short-description: Setting up native compilation
-...
-
-# Persistent native environments
-
-New in 0.49.0
-
-Meson has [cross files for describing cross compilation environments](Cross-compilation.md),
-for describing native environments it has equivalent "native files".
-
-Natives describe the *build machine*, and can be used to override properties of
-non-cross builds, as well as properties that are marked as "native" in a cross
-build.
-
-There are a couple of reasons you might want to use a native file to keep a
-persistent environment:
-
-* To build with a non-default native tool chain (such as clang instead of gcc)
-* To use a non-default version of another binary, such as yacc, or llvm-config
-
-## Changing native file settings
-
-All of the rules about cross files and changed settings apply to native files
-as well, see [here](Cross-compilation.md#changing-cross-file-settings)
-
-## Defining the environment
-
-See the [config-files section](Machine-files.md), for options shared by cross
-and native files.
-
-## Native file locations
-
-Like cross files, native files may be installed to user or system wide
-locations, defined as:
-  - $XDG_DATA_DIRS/meson/native
-    (/usr/local/share/meson/native:/usr/share/meson/native if $XDG_DATA_DIRS is
-    undefined)
-  - $XDG_DATA_HOME/meson/native ($HOME/.local/share/meson/native if
-    $XDG_DATA_HOME is undefined)
-
-The order of locations tried is as follows:
- - A file relative to the local dir
- - The user local location
- - The system wide locations in order
-
-These files are not intended to be shipped by distributions, unless they are
-specifically for distribution packaging, they are mainly intended for
-developers.
diff --git a/meson/docs/markdown/Overview.md b/meson/docs/markdown/Overview.md
deleted file mode 100644 (file)
index 7bee937..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
----
-short-description: Overview of the Meson build system
-...
-
-# Overview
-
-Meson is a build system that is designed to be as user-friendly as
-possible without sacrificing performance. The main tool for this is a
-custom language that the user uses to describe the structure of his
-build. The main design goals of this language has been simplicity,
-clarity and conciseness. Much inspiration was drawn from the Python
-programming language, which is considered very readable, even to
-people who have not programmed in Python before.
-
-Another main idea has been to provide first class support for modern
-programming tools and best practices. These include features as varied
-as unit testing, code coverage reporting, precompiled headers and the
-like. All of these features should be immediately available to any
-project using Meson. The user should not need to hunt for third party
-macros or write shell scripts to get these features. They should just
-work out of the box.
-
-This power should not come at the expense of limited usability. Many
-software builds require unorthodox steps. A common example is that you
-first need to build a custom tool and then use that tool to generate
-more source code to build. This functionality needs to be supported
-and be as easy to use as other parts of the system.
-
-Terminology
---
-
-Meson follows the overall structure of other popular build systems,
-such as CMake and GNU Autotools. This means that the build is divided
-into two discrete steps: *configure step* and *build step*. The first
-step inspects the system, checks for dependencies and does all other
-steps necessary to configure the build. It then generates the actual
-build system. The second step is simply executing this generated build
-system. The end result is a bunch of *build targets*, which are
-usually executables and shared and static libraries.
-
-The directory that contains the source code is called the *source
-directory*. Correspondingly the directory where the output is written
-is called the *build directory*. In other build systems it is common
-to have these two be the same directory. This is called an *in-source
-build*. The case where the build directory is separate is called an
-*out-of-source build*.
-
-What sets Meson apart from most build systems is that it enforces a
-separate build directory. All files created by the build system are
-put in the build directory. It is actually impossible to do an
-in-source build. For people used to building inside their source tree,
-this may seem like a needless complication. However there are several
-benefits to doing only out-of-source builds. These will be explained
-in the next chapter.
-
-When the source code is built, a set of *unit tests* is usually
-run. They ensure that the program is working as it should. If it does,
-the build result can be *installed* after which it is ready for use.
diff --git a/meson/docs/markdown/Performance-comparison.md b/meson/docs/markdown/Performance-comparison.md
deleted file mode 100644 (file)
index 3f15e82..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-# Performance comparison
-
-This page lists experiments comparing build performance between Meson and other build systems.
-
-- [Simple comparison](Simple-comparison.md)
-- [ARM performance test](ARM-performance-test.md)
diff --git a/meson/docs/markdown/Pkg-config-files.md b/meson/docs/markdown/Pkg-config-files.md
deleted file mode 100644 (file)
index 3aa8897..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Pkg config files
-
-[Pkg-config](https://en.wikipedia.org/wiki/Pkg-config) is a way for shared libraries to declare the compiler flags needed to use them. There are two different ways of generating Pkg-config files in Meson. The first way is to build them manually with the `configure_file` command. The second way is to use Meson's built in Pkg-config file generator. The difference between the two is that the latter is very simple and meant for basic use cases. The former should be used when you need to provide a more customized solution.
-
-In this document we describe the simple generator approach. It is used in the following way.
-
-```meson
-pkg = import('pkgconfig')
-libs = ...     # the library/libraries users need to link against
-h = ['.', ...] # subdirectories of ${prefix}/${includedir} to add to header path
-pkg.generate(libraries : libs,
-             subdirs : h,
-             version : '1.0',
-             name : 'libsimple',
-             filebase : 'simple',
-             description : 'A simple demo library.')
-```
-
-This causes a file called `simple.pc` to be created and placed into the install directory during the install phase.
-
-More information on the pkg-config module and the parameters can be found on the [pkgconfig-module](Pkgconfig-module.md) page.
diff --git a/meson/docs/markdown/Pkgconfig-module.md b/meson/docs/markdown/Pkgconfig-module.md
deleted file mode 100644 (file)
index 7b68e24..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-# Pkgconfig module
-
-This module is a simple generator for
-[pkg-config](https://pkg-config.freedesktop.org/) files.
-
-## Usage
-
-```meson
-pkg = import('pkgconfig')
-bar_dep = dependency('bar')
-lib = library('foo', dependencies : [bar])
-pkg.generate(lib)
-```
-
-### pkg.generate()
-
-The generated file's properties are specified with the following
-keyword arguments.
-
-- `description` a string describing the library, used to set the `Description:` field
-- `extra_cflags` a list of extra compiler flags to be added to the
-  `Cflags` field after the header search path
-- `filebase` the base name to use for the pkg-config file; as an
-  example, the value of `libfoo` would produce a pkg-config file called
-  `libfoo.pc`
-- `install_dir` the directory to install to, defaults to the value of
-  option `libdir` followed by `/pkgconfig`
-- `libraries` a list of built libraries (usually results of
-  shared_library) that the user needs to link against. Arbitrary strings can
-  also be provided and they will be added into the `Libs` field. Since 0.45.0
-  dependencies of built libraries will be automatically added, see the
-  [Implicit dependencies](#implicit-dependencies) section below for the exact
-  rules.
-- `libraries_private` list of built libraries or strings to put in the
-  `Libs.private` field. Since 0.45.0 dependencies of built libraries will be
-  automatically added, see the [Implicit dependencies](#implicit-dependencies)
-  section below for the exact rules.
-- `name` the name of this library, used to set the `Name:` field
-- `subdirs` which subdirs of `include` should be added to the header
-  search path, for example if you install headers into
-  `${PREFIX}/include/foobar-1`, the correct value for this argument
-  would be `foobar-1`
-- `requires` list of strings, pkgconfig-dependencies or libraries that
-   `pkgconfig.generate()` was used on to put in the `Requires` field
-- `requires_private` same as `requires` but for `Requires.private` field
-  field
-- `url` a string with a url for the library
-- `variables` a list of strings with custom variables to add to the
-  generated file. The strings must be in the form `name=value` and may
-  reference other pkgconfig variables,
-  e.g. `datadir=${prefix}/share`. The names `prefix`, `libdir` and
-  `includedir` are reserved and may not be used.
-- `version` a string describing the version of this library, used to set the
-  `Version:` field. (*since 0.46.0*) Defaults to the project version if unspecified.
-- `d_module_versions` a list of module version flags used when compiling
-   D sources referred to by this pkg-config file
-- `uninstalled_variables` used instead of the `variables` keyword argument, when
-  generating the uninstalled pkg-config file. Since *0.54.0*
-- `dataonly` field. (*since 0.54.0*) this is used for architecture-independent
-   pkg-config files in projects which also have architecture-dependent outputs.
-- `conflicts` (*since 0.36.0, incorrectly issued a warning prior to 0.54.0*) list of strings to be put in the `Conflicts` field.
-
-Since 0.46 a `StaticLibrary` or `SharedLibrary` object can optionally be passed
-as first positional argument. If one is provided a default value will be
-provided for all required fields of the pc file:
-- `install_dir` is set to `pkgconfig` folder in the same location than the provided library.
-- `description` is set to the project's name followed by the library's name.
-- `name` is set to the library's name.
-
-Since 0.54.0 uninstalled pkg-config files are generated as well. They are
-located in `<build dir>/meson-uninstalled/`. It is sometimes
-useful to build projects against libraries built by meson without having to
-install them into a prefix. In order to do so, just set
-`PKG_CONFIG_PATH=<builddir>/meson-uninstalled` before building your
-application. That will cause pkg-config to prefer those `-uninstalled.pc` files
-and find libraries and headers from the meson builddir. This is an experimental
-feature provided on a best-effort basis, it might not work in all use-cases.
-
-### Implicit dependencies
-
-The exact rules followed to find dependencies that are implicitly added into the
-pkg-config file have evolved over time. Here are the rules as of Meson *0.49.0*,
-previous versions might have slightly different behaviour.
-
-- Not found libraries or dependencies are ignored.
-- Libraries and dependencies are private by default (i.e. added into
-  `Requires.private:` or `Libs.private:`) unless they are explicitly added in
-  `libraries` or `requires` keyword arguments, or is the main library (first
-  positional argument).
-- Libraries and dependencies will be de-duplicated, if they are added in both
-  public and private (e.g `Requires:` and `Requires.private:`) it will be removed
-  from the private list.
-- Shared libraries (i.e. `shared_library()` and **NOT** `library()`) add only
-  `-lfoo` into `Libs:` or `Libs.private:` but their dependencies are not pulled.
-  This is because dependencies are only needed for static link.
-- Other libraries (i.e. `static_library()` or `library()`) add `-lfoo` into `Libs:`
-  or `Libs.private:` and recursively add their dependencies into `Libs.private:` or
-  `Requires.private:`.
-- Dependencies provided by pkg-config are added into `Requires:` or
-  `Requires.private:`. If a version was specified when declaring that dependency
-  it will be written into the generated file too.
-- The threads dependency (i.e. `dependency('threads')`) adds `-pthread` into
-  `Libs:` or `Libs.private:`.
-- Internal dependencies (i.e.
-  `declare_dependency(compiler_args : '-DFOO', link_args : '-Wl,something', link_with : foo)`)
-  add `compiler_args` into `Cflags:` if public, `link_args` and `link_with` into
-  `Libs:` if public or `Libs.private:` if private.
-- Other dependency types add their compiler arguments into `Cflags:` if public,
-  and linker arguments into `Libs:` if public or `Libs.private:` if private.
-- Once a pkg-config file is generated for a library using `pkg.generate(mylib)`,
-  any subsequent call to `pkg.generate()` where mylib appears, will generate a
-  `Requires:` or `Requires.private` instead of a `Libs:` or `Libs.private:`.
diff --git a/meson/docs/markdown/Playground.md b/meson/docs/markdown/Playground.md
deleted file mode 100644 (file)
index 5699f22..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-# playground
-
-This page is *not* part of official documentation. It exists merely for testing new stuff for the wiki.
-
-## Ref manual reformat
-
-The current format is not very readable. We should have something more like what [glib](https://developer.gnome.org/glib/stable/glib-Hash-Tables.html) or [Python](https://docs.python.org/3/library/os.html) do.
-
-Here's a first proposal.
-
-    project(<project name>,
-            <languages to use, comma separated>,
-            version         : <project version>,
-            subproject_dir  : <alternative directory to store subprojects>,
-            meson_version   : <required version of Meson>,
-            license         : <string or array of licenses>,
-            default_options : <default values for project options>,
-
-Longer descriptions of arguments go here.
-
-Take two:
-
-## project
-
-    <project name>
-    <languages to use, comma separated>
-    version         : <project version>
-    subproject_dir  : <alternative directory to store subprojects>
-    meson_version   : <required version of Meson>
-    license         : <string or array of licenses>
-    default_options : <default values for project options>
diff --git a/meson/docs/markdown/Porting-from-autotools.md b/meson/docs/markdown/Porting-from-autotools.md
deleted file mode 100644 (file)
index 2170ffa..0000000
+++ /dev/null
@@ -1,686 +0,0 @@
-# Porting from Autotools
-
-This page uses [AppStream-glib](https://github.com/hughsie/appstream-glib/) as an example project. AppStream-Glib contains some libraries, GObject Introspection data, tests, man pages, i18n, bash-completion with optional flags to build/not build support for some things.
-
-Meson comes with a helper script `ac_converter` that you can use to convert the basic autoconf checks for your project.
-
-## Configure.ac
-
-First let's look at `configure.ac` and write the same in `meson.build`.
-
-```autoconf
-AC_PREREQ(2.63)
-```
-Meson doesn't provide the same function, so just ignore this.
-
-### Defining variables
-`configure.ac`:
-```autoconf
-m4_define([as_major_version], [0])
-m4_define([as_minor_version], [3])
-m4_define([as_micro_version], [6])
-m4_define([as_version],
-          [as_major_version.as_minor_version.as_micro_version])
-```
-`meson.build`:
-```meson
-
-as_version = meson.project_version() # set in project() below
-ver_arr = as_version.split('.')
-
-as_major_version = ver_arr[0]
-as_minor_version = ver_arr[1]
-as_micro_version = ver_arr[2]
-```
-
-### Initializing project and setting compilers
-`configure.ac`:
-```autoconf
-AC_INIT([appstream-glib],[as_version])
-AC_PROG_CC
-```
-`meson.build`:
-```meson
-project('appstream-glib', 'c', version : '0.3.6')
-```
-Note that this must be the first line of your `meson.build` file.
-
-### AC_SUBST
-`configure.ac`:
-```autoconf
-AC_SUBST(AS_MAJOR_VERSION)
-AC_SUBST(AS_MINOR_VERSION)
-AC_SUBST(AS_MICRO_VERSION)
-AC_SUBST(AS_VERSION)
-```
-
-You don't need to do the same in Meson, because it does not have two different types of files (Makefile, configure).
-
-### Auto headers
-
-`configure.ac`:
-
-```autoconf
-AC_CONFIG_HEADERS([config.h])
-```
-
-`meson.build`:
-
-```meson
-conf = configuration_data()
-# Surround the version in quotes to make it a C string
-conf.set_quoted('VERSION', as_version)
-configure_file(output : 'config.h',
-               configuration : conf)
-```
-
-Meson doesn't support autoheaders, you need to manually specify what do you want to see in header file, write `configuration_data()` object and use `configure_file()`.
-
-You can also substitute variables of type `@SOME_VAR@` with configure data. The details are on the [configuration page](Configuration.md).
-
-### Finding programs
-
-`configure.ac`:
-
-```autoconf
-AC_PATH_PROG(GPERF, [gperf], [no])
-if test x$GPERF != xno ; then
-        AC_DEFINE(HAVE_GPERF,[1], [Use gperf])
-fi
-AM_CONDITIONAL(HAVE_GPERF, [test x$GPERF != xno])
-```
-
-`meson.build`:
-
-```meson
-gperf = find_program('gperf', required : false)
-if gperf.found()
-  conf.set('HAVE_GPERF', 1)
-endif
-```
-
-### Finding pkg-config modules
-
-`configure.ac`:
-
-```autoconf
-PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.24)
-```
-
-`meson.build`:
-
-```meson
-soup = dependency('libsoup-2.4', version : '>= 2.24')
-```
-
-### Arguments
-
-`configure.ac`:
-
-```autoconf
-AC_ARG_ENABLE(dep11, AS_HELP_STRING([--enable-dep11],[enable DEP-11]),
-              enable_dep11=$enableval,enable_dep11=yes)
-AM_CONDITIONAL(HAVE_DEP11, test x$enable_dep11 = xyes)
-if test x$enable_dep11 = xyes; then
-  AC_CHECK_HEADER(yaml.h, [], [AC_MSG_ERROR([No yaml.h])])
-  YAML_LIBS="-lyaml"
-  AC_SUBST(YAML_LIBS)
-  AC_DEFINE(AS_BUILD_DEP11,1,[Build DEP-11 code])
-fi
-```
-
-`meson.build`:
-
-```meson
-if get_option('enable-dep11')
-  yaml = dependency('yaml-0.1')
-  conf.set('AS_BUILD_DEP11', 1)
-else
-  yaml = dependency('yaml-0.1', required : false)
-endif
-```
-
-`meson_options.txt`:
-
-```meson
-option('enable-dep11', type : 'boolean', value : true, description : 'enable DEP-11')
-```
-
-## Makefile.am
-
-Next step is `Makefile.am`. In meson you don't need to have other file, you still use `meson.build`.
-
-### Sub directories
-
-`Makefile.am`:
-
-```make
-SUBDIRS =                                         \
-        libappstream-glib
-```
-
-`meson.build`:
-
-```meson
-subdir('libappstream-glib')
-```
-
-### *CLEANFILES, EXTRA_DIST, etc.
-
-`Makefile.am`:
-
-```make
-DISTCLEANFILES =                                        \
-        appstream-glib-*.tar.xz
-
-MAINTAINERCLEANFILES =                                  \
-        *~                                              \
-        ABOUT-NLS                                       \
-        aclocal.m4                                      \
-        ChangeLog                                       \
-        compile                                         \
-        config.guess                                    \
-        config.h.*                                      \
-        config.rpath
-
-EXTRA_DIST =                                            \
-        COPYING                                         \
-        MAINTAINERS                                     \
-        AUTHORS                                         \
-        README.md                                       \
-        NEWS                                            \
-        autogen.sh                                      \
-        config.h
-```
-
-In Meson you don't need have `*CLEANFILES`, because in meson you are building in temporary directory (usually called `build`), you manually removing it. You also not need to use `EXTRA_DIST`, because you will make tarballs via `git archive` or something like this.
-
-### glib-compile-resources
-
-`Makefile.am`:
-```make
-as-resources.c: appstream-glib.gresource.xml                    \
-                as-stock-icons.txt                              \
-                as-license-ids.txt                              \
-                as-blacklist-ids.txt                            \
-                as-category-ids.txt                             \
-                as-environment-ids.txt
-        $(AM_V_GEN)                                             \
-        glib-compile-resources                                  \
-                --sourcedir=$(srcdir)                           \
-                --sourcedir=$(top_builddir)/data                \
-                --target=$@                                     \
-                --generate-source                               \
-                --c-name as                                     \
-                $(srcdir)/appstream-glib.gresource.xml
-as-resources.h: appstream-glib.gresource.xml                    \
-                as-stock-icons.txt                              \
-                as-license-ids.txt                              \
-                as-blacklist-ids.txt                            \
-                as-category-ids.txt                             \
-                as-environment-ids.txt
-        $(AM_V_GEN)                                             \
-        glib-compile-resources                                  \
-                --sourcedir=$(srcdir)                           \
-                --sourcedir=$(top_builddir)/data                \
-                --target=$@                                     \
-                --generate-header                               \
-                --c-name as                                     \
-                $(srcdir)/appstream-glib.gresource.xml
-
-BUILT_SOURCES =                                                 \
-        as-resources.c                                          \
-        as-resources.h
-```
-
-`meson.build`:
-
-```meson
-asresources = gnome.compile_resources(
-  'as-resources', 'appstream-glib.gresource.xml',
-  source_dir : '.',
-  c_name : 'as')
-```
-
-### Headers
-
-`Makefile.am`:
-
-```make
-libappstream_glib_includedir = $(includedir)/libappstream-glib
-libappstream_glib_include_HEADERS =                             \
-        appstream-glib.h                                        \
-        as-app.h                                                \
-        as-bundle.h                                             \
-        as-enums.h                                              \
-        as-icon.h                                               \
-        as-image.h                                              \
-        as-inf.h                                                \
-        as-node.h                                               \
-        as-problem.h                                            \
-        as-provide.h                                            \
-        as-release.h                                            \
-        as-screenshot.h                                         \
-        as-store.h                                              \
-        as-tag.h                                                \
-        as-utils.h                                              \
-        as-version.h
-```
-
-`meson.build`:
-
-```meson
-headers = [
-  'appstream-glib.h',
-  'as-app.h',
-  'as-bundle.h',
-  'as-enums.h',
-  'as-icon.h',
-  'as-image.h',
-  'as-inf.h',
-  'as-node.h',
-  'as-problem.h',
-  'as-provide.h',
-  'as-release.h',
-  'as-screenshot.h',
-  'as-store.h',
-  'as-tag.h',
-  'as-utils.h',
-  'as-version.h']
-install_headers(headers, subdir : 'libappstream-glib')
-```
-
-### Libraries
-
-`Makefile.am`:
-```make
-lib_LTLIBRARIES =                                               \
-        libappstream-glib.la
-libappstream_glib_la_SOURCES =                                  \
-        as-app.c                                                \
-        as-app-desktop.c                                        \
-        as-app-inf.c                                            \
-        as-app-private.h                                        \
-        as-app-validate.c                                       \
-        as-bundle.c                                             \
-        as-bundle-private.h                                     \
-        as-cleanup.h                                            \
-        as-enums.c                                              \
-        as-icon.c                                               \
-        as-icon-private.h                                       \
-        as-image.c                                              \
-        as-image-private.h                                      \
-        as-inf.c                                                \
-        as-inf.h                                                \
-        as-node.c                                               \
-        as-node-private.h                                       \
-        as-problem.c                                            \
-        as-problem.h                                            \
-        as-provide.c                                            \
-        as-provide-private.h                                    \
-        as-release.c                                            \
-        as-release-private.h                                    \
-        as-resources.c                                          \
-        as-resources.h                                          \
-        as-screenshot.c                                         \
-        as-screenshot-private.h                                 \
-        as-store.c                                              \
-        as-tag.c                                                \
-        as-utils.c                                              \
-        as-utils-private.h                                      \
-        as-version.h                                            \
-        as-yaml.c                                               \
-        as-yaml.h
-
-libappstream_glib_la_LIBADD =                                   \
-        $(GLIB_LIBS)                                            \
-        $(GDKPIXBUF_LIBS)                                       \
-        $(LIBARCHIVE_LIBS)                                      \
-        $(SOUP_LIBS)                                            \
-        $(YAML_LIBS)
-
-libappstream_glib_la_LDFLAGS =                                  \
-        -version-info $(LT_CURRENT):$(LT_REVISION):$(LT_AGE)    \
-        -export-dynamic                                         \
-        -no-undefined                                           \
-        -export-symbols-regex '^as_.*'
-```
-
-`meson.build`:
-
-```meson
-sources = [
-  'as-app.c',
-  'as-app-desktop.c',
-  'as-app-inf.c',
-  'as-app-private.h',
-  'as-app-validate.c',
-  'as-bundle.c',
-  'as-bundle-private.h',
-  'as-cleanup.h',
-  'as-enums.c',
-  'as-icon.c',
-  'as-icon-private.h',
-  'as-image.c',
-  'as-image-private.h',
-  'as-inf.c',
-  'as-inf.h',
-  'as-node.c',
-  'as-node-private.h',
-  'as-problem.c',
-  'as-problem.h',
-  'as-provide.c',
-  'as-provide-private.h',
-  'as-release.c',
-  'as-release-private.h',
-  asresources,
-  'as-screenshot.c',
-  'as-screenshot-private.h',
-  'as-store.c',
-  'as-tag.c',
-  'as-utils.c',
-  'as-utils-private.h',
-  'as-version.h',
-  'as-yaml.c',
-  'as-yaml.h']
-
-deps = [glib, gdkpixbuf, libarchive, soup, yaml]
-
-mapfile = 'appstream-glib.map'
-vflag = '-Wl,--version-script,@0@/@1@'.format(meson.current_source_dir(), mapfile)
-asglib = shared_library(
-  'appstream-glib', sources,
-  soversion : lt_current,
-  version : lt_version,
-  dependencies : deps,
-  include_directories : include_directories('@0@/..'.format(meson.current_build_dir())),
-  link_args : ['-Wl,--no-undefined', vflag],
-  link_depends : mapfile,
-  install : true)
-```
-
-`appstream-glib.map`:
-
-```
-{
-global:
-    as_*;
-local:
-    *;
-};
-```
-
-### Custom targets
-
-`Makefile.am`:
-
-```make
-if HAVE_GPERF
-as-tag-private.h: as-tag.gperf
-        $(AM_V_GEN) gperf < $< > $@
-
-libappstream_glib_la_SOURCES += as-tag-private.h
-BUILT_SOURCES += as-tag-private.h
-endif
-```
-
-`meson.build`:
-
-```meson
-if gperf.found()
-  astagpriv = custom_target('gperf as-tag',
-                            output : 'as-tag-private.h',
-                            input : 'as-tag.gperf',
-                            command : [gperf, '@INPUT@', '--output-file', '@OUTPUT@'])
-  sources = sources + [astagpriv]
-endif
-```
-
-### Global CFLAGS
-
-`Makefile.am`:
-
-```make
-AM_CPPFLAGS =                                                   \
-        -DAS_COMPILATION                                        \
-        -DLOCALSTATEDIR=\""$(localstatedir)"\"                  \
-        -DG_LOG_DOMAIN=\"As\"
-```
-
-`meson.build`:
-
-```meson
-add_project_arguments('-DG_LOG_DOMAIN="As"', language : 'c')
-add_project_arguments('-DAS_COMPILATION', language : 'c')
-add_project_arguments('-DLOCALSTATEDIR="/var"', language : 'c')
-```
-
-### Tests
-
-`Makefile.am`:
-
-```make
-check_PROGRAMS =                                                \
-        as-self-test
-as_self_test_SOURCES =                                          \
-        as-self-test.c
-as_self_test_LDADD =                                            \
-        $(GLIB_LIBS)                                            \
-        $(GDKPIXBUF_LIBS)                                       \
-        $(LIBARCHIVE_LIBS)                                      \
-        $(SOUP_LIBS)                                            \
-        $(YAML_LIBS)                                            \
-        $(lib_LTLIBRARIES)
-as_self_test_CFLAGS = -DTESTDATADIR=\""$(top_srcdir)/data/tests"\"
-
-TESTS = as-self-test
-```
-
-`meson.build`:
-
-```meson
-selftest = executable(
-  'as-self-test', 'as-self-test.c',
-  include_directories : include_directories('@0@/..'.format(meson.current_build_dir())),
-  dependencies : deps,
-  c_args : '-DTESTDATADIR="@0@/../data/tests"'.format(meson.current_source_dir()),
-  link_with : asglib)
-test('as-self-test', selftest)
-```
-
-### GObject Introspection
-
-`Makefile.am`:
-
-```make
-introspection_sources =                                         \
-        as-app.c                                                \
-        as-app-validate.c                                       \
-        as-app.h                                                \
-        as-bundle.c                                             \
-        as-bundle.h                                             \
-        as-enums.c                                              \
-        as-enums.h                                              \
-        as-icon.c                                               \
-        as-icon.h                                               \
-        as-image.c                                              \
-        as-image.h                                              \
-        as-inf.c                                                \
-        as-inf.h                                                \
-        as-node.c                                               \
-        as-node.h                                               \
-        as-problem.c                                            \
-        as-problem.h                                            \
-        as-provide.c                                            \
-        as-provide.h                                            \
-        as-release.c                                            \
-        as-release.h                                            \
-        as-screenshot.c                                         \
-        as-screenshot.h                                         \
-        as-store.c                                              \
-        as-store.h                                              \
-        as-tag.c                                                \
-        as-tag.h                                                \
-        as-utils.c                                              \
-        as-utils.h                                              \
-        as-version.h
-
-AppStreamGlib-1.0.gir: libappstream-glib.la
-AppStreamGlib_1_0_gir_INCLUDES = GObject-2.0 Gio-2.0 GdkPixbuf-2.0
-AppStreamGlib_1_0_gir_CFLAGS = $(AM_CPPFLAGS)
-AppStreamGlib_1_0_gir_SCANNERFLAGS = --identifier-prefix=As \
-                                --symbol-prefix=as_ \
-                                --warn-all \
-                                --add-include-path=$(srcdir)
-AppStreamGlib_1_0_gir_EXPORT_PACKAGES = appstream-glib
-AppStreamGlib_1_0_gir_LIBS = libappstream-glib.la
-AppStreamGlib_1_0_gir_FILES = $(introspection_sources)
-INTROSPECTION_GIRS += AppStreamGlib-1.0.gir
-
-girdir = $(datadir)/gir-1.0
-gir_DATA = $(INTROSPECTION_GIRS)
-
-typelibdir = $(libdir)/girepository-1.0
-typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib)
-
-CLEANFILES += $(gir_DATA) $(typelib_DATA)
-```
-
-`meson.build`:
-
-```meson
-introspection_sources = [
-  'as-app.c',
-  'as-app-validate.c',
-  'as-app.h',
-  'as-bundle.c',
-  'as-bundle.h',
-  'as-enums.c',
-  'as-enums.h',
-  'as-icon.c',
-  'as-icon.h',
-  'as-image.c',
-  'as-image.h',
-  'as-inf.c',
-  'as-inf.h',
-  'as-node.c',
-  'as-node.h',
-  'as-problem.c',
-  'as-problem.h',
-  'as-provide.c',
-  'as-provide.h',
-  'as-release.c',
-  'as-release.h',
-  'as-screenshot.c',
-  'as-screenshot.h',
-  'as-store.c',
-  'as-store.h',
-  'as-tag.c',
-  'as-tag.h',
-  'as-utils.c',
-  'as-utils.h',
-  'as-version.h']
-
-gnome.generate_gir(asglib,
-  sources : introspection_sources,
-  nsversion : '1.0',
-  namespace : 'AppStreamGlib',
-  symbol_prefix : 'as_',
-  identifier_prefix : 'As',
-  export_packages : 'appstream-glib',
-  includes : ['GObject-2.0', 'Gio-2.0', 'GdkPixbuf-2.0'],
-  install : true
-)
-```
-
-### GSettings
-
-`configure.ac`:
-```sh
-GLIB_GSETTINGS
-```
-
-`Makefile.am`:
-```make
-gsettings_SCHEMAS = foo.gschema.xml
-@GSETTINGS_RULES@
-```
-
-`meson.build`:
-```meson
-install_data('foo.gschema.xml', install_dir: get_option('datadir') / 'glib-2.0' / 'schemas')
-meson.add_install_script('meson_post_install.py')
-```
-
-`meson_post_install.py`:
-```python
-#!/usr/bin/env python3
-
-import os
-import subprocess
-
-schemadir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], 'share', 'glib-2.0', 'schemas')
-
-if not os.environ.get('DESTDIR'):
-    print('Compiling gsettings schemas...')
-    subprocess.call(['glib-compile-schemas', schemadir])
-```
-
-### gettext
-
-Note this example does not include `intltool` usage.
-
-`configure.ac`:
-```m4
-AM_GNU_GETTEXT([external])
-AM_GNU_GETTEXT_VERSION([0.19.7])
-
-GETTEXT_PACKAGE=foo
-AC_SUBST(GETTEXT_PACKAGE)
-AC_DEFINE_UNQUOTED(GETTEXT_PACKAGE, "$GETTEXT_PACKAGE", [The prefix for our gettext translation domains.])
-```
-
-`po/Makevars`:
-```make
-XGETTEXT_OPTIONS =  --from-code=UTF-8 --keyword=_ --keyword=N_ --keyword=C_:1c,2 --keyword=NC_:1c,2 --keyword=g_dngettext:2,3 --add-comments
-```
-
-`Makefile.am`:
-```make
-%.desktop: %.desktop.in
-    $(AM_V_GEN)$(MSGFMT) --desktop --template $< -d $(top_srcdir)/po -o $@
-
-%.appdata.xml: %.appdata.xml.in
-    $(AM_V_GEN)$(MSGFMT) --xml --template $< -d $(top_srcdir)/po -o $@
-```
-
-`meson.build`:
-```meson
-i18n = import('i18n')
-
-gettext_package = 'foo'
-add_project_arguments('-DGETTEXT_PACKAGE=' + gettext_package, language: 'c')
-subdir('po')
-
-i18n.merge_file(
-  input: 'foo.desktop.in',
-  output: 'foo.desktop',
-  type: 'desktop',
-  po_dir: 'po',
-  install: true,
-  install_dir: get_option('datadir') / 'applications'
-)
-
-i18n.merge_file(
-  input: 'foo.appdata.xml.in',
-  output: 'foo.appdata.xml',
-  po_dir: 'po',
-  install: true,
-  install_dir: get_option('datadir') / 'appdata'
-)
-```
-
-`po/meson.build`:
-```meson
-i18n.gettext(gettext_package, preset: 'glib')
-```
diff --git a/meson/docs/markdown/Precompiled-headers.md b/meson/docs/markdown/Precompiled-headers.md
deleted file mode 100644 (file)
index 05b50bc..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
----
-short-description: Using precompiled headers to reduce compilation time
-...
-
-# Precompiled headers
-
-Parsing header files of system libraries is surprisingly expensive. A
-typical source file has less than one thousand lines of code. In
-contrast the headers of large libraries can be tens of thousands of
-lines. This is especially problematic with C++, where header-only
-libraries are common and they may contain extremely complex code. This
-makes them slow to compile.
-
-Precompiled headers are a tool to mitigate this issue. Basically what
-they do is parse the headers and then serialize the compiler's
-internal state to disk. The downside of precompiled headers is that
-they are tricky to set up. Meson has native support for precompiled
-headers, but using them takes a little work.
-
-A precompiled header file is relatively simple. It is a header file
-that contains `#include` directives for the system headers to
-precompile. Here is a C++ example.
-
-```cpp
-    #include<vector>
-    #include<string>
-    #include<map>
-```
-
-In Meson, precompiled header files are always per-target. That is, the
-given precompiled header is used when compiling every single file in
-the target. Due to limitations of the underlying compilers, this
-header file must not be in the same subdirectory as any of the source
-files. It is strongly recommended that you create a subdirectory
-called `pch` in the target directory and put the header files (and
-nothing else) there.
-
-Toggling the usage of precompiled headers
---
-
-If you wish to compile your project without precompiled headers, you
-can change the value of the pch option by passing `-Db_pch=false`
-argument to Meson at configure time or later with `meson configure`. You can
-also toggle the use of pch in a configured build directory with the
-GUI tool. You don't have to do any changes to the source
-code. Typically this is done to test whether your project compiles
-cleanly without pch (that is, checking that its #includes are in
-order) and working around compiler bugs.
-
-Using precompiled headers with GCC and derivatives
---
-
-Once you have a file to precompile, you can enable the use of pch for
-a given target with a *pch* keyword argument. As an example, let's assume
-you want to build a small C binary with precompiled headers.
-Let's say the source files of the binary use the system headers `stdio.h`
-and `string.h`. Then you create a header file `pch/myexe_pch.h` with this
-content:
-
-```c
-#include <stdio.h>
-#include <string.h>
-```
-
-And add this to meson:
-
-```meson
-executable('myexe', sources : sourcelist, c_pch : 'pch/myexe_pch.h')
-```
-
-That's all. You should note that your source files must _not_ include
-the file `myexe_pch.h` and you must _not_ add the pch subdirectory to
-your search path. Any modification of the original program files is
-not necessary. Meson will make the compiler include the pch with
-compiler options. If you want to disable pch (because of, say,
-compiler bugs), it can be done entirely on the build system side with
-no changes to source code.
-
-You can use precompiled headers on any build target. If your target
-has multiple languages, you can specify multiple pch files like this.
-
-```meson
-executable('multilang', sources : srclist,
-           c_pch : 'pch/c_pch.h', cpp_pch : 'pch/cpp_pch.h')
-```
-
-Using precompiled headers with MSVC
---
-Since Meson version 0.50.0, precompiled headers with MSVC work just like
-with GCC. Meson will automatically create the matching pch implementation
-file for you.
-
-Before version 0.50.0, in addition to the header file, Meson
-also requires a corresponding source file. If your header is called
-`foo_pch.h`, the corresponding source file is usually called
-`foo_pch.cpp` and it resides in the same `pch` subdirectory as the
-header. Its contents are this:
-
-```cpp
-#if !defined(_MSC_VER)
-#error "This file is only for use with MSVC."
-#endif
-
-#include "foo_pch.h"
-```
-
-To enable pch, simply list both files in the target definition:
-
-```meson
-executable('myexe', sources : srclist,
-           cpp_pch : ['pch/foo_pch.h', 'pch/foo_pch.cpp'])
-```
-
-This form will work with both GCC and msvc, because Meson knows that
-GCC does not need a `.cpp` file and thus just ignores it.
-
-It should be noted that due to implementation details of the MSVC
-compiler, having precompiled headers for multiple languages in the
-same target is not guaranteed to work.
diff --git a/meson/docs/markdown/Project-templates.md b/meson/docs/markdown/Project-templates.md
deleted file mode 100644 (file)
index 7ded318..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
----
-short-description: Project templates
-...
-
-# Project templates
-
-To make it easier for new developers to start working, Meson ships a
-tool to generate the basic setup of different kinds of projects. This
-functionality can be accessed with the `meson init` command. A typical
-project setup would go like this:
-
-```console
-$ mkdir project_name
-$ cd project_name
-$ meson init --language=c --name=myproject --version=0.1
-```
-
-This would create the build definitions for a helloworld type
-project. The result can be compiled as usual. For example it
-could be done like this:
-
-```
-$ meson setup builddir
-$ meson compile -C builddir
-```
-
-The generator has many different projects and settings. They can all
-be listed by invoking the command `meson init --help`.
-
-This feature is available since Meson version 0.45.0.
-
-# Generate a build script for an existing project
-
-With `meson init` you can generate a build script for an existing
-project with existing project files by running the command in the
-root directory of your project. Meson currently supports this
-feature for `executable`, and `jar` projects.
-
-# Build after generation of template
-
-It is possible to have Meson generate a build directory from the
-`meson init` command without running `meson setup`. This is done
-by passing `-b` or `--build` switch.
-
-```console
-$ mkdir project_name
-$ cd project_name
-$ meson init --language=c --name=myproject --version=0.1 --build
-```
\ No newline at end of file
diff --git a/meson/docs/markdown/Python-3-module.md b/meson/docs/markdown/Python-3-module.md
deleted file mode 100644 (file)
index f32cdc9..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# Python 3 module
-
-This module provides support for dealing with Python 3. It has the
-following methods.
-
-This module is deprecated and replaced by the [python](Python-module.md) module.
-
-## find_python
-
-This is a cross platform way of finding the Python 3 executable, which
-may have a different name on different operating systems. Returns an
-[external program](Reference-manual.md#external-program-object) object.
-
-*Added 0.38.0*
-
-Deprecated, replaced by [`find_installation`](Python-module.md#find_installation)
-function from `python` module.
-
-## extension_module
-
-Creates a `shared_module` target that is named according to the naming
-conventions of the target platform. All positional and keyword
-arguments are the same as for
-[shared_module](Reference-manual.md#shared_module).
-
-`extension_module` does not add any dependencies to the library so user may
-need to add `dependencies : dependency('python3')`, see
-[Python3 dependency](Dependencies.md#python3).
-
-*Added 0.38.0*
-
-Deprecated, replaced by [`extension_module`](Python-module.md#extension_module)
-method from `python` module.
-
-## language_version
-
-Returns a string with the Python language version such as `3.5`.
-
-*Added 0.40.0*
-
-Deprecated, replaced by [`language_version`](Python-module.md#language_version)
-method from `python` module.
-
-## sysconfig_path
-
-Returns the Python sysconfig path without prefix, such as
-`lib/python3.6/site-packages`.
-
-*Added 0.40.0*
-
-Deprecated, replaced by [`get_path`](Python-module.md#get_path)
-method from `python` module.
diff --git a/meson/docs/markdown/Python-module.md b/meson/docs/markdown/Python-module.md
deleted file mode 100644 (file)
index d99b36a..0000000
+++ /dev/null
@@ -1,244 +0,0 @@
----
-short-description: Generic python module
-authors:
-    - name: Mathieu Duponchelle
-      email: mathieu@centricular.com
-      years: [2018]
-      has-copyright: false
-...
-
-# Python module
-
-This module provides support for finding and building extensions against
-python installations, be they python 2 or 3.
-
-*Added 0.46.0*
-
-## Functions
-
-### `find_installation()`
-
-``` meson
-pymod.find_installation(name_or_path, ...)
-```
-
-Find a python installation matching `name_or_path`.
-
-That argument is optional, if not provided then the returned python
-installation will be the one used to run meson.
-
-If provided, it can be:
-
-- A simple name, eg `python-2.7`, meson will look for an external program
-  named that way, using [find_program]
-
-- A path, eg `/usr/local/bin/python3.4m`
-
-- One of `python2` or `python3`: in either case, the module will try some
-  alternative names: `py -2` or `py -3` on Windows, and `python` everywhere.
-  In the latter case, it will check whether the version provided by the
-  sysconfig module matches the required major version
-
-Keyword arguments are the following:
-
-- `required`: by default, `required` is set to `true` and Meson will
-  abort if no python installation can be found. If `required` is set to `false`,
-  Meson will continue even if no python installation was found. You can
-  then use the `.found()` method on the returned object to check
-  whether it was found or not. Since *0.48.0*  the value of a
-  [`feature`](Build-options.md#features) option can also be passed to the
-  `required` keyword argument.
-- `disabler`: if `true` and no python installation can be found, return a
-  [disabler object](Reference-manual.md#disabler-object) instead of a not-found object.
-  *Since 0.49.0*
-- `modules`: a list of module names that this python installation must have.
-  *Since 0.51.0*
-
-**Returns**: a [python installation][`python_installation` object]
-
-## `python_installation` object
-
-The `python_installation` object is an [external program], with several
-added methods.
-
-### Methods
-
-#### `path()`
-
-```meson
-str py_installation.path()
-```
-
-*Added 0.50.0*
-
-Works like the path method of other `ExternalProgram` objects. Was not
-provided prior to 0.50.0 due to a bug.
-
-#### `extension_module()`
-
-``` meson
-shared_module py_installation.extension_module(module_name, list_of_sources, ...)
-```
-
-Create a `shared_module` target that is named according to the naming
-conventions of the target platform.
-
-All positional and keyword arguments are the same as for [shared_module],
-excluding `name_suffix` and `name_prefix`, and with the addition of the following:
-
-- `subdir`: By default, meson will install the extension module in
-  the relevant top-level location for the python installation, eg
-  `/usr/lib/site-packages`. When subdir is passed to this method,
-  it will be appended to that location. This keyword argument is
-  mutually exclusive with `install_dir`
-
-`extension_module` does not add any dependencies to the library so user may
-need to add `dependencies : py_installation.dependency()`, see [][`dependency()`].
-
-**Returns**: a [buildtarget object]
-
-#### `dependency()`
-
-``` meson
-python_dependency py_installation.dependency(...)
-```
-
-This method accepts no positional arguments, and the same keyword arguments as
-the standard [dependency] function. It also supports the following keyword
-argument:
-
-- `embed`: *(since 0.53.0)* If true, meson will try to find a python dependency
-  that can be used for embedding python into an application.
-
-**Returns**: a [python dependency][`python_dependency` object]
-
-#### `install_sources()`
-
-``` meson
-void py_installation.install_sources(list_of_files, ...)
-```
-
-Install actual python sources (`.py`).
-
-All positional and keyword arguments are the same as for [install_data],
-with the addition of the following:
-
-- `pure`: On some platforms, architecture independent files are expected
-  to be placed in a separate directory. However, if the python sources
-  should be installed alongside an extension module built with this
-  module, this keyword argument can be used to override that behaviour.
-  Defaults to `true`
-
-- `subdir`: See documentation for the argument of the same name to
-  [][`extension_module()`]
-
-#### `get_install_dir()`
-
-``` meson
-string py_installation.get_install_dir(...)
-```
-
-Retrieve the directory [][`install_sources()`] will install to.
-
-It can be useful in cases where `install_sources` cannot be used directly,
-for example when using [configure_file].
-
-This function accepts no arguments, its keyword arguments are the same
-as [][`install_sources()`].
-
-**Returns**: A string
-
-#### `language_version()`
-
-``` meson
-string py_installation.language_version()
-```
-
-Get the major.minor python version, eg `2.7`.
-
-The version is obtained through the `sysconfig` module.
-
-This function expects no arguments or keyword arguments.
-
-**Returns**: A string
-
-#### `get_path()`
-
-``` meson
-string py_installation.get_path(path_name, fallback)
-```
-
-Get a path as defined by the `sysconfig` module.
-
-For example:
-
-``` meson
-purelib = py_installation.get_path('purelib')
-```
-
-This function requires at least one argument, `path_name`,
-which is expected to be a non-empty string.
-
-If `fallback` is specified, it will be returned if no path
-with the given name exists. Otherwise, attempting to read
-a non-existing path will cause a fatal error.
-
-**Returns**: A string
-
-#### `has_path()`
-
-``` meson
-    bool py_installation.has_path(path_name)
-```
-
-**Returns**: true if a path named `path_name` can be retrieved with
-[][`get_path()`], false otherwise.
-
-#### `get_variable()`
-
-``` meson
-string py_installation.get_variable(variable_name, fallback)
-```
-
-Get a variable as defined by the `sysconfig` module.
-
-For example:
-
-``` meson
-py_bindir = py_installation.get_variable('BINDIR', '')
-```
-
-This function requires at least one argument, `variable_name`,
-which is expected to be a non-empty string.
-
-If `fallback` is specified, it will be returned if no variable
-with the given name exists. Otherwise, attempting to read
-a non-existing variable will cause a fatal error.
-
-**Returns**: A string
-
-#### `has_variable()`
-
-``` meson
-    bool py_installation.has_variable(variable_name)
-```
-
-**Returns**: true if a variable named `variable_name` can be retrieved with
-[][`get_variable()`], false otherwise.
-
-## `python_dependency` object
-
-This [dependency object] subclass will try various methods to obtain the
-compiler and linker arguments, starting with pkg-config then potentially
-using information obtained from python's `sysconfig` module.
-
-It exposes the same methods as its parent class.
-
-[find_program]: Reference-manual.md#find_program
-[shared_module]: Reference-manual.md#shared_module
-[external program]: Reference-manual.md#external-program-object
-[dependency]: Reference-manual.md#dependency
-[install_data]: Reference-manual.md#install_data
-[configure_file]: Reference-manual.md#configure_file
-[dependency object]: Reference-manual.md#dependency-object
-[buildtarget object]: Reference-manual.md#build-target-object
diff --git a/meson/docs/markdown/Qt4-module.md b/meson/docs/markdown/Qt4-module.md
deleted file mode 100644 (file)
index 4be1be5..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-# Qt4 module
-
-This module provides support for Qt4's `moc`, `uic` and `rcc`
-tools. It is used identically to the [Qt 5 module](Qt5-module.md).
diff --git a/meson/docs/markdown/Qt5-module.md b/meson/docs/markdown/Qt5-module.md
deleted file mode 100644 (file)
index 0d9a6b6..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# Qt5 module
-
-The Qt5 module provides tools to automatically deal with the various
-tools and steps required for Qt. The module has two methods.
-
-## preprocess
-
-This method takes the following keyword arguments:
- - `moc_headers`, `moc_sources`, `ui_files`, `qresources`, which define the files that require preprocessing with `moc`, `uic` and `rcc`
- - `include_directories`, the directories to add to header search path for `moc` (optional)
- - `moc_extra_arguments`, any additional arguments to `moc` (optional). Available since v0.44.0.
- - `uic_extra_arguments`, any additional arguments to `uic` (optional). Available since v0.49.0.
- - `rcc_extra_arguments`, any additional arguments to `rcc` (optional). Available since v0.49.0.
- - `dependencies`, dependency objects needed by moc. Available since v0.48.0.
-
-It returns an opaque object that should be passed to a main build target.
-
-## compile_translations (since v0.44.0)
-
-This method generates the necessary targets to build translation files with lrelease, it takes the following keyword arguments:
- - `ts_files`, the list of input translation files produced by Qt's lupdate tool.
- - `install` when true, this target is installed during the install step (optional).
- - `install_dir` directory to install to (optional).
- - `build_by_default` when set to true, to have this target be built by default, that is, when invoking `meson compile`; the default value is false (optional).
-
-## has_tools
-
-This method returns `true` if all tools used by this module are found, `false`
-otherwise.
-
-It should be used to compile optional Qt code:
-```meson
-qt5 = import('qt5')
-if qt5.has_tools(required: get_option('qt_feature'))
-  moc_files = qt5.preprocess(...)
-  ...
-endif
-```
-
-This method takes the following keyword arguments:
-- `required`: by default, `required` is set to `false`. If `required` is set to
-  `true` or an enabled [`feature`](Build-options.md#features) and some tools are
-  missing Meson will abort.
-- `method`: method used to find the Qt dependency (`auto` by default).
-
-*Since: 0.54.0*
-
-## Dependencies
-
-See [Qt dependencies](Dependencies.md#qt4-qt5)
-
-The 'modules' argument is used to include Qt modules in the project.
-See the Qt documentation for the [list of modules](http://doc.qt.io/qt-5/qtmodules.html).
-
-The 'private_headers' argument allows usage of Qt's modules private headers.
-(since v0.47.0)
-
-## Example
-A simple example would look like this:
-
-```meson
-qt5 = import('qt5')
-qt5_dep = dependency('qt5', modules: ['Core', 'Gui'])
-inc = include_directories('includes')
-moc_files = qt5.preprocess(moc_headers : 'myclass.h',
-                           moc_extra_arguments: ['-DMAKES_MY_MOC_HEADER_COMPILE'],
-                           include_directories: inc,
-                           dependencies: qt5_dep)
-translations = qt5.compile_translations(ts_files : 'myTranslation_fr.ts', build_by_default : true)
-executable('myprog', 'main.cpp', 'myclass.cpp', moc_files,
-           include_directories: inc,
-           dependencies : qt5_dep)
-```
diff --git a/meson/docs/markdown/Quick-guide.md b/meson/docs/markdown/Quick-guide.md
deleted file mode 100644 (file)
index 74636e5..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
----
-title: Quickstart Guide
-short-description: Getting Started using Mesonbuild
-...
-
-# Using Meson
-
-Meson has been designed to be as simple to use as possible. This page
-outlines the initial steps needed for installation, troubleshooting,
-and standard use.
-
-For more advanced configuration please refer to the command line help `meson --help`
-or the Meson documentation located at the [Mesonbuild](https://mesonbuild.com) website.
-
-Table of Contents:
-* [Requirements](#requirements)
-* [Installation using package manager](#installation-using-package-manager)
-* [Installation using Python](#installation-using-python)
-* [Installation from source](#installation-from-source)
-* [Troubleshooting](#troubleshooting)
-* [Compiling a Meson project](#compiling-a-meson-project)
-* [Using Meson as a distro packager](#using-meson-as-a-distro-packager)
-
-Requirements
---
-
-* [Python 3](https://python.org)
-* [Ninja](https://github.com/ninja-build/ninja/)
-
-*Ninja is only needed if you use the Ninja backend. Meson can also
-generate native VS and XCode project files.*
-
-
-Installation using package manager
---
-
-Ubuntu:
-
-```console
-$ sudo apt-get install python3 python3-pip python3-setuptools \
-                       python3-wheel ninja-build
-```
-*Due to our frequent release cycle and development speed, distro packaged software may quickly become outdated.*
-
-Installation using Python
---
-Requirements: **pip3**
-
-The best way to receive the most up-to-date version of Mesonbuild.
-
-Install as a local user (recommended):
-```console
-$ pip3 install --user meson
-```
-Install as root:
-```console
-$ pip3 install meson
-```
-
-*If you are unsure whether to install as root or a local user, install as a local user.*
-
-
-Installation from source
---
-Requirements: **git**
-
-Meson can be run directly from the cloned git repository.
-
-```console
-$ git clone https://github.com/mesonbuild/meson.git /path/to/sourcedir
-```
-Troubleshooting:
---
-Common Issues:
-```console
-$ meson builddir
-$ bash: /usr/bin/meson: No such file or directory
-```
-Description: The default installation prefix for the python pip module installation is not included in your shell environment PATH. The default prefix for python pip installation modules is located under ``/usr/local``.
-
-**Resolution:
-This issue can be resolved by altering the default shell environment PATH to include ``/usr/local/bin``. **
-
-*Note: There are other ways of fixing this issue such as using symlinks or copying the binaries to a default path and these methods are not recommended or supported as they may break package management interoperability.*
-
-
-Compiling a Meson project
---
-
-The most common use case of Meson is compiling code on a code base you
-are working on. The steps to take are very simple.
-
-```console
-$ cd /path/to/source/root
-$ meson builddir && cd builddir
-$ meson compile
-$ meson test
-```
-
-The only thing to note is that you need to create a separate build
-directory. Meson will not allow you to build source code inside your
-source tree. All build artifacts are stored in the build
-directory. This allows you to have multiple build trees with different
-configurations at the same time. This way generated files are not
-added into revision control by accident.
-
-To recompile after code changes, just type `meson compile`. The build command
-is always the same. You can do arbitrary changes to source code and
-build system files and Meson will detect those and will do the right
-thing. If you want to build optimized binaries, just use the argument
-`--buildtype=debugoptimized` when running Meson. It is recommended
-that you keep one build directory for unoptimized builds and one for
-optimized ones. To compile any given configuration, just go into the
-corresponding build directory and run `meson compile`.
-
-Meson will automatically add compiler flags to enable debug
-information and compiler warnings (i.e. `-g` and `-Wall`). This means
-the user does not have to deal with them and can instead focus on
-coding.
-
-Using Meson as a distro packager
---
-
-Distro packagers usually want total control on the build flags
-used. Meson supports this use case natively. The commands needed to
-build and install Meson projects are the following.
-
-```console
-$ cd /path/to/source/root
-$ meson --prefix /usr --buildtype=plain builddir -Dc_args=... -Dcpp_args=... -Dc_link_args=... -Dcpp_link_args=...
-$ meson compile -C builddir
-$ meson test -C builddir
-$ DESTDIR=/path/to/staging/root meson install -C builddir
-```
-
-The command line switch `--buildtype=plain` tells Meson not to add its
-own flags to the command line. This gives the packager total control
-on used flags.
-
-This is very similar to other build systems. The only difference is
-that the `DESTDIR` variable is passed as an environment variable
-rather than as an argument to `meson install`.
-
-As distro builds happen always from scratch, you might consider
-enabling [unity builds](Unity-builds.md) on your packages because they
-are faster and produce better code. However there are many projects
-that do not build with unity builds enabled so the decision to use
-unity builds must be done by the packager on a case by case basis.
diff --git a/meson/docs/markdown/RPM-module.md b/meson/docs/markdown/RPM-module.md
deleted file mode 100644 (file)
index cab6d96..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# RPM module
-
-The RPM module can be used to create a sample rpm spec file for a
-Meson project. It autodetects installed files, dependencies and so
-on. Using it is very simple. At the very end of your Meson project
-(that is, the end of your top level `meson.build` file) add these two
-lines.
-
-```meson
-rpm = import('rpm')
-rpm.generate_spec_template()
-```
-
-Run Meson once on your code and the template will be written in your
-build directory. Then remove the two lines above and manually edit the
-template to add missing information. After this it is ready for use.
diff --git a/meson/docs/markdown/Reference-manual.md b/meson/docs/markdown/Reference-manual.md
deleted file mode 100644 (file)
index 966d408..0000000
+++ /dev/null
@@ -1,2588 +0,0 @@
-# Reference manual
-
-## Functions
-
-The following functions are available in build files. Click on each to
-see the description and usage. The objects returned by them are [list
-afterwards](#returned-objects).
-
-### add_global_arguments()
-
-``` meson
-  void add_global_arguments(arg1, arg2, ...)
-```
-
-Adds the positional arguments to the compiler command line. This
-function has two keyword arguments:
-
-- `language`: specifies the language(s) that the arguments should be
-applied to. If a list of languages is given, the arguments are added
-to each of the corresponding compiler command lines. Note that there
-is no way to remove an argument set in this way. If you have an
-argument that is only used in a subset of targets, you have to specify
-it in per-target flags.
-
-- `native` *(since 0.48.0)*: a boolean specifying whether the arguments should be
-  applied to the native or cross compilation. If `true` the arguments
-  will only be used for native compilations. If `false` the arguments
-  will only be used in cross compilations. If omitted, the flags are
-  added to native compilations if compiling natively and cross
-  compilations (only) when cross compiling.
-
-The arguments are used in all compiler invocations with the exception
-of compile tests, because you might need to run a compile test with
-and without the argument in question. For this reason only the
-arguments explicitly specified are used during compile tests.
-
-**Note:** Usually you should use `add_project_arguments` instead,
-  because that works even when you project is used as a subproject.
-
-**Note:** You must pass always arguments individually `arg1, arg2,
-  ...` rather than as a string `'arg1 arg2', ...`
-
-### add_global_link_arguments()
-
-``` meson
-    void add_global_link_arguments(*arg1*, *arg2*, ...)
-```
-
-Like `add_global_arguments` but the arguments are passed to the linker.
-
-### add_languages()
-
-``` meson
-  bool add_languages(*langs*)
-```
-
-Add programming languages used by the project. Equivalent to having them in the
-`project` declaration. This function is usually used to add languages that are
-only used under some conditions, like this:
-
-```meson
-project('foobar', 'c')
-if compiling_for_osx
-  add_languages('objc')
-endif
-if add_languages('cpp', required : false)
-  executable('cpp-app', 'main.cpp')
-endif
-```
-
-Takes the following keyword arguments:
-
-- `required`: defaults to `true`, which means that if any of the languages
-specified is not found, Meson will halt. *(since 0.47.0)* The value of a
-[`feature`](Build-options.md#features) option can also be passed.
-
-- `native` *(since 0.54.0)*: if set to `true`, the language will be used to compile for the build
-  machine, if `false`, for the host machine.
-
-Returns `true` if all languages specified were found and `false` otherwise.
-
-If `native` is omitted, the languages may be used for either build or host
-machine, but are never required for the build machine.  (i.e. it is equivalent
-to `add_languages(*langs*, native: false, required: *required*) and
-add_languages(*langs*, native: true, required: false)`. This default behaviour
-may change to `native: false` in a future meson version.
-
-### add_project_arguments()
-
-``` meson
-  void add_project_arguments(arg1, arg2, ...)
-```
-
-This function behaves in the same way as `add_global_arguments` except
-that the arguments are only used for the current project, they won't
-be used in any other subproject.
-
-### add_project_link_arguments()
-
-``` meson
-  void add_project_link_arguments(*arg1*, *arg2*, ...)
-```
-
-Like `add_project_arguments` but the arguments are passed to the linker.
-
-### add_test_setup()
-
-``` meson
-  void add_test_setup(*name*, ...)
-```
-
-Add a custom test setup that can be used to run the tests with a
-custom setup, for example under Valgrind. The keyword arguments are
-the following:
-
-- `env`: environment variables to set, such as `['NAME1=value1',
-  'NAME2=value2']`, or an [`environment()`
-  object](#environment-object) which allows more sophisticated
-  environment juggling. *(since 0.52.0)* A dictionary is also accepted.
-- `exe_wrapper`: a list containing the wrapper command or script followed by the arguments to it
-- `gdb`: if `true`, the tests are also run under `gdb`
-- `timeout_multiplier`: a number to multiply the test timeout with
-- `is_default` *(since 0.49.0)*: a bool to set whether this is the default test setup.
-  If `true`, the setup will be used whenever `meson test` is run
-  without the `--setup` option.
-
-To use the test setup, run `meson test --setup=*name*` inside the
-build dir.
-
-Note that all these options are also available while running the
-`meson test` script for running tests instead of `ninja test` or
-`msbuild RUN_TESTS.vcxproj`, etc depending on the backend.
-
-### alias_target
-
-``` meson
-runtarget alias_target(target_name, dep1, ...)
-```
-
-*(since 0.52.0)*
-
-This function creates a new top-level target. Like all top-level targets, this
-integrates with the selected backend. For instance, with you can
-run it as `meson compile target_name`. This is a dummy target that does not execute any
-command, but ensures that all dependencies are built. Dependencies can be any
-build target (e.g. return value of [executable()](#executable), custom_target(), etc)
-
-### assert()
-
-``` meson
-    void assert(*condition*, *message*)
-```
-
-Abort with an error message if `condition` evaluates to `false`.
-
-*(since 0.53.0)* `message` argument is optional and defaults to print the condition
-statement instead.
-
-### benchmark()
-
-``` meson
-    void benchmark(name, executable, ...)
-```
-
-Creates a benchmark item that will be run when the benchmark target is
-run. The behavior of this function is identical to [`test()`](#test) except for:
-
-* benchmark() has no `is_parallel` keyword because benchmarks are not run in parallel
-* benchmark() does not automatically add the `MALLOC_PERTURB_` environment variable
-
-*Note:* Prior to 0.52.0 benchmark would warn that `depends` and `priority`
-were unsupported, this is incorrect.
-
-### both_libraries()
-
-``` meson
-    buildtarget = both_libraries(library_name, list_of_sources, ...)
-```
-
-*(since 0.46.0)*
-
-Builds both a static and shared library with the given
-sources. Positional and keyword arguments are otherwise the same as
-for [`library`](#library). Source files will be compiled only once and
-object files will be reused to build both shared and static libraries,
-unless `b_staticpic` user option or `pic` argument are set to false in
-which case sources will be compiled twice.
-
-The returned [buildtarget](#build-target-object) always represents the
-shared library. In addition it supports the following extra methods:
-
-- `get_shared_lib()` returns the shared library build target
-- `get_static_lib()` returns the static library build target
-
-### build_target()
-
-Creates a build target whose type can be set dynamically with the
-`target_type` keyword argument.
-
-`target_type` may be set to one of:
-
-- `executable`
-- `shared_library`
-- `shared_module`
-- `static_library`
-- `both_libraries`
-- `library`
-- `jar`
-
-This declaration:
-
-```meson
-executable(<arguments and keyword arguments>)
-```
-
-is equivalent to this:
-
-```meson
-build_target(<arguments and keyword arguments>, target_type : 'executable')
-```
-
-The object returned by `build_target` and all convenience wrappers for
-`build_target` such as [`executable`](#executable) and
-[`library`](#library) has methods that are documented in the [object
-methods section](#build-target-object) below.
-
-### configuration_data()
-
-``` meson
-    configuration_data_object = configuration_data(...)
-```
-
-Creates an empty configuration object. You should add your
-configuration with [its method calls](#configuration-data-object) and
-finally use it in a call to `configure_file`.
-
-*(since 0.49.0)* Takes an optional dictionary as first argument. If
-provided, each key/value pair is added into the `configuration_data`
-as if `set()` method was called for each of them.
-
-### configure_file()
-
-``` meson
-    generated_file = configure_file(...)
-```
-
-This function can run in three modes depending on the keyword arguments
-passed to it.
-
-When a [`configuration_data()`](#configuration_data) object is passed
-to the `configuration:` keyword argument, it takes a template file as
-the `input:` (optional) and produces the `output:` (required) by
-substituting values from the configuration data as detailed in [the
-configuration file documentation](Configuration.md). *(since 0.49.0)* A
-dictionary can be passed instead of a
-[`configuration_data()`](#configuration_data) object.
-
-When a list of strings is passed to the `command:` keyword argument,
-it takes any source or configured file as the `input:` and assumes
-that the `output:` is produced when the specified command is run.
-
-*(since 0.47.0)* When the `copy:` keyword argument is set to `true`,
-this function will copy the file provided in `input:` to a file in the
-build directory with the name `output:` in the current directory.
-
-These are all the supported keyword arguments:
-
-- `capture` *(since 0.41.0)*: when this argument is set to true,
-  Meson captures `stdout` of the `command` and writes it to the target 
-  file specified as `output`.
-- `command`: as explained above, if specified, Meson does not create
-  the file itself but rather runs the specified command, which allows
-  you to do fully custom file generation. *(since 0.52.0)* The command can contain
-  file objects and more than one file can be passed to the `input` keyword
-  argument, see [`custom_target()`](#custom_target) for details about string
-  substitutions.
-- `copy` *(since 0.47.0)*: as explained above, if specified Meson only
-  copies the file from input to output.
-- `depfile` *(since 0.52.0)*: a dependency file that the command can write listing
-  all the additional files this target depends on. A change
-  in any one of these files triggers a reconfiguration.
-- `format` *(since 0.46.0)*: the format of defines. It defaults to `meson`, and so substitutes
-`#mesondefine` statements and variables surrounded by `@` characters, you can also use `cmake`
-to replace `#cmakedefine` statements and variables with the `${variable}` syntax. Finally you can use
-`cmake@` in which case substitutions will apply on `#cmakedefine` statements and variables with
-the `@variable@` syntax.
-- `input`: the input file name. If it's not specified in configuration
-  mode, all the variables in the `configuration:` object (see above)
-  are written to the `output:` file.
-- `install` *(since 0.50.0)*: when true, this generated file is installed during
-the install step, and `install_dir` must be set and not empty. When false, this
-generated file is not installed regardless of the value of `install_dir`.
-When omitted it defaults to true when `install_dir` is set and not empty,
-false otherwise.
-- `install_dir`: the subdirectory to install the generated file to
-  (e.g. `share/myproject`), if omitted or given the value of empty
-  string, the file is not installed.
-- `install_mode` *(since 0.47.0)*: specify the file mode in symbolic format
-  and optionally the owner/uid and group/gid for the installed files.
-- `output`: the output file name. *(since 0.41.0)* may contain
-  `@PLAINNAME@` or `@BASENAME@` substitutions. In configuration mode,
-  the permissions of the input file (if it is specified) are copied to
-  the output file.
-- `output_format` *(since 0.47.0)*: the format of the output to generate when no input
-  was specified. It defaults to `c`, in which case preprocessor directives
-  will be prefixed with `#`, you can also use `nasm`, in which case the
-  prefix will be `%`.
-- `encoding` *(since 0.47.0)*: set the file encoding for the input and output file,
-  defaults to utf-8. The supported encodings are those of python3, see
-  [standard-encodings](https://docs.python.org/3/library/codecs.html#standard-encodings).
-
-### custom_target()
-
-``` meson
-    customtarget custom_target(*name*, ...)
-```
-
-Create a custom top level build target. The only positional argument
-is the name of this target and the keyword arguments are the
-following.
-
-- `build_by_default` *(since 0.38.0)*: causes, when set to true, to
-  have this target be built by default. This means it will be built when
-  `meson compile` is called without any arguments. The default value is `false`.
-  *(since 0.50.0)* If `build_by_default` is explicitly set to false, `install`
-  will no longer override it. If `build_by_default` is not set, `install` will
-  still determine its default.
-- `build_always` **(deprecated)**: if `true` this target is always considered out of
-  date and is rebuilt every time.  Equivalent to setting both
-  `build_always_stale` and `build_by_default` to true.
-- `build_always_stale` *(since 0.47.0)*: if `true` the target is always considered out of date.
-  Useful for things such as build timestamps or revision control tags.
-  The associated command is run even if the outputs are up to date.
-- `capture`: there are some compilers that can't be told to write
-  their output to a file but instead write it to standard output. When
-  this argument is set to true, Meson captures `stdout` and writes it
-  to the target file. Note that your command argument list may not
-  contain `@OUTPUT@` when capture mode is active.
-- `console` *(since 0.48.0)*: keyword argument conflicts with `capture`, and is meant
-  for commands that are resource-intensive and take a long time to
-  finish. With the Ninja backend, setting this will add this target
-  to [Ninja's `console` pool](https://ninja-build.org/manual.html#_the_literal_console_literal_pool),
-  which has special properties such as not buffering stdout and
-  serializing all targets in this pool.
-- `command`: command to run to create outputs from inputs. The command
-  may be strings or the return value of functions that return file-like
-  objects such as [`find_program()`](#find_program),
-  [`executable()`](#executable), [`configure_file()`](#configure_file),
-  [`files()`](#files), [`custom_target()`](#custom_target), etc.
-  Meson will automatically insert the appropriate dependencies on
-  targets and files listed in this keyword argument.
-  Note: always specify commands in array form `['commandname',
-  '-arg1', '-arg2']` rather than as a string `'commandname -arg1
-  -arg2'` as the latter will *not* work.
-- `depend_files`: files ([`string`](#string-object),
-  [`files()`](#files), or [`configure_file()`](#configure_file)) that
-  this target depends on but are not listed in the `command` keyword
-  argument. Useful for adding regen dependencies.
-- `depends`: specifies that this target depends on the specified
-  target(s), even though it does not take any of them as a command
-  line argument. This is meant for cases where you have a tool that
-  e.g. does globbing internally. Usually you should just put the
-  generated sources as inputs and Meson will set up all dependencies
-  automatically.
-- `depfile`: a dependency file that the command can write listing
-  all the additional files this target depends on, for example a C
-  compiler would list all the header files it included, and a change
-  in any one of these files triggers a recompilation
-- `input`: list of source files. *(since 0.41.0)* the list is flattened.
-- `install`: when true, this target is installed during the install step
-- `install_dir`: directory to install to
-- `install_mode` *(since 0.47.0)*: the file mode and optionally the
-  owner/uid and group/gid
-- `output`: list of output files
-
-The list of strings passed to the `command` keyword argument accept
-the following special string substitutions:
-
-- `@INPUT@`: the full path to the input passed to `input`. If more than
-  one input is specified, all of them will be substituted as separate
-  arguments only if the command uses `'@INPUT@'` as a
-  standalone-argument. For instance, this would not work: `command :
-  ['cp', './@INPUT@']`, but this would: `command : ['cp', '@INPUT@']`.
-- `@OUTPUT@`: the full path to the output passed to `output`. If more
-  than one outputs are specified, the behavior is the same as
-  `@INPUT@`.
-- `@INPUT0@` `@INPUT1@` `...`: the full path to the input with the specified array index in `input`
-- `@OUTPUT0@` `@OUTPUT1@` `...`: the full path to the output with the specified array index in `output`
-- `@OUTDIR@`: the full path to the directory where the output(s) must be written
-- `@DEPFILE@`: the full path to the dependency file passed to `depfile`
-- `@PLAINNAME@`: the input filename, without a path
-- `@BASENAME@`: the input filename, with extension removed
-- `@PRIVATE_DIR@` *(since 0.50.1)*: path to a directory where the custom target must store all its intermediate files.
-
-*(since 0.47.0)* The `depfile` keyword argument also accepts the `@BASENAME@` and `@PLAINNAME@` substitutions. 
-
-The returned object also has methods that are documented in the
-[object methods section](#custom-target-object) below.
-
-### declare_dependency()
-
-``` meson
-    dependency_object declare_dependency(...)
-```
-
-This function returns a [dependency object](#dependency-object) that
-behaves like the return value of [`dependency`](#dependency) but is
-internal to the current build. The main use case for this is in
-subprojects. This allows a subproject to easily specify how it should
-be used. This makes it interchangeable with the same dependency that
-is provided externally by the system. This function has the following
-keyword arguments:
-
-- `compile_args`: compile arguments to use.
-- `dependencies`: other dependencies needed to use this dependency.
-- `include_directories`: the directories to add to header search path,
-  must be include_directories objects or *(since 0.50.0)* plain strings
-- `link_args`: link arguments to use.
-- `link_with`: libraries to link against.
-- `link_whole` *(since 0.46.0)*: libraries to link fully, same as [`executable`](#executable).
-- `sources`: sources to add to targets (or generated header files
-  that should be built before sources including them are built)
-- `version`: the version of this dependency, such as `1.2.3`
-- `variables` *(since 0.54.0)*: a dictionary of arbitrary strings, this is meant to be used
-  in subprojects where special variables would be provided via cmake or
-  pkg-config.
-
-### dependency()
-
-``` meson
-    dependency_object dependency(*dependency_name*, ...)
-```
-
-Finds an external dependency (usually a library installed on your
-system) with the given name with `pkg-config` and [with
-CMake](Dependencies.md#cmake) if `pkg-config` fails. Additionally,
-frameworks (OSX only) and [library-specific fallback detection
-logic](Dependencies.md#dependencies-with-custom-lookup-functionality)
-are also supported. This function supports the following keyword
-arguments:
-
-- `default_options` *(since 0.37.0)*: an array of default option values
-  that override those set in the subproject's `meson_options.txt`
-  (like `default_options` in [`project()`](#project), they only have
-  effect when Meson is run for the first time, and command line
-  arguments override any default options in build files)
-- `fallback`: specifies a subproject fallback to use in case the
-  dependency is not found in the system. The value is an array
-  `['subproj_name', 'subproj_dep']` where the first value is the name
-  of the subproject and the second is the variable name in that
-  subproject that contains a dependency object such as the return
-  value of [`declare_dependency`](#declare_dependency) or
-  [`dependency()`](#dependency), etc. Note that this means the
-  fallback dependency may be a not-found dependency, in which
-  case the value of the `required:` kwarg will be obeyed.
-  *(since 0.54.0)* `'subproj_dep'` argument can be omitted in the case the
-  subproject used `meson.override_dependency('dependency_name', subproj_dep)`.
-  In that case, the `fallback` keyword argument can be a single string instead
-  of a list of 2 strings. *Since 0.55.0* the `fallback` keyword argument can be
-  omitted when there is a wrap file or a directory with the same `dependency_name`,
-  and subproject registered the dependency using
-  `meson.override_dependency('dependency_name', subproj_dep)`, or when the wrap
-  file has `dependency_name` in its `[provide]` section.
-  See [Wrap documentation](Wrap-dependency-system-manual.md#provide-section)
-  for more details.
-- `language` *(since 0.42.0)*: defines what language-specific
-  dependency to find if it's available for multiple languages.
-- `method`: defines the way the dependency is detected, the default is
-  `auto` but can be overridden to be e.g. `qmake` for Qt development,
-  and [different dependencies support different values](
-  Dependencies.md#dependencies-with-custom-lookup-functionality)
-  for this (though `auto` will work on all of them)
-- `native`: if set to `true`, causes Meson to find the dependency on
-  the build machine system rather than the host system (i.e. where the
-  cross compiled binary will run on), usually only needed if you build
-  a tool to be used during compilation.
-- `not_found_message` *(since 0.50.0)*: an optional string that will
-  be printed as a `message()` if the dependency was not found.
-- `required`: when set to false, Meson will proceed with the build
-  even if the dependency is not found. *(since 0.47.0)* The value of a
-  [`feature`](Build-options.md#features) option can also be passed.
-- `static`: tells the dependency provider to try to get static
-  libraries instead of dynamic ones (note that this is not supported
-  by all dependency backends)
-- `version` *(since 0.37.0)*: specifies the required version, a string containing a
-  comparison operator followed by the version string, examples include
-  `>1.0.0`, `<=2.3.5` or `3.1.4` for exact matching. 
-  You can also specify multiple restrictions by passing a list to this
-  keyword argument, such as: `['>=3.14.0', '<=4.1.0']`.
-  These requirements are never met if the version is unknown.
-- `include_type` *(since 0.52.0)*: an enum flag, marking how the dependency
-  flags should be converted. Supported values are `'preserve'`, `'system'` and
-  `'non-system'`. System dependencies may be handled differently on some
-   platforms, for instance, using `-isystem` instead of `-I`, where possible.
-   If `include_type` is set to `'preserve'`, no additional conversion will be
-   performed. The default value is `'preserve'`.
-- other
-[library-specific](Dependencies.md#dependencies-with-custom-lookup-functionality)
-keywords may also be accepted (e.g. `modules` specifies submodules to use for
-dependencies such as Qt5 or Boost. `components` allows the user to manually
-add CMake `COMPONENTS` for the `find_package` lookup)
-- `disabler` *(since 0.49.0)*: if `true` and the dependency couldn't be found,
-  returns a [disabler object](#disabler-object) instead of a not-found dependency.
-
-If dependency_name is `''`, the dependency is always not found.  So
-with `required: false`, this always returns a dependency object for
-which the `found()` method returns `false`, and which can be passed
-like any other dependency to the `dependencies:` keyword argument of a
-`build_target`.  This can be used to implement a dependency which is
-sometimes not required e.g. in some branches of a conditional, or with
-a `fallback:` kwarg, can be used to declare an optional dependency
-that only looks in the specified subproject, and only if that's
-allowed by `--wrap-mode`.
-
-The returned object also has methods that are documented in the
-[object methods section](#dependency-object) below.
-
-### disabler()
-
-*(since 0.44.0)*
-
-Returns a [disabler object](#disabler-object).
-
-### error()
-
-``` meson
-    void error(message)
-```
-
-Print the argument string and halts the build process.
-
-### environment()
-
-``` meson
-    environment_object environment(...)
-```
-
-*(since 0.35.0)*
-
-Returns an empty [environment variable object](#environment-object).
-
-*(since 0.52.0)* Takes an optional dictionary as first argument. If
-provided, each key/value pair is added into the `environment_object`
-as if `set()` method was called for each of them.
-
-### executable()
-
-``` meson
-    buildtarget executable(*exe_name*, *sources*, ...)
-```
-
-Creates a new executable. The first argument specifies its name and
-the remaining positional arguments define the input files to use. They
-can be of the following types:
-
-- Strings relative to the current source directory
-- [`files()`](#files) objects defined in any preceding build file
-- The return value of configure-time generators such as [`configure_file()`](#configure_file)
-- The return value of build-time generators such as
-  [`custom_target()`](#custom_target) or
-  [`generator.process()`](#generator-object)
-
-These input files can be sources, objects, libraries, or any other
-file. Meson will automatically categorize them based on the extension
-and use them accordingly. For instance, sources (`.c`, `.cpp`,
-`.vala`, `.rs`, etc) will be compiled and objects (`.o`, `.obj`) and
-libraries (`.so`, `.dll`, etc) will be linked.
-
-With the Ninja backend, Meson will create a build-time [order-only
-dependency](https://ninja-build.org/manual.html#ref_dependencies) on
-all generated input files, including unknown files. This is needed
-to bootstrap the generation of the real dependencies in the
-[depfile](https://ninja-build.org/manual.html#ref_headers)
-generated by your compiler to determine when to rebuild sources.
-Ninja relies on this dependency file for all input files, generated
-and non-generated. The behavior is similar for other backends.
-
-Executable supports the following keyword arguments. Note that just
-like the positional arguments above, these keyword arguments can also
-be passed to [shared and static libraries](#library).
-
-- `<languagename>_pch`: precompiled header file to use for the given language
-- `<languagename>_args`: compiler flags to use for the given language;
-  eg: `cpp_args` for C++
-- `build_by_default` *(since 0.38.0)*: causes, when set to true, to
-   have this target be built by default. This means it will be built when
-  `meson compile` is called without any arguments. The default value is
-  `true` for all built target types.
-- `build_rpath`: a string to add to target's rpath definition in the
-  build dir, but which will be removed on install
-- `dependencies`: one or more objects created with
-  [`dependency`](#dependency) or [`find_library`](#compiler-object)
-  (for external deps) or [`declare_dependency`](#declare_dependency)
-  (for deps built by the project)
-- `extra_files`: not used for the build itself but are shown as
-  source files in IDEs that group files by targets (such as Visual
-  Studio)
-- `gui_app`: when set to true flags this target as a GUI application on
-  platforms where this makes a difference (e.g. Windows).
-- `link_args`: flags to use during linking. You can use UNIX-style
-  flags here for all platforms.
-- `link_depends`: strings, files, or custom targets the link step
-  depends on such as a symbol visibility map. The purpose is to
-  automatically trigger a re-link (but not a re-compile) of the target
-  when this file changes.
-- `link_language` *(since 0.51.0)* *(broken until 0.55.0)*: makes the linker for this
-  target be for the specified language. It is generally unnecessary to set
-  this, as meson will detect the right linker to use in most cases. There are
-  only two cases where this is needed. One, your main function in an
-  executable is not in the language meson picked, or second you want to force
-  a library to use only one ABI.
-- `link_whole` *(since 0.40.0)*: links all contents of the given static libraries
-  whether they are used by not, equivalent to the `-Wl,--whole-archive` argument flag of GCC.
-  *(since 0.41.0)* If passed a list that list will be flattened.
-  *(since 0.51.0)* This argument also accepts outputs produced by
-  custom targets. The user must ensure that the output is a library in
-  the correct format.
-- `link_with`: one or more shared or static libraries (built by this
-  project) that this target should be linked with. *(since 0.41.0)* If passed a 
-  list this list will be flattened. *(since 0.51.0)* The arguments can also be custom targets. 
-  In this case Meson will assume that merely adding the output file in the linker command
-  line is sufficient to make linking work. If this is not sufficient,
-  then the build system writer must write all other steps manually.
-- `export_dynamic` *(since 0.45.0)*: when set to true causes the target's symbols to be
-  dynamically exported, allowing modules built using the
-  [`shared_module`](#shared_module) function to refer to functions,
-  variables and other symbols defined in the executable itself. Implies
-  the `implib` argument.
-- `implib` *(since 0.42.0)*: when set to true, an import library is generated for the
-  executable (the name of the import library is based on *exe_name*).
-  Alternatively, when set to a string, that gives the base name for
-  the import library.  The import library is used when the returned
-  build target object appears in `link_with:` elsewhere.  Only has any
-  effect on platforms where that is meaningful (e.g. Windows). Implies
-  the `export_dynamic` argument.
-- `implicit_include_directories` *(since 0.42.0)*: a boolean telling whether Meson
-  adds the current source and build directories to the include path,
-  defaults to `true`.
-- `include_directories`: one or more objects created with the
-  `include_directories` function, or *(since 0.50.0)* strings, which
-  will be transparently expanded to include directory objects
-- `install`: when set to true, this executable should be installed, defaults to `false`
-- `install_dir`: override install directory for this file. The value is
-  relative to the `prefix` specified. F.ex, if you want to install
-  plugins into a subdir, you'd use something like this: `install_dir :
-  get_option('libdir') / 'projectname-1.0'`.
-- `install_mode` *(since 0.47.0)*: specify the file mode in symbolic format
-  and optionally the owner/uid and group/gid for the installed files.
-- `install_rpath`: a string to set the target's rpath to after install
-  (but *not* before that). On Windows, this argument has no effect.
-- `objects`: list of prebuilt object files (usually for third party
-  products you don't have source to) that should be linked in this
-  target, **never** use this for object files that you build yourself.
-- `name_suffix`: the string that will be used as the extension for the
-  target by overriding the default. By default on Windows this is
-  `exe` and on other platforms it is omitted. Set this to `[]`, or omit
-  the keyword argument for the default behaviour.
-- `override_options` *(since 0.40.0)*: takes an array of strings in the same format as
-  `project`'s `default_options` overriding the values of these options
-  for this target only.
-- `gnu_symbol_visibility` *(since 0.48.0)*: specifies how symbols should be exported, see
-  e.g [the GCC Wiki](https://gcc.gnu.org/wiki/Visibility) for more
-  information. This value can either be an empty string or one of
-  `default`, `internal`, `hidden`, `protected` or `inlineshidden`, which
-  is the same as `hidden` but also includes things like C++ implicit
-  constructors as specified in the GCC manual. Ignored on compilers that
-  do not support GNU visibility arguments.
-- `d_import_dirs`: list of directories to look in for string imports used
-  in the D programming language
-- `d_unittest`: when set to true, the D modules are compiled in debug mode
-- `d_module_versions`: list of module version identifiers set when compiling D sources
-- `d_debug`: list of module debug identifiers set when compiling D sources
-- `pie` *(since 0.49.0)*: build a position-independent executable
-- `native`: is a boolean controlling whether the target is compiled for the
-  build or host machines. Defaults to false, building for the host machine.
-
-The list of `sources`, `objects`, and `dependencies` is always
-flattened, which means you can freely nest and add lists while
-creating the final list.
-
-The returned object also has methods that are documented in the
-[object methods section](#build-target-object) below.
-
-### find_library()
-
-*(since 0.31.0)* **(deprecated)** Use `find_library()` method of
-[the compiler object](#compiler-object) as obtained from
-`meson.get_compiler(lang)`.
-
-### find_program()
-
-``` meson
-    program find_program(program_name1, program_name2, ...)
-```
-
-`program_name1` here is a string that can be an executable or script
-to be searched for in `PATH`, or a script in the current source
-directory.
-
-*(since 0.37.0)* `program_name2` and later positional arguments are used as fallback
-strings to search for. This is meant to be used for cases where the
-program may have many alternative names, such as `foo` and
-`foo.py`. The function will check for the arguments one by one and the
-first one that is found is returned.
-
-Keyword arguments are the following:
-
-- `required` By default, `required` is set to `true` and Meson will
-  abort if no program can be found. If `required` is set to `false`,
-  Meson continue even if none of the programs can be found. You can
-  then use the `.found()` method on the [returned object](#external-program-object) to check
-  whether it was found or not. *(since 0.47.0)* The value of a
-  [`feature`](Build-options.md#features) option can also be passed to the
-  `required` keyword argument.
-
-- `native` *(since 0.43.0)*: defines how this executable should be searched. By default
-  it is set to `false`, which causes Meson to first look for the
-  executable in the cross file (when cross building) and if it is not
-  defined there, then from the system. If set to `true`, the cross
-  file is ignored and the program is only searched from the system.
-
-- `disabler` *(since 0.49.0)*: if `true` and the program couldn't be found, return a
-  [disabler object](#disabler-object) instead of a not-found object.
-  
-
-- `version` *(since 0.52.0)*: specifies the required version, see
-  [`dependency()`](#dependency) for argument format. The version of the program
-  is determined by running `program_name --version` command. If stdout is empty
-  it fallbacks to stderr. If the output contains more text than simply a version
-  number, only the first occurrence of numbers separated by dots is kept.
-  If the output is more complicated than that, the version checking will have to
-  be done manually using [`run_command()`](#run_command).
-
-- `dirs` *(since 0.53.0)*: extra list of absolute paths where to look for program
-  names.
-
-Meson will also autodetect scripts with a shebang line and run them
-with the executable/interpreter specified in it both on Windows
-(because the command invocator will reject the command otherwise) and
-Unixes (if the script file does not have the executable bit
-set). Hence, you *must not* manually add the interpreter while using
-this script as part of a list of commands.
-
-If you need to check for a program in a non-standard location, you can
-just pass an absolute path to `find_program`, e.g.
-
-```meson
-setcap = find_program('setcap', '/usr/sbin/setcap', '/sbin/setcap', required : false)
-```
-
-It is also possible to pass an array to `find_program` in case you
-need to construct the set of paths to search on the fly:
-
-```meson
-setcap = find_program(['setcap', '/usr/sbin/setcap', '/sbin/setcap'], required : false)
-```
-
-The returned object also has methods that are documented in the
-[object methods section](#external-program-object) below.
-
-### files()
-
-``` meson
-    file_array files(list_of_filenames)
-```
-
-This command takes the strings given to it in arguments and returns
-corresponding File objects that you can use as sources for build
-targets. The difference is that file objects remember the subdirectory
-they were defined in and can be used anywhere in the source tree. As
-an example suppose you have source file `foo.cpp` in subdirectory
-`bar1` and you would like to use it in a build target that is defined
-in `bar2`. To make this happen you first create the object in `bar1`
-like this:
-
-```meson
-    foofile = files('foo.cpp')
-```
-
-Then you can use it in `bar2` like this:
-
-```meson
-    executable('myprog', 'myprog.cpp', foofile, ...)
-```
-
-Meson will then do the right thing.
-
-### generator()
-
-``` meson
-    generator_object generator(*executable*, ...)
-```
-
-See also: [`custom_target`](#custom_target)
-
-This function creates a [generator object](#generator-object) that can
-be used to run custom compilation commands. The only positional
-argument is the executable to use. It can either be a self-built
-executable or one returned by find_program. Keyword arguments are the
-following:
-
-- `arguments`: a list of template strings that will be the command line
-  arguments passed to the executable
-- `depends` *(since 0.51.0)*: is an array of build targets that must be built before this
-  generator can be run. This is used if you have a generator that calls
-  a second executable that is built in this project.
-- `depfile`: is a template string pointing to a dependency file that a
-  generator can write listing all the additional files this target
-  depends on, for example a C compiler would list all the header files
-  it included, and a change in any one of these files triggers a
-  recompilation
-- `output`: a template string (or list of template strings) defining
-  how an output file name is (or multiple output names are) generated
-  from a single source file name
-- `capture` *(since 0.43.0)*: when this argument is set to true, Meson
-  captures `stdout` of the `executable` and writes it to the target file
-  specified as `output`.
-
-The returned object also has methods that are documented in the
-[object methods section](#generator-object) below.
-
-The template strings passed to all the above keyword arguments accept
-the following special substitutions:
-
-- `@PLAINNAME@`: the complete input file name, e.g: `foo.c` becomes `foo.c` (unchanged)
-- `@BASENAME@`: the base of the input filename, e.g.: `foo.c.y` becomes `foo.c` (extension is removed)
-
-Each string passed to the `output` keyword argument *must* be
-constructed using one or both of these two substitutions.
-
-In addition to the above substitutions, the `arguments` keyword
-argument also accepts the following:
-
-- `@OUTPUT@`: the full path to the output file
-- `@INPUT@`: the full path to the input file
-- `@DEPFILE@`: the full path to the depfile
-- `@SOURCE_DIR@`: the full path to the root of the source tree
-- `@CURRENT_SOURCE_DIR@`: this is the directory where the currently processed meson.build is located in
-- `@BUILD_DIR@`: the full path to the root of the build dir where the output will be placed
-
-NOTE: Generators should only be used for outputs that will ***only***
-be used as inputs for a [build target](#build_target) or a [custom
-target](#custom_target). When you use the processed output of a
-generator in multiple targets, the generator will be run multiple
-times to create outputs for each target. Each output will be created
-in a target-private directory `@BUILD_DIR@`.
-
-If you want to generate files for general purposes such as for
-generating headers to be used by several sources, or data that will be
-installed, and so on, use a [`custom_target`](#custom_target) instead.
-
-### get_option()
-
-``` meson
-    value get_option(option_name)
-```
-
-Obtains the value of the [project build option](Build-options.md)
-specified in the positional argument.
-
-Note that the value returned for built-in options that end in `dir`
-such as `bindir` and `libdir` is always a path relative to (and
-inside) the `prefix`.
-
-The only exceptions are: `sysconfdir`, `localstatedir`, and
-`sharedstatedir` which will return the value passed during
-configuration as-is, which may be absolute, or relative to `prefix`.
-[`install_dir` arguments](Installing.md) handles that as expected, but
-if you need the absolute path to one of these e.g. to use in a define
-etc., you should use `get_option('prefix') / get_option('localstatedir')`
-
-For options of type `feature` a
-[feature option object](#feature-option-object)
-is returned instead of a string.
-See [`feature` options](Build-options.md#features)
-documentation for more details.
-
-### get_variable()
-
-``` meson
-    value get_variable(variable_name, fallback)
-```
-
-This function can be used to dynamically obtain a variable. `res =
-get_variable(varname, fallback)` takes the value of `varname` (which
-must be a string) and stores the variable of that name into `res`. If
-the variable does not exist, the variable `fallback` is stored to
-`res`instead. If a fallback is not specified, then attempting to read
-a non-existing variable will cause a fatal error.
-
-### import()
-
-``` meson
-    module_object import(module_name)
-```
-
-Imports the given extension module. Returns an opaque object that can
-be used to call the methods of the module. Here's an example for a
-hypothetical `testmod` module.
-
-```meson
-    tmod = import('testmod')
-    tmod.do_something()
-```
-
-### include_directories()
-
-``` meson
-    include_object include_directories(directory_names, ...)
-```
-
-Returns an opaque object which contains the directories (relative to
-the current directory) given in the positional arguments. The result
-can then be passed to the `include_directories:` keyword argument when
-building executables or libraries. You can use the returned object in
-any subdirectory you want, Meson will make the paths work
-automatically.
-
-Note that this function call itself does not add the directories into
-the search path, since there is no global search path. For something
-like that, see [`add_project_arguments()`](#add_project_arguments).
-
-See also `implicit_include_directories` parameter of
-[executable()](#executable), which adds current source and build
-directories to include path.
-
-Each directory given is converted to two include paths: one that is
-relative to the source root and one relative to the build root.
-
-For example, with the following source tree layout in
-`/home/user/project.git`:
-
-`meson.build`:
-```meson
-project(...)
-
-subdir('include')
-subdir('src')
-
-...
-```
-
-`include/meson.build`:
-```meson
-inc = include_directories('.')
-
-...
-```
-
-`src/meson.build`:
-```meson
-sources = [...]
-
-executable('some-tool', sources,
-  include_directories : inc,
-  ...)
-
-...
-```
-
-If the build tree is `/tmp/build-tree`, the following include paths
-will be added to the `executable()` call: `-I/tmp/build-tree/include
--I/home/user/project.git/include`.
-
-This function has one keyword argument `is_system` which, if set,
-flags the specified directories as system directories. This means that
-they will be used with the `-isystem` compiler argument rather than
-`-I` on compilers that support this flag (in practice everything
-except Visual Studio).
-
-### install_data()
-
-``` meson
-    void install_data(list_of_files, ...)
-```
-
-Installs files from the source tree that are listed as positional
-arguments. The following keyword arguments are supported:
-
-- `install_dir`: the absolute or relative path to the installation
-  directory. If this is a relative path, it is assumed to be relative
-  to the prefix.
-
-  If omitted, the directory defaults to `{datadir}/{projectname}` *(since 0.45.0)*.
-
-- `install_mode`: specify the file mode in symbolic format and
-  optionally the owner/uid and group/gid for the installed files. For
-  example:
-
-  `install_mode: 'rw-r--r--'` for just the file mode
-
-  `install_mode: ['rw-r--r--', 'nobody', 'nobody']` for the file mode and the user/group
-
-  `install_mode: ['rw-r-----', 0, 0]` for the file mode and uid/gid
-
- To leave any of these three as the default, specify `false`.
-
-- `rename` *(since 0.46.0)*: if specified renames each source file into corresponding
-  file from `rename` list. Nested paths are allowed and they are
-  joined with `install_dir`. Length of `rename` list must be equal to
-  the number of sources.
-
-See [Installing](Installing.md) for more examples.
-
-### install_headers()
-
-``` meson
-    void install_headers(list_of_headers, ...)
-```
-
-Installs the specified header files from the source tree into the
-system header directory (usually `/{prefix}/include`) during the
-install step. This directory can be overridden by specifying it with
-the `install_dir` keyword argument. If you just want to install into a
-subdirectory of the system header directory, then use the `subdir`
-argument. As an example if this has the value `myproj` then the
-headers would be installed to `/{prefix}/include/myproj`.
-
-For example, this will install `common.h` and `kola.h` into
-`/{prefix}/include`:
-
-```meson
-install_headers('common.h', 'proj/kola.h')
-```
-
-This will install `common.h` and `kola.h` into `/{prefix}/include/myproj`:
-
-```meson
-install_headers('common.h', 'proj/kola.h', subdir : 'myproj')
-```
-
-This will install `common.h` and `kola.h` into `/{prefix}/cust/myproj`:
-
-```meson
-install_headers('common.h', 'proj/kola.h', install_dir : 'cust', subdir : 'myproj')
-```
-
-Accepts the following keywords:
-
-- `install_mode` *(since 0.47.0)*: can be used to specify the file mode in symbolic
-  format and optionally the owner/uid and group/gid for the installed files.
-  An example value could be `['rwxr-sr-x', 'root', 'root']`.
-
-### install_man()
-
-``` meson
-    void install_man(list_of_manpages, ...)
-```
-
-Installs the specified man files from the source tree into system's
-man directory during the install step. This directory can be
-overridden by specifying it with the `install_dir` keyword
-argument.
-
-Accepts the following keywords:
-
-- `install_mode` *(since 0.47.0)*: can be used to specify the file mode in symbolic
-  format and optionally the owner/uid and group/gid for the installed files.
-  An example value could be `['rwxr-sr-x', 'root', 'root']`.
-
-*(since 0.49.0)* [manpages are no longer compressed implicitly][install_man_49].
-
-[install_man_49]: https://mesonbuild.com/Release-notes-for-0-49-0.html#manpages-are-no-longer-compressed-implicitly
-
-### install_subdir()
-
-``` meson
-    void install_subdir(subdir_name, install_dir : ..., exclude_files : ..., exclude_directories : ..., strip_directory : ...)
-```
-
-Installs the entire given subdirectory and its contents from the
-source tree to the location specified by the keyword argument
-`install_dir`.
-
-The following keyword arguments are supported:
-
-- `exclude_files`: a list of file names that should not be installed.
-  Names are interpreted as paths relative to the `subdir_name` location.
-- `exclude_directories`: a list of directory names that should not be installed.
-  Names are interpreted as paths relative to the `subdir_name` location.
-- `install_dir`: the location to place the installed subdirectory.
-- `install_mode` *(since 0.47.0)*: the file mode in symbolic format and optionally
-  the owner/uid and group/gid for the installed files.
-- `strip_directory` *(since 0.45.0)*: install directory contents. `strip_directory=false` by default.
-  If `strip_directory=true` only the last component of the source path is used.
-
-For a given directory `foo`:
-```text
-foo/
-  bar/
-    file1
-  file2
-```
-`install_subdir('foo', install_dir : 'share', strip_directory : false)` creates
-```text
-share/
-  foo/
-    bar/
-      file1
-    file2
-```
-
-`install_subdir('foo', install_dir : 'share', strip_directory : true)` creates
-```text
-share/
-  bar/
-    file1
-  file2
-```
-
-`install_subdir('foo/bar', install_dir : 'share', strip_directory : false)` creates
-```text
-share/
-  bar/
-    file1
-```
-
-`install_subdir('foo/bar', install_dir : 'share', strip_directory : true)` creates
-```text
-share/
-  file1
-```
-
-### is_disabler()
-
-``` meson
-    bool is_disabler(var)
-```
-
-*(since 0.52.0)*
-
-Returns true if a variable is a disabler and false otherwise.
-
-### is_variable()
-
-``` meson
-    bool is_variable(varname)
-```
-
-Returns true if a variable of the given name exists and false otherwise.
-
-### jar()
-
-```meson
-   jar_object jar(name, list_of_sources, ...)
-```
-
-Build a jar from the specified Java source files. Keyword arguments
-are the same as [`executable`](#executable)'s, with the addition of
-`main_class` which specifies the main class to execute when running
-the jar with `java -jar file.jar`.
-
-### join_paths()
-
-``` meson
-string join_paths(string1, string2, ...)
-```
-
-*(since 0.36.0)*
-
-Joins the given strings into a file system path segment. For example
-`join_paths('foo', 'bar')` results in `foo/bar`. If any one of the
-individual segments is an absolute path, all segments before it are
-dropped. That means that `join_paths('foo', '/bar')` returns `/bar`.
-
-**Warning** Don't use `join_paths()` for sources in [`library`](#library) and
-[`executable`](#executable), you should use [`files`](#files) instead.
-
-*(since 0.49.0)* Using the`/` operator on strings is equivalent to calling
-`join_paths`.
-
-```meson
-# res1 and res2 will have identical values
-res1 = join_paths(foo, bar)
-res2 = foo / bar
-```
-
-### library()
-
-``` meson
-    buildtarget library(library_name, list_of_sources, ...)
-```
-
-Builds a library that is either static, shared or both depending on
-the value of `default_library`
-user [option](https://mesonbuild.com/Builtin-options.html).
-You should use this instead of [`shared_library`](#shared_library),
-[`static_library`](#static_library) or
-[`both_libraries`](#both_libraries) most of the time. This allows you
-to toggle your entire project (including subprojects) from shared to
-static with only one option. This option applies to libraries being
-built internal to the entire project. For external dependencies, the
-default library type preferred is shared. This can be adapted on a per
-library basis using the [dependency()](#dependency)) `static` keyword.
-
-The keyword arguments for this are the same as for
-[`executable`](#executable) with the following additions:
-
-- `name_prefix`: the string that will be used as the prefix for the
-  target output filename by overriding the default (only used for
-  libraries). By default this is `lib` on all platforms and compilers,
-  except for MSVC shared libraries where it is omitted to follow
-  convention, and Cygwin shared libraries where it is `cyg`.
-- `name_suffix`: the string that will be used as the suffix for the
-  target output filename by overriding the default (see also:
-  [executable()](#executable)). By default, for shared libraries this
-  is `dylib` on macOS, `dll` on Windows, and `so` everywhere else.
-  For static libraries, it is `a` everywhere. By convention MSVC
-  static libraries use the `lib` suffix, but we use `a` to avoid a
-  potential name clash with shared libraries which also generate
-  import libraries with a `lib` suffix.
-- `rust_crate_type`: specifies the crate type for Rust
-  libraries. Defaults to `dylib` for shared libraries and `rlib` for
-  static libraries.
-
-`static_library`, `shared_library` and `both_libraries` also accept
-these keyword arguments.
-
-Note: You can set `name_prefix` and `name_suffix` to `[]`, or omit
-them for the default behaviour for each platform.
-
-### message()
-
-``` meson
-    void message(text)
-```
-
-This function prints its argument to stdout.
-
-*(since 0.54.0)* Can take more more than one argument that will be separated by
-space.
-
-### warning()
-
-``` meson
-    void warning(text)
-```
-
-*(since 0.44.0)*
-
-This function prints its argument to stdout prefixed with WARNING:.
-
-*(since 0.54.0)* Can take more more than one argument that will be separated by
-space.
-
-### summary()
-
-``` meson
-    void summary(key, value)
-    void summary(dictionary)
-```
-
-*(since 0.53.0)*
-
-This function is used to summarize build configuration at the end of the build
-process. This function provides a way for projects (and subprojects) to report
-this information in a clear way.
-
-The content is a series of key/value pairs grouped into sections. If the section
-keyword argument is omitted, those key/value pairs are implicitly grouped into a section
-with no title. key/value pairs can optionally be grouped into a dictionary,
-but keep in mind that dictionaries does not guarantee ordering. `key` must be string,
-`value` can only be integer, boolean, string, or a list of those.
-
-`summary()` can be called multiple times as long as the same section/key
-pair doesn't appear twice. All sections will be collected and printed at
-the end of the configuration in the same order as they have been called.
-
-Keyword arguments:
-- `section`: title to group a set of key/value pairs.
-- `bool_yn`: if set to true, all boolean values will be replaced by green YES
-  or red NO.
-- `list_sep` *(since 0.54.0)*: string used to separate list values (e.g. `', '`).
-
-Example:
-```meson
-project('My Project', version : '1.0')
-summary({'bindir': get_option('bindir'),
-         'libdir': get_option('libdir'),
-         'datadir': get_option('datadir'),
-        }, section: 'Directories')
-summary({'Some boolean': false,
-         'Another boolean': true,
-         'Some string': 'Hello World',
-         'A list': ['string', 1, true],
-        }, section: 'Configuration')
-```
-
-Output:
-```
-My Project 1.0
-
-  Directories
-             prefix: /opt/gnome
-             bindir: bin
-             libdir: lib/x86_64-linux-gnu
-            datadir: share
-
-  Configuration
-       Some boolean: False
-    Another boolean: True
-        Some string: Hello World
-             A list: string
-                     1
-                     True
-```
-
-### project()
-
-``` meson
-    void project(project_name, list_of_languages, ...)
-```
-
-The first argument to this function must be a string defining the name
-of this project. It is followed by programming languages that the
-project uses. Supported values for languages are `c`, `cpp` (for
-`C++`), `cuda`, `d`, `objc`, `objcpp`, `fortran`, `java`, `cs` (for `C#`),
-`vala` and `rust`. *(since 0.40.0)* The list of languages
-is optional.
-
-The project name can be any string you want, it's not used for
-anything except descriptive purposes. However since it is written to
-e.g. the dependency manifest is usually makes sense to have it be the
-same as the project tarball or pkg-config name. So for example you
-would probably want to use the name _libfoobar_ instead of _The Foobar
-Library_.
-
-Project supports the following keyword arguments.
-
-- `default_options`: takes an array of strings. The strings are in the
-  form `key=value` and have the same format as options to
-  `meson configure`. For example to set the default project type you would
-  set this: `default_options : ['buildtype=debugoptimized']`. Note
-  that these settings are only used when running Meson for the first
-  time. Global options such as `buildtype` can only be specified in
-  the master project, settings in subprojects are ignored. Project
-  specific options are used normally even in subprojects.
-
-
-- `license`: takes a string or array of strings describing the
-  license(s) the code is under. Usually this would be something like
-  `license : 'GPL2+'`, but if the code has multiple licenses you can
-  specify them as an array like this: `license : ['proprietary',
-  'GPL3']`. Note that the text is informal and is only written to
-  the dependency manifest. Meson does not do any license validation,
-  you are responsible for verifying that you abide by all licensing
-  terms. You can access the value in your Meson build files with
-  `meson.project_license()`.
-
-- `meson_version`: takes a string describing which Meson version the
-  project requires. Usually something like `>=0.28.0`.
-
-- `subproject_dir`: specifies the top level directory name that holds
-  Meson subprojects. This is only meant as a compatibility option
-  for existing code bases that house their embedded source code in a
-  custom directory. All new projects should not set this but instead
-  use the default value. It should be noted that this keyword
-  argument is ignored inside subprojects. There can be only one
-  subproject dir and it is set in the top level Meson file.
-
-- `version`: which is a free form string describing the version of
-  this project. You can access the value in your Meson build files
-  with `meson.project_version()`.
-
-### run_command()
-
-``` meson
-    runresult run_command(command, list_of_args, ...)
-```
-
-Runs the command specified in positional arguments.  `command` can be
-a string, or the output of [`find_program()`](#find_program),
-[`files()`](#files) or [`configure_file()`](#configure_file), or [a
-compiler object](#compiler-object).
-
-Returns [an opaque object](#run-result-object) containing the result
-of the invocation. The command is run from an *unspecified* directory,
-and Meson will set three environment variables `MESON_SOURCE_ROOT`,
-`MESON_BUILD_ROOT` and `MESON_SUBDIR` that specify the source
-directory, build directory and subdirectory the target was defined in,
-respectively.
-
-This function supports the following keyword arguments:
-
- - `check` *(since 0.47.0)*: takes a boolean. If `true`, the exit status code of the command will
-   be checked, and the configuration will fail if it is non-zero. The default is
-   `false`.
- - `env` *(since 0.50.0)*: environment variables to set, such as `['NAME1=value1',
-   'NAME2=value2']`, or an [`environment()`
-   object](#environment-object) which allows more sophisticated
-   environment juggling. *(since 0.52.0)* A dictionary is also accepted.
-
-See also [External commands](External-commands.md).
-
-### run_target
-
-``` meson
-runtarget run_target(target_name, ...)
-```
-
-This function creates a new top-level target that runs a specified
-command with the specified arguments. Like all top-level targets, this
-integrates with the selected backend. For instance, you can
-run it as `meson compile target_name`. Note that a run target produces no
-output as far as Meson is concerned. It is only meant for tasks such
-as running a code formatter or flashing an external device's firmware
-with a built file.
-
-The command is run from an *unspecified* directory, and Meson will set
-three environment variables `MESON_SOURCE_ROOT`, `MESON_BUILD_ROOT`
-and `MESON_SUBDIR` that specify the source directory, build directory
-and subdirectory the target was defined in, respectively.
-
- - `command` is a list containing the command to run and the arguments
-   to pass to it. Each list item may be a string or a target. For
-   instance, passing the return value of [`executable()`](#executable)
-   as the first item will run that executable, or passing a string as
-   the first item will find that command in `PATH` and run it.
-- `depends` is a list of targets that this target depends on but which
-  are not listed in the command array (because, for example, the
-  script does file globbing internally)
-
-### set_variable()
-
-``` meson
-    void set_variable(variable_name, value)
-```
-
-Assigns a value to the given variable name. Calling
-`set_variable('foo', bar)` is equivalent to `foo = bar`.
-
-*(since 0.46.1)* The `value` parameter can be an array type.
-
-### shared_library()
-
-``` meson
-    buildtarget shared_library(library_name, list_of_sources, ...)
-```
-
-Builds a shared library with the given sources. Positional and keyword
-arguments are the same as for [`library`](#library) with the following
-extra keyword arguments.
-
-- `soversion`: a string specifying the soversion of this shared
-  library, such as `0`. On Linux and Windows this is used to set the
-  soversion (or equivalent) in the filename. For example, if
-  `soversion` is `4`, a Windows DLL will be called `foo-4.dll` and one
-  of the aliases of the Linux shared library would be
-  `libfoo.so.4`. If this is not specified, the first part of `version`
-  is used instead (see below). For example, if `version` is `3.6.0` and
-  `soversion` is not defined, it is set to `3`.
-- `version`: a string specifying the version of this shared library,
-  such as `1.1.0`. On Linux and OS X, this is used to set the shared
-  library version in the filename, such as `libfoo.so.1.1.0` and
-  `libfoo.1.1.0.dylib`. If this is not specified, `soversion` is used
-  instead (see above).
-- `darwin_versions` *(since 0.48.0)*: an integer, string, or a list of
-  versions to use for setting dylib `compatibility version` and
-  `current version` on macOS. If a list is specified, it must be
-  either zero, one, or two elements. If only one element is specified
-  or if it's not a list, the specified value will be used for setting
-  both compatibility version and current version. If unspecified, the
-  `soversion` will be used as per the aforementioned rules.
-- `vs_module_defs`: a string, a File object, or Custom Target for a
-  Microsoft module definition file for controlling symbol exports,
-  etc., on platforms where that is possible (e.g. Windows).
-
-### shared_module()
-
-``` meson
-    buildtarget shared_module(module_name, list_of_sources, ...)
-```
-
-*(since 0.37.0)*
-
-Builds a shared module with the given sources. Positional and keyword
-arguments are the same as for [`library`](#library).
-
-This is useful for building modules that will be `dlopen()`ed and
-hence may contain undefined symbols that will be provided by the
-library that is loading it.
-
-If you want the shared module to be able to refer to functions and
-variables defined in the [`executable`](#executable) it is loaded by,
-you will need to set the `export_dynamic` argument of the executable to
-`true`.
-
-Supports the following extra keyword arguments:
-
-- `vs_module_defs` *(since 0.52.0)*: a string, a File object, or
-  Custom Target for a Microsoft module definition file for controlling
-  symbol exports, etc., on platforms where that is possible
-  (e.g. Windows).
-
-**Note:** Linking to a shared module is not supported on some
-platforms, notably OSX.  Consider using a
-[`shared_library`](#shared_library) instead, if you need to both
-`dlopen()` and link with a library.
-
-### static_library()
-
-``` meson
-    buildtarget static_library(library_name, list_of_sources, ...)
-```
-
-Builds a static library with the given sources. Positional and keyword
-arguments are otherwise the same as for [`library`](#library), but it
-has one argument the others don't have:
-
- - `pic` *(since 0.36.0)*: builds the library as positional
-   independent code (so it can be linked into a shared library). This
-   option has no effect on Windows and OS X since it doesn't make
-   sense on Windows and PIC cannot be disabled on OS X.
-
-### subdir()
-
-``` meson
-    void subdir(dir_name, ...)
-```
-
-Enters the specified subdirectory and executes the `meson.build` file
-in it. Once that is done, it returns and execution continues on the
-line following this `subdir()` command. Variables defined in that
-`meson.build` file are then available for use in later parts of the
-current build file and in all subsequent build files executed with
-`subdir()`.
-
-Note that this means that each `meson.build` file in a source tree can
-and must only be executed once.
-
-This function has one keyword argument.
-
- - `if_found`: takes one or several dependency objects and will only
-   recurse in the subdir if they all return `true` when queried with
-   `.found()`
-
-### subdir_done()
-
-``` meson
-    subdir_done()
-```
-
-Stops further interpretation of the meson script file from the point of
-the invocation. All steps executed up to this point are valid and will
-be executed by meson. This means that all targets defined before the call
-of `subdir_done` will be build.
-
-If the current script was called by `subdir` the execution returns to the
-calling directory and continues as if the script had reached the end.
-If the current script is the top level script meson configures the project
-as defined up to this point.
-
-Example:
-```meson
-project('example exit', 'cpp')
-executable('exe1', 'exe1.cpp')
-subdir_done()
-executable('exe2', 'exe2.cpp')
-```
-
-The executable `exe1` will be build, while the executable `exe2` is not
-build.
-
-### subproject()
-
-``` meson
-    subproject_object subproject(subproject_name, ...)
-```
-
-Takes the project specified in the positional argument and brings that
-in the current build specification by returning a [subproject
-object](#subproject-object). Subprojects must always be placed inside
-the `subprojects` directory at the top source directory. So for
-example a subproject called `foo` must be located in
-`${MESON_SOURCE_ROOT}/subprojects/foo`. Supports the following keyword
-arguments:
-
- - `default_options` *(since 0.37.0)*: an array of default option values
-   that override those set in the subproject's `meson_options.txt`
-   (like `default_options` in `project`, they only have effect when
-   Meson is run for the first time, and command line arguments override
-   any default options in build files). *(since 0.54.0)*: `default_library`
-   built-in option can also be overridden.
- - `version`: works just like the same as in `dependency`.
-   It specifies what version the subproject should be, as an example `>=1.0.1`
- - `required` *(since 0.48.0)*: By default, `required` is `true` and
-   Meson will abort if the subproject could not be setup. You can set
-   this to `false` and then use the `.found()` method on the [returned
-   object](#subproject-object). You may also pass the value of a
-   [`feature`](Build-options.md#features) option, same as
-   [`dependency()`](#dependency).
-
-Note that you can use the returned [subproject
-object](#subproject-object) to access any variable in the
-subproject. However, if you want to use a dependency object from
-inside a subproject, an easier way is to use the `fallback:` keyword
-argument to [`dependency()`](#dependency).
-
-[See additional documentation](Subprojects.md).
-
-### test()
-
-``` meson
-    void test(name, executable, ...)
-```
-
-Defines a test to run with the test harness. Takes two positional
-arguments, the first is the name of the test and the second is the
-executable to run.  The executable can be an [executable build target
-object](#build-target-object) returned by
-[`executable()`](#executable) or an [external program
-object](#external-program-object) returned by
-[`find_program()`](#find_program).
-
-*(since 0.55.0)* When cross compiling, if an exe_wrapper is needed and defined
-the environment variable `MESON_EXE_WRAPPER` will be set to the string value
-of that wrapper (implementation detail: using `mesonlib.join_args`). Test
-scripts may use this to run cross built binaries. If your test needs
-`MESON_EXE_WRAPPER` in cross build situations it is your responsibility to
-return code 77 to tell the harness to report "skip".
-
-By default, environment variable
-[`MALLOC_PERTURB_`](http://man7.org/linux/man-pages/man3/mallopt.3.html)
-is automatically set by `meson test` to a random value between 1..255.
-This can help find memory leaks on configurations using glibc,
-including with non-GCC compilers. However, this can have a performance impact,
-and may fail a test due to external libraries whose internals are out of the
-user's control. To check if this feature is causing an expected runtime crash,
-disable the feature by temporarily setting environment variable
-`MALLOC_PERTURB_=0`. While it's preferable to only temporarily disable this
-check, if a project requires permanent disabling of this check
-in meson.build do like:
-
-```meson
-nomalloc = environment({'MALLOC_PERTURB_': '0'})
-
-test(..., env: nomalloc, ...)
-```
-
-#### test() Keyword arguments
-
-- `args`: arguments to pass to the executable
-
-- `env`: environment variables to set, such as `['NAME1=value1',
-  'NAME2=value2']`, or an [`environment()`
-  object](#environment-object) which allows more sophisticated
-  environment juggling. *(since 0.52.0)* A dictionary is also accepted.
-
-- `is_parallel`: when false, specifies that no other test must be
-  running at the same time as this test
-
-- `should_fail`: when true the test is considered passed if the
-  executable returns a non-zero return value (i.e. reports an error)
-
-- `suite`: `'label'` (or list of labels `['label1', 'label2']`)
-  attached to this test. The suite name is qualified by a (sub)project
-  name resulting in `(sub)project_name:label`. In the case of a list
-  of strings, the suite names will be `(sub)project_name:label1`,
-  `(sub)project_name:label2`, etc.
-
-- `timeout`: the amount of seconds the test is allowed to run, a test
-  that exceeds its time limit is always considered failed, defaults to
-  30 seconds
-
-- `workdir`: absolute path that will be used as the working directory
-  for the test
-
-- `depends` *(since 0.46.0)*: specifies that this test depends on the specified
-  target(s), even though it does not take any of them as a command
-  line argument. This is meant for cases where test finds those
-  targets internally, e.g. plugins or globbing. Those targets are built
-  before test is executed even if they have `build_by_default : false`.
-
-- `protocol` *(since 0.50.0)*: specifies how the test results are parsed and can
-  be one of `exitcode`, `tap`, or `gtest`. For more information about test
-  harness protocol read [Unit Tests](Unit-tests.md). The following values are
-  accepted:
-  - `exitcode`: the executable's exit code is used by the test harness
-    to record the outcome of the test).
-  - `tap`: [Test Anything Protocol](https://www.testanything.org/).
-  - `gtest` *(since 0.55.0)*: for Google Tests.
-
-- `priority` *(since 0.52.0)*:specifies the priority of a test. Tests with a
-  higher priority are *started* before tests with a lower priority.
-  The starting order of tests with identical priorities is
-  implementation-defined. The default priority is 0, negative numbers are
-  permitted.
-
-Defined tests can be run in a backend-agnostic way by calling
-`meson test` inside the build dir, or by using backend-specific
-commands, such as `ninja test` or `msbuild RUN_TESTS.vcxproj`.
-
-### vcs_tag()
-
-``` meson
-    customtarget vcs_tag(...)
-```
-
-This command detects revision control commit information at build time
-and places it in the specified output file. This file is guaranteed to
-be up to date on every build. Keywords are similar to `custom_target`.
-
-- `command`: string list with the command to execute, see
-  [`custom_target`](#custom_target) for details on how this command
-  must be specified
-- `fallback`: version number to use when no revision control
-  information is present, such as when building from a release tarball
-  (defaults to `meson.project_version()`)
-- `input`: file to modify (e.g. `version.c.in`) (required)
-- `output`: file to write the results to (e.g. `version.c`) (required)
-- `replace_string`: string in the input file to substitute with the
-  commit information (defaults to `@VCS_TAG@`)
-
-Meson will read the contents of `input`, substitute the
-`replace_string` with the detected revision number, and write the
-result to `output`. This method returns a
-[`custom_target`](#custom_target) object that (as usual) should be
-used to signal dependencies if other targets use the file outputted
-by this.
-
-For example, if you generate a header with this and want to use that in
-a build target, you must add the return value to the sources of that
-build target. Without that, Meson will not know the order in which to
-build the targets.
-
-If you desire more specific behavior than what this command provides,
-you should use `custom_target`.
-
-## Built-in objects
-
-These are built-in objects that are always available.
-
-### `meson` object
-
-The `meson` object allows you to introspect various properties of the
-system. This object is always mapped in the `meson` variable. It has
-the following methods.
-
-- `add_dist_script(script_name, arg1, arg2, ...)` *(since 0.48.0)*: causes the script
-  given as argument to run during `dist` operation after the
-  distribution source has been generated but before it is
-  archived. Note that this runs the script file that is in the
-  _staging_ directory, not the one in the source directory. If the
-  script file can not be found in the staging directory, it is a hard
-  error. This command can only invoked from the main project, calling
-  it from a subproject is a hard error. *(since 0.49.0)* Accepts multiple arguments
-  for the fscript. *(since 0.54.0)* The `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT`
-  environment variables are set when dist scripts are run.
-  *(since 0.55.0)* The output of `configure_file`, `files`, and `find_program`
-  as well as strings.
-
-- `add_install_script(script_name, arg1, arg2, ...)`: causes the script
-  given as an argument to be run during the install step, this script
-  will have the environment variables `MESON_SOURCE_ROOT`,
-  `MESON_BUILD_ROOT`, `MESON_INSTALL_PREFIX`,
-  `MESON_INSTALL_DESTDIR_PREFIX`, and `MESONINTROSPECT` set.
-  All positional arguments are passed as parameters.
-  *(since 0.55.0)* The output of `configure_file`, `files`, `find_program`,
-  `custom_target`, indexes of `custom_target`, `executable`, `library`, and
-  other built targets as well as strings.
-
-  *(since 0.54.0)* If `meson install` is called with the `--quiet` option, the
-  environment variable `MESON_INSTALL_QUIET` will be set.
-
-  Meson uses the `DESTDIR` environment variable as set by the
-  inherited environment to determine the (temporary) installation
-  location for files. Your install script must be aware of this while
-  manipulating and installing files. The correct way to handle this is
-  with the `MESON_INSTALL_DESTDIR_PREFIX` variable which is always set
-  and contains `DESTDIR` (if set) and `prefix` joined together. This
-  is useful because both are usually absolute paths and there are
-  platform-specific edge-cases in joining two absolute paths.
-
-  In case it is needed, `MESON_INSTALL_PREFIX` is also always set and
-  has the value of the `prefix` option passed to Meson.
-
-  `MESONINTROSPECT` contains the path to the introspect command that
-  corresponds to the `meson` executable that was used to configure the
-  build. (This might be a different path then the first executable
-  found in `PATH`.) It can be used to query build configuration. Note
-  that the value will contain many parts, f.ex., it may be `python3
-  /path/to/meson.py introspect`. The user is responsible for splitting
-  the string to an array if needed by splitting lexically like a UNIX
-  shell would. If your script uses Python, `shlex.split()` is the
-  easiest correct way to do this.
-
-- `add_postconf_script(script_name, arg1, arg2, ...)`: runs the
-  executable given as an argument after all project files have been
-  generated. This script will have the environment variables
-  `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT` set.
-  *(since 0.55.0)* The output of `configure_file`, `files`, and `find_program`
-  as well as strings.
-
-- `backend()` *(since 0.37.0)*: returns a string representing the
-  current backend: `ninja`, `vs2010`, `vs2015`, `vs2017`, `vs2019`,
-  or `xcode`.
-
-- `build_root()`: returns a string with the absolute path to the build
-  root directory. Note: this function will return the build root of
-  the parent project if called from a subproject, which is usually
-  not what you want. Try using `current_build_dir()`.
-
-- `source_root()`: returns a string with the absolute path to the
-  source root directory. Note: you should use the `files()` function
-  to refer to files in the root source directory instead of
-  constructing paths manually with `meson.source_root()`. This
-  function will return the source root of the parent project if called
-  from a subproject, which is usually not what you want. Try using
-  `current_source_dir()`.
-
-- `current_build_dir()`: returns a string with the absolute path to the
-  current build directory.
-
-- `current_source_dir()`: returns a string to the current source
-  directory. Note: **you do not need to use this function** when
-  passing files from the current source directory to a function since
-  that is the default. Also, you can use the `files()` function to
-  refer to files in the current or any other source directory instead
-  of constructing paths manually with `meson.current_source_dir()`.
-
-- `get_compiler(language)`: returns [an object describing a
-  compiler](#compiler-object), takes one positional argument which is
-  the language to use. It also accepts one keyword argument, `native`
-  which when set to true makes Meson return the compiler for the build
-  machine (the "native" compiler) and when false it returns the host
-  compiler (the "cross" compiler). If `native` is omitted, Meson
-  returns the "cross" compiler if we're currently cross-compiling and
-  the "native" compiler if we're not.
-
-- `get_cross_property(propname, fallback_value)`:
-  *Consider `get_external_property()` instead*. Returns the given
-  property from a cross file, the optional fallback_value is returned
-  if not cross compiling or the given property is not found.
-
-- `get_external_property(propname, fallback_value, native: true/false)`
-  *(since 0.54.0)*: returns the given property from a native or cross file.
-  The optional fallback_value is returned if the given property is not found.
-  The optional `native: true` forces retrieving a variable from the
-  native file, even when cross-compiling.
-  If `native: false` or not specified, variable is retrieved from the
-  cross-file if cross-compiling, and from the native-file when not cross-compiling.
-
-- `can_run_host_binaries()` *(since 0.55.0)*: returns true if the build machine can run
-  binaries compiled for the host. This returns true unless you are
-  cross compiling, need a helper to run host binaries, and don't have one.
-  For example when cross compiling from Linux to Windows, one can use `wine`
-  as the helper.
-
-- `has_exe_wrapper()`: *(since 0.55.0)* **(deprecated)**. Use `can_run_host_binaries` instead.
-
-- `install_dependency_manifest(output_name)`: installs a manifest file
-  containing a list of all subprojects, their versions and license
-  files to the file name given as the argument.
-
-- `is_cross_build()`: returns `true` if the current build is a [cross
-  build](Cross-compilation.md) and `false` otherwise.
-
-- `is_subproject()`: returns `true` if the current project is being
-  built as a subproject of some other project and `false` otherwise.
-
-- `is_unity()`: returns `true` when doing a [unity
-  build](Unity-builds.md) (multiple sources are combined before
-  compilation to reduce build time) and `false` otherwise.
-
-- `override_find_program(progname, program)` *(since 0.46.0)*:
-  specifies that whenever `find_program` is used to find a program
-  named `progname`, Meson should not look it up on the system but
-  instead return `program`, which may either be the result of
-  `find_program`, `configure_file` or `executable`. *(since 0.55.0)* If a version
-  check is passed to `find_program` for a program that has been overridden with
-  an executable, the current project version is used.
-
-  If `program` is an `executable`, it cannot be used during configure.
-
-- `override_dependency(name, dep_object)` *(since 0.54.0)*:
-  specifies that whenever `dependency(name, ...)` is used, Meson should not
-  look it up on the system but instead return `dep_object`, which may either be
-  the result of `dependency()` or `declare_dependency()`. It takes optional
-  `native` keyword arguments. Doing this in a subproject allows the parent
-  project to retrieve the dependency without having to know the dependency
-  variable name: `dependency(name, fallback : subproject_name)`.
-
-- `project_version()`: returns the version string specified in
-  `project` function call.
-
-- `project_license()`: returns the array of licenses specified in
-  `project` function call.
-
-- `project_name()`: returns the project name specified in the `project`
-  function call.
-
-- `version()`: return a string with the version of Meson.
-
-### `build_machine` object
-
-Provides information about the build machine — the machine that is
-doing the actual compilation. See
-[Cross-compilation](Cross-compilation.md). It has the following
-methods:
-
-- `cpu_family()`: returns the CPU family name. [This
-  table](Reference-tables.md#cpu-families) contains all known CPU
-  families. These are guaranteed to continue working.
-
-- `cpu()`: returns a more specific CPU name, such as `i686`, `amd64`,
-  etc.
-
-- `system()`: returns the operating system name.  [This
-  table](Reference-tables.md#operating-system-names) Lists all of
-  the currently known Operating System names, these are guaranteed to
-  continue working.
-
-- `endian()`: returns `big` on big-endian systems and `little` on
-  little-endian systems.
-
-Currently, these values are populated using
-[`platform.system()`](https://docs.python.org/3.4/library/platform.html#platform.system)
-and
-[`platform.machine()`](https://docs.python.org/3.4/library/platform.html#platform.machine). If
-you think the returned values for any of these are incorrect for your
-system or CPU, or if your OS is not in the linked table, please file
-[a bug report](https://github.com/mesonbuild/meson/issues/new) with
-details and we'll look into it.
-
-### `host_machine` object
-
-Provides information about the host machine — the machine on which the
-compiled binary will run. See
-[Cross-compilation](Cross-compilation.md).
-
-It has the same methods as [`build_machine`](#build_machine-object).
-
-When not cross-compiling, all the methods return the same values as
-`build_machine` (because the build machine is the host machine)
-
-Note that while cross-compiling, it simply returns the values defined
-in the cross-info file.
-
-### `target_machine` object
-
-Provides information about the target machine — the machine on which
-the compiled binary's output will run. Hence, this object should only
-be used while cross-compiling a compiler. See
-[Cross-compilation](Cross-compilation.md).
-
-It has the same methods as [`build_machine`](#build_machine-object).
-
-When all compilation is 'native', all the methods return the same
-values as `build_machine` (because the build machine is the host
-machine and the target machine).
-
-Note that while cross-compiling, it simply returns the values defined
-in the cross-info file. If `target_machine` values are not defined in
-the cross-info file, `host_machine` values are returned instead.
-
-### `string` object
-
-All [strings](Syntax.md#strings) have the following methods. Strings
-are immutable, all operations return their results as a new string.
-
-- `contains(string)`: returns true if string contains the string
-  specified as the argument.
-
-- `endswith(string)`: returns true if string ends with the string
-  specified as the argument.
-
-- `format()`: formats text, see the [Syntax
-  manual](Syntax.md#string-formatting) for usage info.
-
-- `join(list_of_strings)`: the opposite of split, for example
-  `'.'.join(['a', 'b', 'c']` yields `'a.b.c'`.
-
-- `split(split_character)`: splits the string at the specified
-  character (or whitespace if not set) and returns the parts in an
-  array.
-
-- `startswith(string)`: returns true if string starts with the string
-  specified as the argument
-
-- `strip()`: removes whitespace at the beginning and end of the string.
-  *(since 0.43.0)* Optionally can take one positional string argument,
-  and all characters in that string will be stripped.
-
-- `to_int()`: returns the string converted to an integer (error if string
-  is not a number).
-
-- `to_lower()`: creates a lower case version of the string.
-
-- `to_upper()`: creates an upper case version of the string.
-
-- `underscorify()`: creates a string where every non-alphabetical
-  non-number character is replaced with `_`.
-
-- `version_compare(comparison_string)`: does semantic version
-  comparison, if `x = '1.2.3'` then `x.version_compare('>1.0.0')`
-  returns `true`.
-
-### `Number` object
-
-[Numbers](Syntax.md#numbers) support these methods:
-
-- `is_even()`: returns true if the number is even
-- `is_odd()`: returns true if the number is odd
-- `to_string()`: returns the value of the number as a string.
-
-### `boolean` object
-
-A [boolean](Syntax.md#booleans) object has two simple methods:
-
-- `to_int()`: returns either `1` or `0`.
-
-- `to_string()`: returns the string `'true'` if the boolean is true or
-  `'false'` otherwise. You can also pass it two strings as positional
-  arguments to specify what to return for true/false. For instance,
-  `bool.to_string('yes', 'no')` will return `yes` if the boolean is
-  true and `no` if it is false.
-
-### `array` object
-
-The following methods are defined for all [arrays](Syntax.md#arrays):
-
-- `contains(item)`: returns `true` if the array contains the object
-  given as argument, `false` otherwise
-
-- `get(index, fallback)`: returns the object at the given index,
-  negative indices count from the back of the array, indexing out of
-  bounds returns the `fallback` value *(since 0.38.0)* or, if it is
-  not specified, causes a fatal error
-
-- `length()`: the size of the array
-
-You can also iterate over arrays with the [`foreach`
-statement](Syntax.md#foreach-statements).
-
-### `dictionary` object
-
-*(since 0.47.0)*
-
-The following methods are defined for all [dictionaries](Syntax.md#dictionaries):
-
-- `has_key(key)`: returns `true` if the dictionary contains the key
-  given as argument, `false` otherwise
-
-- `get(key, fallback)`: returns the value for the key given as first
-  argument if it is present in the dictionary, or the optional
-  fallback value given as the second argument. If a single argument
-  was given and the key was not found, causes a fatal error
-
-You can also iterate over dictionaries with the [`foreach`
-statement](Syntax.md#foreach-statements).
-
-*(since 0.48.0)* Dictionaries can be added (e.g. `d1 = d2 + d3` and `d1 += d2`).
-Values from the second dictionary overrides values from the first.
-
-## Returned objects
-
-These are objects returned by the [functions listed above](#functions).
-
-### `compiler` object
-
-This object is returned by
-[`meson.get_compiler(lang)`](#meson-object). It represents a compiler
-for a given language and allows you to query its properties. It has
-the following methods:
-
-- `alignment(typename)`: returns the alignment of the type specified in
-  the positional argument, you can specify external dependencies to
-  use with `dependencies` keyword argument.
-
-- `cmd_array()`: returns an array containing the command arguments for
-  the current compiler.
-
-- `compiles(code)`: returns true if the code fragment given in the
-  positional argument compiles, you can specify external dependencies
-  to use with `dependencies` keyword argument, `code` can be either a
-  string containing source code or a `file` object pointing to the
-  source code.
-
-- `compute_int(expr, ...')`: computes the value of the given expression
-  (as an example `1 + 2`). When cross compiling this is evaluated with
-  an iterative algorithm, you can specify keyword arguments `low`
-  (defaults to -1024), `high` (defaults to 1024) and `guess` to
-  specify max and min values for the search and the value to try
-  first.
-
-- `find_library(lib_name, ...)`: tries to find the library specified in
-  the positional argument. The [result
-  object](#external-library-object) can be used just like the return
-  value of `dependency`. If the keyword argument `required` is false,
-  Meson will proceed even if the library is not found. By default the
-  library is searched for in the system library directory
-  (e.g. /usr/lib). This can be overridden with the `dirs` keyword
-  argument, which can be either a string or a list of strings.
-  *(since 0.47.0)* The value of a [`feature`](Build-options.md#features)
-  option can also be passed to the `required` keyword argument.
-  *(since 0.49.0)* If the keyword argument `disabler` is `true` and the
-  dependency couldn't be found, return a [disabler object](#disabler-object)
-  instead of a not-found dependency. *(since 0.50.0)* The `has_headers` keyword
-  argument can be a list of header files that must be found as well, using
-  `has_header()` method. All keyword arguments prefixed with `header_` will be
-  passed down to `has_header()` method with the prefix removed. *(since 0.51.0)*
-  The `static` keyword (boolean) can be set to `true` to limit the search to
-  static libraries and `false` for dynamic/shared.
-
-- `first_supported_argument(list_of_strings)`: given a list of
-  strings, returns the first argument that passes the `has_argument`
-  test or an empty array if none pass.
-
-- `first_supported_link_argument(list_of_strings)` *(since 0.46.0)*:
-  given a list of strings, returns the first argument that passes the
-  `has_link_argument` test or an empty array if none pass.
-
-- `get_define(definename)`: returns the given preprocessor symbol's
-  value as a string or empty string if it is not defined.
-  *(since 0.47.0)* This method will concatenate string literals as
-  the compiler would. E.g. `"a" "b"` will become `"ab"`.
-
-- `get_id()`: returns a string identifying the compiler. For example,
-  `gcc`, `msvc`, [and more](Reference-tables.md#compiler-ids).
-
-- `get_argument_syntax()` *(since 0.49.0)*: returns a string identifying the type
-  of arguments the compiler takes. Can be one of `gcc`, `msvc`, or an undefined
-  string value. This method is useful for identifying compilers that are not
-  gcc or msvc, but use the same argument syntax as one of those two compilers
-  such as clang or icc, especially when they use different syntax on different
-  operating systems.
-
-- `get_linker_id()` *(since 0.53.0)*: returns a string identifying the linker.
-   For example, `ld.bfd`, `link`, [and more](Reference-tables.md#linker-ids).
-
-- `get_supported_arguments(list_of_string)` *(since 0.43.0)*: returns
-  an array containing only the arguments supported by the compiler,
-  as if `has_argument` were called on them individually.
-
-- `get_supported_link_arguments(list_of_string)` *(since 0.46.0)*: returns
-  an array containing only the arguments supported by the linker,
-  as if `has_link_argument` were called on them individually.
-
-- `has_argument(argument_name)`: returns true if the compiler accepts
-  the specified command line argument, that is, can compile code
-  without erroring out or printing a warning about an unknown flag.
-
-- `has_link_argument(argument_name)` *(since 0.46.0)*: returns true if
-  the linker accepts the specified command line argument, that is, can
-  compile and link code without erroring out or printing a warning
-  about an unknown flag. Link arguments will be passed to the
-  compiler, so should usually have the `-Wl,` prefix. On VisualStudio
-  a `/link` argument will be prepended.
-
-- `has_function(funcname)`: returns true if the given function is
-  provided by the standard library or a library passed in with the
-  `args` keyword, you can specify external dependencies to use with
-  `dependencies` keyword argument.
-
-- `check_header` *(since 0.47.0)*: returns true if the specified header is *usable* with
-  the specified prefix, dependencies, and arguments.
-  You can specify external dependencies to use with `dependencies`
-  keyword argument and extra code to put above the header test with
-  the `prefix` keyword. In order to look for headers in a specific
-  directory you can use `args : '-I/extra/include/dir`, but this
-  should only be used in exceptional cases for includes that can't be
-  detected via pkg-config and passed via `dependencies`. *(since 0.50.0)* The
-  `required` keyword argument can be used to abort if the header cannot be
-  found.
-
-- `has_header`: returns true if the specified header *exists*, and is
-  faster than `check_header()` since it only does a pre-processor check.
-  You can specify external dependencies to use with `dependencies`
-  keyword argument and extra code to put above the header test with
-  the `prefix` keyword. In order to look for headers in a specific
-  directory you can use `args : '-I/extra/include/dir`, but this
-  should only be used in exceptional cases for includes that can't be
-  detected via pkg-config and passed via `dependencies`. *(since 0.50.0)* The
-  `required` keyword argument can be used to abort if the header cannot be
-  found.
-
-- `has_header_symbol(headername, symbolname)`: detects
-  whether a particular symbol (function, variable, #define, type
-  definition, etc) is declared in the specified header, you can
-  specify external dependencies to use with `dependencies` keyword
-  argument. *(since 0.50.0)* The `required` keyword argument can be 
-  used to abort if the symbol cannot be found.
-
-- `has_member(typename, membername)`: takes two arguments, type name
-  and member name and returns true if the type has the specified
-  member, you can specify external dependencies to use with
-  `dependencies` keyword argument.
-
-- `has_members(typename, membername1, membername2, ...)`: takes at
-  least two arguments, type name and one or more member names, returns
-  true if the type has all the specified members, you can specify
-  external dependencies to use with `dependencies` keyword argument.
-
-- `has_multi_arguments(arg1, arg2, arg3, ...)` *(since 0.37.0)*: the same as
-  `has_argument` but takes multiple arguments and uses them all in a
-  single compiler invocation.
-
-- `has_multi_link_arguments(arg1, arg2, arg3, ...)` *(since 0.46.0)*:
-  the same as `has_link_argument` but takes multiple arguments and
-  uses them all in a single compiler invocation.
-
-- `has_type(typename)`: returns true if the specified token is a type,
-  you can specify external dependencies to use with `dependencies`
-  keyword argument.
-
-- `links(code)`: returns true if the code fragment given in the
-  positional argument compiles and links, you can specify external
-  dependencies to use with `dependencies` keyword argument, `code` can
-  be either a string containing source code or a `file` object
-  pointing to the source code.
-
-- `run(code)`: attempts to compile and execute the given code fragment,
-  returns a run result object, you can specify external dependencies
-  to use with `dependencies` keyword argument, `code` can be either a
-  string containing source code or a `file` object pointing to the
-  source code.
-
-- `symbols_have_underscore_prefix()` *(since 0.37.0)*: returns `true`
-  if the C symbol mangling is one underscore (`_`) prefixed to the symbol.
-
-- `sizeof(typename, ...)`: returns the size of the given type
-  (e.g. `'int'`) or -1 if the type is unknown, to add includes set
-  them in the `prefix` keyword argument, you can specify external
-  dependencies to use with `dependencies` keyword argument.
-
-- `version()`: returns the compiler's version number as a string.
-
-- `has_function_attribute(name)` *(since 0.48.0)*: returns `true` if the
-  compiler supports the GNU style (`__attribute__(...)`) `name`. This is
-  preferable to manual compile checks as it may be optimized for compilers that
-  do not support such attributes.
-  [This table](Reference-tables.md#gcc-__attribute__) lists all of the
-  supported attributes.
-
-- `get_supported_function_attributes(list_of_names)` *(since 0.48.0)*:
-  returns an array containing any names that are supported GCC style
-  attributes. Equivalent to `has_function_attribute` was called on each of them
-  individually.
-
-The following keyword arguments can be used:
-
-- `args`: used to pass a list of compiler arguments that are
-  required to find the header or symbol. For example, you might need
-  to pass the include path `-Isome/path/to/header` if a header is not
-  in the default include path. *(since 0.38.0)* you should use the
-  `include_directories` keyword described below. You may also want to
-  pass a library name `-lfoo` for `has_function` to check for a function.
-  Supported by all methods except `get_id`, `version`, and `find_library`.
-
-- `include_directories` *(since 0.38.0)*: specifies extra directories for 
-  header searches.
-
-- `name`: the name to use for printing a message about the compiler
-  check. Supported by the methods `compiles()`, `links()`, and
-  `run()`. If this keyword argument is not passed to those methods, no
-  message will be printed about the check.
-
-- `no_builtin_args`: when set to true, the compiler arguments controlled
-  by built-in configuration options are not added.
-
-- `prefix`: adds #includes and other things that are
-  required for the symbol to be declared. System definitions should be
-  passed via compiler args (eg: `_GNU_SOURCE` is often required for
-  some symbols to be exposed on Linux, and it should be passed via
-  `args` keyword argument, see below). Supported by the methods
-  `sizeof`, `has_type`, `has_function`, `has_member`, `has_members`,
-  `check_header`, `has_header`, `has_header_symbol`.
-
-**Note:** These compiler checks do not use compiler arguments added with
-`add_*_arguments()`, via `-Dlang_args` on the command-line, or through
-`CFLAGS`/`LDFLAGS`, etc in the environment. Hence, you can trust that
-the tests will be fully self-contained, and won't fail because of custom
-flags added by other parts of the build file or by users.
-
-Note that if you have a single prefix with all your dependencies, you
-might find it easier to append to the environment variables
-`C_INCLUDE_PATH` with GCC/Clang and `INCLUDE` with MSVC to expand the
-default include path, and `LIBRARY_PATH` with GCC/Clang and `LIB` with
-MSVC to expand the default library search path.
-
-However, with GCC, these variables will be ignored when
-cross-compiling. In that case you need to use a specs file. See:
-<http://www.mingw.org/wiki/SpecsFileHOWTO>
-
-### `build target` object
-
-A build target is either an [executable](#executable),
-[shared library](#shared_library), [static library](#static_library),
-[both shared and static library](#both_libraries) or
-[shared module](#shared_module).
-
-- `extract_all_objects()`: is same as `extract_objects` but returns all
-  object files generated by this target. *(since 0.46.0)* keyword argument
-  `recursive` must be set to `true` to also return objects passed to
-  the `object` argument of this target. By default only objects built
-  for this target are returned to maintain backward compatibility with
-  previous versions.  The default will eventually be changed to `true`
-  in a future version.
-
-- `extract_objects(source1, source2, ...)`: takes as its arguments
-  a number of source files as [`string`](#string-object) or
-  [`files()`](#files) and returns an opaque value representing the
-  object files generated for those source files. This is typically used
-  to take single object files and link them to unit tests or to compile
-  some source files with custom flags. To use the object file(s)
-  in another build target, use the `objects:` keyword argument.
-
-- `full_path()`: returns a full path pointing to the result target file.
-  NOTE: In most cases using the object itself will do the same job as
-  this and will also allow Meson to setup inter-target dependencies
-  correctly. Please file a bug if that doesn't work for you.
-
-- `private_dir_include()`: returns a opaque value that works like
-  `include_directories` but points to the private directory of this
-  target, usually only needed if an another target needs to access
-  some generated internal headers of this target
-
-- `name()` *(since 0.54.0)*: returns the target name.
-
-
-### `configuration` data object
-
-This object is returned by
-[`configuration_data()`](#configuration_data) and encapsulates
-configuration values to be used for generating configuration files. A
-more in-depth description can be found in the [the configuration wiki
-page](Configuration.md) It has three methods:
-
-- `get(varname, default_value)`: returns the value of `varname`, if the
-  value has not been set returns `default_value` if it is defined
-  *(since 0.38.0)* and errors out if not
-
-- `get_unquoted(varname, default_value)` *(since 0.44.0)*: returns the value
-  of `varname` but without surrounding double quotes (`"`). If the value has
-  not been set returns `default_value` if it is defined and errors out if not.
-
-- `has(varname)`: returns `true` if the specified variable is set
-
-- `merge_from(other)` *(since 0.42.0)*: takes as argument a different 
-  configuration data object and copies all entries from that object to 
-  the current.
-
-- `set(varname, value)`, sets a variable to a given value
-
-- `set10(varname, boolean_value)` is the same as above but the value
-  is either `true` or `false` and will be written as 1 or 0,
-  respectively
-
-- `set_quoted(varname, value)` is same as `set` but quotes the value
-  in double quotes (`"`)
-
-They all take the `description` keyword that will be written in the
-result file. The replacement assumes a file with C syntax. If your
-generated file is source code in some other language, you probably
-don't want to add a description field because it most likely will
-cause a syntax error.
-
-### `custom target` object
-
-This object is returned by [`custom_target`](#custom_target) and
-contains a target with the following methods:
-
-- `full_path()`: returns a full path pointing to the result target file
-  NOTE: In most cases using the object itself will do the same job as
-  this and will also allow Meson to setup inter-target dependencies
-  correctly. Please file a bug if that doesn't work for you.
-  *(since 0.54.0)* It can be also called on indexes objects:
-  `custom_targets[i].full_path()`.
-
-- `[index]`: returns an opaque object that references this target, and
-  can be used as a source in other targets. When it is used as such it
-  will make that target depend on this custom target, but the only
-  source added will be the one that corresponds to the index of the
-  custom target's output argument.
-
-- `to_list()` *(since 0.54.0)*: returns a list of opaque objects that references
-  this target, and can be used as a source in other targets. This can be used to
-  iterate outputs with `foreach` loop.
-
-### `dependency` object
-
-This object is returned by [`dependency()`](#dependency) and contains
-an external dependency with the following methods:
-
- - `found()`: returns whether the dependency was found.
-
- - `name()` *(since 0.48.0)*: returns the name of the dependency that was
-   searched. Returns `internal` for dependencies created with
-   `declare_dependency()`.
-
- - `get_pkgconfig_variable(varname)` *(since 0.36.0)*: gets the
-   pkg-config variable specified, or, if invoked on a non pkg-config
-   dependency, error out. *(since 0.44.0)* You can also redefine a
-   variable by passing a list to the `define_variable` parameter
-   that can affect the retrieved variable: `['prefix', '/'])`.
-   *(since 0.45.0)* A warning is issued if the variable is not defined,
-   unless a `default` parameter is specified.
-
- - `get_configtool_variable(varname)` *(since 0.44.0)*: gets the
-   command line argument from the config tool (with `--` prepended), or,
-   if invoked on a non config-tool dependency, error out.
-
- - `type_name()`: returns a string describing the type of the
-   dependency, the most common values are `internal` for deps created
-   with `declare_dependency()` and `pkgconfig` for system dependencies
-   obtained with Pkg-config.
-
- - `version()`: the version number as a string, for example `1.2.8`.
-   `unknown` if the dependency provider doesn't support determining the
-   version.
-
- - `include_type()`: returns whether the value set by the `include_type` kwarg
-
- - `as_system(value)`: returns a copy of the dependency object, which has changed
-   the value of `include_type` to `value`. The `value` argument is optional and
-   defaults to `'preserve'`.
-
- - `partial_dependency(compile_args : false, link_args : false, links
-   : false, includes : false, sources : false)` *(since 0.46.0)*: returns
-   a new dependency object with the same name, version, found status,
-   type name, and methods as the object that called it. This new
-   object will only inherit other attributes from its parent as
-   controlled by keyword arguments.
-
-   If the parent has any dependencies, those will be applied to the new
-   partial dependency with the same rules. So, given:
-
-   ```meson
-   dep1 = declare_dependency(compile_args : '-Werror=foo', link_with : 'libfoo')
-   dep2 = declare_dependency(compile_args : '-Werror=bar', dependencies : dep1)
-   dep3 = dep2.partial_dependency(compile_args : true)
-   ```
-
-   dep3 will add `['-Werror=foo', '-Werror=bar']` to the compiler args
-   of any target it is added to, but libfoo will not be added to the
-   link_args.
-
-   *Note*: A bug present until 0.50.1 results in the above behavior
-   not working correctly.
-
-   The following arguments will add the following attributes:
-
-   - compile_args: any arguments passed to the compiler
-   - link_args: any arguments passed to the linker
-   - links: anything passed via link_with or link_whole
-   - includes: any include_directories
-   - sources: any compiled or static sources the dependency has
-
- - `get_variable(cmake : str, pkgconfig : str, configtool : str,
-   internal: str, default_value : str, pkgconfig_define : [str, str])`
-   *(since 0.51.0)*: a generic variable getter method, which replaces the
-   get_*type*_variable methods. This allows one to get the variable
-   from a dependency without knowing specifically how that dependency
-   was found. If default_value is set and the value cannot be gotten
-   from the object then default_value is returned, if it is not set
-   then an error is raised.
-
-   *(since 0.54.0)* added `internal` keyword.
-
-### `disabler` object
-
-A disabler object is an object that behaves in much the same way as
-NaN numbers do in floating point math. That is when used in any
-statement (function call, logical op, etc) they will cause the
-statement evaluation to immediately short circuit to return a disabler
-object. A disabler object has one method:
-
-- `found()`: always returns `false`.
-
-### `external program` object
-
-This object is returned by [`find_program()`](#find_program) and
-contains an external (i.e. not built as part of this project) program
-and has the following methods:
-
-- `found()`: returns whether the executable was found.
-
-- `path()`: *(since 0.55.0)* **(deprecated)** use `full_path()` instead.
-  Returns a string pointing to the script or executable
-  **NOTE:** You should not need to use this method. Passing the object
-  itself should work in all cases. For example: `run_command(obj, arg1, arg2)`.
-
-- `full_path()` (*since 0.55.0*): which returns a string pointing to the script or
-  executable **NOTE:** You should not need to use this method. Passing the object
-  itself should work in all cases. For example: `run_command(obj, arg1, arg2)`.
-
-### `environment` object
-
-This object is returned by [`environment()`](#environment) and stores
-detailed information about how environment variables should be set
-during tests. It should be passed as the `env` keyword argument to
-tests and other functions. It has the following methods.
-
-- `append(varname, value1, value2, ...)`: appends the given values to
-  the old value of the environment variable, e.g.  `env.append('FOO',
-  'BAR', 'BAZ', separator : ';')` produces `BOB;BAR;BAZ` if `FOO` had
-  the value `BOB` and plain `BAR;BAZ` if the value was not defined. If
-  the separator is not specified explicitly, the default path
-  separator for the host operating system will be used, i.e. ';' for
-  Windows and ':' for UNIX/POSIX systems.
-
-- `prepend(varname, value1, value2, ...)`: same as `append`
-  except that it writes to the beginning of the variable.
-
-- `set(varname, value1, value2)`: sets the environment variable
-  specified in the first argument to the values in the second argument
-  joined by the separator, e.g.  `env.set('FOO', 'BAR'),` sets envvar
-  `FOO` to value `BAR`. See `append()` above for how separators work.
-
-**Note:** All these methods overwrite the previously-defined value(s)
-if called twice with the same `varname`.
-
-### `external library` object
-
-This object is returned by [`find_library()`](#find_library) and
-contains an external (i.e. not built as part of this project)
-library. This object has the following methods:
-
-- `found()`: returns whether the library was found.
-
-- `type_name()` *(since 0.48.0)*: returns a string describing
-  the type of the dependency, which will be `library` in this case.
-
-- `partial_dependency(compile_args : false, link_args : false, links
-  : false, includes : false, source : false)` *(since 0.46.0)*: returns
-  a new dependency object with the same name, version, found status,
-  type name, and methods as the object that called it. This new
-  object will only inherit other attributes from its parent as
-  controlled by keyword arguments.
-
-### Feature option object
-
-*(since 0.47.0)*
-
-The following methods are defined for all [`feature` options](Build-options.md#features):
-
-- `enabled()`: returns whether the feature was set to `'enabled'`
-- `disabled()`: returns whether the feature was set to `'disabled'`
-- `auto()`: returns whether the feature was set to `'auto'`
-
-### `generator` object
-
-This object is returned by [`generator()`](#generator) and contains a
-generator that is used to transform files from one type to another by
-an executable (e.g. `idl` files into source code and headers).
-
-- `process(list_of_files, ...)`: takes a list of files, causes them to
-  be processed and returns an object containing the result which can
-  then, for example, be passed into a build target definition. The
-  keyword argument `extra_args`, if specified, will be used to replace
-  an entry `@EXTRA_ARGS@` in the argument list. The keyword argument
-  `preserve_path_from`, if given, specifies that the output files need
-  to maintain their directory structure inside the target temporary
-  directory. The most common value for this is
-  `meson.current_source_dir()`. With this value when a file called
-  `subdir/one.input` is processed it generates a file `<target private
-  directory>/subdir/one.out` as opposed to `<target private
-  directory>/one.out`.
-
-### `subproject` object
-
-This object is returned by [`subproject()`](#subproject) and is an
-opaque object representing it.
-
-- `found()` *(since 0.48.0)*: returns whether the subproject was
-  successfully setup
-
-- `get_variable(name, fallback)`: fetches the specified variable from
-  inside the subproject. This is useful to, for instance, get a
-  [declared dependency](#declare_dependency) from the
-  [subproject](Subprojects.md).
-
-  If the variable does not exist, the variable `fallback` is returned.
-  If a fallback is not specified, then attempting to read a non-existing
-  variable will cause a fatal error.
-
-### `run result` object
-
-This object encapsulates the result of trying to compile and run a
-sample piece of code with [`compiler.run()`](#compiler-object) or
-[`run_command()`](#run_command). It has the following methods:
-
-- `compiled()`: if true, the compilation succeeded, if false it did not
-  and the other methods return unspecified data. This is only available
-  for `compiler.run()` results.
-- `returncode()`: the return code of executing the compiled binary
-- `stderr()`: the standard error produced when the command was run
-- `stdout()`: the standard out produced when the command was run
diff --git a/meson/docs/markdown/Reference-tables.md b/meson/docs/markdown/Reference-tables.md
deleted file mode 100644 (file)
index 3be129f..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-# Reference tables
-
-## Compiler ids
-
-These are return values of the `get_id` (Compiler family) and
-`get_argument_syntax` (Argument syntax) method in a compiler object.
-
-| Value     | Compiler family                  | Argument syntax |
-| -----     | ---------------                  | --------------- |
-| arm       | ARM compiler                     |                 |
-| armclang  | ARMCLANG compiler                |                 |
-| c2000     | Texas Instruments C2000 compiler |                 |
-| ccrx      | Renesas RX Family C/C++ compiler |                 |
-| clang     | The Clang compiler               | gcc             |
-| clang-cl  | The Clang compiler (MSVC compatible driver) | msvc |
-| dmd       | D lang reference compiler        |                 |
-| emscripten| Emscripten WASM compiler         |                 |
-| flang     | Flang Fortran compiler           |                 |
-| g95       | The G95 Fortran compiler         |                 |
-| gcc       | The GNU Compiler Collection      | gcc             |
-| intel     | Intel compiler (Linux and Mac)   | gcc             |
-| intel-cl  | Intel compiler (Windows)         | msvc            |
-| lcc       | Elbrus C/C++/Fortran Compiler    |                 |
-| llvm      | LLVM-based compiler (Swift, D)   |                 |
-| mono      | Xamarin C# compiler              |                 |
-| msvc      | Microsoft Visual Studio          | msvc            |
-| nagfor    | The NAG Fortran compiler         |                 |
-| open64    | The Open64 Fortran Compiler      |                 |
-| pathscale | The Pathscale Fortran compiler   |                 |
-| pgi       | Portland PGI C/C++/Fortran compilers |             |
-| rustc     | Rust compiler                    |                 |
-| sun       | Sun Fortran compiler             |                 |
-| valac     | Vala compiler                    |                 |
-| xc16      | Microchip XC16 C compiler        |                 |
-
-## Linker ids
-
-These are return values of the `get_linker_id` method in a compiler object.
-
-| Value      | Linker family                               |
-| -----      | ---------------                             |
-| ld.bfd     | The GNU linker                              |
-| ld.gold    | The GNU gold linker                         |
-| ld.lld     | The LLVM linker, with the GNU interface     |
-| ld.solaris | Solaris and illumos                         |
-| ld.wasm    | emscripten's wasm-ld linker                 |
-| ld64       | Apple ld64                                  |
-| link       | MSVC linker                                 |
-| lld-link   | The LLVM linker, with the MSVC interface    |
-| xilink     | Used with Intel-cl only, MSVC like          |
-| optlink    | optlink (used with DMD)                     |
-| rlink      | The Renesas linker, used with CCrx only     |
-| xc16-ar    | The Microchip linker, used with XC16 only   |
-| ar2000     | The Texas Instruments linker, used with C2000 only |
-| armlink    | The ARM linker (arm and armclang compilers) |
-| pgi        | Portland/Nvidia PGI                         |
-| nvlink     | Nvidia Linker used with cuda                |
-
-For languages that don't have separate dynamic linkers such as C# and Java, the
-`get_linker_id` will return the compiler name.
-
-## Script environment variables
-
-| Value               | Comment                         |
-| -----               | -------                         |
-| MESONINTROSPECT     | Command to run to run the introspection command, may be of the form `python /path/to/meson introspect`, user is responsible for splitting the path if necessary. |
-| MESON_BUILD_ROOT    | Absolute path to the build dir  |
-| MESON_DIST_ROOT     | Points to the root of the staging directory, only set when running `dist` scripts |
-| MESON_SOURCE_ROOT   | Absolute path to the source dir |
-| MESON_SUBDIR        | Current subdirectory, only set for `run_command` |
-
-## CPU families
-
-These are returned by the `cpu_family` method of `build_machine`,
-`host_machine` and `target_machine`. For cross compilation they are
-set in the cross file.
-
-| Value               | Comment                  |
-| -----               | -------                  |
-| aarch64             | 64 bit ARM processor     |
-| alpha               | DEC Alpha processor      |
-| arc                 | 32 bit ARC processor     |
-| arm                 | 32 bit ARM processor     |
-| avr                 | Atmel AVR processor      |
-| c2000               | 32 bit C2000 processor   |
-| dspic               | 16 bit Microchip dsPIC   |
-| e2k                 | MCST Elbrus processor    |
-| ia64                | Itanium processor        |
-| m68k                | Motorola 68000 processor |
-| microblaze          | MicroBlaze processor     |
-| mips                | 32 bit MIPS processor    |
-| mips64              | 64 bit MIPS processor    |
-| parisc              | HP PA-RISC processor     |
-| pic24               | 16 bit Microchip PIC24   |
-| ppc                 | 32 bit PPC processors    |
-| ppc64               | 64 bit PPC processors    |
-| riscv32             | 32 bit RISC-V Open ISA   |
-| riscv64             | 64 bit RISC-V Open ISA   |
-| rl78                | Renesas RL78             |
-| rx                  | Renesas RX 32 bit MCU    |
-| s390                | IBM zSystem s390         |
-| s390x               | IBM zSystem s390x        |
-| sh4                 | SuperH SH-4              |
-| sparc               | 32 bit SPARC             |
-| sparc64             | SPARC v9 processor       |
-| wasm32              | 32 bit Webassembly       |
-| wasm64              | 64 bit Webassembly       |
-| x86                 | 32 bit x86 processor     |
-| x86_64              | 64 bit x86 processor     |
-
-Any cpu family not listed in the above list is not guaranteed to
-remain stable in future releases.
-
-Those porting from autotools should note that meson does not add
-endianness to the name of the cpu_family. For example, autotools
-will call little endian PPC64 "ppc64le", meson will not, you must
-also check the `.endian()` value of the machine for this information.
-
-## Operating system names
-
-These are provided by the `.system()` method call.
-
-| Value               | Comment                         |
-| -----               | -------                         |
-| android             | By convention only, subject to change |
-| cygwin              | The Cygwin environment for Windows |
-| darwin              | Either OSX or iOS |
-| dragonfly           | DragonFly BSD |
-| emscripten          | Emscripten's Javascript environment |
-| freebsd             | FreeBSD and its derivatives |
-| gnu                 | GNU Hurd |
-| haiku               | |
-| linux               | |
-| netbsd              | |
-| openbsd             | |
-| windows             | Any version of Windows |
-| sunos               | illumos and Solaris |
-
-Any string not listed above is not guaranteed to remain stable in
-future releases.
-
-## Language arguments parameter names
-
-These are the parameter names for passing language specific arguments to your build target.
-
-| Language      | compiler name | linker name       |
-| ------------- | ------------- | ----------------- |
-| C             | c_args        | c_link_args       |
-| C++           | cpp_args      | cpp_link_args     |
-| C#            | cs_args       | cs_link_args      |
-| D             | d_args        | d_link_args       |
-| Fortran       | fortran_args  | fortran_link_args |
-| Java          | java_args     | java_link_args    |
-| Objective C   | objc_args     | objc_link_args    |
-| Objective C++ | objcpp_args   | objcpp_link_args  |
-| Rust          | rust_args     | rust_link_args    |
-| Vala          | vala_args     | vala_link_args    |
-
-All these `<lang>_*` options are specified per machine. See in [specifying
-options per machine](Builtin-options.md#Specifying-options-per-machine) for on
-how to do this in cross builds.
-
-## Compiler and linker flag environment variables
-
-These environment variables will be used to modify the compiler and
-linker flags.
-
-It is recommended that you **do not use these**. They are provided purely to
-for backwards compatibility with other build systems. There are many caveats to
-their use, especially when rebuilding the project. It is **highly** recommended
-that you use [the command line arguments](#language-arguments-parameter-names)
-instead.
-
-| Name      | Comment                                  |
-| -----     | -------                                  |
-| CFLAGS    | Flags for the C compiler                 |
-| CXXFLAGS  | Flags for the C++ compiler               |
-| OBJCFLAGS | Flags for the Objective C compiler       |
-| FFLAGS    | Flags for the Fortran compiler           |
-| DFLAGS    | Flags for the D compiler                 |
-| VALAFLAGS | Flags for the Vala compiler              |
-| RUSTFLAGS | Flags for the Rust compiler              |
-| LDFLAGS   | The linker flags, used for all languages |
-
-N.B. these settings are specified per machine, and so the environment varibles
-actually come in pairs. See the [environment variables per
-machine](#Environment-variables-per-machine) section for details.
-
-## Function Attributes
-
-These are the parameters names that are supported using
-`compiler.has_function_attribute()` or
-`compiler.get_supported_function_attributes()`
-
-### GCC `__attribute__`
-
-These values are supported using the GCC style `__attribute__` annotations,
-which are supported by GCC, Clang, and other compilers.
-
-
-| Name                     |
-|--------------------------|
-| alias                    |
-| aligned                  |
-| alloc_size               |
-| always_inline            |
-| artificial               |
-| cold                     |
-| const                    |
-| constructor              |
-| constructor_priority     |
-| deprecated               |
-| destructor               |
-| error                    |
-| externally_visible       |
-| fallthrough              |
-| flatten                  |
-| format                   |
-| format_arg               |
-| force_align_arg_pointer³ |
-| gnu_inline               |
-| hot                      |
-| ifunc                    |
-| malloc                   |
-| noclone                  |
-| noinline                 |
-| nonnull                  |
-| noreturn                 |
-| nothrow                  |
-| optimize                 |
-| packed                   |
-| pure                     |
-| returns_nonnull          |
-| unused                   |
-| used                     |
-| visibility*              |
-| visibility:default†      |
-| visibility:hidden†       |
-| visibility:internal†     |
-| visibility:protected†    |
-| warning                  |
-| warn_unused_result       |
-| weak                     |
-| weakreaf                 |
-
-\* *Changed in 0.52.0* the "visibility" target no longer includes
-"protected", which is not present in Apple's clang.
-
-† *New in 0.52.0* These split visibility attributes are preferred to the plain
-"visibility" as they provide narrower checks.
-
-³ *New in 0.55.0*
-
-### MSVC __declspec
-
-These values are supported using the MSVC style `__declspec` annotation,
-which are supported by MSVC, GCC, Clang, and other compilers.
-
-| Name                 |
-|----------------------|
-| dllexport            |
-| dllimport            |
-
-
-## Dependency lookup methods
-
-These are the values that can be passed to `dependency` function's
-`method` keyword argument.
-
-| Name              | Comment                                      |
-| -----             | -------                                      |
-| auto              | Automatic method selection                   |
-| pkg-config        | Use Pkg-Config                               |
-| cmake             | Look up as a CMake module                    |
-| config-tool       | Use a custom dep tool such as `cups-config`  |
-| system            | System provided (e.g. OpenGL)                |
-| extraframework    | A macOS/iOS framework                        |
-
-
-## Compiler and Linker selection variables
-
-N.B. these settings are specified per machine, and so the environment varibles
-actually come in pairs. See the [environment variables per
-machine](#Environment-variables-per-machine) section for details.
-
-| Language      | Compiler | Linker    | Note                                        |
-|---------------|----------|-----------|---------------------------------------------|
-| C             | CC       | CC_LD     |                                             |
-| C++           | CXX      | CXX_LD    |                                             |
-| D             | DC       | DC_LD     | Before 0.54 D_LD*                           |
-| Fortran       | FC       | FC_LD     | Before 0.54 F_LD*                           |
-| Objective-C   | OBJC     | OBJC_LD   |                                             |
-| Objective-C++ | OBJCXX   | OBJCXX_LD | Before 0.54 OBJCPP_LD*                      |
-| Rust          | RUSTC    | RUSTC_LD  | Before 0.54 RUST_LD*                        |
-| Vala          | VALAC    |           | Use CC_LD. Vala transpiles to C             |
-| C#            | CSC      | CSC       | The linker is the compiler                  |
-
-*The old environment variales are still supported, but are deprecated and will
-be removed in a future version of meson.*
-
-## Environment variables per machine
-
-Since *0.54.0*, Following Autotool and other legacy build systems, environment
-variables that affect machine-specific settings come in pairs: for every bare
-environment variable `FOO`, there is a suffixed `FOO_FOR_BUILD`, where `FOO`
-just affects the host machine configuration, while `FOO_FOR_BUILD` just affects
-the build machine configuration. For example:
-
- - `PKG_CONFIG_PATH_FOR_BUILD` controls the paths pkg-config will search for
-   just `native: true` dependencies (build machine).
-
- - `PKG_CONFIG_PATH` controls the paths pkg-config will search for just
-   `native: false` dependencies (host machine).
-
-This mirrors the `build.` prefix used for (built-in) meson options, which has
-the same meaning.
-
-This is useful for cross builds. In the native builds, build = host, and the
-unsuffixed environment variables alone will suffice.
-
-Prior to *0.54.0*, there was no `_FOR_BUILD`-suffixed variables, and most
-environment variables only effected native machine configurations, though this
-wasn't consistent (e.g. `PKG_CONFIG_PATH` still affected cross builds).
diff --git a/meson/docs/markdown/Release-notes-for-0.37.0.md b/meson/docs/markdown/Release-notes-for-0.37.0.md
deleted file mode 100644 (file)
index 7e8aa54..0000000
+++ /dev/null
@@ -1,128 +0,0 @@
----
-title: Release 0.37
-short-description: Release notes for 0.37
-...
-
-# New features
-
-## Mesontest
-
-Mesontest is a new testing tool that allows you to run your tests in many different ways. As an example you can run tests multiple times:
-
-    mesontest --repeat=1000 a_test
-
-or with an arbitrary wrapper executable:
-
-    mesontest --wrap='valgrind --tool=helgrind' a_test
-
-or under `gdb`, 1000 times in a row. This is handy for tests that fail spuriously, as when the crash happens you are given the full GDB command line:
-
-    mesontest --repeat=1000 --gdb a_test
-
-## Mesonrewriter
-
-Mesonrewriter is an experimental tool to manipulate your build definitions programmatically. It is not installed by default yet but those interested can run it from the source repository.
-
-As an example, here is how you would add a source file to a build target:
-
-    mesonrewriter add --target=program --filename=new_source.c
-
-## Shared modules
-
-The new `shared_module` function allows the creation of shared modules, that is, extension modules such as plugins that are meant to be used solely with `dlopen` rather than linking them to targets.
-
-## Gnome module
-
-- Detect required programs and print useful errors if missing
-
-### gtkdoc
-
-- Allow passing a list of directories to `src_dir` keyword argument
-- Add `namespace` keyword argument
-- Add `mode` keyword argument
-- Fix `gtkdoc-scangobj` finding local libraries
-
-### compile_resources
-
-- Add `gresource_bundle` keyword argument to output `.gresource` files
-- Add `export` and `install_header` keyword arguments
-- Use depfile support available in GLib >= 2.52.0
-
-## i18n module
-
-- Add `merge_file()` function for creating translated files
-- Add `preset` keyword argument to included common gettext flags
-- Read languages from `LINGUAS` file
-
-## LLVM IR compilation
-
-Meson has long had support for compiling assembler (GAS) files. In this release we add support for compiling LLVM IR files in a similar way when building with the Clang compiler. Just add it to the list of files when creating a `library` or `executable` target like any other source file. No special handling is required:
-
-```meson
-executable('some-exe', 'main.c', 'asm-file.S', 'ir-file.ll')
-```
-
-As always, you can also mix LLVM IR files with C++, C, and Assembly (GAS) sources.
-
-## ViM indent and syntax files
-
-We now include filetype, indent, and syntax files for ViM [with the source tree](https://github.com/mesonbuild/meson/tree/master/data/syntax-highlighting/vim). Please file issues (or pull requests!) for enhancements or if you face any problems using them.
-
-## Push URLs in .wrap files
-
-[.wrap files](Using-the-WrapDB.md) for subprojects can now include a separate push URL to allow developers to push changes directly from a subproject git checkout.
-
-## pkg-config dependencies
-
-Meson now supports multiple version restrictions while searching for pkg-config dependencies.
-
-```meson
-# Just want a lower limit
-dependency('zlib', version : '>1.2.1')
-# Want both a lower and an upper limit
-dependency('opencv', version : ['>=2.3.0', '<=3.1.0'])
-# Want to exclude one specific broken version
-dependency('foolite', version : ['>=3.12.1', '!=3.13.99'])
-```
-
-## Overriding more binaries with environment variables
-
-You can now specify the binary to be used for the following tools by setting the corresponding environment variable
-
-| Name | Environment variable |
-| ---- | -------------------- |
-| pkg-config | PKG_CONFIG     |
-| readelf    | READELF        |
-| nm         | NM             |
-
-## Support for `localstatedir`
-
-Similar to other options such as `bindir` and `datadir`, you can now specify the `localstatedir` for a project by passing `--localstatedir=dir` to `meson` or `-Dlocalstatedir=dir` to `mesonconf` after configuration. You can also access it from inside the `meson.build` file with `get_option('localstatedir')`.
-
-## New compiler function `symbols_have_underscore_prefix`
-
-Checks if the compiler prefixes an underscore to C global symbols with the default calling convention. This is useful when linking to compiled assembly code, or other code that does not have its C symbol mangling handled transparently by the compiler.
-
-```meson
-cc = meson.get_compiler('c')
-conf = configuration_data()
-if cc.symbols_have_underscore_prefix()
-    conf.set('SYMBOLS_HAVE_UNDERSCORE', true)
-endif
-```
-
-C symbol mangling is platform and architecture dependent, and a helper function is needed to detect it. For example, Windows 32-bit prefixes underscore, but 64-bit does not. Linux does not prefix an underscore but OS X does.
-
-## Vala
-
-GLib Resources compiled with [`gnome.compile_resources`](Gnome-module.md#compile_resources) that are added to the sources of a Vala build target will now cause the appropriate `--gresources` flag to be passed to the Vala compiler so you don't need to add that yourself to `vala_args:`.
-
-## Improvements to install scripts
-
-You can now pass arguments to install scripts added with [`meson.add_install_script()`](Reference-manual.md#meson-object). All arguments after the script name will be passed to the script.
-
-The `MESON_INSTALL_DESTDIR_PREFIX` environment variable is now set when install scripts are called. This contains the values of the `DESTDIR` environment variable and the `prefix` option passed to Meson joined together. This is useful because both those are usually absolute paths, and joining absolute paths in a cross-platform way is tricky. [`os.path.join` in Python](https://docs.python.org/3/library/os.path.html#os.path.join) will discard all previous path segments when it encounters an absolute path, and simply concatenating them will not work on Windows where absolute paths begin with the drive letter.
-
-## More install directories
-
-Added new options `sbindir` and `infodir` that can be used for installation.
diff --git a/meson/docs/markdown/Release-notes-for-0.38.0.md b/meson/docs/markdown/Release-notes-for-0.38.0.md
deleted file mode 100644 (file)
index cbd8fff..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
----
-title: Release 0.38
-short-description: Release notes for 0.38
-...
-
-## Uninstall target
-
-Meson allows you to uninstall an install step by invoking the uninstall target. This will remove all files installed as part of install. Note that this does not restore the original files. This also does not undo changes done by custom install scripts (because they can do arbitrary install operations).
-
-## Support for arbitrary test setups
-
-Sometimes you need to run unit tests with special settings. For example under Valgrind. Usually this requires extra command line options for the tool. This is supported with the new *test setup* feature. For example to set up a test run with Valgrind, you'd write this in a `meson.build` file:
-
-```meson
-add_test_setup('valgrind',
-  exe_wrapper : [vg, '--error-exitcode=1', '--leak-check=full'],
-  timeout_multiplier : 100)
-```
-
-This tells Meson to run tests with Valgrind using the given options and multiplying the test timeout values by 100. To run this test setup simply issue the following command:
-
-```console
-$ mesontest --setup=valgrind
-```
-
-## Intel C/C++ compiler support
-
-As usual, just set `CC=icc CXX=icpc` and Meson will use it as the C/C++ compiler. Currently only Linux is supported.
-
-## Get values from configuration data objects
-
-Now it is possible to query values stored in configuration data objects.
-
-```meson
-cdata.set('key', 'value')
-cdata.get('key') # returns 'value'
-cdata.get('nokey', 'default') # returns 'default'
-cdata.get('nokey') # halts with an error
-```
-
-## Python 3 module support
-
-Building Python 3 extension modules has always been possible, but it is now even easier:
-
-```meson
-py3_mod = import('python3')
-pylib = py3_mod.extension_module('modname',
-  'modsource.c',
-  dependencies : py3_dep)
-```
-
-## Default options to subprojects
-
-Projects can specify overriding values for subprojects' `default_options` when invoking a subproject:
-
-```meson
-subproject('foo', default_options : ['optname=overridevalue'])
-dependency('some-dep', fallback : ['some_subproject', 'some_dep'], default_options : ['optname=overridevalue'])
-```
-
-The effect is the same as if the default options were written in the subproject's `project` call.
-
-## Set targets to be built (or not) by default
-
-Build targets got a new keyword `build_by_default` which tells whether the target should be built by default when running e.g. `ninja`. Custom targets are not built by default but other targets are. Any target that is tagged as installed or to be built always is also built by default, regardless of the value of this keyword.
-
-## Add option to mesonconf to wipe cached data.
-
-Meson caches the results of dependency lookups. Sometimes these may get out of sync with the system state. Mesonconf now has a `--clearcache` option to clear these values so they will be re-searched from the system upon next compile.
-
-## Can specify file permissions and owner when installing data
-
-The new `install_mode` keyword argument can be used to specify file permissions and uid/gid of files when doing the install. This allows you to, for example, install suid root scripts.
-
-## `has_header()` checks are now faster
-
-When using compilers that implement the [`__has_include()` preprocessor macro](https://clang.llvm.org/docs/LanguageExtensions.html#include-file-checking-macros), the check is now ~40% faster.
-
-## Array indexing now supports fallback values
-
-The second argument to the array [`.get()`](Reference-manual.md#array-object) function is now returned if the specified index could not be found
-```meson
-array = [10, 11, 12, 13]
-array.get(0) # this will return `10`
-array.get(4) # this will give an error about invalid index
-array.get(4, 0) # this will return `0`
-```
-
-## Silent mode for Mesontest
-
-The Meson test executor got a new argument `-q` (and `--quiet`) that suppresses all output of successful tests. This makes interactive usage nicer because only errors are printed.
diff --git a/meson/docs/markdown/Release-notes-for-0.39.0.md b/meson/docs/markdown/Release-notes-for-0.39.0.md
deleted file mode 100644 (file)
index 705bb80..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
----
-title: Release 0.39
-short-description: Release notes for 0.39
-...
-
-The 0.39.0 release turned out to consist almost entirely of bug fixes and minor polishes.
-
-# New features
-
-## Extra arguments for tests
-
-The Meson test executable allows specifying extra command line arguments to pass to test executables.
-
-    mesontest --test-args=--more-debug-info currenttest
diff --git a/meson/docs/markdown/Release-notes-for-0.40.0.md b/meson/docs/markdown/Release-notes-for-0.40.0.md
deleted file mode 100644 (file)
index a480788..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
----
-title: Release 0.40
-short-description: Release notes for 0.40
-...
-
-# New features
-
-## Outputs of generators can be used in custom targets in the VS backend
-
-This has been possible with the Ninja backend for a long time but now the Visual Studio backend works too.
-
-## `compute_int` method in the compiler objects
-
-This method can be used to evaluate the value of an expression. As an example:
-
-```meson
-cc = meson.get_compiler('c')
-two = cc.compute_int('1 + 1') # A very slow way of adding two numbers.
-```
-
-## Visual Studio 2017 support
-
-There is now a VS2017 backend (`--backend=vs2017`) as well as a generic VS backend (`--backend=vs`) that autodetects the currently active VS version.
-
-## Automatic initialization of subprojects that are git submodules
-
-If you have a directory inside your subprojects directory (usually `subprojects/`) that is a git submodule, meson will automatically initialize it if your build files refer to it. This will be done without needing a wrap file since git contains all the information needed.
-
-## No download mode for wraps
-
-Added a new option `wrap-mode` that can be toggled to prevent Meson from downloading dependency projects. Attempting to do so will cause an error. This is useful for distro packagers and other cases where you must explicitly enforce that nothing is downloaded from the net during configuration or build.
-
-## Overriding options per target
-
-Build targets got a new keyword argument `override_options` that can be used to override system options. As an example if you have a target that you know can't be built with `-Werror` enabled you can override the value of the option like this:
-
-```meson
-executable('foo', 'foo.c', override_options : ['werror=false'])
-```
-
-Note that this does not affect project options, only those options that come from Meson (language standards, unity builds etc).
-
-## Compiler object get define
-
-Compiler objects got a new method `get_define()` that returns the given preprocessor symbol as a string.
-
-```meson
-cc = meson.get_compiler('c')
-one = cc.get_define('__linux__') # returns '1' on Linux hosts
-```
-
-## Cygwin support
-
-Meson now works under Cygwin and we have added it to our CI test matrix.
-
-## Multiple install directories
-
-Custom targets can produce many output files. Previously it was only possible to install all of them in the same directory, but now you can install each output in its own directory like this:
-
-```meson
-custom_target('two_out',
-  output : ['diff.h', 'diff.sh'],
-  command : [creator, '@OUTDIR@'],
-  install : true,
-  install_dir : ['dir1', 'dir2'])
-```
-
-For backwards compatibility and for conciseness, if you only specify one directory all outputs will be installed into it.
-
-The same feature is also available for Vala build targets. For instance, to install a shared library built by valac, the generated header, and the generated VAPI (respectively) into the default locations, you can do:
-
-```meson
-shared_library('valalib', 'mylib.vala',
-  install : true,
-  install_dir : [true, true, true])
-```
-
-To install any of the three in a custom directory, just pass it as a string instead of `true`. To not install it, pass `false`. You can also pass a single string (as before) and it will cause only the library to be installed, so this is a backwards-compatible change.
-
-## Can specify method of obtaining dependencies
-
-Some dependencies have many ways of being provided. As an example Qt can either be detected via `pkg-config` or `qmake`. Until now Meson has had a heuristic for selecting which method to choose but sometimes it does the wrong thing. This can now be overridden with the `method` keyword like this:
-
-```meson
-qt5_dep = dependency('qt5', modules : 'core', method : 'qmake')
-```
-
-## Link whole contents of static libraries
-
-The default behavior of static libraries is to discard all symbols that are not not directly referenced. This may lead to exported symbols being lost. Most compilers support "whole archive" linking that includes all symbols and code of a given static library. This is exposed with the `link_whole` keyword.
-
-```meson
-shared_library('foo', 'foo.c', link_whole : some_static_library)
-```
-
-Note that Visual Studio compilers only support this functionality on VS 2015 and newer.
-
-## Unity builds only for subprojects
-
-Up until now unity builds were either done for every target or none of them. Now unity builds can be specified to be enabled only for subprojects, which change seldom, and not for the master project, which changes a lot. This is enabled by setting the `unity` option to `subprojects`.
-
-## Running `mesonintrospect` from scripts
-
-Meson now sets the `MESONINTROSPECT` environment variable in addition to `MESON_SOURCE_ROOT` and other variables when running scripts. It is guaranteed to point to the correct `mesonintrospect` script, which is important when running meson uninstalled from git or when your `PATH`s may not be set up correctly.
-
-Specifically, the following meson functions will set it: `meson.add_install_script()`, `meson.add_postconf_script()`, `run_command()`, `run_target()`.
diff --git a/meson/docs/markdown/Release-notes-for-0.41.0.md b/meson/docs/markdown/Release-notes-for-0.41.0.md
deleted file mode 100644 (file)
index 7861aad..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
----
-title: Release 0.41
-short-description: Release notes for 0.41
-...
-
-# New features
-
-## Dependency Handler for LLVM
-
-Native support for linking against LLVM using the `dependency` function.
-
-## vcs_tag keyword fallback is now optional
-
-The `fallback` keyword in `vcs_tag()` is now optional. If not given, its value
-defaults to the return value of `meson.project_version()`.
-
-## Better quoting of special characters in ninja command invocations
-
-The ninja backend now quotes special characters that may be interpreted by
-ninja itself, providing better interoperability with custom commands. This
-support may not be perfect; please report any issues found with special
-characters to the issue tracker.
-
-## Pkgconfig support for custom variables
-
-The Pkgconfig module object can add arbitrary variables to the generated .pc
-file with the new `variables` keyword:
-```meson
-pkg.generate(libraries : libs,
-             subdirs : h,
-             version : '1.0',
-             name : 'libsimple',
-             filebase : 'simple',
-             description : 'A simple demo library.',
-             variables : ['datadir=${prefix}/data'])
-```
-
-## A target for creating tarballs
-
-Creating distribution tarballs is simple:
-
-    ninja dist
-
-This will create a `.tar.xz` archive of the source code including
-submodules without any revision control information. This command also
-verifies that the resulting archive can be built, tested and
-installed. This is roughly equivalent to the `distcheck` target in
-other build systems. Currently this only works for projects using Git
-and only with the Ninja backend.
-
-## Support for passing arguments to Rust compiler
-
-Targets for building rust now take a `rust_args` keyword.
-
-## Code coverage export for tests
-
-Code coverage can be generated for tests by passing the `--cov` argument to
-the `run_tests.py` test runner. Note, since multiple processes are used,
-coverage must be combined before producing a report (`coverage3 combine`).
-
-## Reproducible builds
-
-All known issues have been fixed and Meson can now build reproducible Debian
-packages out of the box.
-
-## Extended template substitution in configure_file
-
-The output argument of `configure_file()` is parsed for @BASENAME@ and
-@PLAINNAME@ substitutions.
-
-## Cross-config property for overriding whether an exe wrapper is needed
-
-The new `needs_exe_wrapper` property allows overriding auto-detection for
-cases where `build_machine` appears to be compatible with `host_machine`,
-but actually isn't. For example when:
-- `build_machine` is macOS and `host_machine` is the iOS Simulator
-- the `build_machine`'s libc is glibc but the `host_machine` libc is uClibc
-- code relies on kernel features not available on the `build_machine`
-
-## Support for capturing stdout of a command in configure_file
-
-`configure_file()` now supports a new keyword - `capture`. When this argument
-is set to true, Meson captures `stdout` of the `command` and writes it to
-the target file specified as `output`.
diff --git a/meson/docs/markdown/Release-notes-for-0.42.0.md b/meson/docs/markdown/Release-notes-for-0.42.0.md
deleted file mode 100644 (file)
index e89f1a1..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
----
-title: Release 0.42
-short-description: Release notes for 0.42
-...
-
-# New features
-
-## Distribution tarballs from Mercurial repositories
-
-Creating distribution tarballs can now be made out of projects based on
-Mercurial. As before, this remains possible only with the Ninja backend.
-
-## Keyword argument verification
-
-Meson will now check the keyword arguments used when calling any function
-and print a warning if any of the keyword arguments is not known. In the
-future this will become a hard error.
-
-## Add support for Genie to Vala compiler
-
-The Vala compiler has an alternative syntax, Genie, that uses the `.gs`
-file extension. Meson now recognises and uses Genie files.
-
-## Pkgconfig support for additional cflags
-
-The Pkgconfig module object can add arbitrary extra cflags to the Cflags
-value in the .pc file, using the "extra_cflags" keyword:
-```meson
-pkg.generate(libraries : libs,
-             subdirs : h,
-             version : '1.0',
-             name : 'libsimple',
-             filebase : 'simple',
-             description : 'A simple demo library.',
-             extra_cflags : '-Dfoo' )
-```
-
-## Base options accessible via get_option()
-
-Base options are now accessible via the get_option() function.
-```meson
-uses_lto = get_option('b_lto')
-```
-
-## Allow crate type configuration for Rust compiler
-
-Rust targets now take an optional `rust_crate_type` keyword, allowing
-you to set the crate type of the resulting artifact. Valid crate types
-are `dylib` or `cdylib` for shared libraries, and `rlib` or
-`staticlib` for static libraries. For more, see
-Rust's [linkage reference][rust-linkage].
-
-[rust-linkage]: https://doc.rust-lang.org/reference/linkage.html
-
-## Simultaneous use of Address- and Undefined Behavior Sanitizers
-
-Both the address- and undefined behavior sanitizers can now be used
-simultaneously by passing `-Db_sanitize=address,undefined` to Meson.
-
-## Unstable SIMD module
-
-A new experimental module to compile code with many different SIMD
-instruction sets and selecting the best one at runtime. This module
-is unstable, meaning its API is subject to change in later releases.
-It might also be removed altogether.
-
-
-## Import libraries for executables on Windows
-
-The new keyword `implib` to `executable()` allows generation of an import
-library for the executable.
-
-## Added build_rpath keyword argument
-
-You can specify `build_rpath : '/foo/bar'` in build targets and the
-given path will get added to the target's rpath in the build tree. It
-is removed during the install step.
-
-Meson will print a warning when the user tries to add an rpath linker
-flag manually, e.g. via `link_args` to a target. This is not
-recommended because having multiple rpath causes them to stomp on each
-other. This warning will become a hard error in some future release.
-
-## Vulkan dependency module
-
-Vulkan can now be used as native dependency. The dependency module
-will detect the VULKAN_SDK environment variable or otherwise try to
-receive the vulkan library and header via pkgconfig or from the
-system.
-
-## Limiting the maximum number of linker processes
-
-With the Ninja backend it is now possible to limit the maximum number of
-concurrent linker processes. This is usually only needed for projects
-that have many large link steps that cause the system to run out of
-memory if they are run in parallel. This limit can be set with the
-new `backend_max_links` option.
-
-## Disable implicit include directories
-
-By default Meson adds the current source and build directories to the
-header search path. On some rare occasions this is not desired. Setting
-the `implicit_include_directories` keyword argument to `false` these
-directories are not used.
-
-## Support for MPI dependency
-
-MPI is now supported as a dependency. Because dependencies are
-language-specific, you must specify the requested language with the
-`language` keyword, i.e., `dependency('mpi', language='c')` will
-request the C MPI headers and libraries. See [the MPI
-dependency](Dependencies.md#mpi) for more information.
-
-## Allow excluding files or directories from `install_subdir`
-
-The [`install_subdir`](Reference-manual.md#install_subdir) command
-accepts the new `exclude_files` and `exclude_directories` keyword
-arguments that allow specified files or directories to be excluded
-from the installed subdirectory.
-
-## Make all Meson functionality invokable via the main executable
-
-Previously Meson had multiple executables such as `mesonintrospect`
-and `mesontest`. They are now invokable via the main Meson executable
-like this:
-
-    meson configure <arguments> # equivalent to mesonconf <options>
-    meson test <arguments> # equivalent to mesontest <arguments>
-
-The old commands are still available but they are deprecated
-and will be removed in some future release.
-
-## Pcap dependency detector
-
-Meson will automatically obtain dependency information for pcap
-using the `pcap-config` tool. It is used like any other dependency:
-
-```meson
-pcap_dep = dependency('pcap', version : '>=1.0')
-```
-
-## GNOME module mkenums_simple() addition
-
-Most libraries and applications use the same standard templates for
-glib-mkenums. There is now a new `mkenums_simple()` convenience method
-that passes those default templates to glib-mkenums and allows some tweaks
-such as optional function decorators or leading underscores.
diff --git a/meson/docs/markdown/Release-notes-for-0.43.0.md b/meson/docs/markdown/Release-notes-for-0.43.0.md
deleted file mode 100644 (file)
index 0ca66ae..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
----
-title: Release 0.43
-short-description: Release notes for 0.43
-...
-
-## Portability improvements to Boost Dependency
-
-The Boost dependency has been improved to better detect the various ways to
-install boost on multiple platforms. At the same time the `modules` semantics
-for the dependency has been changed. Previously it was allowed to specify
-header directories as `modules` but it wasn't required. Now, modules are only
-used to specify libraries that require linking.
-
-This is a breaking change and the fix is to remove all modules that aren't
-found.
-
-## Generator learned capture
-
-Generators can now be configured to capture the standard output. See
-`test cases/common/98 gen extra/meson.build` for an example.
-
-## Can index CustomTarget objects
-
-The `CustomTarget` object can now be indexed like an array. The resulting
-object can be used as a source file for other Targets, this will create a
-dependency on the original `CustomTarget`, but will only insert the generated
-file corresponding to the index value of the `CustomTarget`'s `output` keyword.
-
-```meson
-c = custom_target(
-  ...
-  output : ['out.h', 'out.c'],
-)
-lib1 = static_library(
-  'lib1',
-  [lib1_sources, c[0]],
-  ...
-)
-exec = executable(
-  'executable',
-  c[1],
-  link_with : lib1,
-)
-```
-
-## Can override executables in the cross file
-
-The cross file can now be used for overriding the result of
-`find_program`. As an example if you want to find the `objdump`
-command and have the following definition in your cross file:
-
-```ini
-[binaries]
-...
-objdump = '/usr/bin/arm-linux-gnueabihf-objdump-6'
-```
-
-Then issuing the command `find_program('objdump')` will return the
-version specified in the cross file. If you need the build machine's
-objdump, you can specify the `native` keyword like this:
-
-```meson
-native_objdump = find_program('objdump', native : true)
-```
-
-## Easier handling of supported compiler arguments
-
-A common pattern for handling multiple desired compiler arguments, was to
-test their presence and add them to an array one-by-one, e.g.:
-
-```meson
-warning_flags_maybe = [
-  '-Wsomething',
-  '-Wanother-thing',
-  '-Wno-the-other-thing',
-]
-warning_flags = []
-foreach flag : warning_flags_maybe
-  if cc.has_argument(flag)
-    warning_flags += flag
-  endif
-endforeach
-cc.add_project_argument(warning_flags)
-```
-
-A helper has been added for the foreach/has_argument pattern, so you can
-now simply do:
-
-```meson
-warning_flags = [ ... ]
-flags = cc.get_supported_arguments(warning_flags)
-```
-
-## Better support for shared libraries in non-system paths
-
-Meson has support for prebuilt object files and static libraries.
-This release adds feature parity to shared libraries that are either
-in non-standard system paths or shipped as part of your project. On
-systems that support rpath, Meson automatically adds rpath entries
-to built targets using manually found external libraries.
-
-This means that e.g. supporting prebuilt libraries shipped with your
-source or provided by subprojects or wrap definitions by writing a
-build file like this:
-
-```meson
-project('myprebuiltlibrary', 'c')
-
-cc = meson.get_compiler('c')
-prebuilt = cc.find_library('mylib', dirs : meson.current_source_dir())
-mydep = declare_dependency(include_directories : include_directories('.'),
-                           dependencies : prebuilt)
-```
-
-Then you can use the dependency object in the same way as any other.
-
-## wrap-svn
-
-The [Wrap dependency system](Wrap-dependency-system-manual.md) now
-supports [Subversion](https://subversion.apache.org/) (svn).  This
-support is rudimentary. The repository url has to point to a specific
-(sub)directory containing the `meson.build` file (typically
-`trunk/`). However, providing a `revision` is supported.
diff --git a/meson/docs/markdown/Release-notes-for-0.44.0.md b/meson/docs/markdown/Release-notes-for-0.44.0.md
deleted file mode 100644 (file)
index d765940..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
----
-title: Release 0.44
-short-description: Release notes for 0.44
-...
-
-# New features
-
-## Added warning function
-
-This function prints its argument to the console prefixed by "WARNING:" in
-yellow color. A simple example:
-
-warning('foo is deprecated, please use bar instead')
-
-
-## Adds support for additional Qt5-Module keyword `moc_extra_arguments`
-
-When `moc`-ing sources, the `moc` tool does not know about any
-preprocessor macros. The generated code might not match the input
-files when the linking with the moc input sources happens.
-
-This amendment allows to specify a a list of additional arguments
-passed to the `moc` tool. They are called `moc_extra_arguments`.
-
-
-## Prefix-dependent defaults for sysconfdir, localstatedir and sharedstatedir
-
-These options now default in a way consistent with
-[FHS](http://refspecs.linuxfoundation.org/fhs.shtml) and common usage.
-
-If prefix is `/usr`, default sysconfdir to `/etc`, localstatedir to `/var` and
-sharedstatedir to `/var/lib`.
-
-If prefix is `/usr/local` (the default), default localstatedir to `/var/local`
-and sharedstatedir to `/var/local/lib`.
-
-
-## An array type for user options
-
-Previously to have an option that took more than one value a string
-value would have to be created and split, but validating this was
-difficult. A new array type has been added to the meson_options.txt
-for this case. It works like a 'combo', but allows more than one
-option to be passed. The values can optionally be validated against a
-list of valid values. When used on the command line (with -D), values
-are passed as a comma separated list.
-
-```meson
-option('array_opt', type : 'array', choices : ['one', 'two', 'three'], value : ['one'])
-```
-
-These can be overwritten on the command line,
-
-```meson
-meson _build -Darray_opt=two,three
-```
-
-## LLVM dependency supports both dynamic and static linking
-
-The LLVM dependency has been improved to consistently use dynamic linking.
-Previously recent version (>= 3.9) would link dynamically while older versions
-would link statically.
-
-Now LLVM also accepts the `static` keyword to enable statically linking to LLVM
-modules instead of dynamically linking.
-
-
-## Added `if_found` to subdir
-
-Added a new keyword argument to the `subdir` command. It is given a
-list of dependency objects and the function will only recurse in the
-subdirectory if they are all found. Typical usage goes like this.
-
-```meson
-d1 = dependency('foo') # This is found
-d2 = dependency('bar') # This is not found
-
-subdir('somedir', if_found : [d1, d2])
-```
-
-In this case the subdirectory would not be entered since `d2` could
-not be found.
-
-## `get_unquoted()` method for the `configuration` data object
-
-New convenience method that allows reusing a variable value
-defined quoted. Useful in C for config.h strings for example.
-
-
-## Added disabler object
-
-A disabler object is a new kind of object that has very specific
-semantics. If it is used as part of any other operation such as an
-argument to a function call, logical operations etc, it will cause the
-operation to not be evaluated. Instead the return value of said
-operation will also be the disabler object.
-
-For example if you have an setup like this:
-
-```meson
-dep = dependency('foo')
-lib = shared_library('mylib', 'mylib.c',
-  dependencies : dep)
-exe = executable('mytest', 'mytest.c',
-  link_with : lib)
-test('mytest', exe)
-```
-
-If you replace the dependency with a disabler object like this:
-
-```meson
-dep = disabler()
-lib = shared_library('mylib', 'mylib.c',
-  dependencies : dep)
-exe = executable('mytest', 'mytest.c',
-  link_with : lib)
-test('mytest', exe)
-```
-
-Then the shared library, executable and unit test are not
-created. This is a handy mechanism to cut down on the number of `if`
-statements.
-
-
-## Config-Tool based dependencies gained a method to get arbitrary options
-
-A number of dependencies (CUPS, LLVM, pcap, WxWidgets, GnuStep) use a config
-tool instead of pkg-config. As of this version they now have a
-`get_configtool_variable` method, which is analogous to the
-`get_pkgconfig_variable` for pkg config.
-
-```meson
-dep_llvm = dependency('LLVM')
-llvm_inc_dir = dep_llvm.get_configtool_variable('includedir')
-```
-
-## Embedded Python in Windows MSI packages
-
-Meson now ships an internal version of Python in the MSI installer packages.
-This means that it can run Python scripts that are part of your build
-transparently. That is, if you do the following:
-
-```meson
-myprog = find_program('myscript.py')
-```
-
-Then Meson will run the script with its internal Python version if necessary.
-
-## Libwmf dependency now supports libwmf-config
-
-Earlier, `dependency('libwmf')` could only detect the library with pkg-config
-files. Now, if pkg-config files are not found, Meson will look for
-`libwmf-config` and if it's found, will use that to find the library.
diff --git a/meson/docs/markdown/Release-notes-for-0.45.0.md b/meson/docs/markdown/Release-notes-for-0.45.0.md
deleted file mode 100644 (file)
index 2b67f9b..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
----
-title: Release 0.45
-short-description: Release notes for 0.45
-...
-
-# New features
-
-## Python minimum version is now 3.5
-
-Meson will from this version on require Python version 3.5 or newer.
-
-## Config-Tool based dependencies can be specified in a cross file
-
-Tools like LLVM and pcap use a config tool for dependencies, this is a
-script or binary that is run to get configuration information (cflags,
-ldflags, etc) from.
-
-These binaries may now be specified in the `binaries` section of a
-cross file.
-
-```ini
-[binaries]
-cc = ...
-llvm-config = '/usr/bin/llvm-config32'
-```
-
-## Visual Studio C# compiler support
-
-In addition to the Mono C# compiler we also support Visual Studio's C#
-compiler. Currently this is only supported on the Ninja backend.
-
-## Removed two deprecated features
-
-The standalone `find_library` function has been a no-op for a long
-time. Starting with this version it becomes a hard error.
-
-There used to be a keywordless version of `run_target` which looked
-like this:
-
-```meson
-run_target('targetname', 'command', 'arg1', 'arg2')
-```
-
-This is now an error. The correct format for this is now:
-
-```meson
-run_target('targetname',
-  command : ['command', 'arg1', 'arg2'])
-```
-
-## Experimental FPGA support
-
-This version adds support for generating, analysing and uploading FPGA
-programs using the [IceStorm
-toolchain](http://www.clifford.at/icestorm/). This support is
-experimental and is currently limited to the `iCE 40` series of FPGA
-chips.
-
-FPGA generation integrates with other parts of Meson seamlessly. As an
-example, [here](https://github.com/jpakkane/lm32) is an example
-project that compiles a simple firmware into Verilog and combines that
-with an lm32 softcore processor.
-
-## Generator outputs can preserve directory structure
-
-Normally when generating files with a generator, Meson flattens the
-input files so they all go in the same directory. Some code
-generators, such as Protocol Buffers, require that the generated files
-have the same directory layout as the input files used to generate
-them. This can now be achieved like this:
-
-```meson
-g = generator(...) # Compiles protobuf sources
-generated = gen.process('com/mesonbuild/one.proto',
-  'com/mesonbuild/two.proto',
-  preserve_path_from : meson.current_source_dir())
-```
-
-This would cause the following files to be generated inside the target
-private directory:
-
-    com/mesonbuild/one.pb.h
-    com/mesonbuild/one.pb.cc
-    com/mesonbuild/two.pb.h
-    com/mesonbuild/two.pb.cc
-
-## Hexadecimal string literals
-
-Hexadecimal integer literals can now be used in build and option files.
-
-```meson
-int_255 = 0xFF
-```
-
-## b_ndebug : if-release
-
-The value `if-release` can be given for the `b_ndebug` project option.
-
-This will make the `NDEBUG` pre-compiler macro to be defined for release
-type builds as if the `b_ndebug` project option had had the value `true`
-defined for it.
-
-## `install_data()` defaults to `{datadir}/{projectname}`
-
-If `install_data()` is not given an `install_dir` keyword argument, the
-target directory defaults to `{datadir}/{projectname}` (e.g.
-`/usr/share/myproj`).
-
-## install_subdir() supports strip_directory
-
-If strip_directory=true install_subdir() installs directory contents
-instead of directory itself, stripping basename of the source directory.
-
-## Integer options
-
-There is a new integer option type with optional minimum and maximum
-values. It can be specified like this in the `meson_options.txt` file:
-
-```meson
-option('integer_option', type : 'integer', min : 0, max : 5, value : 3)
-```
-
-## New method meson.project_license()
-
-The `meson` builtin object now has a `project_license()` method that
-returns a list of all licenses for the project.
-
-## Rust cross-compilation
-
-Cross-compilation is now supported for Rust targets. Like other
-cross-compilers, the Rust binary must be specified in your cross
-file. It should specify a `--target` (as installed by `rustup target`)
-and a custom linker pointing to your C cross-compiler. For example:
-
-```ini
-[binaries]
-c = '/usr/bin/arm-linux-gnueabihf-gcc-7'
-rust = [
-    'rustc',
-    '--target', 'arm-unknown-linux-gnueabihf',
-    '-C', 'linker=/usr/bin/arm-linux-gnueabihf-gcc-7',
-]
-```
-
-## Rust compiler-private library disambiguation
-
-When building a Rust target with Rust library dependencies, an
-`--extern` argument is now specified to avoid ambiguity between the
-dependency library, and any crates of the same name in `rustc`'s
-private sysroot.
-
-## Project templates
-
-Meson ships with predefined project templates. To start a new project from
-scratch, simply go to an empty directory and type:
-
-    meson init --name=myproject --type=executable --language=c
-
-## Improve test setup selection
-
-Test setups are now identified (also) by the project they belong to
-and it is possible to select the used test setup from a specific
-project. E.g.  to use a test setup `some_setup` from project
-`some_project` for all executed tests one can use
-
-    meson test --setup some_project:some_setup
-
-Should one rather want test setups to be used from the same project as
-where the current test itself has been defined, one can use just
-
-    meson test --setup some_setup
-
-In the latter case every (sub)project must have a test setup `some_setup`
-defined in it.
-
-## Can use custom targets as Windows resource files
-
-The `compile_resources()` function of the `windows` module can now be used on custom targets as well as regular files.
-
-## Can promote dependencies with wrap command
-
-The `promote` command makes it easy to copy nested dependencies to the top level.
-
-    meson wrap promote scommon
-
-This will search the project tree for a subproject called `scommon`
-and copy it to the top level.
-
-If there are many embedded subprojects with the same name, you have to
-specify which one to promote manually like this:
-
-    meson wrap promote subprojects/s1/subprojects/scommon
-
-## Yielding subproject option to superproject
-
-Normally project options are specific to the current project. However
-sometimes you want to have an option whose value is the same over all
-projects. This can be achieved with the new `yield` keyword for
-options. When set to `true`, getting the value of this option in
-`meson.build` files gets the value from the option with the same name
-in the master project (if such an option exists).
diff --git a/meson/docs/markdown/Release-notes-for-0.46.0.md b/meson/docs/markdown/Release-notes-for-0.46.0.md
deleted file mode 100644 (file)
index e3b45e9..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
----
-title: Release 0.46
-short-description: Release notes for 0.46
-...
-
-# New features
-
-## Allow early return from a script
-
-Added the function `subdir_done()`. Its invocation exits the current script at
-the point of invocation. All previously invoked build targets and commands are
-build/executed. All following ones are ignored. If the current script was
-invoked via `subdir()` the parent script continues normally.
-
-## Log output slightly changed
-
-The format of some human-readable diagnostic messages has changed in
-minor ways. In case you are parsing these messages, you may need to
-adjust your code.
-
-## ARM compiler for C and CPP
-
-Cross-compilation is now supported for ARM targets using ARM compiler - ARMCC.
-The current implementation does not support shareable libraries.
-The default extension of the output is .axf.
-The environment path should be set properly for the ARM compiler executables.
-The '--cpu' option with the appropriate target type should be mentioned
-in the cross file as shown in the snippet below.
-
-```ini
-[properties]
-c_args      = ['--cpu=Cortex-M0plus']
-cpp_args    = ['--cpu=Cortex-M0plus']
-
-```
-
-## Building both shared and static libraries
-
-A new function `both_libraries()` has been added to build both shared and static
-libraries at the same time. Source files will be compiled only once and object
-files will be reused to build both shared and static libraries, unless
-`b_staticpic` user option or `pic:` keyword argument are set to false in which
-case sources will be compiled twice.
-
-The returned `buildtarget` object always represents the shared library.
-
-## Compiler object can now be passed to run_command()
-
-This can be used to run the current compiler with the specified arguments
-to obtain additional information from it.
-One of the use cases is to get the location of development files for the
-GCC plugins:
-
-```meson
-cc = meson.get_compiler('c')
-result = run_command(cc, '-print-file-name=plugin')
-plugin_dev_path = result.stdout().strip()
-```
-
-## declare_dependency() now supports `link_whole:`
-
-`declare_dependency()` now supports the `link_whole:` keyword argument which
-transparently works for build targets which use that dependency.
-
-## Old command names are now errors
-
-The old executable names `mesonintrospect`, `mesonconf`, `mesonrewriter`
-and `mesontest` have been deprecated for a long time. Starting from
-this version they no longer do anything but instead always error
-out. All functionality is available as subcommands in the main `meson`
-binary.
-
-## Meson and meson configure now accept the same arguments
-
-Previously meson required that builtin arguments (like prefix) be passed as
-`--prefix` to `meson` and `-Dprefix` to `meson configure`. `meson` now accepts -D
-form like `meson configure` has. `meson configure` also accepts the `--prefix`
-form, like `meson` has.
-
-## Recursively extract objects
-
-The `recursive:` keyword argument has been added to `extract_all_objects()`. When set
-to `true` it will also return objects passed to the `objects:` argument of this
-target. By default only objects built for this target are returned to maintain
-backward compatibility with previous versions. The default will eventually be
-changed to `true` in a future version.
-
-```meson
-lib1 = static_library('a', 'source.c', objects : 'prebuilt.o')
-lib2 = static_library('b', objects : lib1.extract_all_objects(recursive : true))
-```
-
-## Can override find_program()
-
-It is now possible to override the result of `find_program` to point
-to a custom program you want. The overriding is global and applies to
-every subproject from there on. Here is how you would use it.
-
-In master project
-
-```meson
-subproject('mydep')
-```
-
-In the called subproject:
-
-```meson
-prog = find_program('my_custom_script')
-meson.override_find_program('mycodegen', prog)
-```
-
-In master project (or, in fact, any subproject):
-
-```meson
-genprog = find_program('mycodegen')
-```
-
-Now `genprog` points to the custom script. If the dependency had come
-from the system, then it would point to the system version.
-
-You can also use the return value of `configure_file()` to override
-a program in the same way as above:
-
-```meson
-prog_script = configure_file(input : 'script.sh.in',
-                             output : 'script.sh',
-                             configuration : cdata)
-meson.override_find_program('mycodegen', prog_script)
-```
-
-## New functions: has_link_argument() and friends
-
-A new set of methods has been added to [compiler objects](Reference-manual.md#compiler-object)
-to test if the linker supports given arguments.
-
-- `has_link_argument()`
-- `has_multi_link_arguments()`
-- `get_supported_link_arguments()`
-- `first_supported_link_argument()`
-
-## "meson help" now shows command line help
-
-Command line parsing is now less surprising. "meson help" is now
-equivalent to "meson --help" and "meson help <subcommand>" is
-equivalent to "meson <subcommand> --help", instead of creating a build
-directory called "help" in these cases.
-
-## Autogeneration of simple meson.build files
-
-A feature to generate a meson.build file compiling given C/C++ source
-files into a single executable has been added to "meson init". By
-default, it will take all recognizable source files in the current
-directory.  You can also specify a list of dependencies with the -d
-flag and automatically invoke a build with the -b flag to check if the
-code builds with those dependencies. 
-
-For example,
-
-```meson
-meson init -fbd sdl2,gl
-```
-
-will look for C or C++ files in the current directory, generate a
-meson.build for them with the dependencies of sdl2 and gl and
-immediately try to build it, overwriting any previous meson.build and
-build directory.
-
-## install_data() supports `rename:`
-
-The `rename:` keyword argument is used to change names of the installed
-files. Here's how you install and rename the following files:
-
-- `file1.txt` into `share/myapp/dir1/data.txt`
-- `file2.txt` into `share/myapp/dir2/data.txt`
-
-```meson
-install_data(['file1.txt', 'file2.txt'],
-             rename : ['dir1/data.txt', 'dir2/data.txt'],
-             install_dir : 'share/myapp')
-```
-
-## Support for lcc compiler for e2k (Elbrus) architecture
-
-In this version, a support for lcc compiler for Elbrus processors
-based on [e2k microarchitecture](https://en.wikipedia.org/wiki/Elbrus_2000)
-has been added.
-
-Examples of such CPUs:
-* [Elbrus-8S](https://en.wikipedia.org/wiki/Elbrus-8S);
-* Elbrus-4S;
-* [Elbrus-2S+](https://en.wikipedia.org/wiki/Elbrus-2S%2B).
-
-Such compiler have a similar behavior as gcc (basic option compatibility),
-but, in is not strictly compatible with gcc as of current version.
-
-Major differences as of version 1.21.22:
-* it does not support LTO and PCH;
-* it suffers from the same dependency file creation error as icc;
-* it has minor differences in output, especially version output;
-* it differently reacts to lchmod() detection;
-* some backend messages are produced in ru_RU.KOI8-R even if LANG=C;
-* its preprocessor treats some characters differently.
-
-So every noted difference is properly handled now in meson.
-
-## String escape character sequence update
-
-Single-quoted strings in meson have been taught the same set of escape
-sequences as in Python. It is therefore now possible to use arbitrary bytes in
-strings, like for example `NUL` (`\0`) and other ASCII control characters. See
-the chapter about [*Strings* in *Syntax*](Syntax.md#strings) for more
-details.
-
-Potential backwards compatibility issue: Any valid escape sequence according to
-the new rules will be interpreted as an escape sequence instead of the literal
-characters. Previously only the following escape sequences were supported in
-single-quote strings: `\'`, `\\` and `\n`.
-
-Note that the behaviour of triple-quoted (multiline) strings has not changed.
-They behave like raw strings and do not support any escape sequences.
-
-## New `forcefallback` wrap mode
-
-A new wrap mode was added, `--wrap-mode=forcefallback`. When this is set,
-dependencies for which a fallback was provided will always use it, even
-if an external dependency exists and satisfies the version requirements.
-
-## Relaxing of target name requirements
-
-In earlier versions of Meson you could only have one target of a given name for each type.
-For example you could not have two executables named `foo`. This requirement is now
-relaxed so that you can have multiple targets with the same name, as long as they are in
-different subdirectories.
-
-Note that projects that have multiple targets with the same name can not be built with
-the `flat` layout or any backend that writes outputs in the same directory.
-
-## Addition of OpenMP dependency
-
-An OpenMP dependency (`openmp`) has been added that encapsulates the various
-flags used by compilers to enable OpenMP and checks for the existence of the
-`omp.h` header. The `language` keyword may be passed to force the use of a
-specific compiler for the checks.
-
-## Added new partial_dependency method to dependencies and libraries
-
-It is now possible to use only part of a dependency in a target. This allows,
-for example, to only use headers with convenience libraries to avoid linking
-to the same library multiple times.
-
-```meson
-dep = dependency('xcb')
-
-helper = static_library(
-  'helper',
-  ['helper1.c', 'helper2.c'],
-  dependencies : dep.partial_dependency(includes : true),
-]
-
-final = shared_library(
-  'final',
-  ['final.c'],
-  dependencyes : dep,
-)
-```
-
-A partial dependency will have the same name version as the full dependency it
-is derived from, as well as any values requested.
-
-## Improved generation of pkg-config files for static only libraries.
-
-Previously pkg-config files generated by the pkgconfig modules for static libraries
-with dependencies could only be used in a dependencies with `static: true`.
-
-Now the generated file contains the needed dependencies libraries directly within
-`Requires` and `Libs` for build static libraries passed via the `libraries` keyword
-argument.
-
-Projects that install both a static and a shared version of a library should use
-the result of [`both_libraries()`](Reference-manual.md#both_libraries) to the
-pkg-config file generator or use [`configure_file()`](Reference-manual.md#configure_file)
-for more complicated setups.
-
-## Improvements to pkgconfig module
-
-A `StaticLibrary` or `SharedLibrary` object can optionally be passed
-as first positional argument of the `generate()` method. If one is provided a
-default value will be provided for all required fields of the pc file:
-- `install_dir` is set to `pkgconfig` folder in the same location than the provided library.
-- `description` is set to the project's name followed by the library's name.
-- `name` is set to the library's name.
-
-Generating a .pc file is now as simple as:
-
-```meson
-pkgconfig.generate(mylib)
-```
-
-## pkgconfig.generate() requires parameters non-string arguments
-
-`pkgconfig.generate()` `requires:` and `requires_private:` keyword arguments
-now accept pkgconfig-dependencies and libraries that pkgconfig-files were
-generated for.
-
-## Generic python module
-
-Meson now has is a revamped and generic (python 2 and 3) version of the python3
-module. With [this new interface](Python-module.md), projects can now fully
-specify the version of python they want to build against / install sources to,
-and can do so against multiple major or minor versions in parallel.
-
-## test() now supports the `depends:` keyword argument
-
-Build targets and custom targets can be listed in the `depends:` keyword argument
-of test function. These targets will be built before test is run even if they have
-`build_by_default : false`.
diff --git a/meson/docs/markdown/Release-notes-for-0.47.0.md b/meson/docs/markdown/Release-notes-for-0.47.0.md
deleted file mode 100644 (file)
index 675942b..0000000
+++ /dev/null
@@ -1,301 +0,0 @@
----
-title: Release 0.47
-short-description: Release notes for 0.47
-...
-
-# New features
-
-## Allow early return from a script
-
-Added the function `subdir_done()`. Its invocation exits the current script at
-the point of invocation. All previously invoked build targets and commands are
-build/executed. All following ones are ignored. If the current script was
-invoked via `subdir()` the parent script continues normally.
-
-## Concatenate string literals returned from `get_define()`
-
-After obtaining the value of a preprocessor symbol consecutive string literals
-are merged into a single string literal.
-For example a preprocessor symbol's value `"ab" "cd"` is returned as `"abcd"`.
-
-## ARM compiler(version 6) for C and CPP
-
-Cross-compilation is now supported for ARM targets using ARM compiler
-version 6 - ARMCLANG.  The required ARMCLANG compiler options for
-building a shareable library are not included in the current Meson
-implementation for ARMCLANG support, so it can not build shareable
-libraries.  This current Meson implementation for ARMCLANG support can
-not build assembly files with arm syntax (we need to use armasm instead
-of ARMCLANG for the `.s` files with this syntax) and only supports GNU
-syntax.
-
-The default extension of the executable output is `.axf`.
-The environment path should be set properly for the ARM compiler executables.
-The `--target`, `-mcpu` options with the appropriate values should be mentioned
-in the cross file as shown in the snippet below.
-
-```ini
-[properties]
-c_args      = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
-cpp_args    = ['--target=arm-arm-none-eabi', '-mcpu=cortex-m0plus']
-```
-
-Note:
-- The current changes are tested on Windows only.
-- PIC support is not enabled by default for ARM,
-  if users want to use it, they need to add the required arguments
-  explicitly from cross-file(`c_args`/`cpp_args`) or some other way.
-
-## New base build option for LLVM (Apple) bitcode support
-
-When building with clang on macOS, you can now build your static and shared
-binaries with embedded bitcode by enabling the `b_bitcode` [base
-option](Builtin-options.md#base-options) by passing `-Db_bitcode=true` to
-Meson.
-
-This is better than passing the options manually in the environment since Meson
-will automatically disable conflicting options such as `b_asneeded`, and will
-disable bitcode support on targets that don't support it such as
-`shared_module()`.
-
-Since this requires support in the linker, it is currently only enabled when
-using Apple ld. In the future it can be extended to clang on other platforms
-too.
-
-## New compiler check: `check_header()`
-
-The existing compiler check `has_header()` only checks if the header exists,
-either with the `__has_include` C++11 builtin, or by running the pre-processor.
-
-However, sometimes the header you are looking for is unusable on some platforms
-or with some compilers in a way that is only detectable at compile-time. For
-such cases, you should use `check_header()` which will include the header and
-run a full compile.
-
-Note that `has_header()` is much faster than `check_header()`, so it should be
-used whenever possible.
-
-## New action `copy:` for `configure_file()`
-
-In addition to the existing actions `configuration:` and `command:`,
-[`configure_file()`](Reference-manual.md#configure_file) now accepts a keyword
-argument `copy:` which specifies a new action to copy the file specified with
-the `input:` keyword argument to a file in the build directory with the name
-specified with the `output:` keyword argument.
-
-These three keyword arguments are, as before, mutually exclusive. You can only
-do one action at a time.
-
-## New keyword argument `encoding:` for `configure_file()`
-
-Add a new keyword to [`configure_file()`](Reference-manual.md#configure_file)
-that allows the developer to specify the input and output file encoding. The
-default value is the same as before: UTF-8.
-
-In the past, Meson would not handle non-UTF-8/ASCII files correctly, and in the
-worst case would try to coerce it to UTF-8 and mangle the data. UTF-8 is the
-standard encoding now, but sometimes it is necessary to process files that use
-a different encoding.
-
-For additional details see [#3135](https://github.com/mesonbuild/meson/pull/3135).
-
-## New keyword argument `output_format:` for `configure_file()`
-
-When called without an input file, `configure_file` generates a
-C header file by default. A keyword argument was added to allow
-specifying the output format, for example for use with nasm or yasm:
-
-```meson
-conf = configuration_data()
-conf.set('FOO', 1)
-
-configure_file('config.asm',
-  configuration: conf,
-  output_format: 'nasm')
-```
-
-## Substitutions in `custom_target(depfile:)`
-
-The `depfile` keyword argument to `custom_target` now accepts the `@BASENAME@`
-and `@PLAINNAME@` substitutions.
-
-## Deprecated `build_always:` for custom targets
-
-Setting `build_always` to `true` for a custom target not only marks the target
-to be always considered out of date, but also adds it to the set of default
-targets. This option is therefore deprecated and the new option
-`build_always_stale` is introduced.
-
-`build_always_stale` *only* marks the target to be always considered out of
-date, but does not add it to the set of default targets. The old behaviour can
-be achieved by combining `build_always_stale` with `build_by_default`.
-
-The documentation has been updated accordingly.
-
-## New built-in object type: dictionary
-
-Meson dictionaries use a syntax similar to python's dictionaries,
-but have a narrower scope: they are immutable, keys can only
-be string literals, and initializing a dictionary with duplicate
-keys causes a fatal error.
-
-Example usage:
-
-```meson
-d = {'foo': 42, 'bar': 'baz'}
-
-foo = d.get('foo')
-foobar = d.get('foobar', 'fallback-value')
-
-foreach key, value : d
-  Do something with key and value
-endforeach
-```
-
-## Array options treat `-Dopt=` and `-Dopt=[]` as equivalent
-
-Prior to this change passing -Dopt= to an array opt would be interpreted as
-`['']` (an array with an empty string), now `-Dopt=` is the same as `-Dopt=[]`, an
-empty list.
-
-## Feature detection based on `meson_version:` in `project()`
-
-Meson will now print a `WARNING:` message during configuration if you use
-a function or a keyword argument that was added in a meson version that's newer
-than the version specified inside `project()`. For example:
-
-```meson
-project('featurenew', meson_version: '>=0.43')
-
-cdata = configuration_data()
-cdata.set('FOO', 'bar')
-message(cdata.get_unquoted('FOO'))
-```
-
-This will output:
-
-```
-The Meson build system
-Version: 0.47.0.dev1
-Source dir: C:\path\to\srctree
-Build dir: C:\path\to\buildtree
-Build type: native build
-Project name: featurenew
-Project version: undefined
-Build machine cpu family: x86_64
-Build machine cpu: x86_64
-WARNING: Project targetting '>=0.43' but tried to use feature introduced in '0.44.0': configuration_data.get_unquoted()
-Message: bar
-Build targets in project: 0
-WARNING: Project specifies a minimum meson_version '>=0.43' which conflicts with:
- * 0.44.0: {'configuration_data.get_unquoted()'}
-```
-
-## New type of build option for features
-
-A new type of [option called `feature`](Build-options.md#features) can be
-defined in `meson_options.txt` for the traditional `enabled / disabled / auto`
-tristate. The value of this option can be passed to the `required` keyword
-argument of functions `dependency()`, `find_library()`, `find_program()` and
-`add_languages()`.
-
-A new global option `auto_features` has been added to override the value of all
-`auto` features. It is intended to be used by packagers to have full control on
-which feature must be enabled or disabled.
-
-## New options to `gnome.gdbus_codegen()`
-
-You can now pass additional arguments to gdbus-codegen using the `extra_args`
-keyword. This is the same for the other gnome function calls.
-
-Meson now automatically adds autocleanup support to the generated code. This
-can be modified by setting the autocleanup keyword.
-
-For example:
-
-```meson
-sources += gnome.gdbus_codegen('com.mesonbuild.Test',
-  'com.mesonbuild.Test.xml',
-  autocleanup : 'none',
-  extra_args : ['--pragma-once'])
-```
-
-## Made 'install' a top level Meson command
-
-You can now run `meson install` in your build directory and it will do
-the install. It has several command line options you can toggle the
-behaviour that is not in the default `ninja install` invocation. This
-is similar to how `meson test` already works.
-
-For example, to install only the files that have changed, you can do:
-
-```console
-$ meson install --only-changed
-```
-
-## `install_mode:` keyword argument extended to all installable targets
-
-It is now possible to pass an `install_mode` argument to all installable targets,
-such as `executable()`, libraries, headers, man pages and custom/generated
-targets.
-
-The `install_mode` argument can be used to specify the file mode in symbolic
-format and optionally the owner/uid and group/gid for the installed files.
-
-## New built-in option `install_umask` with a default value 022
-
-This umask is used to define the default permissions of files and directories
-created in the install tree. Files will preserve their executable mode, but the
-exact permissions will obey the `install_umask`.
-
-The `install_umask` can be overridden in the meson command-line:
-
-```console
-$ meson --install-umask=027 builddir/
-```
-
-A project can also override the default in the `project()` call:
-
-```meson
-project('myproject', 'c',
-  default_options : ['install_umask=027'])
-```
-
-To disable the `install_umask`, set it to `preserve`, in which case permissions
-are copied from the files in their origin.
-
-## Octal and binary string literals
-
-Octal and binary integer literals can now be used in build and option files.
-
-```meson
-int_493 = 0o755
-int_1365 = 0b10101010101
-```
-
-## New keyword arguments: 'check' and 'capture' for `run_command()`
-
-If `check:` is `true`, then the configuration will fail if the command returns a
-non-zero exit status. The default value is `false` for compatibility reasons.
-
-`run_command()` used to always capture the output and stored it for use in
-build files. However, sometimes the stdout is in a binary format which is meant
-to be discarded. For that case, you can now set the `capture:` keyword argument
-to `false`.
-
-## Windows resource files dependencies
-
-The `compile_resources()` function of the `windows` module now takes
-the `depend_files:` and `depends:` keywords.
-
-When using binutils's `windres`, dependencies on files `#include`'d by the
-preprocessor are now automatically tracked.
-
-## Polkit support for privileged installation
-
-When running `install`, if installation fails with a permission error and
-`pkexec` is available, Meson will attempt to use it to spawn a permission
-dialog for privileged installation and retry the installation.
-
-If `pkexec` is not available, the old behaviour is retained and you will need
-to explicitly run the install step with `sudo`.
diff --git a/meson/docs/markdown/Release-notes-for-0.48.0.md b/meson/docs/markdown/Release-notes-for-0.48.0.md
deleted file mode 100644 (file)
index 2cb0268..0000000
+++ /dev/null
@@ -1,334 +0,0 @@
----
-title: Release 0.48
-short-description: Release notes for 0.48
-...
-
-# New features
-
-## Toggles for build type, optimization and vcrt type
-
-Since the very beginning Meson has provided different project types to
-use, such as *debug* and *minsize*. There is also a *plain* type that
-adds nothing by default but instead makes it the user's responsibility
-to add everything by hand. This works but is a bit tedious.
-
-In this release we have added new new options to manually toggle
-e.g. optimization levels and debug info so those can be changed
-independently of other options. For example by default the debug
-buildtype has no optmization enabled at all. If you wish to use GCC's
-`-Og` instead, you could set it with the following command:
-
-```
-meson configure -Doptimization=g
-```
-
-Similarly we have added a toggle option to select the version of
-Visual Studio C runtime to use. By default it uses the debug runtime
-DLL debug builds and release DLL for release builds but this can be
-manually changed with the new base option `b_vscrt`.
-
-## Meson warns if two calls to `configure_file()` write to the same file
-
-If two calls to [`configure_file()`](Reference-manual.md#configure_file)
-write to the same file Meson will print a `WARNING:` message during
-configuration. For example:
-```meson
-project('configure_file', 'cpp')
-
-configure_file(
-  input: 'a.in',
-  output: 'out',
-  command: ['./foo.sh']
-)
-configure_file(
-  input: 'a.in',
-  output: 'out',
-  command: ['./foo.sh']
-)
-```
-
-This will output:
-
-```
-The Meson build system
-Version: 0.47.0.dev1
-Source dir: /path/to/srctree
-Build dir: /path/to/buildtree
-Build type: native build
-Project name: configure_file
-Project version: undefined
-Build machine cpu family: x86_64
-Build machine cpu: x86_64
-Configuring out with command
-WARNING: Output file out for configure_file overwritten. First time written in line 3 now in line 8
-Configuring out with command
-Build targets in project: 0
-Found ninja-1.8.2 at /usr/bin/ninja
-```
-
-## New kwarg `console` for `custom_target()`
-
-This keyword argument conflicts with `capture`, and is meant for
-commands that are resource-intensive and take a long time to
-finish. With the Ninja backend, setting this will add this target to
-[Ninja's `console`
-pool](https://ninja-build.org/manual.html#_the_literal_console_literal_pool),
-which has special properties such as not buffering stdout and
-serializing all targets in this pool.
-
-The primary use-case for this is to be able to run external commands
-that take a long time to exeute. Without setting this, the user does
-not receive any feedback about what the program is doing.
-
-## `dependency(version:)` now applies to all dependency types
-
-Previously, version constraints were only enforced for dependencies found using
-the pkg-config dependency provider.  These constraints now apply to dependencies
-found using any dependency provider.
-
-Some combinations of dependency, host and method do not currently support
-discovery of the version.  In these cases, the dependency will not be found if a
-version constraint is applied, otherwise the `version()` method for the
-dependency object will return `'unknown'`.
-
-(If discovering the version in one of these combinations is important to you,
-and a method exists to determine the version in that case, please file an issue
-with as much information as possible.)
-
-## python3 module is deprecated
-
-A generic module `python` has been added in Meson `0.46.0` and has a superset of
-the features implemented by the previous `python3` module.
-
-In most cases, it is a simple matter of renaming:
-```meson
-py3mod = import('python3')
-python = py3mod.find_python()
-```
-
-becomes
-
-```meson
-pymod = import('python')
-python = pymod.find_installation()
-```
-
-## Dictionary addition
-
-Dictionaries can now be added, values from the second dictionary overrides values
-from the first
-
-```meson
-d1 = {'a' : 'b'}
-d3 = d1 + {'a' : 'c'}
-d3 += {'d' : 'e'}
-```
-
-## Dist scripts
-
-You can now specify scripts that are run as part of the `dist`
-target. An example usage would go like this:
-
-```meson
-project('foo', 'c')
-
-# other stuff here
-
-meson.add_dist_script('dist_cleanup.py')
-```
-
-## Fatal warnings
-
-A new command line option has been added: `--fatal-meson-warnings`. When enabled, any
-warning message printed by Meson will be fatal and raise an exception. It is
-intended to be used by developers and CIs to easily catch deprecation warnings,
-or any other potential issues.
-
-## Helper methods added for checking GNU style attributes: `__attribute__(...)`
-
-A set of new helpers have been added to the C and C++ compiler objects for
-checking GNU style function attributes. These are not just simpler to use, they
-may be optimized to return fast on compilers that don't support these
-attributes. Currently this is true for MSVC.
-
-```meson
-cc = meson.get_compiler('c')
-if cc.has_function_attribute('aligned')
-   add_project_arguments('-DHAVE_ALIGNED', language : 'c')
-endif
-```
-
-Would replace code like:
-
-```meson
-if cc.compiles('''into foo(void) __attribute__((aligned(32)))''')
-   add_project_arguments('-DHAVE_ALIGNED', language : 'c')
-endif
-```
-
-Additionally, a multi argument version has been added:
-
-```meson
-foreach s : cc.get_supported_function_attributes(['hidden', 'alias'])
-   add_project_arguments('-DHAVE_@0@'.format(s.to_upper()), language : 'c')
-endforeach
-```
-
-## `gnome.generate_gir()` now optionally accepts multiple libraries
-
-The GNOME module can now generate a single gir for multiple libraries, which
-is something `g-ir-scanner` supported, but had not been exposed yet.
-
-gnome.generate_gir() will now accept multiple positional arguments, if none
-of these arguments are an `Executable` instance.
-
-## Hotdoc module
-
-A new module has been written to ease generation of
-[hotdoc](https://hotdoc.github.io/) based documentation. It supports
-complex use cases such as hotdoc subprojects (to create documentation
-portals) and makes it straight forward to leverage full capabilities
-of hotdoc.
-
-Simple usage:
-
-``` meson
-hotdoc = import('hotdoc')
-
-hotdoc.generate_doc(
-  'foobar',
-  c_smart_index: true,
-  project_version: '0.1',
-  sitemap: 'sitemap.txt',
-  index: 'index.md',
-  c_sources: ['path/to/file.c'],
-  languages: ['c'],
-  install: true,
-)
-```
-
-## `i18n.merge_file()` now fully supports variable substitutions defined in `custom_target()`
-
-Filename substitutions like @BASENAME@ and @PLAINNAME@ were previously
-accepted but the name of the build target wasn't altered leading to
-colliding target names when using the substitution twice.
-i18n.merge_file() now behaves as custom_target() in this regard.
-
-## Projects args can be set separately for cross and native builds (potentially breaking change)
-
-It has been a longstanding bug (or let's call it a "delayed bug fix")
-that if you do this:
-
-```meson
-add_project_arguments('-DFOO', language : 'c')
-```
-
-Then the flag is used both in native and cross compilations. This is
-very confusing and almost never what you want. To fix this a new
-keyword `native` has been added to all functions that add arguments,
-namely `add_global_arguments`, `add_global_link_arguments`,
-`add_project_arguments` and `add_project_link_arguments` that behaves
-like the following:
-
-```meson
-# Added to native builds when compiling natively and to cross
-# compilations when doing cross compiles.
-add_project_arguments(...)
-
-# Added only to native compilations, not used in cross compilations.
-add_project_arguments(..., native : true)
-
-# Added only to cross compilations, not used in native compilations.
-add_project_arguments(..., native : false)
-```
-
-Also remember that cross compilation is a property of each
-target. There can be target that are compiled with the native compiler
-and some which are compiled with the cross compiler.
-
-Unfortunately this change is backwards incompatible and may cause some
-projects to fail building. However this should be very rare in practice.
-
-## More flexible `override_find_program()`.
-
-It is now possible to pass an `executable` to
-`override_find_program()` if the overridden program is not used during
-configure.
-
-This is particularly useful for fallback dependencies like Protobuf
-that also provide a tool like protoc.
-
-## `shared_library()` now supports setting dylib compatibility and current version
-
-Now, by default `shared_library()` sets `-compatibility_version` and
-`-current_version` of a macOS dylib using the `soversion`.
-
-This can be overriden by using the `darwin_versions:` kwarg to
-[`shared_library()`](Reference-manual.md#shared_library). As usual, you can
-also pass this kwarg to `library()` or `build_target()` and it will be used in
-the appropriate circumstances.
-
-## Version comparison
-
-`dependency(version:)` and other version constraints now handle versions
-containing non-numeric characters better, comparing versions using the rpmvercmp
-algorithm (as using the `pkg-config` autoconf macro `PKG_CHECK_MODULES` does).
-
-This is a breaking change for exact comparison constraints which rely on the
-previous comparison behaviour of extending the compared versions with `'0'`
-elements, up to the same length of `'.'`-separated elements.
-
-For example, a version of `'0.11.0'` would previously match a version constraint
-of `'==0.11'`, but no longer does, being instead considered strictly greater.
-
-Instead, use a version constraint which exactly compares with the precise
-version required, e.g. `'==0.11.0'`.
-
-## Keyword argument for GNU symbol visibility
-
-Build targets got a new keyword, `gnu_symbol_visibility` that controls
-how symbols are exported from shared libraries. This is most commonly
-used to hide implementation symbols like this:
-
-```meson
-shared_library('mylib', ...
-  gnu_symbol_visibility: 'hidden')
-```
-
-In this case only symbols explicitly marked as visible in the source
-files get exported.
-
-## Git wraps can now clone submodules automatically
-
-To enable this, the following needs to be added to the `.wrap` file:
-
-```ini
-clone-recursive=true
-```
-
-## `subproject()` function now supports the `required:` kwarg
-
-This allows you to declare an optional subproject. You can now call `found()`
-on the return value of the `subproject()` call to see if the subproject is
-available before calling `get_variable()` to fetch information from it.
-
-## `dependency()` objects now support the `.name()` method
-
-You can now fetch the name of the dependency that was searched like so:
-
-```meson
-glib_dep = dependency('glib-2.0')
-...
-message("dependency name is " + glib_dep.name())
-# This outputs `dependency name is glib-2.0`
-
-qt_dep = dependency('qt5')
-...
-message("dependency name is " + qt_dep.name())
-# This outputs `dependency name is qt5`
-
-decl_dep = declare_dependency()
-...
-message("dependency name is " + decl_dep.name())
-# This outputs `dependency name is internal`
-```
diff --git a/meson/docs/markdown/Release-notes-for-0.49.0.md b/meson/docs/markdown/Release-notes-for-0.49.0.md
deleted file mode 100644 (file)
index 9a5e5f5..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
----
-title: Release 0.49
-short-description: Release notes for 0.49
-...
-
-# New features
-
-## Libgcrypt dependency now supports libgcrypt-config
-
-Earlier, `dependency('libgcrypt')` could only detect the library with pkg-config
-files. Now, if pkg-config files are not found, Meson will look for
-`libgcrypt-config` and if it's found, will use that to find the library.
-
-## New `section` key for the buildoptions introspection
-
-Meson now has a new `section` key in each build option. This allows
-IDEs to group these options similar to `meson configure`.
-
-The possible values for `section` are:
-
- - core
- - backend
- - base
- - compiler
- - directory
- - user
- - test
-
-## CC-RX compiler for C and CPP
-
-Cross-compilation is now supported for Renesas RX targets with the
-CC-RX compiler.
-
-The environment path should be set properly for the CC-RX compiler
-executables.  The `-cpu` option with the appropriate value should be
-mentioned in the cross-file as shown in the snippet below.
-
-```ini
-[properties]
-c_args      = ['-cpu=rx600']
-cpp_args    = ['-cpu=rx600']
-```
-
-The default extension of the executable output is `.abs`.  Other
-target specific arguments to the compiler and linker will need to be
-added explicitly from the
-cross-file(`c_args`/`c_link_args`/`cpp_args`/`cpp_link_args`) or some
-other way.  Refer to the CC-RX User's manual for additional compiler
-and linker options.
-
-## CMake `find_package` dependency backend
-
-Meson can now use the CMake `find_package` ecosystem to
-detect dependencies. Both the old-style `<NAME>_LIBRARIES`
-variables as well as imported targets are supported. Meson
-can automatically guess the correct CMake target in most
-cases but it is also possible to manually specify a target
-with the `modules` property.
-
-```meson
-# Implicitly uses CMake as a fallback and guesses a target
-dep1 = dependency('KF5TextEditor')
-
-# Manually specify one or more CMake targets to use
-dep2 = dependency('ZLIB', method : 'cmake', modules : ['ZLIB::ZLIB'])
-```
-
-CMake is automatically used after `pkg-config` fails when
-no `method` (or `auto`) was provided in the dependency options.
-
-## New compiler method `get_argument_syntax`
-
-The compiler object now has `get_argument_syntax` method, which returns a
-string value of `gcc`, `msvc`, or an undefined value string value. This can be
-used to determine if a compiler uses gcc syntax (`-Wfoo`), msvc syntax
-(`/w1234`), or some other kind of arguments.
-
-```meson
-cc = meson.get_compiler('c')
-
-if cc.get_argument_syntax() == 'msvc'
-  if cc.has_argument('/w1235')
-    add_project_arguments('/w1235', language : ['c'])
-  endif
-elif cc.get_argument_syntax() == 'gcc'
-  if cc.has_argument('-Wfoo')
-    add_project_arguments('-Wfoo', language : ['c'])
-  endif
-elif cc.get_id() == 'some other compiler'
-  add_project_arguments('--error-on-foo', language : ['c'])
-endif
-```
-
-## Return `Disabler()` instead of not-found object
-
-Functions such as `dependency()`, `find_library()`, `find_program()`, and
-`python.find_installation()` have a new keyword argument: `disabler`. When set
-to `true` those functions return `Disabler()` objects instead of not-found
-objects.
-
-## `introspect --projectinfo` can now be used without configured build directory
-
-This allows IDE integration to get information about the project before the user has configured a build directory.
-
-Before you could use `meson.py introspect --projectinfo build-directory`.
-Now you also can use `meson.py introspect --projectinfo project-dir/meson.build`.
-
-The output is similiar to the output with a build directory but additionally also includes information from `introspect --buildsystem-files`.
-
-For example `meson.py introspect --projectinfo test\ cases/common/47\ subproject\ options/meson.build`
-This outputs (pretty printed for readability):
-```
-{
-    "buildsystem_files": [
-        "meson_options.txt",
-        "meson.build"
-    ],
-    "name": "suboptions",
-    "version": null,
-    "descriptive_name": "suboptions",
-    "subprojects": [
-        {
-            "buildsystem_files": [
-                "subprojects/subproject/meson_options.txt",
-                "subprojects/subproject/meson.build"
-            ],
-            "name": "subproject",
-            "version": "undefined",
-            "descriptive_name": "subproject"
-        }
-    ]
-}
-```
-
-Both usages now include a new `descriptive_name` property which always
-shows the name set in the project.
-
-## Can specify keyword arguments with a dictionary
-
-You can now specify keyword arguments for any function and method call
-with the `kwargs` keyword argument. This is perhaps best described
-with an example:
-
-```meson
-options = {'include_directories': include_directories('inc')}
-
-...
-
-executable(...
-  kwargs: options)
-```
-
-The above code is identical to this:
-
-```meson
-executable(...
-  include_directories: include_directories('inc'))
-```
-
-That is, Meson will expand the dictionary given to `kwargs` as if the
-entries in it had been given as keyword arguments directly.
-
-Note that any individual argument can be specified either directly or
-with the `kwarg` dict but not both. If a key is specified twice, it
-is a hard error.
-
-## Manpages are no longer compressed implicitly
-
-Earlier, the `install_man` command has automatically compressed installed
-manpages into `.gz` format. This collided with manpage compression hooks
-already used by various distributions. Now, manpages are installed uncompressed
-and distributors are expected to handle compressing them according to their own
-compression preferences.
-
-## Native config files
-
-Native files (`--native-file`) are the counterpart to cross files (`--cross-file`),
-and allow specifying information about the build machine, both when cross compiling
-and when not.
-
-Currently the native files only allow specifying the names of binaries, similar
-to the cross file, for example:
-
-```ini
-[binaries]
-llvm-config = "/opt/llvm-custom/bin/llvm-config"
-```
-
-Will override the llvm-config used for *native* binaries. Targets for the host
-machine will continue to use the cross file.
-
-## Foreach `break` and `continue`
-
-`break` and `continue` keywords can be used inside foreach loops.
-
-```meson
-items = ['a', 'continue', 'b', 'break', 'c']
-result = []
-foreach i : items
-  if i == 'continue'
-    continue
-  elif i == 'break'
-    break
-  endif
-  result += i
-endforeach
-# result is ['a', 'b']
-```
-
-You can check if an array contains an element like this:
-```meson
-my_array = [1, 2]
-if 1 in my_array
-# This condition is true
-endif
-if 1 not in my_array
-# This condition is false
-endif
-```
-
-You can check if a dictionary contains a key like this:
-```meson
-my_dict = {'foo': 42, 'foo': 43}
-if 'foo' in my_dict
-# This condition is true
-endif
-if 42 in my_dict
-# This condition is false
-endif
-if 'foo' not in my_dict
-# This condition is false
-endif
-```
-
-## Joining paths with /
-
-For clarity and conciseness, we recommend using the `/` operator to separate
-path elements:
-
-```meson
-joined = 'foo' / 'bar'
-```
-
-Before Meson 0.49, joining path elements was done with the legacy `join_paths`
-function, but the `/` syntax above is now recommended.
-
-```meson
-joined = join_paths('foo', 'bar')
-```
-
-This only works for strings.
-
-## Position-independent executables
-
-When `b_pie` option, or `executable()`'s `pie` keyword argument is set to
-`true`, position-independent executables are built. All their objects are built
-with `-fPIE` and the executable is linked with `-pie`. Any static library they
-link must be built with `pic` set to `true` (see `b_staticpic` option).
-
-## Deprecation warning in pkg-config generator
-
-All libraries passed to the `libraries` keyword argument of the `generate()`
-method used to be associated with that generated pkg-config file. That means
-that any subsequent call to `generate()` where those libraries appear would add
-the filebase of the `generate()` that first contained them into `Requires:` or
-`Requires.private:` field instead of adding an `-l` to `Libs:` or `Libs.private:`.
-
-This behaviour is now deprecated. The library that should be associated with
-the generated pkg-config file should be passed as first positional argument
-instead of in the `libraries` keyword argument. The previous behaviour is
-maintained but prints a deprecation warning and support for this will be removed
-in a future Meson release. If you can not create the needed pkg-config file
-without this warning, please file an issue with as much details as possible
-about the situation.
-
-For example this sample will write `Requires: liba` into `libb.pc` but print a
-deprecation warning:
-```meson
-liba = library(...)
-pkg.generate(libraries : liba)
-
-libb = library(...)
-pkg.generate(libraries : [liba, libb])
-```
-
-It can be fixed by passing `liba` as first positional argument::
-```meson
-liba = library(...)
-pkg.generate(liba)
-
-libb = library(...)
-pkg.generate(libb, libraries : [liba])
-```
-
-## Subprojects download, checkout, update command-line
-
-New command-line tool has been added to manage subprojects:
-
-- `meson subprojects download` to download all subprojects that have a wrap file.
-- `meson subprojects update` to update all subprojects to latest version.
-- `meson subprojects checkout` to checkout or create a branch in all git subprojects.
-
-## New keyword argument `is_default` to `add_test_setup()`
-
-The keyword argument `is_default` may be used to set whether the test
-setup should be used by default whenever `meson test` is run without
-the `--setup` option.
-
-```meson
-add_test_setup('default', is_default: true, env: 'G_SLICE=debug-blocks')
-add_test_setup('valgrind', env: 'G_SLICE=always-malloc', ...)
-test('mytest', exe)
-```
-
-For the example above, running `meson test` and `meson test
---setup=default` is now equivalent.
diff --git a/meson/docs/markdown/Release-notes-for-0.50.0.md b/meson/docs/markdown/Release-notes-for-0.50.0.md
deleted file mode 100644 (file)
index a9363d8..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
----
-title: Release 0.50.0
-short-description: Release notes for 0.50.0
-...
-
-# New features
-
-## Added `cmake_module_path` and `cmake_args` to dependency
-
-The CMake dependency backend can now make use of existing `Find<name>.cmake`
-files by setting the `CMAKE_MODULE_PATH` with the new `dependency()` property
-`cmake_module_path`. The paths given to `cmake_module_path` should be relative
-to the project source directory.
-
-Furthermore the property `cmake_args` was added to give CMake additional
-parameters.
-
-## Added PGI compiler support
-
-Nvidia / PGI C, C++ and Fortran
-[no-cost](https://www.pgroup.com/products/community.htm) compilers are
-now supported.  They have been tested on Linux so far.
-
-
-
-## Fortran Coarray
-
-Fortran 2008 / 2018 coarray support was added via `dependency('coarray')`
-
-## Libdir defaults to `lib` when cross compiling
-
-Previously `libdir` defaulted to the value of the build machine such
-as `lib/x86_64-linux-gnu`, which is almost always incorrect when cross
-compiling. It now defaults to plain `lib` when cross compiling. Native
-builds remain unchanged and will point to the current system's library
-dir.
-
-## Native and Cross File Paths and Directories
-
-A new `[paths]` section has been added to native and cross files. This
-can be used to set paths such a prefix and libdir in a persistent way.
-
-## Add warning_level 0 option
-
-Adds support for a warning level 0 which does not enable any static
-analysis checks from the compiler
-
-## A builtin target to run clang-format
-
-If you have `clang-format` installed and there is a `.clang-format`
-file in the root of your master project, Meson will generate a run
-target called `clang-format` so you can reformat all files with one
-command:
-
-```meson
-ninja clang-format
-```
-
-
-## Added `.path()` method to object returned by `python.find_installation()`
-
-`ExternalProgram` objects as well as the object returned by the
-`python3` module provide this method, but the new `python` module did
-not.
-
-## Fix ninja console log from generators with multiple output nodes
-
-This resolves [issue #4760](https://github.com/mesonbuild/meson/issues/4760)
-where a generator with multiple output nodes printed an empty string to the console
-
-## `introspect --buildoptions` can now be used without configured build directory
-
-It is now possible to run `meson introspect --buildoptions /path/to/meson.build`
-without a configured build directory.
-
-Running `--buildoptions` without a build directory produces the same
-output as running it with a freshly configured build directory.
-
-However, this behavior is not guaranteed if subprojects are
-present. Due to internal limitations all subprojects are processed
-even if they are never used in a real meson run.  Because of this
-options for the subprojects can differ.
-
-## `include_directories` accepts a string
-
-The `include_directories` keyword argument now accepts plain strings
-rather than an include directory object. Meson will transparently
-expand it so that a declaration like this:
-
-```meson
-executable(..., include_directories: 'foo')
-```
-
-Is equivalent to this:
-
-```meson
-foo_inc = include_directories('foo')
-executable(..., include_directories: foo_inc)
-```
-
-## Fortran submodule support
-
-Initial support for Fortran `submodule` was added, where the submodule is in
-the same or different file than the parent `module`.
-The submodule hierarchy specified in the source Fortran code `submodule`
-statements are used by Meson to resolve source file dependencies.
-For example:
-
-```fortran
-submodule (ancestor:parent) child
-```
-
-
-## Add `subproject_dir` to `--projectinfo` introspection output
-
-This allows applications interfacing with Meson (such as IDEs) to know about
-an overridden subproject directory.
-
-## Find library with its headers
-
-The `find_library()` method can now also verify if the library's headers are
-found in a single call, using the `has_header()` method internally.
-
-```meson
-# Aborts if the 'z' library is found but not its header file
-zlib = find_library('z', has_headers : 'zlib.h')
-# Returns not-found if the 'z' library is found but not its header file
-zlib = find_library('z', has_headers : 'zlib.h', required : false)
-```
-
-Any keyword argument with the `header_` prefix passed to `find_library()` will
-be passed to the `has_header()` method with the prefix removed.
-
-```meson
-libfoo = find_library('foo',
-  has_headers : ['foo.h', 'bar.h'],
-  header_prefix : '#include <baz.h>',
-  header_include_directories : include_directories('.'))
-```
-
-## NetCDF
-
-NetCDF support for C, C++ and Fortran is added via pkg-config.
-
-## Added the Flang compiler
-
-[Flang](https://github.com/flang-compiler/flang/releases) Fortran
-compiler support was added.  As with other Fortran compilers, flang is
-specified using `FC=flang meson ..` or similar.
-
-## New `not_found_message` for `dependency()`
-
-You can now specify a `not_found_message` that will be printed if the
-specified dependency was not found. The point is to convert constructs
-that look like this:
-
-```meson
-d = dependency('something', required: false)
-if not d.found()
-  message('Will not be able to do something.')
-endif
-```
-
-Into this:
-
-```meson
-d = dependency('something',
-  required: false,
-  not_found_message: 'Will not be able to do something.')
-```
-
-Or constructs like this:
-
-```meson
-d = dependency('something', required: false)
-if not d.found()
-  error('Install something by doing XYZ.')
-endif
-```
-
-into this:
-
-```meson
-d = dependency('something',
-  not_found_message: 'Install something by doing XYZ.')
-```
-
-Which works, because the default value of `required` is `true`.
-
-## Cuda support
-
-Compiling Cuda source code is now supported, though only with the
-Ninja backend. This has been tested only on Linux for now.
-
-Because NVidia's Cuda compiler does not produce `.d` dependency files,
-dependency tracking does not work.
-
-## `run_command()` accepts `env` kwarg
-
-You can pass [`environment`](Reference-manual.md#environment-object)
-object to [`run_command`](Reference-manual.md#run-command), just
-like to `test`:
-
-```meson
-env = environment()
-env.set('FOO', 'bar')
-run_command('command', 'arg1', 'arg2', env: env)
-```
-
-## `extract_objects:` accepts `File` arguments
-
-The `extract_objects` function now supports File objects to tell it
-what to extract. Previously, file paths could only be passed as strings.
-
-## Changed the JSON format of the introspection
-
-All paths used in the meson introspection JSON format are now absolute. This
-affects the `filename` key in the targets introspection and the output of
-`--buildsystem-files`.
-
-Furthermore, the `filename` and `install_filename` keys in the targets
-introspection are now lists of strings with identical length.
-
-The `--target-files` option is now deprecated, since the same information
-can be acquired from the `--tragets` introspection API.
-
-## Meson file rewriter
-
-This release adds the functionality to perform some basic modification
-on the `meson.build` files from the command line. The currently
-supported operations are:
-
-- For build targets:
-  - Add/Remove source files
-  - Add/Remove targets
-  - Modify a select set of kwargs
-  - Print some JSON information
-- For dependencies:
-  - Modify a select set of kwargs
-- For the project function:
-  - Modify a select set of kwargs
-  - Modify the default options list
-
-For more information see the rewriter documentation.
-
-## `introspect --scan-dependencies` can now be used to scan for dependencies used in a project
-
-It is now possible to run `meson introspect --scan-dependencies
-/path/to/meson.build` without a configured build directory to scan for
-dependencies.
-
-The output format is as follows:
-
-```json
-[
-  {
-    "name": "The name of the dependency",
-    "required": true,
-    "conditional": false,
-    "has_fallback": false
-  }
-]
-```
-
-The `required` keyword specifies whether the dependency is marked as required
-in the `meson.build` (all dependencies are required by default). The
-`conditional` key indicates whether the `dependency()` function was called
-inside a conditional block. In a real meson run these dependencies might not be
-used, thus they _may_ not be required, even if the `required` key is set. The
-`has_fallback` key just indicates whether a fallback was directly set in the
-`dependency()` function.
-
-## `introspect --targets` can now be used without configured build directory
-
-It is now possible to run `meson introspect --targets /path/to/meson.build`
-without a configured build directory.
-
-The generated output is similar to running the introspection with a build
-directory. However, there are some key differences:
-
-- The paths in `filename` now are _relative_ to the future build directory
-- The `install_filename` key is completely missing
-- There is only one entry in `target_sources`:
-  - With the language set to `unknown`
-  - Empty lists for `compiler` and `parameters` and `generated_sources`
-  - The `sources` list _should_ contain all sources of the target
-
-There is no guarantee that the sources list in `target_sources` is correct.
-There might be differences, due to internal limitations. It is also not
-guaranteed that all targets will be listed in the output. It might even be
-possible that targets are listed, which won't exist when meson is run normally.
-This can happen if a target is defined inside an if statement.
-Use this feature with care.
-
-## Added option to introspect multiple parameters at once
-
-Meson introspect can now print the results of multiple introspection
-commands in a single call. The results are then printed as a single JSON
-object.
-
-The format for a single command was not changed to keep backward
-compatibility.
-
-Furthermore the option `-a,--all`, `-i,--indent` and `-f,--force-object-output`
-were added to print all introspection information in one go, format the
-JSON output (the default is still compact JSON) and force use the new
-output format, even if only one introspection command was given.
-
-A complete introspection dump is also stored in the `meson-info`
-directory. This dump will be (re)generated each time meson updates the
-configuration of the build directory.
-
-Additionlly the format of `meson introspect target` was changed:
-
-  - New: the `sources` key. It stores the source files of a target and their compiler parameters.
-  - New: the `defined_in` key. It stores the meson file where a target is defined
-  - New: the `subproject` key. It stores the name of the subproject where a target is defined.
-  - Added new target types (`jar`, `shared module`).
-
-## `meson configure` can now print the default options of an unconfigured project
-
-With this release, it is also possible to get a list of all build options
-by invoking `meson configure` with the project source directory or
-the path to the root `meson.build`. In this case, meson will print the
-default values of all options.
-
-## HDF5
-
-HDF5 support is added via pkg-config.
-
-## Added the `meson-info.json` introspection file
-
-Meson now generates a `meson-info.json` file in the `meson-info` directory
-to provide introspection information about the latest meson run. This file
-is updated when the build configuration is changed and the build files are
-(re)generated.
-
-## New kwarg `install:` for `configure_file()`
-
-Previously when using `configure_file()`, you could install the outputted file
-by setting the `install_dir:` keyword argument. Now, there is an explicit kwarg
-`install:` to enable/disable it. Omitting it will maintain the old behaviour.
diff --git a/meson/docs/markdown/Release-notes-for-0.51.0.md b/meson/docs/markdown/Release-notes-for-0.51.0.md
deleted file mode 100644 (file)
index b7e441c..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
----
-title: Release 0.51.0
-short-description: Release notes for 0.51.0
-...
-
-# New features
-
-## (C) Preprocessor flag handling
-
-Meson previously stored `CPPFLAGS` and per-language compilation flags
-separately. (That latter would come from `CFLAGS`, `CXXFLAGS`, etc., along with
-`<lang>_args` options whether specified no the command-line interface (`-D..`),
-`meson.build` (`default_options`), or cross file (`[properties]`).) This was
-mostly unobservable, except for certain preprocessor-only checks like
-`check_header` would only use the preprocessor flags, leading to confusion if
-some `-isystem` was in `CFLAGS` but not `CPPFLAGS`. Now, they are lumped
-together, and `CPPFLAGS`, for the languages which are deemed to care to about,
-is just another source of compilation flags along with the others already
-listed.
-
-## Sanity checking compilers with user flags
-
-Sanity checks previously only used user-specified flags for cross compilers, but
-now do in all cases.
-
-All compilers meson might decide to use for the build are "sanity checked"
-before other tests are run. This usually involves building simple executable and
-trying to run it. Previously user flags (compilation and/or linking flags) were
-used for sanity checking cross compilers, but not native compilers.  This is
-because such flags might be essential for a cross binary to succeed, but usually
-aren't for a native compiler.
-
-In recent releases, there has been an effort to minimize the special-casing of
-cross or native builds so as to make building more predictable in less-tested
-cases. Since this the user flags are necessary for cross, but not harmful for
-native, it makes more sense to use them in all sanity checks than use them in no
-sanity checks, so this is what we now do.
-
-## New `sourceset` module
-
-A new module, `sourceset`, was added to help building many binaries
-from the same source files.  Source sets associate source files and
-dependencies to keys in a `configuration_data` object or a dictionary;
-they then take multiple `configuration_data` objects or dictionaries,
-and compute the set of source files and dependencies for each of those
-configurations.
-
-## n_debug=if-release and buildtype=plain means no asserts
-
-Previously if this combination was used then assertions were enabled,
-which is fairly surprising behavior.
-
-## `target_type` in `build_targets` accepts the value 'shared_module'
-
-The `target_type` keyword argument in `build_target()` now accepts the
-value `'shared_module'`.
-
-The statement
-
-```meson
-build_target(..., target_type: 'shared_module')
-```
-
-is equivalent to this:
-
-```meson
-shared_module(...)
-```
-
-## New modules kwarg for python.find_installation
-
-This mirrors the modules argument that some kinds of dependencies (such as
-qt, llvm, and cmake based dependencies) take, allowing you to check that a
-particular module is available when getting a python version.
-
-```meson
-py = import('python').find_installation('python3', modules : ['numpy'])
-```
-
-## Support for the Intel Compiler on Windows (ICL)
-
-Support has been added for ICL.EXE and ifort on windows. The support should be
-on part with ICC support on Linux/MacOS. The ICL C/C++ compiler behaves like
-Microsoft's CL.EXE rather than GCC/Clang like ICC does, and has a different id,
-`intel-cl` to differentiate it.
-
-```meson
-cc = meson.get_compiler('c')
-if cc.get_id == 'intel-cl'
-  add_project_argument('/Qfoobar:yes', language : 'c')
-endif
-```
-
-## Added basic support for the Xtensa CPU toolchain
-
-You can now use `xt-xcc`, `xt-xc++`, `xt-nm`, etc... on your cross compilation
-file and meson won't complain about an unknown toolchain.
-
-
-## Dependency objects now have a get_variable method
-
-This is a generic replacement for type specific variable getters such as
-`ConfigToolDependency.get_configtool_variable` and
-`PkgConfigDependency.get_pkgconfig_variable`, and is the only way to query
-such variables from cmake dependencies.
-
-This method allows you to get variables without knowing the kind of
-dependency you have.
-
-```meson
-dep = dependency('could_be_cmake_or_pkgconfig')
-# cmake returns 'YES', pkg-config returns 'ON'
-if ['YES', 'ON'].contains(dep.get_variable(pkgconfig : 'var-name', cmake : 'COP_VAR_NAME', default_value : 'NO'))
-  error('Cannot build your project when dep is built with var-name support')
-endif
-```
-
-## CMake prefix path overrides
-
-When using pkg-config as a dependency resolver we can pass
-`-Dpkg_config_path=$somepath` to extend or overwrite where pkg-config will
-search for dependencies. Now cmake can do the same, as long as the dependency
-uses a ${Name}Config.cmake file (not a Find{$Name}.cmake file), by passing
-`-Dcmake_prefix_path=list,of,paths`. It is important that point this at the
-prefix that the dependency is installed into, not the cmake path.
-
-If you have installed something to `/tmp/dep`, which has a layout like:
-```
-/tmp/dep/lib/cmake
-/tmp/dep/bin
-```
-
-then invoke meson as `meson builddir/ -Dcmake_prefix_path=/tmp/dep`
-
-## Tests that should fail but did not are now errors
-
-You can tag a test as needing to fail like this:
-
-```meson
-test('shoulfail', exe, should_fail: true)
-```
-
-If the test passes the problem is reported in the error logs but due
-to a bug it was not reported in the test runner's exit code. Starting
-from this release the unexpected passes are properly reported in the
-test runner's exit code. This means that test runs that were passing
-in earlier versions of Meson will report failures with the current
-version. This is a good thing, though, since it reveals an error in
-your test suite that has, until now, gone unnoticed.
-
-## New target keyword argument: `link_language`
-
-There may be situations for which the user wishes to manually specify
-the linking language.  For example, a C++ target may link C, Fortran,
-etc. and perhaps the automatic detection in Meson does not pick the
-desired compiler.  The user can manually choose the linker by language
-per-target like this example of a target where one wishes to link with
-the Fortran compiler:
-
-```meson
-executable(..., link_language : 'fortran')
-```
-
-A specific case this option fixes is where for example the main
-program is Fortran that calls C and/or C++ code.  The automatic
-language detection of Meson prioritizes C/C++, and so an compile-time
-error results like `undefined reference to main`, because the linker
-is C or C++ instead of Fortran, which is fixed by this per-target
-override.
-
-## New module to parse kconfig output files
-
-The new module `unstable-kconfig` adds the ability to parse and use
-kconfig output files from `meson.build`.
-
-
-## Add new `meson subprojects foreach` command
-
-`meson subprojects` has learned a new `foreach` command which accepts a command
-with arguments and executes it in each subproject directory.
-
-For example this can be useful to check the status of subprojects (e.g. with
-`git status` or `git diff`) before performing other actions on them.
-
-
-## Added c17 and c18 as c_std values for recent GCC and Clang Versions
-
-For gcc version 8.0 and later, the values c17, c18, gnu17, and gnu18
-were added to the accepted values for built-in compiler option c_std.
-
-For Clang version 10.0 and later on Apple OSX (Darwin), and for
-version 7.0 and later on other platforms, the values c17 and gnu17
-were added as c_std values.
-
-## gpgme dependency now supports gpgme-config
-
-Previously, we could only detect GPGME with custom invocations of
-`gpgme-config` or when the GPGME version was recent enough (>=1.13.0)
-to install pkg-config files. Now we added support to Meson allowing us
-to use `dependency('gpgme')` and fall back on `gpgme-config` parsing.
-
-## Can link against custom targets
-
-The output of `custom_target` and `custom_target[i]` can be used in
-`link_with` and `link_whole` keyword arguments. This is useful for
-integrating custom code generator steps, but note that there are many
-limitations:
-
- - Meson can not know about link dependencies of the custom target. If
-   the target requires further link libraries, you need to add them manually
-
- - The user is responsible for ensuring that the code produced by
-   different toolchains are compatible.
-
- - `custom_target` may only be used when it has a single output file.
-   Use `custom_target[i]` when dealing with multiple output files.
-
- - The output file must have the correct file name extension.
-
-
-## Removed the deprecated `--target-files` API
-
-The `--target-files` introspection API is now no longer available. The same
-information can be queried with the `--targets` API introduced in 0.50.0.
-
-## Generators have a new `depends` keyword argument
-
-Generators can now specify extra dependencies with the `depends`
-keyword argument. It matches the behaviour of the same argument in
-other functions and specifies that the given targets must be built
-before the generator can be run. This is used in cases such as this
-one where you need to tell a generator to indirectly invoke a
-different program.
-
-```meson
-exe = executable(...)
-cg = generator(program_runner,
-    output: ['@BASENAME@.c'],
-    arguments: ['--use-tool=' + exe.full_path(), '@INPUT@', '@OUTPUT@'],
-    depends: exe)
-```
-
-## Specifying options per mer machine
-
-Previously, no cross builds were controllable from the command line.
-Machine-specific options like the pkg-config path and compiler options only
-affected native targets, that is to say all targets in native builds, and
-`native: true` targets in cross builds. Now, prefix the option with `build.` to
-affect build machine targets, and leave it unprefixed to affect host machine
-targets.
-
-For those trying to ensure native and cross builds to the same platform produced
-the same result, the old way was frustrating because very different invocations
-were needed to affect the same targets, if it was possible at all. Now, the same
-command line arguments affect the same targets everwhere --- Meson is closer to
-ignoring whether the "overall" build is native or cross, and just caring about
-whether individual targets are for the build or host machines.
-
-
-## subproject.get_variable() now accepts a `fallback` argument
-
-Similar to `get_variable`, a fallback argument can now be passed to
-`subproject.get_variable()`, it will be returned if the requested
-variable name did not exist.
-
-``` meson
-var = subproject.get_variable('does-not-exist', 'fallback-value')
-```
-
-## Add keyword `static` to `find_library`
-
-`find_library` has learned the `static` keyword. They keyword must be a boolean,
-where `true` only searches for static libraries and `false` only searches for
-dynamic/shared. Leaving the keyword unset will keep the old behavior of first
-searching for dynamic and then falling back to static.
-
-## Fortran `include` statements recursively parsed
-
-While non-standard and generally not recommended, some legacy Fortran
-programs use `include` directives to inject code inline.  Since v0.51,
-Meson can handle Fortran `include` directives recursively.
-
-DO NOT list `include` files as sources for a target, as in general
-their syntax is not correct as a standalone target.  In general
-`include` files are meant to be injected inline as if they were copy
-and pasted into the source file.
-
-`include` was never standard and was superceded by Fortran 90 `module`.
-
-The `include` file is only recognized by Meson if it has a Fortran
-file suffix, such as `.f` `.F` `.f90` `.F90` or similar.  This is to
-avoid deeply nested scanning of large external legacy C libraries that
-only interface to Fortran by `include biglib.h` or similar.
-
-## CMake subprojects
-
-Meson can now directly consume CMake based subprojects with the
-CMake module.
-
-Using CMake subprojects is similar to using the "normal" meson
-subprojects. They also have to be located in the `subprojects`
-directory.
-
-Example:
-
-```cmake
-add_library(cm_lib SHARED ${SOURCES})
-```
-
-```meson
-cmake = import('cmake')
-
-# Configure the CMake project
-sub_proj = cmake.subproject('libsimple_cmake')
-
-# Fetch the dependency object
-cm_lib = sub_proj.dependency('cm_lib')
-
-executable(exe1, ['sources'], dependencies: [cm_lib])
-```
-
-It should be noted that not all projects are guaranteed to work. The
-safest approach would still be to create a `meson.build` for the
-subprojects in question.
-
-## Multipe cross files can be specified
-
-`--cross-file` can be passed multiple times, with the configuration files overlaying the same way as `--native-file`.
-
diff --git a/meson/docs/markdown/Release-notes-for-0.52.0.md b/meson/docs/markdown/Release-notes-for-0.52.0.md
deleted file mode 100644 (file)
index 018fb35..0000000
+++ /dev/null
@@ -1,248 +0,0 @@
----
-title: Release 0.52.0
-short-description: Release notes for 0.52.0
-...
-
-# New features
-
-## Gettext targets are ignored if `gettext` is not installed
-
-Previously the `i18n` module has errored out when `gettext` tools are
-not installed on the system. Starting with this version they will
-become no-ops instead. This makes it easier to build projects on
-minimal environments (such as when bootstrapping) that do not have
-translation tools installed.
-
-## Support taking environment values from a dictionary
-
-`environment()` now accepts a dictionary as first argument.  If
-provided, each key/value pair is added into the `environment_object`
-as if `set()` method was called for each of them.
-
-On the various functions that take an `env:` keyword argument, you may
-now give a dictionary.
-
-## alias_target
-
-``` meson
-runtarget alias_target(target_name, dep1, ...)
-```
-
-This function creates a new top-level target. Like all top-level targets, this
-integrates with the selected backend. For instance, with Ninja you can
-run it as `ninja target_name`. This is a dummy target that does not execute any
-command, but ensures that all dependencies are built. Dependencies can be any
-build target (e.g. return value of executable(), custom_target(), etc)
-
-
-## Enhancements to the pkg_config_path argument
-
-Setting sys_root in the [properties] section of your cross file will now set
-PKG_CONFIG_SYSROOT_DIR automatically for host system dependencies when
-cross compiling.
-
-## The meson test program now accepts an additional "--gdb-path" argument to specify the GDB binary
-
-`meson test --gdb testname` invokes GDB with the specific test case. However, sometimes GDB is not in the path or a GDB replacement is wanted.
-Therefore, a `--gdb-path` argument was added to specify which binary is executed (per default `gdb`):
-
-```console
-$ meson test --gdb --gdb-path /my/special/location/for/gdb testname
-$ meson test --gdb --gdb-path cgdb testname
-```
-
-## Better support for illumos and Solaris
-
-illumos (and hopefully Solaris) support has been dramatically improved, and one
-can reasonably expect projects to compile.
-
-## Splitting of Compiler.get_function_attribute('visibility')
-
-On macOS there is no `protected` visibility, which results in the visbility
-check always failing. 0.52.0 introduces two changes to improve this situation:
-
-1. the "visibility" check no longer includes "protected"
-2. a new set of "split" checks are introduced which check for a single
-   attribute instead of all attributes.
-
-These new attributes are:
-* visibility:default
-* visibility:hidden
-* visibility:internal
-* visibility:protected
-
-## Clang-tidy target
-
-If `clang-tidy` is installed and the project's source root contains a
-`.clang-tidy` (or `_clang-tidy`) file, Meson will automatically define
-a `clang-tidy` target that runs Clang-Tidy on all source files.
-
-If you have defined your own `clang-tidy` target, Meson will not
-generate its own target.
-
-## Add blocks dependency
-
-Add `dependency('blocks')` to use the Clang blocks extension.
-
-## Meson's builtin b_lundef is now supported on macOS
-
-This has always been possible, but there are some addtional restrictions on
-macOS (mainly do to Apple only features). With the linker internal
-re-architecture this has become possible
-
-## Compiler and dynamic linker representation split
-
-0.52.0 inclues a massive refactor of the representaitons of compilers to
-tease apart the representations of compilers and dynamic linkers (ld). This
-fixes a number of compiler/linker combinations. In particular this fixes
-use GCC and vanilla clang on macOS.
-
-## Add `depth` option to `wrap-git`
-
-To allow shallow cloning, an option `depth` has been added to `wrap-git`.
-This applies recursively to submodules when `clone-recursive` is set to `true`.
-
-Note that the git server may have to be configured to support shallow cloning
-not only for branches but also for tags.
-
-## Enhancements to the source_set module
-
-`SourceSet` objects now provide the `all_dependencies()` method, that
-complement the existing `all_sources()` method.
-
-## added `--only test(s)` option to run_project_tests.py
-
-Individual tests or a list of tests from run_project_tests.py can be selected like:
-```
-python run_project_tests.py --only fortran
-
-python run_project_tests.py --only fortran python3
-```
-
-This assists Meson development by only running the tests for the portion of Meson being worked on during local development.
-
-## Experimental Webassembly support via Emscripten
-
-Meson now supports compiling code to Webassembly using the Emscripten
-compiler. As with most things regarding Webassembly, this support is
-subject to change.
-
-## Version check in `find_program()`
-
-A new `version` keyword argument has been added to `find_program` to specify
-the required version. See [`dependency()`](#dependency) for argument format.
-The version of the program is determined by running `program_name --version`
-command. If stdout is empty it fallbacks to stderr. If the output contains more
-text than simply a version number, only the first occurence of numbers separated
-by dots is kept. If the output is more complicated than that, the version
-checking will have to be done manually using [`run_command()`](#run_command).
-
-## Added `vs_module_defs` to `shared_module()`
-
-Like `shared_library()`, `shared_module()` now accepts
-`vs_module_defs` argument for controlling symbol exports, etc.
-
-## Improved support for static libraries
-
-Static libraries had numerous shortcomings in the past, especially when using
-uninstalled static libraries. This release brings many internal changes in the
-way they are handled, including:
-
-- `link_whole:` of static libraries. In the example below, lib2 used to miss
-  symbols from lib1 and was unusable.
-```meson
-lib1 = static_library(sources)
-lib2 = static_library(other_sources, link_whole : lib1, install : true)
-```
-- `link_with:` of a static library with an uninstalled static library. In the
-example below, lib2 now implicitly promote `link_with:` to `link_whole:` because
-the installed lib2 would oterhwise be unusable.
-```meson
-lib1 = static_library(sources, install : false)
-lib2 = static_library(sources, link_with : lib1, install : true)
-```
-- pkg-config generator do not include uninstalled static libraries. In the example
-  below, the generated `.pc` file used to be unusable because it contained
-  `Libs.private: -llib1` and `lib1.a` is not installed. `lib1` is now ommitted
-  from the `.pc` file because the `link_with:` has been promoted to
-  `link_whole:` (see above) and thus lib1 is not needed to use lib2.
-```meson
-lib1 = static_library(sources, install : false)
-lib2 = both_libraries(sources, link_with : lib1, install : true)
-pkg.generate(lib2)
-```
-
-Many projects have been using `extract_all_objects()` to work around those issues,
-and hopefully those hacks could now be removed. Since this is a pretty large
-change, please double check if your static libraries behave correctly, and
-report any regression.
-
-## Enhancements to the kconfig module
-
-`kconfig.load()` may now accept a `configure_file()` as input file.
-
-## Added `include_type` kwarg to `dependency`
-
-The `dependency()` function now has a `include_type` kwarg. It can take the
-values `'preserve'`, `'system'` and `'non-system'`. If it is set to `'system'`,
-all include directories of the dependency are marked as system dependencies.
-
-The default value of `include_type` is `'preserve'`.
-
-Additionally, it is also possible to check and change the `include_type`
-state of an existing dependency object with the new `include_type()` and
-`as_system()` methods.
-
-## Enhancements to `configure_file()`
-
-`input:` now accepts multiple input file names for `command:`-configured file.
-
-`depfile:` keyword argument is now accepted. The dependency file can
-list all the additional files the configure target depends on.
-
-## Projects args can be set separately for build and host machines (potentially breaking change)
-
-Simplify `native` flag behavior in `add_global_arguments`,
-`add_global_link_arguments`, `add_project_arguments` and
-`add_project_link_arguments`. The rules are now very simple:
-
- - `native: true` affects `native: true` targets
-
- - `native: false` affects `native: false` targets
-
- - No native flag is the same as `native: false`
-
-This further simplifies behavior to match the "build vs host" decision done in
-last release with `c_args` vs `build_c_args`. The underlying motivation in both
-cases is to execute the same commands whether the overall build is native or
-cross.
-
-## Allow checking if a variable is a disabler
-
-Added the function `is_disabler(var)`. Returns true if a variable is a disabler
-and false otherwise.
-
-
-## gtkdoc-check support
-
-`gnome.gtkdoc()` now has a `check` keyword argument. If `true` runs it will run
-`gtkdoc-check` when running unit tests. Note that this has the downside of
-rebuilding the doc for each build, which is often very slow. It usually should
-be enabled only in CI.
-
-## `gnome.gtkdoc()` returns target object
-
-`gnome.gtkdoc()` now returns a target object that can be passed as dependency to
-other targets using generated doc files (e.g. in `content_files` of another doc).
-
-## Dist is now a top level command
-
-Previously creating a source archive could only be done with `ninja
-dist`. Starting with this release Meson provides a top level `dist`
-that can be invoked directly. It also has a command line option to
-determine which kinds of archives to create:
-
-```meson
-meson dist --formats=xztar,zip
-```
-
diff --git a/meson/docs/markdown/Release-notes-for-0.53.0.md b/meson/docs/markdown/Release-notes-for-0.53.0.md
deleted file mode 100644 (file)
index b29759f..0000000
+++ /dev/null
@@ -1,211 +0,0 @@
----
-title: Release 0.53.0
-short-description: Release notes for 0.53.0
-...
-
-# New features
-
-## A new module for filesystem operations
-
-The new `fs` module can be used to examine the contents of the current
-file system.
-
-```meson
-fs = import('fs')
-assert(fs.exists('important_file'),
-       'The important file is missing.')
-```
-
-## meson dist --include-subprojects
-
-`meson dist` command line now gained `--include-subprojects` command line option.
-When enabled, the source tree of all subprojects used by the current build will
-also be included in the final tarball. This is useful to distribute self contained
-tarball that can be built offline (i.e. `--wrap-mode=nodownload`).
-
-## Added new Meson templates for `Dlang`, `Rust`, `Objective-C`
-
-Meson now ships with predefined project templates for `Dlang`,
-`Fortran`, `Rust`, `Objective-C`, and by passing the associated flags `d`,
-`fortran`, `rust`, `objc` to `meson init --language`.
-
-## Add a new summary() function
-
-A new function [`summary()`](Reference-manual.md#summary) has been added to
-summarize build configuration at the end of the build process.
-
-Example:
-```meson
-project('My Project', version : '1.0')
-summary({'bindir': get_option('bindir'),
-         'libdir': get_option('libdir'),
-         'datadir': get_option('datadir'),
-        }, section: 'Directories')
-summary({'Some boolean': false,
-         'Another boolean': true,
-         'Some string': 'Hello World',
-         'A list': ['string', 1, true],
-        }, section: 'Configuration')
-```
-
-Output:
-```
-My Project 1.0
-
-  Directories
-             prefix: /opt/gnome
-             bindir: bin
-             libdir: lib/x86_64-linux-gnu
-            datadir: share
-
-  Configuration
-       Some boolean: False
-    Another boolean: True
-        Some string: Hello World
-             A list: string
-                     1
-                     True
-```
-
-## Generic Overrider for Dynamic Linker selection
-
-Previous to meson 0.52.0 you set the dynamic linker using compiler specific
-flags passed via language flags and hoped things worked out. In meson 0.52.0
-meson started detecting the linker and making intelligent decisions about
-using it. Unfortunately this broke choosing a non-default linker.
-
-Now there is a generic mechanism for doing this. In 0.53.0, you can use the `LD`
-environment variable. **In 0.53.1** this was changed to `<compiler_variable>_LD`,
-such as `CC_LD`, `CXX_LD`, `D_LD`, etc due to regressions. The usual meson
-[environment variable rules](https://mesonbuild.com/Running-Meson.html#environment-variables)
-apply. Alternatively, you can add the following to a cross or native file:
-
-In 0.53.0:
-
-```ini
-[binaries]
-ld = 'gold'
-```
-
-**In 0.53.1 or newer**:
-
-```ini
-[binaries]
-c = 'gcc'
-c_ld = 'gold'
-```
-
-```ini
-[binaries]
-c = 'clang'
-c_ld = 'lld'
-```
-
-And meson will select the linker if possible.
-
-## `fortran_std` option
-
-**new in 0.53.0**
-Akin to the `c_std` and `cpp_std` options, the `fortran_std` option sets Fortran compilers to warn or error on non-Fortran standard code.
-Only the Gfortran and Intel Fortran compilers have support for this option.
-Other Fortran compilers ignore the `fortran_std` option.
-
-Supported values for `fortran_std` include:
-
-* `legacy` for non-conforming code--this is especially important for Gfortran, which by default errors on old non-compliant Fortran code
-* `f95` for Fortran 95 compliant code.
-* `f2003` for Fortran 2003 compliant code.
-* `f2008` for Fortran 2008 compliant code.
-* `f2018` for Fortran 2018 compliant code.
-
-## python.dependency() embed kwarg
-
-Added the `embed` kwarg to the python module dependency function to select
-the python library that can be used to embed python into an application.
-
-## Scalapack
-
-added in **0.53.0**:
-
-```meson
-scalapack = dependency('scalapack')
-```
-
-Historically and through today, typical Scalapack setups have broken and incomplete pkg-config or
-FindScalapack.cmake. Meson handles finding Scalapack on setups including:
-
-* Linux: Intel MKL or OpenMPI + Netlib
-* MacOS: Intel MKL or OpenMPI + Netlib
-* Windows: Intel MKL (OpenMPI not available on Windows)
-
-## Search directories for `find_program()`
-
-It is now possible to give a list of absolute paths where `find_program()` should
-also search, using the `dirs` keyword argument.
-
-For example on Linux `/sbin` and `/usr/sbin` are not always in the `$PATH`:
-```meson
-prog = find_program('mytool', dirs : ['/usr/sbin', '/sbin'])
-```
-
-## Source tags targets
-
-When the respective tools are available, 'ctags', 'TAGS' and 'cscope'
-targets will be generated by Meson, unless you have defined your own.
-
-## Dictionary entry using string variable as key
-
-Keys can now be any expression evaluating to a string value, not limited
-to string literals any more.
-```meson
-d = {'a' + 'b' : 42}
-k = 'cd'
-d += {k : 43}
-```
-
-## Improved CMake subprojects support
-
-With this release even more CMake projects are supported via
-[CMake subprojects](CMake-module.md#cmake-subprojects) due to these internal
-improvements:
-
-- Use the CMake file API for CMake >=3.14
-- Handle the explicit dependencies via `add_dependency`
-- Basic support for `add_custom_target`
-- Improved `add_custom_command` support
-- Object library support on Windows
-
-## compiler.get_linker_id()
-
-since 0.53.0, `compiler.get_linker_id()` allows retrieving a lowercase name for the linker.
-Since each compiler family can typically use a variety of linkers depending on operating system,
-this helps users define logic for corner cases not otherwise easily handled.
-
-## CUDA dependency
-
-Native support for compiling and linking against the CUDA Toolkit using 
-the `dependency` function: 
-
-```meson
-project('CUDA test', 'cpp', meson_version: '>= 0.53.0')
-exe = executable('prog', 'prog.cc', dependencies: dependency('cuda'))
-```
-
-See [the CUDA dependency](Dependencies.md#cuda) for more information.
-
-## Added global option to disable C++ RTTI
-
-The new boolean option is called `cpp_rtti`.
-
-## Introspection API changes
-
-dependencies (--dependencies, intro-dependencies.json):
-- added the `version` key
-
-scanning dependencies (--scan-dependencies):
-- added the `version` key containing the required dependency version
-
-tests and benchmarks (--tests, --benchmarks, intro-tests.json,
-intro-benchmarks.json):
-- added the `protocol` key
-
diff --git a/meson/docs/markdown/Release-notes-for-0.54.0.md b/meson/docs/markdown/Release-notes-for-0.54.0.md
deleted file mode 100644 (file)
index 2f215de..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
----
-title: Release 0.54.0
-short-description: Release notes for 0.54.0
-...
-
-# New features
-
-## Emscripten (emcc) now supports threads
-
-In addition to properly setting the compile and linker arguments, a new meson
-builtin has been added to control the PTHREAD_POOL_SIZE option,
-`-D<lang>_thread_count`, which may be set to any integer value greater than 0.
-If it set to 0 then the PTHREAD_POOL_SIZE option will not be passed.
-
-## Introduce dataonly for the pkgconfig module
-This allows users to disable writing out the inbuilt variables to
-the pkg-config file as they might actually not be required.
-
-One reason to have this is for architecture-independent pkg-config
-files in projects which also have architecture-dependent outputs.
-
-```
-pkgg.generate(
-  name : 'libhello_nolib',
-  description : 'A minimalistic pkgconfig file.',
-  version : libver,
-  dataonly: true
-)
-```
-
-## Consistently report file locations relative to cwd
-
-The paths for filenames in error and warning locations are now consistently
-reported relative to the current working directory (when possible), or as
-absolute paths (when a relative path does not exist, e.g. a Windows path
-starting with a different drive letter to the current working directory).
-
-(The previous behaviour was to report a path relative to the source root for all
-warnings and most errors, and relative to cwd for certain parser errors)
-
-## `dependency()` consistency
-
-The first time a dependency is found, using `dependency('foo', ...)`, the return
-value is now cached. Any subsequent call will return the same value as long as
-version requested match, otherwise not-found dependency is returned. This means
-that if a system dependency is first found, it won't fallback to a subproject
-in a subsequent call any more and will rather return not-found instead if the
-system version does not match. Similarly, if the first call returns the subproject
-fallback dependency, it will also return the subproject dependency in a subsequent
-call even if no fallback is provided.
-
-For example, if the system has `foo` version 1.0:
-```meson
-# d2 is set to foo_dep and not the system dependency, even without fallback argument.
-d1 = dependency('foo', version : '>=2.0', required : false,
-                fallback : ['foo', 'foo_dep'])
-d2 = dependency('foo', version : '>=1.0', required : false)
-```
-```meson
-# d2 is not-found because the first call returned the system dependency, but its version is too old for 2nd call.
-d1 = dependency('foo', version : '>=1.0', required : false)
-d2 = dependency('foo', version : '>=2.0', required : false,
-                fallback : ['foo', 'foo_dep'])
-```
-
-## Override `dependency()`
-
-It is now possible to override the result of `dependency()` to point
-to any dependency object you want. The overriding is global and applies to
-every subproject from there on.
-
-For example, this subproject provides 2 libraries with version 2.0:
-
-```meson
-project(..., version : '2.0')
-
-libfoo = library('foo', ...)
-foo_dep = declare_dependency(link_with : libfoo)
-meson.override_dependency('foo', foo_dep)
-
-libbar = library('bar', ...)
-bar_dep = declare_dependency(link_with : libbar)
-meson.override_dependency('bar', bar_dep)
-```
-
-Assuming the system has `foo` and `bar` 1.0 installed, and master project does this:
-```meson
-foo_dep = dependency('foo', version : '>=2.0', fallback : ['foo', 'foo_dep'])
-bar_dep = dependency('bar')
-```
-
-This used to mix system 1.0 version and subproject 2.0 dependencies, but thanks
-to the override `bar_dep` is now set to the subproject's version instead.
-
-Another case this can be useful is to force a subproject to use a specific dependency.
-If the subproject does `dependency('foo')` but the main project wants to provide
-its own implementation of `foo`, it can for example call
-`meson.override_dependency('foo', declare_dependency(...))` before configuring the
-subproject.
-
-## Simplified `dependency()` fallback
-
-In the case a subproject `foo` calls `meson.override_dependency('foo-2.0', foo_dep)`,
-the parent project can omit the dependency variable name in fallback keyword
-argument: `dependency('foo-2.0', fallback : 'foo')`.
-
-## Backend agnostic compile command
-
-A new `meson compile` command has been added to support backend agnostic
-compilation. It accepts two arguments, `-j` and `-l`, which are used if
-possible (`-l` does nothing with msbuild). A `-j` or `-l` value < 1 lets the
-backend decide how many threads to use. For msbuild this means `-m`, for
-ninja it means passing no arguments.
-
-```console
-meson builddir --backend vs
-meson compile -C builddir -j0  # this is the same as `msbuild builddir/my.sln -m`
-```
-
-```console
-meson builddir
-meson compile -C builddir -j3  # this is the same as `ninja -C builddir -j3`
-```
-
-Additionally `meson compile` provides a `--clean` switch to clean the project.
-
-A complete list of arguments is always documented via `meson compile --help`
-
-## Native (build machine) compilers not always required
-
-`add_languages()` gained a `native:` keyword, indicating if a native or cross
-compiler is to be used.
-
-For the benefit of existing simple build definitions which don't contain any
-`native: true` targets, without breaking backwards compatibility for build
-definitions which assume that the native compiler is available after
-`add_languages()`, if the `native:` keyword is absent the languages may be used
-for either the build or host machine, but are never required for the build
-machine.
-
-This changes the behaviour of the following meson fragment (when cross-compiling
-but a native compiler is not available) from reporting an error at
-`add_language` to reporting an error at `executable`.
-
-```
-add_language('c')
-executable('main', 'main.c', native: true)
-```
-
-## Summary improvements
-
-A new `list_sep` keyword argument has been added to `summary()` function.
-If defined and the value is a list, elements will be separated by the provided
-string instead of being aligned on a new line.
-
-The automatic `subprojects` section now also print the number of warnings encountered
-during that subproject configuration, or the error message if the configuration failed.
-
-## Add a system type dependency for zlib
-
-This allows zlib to be detected on macOS and FreeBSD without the use of
-pkg-config or cmake, neither of which are part of the base install on those
-OSes (but zlib is).
-
-A side effect of this change is that `dependency('zlib')` also works with
-cmake instead of requiring `dependency('ZLIB')`.
-
-## Added 'name' method
-Build target objects (as returned by executable(), library(), ...) now have a name() method.
-
-## New option `--quiet` to `meson install`
-
-Now you can run `meson install --quiet` and meson will not verbosely print
-every file as it is being installed. As before, the full log is always
-available inside the builddir in `meson-logs/install-log.txt`.
-
-When this option is passed, install scripts will have the environment variable
-`MESON_INSTALL_QUIET` set.
-
-Numerous speed-ups were also made for the install step, especially on Windows
-where it is now 300% to 1200% faster than before depending on your workload.
-
-## Property support emscripten's wasm-ld
-
-Before 0.54.0 we treated emscripten as both compiler and linker, which isn't
-really true. It does have a linker, called wasm-ld (meson's name is ld.wasm).
-This is a special version of clang's lld. This will now be detected properly.
-
-## Skip sanity tests when cross compiling
-
-For certain cross compilation environments it is not possible to
-compile a sanity check application. This can now be disabled by adding
-the following entry to your cross file's `properties` section:
-
-```
-skip_sanity_check = true
-```
-
-## Support for overiding the linker with ldc and gdc
-
-LDC (the llvm D compiler) and GDC (The Gnu D Compiler) now honor D_LD linker
-variable (or d_ld in the cross file) and is able to pick differnt linkers.
-
-GDC supports all of the same values as GCC, LDC supports ld.bfd, ld.gold,
-ld.lld, ld64, link, and lld-link.
-
-## Native file properties
-
-As of Meson 0.54.0, the `--native-file nativefile.ini` can contain:
-
-* binaries
-* paths
-* properties
-
-which are defined and used the same way as in cross files.
-The `properties` are new for Meson 0.54.0, and are read like:
-
-```meson
-x = meson.get_external_property('foobar', 'foo')
-```
-
-where `foobar` is the property name, and the optional `foo` is the fallback string value.
-
-For cross-compiled projects, `get_external_property()` reads the cross-file unless `native: true` is specified.
-
-## Changed the signal used to terminate a test process (group)
-
-A test process (group) is now terminated via SIGTERM instead of SIGKILL
-allowing the signal to be handled. However, it is now the responsibility of
-the custom signal handler (if any) to ensure that any process spawned by the
-top-level test processes is correctly killed.
-
-## Dynamic Linker environment variables actually match docs
-
-The docs have always claimed that the Dynamic Linker environment variable
-should be `${COMPILER_VAR}_LD`, but that's only the case for about half of
-the variables. The other half are different. In 0.54.0 the variables match.
-The old variables are still supported, but are deprecated and raise a
-deprecation warning.
-
-## Per subproject `default_library` and `werror` options
-
-The `default_library` and `werror` built-in options can now be defined per subproject.
-This is useful for example when building shared libraries in the main project,
-but static link a subproject, or when the main project must build with no warnings
-but some subprojects cannot.
-
-Most of the time this would be used either by the parent project by setting
-subproject's default_options (e.g. `subproject('foo', default_options: 'default_library=static')`),
-or by the user using the command line `-Dfoo:default_library=static`.
-
-The value is overriden in this order:
-- Value from parent project
-- Value from subproject's default_options if set
-- Value from subproject() default_options if set
-- Value from command line if set
-
-## Environment Variables with Cross Builds
-
-Previously in Meson, variables like `CC` effected both the host and build
-platforms for native builds, but the just the build platform for cross builds.
-Now `CC_FOR_BUILD` is used for the build platform in cross builds.
-
-This old behavior is inconsistent with the way Autotools works, which
-undermines the purpose of distro-integration that is the only reason
-environment variables are supported at all in Meson. The new behavior is not
-quite the same, but doesn't conflict: meson doesn't always repond to an
-environment when Autoconf would, but when it does it interprets it as Autotools
-would.
-
-## Added 'pkg_config_libdir' property
-Allows to define a list of folders used by pkg-config for a cross build
-and avoid a system directories use.
-
-## More new sample Meson templates for (`Java`, `Cuda`, and more)
-
-Meson now ships with predefined project templates for `Java`,
-`Cuda`, `Objective-C++`, and `C#`, we provided with associated
-values for corresponding languages, avalable for both library,
-and executable.
-
-## Ninja version requirement bumped to 1.7
-
-Meson now uses the [Implicit outputs](https://ninja-build.org/manual.html#ref_outputs)
-feature of Ninja for some types of targets that have multiple outputs which may
-not be listed on the command-line. This feature requires Ninja 1.7+.
-
-Note that the latest version of [Ninja available in Ubuntu 16.04](https://packages.ubuntu.com/search?keywords=ninja-build&searchon=names&suite=xenial-backports&section=all)
-(the oldest Ubuntu LTS at the time of writing) is 1.7.1. If your distro does
-not ship with a new-enough Ninja, you can download the latest release from
-Ninja's GitHub page: https://github.com/ninja-build/ninja/releases
-
-## Added `-C` argument to `meson init` command
-
-The meson init assumes that it is run inside the project
-root directory. If this isn't the case, you can now use
-`-C` to specify the actual project source directory.
-
-## More than one argument to `message()` and `warning()`
-
-Arguments passed to `message()` and `warning()` will be printed separated by
-space.
-
-## Added `has_tools` method to qt module
-
-It should be used to compile optional Qt code:
-```meson
-qt5 = import('qt5')
-if qt5.has_tools(required: get_option('qt_feature'))
-  moc_files = qt5.preprocess(...)
-  ...
-endif
-```
-
-## The MSI installer is only available in 64 bit version
-
-Microsoft ended support for Windows 7, so only 64 bit Windows OSs are
-officially supported. Thus only a 64 bit MSI installer will be
-provided going forward. People needing a 32 bit version can build
-their own with the `msi/createmsi.py` script in Meson's source
-repository.
-
-## Uninstalled pkg-config files
-
-**Note**: the functionality of this module is governed by [Meson's
-  rules on mixing build systems](Mixing-build-systems.md).
-
-The `pkgconfig` module now generates uninstalled pc files as well. For any generated
-`foo.pc` file, an extra `foo-uninstalled.pc` file is placed into
-`<builddir>/meson-uninstalled`. They can be used to build applications against
-libraries built by meson without installing them, by pointing `PKG_CONFIG_PATH`
-to that directory. This is an experimental feature provided on a best-effort
-basis, it might not work in all use-cases.
-
-## CMake find_package COMPONENTS support
-
-It is now possible to pass components to the CMake dependency backend via the
-new `components` kwarg in the `dependency` function.
-
-## Added Microchip XC16 C compiler support
-Make sure compiler executables are setup correctly in your path
-Compiler is available from the Microchip website for free
-
-
-## Added Texas Instruments C2000 C/C++ compiler support
-Make sure compiler executables are setup correctly in your path
-Compiler is available from Texas Instruments website for free
-
-## Unity file block size is configurable
-
-Traditionally the unity files that Meson autogenerates contain all
-source files that belong to a single target. This is the most
-efficient setting for full builds but makes incremental builds slow.
-This release adds a new option `unity_size` which specifies how many
-source files should be put in each unity file.
-
-The default value for block size is 4. This means that if you have a
-target that has eight source files, Meson will generate two unity
-files each of which includes four source files. The old behaviour can
-be replicated by setting `unity_size` to a large value, such as 10000.
-
-## Verbose mode for `meson compile`
-
-The new option `--verbose` has been added to `meson compile` that will enable
-more verbose compilation logs. Note that for VS backend it means that logs will
-be less verbose by default (without `--verbose` option).
diff --git a/meson/docs/markdown/Release-notes-for-0.55.0.md b/meson/docs/markdown/Release-notes-for-0.55.0.md
deleted file mode 100644 (file)
index cd3f795..0000000
+++ /dev/null
@@ -1,315 +0,0 @@
----
-title: Release 0.55.0
-short-description: Release notes for 0.55.0
-...
-
-# New features
-
-## rpath removal now more careful
-
-On Linux-like systems, meson adds rpath entries to allow running apps
-in the build tree, and then removes those build-time-only
-rpath entries when installing.  Rpath entries may also come
-in via LDFLAGS and via .pc files.  Meson used to remove those
-latter rpath entries by accident, but is now more careful.
-
-## Added ability to specify targets in `meson compile`
-
-It's now possible to specify targets in `meson compile`, which will result in building only the requested targets.
-
-Usage: `meson compile [TARGET [TARGET...]]`
-`TARGET` has the following syntax: `[PATH/]NAME[:TYPE]`.
-`NAME`: name of the target from `meson.build` (e.g. `foo` from `executable('foo', ...)`).
-`PATH`: path to the target relative to the root `meson.build` file. Note: relative path for a target specified in the root `meson.build` is `./`.
-`TYPE`: type of the target (e.g. `shared_library`, `executable` and etc)
-
-`PATH` and/or `TYPE` can be ommited if the resulting `TARGET` can be used to uniquely identify the target in `meson.build`.
-
-For example targets from the following code:
-```meson
-shared_library('foo', ...)
-static_library('foo', ...)
-executable('bar', ...)
-```
-can be invoked with `meson compile foo:shared_library foo:static_library bar`.
-
-## Test protocol for gtest
-
-Due to the popularity of Gtest (google test) among C and C++ developers meson
-now supports a special protocol for gtest. With this protocol meson injects
-arguments to gtests to output JUnit, reads that JUnit, and adds the output to
-the JUnit it generates.
-
-## meson.add_*_script methods accept new types
-
-All three (`add_install_script`, `add_dist_script`, and
-`add_postconf_script`) now accept ExternalPrograms (as returned by
-`find_program`), Files, and the output of `configure_file`. The dist and
-postconf methods cannot accept other types because of when they are run.
-While dist could, in theory, take other dependencies, it would require more
-extensive changes, particularly to the backend.
-
-```meson
-meson.add_install_script(find_program('foo'), files('bar'))
-meson.add_dist_script(find_program('foo'), files('bar'))
-meson.add_postconf_script(find_program('foo'), files('bar'))
-```
-
-The install script variant is also able to accept custom_targets,
-custom_target indexes, and build targets (executables, libraries), and can
-use built executables a the script to run
-
-```meson
-installer = executable('installer', ...)
-meson.add_install_script(installer, ...)
-meson.add_install_script('foo.py', installer)
-```
-
-## Machine file constants
-
-Native and cross files now support string and list concatenation using the `+`
-operator, and joining paths using the `/` operator.
-Entries defined in the `[constants]` section can be used in any other section.
-An entry defined in any other section can be used only within that same section and only
-after it has been defined.
-
-```ini
-[constants]
-toolchain = '/toolchain'
-common_flags = ['--sysroot=' + toolchain + '/sysroot']
-
-[properties]
-c_args = common_flags + ['-DSOMETHING']
-cpp_args = c_args + ['-DSOMETHING_ELSE']
-
-[binaries]
-c = toolchain + '/gcc'
-```
-
-## Configure CMake subprojects with meson.subproject_options
-
-Meson now supports passing configuration options to CMake and overriding
-certain build details extracted from the CMake subproject.
-
-The new CMake configuration options object is very similar to the
-[configuration data object](Reference-manual.md#configuration-data-object) object
-returned by [`configuration_data`](Reference-manual.md#configuration_data). It
-is generated by the `subproject_options` function
-
-All configuration options have to be set *before* the subproject is configured
-and must be passed to the `subproject` method via the `options` key. Altering
-the configuration object won't have any effect on previous `cmake.subproject`
-calls.
-
-**Note:** The `cmake_options` kwarg for the `subproject` function is now
-deprecated since it is replaced by the new `options` system.
-
-## find_program: Fixes when the program has been overridden by executable
-
-When a program has been overridden by an executable, the returned object of
-find_program() had some issues:
-
-```meson
-# In a subproject:
-exe = executable('foo', ...)
-meson.override_find_program('foo', exe)
-
-# In main project:
-# The version check was crashing meson.
-prog = find_program('foo', version : '>=1.0')
-
-# This was crashing meson.
-message(prog.path())
-
-# New method to be consistent with built objects.
-message(prog.full_path())
-```
-
-## Response files enabled on Linux, reined in on Windows
-
-Meson used to always use response files on Windows,
-but never on Linux.
-
-It now strikes a happier balance, using them on both platforms,
-but only when needed to avoid command line length limits.
-
-## `unstable-kconfig` module renamed to `unstable-keyval`
-
-The `unstable-kconfig` module is now renamed to `unstable-keyval`.
-We expect this module to become stable once it has some usage experience,
-specifically in the next or the following release
-
-
-## Fatal warnings in `gnome.generate_gir()`
-
-`gnome.generate_gir()` now has `fatal_warnings` keyword argument to abort when
-a warning is produced. This is useful for example in CI environment where it's
-important to catch potential issues.
-
-## b_ndebug support for D language compilers
-
-D Language compilers will now set -release/--release/-frelease (depending on
-the compiler) when the b_ndebug flag is set.
-
-## Meson test now produces JUnit xml from results
-
-Meson will now generate a JUnit compatible XML file from test results. it
-will be in the meson-logs directory and is called testlog.junit.xml.
-
-## Config tool based dependencies no longer search PATH for cross compiling
-
-Before 0.55.0 config tool based dependencies (llvm-config, cups-config, etc),
-would search system $PATH if they weren't defined in the cross file. This has
-been a source of bugs and has been deprecated. It is now removed, config tool
-binaries must be specified in the cross file now or the dependency will not
-be found.
-
-## Rename has_exe_wrapper -> can_run_host_binaries
-
-The old name was confusing as it didn't really match the behavior of the
-function. The old name remains as an alias (the behavior hasn't changed), but
-is now deprecated.
-
-## String concatenation in meson_options.txt
-
-It is now possible to use string concatenation (with the `+` opperator) in the
-meson_options.txt file. This allows splitting long option descriptions.
-
-```meson
-option(
-  'testoption',
-  type : 'string',
-  value : 'optval',
-  description : 'An option with a very long description' +
-                'that does something in a specific context'
-)
-```
-
-## Wrap fallback URL
-
-Wrap files can now define `source_fallback_url` and `patch_fallback_url` to be
-used in case the main server is temporaly down.
-
-## Clang coverage support
-
-llvm-cov is now used to generate coverage information when clang is used as
-the compiler.
-
-## Local wrap source and patch files
-
-It is now possible to use the `patch_filename` and `source_filename` value in a
-`.wrap` file without `*_url` to specify a local source / patch file. All local
-files must be located in the `subprojects/packagefiles` directory. The `*_hash`
-entries are optional with this setup.
-
-## Local wrap patch directory
-
-Wrap files can now specify `patch_directory` instead of `patch_filename` in the
-case overlay files are local. Every files in that directory, and subdirectories,
-will be copied to the subproject directory. This can be used for example to add
-`meson.build` files to a project not using Meson build system upstream.
-The patch directory must be placed in `subprojects/packagefiles` directory.
-
-## Patch on all wrap types
-
-`patch_*` keys are not limited to `wrap-file` any more, they can be specified for
-all wrap types.
-
-## link_language argument added to all targets
-
-Previously the `link_language` argument was only supposed to be allowed in
-executables, because the linker used needs to be the linker for the language
-that implements the main function. Unfortunately it didn't work in that case,
-and, even worse, if it had been implemented properly it would have worked for
-*all* targets. In 0.55.0 this restriction has been removed, and the bug fixed.
-It now is valid for `executable` and all derivative of `library`.
-
-## meson dist --no-tests
-
-`meson dist` has a new option `--no-tests` to skip build and tests of generated
-packages. It can be used to not waste time for example when done in CI that
-already does its own testing.
-
-## Force fallback for
-
-A newly-added `--force-fallback-for` command line option can now be used to
-force fallback for specific subprojects.
-
-Example:
-
-```
-meson build --force-fallback-for=foo,bar
-```
-
-## Implicit dependency fallback
-
-`dependency('foo')` now automatically fallback if the dependency is not found on
-the system but a subproject wrap file or directory exists with the same name.
-
-That means that simply adding `subprojects/foo.wrap` is enough to add fallback
-to any `dependency('foo')` call. It is however requires that the subproject call
-`meson.override_dependency('foo', foo_dep)` to specify which dependency object
-should be used for `foo`.
-
-## Wrap file `provide` section
-
-Wrap files can define the dependencies it provides in the `[provide]` section.
-When `foo.wrap` provides the dependency `foo-1.0` any call do `dependency('foo-1.0')`
-will automatically fallback to that subproject even if no `fallback` keyword
-argument is given. See [Wrap documentation](Wrap-dependency-system-manual.md#provide_section).
-
-## `find_program()` fallback
-
-When a program cannot be found on the system but a wrap file has its name in the
-`[provide]` section, that subproject will be used as fallback.
-
-## Test scripts are given the exe wrapper if needed
-
-Meson will now set the `MESON_EXE_WRAPPER` as the properly wrapped and joined
-representation. For Unix-like OSes this means python's shelx.join, on Windows
-an implementation that attempts to properly quote windows argument is used.
-This allow wrapper scripts to run test binaries, instead of just skipping.
-
-for example, if the wrapper is `['emulator', '--script']`, it will be passed
-as `MESON_EXE_WRAPPER="emulator --script"`.
-
-## Added ability to specify backend arguments in `meson compile`
-
-It's now possible to specify backend specific arguments in `meson compile`.
-
-Usage: `meson compile [--vs-args=args] [--ninja-args=args]`
-
-```
-  --ninja-args NINJA_ARGS    Arguments to pass to `ninja` (applied only on `ninja` backend).
-  --vs-args VS_ARGS          Arguments to pass to `msbuild` (applied only on `vs` backend).
-```
-
-These arguments use the following syntax:
-
-If you only pass a single string, then it is considered to have all values separated by commas. Thus invoking the following command:
-
-```
-$ meson compile --ninja-args=-n,-d,explain
-```
-
-would add `-n`, `-d` and `explain` arguments to ninja invocation.
-
-If you need to have commas or spaces in your string values, then you need to pass the value with proper shell quoting like this:
-
-```
-$ meson compile "--ninja-args=['a,b', 'c d']"
-```
-
-## Introspection API changes
-
-dumping the AST (--ast): **new in 0.55.0**
-- prints the AST of a meson.build as JSON
-
-## `--backend=vs` now matches `-Db_vscrt=from_buildtype` behaviour in the Ninja backend
-
-When `--buildtype=debugoptimized` is used with the Ninja backend, the VS CRT
-option used is `/MD`, which is the [behaviour documented for all
-backends](https://mesonbuild.com/Builtin-options.html#b_vscrt-from_buildtype).
-However, the Visual Studio backend was pass `/MT` in that case, which is inconsistent.
-
-If you need to use the MultiThreaded CRT, you should explicitly pass `-Db_vscrt=mt`
diff --git a/meson/docs/markdown/Release-notes.md b/meson/docs/markdown/Release-notes.md
deleted file mode 100644 (file)
index d7de275..0000000
+++ /dev/null
@@ -1 +0,0 @@
-# Release notes
diff --git a/meson/docs/markdown/Release-procedure.md b/meson/docs/markdown/Release-procedure.md
deleted file mode 100644 (file)
index caf4973..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-# Release procedure
-
-**This page is WIP. The following procedure is not yet approved for use**
-
-# Trunk
-
-Meson operates under the principle that trunk should (in theory) be always
-good enough for release. That is, all code merged in trunk must pass all unit
-tests. Any broken code should either be fixed or reverted immediately.
-
-People who are willing to tolerate the occasional glitch should be able to
-use Meson trunk for their day to day development if they so choose.
-
-# Major releases
-
-Major releases are currently in the form 0.X.0, where X is an increasing
-number. We aim to do a major release roughly once a month, though the
-schedule is not set in stone.
-
-Before a major release is made a stable branch will be made, and 0.X.0-rc1
-release candidate will be made. A new milestone for 0.X.0 will be made, and
-all bugs effecting the RC will be assigned to this milestone. Patches fixing
-bugs in the milestone will be picked to the stable branch, and normal
-development will continue on the master branch. Every week after after this a
-new release candidate will be made until all bugs are resolved in that
-milestone. When all of the bugs are fixed the 0.X.0 release will be made.
-
-# Bugfix releases
-
-Bugfix releases contain only minor fixes to major releases and are designated
-by incrementing the last digit of the version number. The criteria for a bug
-fix release is one of the following:
-
- - release has a major regression compared to the previous release (making
-   existing projects unbuildable)
- - the release has a serious bug causing data loss or equivalent
- - other unforeseen major issue
-
-In these cases a bug fix release can be made. It shall contain _only_ the fix
-for the issue (or issues) in question and other minor bug fixes. Only changes
-that have already landed in trunk will be considered for inclusion. No new
-functionality shall be added.
-
-# Requesting a bug fix release
-
-The process for requesting that a bug fix release be made goes roughly as follows:
-
- - file a bug about the core issue
- - file a patch fixing it if possible
- - contact the development team and request a bug fix release (IRC is the
-   preferred contact medium)
-
-The request should contain the following information:
-
- - the issue in question
- - whether it has already caused problems for real projects
- - an estimate of how many people and projects will be affected
-
-There is no need to write a long and complicated request report. Something like the following is sufficient:
-
-> The latest release has a regression where trying to do Foo using Bar
-breaks. This breaks all projects that use both, which includes at least [list
-of affected projects]. This causes problems for X amount of people and
-because of this we should do a bugfix release.
diff --git a/meson/docs/markdown/Reproducible-builds.md b/meson/docs/markdown/Reproducible-builds.md
deleted file mode 100644 (file)
index 1e00fea..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Reproducible builds
-
-A reproducible build means the following (as quoted from [the
-reproducible builds project site](https://reproducible-builds.org/)):
-
-> Reproducible builds are a set of software development practices that
-  create a verifiable path from human readable source code to the
-  binary code used by computers.
-
-Roughly what this means is that if two different people compile the
-project from source, their outputs are bitwise identical to each
-other. This allows people to verify that binaries downloadable from
-the net actually come from the corresponding sources and have not, for
-example, had malware added to them.
-
-Meson aims to support reproducible builds out of the box with zero
-additional work (assuming the rest of the build environment is set up
-for reproducibility). If you ever find a case where this is not
-happening, it is a bug. Please file an issue with as much information
-as possible and we'll get it fixed.
diff --git a/meson/docs/markdown/Rewriter.md b/meson/docs/markdown/Rewriter.md
deleted file mode 100644 (file)
index 6414480..0000000
+++ /dev/null
@@ -1,236 +0,0 @@
----
-short-description: Automatic modification of the build system files
-...
-
-# Meson file rewriter
-
-Since version 0.50.0, meson has the functionality to perform some basic
-modification on the `meson.build` files from the command line. The currently
-supported operations are:
-
-- For build targets:
-  - Add/Remove source files
-  - Add/Remove targets
-  - Modify a select set of kwargs
-  - Print some JSON information
-- For dependencies:
-  - Modify a select set of kwargs
-- For the project function:
-  - Modify a select set of kwargs
-  - Modify the default options list
-
-The rewriter has both, a normal command line interface and a "script mode". The
-normal CLI is mostly designed for everyday use. The "script mode", on the
-other hand, is meant to be used by external programs (IDEs, graphical
-frontends, etc.)
-
-The rewriter itself is considered stable, however the user interface and the
-"script mode" API might change in the future. These changes may also break
-backwards comaptibility to older releases.
-
-We are also open to suggestions for API improvements.
-
-## Using the rewriter
-
-All rewriter functions are accessed via `meson rewrite`. The meson rewriter
-assumes that it is run inside the project root directory. If this isn't the
-case, use `--sourcedir` to specify the actual project source directory.
-
-### Adding and removing sources
-
-The most common operations will probably be the adding and removing of source
-files to a build target. This can be easily done with:
-
-```bash
-meson rewrite target <target name/id> {add/rm} [list of sources]
-```
-
-For instance, given the following example
-
-```meson
-src = ['main.cpp', 'fileA.cpp']
-
-exe1 = executable('testExe', src)
-```
-
-the source `fileB.cpp` can be added with:
-
-```bash
-meson rewrite target testExe add fileB.cpp
-```
-
-After executing this command, the new `meson.build` will look like this:
-
-```meson
-src = ['main.cpp', 'fileA.cpp', 'fileB.cpp']
-
-exe1 = executable('testExe', src)
-```
-
-In this case, `exe1` could also have been used for the target name. This is
-possible because the rewriter also searches for assignments and unique meson
-IDs, which can be acquired with introspection. If there are multiple targets
-with the same name, meson will do nothing and print an error message.
-
-For more information see the help output of the rewriter target command.
-
-### Setting the project version
-
-It is also possible to set kwargs of specific functions with the rewriter. The
-general command for setting or removing kwargs is:
-
-```bash
-meson rewrite kwargs {set/delete} <function type> <function ID> <key1> <value1> <key2> <value2> ...
-```
-
-For instance, setting the project version can be achieved with this command:
-
-```bash
-meson rewrite kwargs set project / version 1.0.0
-```
-
-Currently, only the following function types are supported:
-
-- dependency
-- target (any build target, the function ID is the target name/ID)
-- project (the function ID must be `/` since project() can only be called once)
-
-For more information see the help output of the rewrite kwargs command.
-
-### Setting the project default options
-
-For setting and deleting default options, use the following command:
-
-```bash
-meson rewrite default-options {set/delete} <opt1> <value1> <opt2> <value2> ...
-```
-
-## Limitations
-
-Rewriting a meson file is not guaranteed to keep the indentation of the modified
-functions. Additionally, comments inside a modified statement will be removed.
-Furthermore, all source files will be sorted alphabetically.
-
-For instance adding `e.c` to srcs in the following code
-
-```meson
-# Important comment
-
-srcs = [
-'a.c', 'c.c', 'f.c',
-# something important about b
-       'b.c', 'd.c', 'g.c'
-]
-
-# COMMENT
-```
-
-would result in the following code:
-
-```meson
-# Important comment
-
-srcs = [
-  'a.c',
-  'b.c',
-  'c.c',
-  'd.c',
-  'e.c',
-  'f.c',
-  'g.c'
-]
-
-# COMMENT
-```
-
-## Using the "script mode"
-
-The "script mode" should be the preferred API for third party programs, since
-it offers more flexibility and higher API stability. The "scripts" are stored
-in JSON format and executed with `meson rewrite command <JSON file or string>`.
-
-The JSON format is defined as follows:
-
-```json
-[
-  {
-    "type": "function to execute",
-    ...
-  }, {
-    "type": "other function",
-    ...
-  },
-  ...
-]
-```
-
-Each object in the main array must have a `type` entry which specifies which
-function should be executed.
-
-Currently, the following functions are supported:
-
-- target
-- kwargs
-- default_options
-
-### Target modification format
-
-The format for the type `target` is defined as follows:
-
-```json
-{
-  "type": "target",
-  "target": "target ID/name/assignment variable",
-  "operation": "one of ['src_add', 'src_rm', 'target_rm', 'target_add', 'info']",
-  "sources": ["list", "of", "source", "files", "to", "add, remove"],
-  "subdir": "subdir where the new target should be added (only has an effect for operation 'tgt_add')",
-  "target_type": "function name of the new target -- same as in the CLI (only has an effect for operation 'tgt_add')"
-}
-```
-
-The keys `sources`, `subdir` and `target_type` are optional.
-
-### kwargs modification format
-
-The format for the type `target` is defined as follows:
-
-```json
-{
-  "type": "kwargs",
-  "function": "one of ['dependency', 'target', 'project']",
-  "id": "function ID",
-  "operation": "one of ['set', 'delete', 'add', 'remove', 'remove_regex', 'info']",
-  "kwargs": {
-    "key1": "value1",
-    "key2": "value2",
-    ...
-  }
-}
-```
-
-### Default options modification format
-
-The format for the type `default_options` is defined as follows:
-
-```json
-{
-  "type": "default_options",
-  "operation": "one of ['set', 'delete']",
-  "options": {
-    "opt1": "value1",
-    "opt2": "value2",
-    ...
-  }
-}
-```
-
-For operation `delete`, the values of the `options` can be anything (including `null`)
-
-## Extracting information
-
-The rewriter also offers operation `info` for the types `target` and `kwargs`.
-When this operation is used, meson will print a JSON dump to stderr, containing
-all available information to the rewriter about the build target / function
-kwargs in question.
-
-The output format is currently experimental and may change in the future.
diff --git a/meson/docs/markdown/Run-targets.md b/meson/docs/markdown/Run-targets.md
deleted file mode 100644 (file)
index b584bf7..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
----
-short-description: Targets to run external commands
-...
-
-# Run targets
-
-Sometimes you need to have a target that just runs an external command. As an example you might have a build target that reformats your source code, runs `cppcheck` or something similar. In Meson this is accomplished with a so called *run target*.
-
-The recommended way of doing this is writing the command(s) you want to run to a script file. Here's an example script.
-
-```bash
-#!/bin/sh
-
-cd "${MESON_SOURCE_ROOT}"
-inspector_command -o "${MESON_BUILD_ROOT}/inspection_result.txt"
-```
-
-Note the two environment variables `MESON_SOURCE_ROOT` and `MESON_BUILD_ROOT`. These are absolute paths to your project's source and build directories and they are automatically set up by Meson. In addition to these Meson also sets up the variable `MESON_SUBDIR`, which points to the subdirectory where the run command was specified. Most commands don't need to set up this.
-
-Note how the script starts by cd'ing into the source dir. Meson does not guarantee that the script is run in any specific directory. Whether you need to do the same depends on what your custom target wants to do.
-
-To make this a run target we write it to a script file called `scripts/inspect.sh` and specify it in the top level Meson file like this.
-
-```meson
-run_target('inspector',
-  command : 'scripts/inspect.sh')
-```
-
-Run targets are not run by default. To run it run the following command.
-
-```console
-$ meson compile inspector
-```
-
-All additional entries in `run_target`'s `command` array are passed unchanged to the inspector script, so you can do things like this:
-
-```meson
-run_target('inspector',
-  command : ['scripts/inspect.sh', '--exclude', 'tests'])
-```
diff --git a/meson/docs/markdown/Running-Meson.md b/meson/docs/markdown/Running-Meson.md
deleted file mode 100644 (file)
index 326ecb9..0000000
+++ /dev/null
@@ -1,198 +0,0 @@
----
-short-description: Building a project with Meson
-...
-
-# Running Meson
-
-There are two different ways of invoking Meson. First, you can run it directly
-from the source tree with the command `/path/to/source/meson.py`. Meson may
-also be installed in which case the command is simply `meson`. In this manual
-we only use the latter format for simplicity.
-
-At the time of writing only a command line version of Meson is available. This
-means that Meson must be invoked using the terminal. If you wish to use the
-MSVC compiler, you need to run Meson under "Visual Studio command prompt".
-
-All available meson commands are listed on the [commands reference page](Commands.md).
-
-## Configuring the build directory
-
-Let us assume that we have a source tree that has a Meson build system. This
-means that at the topmost directory has a file called `meson.build`. We run the
-following commands to get the build started.
-
-```sh
-cd /path/to/source/root
-meson setup builddir
-```
-
-We invoke Meson with the `setup` command, giving it the location of the build
-directory. Meson uses [out of source
-builds](http://voices.canonical.com/jussi.pakkanen/2013/04/16/why-you-should-consider-using-separate-build-directories/).
-
-Hint: The syntax of meson is `meson [command] [arguments] [options]`. The
-`setup` command takes a `builddir` and a `srcdir` argument. If no `srcdir` is
-given Meson will deduce the `srcdir` based on `pwd` and the location of
-`meson.build`.
-
-Meson then loads the build configuration file and writes the corresponding
-build backend in the build directory. By default Meson generates a *debug
-build*, which turns on basic warnings and debug information and disables
-compiler optimizations.
-
-Additionally, the invocation can pass options to meson. The list of options is
-documented [here](Builtin-options.md).
-
-You can specify a different type of build with the `--buildtype` command line
-argument. It can have one of the following values.
-
-| value            | meaning                                                                                                                                                    |
-| ------           | --------                                                                                                                                                   |
-| `plain`          | no extra build flags are used, even for compiler warnings, useful for distro packagers and other cases where you need to specify all arguments by yourself |
-| `debug`          | debug info is generated but the result is not optimized, this is the default                                                                               |
-| `debugoptimized` | debug info is generated and the code is optimized (on most compilers this means `-g -O2`)                                                                  |
-| `release`        | full optimization, no debug info                                                                                                                           |
-
-The build directory is mandatory. The reason for this is that it simplifies the
-build process immensely. Meson will not under any circumstances write files
-inside the source directory (if it does, it is a bug and should be fixed). This
-means that the user does not need to add a bunch of files to their revision
-control's ignore list. It also means that you can create arbitrarily many build
-directories for any given source tree.
-
-For example, if we wanted to test building the source code with the Clang
-compiler instead of the system default, we could just type the following
-commands:
-
-```sh
-cd /path/to/source/root
-CC=clang CXX=clang++ meson setup buildclang
-```
-
-This separation is even more powerful if your code has multiple configuration
-options (such as multiple data backends). You can create a separate
-subdirectory for each of them. You can also have build directories for
-optimized builds, code coverage, static analysis and so on. They are all neatly
-separated and use the same source tree. Changing between different
-configurations is just a question of changing to the corresponding directory.
-
-Unless otherwise mentioned, all following command line invocations are meant to
-be run in the source directory.
-
-By default Meson will use the Ninja backend to build your project. If you wish
-to use any of the other backends, you need to pass the corresponding argument
-during configuration time. As an example, here is how you would use Meson to
-generate a Visual studio solution.
-
-```sh
-meson setup <build dir> --backend=vs
-```
-
-You can then open the generated solution with Visual Studio and compile it in
-the usual way. A list of backends can be obtained with `meson setup --help`.
-
-## Environment variables
-
-Sometimes you want to add extra compiler flags, this can be done by passing
-them in environment variables when calling meson. See [the reference
-tables](Reference-tables.md#compiler-and-linker-flag-envrionment-variables) for
-a list of all the environment variables. Be aware however these environment
-variables are only used for the native compiler and will not affect the
-compiler used for cross-compiling, where the flags specified in the cross file
-will be used.
-
-Furthermore it is possible to stop meson from adding flags itself by using the
-`--buildtype=plain` option, in this case you must provide the full compiler and
-linker arguments needed.
-
-## Building from the source
-
-To start the build, simply type the following command.
-
-```sh
-meson compile -C builddir
-```
-
-See [`meson compile` description](Commands.md#compile) for more info.
-
-### Building directly with ninja
-
-By default Meson uses the [Ninja build system](https://ninja-build.org/) to 
-actually build the code. To start the build, simply type the following command.
-
-```sh
-ninja -C builddir
-```
-
-The main usability difference between Ninja and Make is that Ninja will
-automatically detect the number of CPUs in your computer and parallelize itself
-accordingly. You can override the amount of parallel processes used with the
-command line argument `-j <num processes>`.
-
-It should be noted that after the initial configure step `ninja` is the only
-command you ever need to type to compile. No matter how you alter your source
-tree (short of moving it to a completely new location), Meson will detect the
-changes and regenerate itself accordingly. This is especially handy if you have
-multiple build directories. Often one of them is used for development (the
-"debug" build) and others only every now and then (such as a "static analysis"
-build). Any configuration can be built just by `cd`'ing to the corresponding
-directory and running Ninja.
-
-## Running tests
-
-Meson provides native support for running tests. The command to do that is
-simple.
-
-```sh
-meson test -C builddir
-```
-
-See [`meson test` description](Commands.md#test) for more info.
-
-Meson does not force the use of any particular testing framework. You are free
-to use GTest, Boost Test, Check or even custom executables.
-
-Note: it can be also invoked directly with ninja with the following command:
-```sh
-ninja -C builddir test
-```
-
-## Installing
-
-Installing the built software is just as simple.
-
-```sh
-meson install -C builddir
-```
-
-See [`meson install` description](Commands.md#install) for more info.
-
-Note that Meson will only install build targets explicitly tagged as
-installable, as detailed in the [installing targets
-documentation](Installing.md).
-
-By default Meson installs to `/usr/local`. This can be changed by passing the
-command line argument `--prefix /your/prefix` to Meson during configure time.
-Meson also supports the `DESTDIR` variable used in e.g. building packages. It
-is used like this:
-
-```sh
-DESTDIR=/path/to/staging meson install -C builddir
-```
-
-Note: it can be also invoked directly with ninja with the following command:
-```sh
-ninja -C builddir install
-```
-
-## Command line help
-
-Meson has a standard command line help feature. It can be accessed with the
-following command.
-
-    meson --help
-
-## Exit status
-
-Meson exits with status 0 if successful, 1 for problems with the command line
-or meson.build file, and 2 for internal errors.
diff --git a/meson/docs/markdown/Shipping-prebuilt-binaries-as-wraps.md b/meson/docs/markdown/Shipping-prebuilt-binaries-as-wraps.md
deleted file mode 100644 (file)
index bac19f9..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-# Shipping prebuilt binaries as wraps
-
-A common dependency case, especially on Windows, is the need to provide dependencies as prebuilt binaries rather than Meson projects that you build from scratch. Common reasons include not having access to source code, not having the time and effort to rewrite a legacy system's build definitions to Meson or just the fact that compiling the dependency projects takes too long.
-
-Packaging a project is straightforward. As an example let's look at a case where the project consists of one static library called `bob` and some headers. To create a binary dependency project we put the static library at the top level and headers in a subdirectory called `include`. The Meson build definition would look like the following.
-
-```meson
-project('binary dep', 'c')
-
-cc = meson.get_compiler('c')
-bin_dep = declare_dependency(
-  dependencies : cc.find_library('bob', dirs : meson.current_source_dir()),
-  include_directories : include_directories('include'))
-```
-
-Now you can use this subproject as if it was a Meson project:
-
-```meson
-project('using dep', 'c')
-bob_dep = subproject('bob').get_variable('bin_dep')
-executable('prog', 'prog.c', dependencies : bob_dep)
-```
-
-Note that often libraries compiled with different compilers (or even compiler flags) might not be compatible. If you do this, then you are responsible for verifying that your libraries are compatible, Meson will not check things for you.
diff --git a/meson/docs/markdown/Simd-module.md b/meson/docs/markdown/Simd-module.md
deleted file mode 100644 (file)
index 0fd1dda..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-# Unstable SIMD module
-
-This module provides helper functionality to build code with SIMD instructions.
-Available since 0.42.0.
-
-**Note**: this module is unstable. It is only provided as a technology preview.
-Its API may change in arbitrary ways between releases or it might be removed
-from Meson altogether.
-
-## Usage
-
-This module is designed for the use case where you have an algorithm with one
-or more SIMD implementation and you choose which one to use at runtime.
-
-The module provides one method, `check`, which is used like this:
-
-    rval = simd.check('mysimds',
-      mmx : 'simd_mmx.c',
-      sse : 'simd_sse.c',
-      sse2 : 'simd_sse2.c',
-      sse3 : 'simd_sse3.c',
-      ssse3 : 'simd_ssse3.c',
-      sse41 : 'simd_sse41.c',
-      sse42 : 'simd_sse42.c',
-      avx : 'simd_avx.c',
-      avx2 : 'simd_avx2.c',
-      neon : 'simd_neon.c',
-      compiler : cc)
-
-Here the individual files contain the accelerated versions of the functions
-in question. The `compiler` keyword argument takes the compiler you are
-going to use to compile them. The function returns an array with two values.
-The first value is a bunch of libraries that contain the compiled code. Any
-SIMD code that the compiler can't compile (for example, Neon instructions on
-an x86 machine) are ignored. You should pass this value to the desired target
-using `link_with`. The second value is a `configuration_data` object that
-contains true for all the values that were supported. For example if the
-compiler did support sse2 instructions, then the object would have `HAVE_SSE2`
-set to 1.
-
-Generating code to detect the proper instruction set at runtime is
-straightforward. First you create a header with the configuration object and
-then a chooser function that looks like this:
-
-    void (*fptr)(type_of_function_here)  = NULL;
-
-    #if HAVE_NEON
-    if(fptr == NULL && neon_available()) {
-        fptr = neon_accelerated_function;
-    }
-    #endif
-    #if HAVE_AVX2
-    if(fptr == NULL && avx2_available()) {
-        fptr = avx_accelerated_function;
-    }
-    #endif
-
-    ...
-
-    if(fptr == NULL) {
-        fptr = default_function;
-    }
-
-Each source file provides two functions, the `xxx_available` function to query
-whether the CPU currently in use supports the instruction set and
-`xxx_accelerated_function` that is the corresponding accelerated
-implementation.
-
-At the end of this function the function pointer points to the fastest
-available implementation and can be invoked to do the computation.
diff --git a/meson/docs/markdown/Simple-comparison.md b/meson/docs/markdown/Simple-comparison.md
deleted file mode 100644 (file)
index 5ac90e4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# A simple comparison
-
-In this experiment we generated one thousand C files with contents that looked like this.
-
-```c
-#include<stdio.h>
-#include"header.h"
-
-int func23() { return 0; }
-```
-
-The function number was different in each file. In addition there was a main C file that just called each function in turn. We then generated build system files for *Meson*, *CMake*, *SCons*, *Premake* and *Autotools* that compiled these files into a single executable.
-
-With this we measured three different things. The first is configuration time, that is, the time the build system takes to generate necessary build files. This is usually called the *configure step*. The time was measured in seconds.
-
-The second thing to measure was the build time. This should be limited by the compiler and in the optimal case should be the same for every build system. Four parallel processes were used in this test.
-
-The third thing we measured was the empty build time. This measures how much time the build system takes to check the states of all source files because if any of them could potentially cause a rebuild.
-
-Since CMake has two different backends, Make and Ninja, we ran the tests on both of them. All tests were run on a 2011 era Macbook Pro running Ubuntu 13/04. The tests were run multiple times and we always took the fastest time.
-
-Here are the results for configuration time.
-
-![Configuration times](images/conftime.png)
-
-The reason SCons got zero seconds on this test is because you cannot separate configure and build steps. They run as one unit. Autotools is the clear loser of this test as it is over an order of magnitude slower than the second slowest one. This configuration time includes both autogen and configure. All other systems take less than one second to do this setup, which is fast enough for a human being to interpret as instantaneous.
-
-![Build times](https://raw.githubusercontent.com/wiki/jpakkane/meson/buildtime.png)
-
-Build times are a bit more even. SCons is the slowest, being almost ten seconds slower than the second slowest. Some of it is work from the configure step but it still has the worst performance. Premake is the fastest Make-based build system narrowly beating out Autotools. Both Ninja-based build systems are faster than all non-Ninja ones with Meson being slightly faster. In practice the difference is minimal. The advantages of Ninja can be seen by comparing CMake's times when using Make or Ninja. It is possible to shave off 3.5 seconds (over 20%) of the total build time just by changing the backend. The project's CMake configuration files don't need any changes.
-
-![No-op time](https://raw.githubusercontent.com/wiki/jpakkane/meson/emptytime.png)
-
-Empty build times reflect the performance of regular build times. SCons is again the slowest taking over three seconds compared to Meson, which takes only 0.03 seconds, a difference of two orders of magnitude. Even Autotools, the fastest Make-based system, is almost one order of magnitude slower. Ninja holds the top spots just like in the previous test.
-
-Conclusions
------
-
-Build system performance matters. Even with this extremely simple example we can find differences between various popular build systems. As the project size increases, these differences grow even larger. (The author has witnessed no-op build times of 30 seconds for Make versus less than one second for Ninja when compiling the Clang compiler.) Keeping incremental build times low is one of the major keys of programmer productivity as it allows developers to iterate faster and stay in the creative zone.
-
-Original scripts
------
-
-Those who want to run these experiments themselves can download the scripts here:
-
-* [Generator script](https://raw.githubusercontent.com/wiki/jpakkane/meson/gen_src.py)
-* [Measurement script](https://raw.githubusercontent.com/wiki/jpakkane/meson/measure.py)
diff --git a/meson/docs/markdown/SourceSet-module.md b/meson/docs/markdown/SourceSet-module.md
deleted file mode 100644 (file)
index 4b34ff7..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
----
-short-description: Source set module
-authors:
-    - name: Paolo Bonzini
-      email: pbonzini@redhat.com
-      years: [2019]
-...
-
-# Source set module
-
-This module provides support for building many targets against a single set
-of files; the choice of which files to include in each target depends on the
-contents of a dictionary or a `configuration_data` object.  The module can
-be loaded with:
-
-``` meson
-ssmod = import('sourceset')
-```
-
-A simple example of using the module looks like this:
-
-``` meson
-ss = ssmod.source_set()
-# Include main.c unconditionally
-ss.add(files('main.c'))
-# Include a.c if configuration key FEATURE1 is true
-ss.add(when: 'FEATURE1', if_true: files('a.c'))
-# Include zlib.c if the zlib dependency was found, and link zlib
-# in the executable
-ss.add(when: zlib, if_true: files('zlib.c'))
-# many more rules here...
-ssconfig = ss.apply(config)
-executable('exe', sources: ssconfig.sources(),
-           dependencies: ssconfig.dependencies())
-```
-
-and it would be equivalent to
-
-``` meson
-sources = files('main.c')
-dependencies = []
-if config['FEATURE1'] then
-    sources += [files('a.c')]
-endif
-if zlib.found() then
-    sources += [files('zlib.c')]
-    dependencies += [zlib]
-endif
-# many more "if"s here...
-executable('exe', sources: sources, dependencies: dependencies())
-```
-
-Sourcesets can be used with a single invocation of the `apply` method,
-similar to the example above, but the module is especially useful
-when multiple executables are generated by applying the same rules to
-many different configurations.
-
-*Added 0.51.0*
-
-## Functions
-
-### `source_set()`
-
-``` meson
-ssmod.source_set()
-```
-
-Create and return a new source set object.
-
-**Returns**: a [source set][`source_set` object]
-
-## `source_set` object
-
-The `source_set` object provides methods to add files to a source set and
-to query it.  The source set becomes immutable after any method but `add`
-is called.
-
-### Methods
-
-#### `add()`
-
-``` meson
-source_set.add([when: varnames_and_deps],
-               [if_true: sources_and_deps],
-               [if_false: list_of_alt_sources])
-source_set.add(sources_and_deps)
-```
-
-Add a *rule* to a source set.  A rule determines the conditions under which
-some source files or dependency objects are included in a build configuration.
-All source files must be present in the source tree or they can be created
-in the build tree via `configure_file`, `custom_target` or `generator`.
-
-`varnames_and_deps` is a list of conditions for the rule, which can be
-either strings or dependency objects (a dependency object is anything that
-has a `found()` method).  If *all* the strings evaluate to true and all
-dependencies are found, the rule will evaluate to true; `apply()`
-will then include the contents of the `if_true` keyword argument in its
-result.  Otherwise, that is if any of the strings in the positional
- arguments evaluate to false or any dependency is not found, `apply()`
-will instead use the contents of the `if_false` keyword argument.
-
-Dependencies can also appear in `sources_and_deps`.  In this case, a
-missing dependency will simply be ignored and will *not* disable the rule,
-similar to how the `dependencies` keyword argument works in build targets.
-
-**Note**: It is generally better to avoid mixing source sets and disablers.
-This is because disablers will cause the rule to be dropped altogether,
-and the `list_of_alt_sources` would not be taken into account anymore.
-
-#### `add_all()`
-
-``` meson
-source_set.add_all(when: varnames_and_deps,
-                   if_true: [source_set1, source_set2, ...])
-source_set.add_all(source_set1, source_set2, ...)
-```
-
-Add one or more source sets to another.
-
-For each source set listed in the arguments, `apply()` will
-consider their rules only if the conditions in `varnames_and_deps` are
-evaluated positively.  For example, the following:
-
-``` meson
-sources_b = ssmod.source_set()
-sources_b.add(when: 'HAVE_A', if_true: 'file.c')
-sources = ssmod.source_set()
-sources.add_all(when: 'HAVE_B', if_true: sources_b)
-```
-
-is equivalent to:
-
-``` meson
-sources = ssmod.source_set()
-sources.add(when: ['HAVE_A', 'HAVE_B'], if_true: 'file.c')
-```
-
-#### `all_sources()`
-
-``` meson
-list source_set.all_sources(...)
-```
-
-Returns a list of all sources that were placed in the source set using
-`add` (including nested source sets) and that do not have a not-found
-dependency.  If a rule has a not-found dependency, only the `if_false`
-sources are included (if any).
-
-**Returns**: a list of file objects
-
-#### `all_dependencies()` *(since 0.52.0)*
-
-``` meson
-list source_set.all_dependencies(...)
-```
-
-Returns a list of all dependencies that were placed in the source set
-using `add` (including nested source sets) and that were found.
-
-**Returns**: a list of dependencies
-
-#### `apply()`
-
-``` meson
-source_files source_set.apply(conf_data[, strict: false])
-```
-
-Match the source set against a dictionary or a `configuration_data` object
-and return a *source configuration* object.  A source configuration object
-allows you to retrieve the sources and dependencies for a specific configuration.
-
-By default, all the variables that were specified in the rules have to
-be present in `conf_data`.  However, in some cases the convention is
-that `false` configuration symbols are absent in `conf_data`; this is
-the case for example when the configuration was loaded from a Kconfig file.
-In that case you can specify the `strict: false` keyword argument, which
-will treat absent variables as false.
-
-**Returns**: a [source configuration][`source_configuration` object]
-
-## `source_configuration` object
-
-The `source_configuration` object provides methods to query the result of an
-`apply` operation on a source set.
-
-### Methods
-
-#### `sources()`
-
-``` meson
-source_config.sources()
-```
-
-Return the source files corresponding to the applied configuration.
-
-**Returns**: a list of file objects
-
-#### `dependencies()`
-
-``` meson
-source_config.dependencies()
-```
-
-Return the dependencies corresponding to the applied configuration.
-
-**Returns**: a list of dependency objects
diff --git a/meson/docs/markdown/Style-guide.md b/meson/docs/markdown/Style-guide.md
deleted file mode 100644 (file)
index 960e60c..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
----
-short-description: Style recommendations for Meson files
-...
-
-# Style recommendations
-
-This page lists some recommendations on organizing and formatting your
-Meson build files.
-
-## Tabs or spaces?
-
-Always spaces.
-
-## Naming Variable
-
-The most consistent naming convention is the snake case. Let say you would
-like to refer to your executable so something like `my_exe` would work or
-just `exe`.
-
-## Naming options
-
-There are two ways of naming project options. As an example for
-booleans the first one is `foo` and the second one is
-`enable-foo`. The former style is recommended, because in Meson
-options have strong type, rather than being just strings.
-
-You should try to name options the same as is common in other
-projects. This is especially important for yielding options, because
-they require that both the parent and subproject options have the same
-name.
-
-# Global arguments
-
-Prefer `add_project_arguments` to `add_global_arguments` because using
-the latter prevents using the project as a subproject.
-
-# Cross compilation arguments
-
-Try to keep cross compilation arguments away from your build files as
-much as possible. Keep them in the cross file instead. This adds
-portability, since all changes needed to compile to a different
-platform are isolated in one place.
-
-# Sorting source paths
-
-The source file arrays should all be sorted. This makes it easier to spot
-errors and often reduces merge conflicts. Furthermore, the paths should be
-sorted with a natural sorting algorithm, so that numbers are sorted in an
-intuitive way (`1, 2, 3, 10, 20` instead of `1, 10, 2, 20, 3`).
-
-Numbers should also be sorted before characters (`a111` before `ab0`).
-Furthermore, strings should be sorted case insensitive.
-
-Additionally, if a path contains a directory it should be sorted before
-normal files. This rule also applies recursively for subdirectories.
-
-The following example shows correct source list definition:
-
-```meson
-sources = files([
-  'aaa/a1.c',
-  'aaa/a2.c',
-  'bbb/subdir1/b1.c',
-  'bbb/subdir2/b2.c',
-  'bbb/subdir10/b3.c',
-  'bbb/subdir20/b4.c',
-  'bbb/b5.c',
-  'bbb/b6.c',
-  'f1.c',
-  'f2.c',
-  'f10.c',
-  'f20.c'
-])
-```
diff --git a/meson/docs/markdown/Subprojects.md b/meson/docs/markdown/Subprojects.md
deleted file mode 100644 (file)
index 02a83e6..0000000
+++ /dev/null
@@ -1,337 +0,0 @@
----
-short-description: Using meson projects as subprojects within other meson projects
-...
-
-# Subprojects
-
-Some platforms do not provide a native packaging system. In these
-cases it is common to bundle all third party libraries in your source
-tree. This is usually frowned upon because it makes it hard to add
-these kinds of projects into e.g. those Linux distributions that
-forbid bundled libraries.
-
-Meson tries to solve this problem by making it extremely easy to
-provide both at the same time. The way this is done is that Meson
-allows you to take any other Meson project and make it a part of your
-build without (in the best case) any changes to its Meson setup. It
-becomes a transparent part of the project.
-
-It should be noted that this is only guaranteed to work for subprojects
-that are built with Meson. The reason is the simple fact that there is
-no possible way to do this reliably with mixed build systems. Because of
-this, only meson subprojects are described here.
-[CMake based subprojects](CMake-module.md#cmake-subprojects) are also
-supported but not guaranteed to work.
-
-## A subproject example
-
-Usually dependencies consist of some header files plus a library to link against.
-To declare this internal dependency use `declare_dependency` function.
-
-As an example, suppose we have a simple project that provides a shared
-library. Its `meson.build` would look like this.
-
-```meson
-project('libsimple', 'c')
-
-inc = include_directories('include')
-libsimple = shared_library('simple',
-  'simple.c',
-  include_directories : inc,
-  install : true)
-
-libsimple_dep = declare_dependency(include_directories : inc,
-  link_with : libsimple)
-```
-
-### Naming convention for dependency variables
-
-Ideally the dependency variable name should be of `<project_name>_dep` form.
-This way one can just use it without even looking inside build definitions of that subproject.
-
-In cases where there are multiple dependencies need to be declared, the default one
-should be named as `<project_name>_dep` (e.g. `gtest_dep`), and others can have
-`<project_name>_<other>_<name>_dep` form (e.g. `gtest_main_dep` - gtest with main function).
-
-There may be exceptions to these rules where common sense should be applied.
-
-### Adding variables to the dependency
-
-*New in 0.54.0*
-
-In some cases a project may define special variables via pkg-config or cmake
-that a caller needs to know about. Meson provides a `dependency.get_variable`
-method to hide what kind of dependency is provided, and this is available to
-subprojects as well. Use the `variables` keyword to add a dict of strings:
-
-```meson
-my_dep = declare_dependency(..., variables : {'var': 'value', 'number': '3'})
-```
-
-Which another project can access via:
-
-```meson
-var = my_dep.get_variable(internal : 'var', cmake : 'CMAKE_VAR')
-```
-
-The values of the dict must be strings, as pkg-config and cmake will return
-variables as strings.
-
-### Build options in subproject
-
-All Meson features of the subproject, such as project options keep
-working and can be set in the master project. There are a few
-limitations, the most important being that global compiler arguments
-must be set in the main project before calling subproject. Subprojects
-must not set global arguments because there is no way to do that
-reliably over multiple subprojects. To check whether you are running
-as a subproject, use the `is_subproject` function.
-
-## Using a subproject
-
-All subprojects must be inside `subprojects` directory.
-The `subprojects` directory must be at the top level of your project.
-Subproject declaration must be in your top level `meson.build`.
-
-### A simple example
-
-Let's use `libsimple` as a subproject.
-
-At the top level of your project create `subprojects` directory.
-Then copy `libsimple` into `subprojects` directory.
-
-Your project's `meson.build` should look like this.
-
-```meson
-project('my_project', 'cpp')
-
-libsimple_proj = subproject('libsimple')
-libsimple_dep = libsimple_proj.get_variable('libsimple_dep')
-
-executable('my_project',
-  'my_project.cpp',
-  dependencies : libsimple_dep,
-  install : true)
-```
-
-Note that the subproject object is *not* used as the dependency, but
-rather you need to get the declared dependency from it with
-`get_variable` because a subproject may have multiple declared
-dependencies.
-
-### Toggling between system libraries and embedded sources
-
-When building distro packages it is very important that you do not
-embed any sources. Some distros have a rule forbidding embedded
-dependencies so your project must be buildable without them or
-otherwise the packager will hate you.
-
-Here's how you would use system libraries and fall back to embedding sources
-if the dependency is not available.
-
-```meson
-project('my_project', 'cpp')
-
-libsimple_dep = dependency('libsimple', required : false)
-
-if not libsimple_dep.found()
-  libsimple_proj = subproject('libsimple')
-  libsimple_dep = libsimple_proj.get_variable('libsimple_dep')
-endif
-
-executable('my_project',
-  'my_project.cpp',
-  dependencies : libsimple_dep,
-  install : true)
-```
-
-Because this is such a common operation, Meson provides a shortcut for
-this use case.
-
-```meson
-dep = dependency('foo', fallback : [subproject_name, variable_name])
-```
-
-The `fallback` keyword argument takes two items, the name of the
-subproject and the name of the variable that holds the dependency. If
-you need to do something more complicated, such as extract several
-different variables, then you need to do it yourself with the manual
-method described above.
-
-Using this shortcut the build definition would look like this.
-
-```meson
-project('my_project', 'cpp')
-
-libsimple_dep = dependency('libsimple', fallback : ['libsimple', 'libsimple_dep'])
-
-executable('my_project',
-  'my_project.cpp',
-  dependencies : libsimple_dep,
-  install : true)
-```
-
-With this setup when libsimple is provided by the system, we use it. When
-that is not the case we use the embedded version (the one from subprojects).
-
-Note that `libsimple_dep` can point to an external or an internal dependency but
-you don't have to worry about their differences. Meson will take care
-of the details for you.
-
-### Subprojects depending on other subprojects
-
-Subprojects can use other subprojects, but all subprojects must reside
-in the top level `subprojects` directory. Recursive use of subprojects
-is not allowed, though, so you can't have subproject `a` that uses
-subproject `b` and have `b` also use `a`.
-
-## Obtaining subprojects
-
-Meson ships with a dependency system to automatically obtain
-dependency subprojects. It is documented in the [Wrap dependency
-system manual](Wrap-dependency-system-manual.md).
-
-## Command-line options
-
-The usage of subprojects can be controlled by users and distros with
-the following command-line options:
-
-* **--wrap-mode=nodownload**
-
-    Meson will not use the network to download any subprojects or
-    fetch any wrap information. Only pre-existing sources will be used.
-    This is useful (mostly for distros) when you want to only use the
-    sources provided by a software release, and want to manually handle
-    or provide missing dependencies.
-
-* **--wrap-mode=nofallback**
-
-    Meson will not use subproject fallbacks for any dependency
-    declarations in the build files, and will only look for them in the
-    system. Note that this does not apply to unconditional subproject()
-    calls, and those are meant to be used for sources that cannot be
-    provided by the system, such as copylibs.
-
-    This option may be overriden by `--force-fallback-for` for specific
-    dependencies.
-
-* **--wrap-mode=forcefallback**
-
-    Meson will not look at the system for any dependencies which have
-    subproject fallbacks available, and will *only* use subprojects for
-    them. This is useful when you want to test your fallback setup, or
-    want to specifically build against the library sources provided by
-    your subprojects.
-
-* **--force-fallback-for=list,of,dependencies**
-
-    Meson will not look at the system for any dependencies listed there,
-    provided a fallback was supplied when the dependency was declared.
-
-    This option takes precedence over `--wrap-mode=nofallback`, and when
-    used in combination with `--wrap-mode=nodownload` will only work
-    if the dependency has already been downloaded.
-
-    This is useful when your project has many fallback dependencies,
-    but you only want to build against the library sources for a few
-    of them.
-
-    **Warning**: This could lead to mixing system and subproject version of the
-    same library in the same process. Take this case as example:
-    - Libraries `glib-2.0` and `gstreamer-1.0` are installed on your system.
-    - `gstreamer-1.0` depends on `glib-2.0`, pkg-config file `gstreamer-1.0.pc`
-      has `Requires: glib-2.0`.
-    - In your application build definition you do:
-      ```meson
-      executable('app', ...,
-        dependencies: [
-          dependency('glib-2.0', fallback: 'glib'),
-          dependency('gstreamer-1.0', fallback: 'gstreamer')],
-      )
-      ```
-    - You configure with `--force-fallback-for=glib`.
-    This result in linking to two different versions of library `glib-2.0`
-    because `dependency('glib-2.0', fallback: 'glib')` will return the
-    subproject dependency, but `dependency('gstreamer-1.0', fallback: 'gstreamer')`
-    will not fallback and return the system dependency, including `glib-2.0`
-    library. To avoid that situation, every dependency that itself depend on
-    `glib-2.0` must also be forced to fallback, in this case with
-    `--force-fallback-for=glib,gsteamer`.
-
-## Download subprojects
-
-*Since 0.49.0*
-
-Meson will automatically download needed subprojects during configure, unless
-**--wrap-mode=nodownload** option is passed. It is sometimes preferable to
-download all subprojects in advance, so the meson configure can be performed
-offline. The command-line `meson subprojects download` can be used for that, it
-will download all missing subprojects, but will not update already fetched
-subprojects.
-
-## Update subprojects
-
-*Since 0.49.0*
-
-Once a subproject has been fetched, Meson will not update it automatically.
-For example if the wrap file tracks a git branch, it won't pull latest commits.
-
-To pull latest version of all your subprojects at once, just run the command:
-`meson subprojects update`.
-- If the wrap file comes from wrapdb, the latest version of the wrap file will
-  be pulled and used next time meson reconfigure the project. This can be
-  triggered using `meson --reconfigure`. Previous source tree is not deleted, to
-  prevent from any loss of local changes.
-- If the wrap file points to a git commit or tag, a checkout of that commit is
-  performed.
-- If the wrap file points to a git branch, and the current branch has the same
-  name, a `git pull` is performed.
-- If the wrap file points to a git branch, and the current branch is different,
-  it is skipped. Unless `--rebase` option is passed in which case
-  `git pull --rebase` is performed.
-
-## Start a topic branch across all git subprojects
-
-*Since 0.49.0*
-
-The command-line `meson subprojects checkout <branch_name>` will checkout a
-branch, or create one with `-b` argument, in every git subprojects. This is
-useful when starting local changes across multiple subprojects. It is still your
-responsibility to commit and push in each repository where you made local
-changes.
-
-To come back to the revision set in wrap file (i.e. master), just run
-`meson subprojects checkout` with no branch name.
-
-## Execute a command on all subprojects
-
-*Since 0.51.0*
-
-The command-line `meson subprojects foreach <command> [...]` will
-execute a command in each subproject directory. For example this can be useful
-to check the status of subprojects (e.g. with `git status` or `git diff`) before
-performing other actions on them.
-
-## Why must all subprojects be inside a single directory?
-
-There are several reasons.
-
-First of all, to maintain any sort of sanity, the system must prevent going
-inside other subprojects with `subdir()` or variations thereof. Having the
-subprojects in well defined places makes this easy. If subprojects could be
-anywhere at all, it would be a lot harder.
-
-Second of all it is extremely important that end users can easily see what
-subprojects any project has. Because they are in one, and only one, place,
-reviewing them becomes easy.
-
-This is also a question of convention. Since all Meson projects have the same
-layout w.r.t subprojects, switching between projects becomes easier. You don't
-have to spend time on a new project traipsing through the source tree looking
-for subprojects. They are always in the same place.
-
-Finally if you can have subprojects anywhere, this increases the possibility of
-having many different (possibly incompatible) versions of a dependency in your
-source tree. Then changing some code (such as changing the order you traverse
-directories) may cause a completely different version of the subproject to be
-used by accident.
diff --git a/meson/docs/markdown/Syntax.md b/meson/docs/markdown/Syntax.md
deleted file mode 100644 (file)
index 7cb39e9..0000000
+++ /dev/null
@@ -1,674 +0,0 @@
----
-short-description: Syntax and structure of Meson files
-...
-
-# Syntax
-
-The syntax of Meson's specification language has been kept as simple
-as possible. It is *strongly typed* so no object is ever converted to
-another under the covers. Variables have no visible type which makes
-Meson *dynamically typed* (also known as *duck typed*).
-
-The main building blocks of the language are *variables*, *numbers*,
-*booleans*, *strings*, *arrays*, *function calls*, *method calls*, *if
-statements* and *includes*.
-
-Usually one Meson statement takes just one line. There is no way to
-have multiple statements on one line as in e.g. *C*. Function and
-method calls' argument lists can be split over multiple lines. Meson
-will autodetect this case and do the right thing.
-
-In other cases, *(added 0.50)* you can get multi-line statements by ending the
-line with a `\`.  Apart from line ending whitespace has no syntactic meaning.
-
-## Variables
-
-Variables in Meson work just like in other high level programming
-languages. A variable can contain a value of any type, such as an
-integer or a string. Variables don't need to be predeclared, you can
-just assign to them and they appear. Here's how you would assign
-values to two different variables.
-
-```meson
-var1 = 'hello'
-var2 = 102
-```
-
-One important difference in how variables work in Meson is that all
-objects are immutable. This is different from, for example, how Python
-works.
-
-```meson
-var1 = [1, 2, 3]
-var2 = var1
-var2 += [4]
-# var2 is now [1, 2, 3, 4]
-# var1 is still [1, 2, 3]
-```
-
-## Numbers
-
-Meson supports only integer numbers. They are declared simply by
-writing them out. Basic arithmetic operations are supported.
-
-```meson
-x = 1 + 2
-y = 3 * 4
-d = 5 % 3 # Yields 2.
-```
-
-Hexadecimal literals are supported since version 0.45.0:
-
-```meson
-int_255 = 0xFF
-```
-
-Octal and binary literals are supported since version 0.47.0:
-
-```meson
-int_493 = 0o755
-int_1365 = 0b10101010101
-```
-
-Strings can be converted to a number like this:
-
-```meson
-string_var = '42'
-num = string_var.to_int()
-```
-
-Numbers can be converted to a string:
-
-```meson
-int_var = 42
-string_var = int_var.to_string()
-```
-
-## Booleans
-
-A boolean is either `true` or `false`.
-
-```meson
-truth = true
-```
-
-## Strings
-
-Strings in Meson are declared with single quotes. To enter a literal
-single quote do it like this:
-
-```meson
-single quote = 'contains a \' character'
-```
-
-The full list of escape sequences is:
-
-* `\\` Backslash
-* `\'` Single quote
-* `\a` Bell
-* `\b` Backspace
-* `\f` Formfeed
-* `\n` Newline
-* `\r` Carriage Return
-* `\t` Horizontal Tab
-* `\v` Vertical Tab
-* `\ooo` Character with octal value ooo
-* `\xhh` Character with hex value hh
-* `\uxxxx` Character with 16-bit hex value xxxx
-* `\Uxxxxxxxx` Character with 32-bit hex value xxxxxxxx
-* `\N{name}` Character named name in Unicode database
-
-As in python and C, up to three octal digits are accepted in `\ooo`.
-
-Unrecognized escape sequences are left in the string unchanged, i.e., the
-backslash is left in the string.
-
-### String concatenation
-
-Strings can be concatenated to form a new string using the `+` symbol.
-
-```meson
-str1 = 'abc'
-str2 = 'xyz'
-combined = str1 + '_' + str2 # combined is now abc_xyz
-```
-
-### String path building
-
-*(Added 0.49)*
-
-You can concatenate any two strings using `/` as an operator to build paths.
-This will always use `/` as the path separator on all platforms.
-
-```meson
-joined = '/usr/share' / 'projectname'    # => /usr/share/projectname
-joined = '/usr/local' / '/etc/name'      # => /etc/name
-
-joined = 'C:\\foo\\bar' / 'builddir'     # => C:/foo/bar/builddir
-joined = 'C:\\foo\\bar' / 'D:\\builddir' # => D:/builddir
-```
-
-Note that this is equivalent to using [`join_paths()`](Reference-manual.md#join_paths),
-which was obsoleted by this operator.
-
-### Strings running over multiple lines
-
-Strings running over multiple lines can be declared with three single
-quotes, like this:
-
-```meson
-multiline_string = '''#include <foo.h>
-int main (int argc, char ** argv) {
-  return FOO_SUCCESS;
-}'''
-```
-
-These are raw strings that do not support the escape sequences listed
-above.  These strings can also be combined with the string formatting
-functionality described below.
-
-### String formatting
-
-Strings can be built using the string formatting functionality.
-
-```meson
-template = 'string: @0@, number: @1@, bool: @2@'
-res = template.format('text', 1, true)
-# res now has value 'string: text, number: 1, bool: true'
-```
-
-As can be seen, the formatting works by replacing placeholders of type
-`@number@` with the corresponding argument.
-
-### String methods
-
-Strings also support a number of other methods that return transformed
-copies.
-
-#### .strip()
-
-```meson
-# Similar to the Python str.strip(). Removes leading/ending spaces and newlines
-define = ' -Dsomedefine '
-stripped_define = define.strip()
-# 'stripped_define' now has the value '-Dsomedefine'
-```
-
-#### .to_upper(), .to_lower()
-
-```meson
-target = 'x86_FreeBSD'
-upper = target.to_upper() # t now has the value 'X86_FREEBSD'
-lower = target.to_lower() # t now has the value 'x86_freebsd'
-```
-
-#### .to_int()
-
-```meson
-version = '1'
-# Converts the string to an int and throws an error if it can't be
-ver_int = version.to_int()
-```
-
-#### .contains(), .startswith(), .endswith()
-
-```meson
-target = 'x86_FreeBSD'
-is_fbsd = target.to_lower().contains('freebsd')
-# is_fbsd now has the boolean value 'true'
-is_x86 = target.startswith('x86') # boolean value 'true'
-is_bsd = target.to_lower().endswith('bsd') # boolean value 'true'
-```
-
-#### .split(), .join()
-
-```meson
-# Similar to the Python str.split()
-components = 'a b   c d '.split()
-# components now has the value ['a', 'b', 'c', 'd']
-components = 'a b   c d '.split(' ')
-# components now has the value ['a', 'b', '', '', 'c', 'd', '']
-
-# Similar to the Python str.join()
-output = ' '.join(['foo', 'bar'])
-# Output value is 'foo bar'
-pathsep = ':'
-path = pathsep.join(['/usr/bin', '/bin', '/usr/local/bin'])
-# path now has the value '/usr/bin:/bin:/usr/local/bin'
-
-# For joining path elements, you should use path1 / path2
-# This has the advantage of being cross-platform
-path = '/usr' / 'local' / 'bin'
-# path now has the value '/usr/local/bin'
-
-# For sources files, use files():
-my_sources = files('foo.c')
-...
-my_sources += files('bar.c')
-# This has the advantage of always calculating the correct relative path, even
-# if you add files in another directory or use them in a different directory
-# than they're defined in
-
-# Example to set an API version for use in library(), install_header(), etc
-project('project', 'c', version: '0.2.3')
-version_array = meson.project_version().split('.')
-# version_array now has the value ['0', '2', '3']
-api_version = '.'.join([version_array[0], version_array[1]])
-# api_version now has the value '0.2'
-
-# We can do the same with .format() too:
-api_version = '@0@.@1@'.format(version_array[0], version_array[1])
-# api_version now (again) has the value '0.2'
-```
-
-#### .underscorify()
-
-```meson
-name = 'Meson Docs.txt#Reference-manual'
-# Replaces all characters other than `a-zA-Z0-9` with `_` (underscore)
-# Useful for substituting into #defines, filenames, etc.
-underscored = name.underscorify()
-# underscored now has the value 'Meson_Docs_txt_Reference_manual'
-```
-
-#### .version_compare()
-
-```meson
-version = '1.2.3'
-# Compare version numbers semantically
-is_new = version.version_compare('>=2.0')
-# is_new now has the boolean value false
-# Supports the following operators: '>', '<', '>=', '<=', '!=', '==', '='
-```
-
-Meson version comparison conventions include:
-
-```meson
-'3.6'.version_compare('>=3.6.0') == false
-```
-
-It is best to be unambiguous and specify the full revision level to compare.
-
-## Arrays
-
-Arrays are delimited by brackets. An array can contain an arbitrary number of objects of any type.
-
-```meson
-my_array = [1, 2, 'string', some_obj]
-```
-
-Accessing elements of an array can be done via array indexing:
-
-```meson
-my_array = [1, 2, 'string', some_obj]
-second_element = my_array[1]
-last_element = my_array[-1]
-```
-
-You can add more items to an array like this:
-
-```meson
-my_array += ['foo', 3, 4, another_obj]
-```
-
-When adding a single item, you do not need to enclose it in an array:
-
-```meson
-my_array += ['something']
-# This also works
-my_array += 'else'
-```
-
-Note appending to an array will always create a new array object and
-assign it to `my_array` instead of modifying the original since all
-objects in Meson are immutable.
-
-Since 0.49.0, you can check if an array contains an element like this:
-
-```meson
-my_array = [1, 2]
-if 1 in my_array
-# This condition is true
-endif
-if 1 not in my_array
-# This condition is false
-endif
-```
-
-### Array methods
-
-The following methods are defined for all arrays:
-
- - `length`, the size of the array
- - `contains`, returns `true` if the array contains the object given as argument, `false` otherwise
- - `get`, returns the object at the given index, negative indices count from the back of the array, indexing out of bounds is a fatal error. Provided for backwards-compatibility, it is identical to array indexing.
-
-## Dictionaries
-
-Dictionaries are delimited by curly braces. A dictionary can contain an
-arbitrary number of key value pairs. Keys are required to be strings, values can
-be objects of any type. Prior to *0.53.0* keys were required to be literal strings.
-
-```meson
-my_dict = {'foo': 42, 'bar': 'baz'}
-```
-
-Keys must be unique:
-
-```meson
-# This will fail
-my_dict = {'foo': 42, 'foo': 43}
-```
-
-Dictionaries are immutable and do not have a guaranteed order.
-
-Dictionaries are available since 0.47.0.
-
-Visit the [Reference Manual](Reference-manual.md#dictionary-object) to read
-about the methods exposed by dictionaries.
-
-Since 0.49.0, you can check if a dictionary contains a key like this:
-
-```meson
-my_dict = {'foo': 42, 'bar': 43}
-if 'foo' in my_dict
-# This condition is true
-endif
-if 42 in my_dict
-# This condition is false
-endif
-if 'foo' not in my_dict
-# This condition is false
-endif
-```
-
-*Since 0.53.0* Keys can be any expression evaluating to a string value, not limited
-to string literals any more.
-
-```meson
-d = {'a' + 'b' : 42}
-k = 'cd'
-d += {k : 43}
-```
-
-## Function calls
-
-Meson provides a set of usable functions. The most common use case is
-creating build objects.
-
-```meson
-executable('progname', 'prog.c')
-```
-
-Most functions take only few positional arguments but several keyword
-arguments, which are specified like this:
-
-```meson
-executable('progname',
-  sources: 'prog.c',
-  c_args: '-DFOO=1')
-```
-
-Starting with version 0.49.0 keyword arguments can be specified
-dynamically. This is done by passing dictionary representing the
-keywords to set in the `kwargs` keyword. The previous example would be
-specified like this:
-
-```meson
-d = {'sources': 'prog.c',
-  'c_args': '-DFOO=1'}
-
-executable('progname',
-  kwargs: d)
-```
-
-A single function can take keyword argumets both directly in the
-function call and indirectly via the `kwargs` keyword argument. The
-only limitation is that it is a hard error to pass any particular key
-both as a direct and indirect argument.
-
-```meson
-d = {'c_args': '-DFOO'}
-executable('progname', 'prog.c',
-  c_args: '-DBAZ=1',
-  kwargs: d) # This is an error!
-```
-
-Attempting to do this causes Meson to immediately exit with an error.
-
-## Method calls
-
-Objects can have methods, which are called with the dot operator. The
-exact methods it provides depends on the object.
-
-```meson
-myobj = some_function()
-myobj.do_something('now')
-```
-
-## If statements
-
-If statements work just like in other languages.
-
-```meson
-var1 = 1
-var2 = 2
-if var1 == var2 # Evaluates to false
-  something_broke()
-elif var3 == var2
-  something_else_broke()
-else
-  everything_ok()
-endif
-
-opt = get_option('someoption')
-if opt != 'foo'
-  do_something()
-endif
-```
-
-## Logical operations
-
-Meson has the standard range of logical operations which can be used in
-`if` statements.
-
-```meson
-if a and b
-  # do something
-endif
-if c or d
-  # do something
-endif
-if not e
-  # do something
-endif
-if not (f or g)
-  # do something
-endif
-```
-
-Logical operations work only on boolean values.
-
-## Foreach statements
-
-To do an operation on all elements of an iterable, use the `foreach`
-command.
-
-> Note that Meson variables are immutable. Trying to assign a new value
-> to the iterated object inside a foreach loop will not affect foreach's
-> control flow.
-
-### Foreach with an array
-
-Here's an example of how you could define two executables
-with corresponding tests using arrays and foreach.
-
-```meson
-progs = [['prog1', ['prog1.c', 'foo.c']],
-         ['prog2', ['prog2.c', 'bar.c']]]
-
-foreach p : progs
-  exe = executable(p[0], p[1])
-  test(p[0], exe)
-endforeach
-```
-
-### Foreach with a dictionary
-
-Here's an example of you could iterate a set of components that
-should be compiled in according to some configuration. This uses
-a [dictionary][dictionaries], which is available since 0.47.0.
-
-```meson
-components = {
-  'foo': ['foo.c'],
-  'bar': ['bar.c'],
-  'baz': ['baz.c'],
-}
-
-# compute a configuration based on system dependencies, custom logic
-conf = configuration_data()
-conf.set('USE_FOO', 1)
-
-# Determine the sources to compile
-sources_to_compile = []
-foreach name, sources : components
-  if conf.get('USE_@0@'.format(name.to_upper()), 0) == 1
-    sources_to_compile += sources
-  endif
-endforeach
-```
-
-### Foreach `break` and `continue`
-
-Since 0.49.0 `break` and `continue` keywords can be used inside foreach loops.
-
-```meson
-items = ['a', 'continue', 'b', 'break', 'c']
-result = []
-foreach i : items
-  if i == 'continue'
-    continue
-  elif i == 'break'
-    break
-  endif
-  result += i
-endforeach
-# result is ['a', 'b']
-```
-
-## Comments
-
-A comment starts with the `#` character and extends until the end of the line.
-
-```meson
-some_function() # This is a comment
-some_other_function()
-```
-
-## Ternary operator
-
-The ternary operator works just like in other languages.
-
-```meson
-x = condition ? true_value : false_value
-```
-
-The only exception is that nested ternary operators are forbidden to
-improve legibility. If your branching needs are more complex than this
-you need to write an `if/else` construct.
-
-## Includes
-
-Most source trees have multiple subdirectories to process. These can
-be handled by Meson's `subdir` command. It changes to the given
-subdirectory and executes the contents of `meson.build` in that
-subdirectory. All state (variables etc) are passed to and from the
-subdirectory. The effect is roughly the same as if the contents of the
-subdirectory's Meson file would have been written where the include
-command is.
-
-```meson
-test_data_dir = 'data'
-subdir('tests')
-```
-
-## User-defined functions and methods
-
-Meson does not currently support user-defined functions or
-methods. The addition of user-defined functions would make Meson
-Turing-complete which would make it harder to reason about and more
-difficult to integrate with tools like IDEs. More details about this
-are [in the
-FAQ](FAQ.md#why-is-meson-not-just-a-python-module-so-i-could-code-my-build-setup-in-python). If
-because of this limitation you find yourself copying and pasting code
-a lot you may be able to use a [`foreach` loop
-instead](#foreach-statements).
-
-## Stability Promises
-
-Meson is very actively developed and continuously improved. There is a
-possibility that future enhancements to the Meson build system will require
-changes to the syntax. Such changes might be the addition of new reserved
-keywords, changing the meaning of existing keywords or additions around the
-basic building blocks like statements and fundamental types. It is planned
-to stabilize the syntax with the 1.0 release.
-
-## Grammar
-
-This is the full Meson grammar, as it is used to parse Meson build definition files:
-
-```
-additive_expression: multiplicative_expression | (additive_expression additive_operator multiplicative_expression)
-additive_operator: "+" | "-"
-argument_list: positional_arguments ["," keyword_arguments] | keyword_arguments
-array_literal: "[" [expression_list] "]"
-assignment_expression: conditional_expression | (logical_or_expression assignment_operator assignment_expression)
-assignment_operator: "=" | "*=" | "/=" | "%=" | "+=" | "-="
-boolean_literal: "true" | "false"
-build_definition: (NEWLINE | statement)*
-condition: expression
-conditional_expression: logical_or_expression | (logical_or_expression "?" expression ":" assignment_expression
-decimal_literal: DECIMAL_NUMBER
-DECIMAL_NUMBER: /[1-9][0-9]*/
-dictionary_literal: "{" [key_value_list] "}"
-equality_expression: relational_expression | (equality_expression equality_operator relational_expression)
-equality_operator: "==" | "!="
-expression: assignment_expression
-expression_list: expression ("," expression)*
-expression_statememt: expression
-function_expression: id_expression "(" [argument_list] ")"
-hex_literal: "0x" HEX_NUMBER
-HEX_NUMBER: /[a-fA-F0-9]+/
-id_expression: IDENTIFIER
-IDENTIFIER: /[a-zA-Z_][a-zA-Z_0-9]*/
-identifier_list: id_expression ("," id_expression)*
-integer_literal: decimal_literal | octal_literal | hex_literal
-iteration_statement: "foreach" identifier_list ":" id_expression NEWLINE (statement | jump_statement)* "endforeach"
-jump_statement: ("break" | "continue") NEWLINE
-key_value_item: expression ":" expression
-key_value_list: key_value_item ("," key_value_item)*
-keyword_item: id_expression ":" expression
-keyword_arguments: keyword_item ("," keyword_item)*
-literal: integer_literal | string_literal | boolean_literal | array_literal | dictionary_literal
-logical_and_expression: equality_expression | (logical_and_expression "and" equality_expression)
-logical_or_expression: logical_and_expression | (logical_or_expression "or" logical_and_expression)
-method_expression: postfix_expression "." function_expression
-multiplicative_expression: unary_expression | (multiplicative_expression multiplicative_operator unary_expression)
-multiplicative_operator: "*" | "/" | "%"
-octal_literal: "0o" OCTAL_NUMBER
-OCTAL_NUMBER: /[0-7]+/
-positional_arguments: expression ("," expression)*
-postfix_expression: primary_expression | subscript_expression | function_expression | method_expression
-primary_expression: literal | ("(" expression ")") | id_expression
-relational_expression: additive_expression | (relational_expression relational_operator additive_expression)
-relational_operator: ">" | "<" | ">=" | "<=" | "in" | ("not" "in")
-selection_statement: "if" condition NEWLINE (statement)* ("elif" condition NEWLINE (statement)*)* ["else" (statement)*] "endif"
-statement: (expression_statement | selection_statement | iteration_statement) NEWLINE
-string_literal: ("'" STRING_SIMPLE_VALUE "'") | ("'''" STRING_MULTILINE_VALUE "'''")
-STRING_MULTILINE_VALUE: \.*?(''')\
-STRING_SIMPLE_VALUE: \.*?(?<!\\)(\\\\)*?'\
-subscript_expression: postfix_expression "[" expression "]"
-unary_expression: postfix_expression | (unary_operator unary_expression)
-unary_operator: "not" | "+" | "-"
-```
diff --git a/meson/docs/markdown/Threads.md b/meson/docs/markdown/Threads.md
deleted file mode 100644 (file)
index 1bf9f83..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
----
-short-description: Enabling thread support
-...
-
-# Threads
-
-Meson has a very simple notational shorthand for enabling thread support on your build targets. First you obtain the thread dependency object like this:
-
-```meson
-thread_dep = dependency('threads')
-```
-
-And then you just use it in a target like this:
-
-```meson
-executable('threadedprogram', ...
-  dependencies : thread_dep)
-```
diff --git a/meson/docs/markdown/Tutorial.md b/meson/docs/markdown/Tutorial.md
deleted file mode 100644 (file)
index c5a4e6b..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
----
-short-description: Simplest tutorial
-...
-
-# Tutorial
-
-This page shows from the ground up how to create a Meson build
-definition for a simple project. Then we expand it to use external
-dependencies to show how easily they can be integrated into your
-project.
-
-This tutorial has been written mostly for Linux usage. It assumes that
-you have GTK development libraries available on the system. On
-Debian-derived systems such as Ubuntu they can be installed with the
-following command:
-
-```
-sudo apt install libgtk-3-dev
-```
-
-It is possible to build the GUI application on other platforms, such
-as Windows and macOS, but you need to install the needed dependencies.
-
-The humble beginning
------
-
-Let's start with the most basic of programs, the classic hello
-example. First we create a file `main.c` which holds the source. It
-looks like this.
-
-```c
-#include<stdio.h>
-
-int main(int argc, char **argv) {
-  printf("Hello there.\n");
-  return 0;
-}
-```
-
-Then we create a Meson build description and put it in a file called
-`meson.build` in the same directory. Its contents are the following.
-
-```meson
-project('tutorial', 'c')
-executable('demo', 'main.c')
-```
-
-That is all. We are now ready to build our application. First we need
-to initialize the build by going into the source directory and issuing
-the following commands.
-
-```console
-$ meson builddir
-```
-
-We create a separate build directory to hold all of the compiler
-output. Meson is different from some other build systems in that it
-does not permit in-source builds. You must always create a separate
-build directory. Common convention is to put the default build
-directory in a subdirectory of your top level source directory.
-
-When Meson is run it prints the following output.
-
-    The Meson build system
-     version: 0.13.0-research
-    Source dir: /home/jpakkane/mesontutorial
-    Build dir: /home/jpakkane/mesontutorial/builddir
-    Build type: native build
-    Project name is "tutorial".
-    Using native c compiler "ccache cc". (gcc 4.8.2)
-    Creating build target "demo" with 1 files.
-
-Now we are ready to build our code.
-
-```
-$ cd builddir
-$ meson compile
-```
-
-Once that is done we can run the resulting binary.
-
-```console
-$ ./demo
-```
-
-This produces the expected output.
-
-    Hello there.
-
-Adding dependencies
------
-
-Just printing text is a bit old fashioned. Let's update our program to
-create a graphical window instead. We'll use the
-[GTK+](https://gtk.org) widget toolkit. First we edit the main file to
-use GTK+. The new version looks like this.
-
-```c
-#include<gtk/gtk.h>
-
-int main(int argc, char **argv) {
-  GtkWidget *win;
-  gtk_init(&argc, &argv);
-  win = gtk_window_new(GTK_WINDOW_TOPLEVEL);
-  gtk_window_set_title(GTK_WINDOW(win), "Hello there");
-  g_signal_connect(win, "destroy", G_CALLBACK(gtk_main_quit), NULL);
-  gtk_widget_show(win);
-  gtk_main();
-}
-```
-
-Then we edit the Meson file, instructing it to find and use the GTK+
-libraries.
-
-```meson
-project('tutorial', 'c')
-gtkdep = dependency('gtk+-3.0')
-executable('demo', 'main.c', dependencies : gtkdep)
-```
-
-Now we are ready to build. The thing to notice is that we do *not*
-need to recreate our build directory, run any sort of magical commands
-or the like. Instead we just type the exact same command as if we were
-rebuilding our code without any build system changes.
-
-```
-$ meson compile
-```
-
-Once you have set up your build directory the first time, you don't
-ever need to run the `meson` command again. You always just run
-`meson compile`. Meson will automatically detect when you have done changes to
-build definitions and will take care of everything so users don't have
-to care. In this case the following output is produced.
-
-    [1/1] Regenerating build files
-    The Meson build system
-     version: 0.13.0-research
-    Source dir: /home/jpakkane/mesontutorial
-    Build dir: /home/jpakkane/mesontutorial/builddir
-    Build type: native build
-    Project name is "tutorial".
-    Using native c compiler "ccache cc". (gcc 4.8.2)
-    Found pkg-config version 0.26.
-    Dependency gtk+-3.0 found: YES
-    Creating build target "demo" with 1 files.
-    [1/2] Compiling c object demo.dir/main.c.o
-    [2/2] Linking target demo
-
-Note how Meson noticed that the build definition has changed and reran
-itself automatically. The program is now ready to be run:
-
-```
-$ ./demo
-```
-
-This creates the following GUI application.
-
-![GTK+ sample application screenshot](images/gtksample.png)
diff --git a/meson/docs/markdown/Unit-tests.md b/meson/docs/markdown/Unit-tests.md
deleted file mode 100644 (file)
index 60fcad2..0000000
+++ /dev/null
@@ -1,261 +0,0 @@
----
-short-description: Meson's own unit-test system
-...
-
-# Unit tests
-
-Meson comes with a fully functional unit test system. To use it simply build
-an executable and then use it in a test.
-
-```meson
-e = executable('prog', 'testprog.c')
-test('name of test', e)
-```
-
-You can add as many tests as you want. They are run with the command `meson
-test`.
-
-Meson captures the output of all tests and writes it in the log file
-`meson-logs/testlog.txt`.
-
-## Test parameters
-
-Some tests require the use of command line arguments or environment
-variables. These are simple to define.
-
-```meson
-test('command line test', exe, args : ['first', 'second'])
-test('envvar test', exe2, env : ['key1=value1', 'key2=value2'])
-```
-
-Note how you need to specify multiple values as an array.
-
-### MALLOC_PERTURB_
-
-By default, environment variable
-[`MALLOC_PERTURB_`](http://man7.org/linux/man-pages/man3/mallopt.3.html) is
-set to a random value between 1..255. This can help find memory leaks on
-configurations using glibc, including with non-GCC compilers. This feature
-can be disabled as discussed in [test()](Reference-manual.md#test).
-
-## Coverage
-
-If you enable coverage measurements by giving Meson the command line flag
-`-Db_coverage=true`, you can generate coverage reports after running the
-tests (running the tests is required to gather the list of functions that get
-called). Meson will autodetect what coverage generator tools you have
-installed and will generate the corresponding targets. These targets are
-`coverage-xml` and `coverage-text` which are both provided by
-[Gcovr](http://gcovr.com) (version 3.3 or higher) and `coverage-html`, which
-requires [Lcov](https://ltp.sourceforge.io/coverage/lcov.php) and
-[GenHTML](https://linux.die.net/man/1/genhtml) or [Gcovr](http://gcovr.com).
-As a convenience, a high-level `coverage` target is also generated which will
-produce all 3 coverage report types, if possible.
-
-The output of these commands is written to the log directory `meson-logs` in
-your build directory.
-
-## Parallelism
-
-To reduce test times, Meson will by default run multiple unit tests in
-parallel. It is common to have some tests which can not be run in parallel
-because they require unique hold on some resource such as a file or a D-Bus
-name. You have to specify these tests with a keyword argument.
-
-```meson
-test('unique test', t, is_parallel : false)
-```
-
-Meson will then make sure that no other unit test is running at the same
-time. Non-parallel tests take longer to run so it is recommended that you
-write your unit tests to be parallel executable whenever possible.
-
-By default Meson uses as many concurrent processes as there are cores on the
-test machine. You can override this with the environment variable
-`MESON_TESTTHREADS` like this.
-
-```console
-$ MESON_TESTTHREADS=5 meson test
-```
-
-## Priorities
-
-*(added in version 0.52.0)*
-
-Tests can be assigned a priority that determines when a test is *started*.
-Tests with higher priority are started first, tests with lower priority
-started later. The default priority is 0, meson makes no guarantee on the
-ordering of tests with identical priority.
-
-```meson
-test('started second', t, priority : 0)
-test('started third', t, priority : -50)
-test('started first', t, priority : 1000)
-```
-
-Note that the test priority only affects the starting order of tests and
-subsequent tests are affected by how long it takes previous tests to
-complete. It is thus possible that a higher-priority test is still running
-when lower-priority tests with a shorter runtime have completed.
-
-## Skipped tests and hard errors
-
-Sometimes a test can only determine at runtime that it can not be run.
-
-For the default `exitcode` testing protocol, the GNU standard approach in
-this case is to exit the program with error code 77. Meson will detect this
-and report these tests as skipped rather than failed. This behavior was added
-in version 0.37.0.
-
-For TAP-based tests, skipped tests should print a single line starting with
-`1..0 # SKIP`.
-
-In addition, sometimes a test fails set up so that it should fail even if it
-is marked as an expected failure. The GNU standard approach in this case is
-to exit the program with error code 99. Again, Meson will detect this and
-report these tests as `ERROR`, ignoring the setting of `should_fail`. This
-behavior was added in version 0.50.0.
-
-## Testing tool
-
-The goal of the meson test tool is to provide a simple way to run tests in a
-variety of different ways. The tool is designed to be run in the build
-directory.
-
-The simplest thing to do is just to run all tests.
-
-```console
-$ meson test
-```
-
-### Run subsets of tests
-
-For clarity, consider the meson.build containing:
-
-```meson
-
-test('A', ..., suite: 'foo')
-test('B', ..., suite: ['foo', 'bar'])
-test('C', ..., suite: 'bar')
-test('D', ..., suite: 'baz')
-
-```
-
-Specify test(s) by name like:
-
-```console
-$ meson test A D
-```
-
-Tests belonging to a suite `suite` can be run as follows
-
-```console
-$ meson test --suite (sub)project_name:suite
-```
-
-Since version *0.46*, `(sub)project_name` can be omitted if it is the
-top-level project.
-
-Multiple suites are specified like:
-
-```console
-$ meson test --suite foo --suite bar
-```
-
-NOTE: If you choose to specify both suite(s) and specific test name(s), the
-test name(s) must be contained in the suite(s). This however is redundant--
-it would be more useful to specify either specific test names or suite(s).
-
-### Other test options
-
-Sometimes you need to run the tests multiple times, which is done like this:
-
-```console
-$ meson test --repeat=10
-```
-
-Invoking tests via a helper executable such as Valgrind can be done with the
-`--wrap` argument
-
-```console
-$ meson test --wrap=valgrind testname
-```
-
-Arguments to the wrapper binary can be given like this:
-
-```console
-$ meson test --wrap='valgrind --tool=helgrind' testname
-```
-
-Meson also supports running the tests under GDB. Just doing this:
-
-```console
-$ meson test --gdb testname
-```
-
-Meson will launch `gdb` all set up to run the test. Just type `run` in the
-GDB command prompt to start the program.
-
-The second use case is a test that segfaults only rarely. In this case you
-can invoke the following command:
-
-```console
-$ meson test --gdb --repeat=10000 testname
-```
-
-This runs the test up to 10 000 times under GDB automatically. If the program
-crashes, GDB will halt and the user can debug the application. Note that
-testing timeouts are disabled in this case so `meson test` will not kill
-`gdb` while the developer is still debugging it. The downside is that if the
-test binary freezes, the test runner will wait forever.
-
-Sometimes, the GDB binary is not in the PATH variable or the user wants to
-use a GDB replacement. Therefore, the invoked GDB program can be specified
-*(added 0.52.0)*:
-
-```console
-$ meson test --gdb --gdb-path /path/to/gdb testname
-```
-
-```console
-$ meson test --print-errorlogs
-```
-
-Meson will report the output produced by the failing tests along with other
-useful information as the environmental variables. This is useful, for
-example, when you run the tests on Travis-CI, Jenkins and the like.
-
-For further information see the command line help of Meson by running `meson
-test -h`.
-
-## Legacy notes
-
-If `meson test` does not work for you, you likely have a old version of
-Meson. In that case you should call `mesontest` instead. If `mesontest`
-doesn't work either you have a very old version prior to 0.37.0 and should
-upgrade.
-
-## Test outputs
-
-Meson will write several different files with detailed results of running
-tests. These will be written into $builddir/meson-logs/
-
-### testlog.json
-
-This is not a proper json file, but a file containing one valid json object
-per line. This is file is designed so each line is streamed out as each test
-is run, so it can be read as a stream while the test harness is running
-
-### testlog.junit.xml
-
-This is a valid JUnit XML description of all tests run. It is not streamed
-out, and is written only once all tests complete running.
-
-When tests use the `tap` protocol each test will be recorded as a testsuite
-container, with each case named by the number of the result.
-
-When tests use the `gtest` protocol meson will inject arguments to the test
-to generate it's own JUnit XML, which meson will include as part of this XML
-file.
-
-*New in 0.55.0*
diff --git a/meson/docs/markdown/Unity-builds.md b/meson/docs/markdown/Unity-builds.md
deleted file mode 100644 (file)
index 533a421..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
----
-short-description: Unity builds are a technique for reducing build times
-...
-
-# Unity builds
-
-Unity builds are a technique for cutting down build times. The way it works is relatively straightforward. Suppose we have source files `src1.c`, `src2.c` and `src3.c`. Normally we would run the compiler three times, once for each file. In a unity build we instead compile all these sources in a single unit. The simplest approach is to create a new source file that looks like this.
-
-```c
-#include<src1.c>
-#include<src2.c>
-#include<src3.c>
-```
-
-This is then compiled rather than the individual files. The exact speedup depends on the code base, of course, but it is not uncommon to obtain more than 50% speedup in compile times. This happens even though the Unity build uses only one CPU whereas individual compiles can be run in parallel. Unity builds can also lead to faster code, because the compiler can do more aggressive optimizations (e.g. inlining).
-
-The downside is that incremental builds are as slow as full rebuilds (because that is what they are). Unity compiles also use more memory, which may become an issue in certain scenarios. There may also be some bugs in the source that need to be fixed before Unity compiles work. As an example, if both `src1.c` and `src2.c` contain a static function or variable of the same name, there will be a clash.
-
-Meson has built-in support for unity builds. To enable them, just pass `--unity on` on the command line or enable unity builds with the GUI. No code changes are necessary apart from the potential clash issue discussed above. Meson will automatically generate all the necessary inclusion files for you.
diff --git a/meson/docs/markdown/Use-of-Python.md b/meson/docs/markdown/Use-of-Python.md
deleted file mode 100644 (file)
index 1803503..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Use of Python
-
-Meson is implemented in Python. This has both positive and negative sides. The main thing people seem to be mindful about is the dependency on Python to build source code. This page discusses various aspects of this problem.
-
-# Dependency hell
-
-There have been many Python programs that are difficult to maintain on multiple platforms. The reasons come mostly from dependencies. The program may use dependencies that are hard to compile on certain platforms, are outdated, conflict with other dependencies, not available on a given Python version and so on.
-
-Meson avoids dependency problems with one simple rule: Meson is not allowed to have any dependencies outside the Python basic library. The only thing you need is Python 3 (and possibly Ninja).
-
-## Reimplementability
-
-Meson has been designed in such a way that the implementation language is never exposed in the build definitions. This makes it possible (and maybe even easy) to reimplement Meson in any other programming language. There are currently no plans to reimplement Meson, but we will make sure that Python is not exposed inside the build definitions.
-
-## Cross platform tooling
-
-There is no one technical solution or programming language that works natively on all operating systems currently in use. When Autotools was designed in the late 80s, Unix shell was available pretty much anywhere. This is no longer the case.
-
-It is also the case that as any project gets larger, sooner or later it requires code generation, scripting or other tooling. This seems to be inevitable. Because there is no scripting language that would be available everywhere, these tools either need to be rewritten for each platform (which is a lot of work and is prone to errors) or the project needs to take a dependency on _something_.
-
-Any project that uses Meson (at least the current version) can rely on the fact that Python 3 will always be available, because you can't compile the project without it. All tooling can then be done in Python 3 with the knowledge that it will run on any platform without any extra dependencies (modulo the usual porting work). This reduces maintenance effort on multiplatform projects by a fair margin.
diff --git a/meson/docs/markdown/Users.md b/meson/docs/markdown/Users.md
deleted file mode 100644 (file)
index 49d30a4..0000000
+++ /dev/null
@@ -1,147 +0,0 @@
----
-title: Users
-...
-
-# List of projects using Meson
-
-If you have a project that uses Meson that you want to add to this
-list, please [file a
-pull-request](https://github.com/mesonbuild/meson/edit/master/docs/markdown/Users.md)
-for it. All the software on this list is tested for regressions before
-release, so it's highly recommended that projects add themselves
-here. Some additional projects are listed in the [`meson` GitHub
-topic](https://github.com/topics/meson).
-
- - [2048.cpp](https://github.com/plibither8/2048.cpp), a fully featured terminal version of the game "2048" written in C++
- - [Aravis](https://github.com/AravisProject/aravis), a glib/gobject based library for video acquisition using Genicam cameras
- - [Akira](https://github.com/akiraux/Akira), a native Linux app for UI and UX design built in Vala and Gtk
- - [AQEMU](https://github.com/tobimensch/aqemu), a Qt GUI for QEMU virtual machines, since version 0.9.3
- - [Arduino sample project](https://github.com/jpakkane/mesonarduino)
- - [bolt](https://gitlab.freedesktop.org/bolt/bolt), userspace daemon to enable security levels for Thunderbolt™ 3 on Linux
- - [Budgie Desktop](https://github.com/budgie-desktop/budgie-desktop), a desktop environment built on GNOME technologies
- - [Bzip2](https://gitlab.com/federicomenaquintero/bzip2), the bzip2 compressor/decompressor
- - [Cage](https://github.com/Hjdskes/cage), a Wayland kiosk
- - [casync](https://github.com/systemd/casync), Content-Addressable Data Synchronization Tool
- - [cinnamon-desktop](https://github.com/linuxmint/cinnamon-desktop), the cinnamon desktop library
- - [Cozy](https://github.com/geigi/cozy), a modern audio book player for Linux and macOS using GTK+ 3
- - [dav1d](https://code.videolan.org/videolan/dav1d), an AV1 decoder
- - [dbus-broker](https://github.com/bus1/dbus-broker), Linux D-Bus Message Broker
- - [DPDK](http://dpdk.org/browse/dpdk), Data Plane Development Kit, a set of libraries and drivers for fast packet processing
- - [DXVK](https://github.com/doitsujin/dxvk), a Vulkan-based Direct3D 11 implementation for Linux using Wine
- - [elementary OS](https://github.com/elementary/), Linux desktop oriented distribution
- - [Emeus](https://github.com/ebassi/emeus), constraint based layout manager for GTK+
- - [ESP8266 Arduino sample project](https://github.com/trilader/arduino-esp8266-meson), sample project for using the ESP8266 Arduino port with Meson
- - [FeedReader](https://github.com/jangernert/FeedReader), a modern desktop application designed to complement existing web-based RSS accounts
- - [Flecs](https://github.com/SanderMertens/flecs), a Fast and Lightweight ECS (Entity Component System) C library
- - [Foliate](https://github.com/johnfactotum/foliate), a simple and modern GTK eBook reader, built with GJS and Epub.js
- - [Fractal](https://wiki.gnome.org/Apps/Fractal/), a Matrix messaging client for GNOME
- - [Frida](https://github.com/frida/frida-core), a dynamic binary instrumentation toolkit
- - [fwupd](https://github.com/hughsie/fwupd), a simple daemon to allow session software to update firmware
- - [GameMode](https://github.com/FeralInteractive/gamemode), a daemon/lib combo for Linux that allows games to request a set of optimisations be temporarily applied to the host OS
- - [Geary](https://wiki.gnome.org/Apps/Geary), an email application built around conversations, for the GNOME 3 desktop.
- - [GLib](https://gitlab.gnome.org/GNOME/glib), cross-platform C library used by GTK+ and GStreamer
- - [Glorytun](https://github.com/angt/glorytun), a multipath UDP tunnel
- - [GNOME Boxes](https://gitlab.gnome.org/GNOME/gnome-boxes), a GNOME hypervisor
- - [GNOME Builder](https://gitlab.gnome.org/GNOME/gnome-builder), an IDE for the GNOME platform
- - [GNOME MPV](https://github.com/gnome-mpv/gnome-mpv), GNOME frontend to the mpv video player
- - [GNOME Recipes](https://gitlab.gnome.org/GNOME/recipes), application for cooking recipes
- - [GNOME Software](https://gitlab.gnome.org/GNOME/gnome-software), an app store for GNOME
- - [GNOME Twitch](https://github.com/vinszent/gnome-twitch), an app for viewing Twitch streams on GNOME desktop
- - [GNOME Usage](https://gitlab.gnome.org/GNOME/gnome-usage), a GNOME application for visualizing system resources
- - [GNU FriBidi](https://github.com/fribidi/fribidi), the open source implementation of the Unicode Bidirectional Algorithm
- - [Graphene](https://ebassi.github.io/graphene/), a thin type library for graphics
- - [Grilo](https://git.gnome.org/browse/grilo) and [Grilo plugins](https://git.gnome.org/browse/grilo-plugins), the Grilo multimedia framework
- - [GStreamer](https://gitlab.freedesktop.org/gstreamer/gstreamer), multimedia framework
- - [GTK+](https://gitlab.gnome.org/GNOME/gtk), the multi-platform toolkit used by GNOME
- - [GtkDApp](https://gitlab.com/csoriano/GtkDApp), an application template for developing Flatpak apps with Gtk+ and D
- - [GVfs](https://git.gnome.org/browse/gvfs/), a userspace virtual filesystem designed to work with the I/O abstraction of GIO
- - [Hardcode-Tray](https://github.com/bil-elmoussaoui/Hardcode-Tray), fixes hardcoded tray icons in Linux
- - [HelenOS](http://helenos.org), a portable microkernel-based multiserver operating system
- - [HexChat](https://github.com/hexchat/hexchat), a cross-platform IRC client in C
- - [IGT](https://gitlab.freedesktop.org/drm/igt-gpu-tools), Linux kernel graphics driver test suite
- - [inih](https://github.com/benhoyt/inih) (INI Not Invented Here), a small and simple .INI file parser written in C
- - [Irssi](https://github.com/irssi/irssi), a terminal chat client in C
- - [iSH](https://github.com/tbodt/ish), Linux shell for iOS
- - [Janet](https://github.com/janet-lang/janet), a functional and imperative programming language and bytecode interpreter
- - [json](https://github.com/nlohmann/json), JSON for Modern C++
- - [JsonCpp](https://github.com/open-source-parsers/jsoncpp), a C++ library for interacting with JSON
- - [Json-glib](https://gitlab.gnome.org/GNOME/json-glib), GLib-based JSON manipulation library
- - [Kiwix libraries](https://github.com/kiwix/kiwix-lib)
- - [Knot Resolver](https://gitlab.labs.nic.cz/knot/knot-resolver), Full caching DNS resolver implementation
- - [Ksh](https://github.com/att/ast), a Korn Shell
- - [Lc0](https://github.com/LeelaChessZero/lc0), LeelaChessZero is a UCI-compliant chess engine designed to play chess via neural network
- - [Le](https://github.com/kirushyk/le), machine learning framework
- - [libcamera](https://git.linuxtv.org/libcamera.git/), a library to handle complex cameras on Linux, ChromeOS and Android
- - [Libdrm](https://gitlab.freedesktop.org/mesa/drm), a library for abstracting DRM kernel interfaces
- - [libeconf](https://github.com/openSUSE/libeconf), Enhanced config file parsing library, which merges config files placed in several locations into one
- - [Libepoxy](https://github.com/anholt/libepoxy/), a library for handling OpenGL function pointer management
- - [libfuse](https://github.com/libfuse/libfuse), the reference implementation of the Linux FUSE (Filesystem in Userspace) interface
- - [Libgit2-glib](https://git.gnome.org/browse/libgit2-glib), a GLib wrapper for libgit2
- - [libglvnd](https://gitlab.freedesktop.org/glvnd/libglvnd), Vendor neutral OpenGL dispatch library for Unix-like OSes
- - [Libhttpseverywhere](https://git.gnome.org/browse/libhttpseverywhere), a library to enable httpseverywhere on any desktop app
- - [libmodulemd](https://github.com/fedora-modularity/libmodulemd), a GObject Introspected library for managing [Fedora Project](https://getfedora.org/) module metadata.
- - [Libosmscout](https://github.com/Framstag/libosmscout), a C++ library for offline map rendering, routing and location
-lookup based on OpenStreetMap data
- - [libratbag](https://github.com/libratbag/libratbag), provides a DBus daemon to configure input devices, mainly gaming mice.
- - [libspng](https://gitlab.com/randy408/libspng), a C library for reading and writing Portable Network Graphics (PNG)
-format files
- - [libui](https://github.com/andlabs/libui), a simple and portable (but not inflexible) GUI library in C that uses the native GUI technologies of each platform it supports
- - [Libva](https://github.com/intel/libva), an implementation for the VA (VIdeo Acceleration) API
- - [Libzim](https://github.com/openzim/libzim), the reference implementation for the ZIM file format
- - [Marker](https://github.com/fabiocolacio/Marker), a GTK-3 markdown editor
- - [Mesa](https://gitlab.freedesktop.org/mesa/mesa/), an open source graphics driver project
- - [MiracleCast](https://github.com/albfan/miraclecast), connect external monitors to your system via Wifi-Display specification aka Miracast
- - [mrsh](https://github.com/emersion/mrsh), a minimal POSIX shell
- - [Nautilus](https://gitlab.gnome.org/GNOME/nautilus), the GNOME file manager
- - [Nemo](https://github.com/linuxmint/nemo), the file manager for the Cinnamon desktop environment
- - [OcherBook](https://github.com/ccoffing/OcherBook), an open source book reader for Kobo devices
- - [oomd](https://github.com/facebookincubator/oomd), a userspace Out-Of-Memory (OOM) killer for Linux systems
- - [OpenH264](https://github.com/cisco/openh264), open source H.264 codec
- - [OpenHMD](https://github.com/OpenHMD/OpenHMD), a free and open source API and drivers for immersive technology, such as head mounted displays with built in head tracking
- - [OpenTitan](https://github.com/lowRISC/opentitan), an open source silicon Root of Trust (RoT) project.
- - [Orc](https://gitlab.freedesktop.org/gstreamer/orc), the Optimized Inner Loop Runtime Compiler
- - [OTS](https://github.com/khaledhosny/ots), the OpenType Sanitizer, parses and serializes OpenType files (OTF, TTF) and WOFF and WOFF2 font files, validating and sanitizing them as it goes. Used by Chromium and Firefox
- - [Outlier](https://github.com/kerolasa/outlier), a small Hello World style meson example project
- - [Pacman](https://git.archlinux.org/pacman.git/tree/), a package manager for Arch Linux
- - [Pango](https://git.gnome.org/browse/pango/), an Internationalized text layout and rendering library
- - [Parzip](https://github.com/jpakkane/parzip), a multithreaded reimplementation of Zip
- - [Peek](https://github.com/phw/peek), simple animated GIF screen recorder with an easy to use interface
- - [PicoLibc](https://github.com/keith-packard/picolibc), a standard C library for small embedded systems with limited RAM
- - [PipeWire](https://github.com/PipeWire/pipewire), a framework for video and audio for containerized applications
- - [Pithos](https://github.com/pithos/pithos), a Pandora Radio client
- - [Pitivi](https://github.com/pitivi/pitivi/), a nonlinear video editor
- - [Playerctl](https://github.com/acrisci/playerctl), mpris command-line controller and library for spotify, vlc, audacious, bmp, cmus, and others
- - [Polari](https://gitlab.gnome.org/GNOME/polari), an IRC client
- - [qboot](https://github.com/bonzini/qboot), a minimal x86 firmware for booting Linux kernels
- - [radare2](https://github.com/radare/radare2), unix-like reverse engineering framework and commandline tools (not the default)
- - [RxDock](https://gitlab.com/rxdock/rxdock), a protein-ligand docking software designed for high throughput virtual screening (fork of rDock)
- - [scrcpy](https://github.com/Genymobile/scrcpy), a cross platform application that provides display and control of Android devices connected on USB or over TCP/IP
- - [Sequeler](https://github.com/Alecaddd/sequeler), a friendly SQL client for Linux, built with Vala and Gtk
- - [Siril](https://gitlab.com/free-astro/siril), an image processing software for amateur astronomy
- - [SSHFS](https://github.com/libfuse/sshfs), allows you to mount a remote filesystem using SFTP
- - [sway](https://github.com/swaywm/sway), i3-compatible Wayland compositor
- - [Sysprof](https://git.gnome.org/browse/sysprof), a profiling tool
- - [systemd](https://github.com/systemd/systemd), the init system
- - [szl](https://github.com/dimkr/szl), a lightweight, embeddable scripting language
- - [Taisei Project](https://taisei-project.org/), an open-source Touhou Project clone and fangame
- - [Terminology](https://github.com/billiob/terminology), a terminal emulator based on the Enlightenment Foundation Libraries
- - [Tilix](https://github.com/gnunn1/tilix), a tiling terminal emulator for Linux using GTK+ 3
- - [Tizonia](https://github.com/tizonia/tizonia-openmax-il), a command-line cloud music player for Linux with support for Spotify, Google Play Music, YouTube, SoundCloud, TuneIn, Plex servers and Chromecast devices
- - [Vala Language Server](https://github.com/benwaffle/vala-language-server), code intelligence engine for the Vala and Genie programming languages
- - [Valum](https://github.com/valum-framework/valum), a micro web framework written in Vala
- - [Venom](https://github.com/naxuroqa/Venom), a modern Tox client for the GNU/Linux desktop
- - [VMAF](https://github.com/Netflix/vmaf) (by Netflix), a perceptual video quality assessment based on multi-method fusion
- - [Wayland](https://github.com/wayland-project/wayland) and [Weston](https://github.com/wayland-project/weston), a next generation display server
- - [wlroots](https://github.com/swaywm/wlroots), a modular Wayland compositor library
- - [wxFormBuilder](https://github.com/wxFormBuilder/wxFormBuilder), RAD tool for wxWidgets GUI design
- - [xi-gtk](https://github.com/eyelash/xi-gtk), a GTK+ front-end for the Xi editor
- - [Xorg](https://gitlab.freedesktop.org/xorg/xserver), the X.org display server (not the default yet)
- - [X Test Suite](https://gitlab.freedesktop.org/xorg/test/xts), The X.org test suite
- - [zathura](https://github.com/pwmt/zathura), a highly customizable and functional document viewer based on the
-girara user interface library and several document libraries
- - [Zrythm](https://git.zrythm.org/cgit/zrythm), a cross-platform digital audio workstation using GTK+ 3
- - [ZStandard](https://github.com/facebook/zstd/commit/4dca56ed832c6a88108a2484a8f8ff63d8d76d91), a compression algorithm developed at Facebook (not used by default)
-
-Note that a more up-to-date list of GNOME projects that use Meson can
-be found
-[here](https://wiki.gnome.org/Initiatives/GnomeGoals/MesonPorting).
diff --git a/meson/docs/markdown/Using-multiple-build-directories.md b/meson/docs/markdown/Using-multiple-build-directories.md
deleted file mode 100644 (file)
index ab6cf3c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# Using multiple build directories
-
-One of the main design goals of Meson has been to build all projects out-of-source. This means that *all* files generated during the build are placed in a separate subdirectory. This goes against common Unix tradition where you build your projects in-source. Building out of source gives two major advantages.
-
-First of all this makes for very simple `.gitignore` files. In classical build systems you may need to have tens of lines of definitions, most of which contain wildcards. When doing out of source builds all of this busywork goes away. A common ignore file for a Meson project only contains a few lines that are the build directory and IDE project files.
-
-Secondly this makes it very easy to clean your projects: just delete the build subdirectory and you are done. There is no need to guess whether you need to run `make clean`, `make distclean`, `make mrproper` or something else. When you delete a build subdirectory there is no possible way to have any lingering state from your old builds.
-
-The true benefit comes from somewhere else, though.
-
-## Multiple build directories for the same source tree
-
-Since a build directory is fully self contained and treats the source tree as a read-only piece of data, it follows that you can have arbitrarily many build trees for any source tree at the same time. Since all build trees can have different configuration, this is extremely powerful. Now you might be wondering why one would want to have multiple build setups at the same time. Let's examine this by setting up a hypothetical project.
-
-The first thing to do is to set up the default build, that is, the one we are going to use over 90% of the time. In this we use the system compiler and build with debug enabled and no optimizations so it builds as fast as possible. This is the default project type for Meson, so setting it up is simple.
-
-    mkdir builddir
-    meson builddir
-
-Another common setup is to build with debug and optimizations to, for example, run performance tests. Setting this up is just as simple.
-
-    mkdir buildopt
-    meson --buildtype=debugoptimized buildopt
-
-For systems where the default compiler is GCC, we would like to compile with Clang, too. So let's do that.
-
-    mkdir buildclang
-    CC=clang CXX=clang++ meson buildclang
-
-You can add cross builds, too. As an example, let's set up a Linux -> Windows cross compilation build using MinGW.
-
-    mkdir buildwine
-    meson --cross-file=mingw-cross.txt buildwine
-
-The cross compilation file sets up Wine so that not only can you compile your application, you can also run the unit test suite just by issuing the command `meson test`.
-
-To compile any of these build types, just cd into the corresponding build directory and run `meson compile` or instruct your IDE to do the same. Note that once you have set up your build directory once, you can just run Ninja and Meson will ensure that the resulting build is fully up to date according to the source. Even if you have not touched one of the directories in weeks and have done major changes to your build configuration, Meson will detect this and bring the build directory up to date (or print an error if it can't do that). This allows you to do most of your work in the default directory and use the others every now and then without having to babysit your build directories.
-
-## Specialized uses
-
-Separate build directories allows easy integration for various different kinds of tools. As an example, Clang comes with a static analyzer. It is meant to be run from scratch on a given source tree. The steps to run it with Meson are very simple.
-
-    rm -rf buildscan
-    mkdir buildscan
-    scan-build meson buildscan
-    cd buildscan
-    scan-build ninja
-
-These commands are the same for every single Meson project, so they could even be put in a script turning static analysis into a single command.
diff --git a/meson/docs/markdown/Using-the-WrapDB.md b/meson/docs/markdown/Using-the-WrapDB.md
deleted file mode 100644 (file)
index d8ea31c..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Using the WrapDB
-
-The Wrap database is a web service that provides Meson build definitions to projects that do not have it natively. Using it is simple. The service can be found [here](https://wrapdb.mesonbuild.com).
-
-The front page lists all projects that are on the service. Select the one you want and click it. The detail page lists available versions by branch and revision id. The branch names come from upstream releases and revision ids are version numbers internal to the database. Whenever the packaging is updated a new revision is released to the service a new revision with a bigger revision id is added. Usually you want to select the newest branch with the highest revision id.
-
-You can get the actual wrap file which tells Meson how to fetch the project by clicking on the download link on the page. As an example, the wrap file for [zlib-1.2.8, revision 4](https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/4/get_wrap) looks like this. You can find detailed documentation about it in [the Wrap manual](Wrap-dependency-system-manual.md).
-
-    [wrap-file]
-    directory = zlib-1.2.8
-
-    source_url = http://zlib.net/zlib-1.2.8.tar.gz
-    source_filename = zlib-1.2.8.tar.gz
-    source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
-
-    patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/4/get_zip
-    patch_filename = zlib-1.2.8-4-wrap.zip
-    patch_hash = 2327a42c8f73a4289ee8c9cd4abc43b324d0decc28d6e609e927f0a50321af4a
-
-Add this file to your project with the name `subprojects/zlib.wrap`. Then you can use it in your `meson.build` file with this directive:
-
-    zproj = subproject('zlib')
-
-When Meson encounters this it will automatically download, unpack and patch the source files.
-
-## Contributing build definitions
-
-The contents of the Wrap database are tracked in git repos of the [Mesonbuild project](https://github.com/mesonbuild). The actual process is simple and described in [submission documentation](Adding-new-projects-to-wrapdb.md).
diff --git a/meson/docs/markdown/Using-with-Visual-Studio.md b/meson/docs/markdown/Using-with-Visual-Studio.md
deleted file mode 100644 (file)
index c66cf3c..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
----
-short-description: How to use meson in Visual Studio
-...
-
-# Using with Visual Studio
-
-In order to generate Visual Studio projects, Meson needs to know the settings
-of your installed version of Visual Studio. The only way to get this
-information is to run Meson under the Visual Studio Command Prompt.
-
-You can always find the Visual Studio Command Prompt by searching from the
-Start Menu. However, the name is different for each Visual Studio version. With
-Visual Studio 2019, look for "x64 Native Tools Command Prompt for VS 2019".
-The next steps are [the same as always](https://mesonbuild.com/Running-Meson.html#configuring-the-build-directory):
-
-1. `cd` into your source directory
-1. `meson setup builddir`, which will create and setup the build directory
-1. `meson compile -C builddir`, to compile your code. You can also use `ninja -C builddir` here if you are using the default Ninja backend.
-
-If you wish to generate Visual Studio project files, pass `--backend vs`.
-At the time of writing the Ninja backend is more mature than the VS backend so
-you might want to use it for serious work.
-
-# Using Clang-CL with Visual Studio
-
-*(new in 0.52.0)*
-
-You will first need to get a copy of llvm+clang for Windows, such versions
-are available from a number of sources, including the llvm website. Then you
-will need the [llvm toolset extension for visual
-studio](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain).
-You then need to either use a [native file](Native-environments.md#binaries)
-or `set CC=clang-cl`, and `set CXX=clang-cl` to use those compilers, meson
-will do the rest.
-
-This only works with visual studio 2017 and 2019.
-
-There is currently no support in meson for clang/c2.
-
-# Using Intel-CL (ICL) with Visual Studio
-
-*(new in 0.52.0)*
-
-To use ICL you need only have ICL installed and launch an ICL development
-shell like you would for the ninja backend and meson will take care of it.
diff --git a/meson/docs/markdown/Using-wraptool.md b/meson/docs/markdown/Using-wraptool.md
deleted file mode 100644 (file)
index f6023e8..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# Using wraptool
-
-Wraptool is a subcommand of Meson that allows you to manage your
-source dependencies using the WrapDB database. It gives you all things
-you would expect, such as installing and updating dependencies. The
-wrap tool works on all platforms, the only limitation is that the wrap
-definition works on your target platform. If you find some Wraps that
-don't work, please file bugs or, even better, patches.
-
-All code examples here assume that you are running the commands in
-your top level source directory. Lines that start with the `$` mark
-are commands to type.
-
-## Simple querying
-
-The simplest operation to do is to query the list of packages
-available. To list them all issue the following command:
-
-    $ meson wrap list
-    box2d
-    enet
-    gtest
-    libjpeg
-    liblzma
-    libpng
-    libxml2
-    lua
-    ogg
-    sqlite
-    vorbis
-    zlib
-
-Usually you want to search for a specific package. This can be done
-with the `search` command:
-
-    $ meson wrap search jpeg
-    libjpeg
-
-To determine which versions of libjpeg are available to install, issue
-the `info` command:
-
-    $ meson wrap info libjpeg
-    Available versions of libjpeg:
-      9a 2
-
-The first number is the upstream release version, in this case
-`9a`. The second number is the Wrap revision number. They don't relate
-to anything in particular, but larger numbers imply newer
-releases. You should always use the newest available release.
-
-## Installing dependencies
-
-Installing dependencies is just as straightforward. First just create
-the `subprojects` directory at the top of your source tree and issue
-the install command.
-
-    $ meson wrap install libjpeg
-    Installed libjpeg branch 9a revision 2
-
-Now you can issue a `subproject('libjpeg')` in your `meson.build` file
-to use it.
-
-To check if your projects are up to date you can issue the `status` command.
-
-    $ meson wrap status
-    Subproject status
-     libjpeg up to date. Branch 9a, revision 2.
-     zlib not up to date. Have 1.2.8 2, but 1.2.8 4 is available.
-
-In this case `zlib` has a newer release available. Updating it is
-straightforward:
-
-    $ meson wrap update zlib
-    Updated zlib to branch 1.2.8 revision 4
-
-Wraptool can do other things besides these. Documentation for these
-can be found in the command line help, which can be accessed by
-`meson wrap --help`.
-
-## Promoting dependencies
-
-Meson will only search for subprojects from the top level
-`subprojects` directory. If you have subprojects that themselves have
-subprojects, you must transfer them to the top level. This can be done
-by going to your source root and issuing a promotion command.
-
-    meson wrap promote projname
-
-This will cause Meson to go through your entire project tree, find an
-embedded subproject and copy it to the top level.
-
-If there are multiple embedded copies of a subproject, Meson will not
-try to guess which one you want. Instead it will print all the
-possibilities. You can then manually select which one to promote by
-writing it out fully.
-
-    meson wrap promote subprojects/s1/subprojects/projname
-
-This functionality was added in Meson release 0.45.0.
diff --git a/meson/docs/markdown/Vala.md b/meson/docs/markdown/Vala.md
deleted file mode 100644 (file)
index cbb58a9..0000000
+++ /dev/null
@@ -1,322 +0,0 @@
----
-title: Vala
-short-description: Compiling Vala and Genie programs
-...
-
-# Compiling Vala applications and libraries
-Meson supports compiling applications and libraries written in
-[Vala](https://vala-project.org/) and
-[Genie](https://wiki.gnome.org/Projects/Genie) . A skeleton `meson.build` file:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-You must always specify the `glib-2.0` and `gobject-2.0` libraries as
-dependencies, because all current Vala applications use them.
-[GLib](https://developer.gnome.org/glib/stable/) is used for basic data types
-and [GObject](https://developer.gnome.org/gobject/stable/) is used for the
-runtime type system.
-
-
-## Using libraries
-Meson uses the [`dependency()`](Reference-manual.md#dependency) function to find
-the relevant VAPI, C headers and linker flags when it encounters a Vala source
-file in a build target. Vala needs a VAPI file and a C header or headers to use
-a library. The VAPI file helps map Vala code to the library's C programming
-interface. It is the
-[`pkg-config`](https://www.freedesktop.org/wiki/Software/pkg-config/) tool that
-makes finding these installed files all work seamlessly behind the scenes. When
-a `pkg-config` file doesn't exist for the library then the
-[`find_library()`](Reference-manual.md#find_library) method of the [compiler
-object](Reference-manual.md#compiler-object) needs to be used. Examples are
-given later.
-
-Note Vala uses libraries that follow the C Application Binary Interface (C ABI).
-The library, however, could be written in C, Vala, Rust, Go, C++ or any other
-language that can generate a binary compatible with the C ABI and so provides C
-headers.
-
-
-### The simplest case
-This first example is a simple addition to the `meson.build` file because:
-
- * the library has a `pkg-config` file, `gtk+-3.0.pc`
- * the VAPI is distributed with Vala and so installed with the Vala compiler
- * the VAPI is installed in Vala's standard search path
- * the VAPI, `gtk+-3.0.vapi`, has the same name as the `pkg-config` file
-
-Everything works seamlessly in the background and only a single extra line is
-needed:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-    dependency('gtk+-3.0'),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-GTK+ is the graphical toolkit used by GNOME, elementary OS and other desktop
-environments. The binding to the library, the VAPI file, is distributed with
-Vala.
-
-Other libraries may have a VAPI that is distributed with the library itself.
-Such libraries will have their VAPI file installed along with their other
-development files. The VAPI is installed in Vala's standard search path and so
-works just as seamlessly using the `dependency()` function.
-
-
-### Targeting a version of GLib
-Meson's [`dependency()`](Reference-manual.md#dependency) function allows a
-version check of a library. This is often used to check a minimum version is
-installed. When setting a minimum version of GLib, Meson will also pass this to
-the Vala compiler using the `--target-glib` option.
-
-This is needed when using GTK+'s user interface definition files with Vala's
-`[GtkTemplate]`, `[GtkChild]` and `[GtkCallback]` attributes. This requires
-`--target-glib 2.38`, or a newer version, to be passed to Vala. With Meson this
-is simply done with:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0', version: '>=2.38'),
-    dependency('gobject-2.0'),
-    dependency('gtk+-3.0'),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-Using `[GtkTemplate]` also requires the GTK+ user interface definition files to
-be built in to the binary as GResources. For completeness, the next example
-shows this:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0', version: '>=2.38'),
-    dependency('gobject-2.0'),
-    dependency('gtk+-3.0'),
-]
-
-sources = files('app.vala')
-
-sources += import( 'gnome' ).compile_resources(
-    'project-resources',
-    'src/resources/resources.gresource.xml',
-    source_dir: 'src/resources',
-)
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-
-### Adding to Vala's search path
-So far we have covered the cases where the VAPI file is either distributed with
-Vala or the library. A VAPI can also be included in the source files of your
-project. The convention is to put it in the `vapi` directory of your project.
-
-This is needed when a library does not have a VAPI or your project needs to link
-to another component in the project that uses the C ABI. For example if part of
-the project is written in C.
-
-The Vala compiler's `--vapidir` option is used to add the project directory to
-the VAPI search path. In Meson this is done with the `add_project_arguments()`
-function:
-
-```meson
-project('vala app', 'vala', 'c')
-
-vapi_dir = meson.current_source_dir() / 'vapi'
-
-add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-    dependency('foo'), # 'foo.vapi' will be resolved as './vapi/foo.vapi'
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-If the VAPI is for an external library then make sure that the VAPI name
-corresponds to the pkg-config file name.
-
-The [`vala-extra-vapis` repository](https://gitlab.gnome.org/GNOME/vala-extra-vapis)
-is a community maintained repository of VAPIs that are not distributed.
-Developers use the repository to share early work on new bindings and
-improvements to existing bindings. So the VAPIs can frequently change. It is
-recommended VAPIs from this repository are copied in to your project's source
-files.
-
-This also works well for starting to write new bindings before they are shared
-with the `vala-extra-vapis` repository.
-
-
-### Libraries without pkg-config files
-A library that does not have a corresponding pkg-config file may mean
-`dependency()` is unsuitable for finding the C and Vala interface files. In this
-case it is necessary to use the `find_library()` method of the compiler object.
-
-The first example uses Vala's POSIX binding. There is no pkg-config file because
-POSIX includes the standard C library on Unix systems. All that is needed is the
-VAPI file, `posix.vapi`. This is included with Vala and installed in Vala's
-standard search path. Meson just needs to be told to only find the library for
-the Vala compiler:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-    meson.get_compiler('vala').find_library('posix'),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-
-The next example shows how to link with a C library where no additional VAPI is
-needed. The standard maths functions are already bound in `glib-2.0.vapi`, but
-the GNU C library requires linking to the maths library separately. In this
-example Meson is told to find the library only for the C compiler:
-
-```meson
-project('vala app', 'vala', 'c')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-    meson.get_compiler('c').find_library('m', required: false),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-The `required: false` means the build will continue when using another C library
-that does not separate the maths library. See [Add math library (-lm)
-portably](howtox.md#add-math-library-lm-portably).
-
-The final example shows how to use a library that does not have a pkg-config
-file and the VAPI is in the `vapi` directory of your project source files:
-```meson
-project('vala app', 'vala', 'c')
-
-vapi_dir = meson.current_source_dir() / 'vapi'
-
-add_project_arguments(['--vapidir', vapi_dir], language: 'vala')
-
-dependencies = [
-    dependency('glib-2.0'),
-    dependency('gobject-2.0'),
-    meson.get_compiler('c').find_library('foo'),
-    meson.get_compiler('vala').find_library('foo', dir: vapi_dir),
-]
-
-sources = files('app.vala')
-
-executable('app_name', sources, dependencies: dependencies)
-```
-The `find_library()` method of the C compiler object will try to find the C
-header files and the library to link with.
-
-The `find_library()` method of the Vala compiler object needs to have the `dir`
-keyword added to include the project VAPI directory. This is not added
-automatically by `add_project_arguments()`.
-
-### Working with the Vala Preprocessor
-Passing arguments to [Vala's preprocessor](https://wiki.gnome.org/Projects/Vala/Manual/Preprocessor) requires specifying the language as `c`.  For example, the following statement sets the preprocessor symbol `FUSE_USE_VERSION` to the value `26`:
-
-```meson
-add_project_arguments('-DFUSE_USE_VERSION=26', language: 'c')
-```
-
-## Building libraries
-
-
-### Changing C header and VAPI names
-Meson's [`library`](Reference-manual.md#library) target automatically outputs
-the C header and the VAPI. They can be renamed by setting the `vala_header` and
-`vala_vapi` arguments respectively:
-
-```meson
-foo_lib = shared_library('foo', 'foo.vala',
-                  vala_header: 'foo.h',
-                  vala_vapi: 'foo-1.0.vapi',
-                  dependencies: [glib_dep, gobject_dep],
-                  install: true,
-                  install_dir: [true, true, true])
-```
-In this example, the second and third elements of the `install_dir` array
-indicate the destination with `true` to use default directories (i.e. `include`
-and `share/vala/vapi`).
-
-
-### GObject Introspection and language bindings
-A 'binding' allows another programming language to use a library written in
-Vala. Because Vala uses the GObject type system as its runtime type system it is
-very easy to use introspection to generate a binding. A Meson build of a Vala
-library can generate the GObject introspection metadata. The metadata is then
-used in separate projects with [language specific
-tools](https://wiki.gnome.org/Projects/Vala/LibraryWritingBindings) to generate
-a binding.
-
-The main form of metadata is a GObject Introspection Repository (GIR) XML file.
-GIRs are mostly used by languages that generate bindings at compile time.
-Languages that generate bindings at runtime mostly use a typelib file, which is
-generated from the GIR.
-
-Meson can generate a GIR as part of the build.  For a Vala library the
-`vala_gir` option has to be set for the `library`:
-
-```meson
-foo_lib = shared_library('foo', 'foo.vala',
-                  vala_gir: 'Foo-1.0.gir',
-                  dependencies: [glib_dep, gobject_dep],
-                  install: true,
-                  install_dir: [true, true, true, true])
-```
-
-The `true` value in `install_dir` tells Meson to use the default directory (i.e.
-`share/gir-1.0` for GIRs). The fourth element in the `install_dir` array
-indicates where the GIR file will be installed.
-
-To then generate a typelib file use a custom target with the `g-ir-compiler`
-program and a dependency on the library:
-
-```meson
-g_ir_compiler = find_program('g-ir-compiler')
-custom_target('foo typelib', command: [g_ir_compiler, '--output', '@OUTPUT@', '@INPUT@'],
-              input: meson.current_build_dir() / 'Foo-1.0.gir',
-              output: 'Foo-1.0.typelib',
-              depends: foo_lib,
-              install: true,
-              install_dir: get_option('libdir') / 'girepository-1.0')
-```
diff --git a/meson/docs/markdown/Videos.md b/meson/docs/markdown/Videos.md
deleted file mode 100644 (file)
index fb60038..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
----
-short-description: Videos about Meson
-...
-
-# Videos
-
- - [Behind (and under) the scenes of the Meson build
-   system](https://www.youtube.com/watch?v=iLN6wL7ExHU), Linux.conf.au
-   2020
-
- - [Behind the Scenes of a C++ Build
-   System](https://www.youtube.com/watch?v=34KzT2yvQuM), CppCon 2019
-
- - [Compiling Multi-Million Line C++ Code Bases Effortlessly with the
-   Meson Build system](https://www.youtube.com/watch?v=SCZLnopmYBM),
-   CppCon 2018
-
- - [The Meson Build System, 4+ years of work to become an overnight
-   success](https://www.youtube.com/watch?v=gHdTzdXkhRY), Linux.conf.au 2018
-
- - [Power through simplicity, using Python in the Meson Build
-   System](https://youtu.be/3jF3oVsjIEM), Piter.py, 2017
-
- - [Meson and the changing Linux build
-   landscape](https://media.ccc.de/v/ASG2017-111-meson_and_the_changing_linux_build_landscape),
-   All Systems Go 2017
-
- - [Meson, compiling the world with
-   Python](https://www.youtube.com/watch?v=sEO4DC8hm34), Europython
-   2017
-
- - [Builds, dependencies and deployment in a modern multiplatform
-   world](https://www.youtube.com/embed/CTJtKtQ8R5k), Linux.conf.au
-   2016
-
- - [New world, new tools](https://www.youtube.com/embed/0-gx1qU2pPo),
-   Libre Application Summit 2016
-
- - [Making build systems not
-   suck](https://www.youtube.com/embed/KPi0AuVpxLI), Linux.conf.au
-   2015, Auckland, New Zealand
-
- - [Lightning talk at FOSDEM
-   2014](http://mirror.onet.pl/pub/mirrors/video.fosdem.org/2014/H2215_Ferrer/Sunday/Introducing_the_Meson_build_system.webm),
-   The first ever public presentation on Meson
diff --git a/meson/docs/markdown/Vs-External.md b/meson/docs/markdown/Vs-External.md
deleted file mode 100644 (file)
index ab3d191..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# Visual Studio's external build projects
-
-Visual Studio supports developing projects that have an external build
-system. If you wish to use this integration method, here is how you
-set it up. This documentation describes Visual Studio 2019. Other
-versions have not been tested, but they should work roughly in the
-same way.
-
-## Creating and compiling
-
-Check out your entire project in some directory. Then open Visual
-Studio and select `File -> New -> Project` and from the list of
-project types select `Makefile project`. Click `Next`.
-
-Type your project's name In the `Project name` entry box. In this
-example we're going to use `testproj`. Next select the `Location`
-entry and browse to the root of your projet sources. Make sure that
-the checkbox `Place solution and project in the same directory` is
-checked. Click `Create`.
-
-The next dialog page defines build commands, which you should set up
-as follows:
-
-| entry | value |
-| ----- | ----- |
-|build  | `meson compile -C $(Configuration)` |
-|clean  | `meson compile -C $(Configuration) --clean` |
-|rebuild| `meson compile -C $(Configuration) --clean && meson compile -C $(Configuration)` |
-|Output | `$(Configuration)\name_of_your_executable.exe|
-
-
-Then click `Finish`.
-
-Visual Studio has created a subdirectory in your source root. It is
-named after the project name. In this case it would be `testproj`. Now
-you need to set up Meson for building both Debug and Release versions
-in this directory. Open a VS dev tool terminal, go to the source root
-and issue the following commands.
-
-```
-meson testproj\Debug
-meson testproj\Release --buildtype=debugoptimized
-```
-
-Now you should have a working VS solution that compiles and runs both
-in Debug and Release modes.
-
-## Adding sources to the project
-
-This project is not very useful on its own, because it does not list
-any source files. VS does not seem to support adding entire source
-trees at once, so you have to add sources to the solution manually.
-
-In the main view go to `Solution Explorer`, right click on the project
-you just created and select `Add -> Existing Item`, browse to your
-source tree and select all files you want to have in this project. Now
-you can use the editor and debugger as in a normal VS project.
diff --git a/meson/docs/markdown/Windows-module.md b/meson/docs/markdown/Windows-module.md
deleted file mode 100644 (file)
index 8c01a41..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-# Windows module
-
-This module provides functionality used to build applications for
-Windows.
-
-## Methods
-
-### compile_resources
-
-Compiles Windows `rc` files specified in the positional
-arguments. Returns an opaque object that you put in the list of
-sources for the target you want to have the resources in. This method
-has the following keyword argument.
-
-- `args` lists extra arguments to pass to the resource compiler
-- `depend_files` lists resource files that the resource script depends on
-  (e.g. bitmap, cursor, font, html, icon, message table, binary data or manifest
-  files referenced by the resource script) (*since 0.47.0*)
-- `depends` lists target(s) that this target depends on, even though it does not
-  take them as an argument (e.g. as above, but generated) (*since 0.47.0*)
-- `include_directories` lists directories to be both searched by the resource
-  compiler for referenced resource files, and added to the preprocessor include
-  search path.
-
-The resource compiler executable used is the first which exists from the
-following list:
-
-1. The `windres` executable given in the `[binaries]` section of the cross-file
-2. The `WINDRES` environment variable
-3. The resource compiler which is part of the same toolset as the C or C++ compiler in use.
diff --git a/meson/docs/markdown/Wrap-best-practices-and-tips.md b/meson/docs/markdown/Wrap-best-practices-and-tips.md
deleted file mode 100644 (file)
index bdff9ee..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-# Wrap best practices and tips
-
-There are several things you need to take into consideration when
-writing a Meson build definition for a project. This is especially
-true when the project will be used as a subproject. This page lists a
-few things to consider when writing your definitions.
-
-## Do not put config.h in external search path
-
-Many projects use a `config.h` header file that they use for
-configuring their project internally. These files are never installed
-to the system header files so there are no inclusion collisions. This
-is not the case with subprojects, your project tree may have an
-arbitrary number of configuration files, so we need to ensure they
-don't clash.
-
-The basic problem is that the users of the subproject must be able to
-include subproject headers without seeing its `config.h` file. The
-most correct solution is to rename the `config.h` file into something
-unique, such as `foobar-config.h`. This is usually not feasible unless
-you are the maintainer of the subproject in question.
-
-The pragmatic solution is to put the config header in a directory that
-has no other header files and then hide that from everyone else. One
-way is to create a top level subdirectory called `internal` and use
-that to build your own sources, like this:
-
-```meson
-subdir('internal') # create config.h in this subdir
-internal_inc = include_directories('internal')
-shared_library('foo', 'foo.c', include_directories : internal_inc)
-```
-
-Many projects keep their `config.h` in the top level directory that
-has no other source files in it. In that case you don't need to move
-it but can just do this instead:
-
-```meson
-internal_inc = include_directories('.') # At top level meson.build
-```
-
-## Make libraries buildable both as static and shared
-
-Some platforms (e.g. iOS) requires linking everything in your main app
-statically. In other cases you might want shared libraries. They are
-also faster during development due to Meson's relinking
-optimization. However building both library types on all builds is
-slow and wasteful.
-
-Your project should use the `library` method that can be toggled
-between shared and static with the `default_library` builtin option.
-
-
-```meson
-mylib = library('foo', 'foo.c')
-```
-
-## Declare generated headers explicitly
-
-Meson's Ninja backend works differently from Make and other
-systems. Rather than processing things directory per directory, it
-looks at the entire build definition at once and runs the individual
-compile jobs in what might look to the outside as a random order.
-
-The reason for this is that this is much more efficient so your builds
-finish faster. The downside is that you have to be careful with your
-dependencies. The most common problem here is headers that are
-generated at compile time with e.g. code generators. If these headers
-are needed when building code that uses these libraries, the compile
-job might be run before the code generation step. The fix is to make
-the dependency explicit like this:
-
-```meson
-myheader = custom_target(...)
-mylibrary = shared_library(...)
-mydep = declare_dependency(link_with : mylibrary,
-  include_directories : include_directories(...),
-  sources : myheader)
-```
-
-And then you can use the dependency in the usual way:
-
-```meson
-executable('dep_using_exe', 'main.c',
-  dependencies : mydep)
-```
-
-Meson will ensure that the header file has been built before compiling `main.c`.
-
-## Avoid exposing compilable source files in declare_dependency
-
-The main use for the `sources` argument in `declare_dependency` is to
-construct the correct dependency graph for the backends, as
-demonstrated in the previous section. It is extremely important to
-note that it should *not* be used to directly expose compilable
-sources (`.c`, `.cpp`, etc.) of dependencies, and should rather only
-be used for header/config files. The following example will illustrate
-what can go wrong if you accidentally expose compilable source files.
-
-So you've read about unity builds and how Meson natively supports
-them. You decide to expose the sources of dependencies in order to
-have unity builds that include their dependencies. For your support
-library you do
-
-```meson
-my_support_sources = files(...)
-
-mysupportlib = shared_library(
-  ...
-  sources : my_support_sources,
-  ...)
-mysupportlib_dep = declare_dependency(
-  ...
-  link_with : mylibrary,
-  sources : my_support_sources,
-  ...)
-```
-
-And for your main project you do:
-
-```meson
-mylibrary = shared_library(
-  ...
-  dependencies : mysupportlib_dep,
-  ...)
-myexe = executable(
-  ...
-  link_with : mylibrary,
-  dependencies : mysupportlib_dep,
-  ...)
-```
-
-This is extremely dangerous. When building, `mylibrary` will build and
-link the support sources `my_support_sources` into the resulting
-shared library. Then, for `myexe`, these same support sources will be
-compiled again, will be linked into the resulting executable, in
-addition to them being already present in `mylibrary`. This can
-quickly run afoul of the [One Definition Rule
-(ODR)](https://en.wikipedia.org/wiki/One_Definition_Rule) in C++, as
-you have more than one definition of a symbol, yielding undefined
-behavior. While C does not have a strict ODR rule, there is no
-language in the standard which guarantees such behavior to
-work. Violations of the ODR can lead to weird idiosyncratic failures
-such as segfaults. In the overwhelming number of cases, exposing
-library sources via the `sources` argument in `declare_dependency` is
-thus incorrect. If you wish to get full cross-library performance,
-consider building `mysupportlib` as a static library instead and
-employing LTO.
-
-There are exceptions to this rule. If there are some natural
-constraints on how your library is to be used, you can expose
-sources. For instance, the WrapDB module for GoogleTest directly
-exposes the sources of GTest and GMock. This is valid, as GTest and
-GMock will only ever be used in *terminal* link targets. A terminal
-target is the final target in a dependency link chain, for instance
-`myexe` in the last example, whereas `mylibrary` is an intermediate
-link target. For most libraries this rule is not applicable though, as
-you cannot in general control how others consume your library, and as
-such should not expose sources.
diff --git a/meson/docs/markdown/Wrap-dependency-system-manual.md b/meson/docs/markdown/Wrap-dependency-system-manual.md
deleted file mode 100644 (file)
index 8e6282e..0000000
+++ /dev/null
@@ -1,241 +0,0 @@
-# Wrap dependency system manual
-
-One of the major problems of multiplatform development is wrangling
-all your dependencies. This is awkward on many platforms, especially
-on ones that do not have a built-in package manager. The latter problem
-has been worked around by having third party package managers. They
-are not really a solution for end user deployment, because you can't
-tell them to install a package manager just to use your app. On these
-platforms you must produce self-contained applications. Same applies
-when destination platform is missing (up-to-date versions of) your
-application's dependencies.
-
-The traditional approach to this has been to bundle dependencies
-inside your own project. Either as prebuilt libraries and headers or
-by embedding the source code inside your source tree and rewriting
-your build system to build them as part of your project.
-
-This is both tedious and error prone because it is always done by
-hand. The Wrap dependency system of Meson aims to provide an automated
-way to do this.
-
-## How it works
-
-Meson has a concept of [subprojects](Subprojects.md). They are a way
-of nesting one Meson project inside another. Any project that builds
-with Meson can detect that it is built as a subproject and build
-itself in a way that makes it easy to use (usually this means as a
-static library).
-
-To use this kind of a project as a dependency you could just copy and
-extract it inside your project's `subprojects` directory.
-
-However there is a simpler way. You can specify a Wrap file that tells Meson
-how to download it for you. If you then use this subproject in your build,
-Meson will automatically download and extract it during build. This makes
-subproject embedding extremely easy.
-
-All wrap files must have a name of `<project_name>.wrap` form and be in `subprojects` dir.
-
-Currently Meson has four kinds of wraps:
-- wrap-file
-- wrap-git
-- wrap-hg
-- wrap-svn
-
-## wrap format
-
-Wrap files are written in ini format, with a single header containing the type
-of wrap, followed by properties describing how to obtain the sources, validate
-them, and modify them if needed. An example wrap-file for the wrap named
-`libfoobar` would have a filename `libfoobar.wrap` and would look like this:
-
-```ini
-[wrap-file]
-directory = libfoobar-1.0
-
-source_url = https://example.com/foobar-1.0.tar.gz
-source_filename = foobar-1.0.tar.gz
-source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663
-```
-
-An example wrap-git will look like this:
-
-```ini
-[wrap-git]
-url = https://github.com/libfoobar/libfoobar.git
-revision = head
-```
-
-## Accepted configuration properties for wraps
-- `directory` - name of the subproject root directory, defaults to the name of the wrap.
-
-Since *0.55.0* those can be used in all wrap types, they were previously reserved to `wrap-file`:
-
-- `patch_url` - download url to retrieve an optional overlay archive
-- `patch_fallback_url` - fallback URL to be used when download from `patch_url` fails *Since: 0.55.0*
-- `patch_filename` - filename of the downloaded overlay archive
-- `patch_hash` - sha256 checksum of the downloaded overlay archive
-- `patch_directory` - *Since 0.55.0* Overlay directory, alternative to `patch_filename` in the case
-  files are local instead of a downloaded archive. The directory must be placed in
-  `subprojects/packagefiles`.
-
-### Specific to wrap-file
-- `source_url` - download url to retrieve the wrap-file source archive
-- `source_fallback_url` - fallback URL to be used when download from `source_url` fails *Since: 0.55.0*
-- `source_filename` - filename of the downloaded source archive
-- `source_hash` - sha256 checksum of the downloaded source archive
-- `lead_directory_missing` - for `wrap-file` create the leading
-  directory name. Needed when the source file does not have a leading
-  directory.
-
-Since *0.55.0* it is possible to use only the `source_filename` and
-`patch_filename` value in a .wrap file (without `source_url` and `patch_url`) to
-specify a local archive in the `subprojects/packagefiles` directory. The `*_hash`
-entries are optional when using this method. This method should be prefered over
-the old `packagecache` approach described below.
-
-Since *0.49.0* if `source_filename` or `patch_filename` is found in the
-project's `subprojects/packagecache` directory, it will be used instead
-of downloading the file, even if `--wrap-mode` option is set to
-`nodownload`. The file's hash will be checked.
-
-### Specific to VCS-based wraps
-- `url` - name of the wrap-git repository to clone. Required.
-- `revision` - name of the revision to checkout. Must be either: a
-  valid value (such as a git tag) for the VCS's `checkout` command, or
-  (for git) `head` to track upstream's default branch. Required.
-
-### Specific to wrap-git
-- `depth` - shallowly clone the repository to X number of commits. Note
-  that git always allow shallowly cloning branches, but in order to
-  clone commit ids shallowly, the server must support
-  `uploadpack.allowReachableSHA1InWant=true`.  *(since 0.52.0)*
-- `push-url` - alternative url to configure as a git push-url. Useful if
-  the subproject will be developed and changes pushed upstream.
-  *(since 0.37.0)*
-- `clone-recursive` - also clone submodules of the repository
-  *(since 0.48.0)*
-
-## wrap-file with Meson build patch
-
-Unfortunately most software projects in the world do not build with
-Meson. Because of this Meson allows you to specify a patch URL.
-
-For historic reasons this is called a "patch", however, it serves as an
-overlay to add or replace files rather than modifying them. The file
-must be an archive; it is downloaded and automatically extracted into
-the subproject. The extracted files will include a meson build
-definition for the given subproject.
-
-This approach makes it extremely simple to embed dependencies that
-require build system changes. You can write the Meson build definition
-for the dependency in total isolation. This is a lot better than doing
-it inside your own source tree, especially if it contains hundreds of
-thousands of lines of code. Once you have a working build definition,
-just zip up the Meson build files (and others you have changed) and
-put them somewhere where you can download them.
-
-Prior to *0.55.0* Meson build patches were only supported for wrap-file mode.
-When using wrap-git, the repository must contain all Meson build definitions.
-Since *0.55.0* Meson build patches are supported for any wrap modes, including
-wrap-git.
-
-## `provide` section
-
-*Since *0.55.0*
-
-Wrap files can define the dependencies it provides in the `[provide]` section.
-
-```ini
-[provide]
-dependency_names = foo-1.0
-```
-
-When a wrap file provides the dependency `foo-1.0`, as above, any call to
-`dependency('foo-1.0')` will automatically fallback to that subproject even if
-no `fallback` keyword argument is given. A wrap file named `foo.wrap` implicitly
-provides the dependency name `foo` even when the `[provide]` section is missing.
-
-Optional dependencies, like `dependency('foo-1.0', required: get_option('foo_opt'))`
-where `foo_opt` is a feature option set to `auto`, will not fallback to the
-subproject defined in the wrap file, for 2 reasons:
-- It allows for looking the dependency in other ways first, for example using
-  `cc.find_library('foo')`, and only fallback if that fails:
-
-```meson
-# this won't use fallback defined in foo.wrap
-foo_dep = dependency('foo-1.0', required: false)
-if not foo_dep.found()
-  foo_dep = cc.find_library('foo', has_headers: 'foo.h', required: false)
-  if not foo_dep.found()
-    # This will use the fallback
-    foo_dep = dependency('foo-1.0')
-    # or
-    foo_dep = dependency('foo-1.0', required: false, fallback: 'foo')
-  endif
-endif
-```
-
-- Sometimes not-found dependency is preferable to a fallback when the feature is
-  not explicitly requested by the user. In that case
-  `dependency('foo-1.0', required: get_option('foo_opt'))` will only fallback
-  when the user sets `foo_opt` to `enabled` instead of `auto`.
-
-If it is desired to fallback for an optional dependency, the `fallback` keyword
-argument must be passed explicitly. For example
-`dependency('foo-1.0', required: get_option('foo_opt'), fallback: 'foo')` will
-use the fallback even when `foo_opt` is set to `auto`.
-
-This mechanism assumes the subproject calls `meson.override_dependency('foo-1.0', foo_dep)`
-so Meson knows which dependency object should be used as fallback. Since that
-method was introduced in version *0.54.0*, as a transitional aid for projects
-that do not yet make use of it the variable name can be provided in the wrap file
-with entries in the format `foo-1.0 = foo_dep`.
-
-For example when using a recent enough version of glib that uses
-`meson.override_dependency()` to override `glib-2.0`, `gobject-2.0` and `gio-2.0`,
-a wrap file would look like:
-```ini
-[wrap-git]
-url=https://gitlab.gnome.org/GNOME/glib.git
-revision=glib-2-62
-
-[provide]
-dependency_names = glib-2.0, gobject-2.0, gio-2.0
-```
-
-With older version of glib dependency variable names need to be specified:
-```ini
-[wrap-git]
-url=https://gitlab.gnome.org/GNOME/glib.git
-revision=glib-2-62
-
-[provide]
-glib-2.0=glib_dep
-gobject-2.0=gobject_dep
-gio-2.0=gio_dep
-```
-
-Programs can also be provided by wrap files, with the `program_names` key:
-```ini
-[provide]
-program_names = myprog, otherprog
-```
-
-With such wrap file, `find_program('myprog')` will automatically fallback to use
-the subproject, assuming it uses `meson.override_find_program('myprog')`.
-
-## Using wrapped projects
-
-Wraps provide a convenient way of obtaining a project into your subproject directory.
-Then you use it as a regular subproject (see [subprojects](Subprojects.md)).
-
-## Getting wraps
-
-Usually you don't want to write your wraps by hand.
-
-There is an online repository called [WrapDB](https://wrapdb.mesonbuild.com) that provides
-many dependencies ready to use. You can read more about WrapDB [here](Using-the-WrapDB.md).
-
-There is also a Meson subcommand to get and manage wraps (see [using wraptool](Using-wraptool.md)).
diff --git a/meson/docs/markdown/Wrap-maintainer-tools.md b/meson/docs/markdown/Wrap-maintainer-tools.md
deleted file mode 100644 (file)
index 717d0d2..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-# Wrap maintainer tools
-
-The [mesonwrap repository](https://github.com/mesonbuild/mesonwrap) provides tools
-to maintain the WrapDB. Read-only features such can be used by anyone without Meson admin rights.
-
-## Personal access token
-
-Some tools require access to the Github API.
-A [personal access token](https://github.com/settings/tokens) may be required
-if the freebie Github API quota is exhausted. `public_repo` scope is required
-for write operations.
-
-```
-$ cat ~/.config/mesonwrap.ini
-[mesonwrap]
-github_token = <github token>
-```
diff --git a/meson/docs/markdown/Wrap-review-guidelines.md b/meson/docs/markdown/Wrap-review-guidelines.md
deleted file mode 100644 (file)
index 3e41a8d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Wrap review guidelines
-
-In order to get a package in the Wrap database it must be reviewed and
-accepted by someone with admin rights. Here is a list of items to
-check in the review. If some item is not met it does not mean that the
-package is rejected. What should be done will be determined on a
-case-by-case basis. Similarly meeting all these requirements does not
-guarantee that the package will get accepted. Use common sense.
-
-The review process is partially automated by the [mesonwrap](Wrap-maintainer-tools.md)
-`review` tool.
-
-```
-mesonwrap review zlib --pull-request=1 [--approve]
-```
-
-Since not every check can be automated please pay attention to the following during the review:
-
-- Download link points to an authoritative upstream location.
-- Version branch is created from master.
-- Except for the existing code, `LICENSE.build` is mandatory.
-- `project()` has a version and it matches the source version.
-- `project()` has a license.
-- Complex `configure_file()` inputs are documented.
-  If the file is a copy of a project file make sure it is clear what was changed.
-- Unit tests are enabled if the project provides them.
-- There are no guidelines if `install()` is a good or a bad thing in wraps.
-- If the project can't be tested on the host platform consider using the `--cross-file` flag.
-  See [the issue](https://github.com/mesonbuild/mesonwrap/issues/125).
-
-Encourage wrap readability. Use your own judgement.
-
-## Approval
-
-If the code looks good use the `--approve` flag to merge it.
-The tool automatically creates a release.
diff --git a/meson/docs/markdown/_Sidebar.md b/meson/docs/markdown/_Sidebar.md
deleted file mode 100644 (file)
index 2637d68..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-## Quick References
-
-* [Functions](Reference-manual.md)
-* [Options](Build-options.md)
-* [Configuration](Configuration.md)
-* [Dependencies](Dependencies.md)
-* [Tests](Unit-tests.md)
-* [Syntax](Syntax.md)
-
-### [Modules](Module-reference.md)
-
-* [gnome](Gnome-module.md)
-* [i18n](i18n-module.md)
-* [pkgconfig](Pkgconfig-module.md)
diff --git a/meson/docs/markdown/fallback-wraptool.md b/meson/docs/markdown/fallback-wraptool.md
deleted file mode 100644 (file)
index 9f4814b..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
----
-title: fallback wraptool
-...
-
-# In case of emergency
-
-In case wraptool is down we have created a backup script that you can
-use to download wraps directly from the GitHub repos. It is not as
-slick and may have bugs but at least it will allow you to use wraps.
-
-## Using it
-
-To list all available wraps:
-
-    ghwt.py list
-
-To install a wrap, go to your source root, make sure that the
-`subprojects` directory exists and run this command:
-
-    ghwt.py install <projectname> [<branchname>]
-
-This will stage the subproject ready to use. If you have multiple
-subprojects you need to download them all manually.
-
-Specifying branch name is optional. If not specified, the list
-of potential branches is sorted alphabetically and the last branch is 
-used.
-
-*Note* The tool was added in 0.32.0, for versions older than that you
-need to delete the `foo.wrap` file to work around this issue.
-
-## How to upgrade an existing dir/fix broken state/any other problem
-
-Nuke the contents of `subprojects` and start again.
-
-## Known issues
-
-Some repositories show up in the list but are not installable. They
-would not show up in the real WrapDB because they are works in
-progress.
-
-GitHub web API limits the amount of queries you can do to 60/hour. If
-you exceed that you need to wait for the timer to reset.
diff --git a/meson/docs/markdown/howtox.md b/meson/docs/markdown/howtox.md
deleted file mode 100644 (file)
index c89f883..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-# How do I do X in Meson?
-
-This page lists code snippets for common tasks. These are written
-mostly using the C compiler, but the same approach should work on
-almost all other compilers.
-
-## Set compiler
-
-When first running Meson, set it in an environment variable.
-
-```console
-$ CC=mycc meson <options>
-```
-
-Note that environment variables like `CC` only works in native builds. The `CC`
-refers to the compiler for the host platform, that is the compiler used to
-compile programs that run on the machine we will eventually install the project
-on. The compiler used to build things that run on the machine we do the
-building can be specified with `CC_FOR_BUILD`. You can use it in cross builds.
-
-Note that environment variables are never the idiomatic way to do anything with
-Meson, however. It is better to use the native and cross files. And the tools
-for the host platform in cross builds can only be specified with a cross file.
-
-There is a table of all environment variables supported [Here](Reference-tables.md#compiler-and-linker-selection-variables)
-
-
-## Set dynamic linker
-
-*New in 0.53.0*
-
-Like the compiler, the linker is selected via the `<compiler variable>_LD`
-environment variable, or through the `<compiler entry>_ld` entry in a native
-or cross file. You must be aware of whether you're using a compiler that
-invokes the linker itself (most compilers including GCC and Clang) or a
-linker that is invoked directly (when using MSVC or compilers that act like
-it, including Clang-Cl). With the former `c_ld` or `CC_LD` should be the value
-to pass to the compiler's special argument (such as `-fuse-ld` with clang and
-gcc), with the latter it should be an executable, such as `lld-link.exe`.
-
-*NOTE* In meson 0.53.0 the `ld` entry in the cross/native file and the `LD`
-environment variable were used, this resulted in a large number of regressions
-and was changed in 0.53.1 to `<lang>_ld` and `<comp variable>_LD`.
-
-```console
-$ CC=clang CC_LD=lld meson <options>
-```
-
-or
-
-```console
-$ CC=clang-cl CC_LD=link meson <options>
-```
-
-or in a cross or native file:
-
-```ini
-[binaries]
-c = 'clang'
-c_ld = 'lld'
-```
-
-There is a table of all environment variables supported [Here](Reference-tables.md#compiler-and-linker-selection-variables)
-
-
-## Set default C/C++ language version
-
-```meson
-project('myproj', 'c', 'cpp',
-        default_options : ['c_std=c11', 'cpp_std=c++11'])
-```
-
-The language version can also be set on a per-target basis.
-
-```meson
-executable(..., override_options : ['c_std=c11'])
-```
-
-## Enable threads
-
-Lots of people seem to do this manually with `find_library('pthread')`
-or something similar. Do not do that. It is not portable. Instead do
-this.
-
-```meson
-thread_dep = dependency('threads')
-executable(..., dependencies : thread_dep)
-```
-
-## Set extra compiler and linker flags from the outside (when e.g. building distro packages)
-
-The behavior is the same as with other build systems, with environment
-variables during first invocation. Do not use these when you need to rebuild
-the source
-
-```console
-$ CFLAGS=-fsomething LDFLAGS=-Wl,--linker-flag meson <options>
-```
-
-## Use an argument only with a specific compiler
-
-First check which arguments to use.
-
-```meson
-if meson.get_compiler('c').get_id() == 'clang'
-  extra_args = ['-fclang-flag']
-else
-  extra_args = []
-endif
-```
-
-Then use it in a target.
-
-```meson
-executable(..., c_args : extra_args)
-```
-
-If you want to use the arguments on all targets, then do this.
-
-```meson
-if meson.get_compiler('c').get_id() == 'clang'
-  add_global_arguments('-fclang-flag', language : 'c')
-endif
-```
-
-## Set a command's output to configuration
-
-```meson
-txt = run_command('script', 'argument').stdout().strip()
-cdata = configuration_data()
-cdata.set('SOMETHING', txt)
-configure_file(...)
-```
-
-## Generate a runnable script with `configure_file`
-
-`configure_file` preserves metadata so if your template file has
-execute permissions, the generated file will have them too.
-
-## Producing a coverage report
-
-First initialize the build directory with this command.
-
-```console
-$ meson <other flags> -Db_coverage=true
-```
-
-Then issue the following commands.
-
-```console
-$ meson compile
-$ meson test
-$ meson compile coverage-html (or coverage-xml)
-```
-
-The coverage report can be found in the meson-logs subdirectory.
-
-*New in 0.55.0* llvm-cov support for use with clang
-
-## Add some optimization to debug builds
-
-By default the debug build does not use any optimizations. This is the
-desired approach most of the time. However some projects benefit from
-having some minor optimizations enabled. GCC even has a specific
-compiler flag `-Og` for this. To enable its use, just issue the
-following command.
-
-```console
-$ meson configure -Dc_args=-Og
-```
-
-This causes all subsequent builds to use this command line argument.
-
-## Use address sanitizer
-
-Clang comes with a selection of analysis tools such as the [address
-sanitizer](https://clang.llvm.org/docs/AddressSanitizer.html). Meson
-has native support for these with the `b_sanitize` option.
-
-```console
-$ meson <other options> -Db_sanitize=address
-```
-
-After this you just compile your code and run the test suite. Address
-sanitizer will abort executables which have bugs so they show up as
-test failures.
-
-## Use Clang static analyzer
-
-Install scan-build and configure your project. Then do this:
-
-```console
-$ meson compile scan-build
-```
-
-You can use the `SCANBUILD` environment variable to choose the
-scan-build executable.
-
-```console
-$ SCANBUILD=<your exe> meson compile scan-build
-```
-
-
-## Use profile guided optimization
-
-Using profile guided optimization with GCC is a two phase
-operation. First we set up the project with profile measurements
-enabled and compile it.
-
-```console
-$ meson setup <Meson options, such as --buildtype=debugoptimized> -Db_pgo=generate
-$ meson compile -C builddir
-```
-
-Then we need to run the program with some representative input. This
-step depends on your project.
-
-Once that is done we change the compiler flags to use the generated
-information and rebuild.
-
-```console
-$ meson configure -Db_pgo=use
-$ meson compile
-```
-
-After these steps the resulting binary is fully optimized.
-
-## Add math library (`-lm`) portably
-
-Some platforms (e.g. Linux) have a standalone math library. Other
-platforms (pretty much everyone else) do not. How to specify that `m`
-is used only when needed?
-
-```meson
-cc = meson.get_compiler('c')
-m_dep = cc.find_library('m', required : false)
-executable(..., dependencies : m_dep)
-```
-
-## Install an executable to `libexecdir`
-
-```meson
-executable(..., install : true, install_dir : get_option('libexecdir'))
-```
-
-## Use existing `Find<name>.cmake` files
-
-Meson can use the CMake `find_package()` ecosystem if CMake is installed.
-To find a dependency with custom `Find<name>.cmake`, set the `cmake_module_path`
-property to the path in your project where the CMake scripts are stored.
-
-Example for a `FindCmakeOnlyDep.cmake` in a `cmake` subdirectory:
-
-```meson
-cm_dep = dependency('CmakeOnlyDep', cmake_module_path : 'cmake')
-```
-
-The `cmake_module_path` property is only needed for custom CMake scripts. System
-wide CMake scripts are found automatically.
-
-More information can be found [here](Dependencies.md#cmake)
-
-## Get a default not-found dependency?
-
-```meson
-null_dep = dependency('', required : false)
-```
-
-This can be used in cases where you want a default value, but might override it
-later.
-
-```meson
-# Not needed on Windows!
-my_dep = dependency('', required : false)
-if host_machine.system() in ['freebsd', 'netbsd', 'openbsd', 'dragonfly']
-  my_dep = dependency('some dep', required : false)
-elif host_machine.system() == 'linux'
-  my_dep = dependency('some other dep', required : false)
-endif
-
-executable(
-  'myexe',
-  my_sources,
-  deps : [my_dep]
-)
-```
diff --git a/meson/docs/markdown/i18n-module.md b/meson/docs/markdown/i18n-module.md
deleted file mode 100644 (file)
index 4948fab..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# I18n module
-
-This module provides internationalisation and localisation functionality.
-
-## Usage
-
-To use this module, just do: **`i18n = import('i18n')`**. The
-following functions will then be available as methods on the object
-with the name `i18n`. You can, of course, replace the name `i18n` with
-anything else.
-
-### i18n.gettext()
-
-Sets up gettext localisation so that translations are built and placed
-into their proper locations during install. Takes one positional
-argument which is the name of the gettext module.
-
-* `args`: list of extra arguments to pass to `xgettext` when
-  generating the pot file
-* `data_dirs`: (*Added 0.36.0*) list of directories to be set for
-  `GETTEXTDATADIRS` env var (Requires gettext 0.19.8+), used for local
-  its files
-* `languages`: list of languages that are to be generated. As of
-  0.37.0 this is optional and the
-  [LINGUAS](https://www.gnu.org/software/gettext/manual/html_node/po_002fLINGUAS.html)
-  file is read.
-* `preset`: (*Added 0.37.0*) name of a preset list of arguments,
-  current option is `'glib'`, see
-  [source](https://github.com/mesonbuild/meson/blob/master/mesonbuild/modules/i18n.py)
-  for for their value
-* `install`: (*Added 0.43.0*) if false, do not install the built translations.
-* `install_dir`: (*Added 0.50.0*) override default install location, default is `localedir`
-
-This function also defines targets for maintainers to use:
-**Note**: These output to the source directory
-
-* `<project_id>-pot`: runs `xgettext` to regenerate the pot file
-* `<project_id>-update-po`: regenerates the `.po` files from current `.pot` file
-* `<project_id>-gmo`: builds the translations without installing
-
-### i18n.merge_file()
-
-This merges translations into a text file using `msgfmt`. See
-[custom_target](Reference-manual.md#custom_target)
-for normal keywords. In addition it accepts these keywords:
-
-* `data_dirs`: (*Added 0.41.0*) list of directories for its files (See
-  also `i18n.gettext()`)
-* `po_dir`: directory containing translations, relative to current directory
-* `type`: type of file, valid options are `'xml'` (default) and `'desktop'`
-* `args`: (*Added 0.51.0*) list of extra arguments to pass to `msgfmt`
-
-*Added 0.37.0*
diff --git a/meson/docs/markdown/images/buildtime.png b/meson/docs/markdown/images/buildtime.png
deleted file mode 100644 (file)
index 2a44422..0000000
Binary files a/meson/docs/markdown/images/buildtime.png and /dev/null differ
diff --git a/meson/docs/markdown/images/conftime.png b/meson/docs/markdown/images/conftime.png
deleted file mode 100644 (file)
index 63754db..0000000
Binary files a/meson/docs/markdown/images/conftime.png and /dev/null differ
diff --git a/meson/docs/markdown/images/emptytime.png b/meson/docs/markdown/images/emptytime.png
deleted file mode 100644 (file)
index d80eab9..0000000
Binary files a/meson/docs/markdown/images/emptytime.png and /dev/null differ
diff --git a/meson/docs/markdown/images/glib_build.png b/meson/docs/markdown/images/glib_build.png
deleted file mode 100644 (file)
index ddb9947..0000000
Binary files a/meson/docs/markdown/images/glib_build.png and /dev/null differ
diff --git a/meson/docs/markdown/images/glib_conf.png b/meson/docs/markdown/images/glib_conf.png
deleted file mode 100644 (file)
index 5de60d5..0000000
Binary files a/meson/docs/markdown/images/glib_conf.png and /dev/null differ
diff --git a/meson/docs/markdown/images/glib_empty.png b/meson/docs/markdown/images/glib_empty.png
deleted file mode 100644 (file)
index 5976e7f..0000000
Binary files a/meson/docs/markdown/images/glib_empty.png and /dev/null differ
diff --git a/meson/docs/markdown/images/glib_link.png b/meson/docs/markdown/images/glib_link.png
deleted file mode 100644 (file)
index 23d9044..0000000
Binary files a/meson/docs/markdown/images/glib_link.png and /dev/null differ
diff --git a/meson/docs/markdown/images/gtksample.png b/meson/docs/markdown/images/gtksample.png
deleted file mode 100644 (file)
index b6557c4..0000000
Binary files a/meson/docs/markdown/images/gtksample.png and /dev/null differ
diff --git a/meson/docs/markdown/images/py3-install-1.png b/meson/docs/markdown/images/py3-install-1.png
deleted file mode 100644 (file)
index 74f0819..0000000
Binary files a/meson/docs/markdown/images/py3-install-1.png and /dev/null differ
diff --git a/meson/docs/markdown/images/py3-install-2.png b/meson/docs/markdown/images/py3-install-2.png
deleted file mode 100644 (file)
index 9a8f1fe..0000000
Binary files a/meson/docs/markdown/images/py3-install-2.png and /dev/null differ
diff --git a/meson/docs/markdown/images/py3-install-3.png b/meson/docs/markdown/images/py3-install-3.png
deleted file mode 100644 (file)
index b702910..0000000
Binary files a/meson/docs/markdown/images/py3-install-3.png and /dev/null differ
diff --git a/meson/docs/markdown/index.md b/meson/docs/markdown/index.md
deleted file mode 100644 (file)
index ccd341f..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
----
-render-subpages: false
-...
-
-# The Meson Build system
-
-## Overview
-
-Meson is an open source build system meant to be both extremely fast,
-and, even more importantly, as user friendly as possible.
-
-The main design point of Meson is that every moment a developer spends
-writing or debugging build definitions is a second wasted. So is every
-second spent waiting for the build system to actually start compiling
-code.
-
-## Features
-
-*   multiplatform support for Linux, macOS, Windows, GCC, Clang, Visual Studio and others
-*   supported languages include C, C++, D, Fortran, Java, Rust
-*   build definitions in a very readable and user friendly non-Turing complete DSL
-*   cross compilation for many operating systems as well as bare metal
-*   optimized for extremely fast full and incremental builds without sacrificing correctness
-*   built-in multiplatform dependency provider that works together with distro packages
-*   fun!
-
-## A full manual
-
-The documentation on this site is freely available for all. However
-there is also a full separate manual available for purchase [on this
-web page](https://meson-manual.com/).
-
-## Community
-
-There are two main methods of connecting with other Meson
-developers. The first one is the mailing list, which is hosted at
-[Google Groups](https://groups.google.com/forum/#!forum/mesonbuild).
-
-The second way is via IRC. The channel to use is `#mesonbuild` at
-[Freenode](https://freenode.net/).
-
-### [Projects using Meson](Users.md)
-
-Many projects out there are using Meson and their communities are also
-a great resource for learning about what (and what not too!) do when
-trying to convert to using Meson.
-
-[A short list of Meson users can be found here](Users.md)
-but there are many more. We would love to hear about your success
-stories too and how things could be improved too!
-
-## Development
-
-All development on Meson is done on the [GitHub
-project](https://github.com/mesonbuild/meson). Instructions for
-contributing can be found on the [contribution page](Contributing.md).
-
-
-You do not need to sign a CLA to contribute to Meson.
diff --git a/meson/docs/markdown/legal.md b/meson/docs/markdown/legal.md
deleted file mode 100644 (file)
index a14b7b9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-# Legal information
-
-Meson is copyrighted by all members of the Meson development team.
-Meson is licensed under the [Apache 2 license].
-
-Meson is a registered trademark of Jussi Pakkanen.
-
-## Meson logo licensing
-
-Meson's logo is (C) Jussi Pakkanen and used by the Meson project with
-specific permission. It is not licensed under the same terms as the
-rest of the project.
-
-If you are a third party and want to use the Meson logo, you must
-first obtain written permission from Jussi Pakkanen.
-
-## Website licensing
-
-The meson website content is released under [Creative Commons
-Attribution-ShareAlike 4.0 International].
-
-All code samples on the website are released under [CC0 1.0 Universal].
-
-[Creative Commons Attribution-ShareAlike 4.0 International]: https://creativecommons.org/licenses/by-sa/4.0/
-[CC0 1.0 Universal]: https://creativecommons.org/publicdomain/zero/1.0/
-[Apache 2 license]: https://www.apache.org/licenses/LICENSE-2.0
diff --git a/meson/docs/markdown/snippets/add_release_note_snippets_here b/meson/docs/markdown/snippets/add_release_note_snippets_here
deleted file mode 100644 (file)
index cdd57c6..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-DO NOT ADD ANYTHING TO THIS FILE!
-
-Add release note snippets to their own files, one file per snippet.
diff --git a/meson/docs/markdown_dynamic/Commands.md b/meson/docs/markdown_dynamic/Commands.md
deleted file mode 100644 (file)
index a35b4da..0000000
+++ /dev/null
@@ -1,296 +0,0 @@
-# Command-line commands
-
-There are two different ways of invoking Meson. First, you can run it directly
-from the source tree with the command `/path/to/source/meson.py`. Meson may
-also be installed in which case the command is simply `meson`. In this manual
-we only use the latter format for simplicity.
-
-Meson is invoked using the following syntax:
-`meson [COMMAND] [COMMAND_OPTIONS]`
-
-This section describes all available commands and some of their Optional arguments.
-The most common workflow is to run [`setup`](#setup), followed by [`compile`](#compile), and then [`install`](#install).
-
-For the full list of all available options for a specific command use the following syntax:
-`meson COMMAND --help`
-
-### configure
-
-```
-{{ cmd_help['configure']['usage'] }}
-```
-
-Changes options of a configured meson project.
-
-```
-{{ cmd_help['configure']['arguments'] }}
-```
-
-Most arguments are the same as in [`setup`](#setup).
-
-Note: reconfiguring project will not reset options to their default values (even if they were changed in `meson.build`).
-
-#### Examples:
-
-List all available options:
-```
-meson configure builddir
-```
-
-Change value of a single option:
-```
-meson configure builddir -Doption=new_value
-```
-
-### compile
-
-*(since 0.54.0)*
-
-```
-{{ cmd_help['compile']['usage'] }}
-```
-
-Builds a default or a specified target of a configured meson project.
-
-```
-{{ cmd_help['compile']['arguments'] }}
-```
-
-`--verbose` argument is available since 0.55.0.
-
-#### Targets
-
-*(since 0.55.0)*
-
-`TARGET` has the following syntax `[PATH/]NAME[:TYPE]`, where:
-- `NAME`: name of the target from `meson.build` (e.g. `foo` from `executable('foo', ...)`).
-- `PATH`: path to the target relative to the root `meson.build` file. Note: relative path for a target specified in the root `meson.build` is `./`.
-- `TYPE`: type of the target. Can be one of the following: 'executable', 'static_library', 'shared_library', 'shared_module', 'custom', 'run', 'jar'.
-  
-`PATH` and/or `TYPE` can be ommited if the resulting `TARGET` can be used to uniquely identify the target in `meson.build`.
-
-#### Backend specific arguments
-
-*(since 0.55.0)*
-
-`BACKEND-args` use the following syntax:
-
-If you only pass a single string, then it is considered to have all values separated by commas. Thus invoking the following command:
-
-```
-$ meson compile --ninja-args=-n,-d,explain
-```
-
-would add `-n`, `-d` and `explain` arguments to ninja invocation.
-
-If you need to have commas or spaces in your string values, then you need to pass the value with proper shell quoting like this:
-
-```
-$ meson compile "--ninja-args=['a,b', 'c d']"
-```
-
-#### Examples:
-
-Build the project:
-```
-meson compile -C builddir
-```
-
-Execute a dry run on ninja backend with additional debug info:
-```
-meson compile --ninja-args=-n,-d,explain
-```
-
-Build three targets: two targets that have the same `foo` name, but different type, and a `bar` target:
-```
-meson compile foo:shared_library foo:static_library bar
-```
-
-Produce a coverage html report (if available):
-```
-meson compile coverage-html
-```
-
-### dist
-
-*(since 0.52.0)*
-
-```
-{{ cmd_help['dist']['usage'] }}
-```
-
-Generates a release archive from the current source tree.
-
-```
-{{ cmd_help['dist']['arguments'] }}
-```
-
-See [notes about creating releases](Creating-releases.md) for more info.
-
-#### Examples:
-
-Create a release archive:
-```
-meson dist -C builddir
-```
-
-### init
-
-*(since 0.45.0)*
-
-```
-{{ cmd_help['init']['usage'] }}
-```
-
-Creates a basic set of build files based on a template.
-
-```
-{{ cmd_help['init']['arguments'] }}
-```
-
-#### Examples:
-
-Create a project in `sourcedir`:
-```
-meson init -C sourcedir
-```
-
-### introspect
-
-```
-{{ cmd_help['introspect']['usage'] }}
-```
-
-Displays information about a configured meson project.
-
-```
-{{ cmd_help['introspect']['arguments'] }}
-```
-
-#### Examples:
-
-Display basic information about a configured project in `builddir`:
-```
-meson introspect builddir
-```
-
-### install
-
-*(since 0.47.0)*
-
-```
-{{ cmd_help['install']['usage'] }}
-```
-
-Installs the project to the prefix specified in [`setup`](#setup).
-
-```
-{{ cmd_help['install']['arguments'] }}
-```
-
-See [the installation documentation](Installing.md) for more info.
-
-#### Examples:
-
-Install project to `prefix`:
-```
-meson install -C builddir
-```
-
-Install project to `$DESTDIR/prefix`:
-```
-DESTDIR=/path/to/staging/area meson install -C builddir
-```
-
-### rewrite
-
-*(since 0.50.0)*
-
-```
-{{ cmd_help['rewrite']['usage'] }}
-```
-
-Modifies the meson project.
-
-```
-{{ cmd_help['rewrite']['arguments'] }}
-```
-
-See [the meson file rewriter documentation](Rewriter.md) for more info.
-
-### setup
-
-```
-{{ cmd_help['setup']['usage'] }}
-```
-
-Configures a build directory for the meson project.
-
-This is the default meson command (invoked if there was no COMMAND supplied).
-
-```
-{{ cmd_help['setup']['arguments'] }}
-```
-
-See [meson introduction page](Running-Meson.md#configuring-the-build-directory) for more info.
-
-#### Examples:
-
-Configures `builddir` with default values:
-```
-meson setup builddir
-```
-
-### subprojects
-
-*(since 0.49.0)*
-
-```
-{{ cmd_help['subprojects']['usage'] }}
-```
-
-Manages subprojects of the meson project.
-
-```
-{{ cmd_help['subprojects']['arguments'] }}
-```
-
-### test
-
-```
-{{ cmd_help['test']['usage'] }}
-```
-
-Run tests for the configure meson project.
-
-```
-{{ cmd_help['test']['arguments'] }}
-```
-
-See [the unit test documentation](Unit-tests.md) for more info.
-
-#### Examples:
-
-Run tests for the project:
-```
-meson test -C builddir
-```
-
-Run only `specific_test_1` and `specific_test_2`:
-```
-meson test -C builddir specific_test_1 specific_test_2
-```
-
-### wrap
-
-```
-{{ cmd_help['wrap']['usage'] }}
-```
-
-An utility to manage WrapDB dependencies.
-
-```
-{{ cmd_help['wrap']['arguments'] }}
-```
-
-See [the WrapDB tool documentation](Using-wraptool.md) for more info.
diff --git a/meson/docs/meson.build b/meson/docs/meson.build
deleted file mode 100644 (file)
index c07a200..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-project('Meson documentation', version: '1.0')
-
-cur_bdir = meson.current_build_dir()
-
-# Copy all files to build dir, since HotDoc uses relative paths
-run_command(
-    files('../tools/copy_files.py'),
-    '-C', meson.current_source_dir(),
-    '--output-dir', cur_bdir,
-    'markdown', 'theme', 'sitemap.txt', 
-    check: true)
-
-# Only the script knows which files are being generated
-docs_gen = custom_target(
-    'gen_docs',
-    input: files('markdown/index.md'),
-    output: 'gen_docs.dummy',
-    command: [
-        files('../tools/regenerate_docs.py'),
-        '--output-dir', join_paths(cur_bdir, 'markdown'),
-        '--dummy-output-file', '@OUTPUT@',
-    ],
-    build_by_default: true,
-    install: false)
-
-hotdoc = import('hotdoc')
-documentation = hotdoc.generate_doc(meson.project_name(),
-    project_version: meson.project_version(),
-    sitemap: join_paths(cur_bdir, 'sitemap.txt'),
-    build_by_default: true,
-    depends: docs_gen,
-    index: join_paths(cur_bdir, 'markdown/index.md'),
-    install: false,
-    extra_assets: ['images/'],
-    include_paths: [join_paths(cur_bdir, 'markdown')],
-    default_license: 'CC-BY-SAv4.0',
-    html_extra_theme: join_paths(cur_bdir, 'theme', 'extra'),
-    git_upload_repository: 'git@github.com:jpakkane/jpakkane.github.io.git',
-    edit_on_github_repository: 'https://github.com/mesonbuild/meson/',
-    syntax_highlighting_activate: true,
-)
-
-run_target('upload',
-    command: [find_program('hotdoc'), 'run', '--conf-file', documentation.config_path()]
-)
diff --git a/meson/docs/sitemap.txt b/meson/docs/sitemap.txt
deleted file mode 100644 (file)
index ac74870..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-index.md
-       Getting-meson.md
-       Quick-guide.md
-       Tutorial.md
-       Manual.md
-               Overview.md
-               Running-Meson.md
-               Commands.md
-               Builtin-options.md
-               Using-with-Visual-Studio.md
-               Meson-sample.md
-               Syntax.md
-               Machine-files.md
-               Native-environments.md
-               Build-targets.md
-               Include-directories.md
-               Installing.md
-               Adding-arguments.md
-               Configuration.md
-               Compiler-properties.md
-               Dependencies.md
-               Threads.md
-               External-commands.md
-               Precompiled-headers.md
-               Unity-builds.md
-               Feature-autodetection.md
-               Generating-sources.md
-               Unit-tests.md
-               Cross-compilation.md
-               Localisation.md
-               Build-options.md
-               Subprojects.md
-               Disabler.md
-               Modules.md
-                       CMake-module.md
-                       Dlang-module.md
-                       Fs-module.md
-                       Gnome-module.md
-                       Hotdoc-module.md
-                       i18n-module.md
-                       Icestorm-module.md
-                       Pkgconfig-module.md
-                       Python-module.md
-                       Python-3-module.md
-                       Qt4-module.md
-                       Qt5-module.md
-                       RPM-module.md
-                       Simd-module.md
-                       SourceSet-module.md
-                       Windows-module.md
-                       Cuda-module.md
-                       Keyval-module.md
-               Java.md
-               Vala.md
-               D.md
-               IDE-integration.md
-               Custom-build-targets.md
-               Build-system-converters.md
-               Configuring-a-build-directory.md
-               Run-targets.md
-               Creating-releases.md
-               Creating-OSX-packages.md
-               Creating-Linux-binaries.md
-               Project-templates.md
-       Reference-manual.md
-       Reference-tables.md
-       Style-guide.md
-       Rewriter.md
-       FAQ.md
-       Reproducible-builds.md
-       howtox.md
-       Wrap-dependency-system-manual.md
-               Adding-new-projects-to-wrapdb.md
-               Using-the-WrapDB.md
-               Using-wraptool.md
-               Wrap-maintainer-tools.md
-               Wrap-best-practices-and-tips.md
-               Wrap-review-guidelines.md
-               Shipping-prebuilt-binaries-as-wraps.md
-               fallback-wraptool.md
-       Release-notes.md
-               Release-notes-for-0.55.0.md
-               Release-notes-for-0.54.0.md
-               Release-notes-for-0.53.0.md
-               Release-notes-for-0.52.0.md
-               Release-notes-for-0.51.0.md
-               Release-notes-for-0.50.0.md
-               Release-notes-for-0.49.0.md
-               Release-notes-for-0.48.0.md
-               Release-notes-for-0.47.0.md
-               Release-notes-for-0.46.0.md
-               Release-notes-for-0.45.0.md
-               Release-notes-for-0.44.0.md
-               Release-notes-for-0.43.0.md
-               Release-notes-for-0.42.0.md
-               Release-notes-for-0.41.0.md
-               Release-notes-for-0.40.0.md
-               Release-notes-for-0.39.0.md
-               Release-notes-for-0.38.0.md
-               Release-notes-for-0.37.0.md
-       Additional.md
-               Release-procedure.md
-               Performance-comparison.md
-                       ARM-performance-test.md
-                       Simple-comparison.md
-               Comparisons.md
-               Conference-presentations.md
-               Contact-information.md
-               Continuous-Integration.md
-               Design-rationale.md
-               IndepthTutorial.md
-               In-the-press.md
-               Mixing-build-systems.md
-               Pkg-config-files.md
-               Playground.md
-               Porting-from-autotools.md
-               Use-of-Python.md
-               Users.md
-               Using-multiple-build-directories.md
-               Vs-External.md
-       Contributing.md
-               MesonCI.md
-       legal.md
-       Videos.md
diff --git a/meson/docs/theme/extra/images/favicon.png b/meson/docs/theme/extra/images/favicon.png
deleted file mode 100644 (file)
index 6800fe8..0000000
Binary files a/meson/docs/theme/extra/images/favicon.png and /dev/null differ
diff --git a/meson/docs/theme/extra/images/meson_logo.png b/meson/docs/theme/extra/images/meson_logo.png
deleted file mode 100644 (file)
index 1b3915d..0000000
Binary files a/meson/docs/theme/extra/images/meson_logo.png and /dev/null differ
diff --git a/meson/docs/theme/extra/prism_components/prism-meson.js b/meson/docs/theme/extra/prism_components/prism-meson.js
deleted file mode 100644 (file)
index 242af19..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-Prism.languages.meson= {
-       'triple-quoted-string': {
-               'pattern': /'''[\s\S]*?'''/,
-               'alias': 'string'
-       },
-       'comment': /#.*/,
-       'string': /'(?:\\'|[^'])*'/,
-       'number': /\b\d+(?:\.\d+)?\b/,
-       'keyword': /\b(?:if|else|elif|endif|foreach|endforeach)\b/,
-       'function': /(?=\.|\b)[a-zA-Z_]+\s*(?=\()/,
-       'boolean': /\b(?:true|false)\b/,
-       'builtin': /\b(?:meson|host_machine|target_machine|build_machine)(?=\.)/,
-       'operator': /(?:[<>=*+\-/!]?=|%|\/|\*|-|\+|\b(?:or|and|not)\b)/,
-       'punctuation': /[(),[\]]/
-       // TODO: Handle ternary ?:
-};
\ No newline at end of file
diff --git a/meson/docs/theme/extra/prism_components/prism-meson.min.js b/meson/docs/theme/extra/prism_components/prism-meson.min.js
deleted file mode 100644 (file)
index 7bf90e0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Prism.languages.meson={"triple-quoted-string":{pattern:/'''[\s\S]*?'''/,alias:"string"},comment:/#.*/,string:/'(?:\\'|[^'])*'/,number:/\b\d+(?:\.\d+)?\b/,keyword:/\b(?:if|else|elif|endif|foreach|endforeach)\b/,"function":/(?=\.|\b)[a-zA-Z_]+\s*(?=\()/,"boolean":/\b(?:true|false)\b/,builtin:/\b(?:meson|host_machine|target_machine|build_machine)(?=\.)/,operator:/(?:[<>=*+\-\/!]?=|%|\/|\*|-|\+|\b(?:or|and|not)\b)/,punctuation:/[(),[\]]/};
\ No newline at end of file
diff --git a/meson/docs/theme/extra/templates/brand-logo.html b/meson/docs/theme/extra/templates/brand-logo.html
deleted file mode 100644 (file)
index 7a12347..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<img src="assets/images/meson_logo.png" alt=Home>
diff --git a/meson/docs/theme/extra/templates/extra_head.html b/meson/docs/theme/extra/templates/extra_head.html
deleted file mode 100644 (file)
index 29b7477..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<link rel="icon" type="image/png" href="assets/images/favicon.png">
-<link rel="shortcut icon" href="assets/images/favicon.png">
diff --git a/meson/docs/theme/extra/templates/license.html b/meson/docs/theme/extra/templates/license.html
deleted file mode 100644 (file)
index 5518782..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-@require(license, logo_path)
-
-<hr/>
-
-<div class="license-description">
-    Website licensing information are available on the <a href=legal.html>Legal</a> page.
-</div>
diff --git a/meson/docs/theme/extra/templates/navbar_center.html b/meson/docs/theme/extra/templates/navbar_center.html
deleted file mode 100644 (file)
index 9934be7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<p><b>The Meson Build System</b></p>
diff --git a/meson/docs/theme/extra/templates/navbar_links.html b/meson/docs/theme/extra/templates/navbar_links.html
deleted file mode 100644 (file)
index 832bd2c..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-@require(page)
-
-<li class="dropdown">
-  <a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-    Modules <span class="caret"></span>
-  </a>
-  <ul class="dropdown-menu" id="modules-menu">
-    @for tup in ( \
-                                        ("CMake-module.html","CMake"), \
-                                        ("Cuda-module.html","CUDA"), \
-           ("Dlang-module.html","Dlang"), \
-           ("Fs-module.html","Filesystem"), \
-                                        ("Gnome-module.html","GNOME"), \
-                                        ("Hotdoc-module.html","Hotdoc"), \
-                                        ("i18n-module.html","i18n"), \
-                                        ("Icestorm-module.html","Icestorm"), \
-                                        ("Keyval-module.html","Keyval"), \
-           ("Pkgconfig-module.html","Pkgconfig"), \
-           ("Python-module.html","Python"), \
-           ("Python-3-module.html","Python 3"), \
-           ("Qt4-module.html","Qt4"), \
-           ("Qt5-module.html","Qt5"), \
-           ("RPM-module.html","RPM"), \
-           ("SourceSet-module.html","SourceSet"), \
-           ("Windows-module.html","Windows")):
-                       <li>
-                               <a href="@tup[0]">@tup[1]</a>
-                       </li>
-               @end
-       </ul>
-</li>
-\
-<li class="dropdown">
-       <a class="dropdown-toggle" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
-               Quick References <span class="caret"></span>
-       </a>
-       <ul class="dropdown-menu" id="quick-refs-menu">
-               @for tup in (("Reference-manual.html", "Functions"), \
-           ("Build-options.html", "Options"), \
-           ("Configuration.html", "Configuration"), \
-           ("Dependencies.html", "Dependencies"), \
-           ("Unit-tests.html", "Tests"), \
-           ("Syntax.html", "Syntax")):
-                       <li>
-                               <a href="@tup[0]">@tup[1]</a>
-                       </li>
-               @end
-       </ul>
-</li>
diff --git a/meson/ghwt.py b/meson/ghwt.py
deleted file mode 100755 (executable)
index 5a71a38..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# ghwt - GitHub WrapTool
-#
-# An emergency wraptool(1) replacement downloader that downloads
-# directly from GitHub in case wrapdb.mesonbuild.com is down.
-
-import urllib.request, json, sys, os, shutil, subprocess
-import configparser, hashlib
-
-req_timeout = 600.0
-private_repos = {'meson', 'wrapweb', 'meson-ci'}
-spdir = 'subprojects'
-
-def gh_get(url):
-    r = urllib.request.urlopen(url, timeout=req_timeout)
-    jd = json.loads(r.read().decode('utf-8'))
-    return jd
-
-def list_projects():
-    jd = gh_get('https://api.github.com/orgs/mesonbuild/repos')
-    entries = [entry['name'] for entry in jd]
-    entries = [e for e in entries if e not in private_repos]
-    entries.sort()
-    for i in entries:
-        print(i)
-    return 0
-
-def unpack(sproj, branch):
-    tmpdir = os.path.join(spdir, sproj + '_ghwt')
-    shutil.rmtree(tmpdir, ignore_errors=True)
-    subprocess.check_call(['git', 'clone', '-b', branch, 'https://github.com/mesonbuild/{}.git'.format(sproj), tmpdir])
-    usfile = os.path.join(tmpdir, 'upstream.wrap')
-    assert(os.path.isfile(usfile))
-    config = configparser.ConfigParser(interpolation=None)
-    config.read(usfile)
-    outdir = os.path.join(spdir, sproj)
-    if 'directory' in config['wrap-file']:
-        outdir = os.path.join(spdir, config['wrap-file']['directory'])
-    if os.path.isdir(outdir):
-        print('Subproject is already there. To update, nuke the {} dir and reinstall.'.format(outdir))
-        shutil.rmtree(tmpdir)
-        return 1
-    us_url = config['wrap-file']['source_url']
-    us = urllib.request.urlopen(us_url, timeout=req_timeout).read()
-    h = hashlib.sha256()
-    h.update(us)
-    dig = h.hexdigest()
-    should = config['wrap-file']['source_hash']
-    if dig != should:
-        print('Incorrect hash on download.')
-        print(' expected:', should)
-        print(' obtained:', dig)
-        return 1
-    ofilename = os.path.join(spdir, config['wrap-file']['source_filename'])
-    with open(ofilename, 'wb') as ofile:
-        ofile.write(us)
-    if 'lead_directory_missing' in config['wrap-file']:
-        os.mkdir(outdir)
-        shutil.unpack_archive(ofilename, outdir)
-    else:
-        shutil.unpack_archive(ofilename, spdir)
-        assert(os.path.isdir(outdir))
-    shutil.move(os.path.join(tmpdir, '.git'), outdir)
-    subprocess.check_call(['git', 'reset', '--hard'], cwd=outdir)
-    shutil.rmtree(tmpdir)
-    shutil.rmtree(os.path.join(outdir, '.git'))
-    os.unlink(ofilename)
-
-def install(sproj, requested_branch=None):
-    if not os.path.isdir(spdir):
-        print('Run this in your source root and make sure there is a subprojects directory in it.')
-        return 1
-    blist = gh_get('https://api.github.com/repos/mesonbuild/{}/branches'.format(sproj))
-    blist = [b['name'] for b in blist]
-    blist = [b for b in blist if b != 'master']
-    blist.sort()
-    branch = blist[-1]
-    if requested_branch is not None:
-        if requested_branch in blist:
-            branch = requested_branch
-        else:
-            print('Could not find user-requested branch', requested_branch)
-            print('Available branches for', sproj, ':')
-            print(blist)
-            return 1
-    print('Using branch', branch)
-    return unpack(sproj, branch)
-
-def print_help():
-    print('Usage:')
-    print(sys.argv[0], 'list')
-    print(sys.argv[0], 'install', 'package_name', '[branch_name]')
-
-def run(args):
-    if not args or args[0] == '-h' or args[0] == '--help':
-        print_help()
-        return 1
-    command = args[0]
-    args = args[1:]
-    if command == 'list':
-        list_projects()
-        return 0
-    elif command == 'install':
-        if len(args) == 1:
-            return install(args[0])
-        elif len(args) == 2:
-            return install(args[0], args[1])
-        else:
-            print_help()
-            return 1
-    else:
-        print('Unknown command')
-        return 1
-
-if __name__ == '__main__':
-    print('This is an emergency wrap downloader. Use only when wrapdb is down.')
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/graphics/meson_logo.svg b/meson/graphics/meson_logo.svg
deleted file mode 100644 (file)
index d5b47bc..0000000
+++ /dev/null
@@ -1,340 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="210mm"
-   height="297mm"
-   viewBox="0 0 210 297"
-   version="1.1"
-   id="svg1769"
-   inkscape:version="0.92.3 (2405546, 2018-03-11)"
-   sodipodi:docname="meson_logo.svg">
-  <defs
-     id="defs1763">
-    <marker
-       inkscape:stockid="Arrow1Lend"
-       orient="auto"
-       refY="0.0"
-       refX="0.0"
-       id="marker4405"
-       style="overflow:visible;"
-       inkscape:isstock="true">
-      <path
-         id="path4403"
-         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
-         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
-         transform="scale(0.8) rotate(180) translate(12.5,0)" />
-    </marker>
-    <marker
-       inkscape:stockid="Arrow1Lstart"
-       orient="auto"
-       refY="0.0"
-       refX="0.0"
-       id="Arrow1Lstart"
-       style="overflow:visible"
-       inkscape:isstock="true">
-      <path
-         id="path2389"
-         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
-         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
-         transform="scale(0.8) translate(12.5,0)" />
-    </marker>
-    <marker
-       inkscape:stockid="Arrow1Lend"
-       orient="auto"
-       refY="0.0"
-       refX="0.0"
-       id="Arrow1Lend"
-       style="overflow:visible;"
-       inkscape:isstock="true">
-      <path
-         id="path2392"
-         d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
-         style="fill-rule:evenodd;stroke:#000000;stroke-width:1pt;stroke-opacity:1;fill:#000000;fill-opacity:1"
-         transform="scale(0.8) rotate(180) translate(12.5,0)" />
-    </marker>
-  </defs>
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="1.4"
-     inkscape:cx="369.10197"
-     inkscape:cy="819.78077"
-     inkscape:document-units="mm"
-     inkscape:current-layer="layer1"
-     showgrid="false"
-     inkscape:window-width="1226"
-     inkscape:window-height="910"
-     inkscape:window-x="536"
-     inkscape:window-y="82"
-     inkscape:window-maximized="0" />
-  <metadata
-     id="metadata1766">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title></dc:title>
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <g
-       transform="matrix(0.20036166,0,0,0.20036166,28.277456,17.580208)"
-       id="g1745-3">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67"
-         d="m 33.334478,102.25658 -1.276087,23.80689 -0.0061,0.003 c -0.08934,1.57587 -0.55403,1.79754 -0.644545,1.88447 -0.420443,0.40386 -0.969288,0.27991 -1.431912,0.32133 -0.189719,0.0171 -0.274798,1.15962 0.04972,1.15962 0.403098,0 2.284665,-0.0926 2.707616,-0.0918 0.34244,5.3e-4 2.446519,0.0918 2.947819,0.0918 0.243445,0 0.370705,-1.03417 0.105626,-1.06723 -0.334434,-0.0417 -1.200125,-0.31005 -1.274063,-0.75434 -0.01017,-0.0614 -0.02059,-0.35182 -0.02945,-0.91973 l 0.703497,-13.30253 10.175621,17.27235 9.996785,-19.87488 1.204659,15.57675 c 0.0199,0.79989 -0.03947,1.50889 -0.07995,1.58096 -0.158144,0.28144 -0.595899,0.45144 -1.099501,0.58649 -0.3945,0.10571 -0.411138,0.90798 0.161424,0.90798 1.064556,0 2.202444,-0.25797 2.625396,-0.25717 0.342437,5.3e-4 3.41059,0.24547 4.337927,0.21604 0.374592,-0.0113 0.485723,-0.78623 0.09622,-0.87103 -0.660138,-0.14372 -1.863341,-0.68218 -2.085916,-1.20514 -0.04562,-0.10717 -0.451347,-1.17783 -0.52673,-1.76188 L 56.99415,102.32777 45.888836,124.45753 Z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5"
-         d="m 66.900973,102.70528 c -0.312317,-0.0246 -0.418637,0.62952 -0.05394,0.71112 1.198705,0.26826 1.543521,1.04959 1.766094,1.57255 0.04894,0.11494 0.445239,1.36695 0.44487,1.85292 -0.0047,6.12333 0.345802,12.15388 0.135426,18.22902 0.100256,1.2438 -0.193648,2.39 -0.509132,2.93519 -0.18505,0.31978 -0.884081,0.66664 -1.440569,0.67016 -0.227745,0.001 -0.331782,0.75651 -0.0072,0.75651 4.310608,-0.025 8.883044,0.006 12.816334,-0.002 l 2.7e-4,-0.0188 c 0.43124,-0.43502 1.5967,-2.08483 1.82958,-3.27069 0.18948,-0.52535 0.18474,-0.98124 -0.50683,-0.0127 -0.4636,0.64927 -0.59031,0.90175 -1.32429,1.151 -1.82289,0.3852 -4.59972,0.38331 -6.355561,0.0383 -0.986536,-0.19387 -1.839515,-0.67769 -1.853692,-2.07823 v -7.99646 h 5.990643 c 0.739256,0 1.31716,1.03942 1.3397,1.60391 0.0185,0.46295 0.74548,0.48307 0.75459,0.008 l 0.026,-4.50003 c 0.004,-0.53369 -0.7806,-0.56271 -0.7806,0.008 0,0.73447 -0.921892,0.73171 -1.42577,0.76963 -1.94137,0 -3.97512,0.0127 -5.953786,0.0127 v -9.80142 h 7.151596 l -2.7e-4,0.008 c 0.85429,0.46268 1.26608,1.01883 1.29024,1.6238 0.0185,0.46295 0.62893,0.48309 0.63805,0.008 l 0.0264,-3.43815 h -1.88473 -7.235748 c -0.478738,-0.0866 -0.972265,-0.15524 -1.413794,-0.20809 -1.617876,-0.19366 -2.63534,-0.4144 -3.398684,-0.6258 -0.02257,-0.006 -0.04421,-0.01 -0.06502,-0.0113 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3"
-         d="m 94.757975,103.02543 c -0.11408,2e-4 -0.22964,0.003 -0.34695,0.006 -2.58595,0.0843 -6.698092,2.61617 -6.539972,6.86354 0.08677,2.33091 2.746652,5.60719 5.031322,7.5844 2.17308,1.88065 5.586685,3.44697 5.546319,6.10751 -0.051,2.28483 -1.805601,4.27404 -5.270909,4.27404 -2.16525,-0.11423 -3.141615,-0.16572 -4.533845,-1.52671 -0.56065,-0.552 -0.693139,-1.85564 -0.705019,-2.51927 l -1.239776,-0.008 -0.0264,4.0512 c 1.89697,1.15258 4.30363,1.78611 6.4362,1.74849 5.35562,-0.13555 7.674295,-3.30385 7.756735,-6.55447 0.20533,-4.55913 -3.157431,-6.63582 -5.844601,-8.78074 -2.23068,-1.78054 -4.734939,-3.06638 -4.734939,-6.03352 0,-1.27234 2.035285,-3.41774 4.601495,-3.57283 1.467869,-4.8e-4 2.663536,0.16339 3.582067,1.19225 0.523978,0.58691 0.91614,1.19386 0.92798,1.8575 l 0.983328,0.0553 -0.0352,-4.07423 c -0.581995,0.0175 -1.212055,-0.0524 -1.771445,-0.16946 -0.0364,-0.008 -0.0666,-0.01 -0.0969,-0.0127 -0.97967,-0.18924 -2.20726,-0.49013 -3.71961,-0.4877 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5"
-         d="m 119.7033,102.99102 c -7.99363,0 -13.58284,5.8792 -13.58284,14.60148 0,6.01803 5.49465,12.43311 14.00323,12.43311 9.22108,0 13.84717,-7.21361 13.81967,-13.4888 -0.0281,-6.41474 -4.43284,-13.54579 -14.24006,-13.54579 z m 10.30799,14.57345 c -0.12272,8.03534 -4.17824,10.62033 -9.57356,10.69443 -6.14582,0.0844 -10.59665,-6.47237 -10.61036,-12.01292 -0.12109,-10.12036 6.15743,-11.49973 9.07137,-11.58569 8.43605,0.16046 11.18568,8.11371 11.11255,12.90418 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62"
-         d="m 139.89961,102.70719 -0.37324,23.7168 c -0.014,0.89103 -0.17468,1.31752 -0.31805,1.554 -0.24039,0.39655 -0.86073,0.68583 -1.47275,0.6826 -0.26436,-0.001 -0.30089,0.82643 0.0236,0.82643 0.75747,0 2.67875,-0.21072 3.1017,-0.20992 0.34242,5.3e-4 1.8727,0.15573 3.08741,0.15657 0.61256,0 0.41837,-0.76043 0.095,-0.81871 -0.27055,-0.0488 -1.24066,-0.44168 -1.31459,-0.82412 -0.0284,-0.1467 -0.15685,-1.69371 -0.16868,-2.66273 -0.059,-4.83509 -0.071,-9.53141 -0.0523,-14.44595 l 21.14337,19.71286 -0.0541,-23.80413 c 0,-0.68938 0.17375,-1.20182 0.37143,-1.55761 0.28835,-0.51901 0.91397,-0.60476 1.40691,-0.64762 0.25291,-0.022 0.36676,-0.86034 -0.0658,-0.86034 -0.53725,0 -2.50677,0.0341 -3.07048,0.0331 -0.45641,-7.3e-4 -2.79852,-0.16948 -3.46655,-0.18148 -0.59648,-0.01 -0.51589,0.90058 0.0537,0.89521 1.1222,-0.01 1.47204,0.66995 1.7443,1.68232 0.0443,0.16517 0.21934,0.83734 0.29759,2.23392 l 0.13745,15.66736 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-    </g>
-    <path
-       style="fill:#39207c;fill-opacity:1;stroke:none;stroke-width:1.71902049;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 181.30469 74.429688 C 161.46687 85.630004 149.15002 106.61558 149.03711 129.41016 C 169.79161 140.72574 194.16258 140.33981 213.04883 129.5293 C 213.05119 129.47468 213.05406 129.41962 213.05859 129.36523 C 213.03478 106.69297 200.93117 85.75333 181.30469 74.429688 z M 191.98438 98.699219 C 194.92554 100.69787 194.48939 105.50984 194.01562 108.80469 C 193.41277 112.43416 189.93299 118.40107 185.41211 122.29492 C 185.99691 123.1334 186.3389 124.16595 186.33398 125.26758 C 183.53249 126.68366 180.75263 125.08608 177.39062 122.20703 C 174.02862 119.32795 170.40256 113.55973 169.19922 107.63086 C 168.13189 107.74388 167.03897 107.50536 166.10156 106.91406 C 166.3464 103.58956 169.87486 101.6149 173.00195 100.44922 C 176.12905 99.283537 184.18515 98.888979 189.86523 100.9082 C 190.30813 99.978311 191.04179 99.196513 191.98438 98.701172 L 191.98438 98.699219 z "
-       transform="scale(0.26458333)"
-       id="path817-6-2-9-7-9-93-9-8-1" />
-    <g
-       transform="matrix(0.20036166,0,0,0.20036166,99.991867,3.1795752)"
-       id="g1745-3-3">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67-6"
-         d="m 33.334478,102.25658 -1.276087,23.80689 -0.0061,0.003 c -0.08934,1.57587 -0.55403,1.79754 -0.644545,1.88447 -0.420443,0.40386 -0.969288,0.27991 -1.431912,0.32133 -0.189719,0.0171 -0.274798,1.15962 0.04972,1.15962 0.403098,0 2.284665,-0.0926 2.707616,-0.0918 0.34244,5.3e-4 2.446519,0.0918 2.947819,0.0918 0.243445,0 0.370705,-1.03417 0.105626,-1.06723 -0.334434,-0.0417 -1.200125,-0.31005 -1.274063,-0.75434 -0.01017,-0.0614 -0.02059,-0.35182 -0.02945,-0.91973 l 0.703497,-13.30253 10.175621,17.27235 9.996785,-19.87488 1.204659,15.57675 c 0.0199,0.79989 -0.03947,1.50889 -0.07995,1.58096 -0.158144,0.28144 -0.595899,0.45144 -1.099501,0.58649 -0.3945,0.10571 -0.411138,0.90798 0.161424,0.90798 1.064556,0 2.202444,-0.25797 2.625396,-0.25717 0.342437,5.3e-4 3.41059,0.24547 4.337927,0.21604 0.374592,-0.0113 0.485723,-0.78623 0.09622,-0.87103 -0.660138,-0.14372 -1.863341,-0.68218 -2.085916,-1.20514 -0.04562,-0.10717 -0.451347,-1.17783 -0.52673,-1.76188 L 56.99415,102.32777 45.888836,124.45753 Z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5-7"
-         d="m 66.900973,102.70528 c -0.312317,-0.0246 -0.418637,0.62952 -0.05394,0.71112 1.198705,0.26826 1.543521,1.04959 1.766094,1.57255 0.04894,0.11494 0.445239,1.36695 0.44487,1.85292 -0.0047,6.12333 0.345802,12.15388 0.135426,18.22902 0.100256,1.2438 -0.193648,2.39 -0.509132,2.93519 -0.18505,0.31978 -0.884081,0.66664 -1.440569,0.67016 -0.227745,0.001 -0.331782,0.75651 -0.0072,0.75651 4.310608,-0.025 8.883044,0.006 12.816334,-0.002 l 2.7e-4,-0.0188 c 0.43124,-0.43502 1.5967,-2.08483 1.82958,-3.27069 0.18948,-0.52535 0.18474,-0.98124 -0.50683,-0.0127 -0.4636,0.64927 -0.59031,0.90175 -1.32429,1.151 -1.82289,0.3852 -4.59972,0.38331 -6.355561,0.0383 -0.986536,-0.19387 -1.839515,-0.67769 -1.853692,-2.07823 v -7.99646 h 5.990643 c 0.739256,0 1.31716,1.03942 1.3397,1.60391 0.0185,0.46295 0.74548,0.48307 0.75459,0.008 l 0.026,-4.50003 c 0.004,-0.53369 -0.7806,-0.56271 -0.7806,0.008 0,0.73447 -0.921892,0.73171 -1.42577,0.76963 -1.94137,0 -3.97512,0.0127 -5.953786,0.0127 v -9.80142 h 7.151596 l -2.7e-4,0.008 c 0.85429,0.46268 1.26608,1.01883 1.29024,1.6238 0.0185,0.46295 0.62893,0.48309 0.63805,0.008 l 0.0264,-3.43815 h -1.88473 -7.235748 c -0.478738,-0.0866 -0.972265,-0.15524 -1.413794,-0.20809 -1.617876,-0.19366 -2.63534,-0.4144 -3.398684,-0.6258 -0.02257,-0.006 -0.04421,-0.01 -0.06502,-0.0113 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3-5"
-         d="m 94.757975,103.02543 c -0.11408,2e-4 -0.22964,0.003 -0.34695,0.006 -2.58595,0.0843 -6.698092,2.61617 -6.539972,6.86354 0.08677,2.33091 2.746652,5.60719 5.031322,7.5844 2.17308,1.88065 5.586685,3.44697 5.546319,6.10751 -0.051,2.28483 -1.805601,4.27404 -5.270909,4.27404 -2.16525,-0.11423 -3.141615,-0.16572 -4.533845,-1.52671 -0.56065,-0.552 -0.693139,-1.85564 -0.705019,-2.51927 l -1.239776,-0.008 -0.0264,4.0512 c 1.89697,1.15258 4.30363,1.78611 6.4362,1.74849 5.35562,-0.13555 7.674295,-3.30385 7.756735,-6.55447 0.20533,-4.55913 -3.157431,-6.63582 -5.844601,-8.78074 -2.23068,-1.78054 -4.734939,-3.06638 -4.734939,-6.03352 0,-1.27234 2.035285,-3.41774 4.601495,-3.57283 1.467869,-4.8e-4 2.663536,0.16339 3.582067,1.19225 0.523978,0.58691 0.91614,1.19386 0.92798,1.8575 l 0.983328,0.0553 -0.0352,-4.07423 c -0.581995,0.0175 -1.212055,-0.0524 -1.771445,-0.16946 -0.0364,-0.008 -0.0666,-0.01 -0.0969,-0.0127 -0.97967,-0.18924 -2.20726,-0.49013 -3.71961,-0.4877 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5-3"
-         d="m 119.7033,102.99102 c -7.99363,0 -13.58284,5.8792 -13.58284,14.60148 0,6.01803 5.49465,12.43311 14.00323,12.43311 9.22108,0 13.84717,-7.21361 13.81967,-13.4888 -0.0281,-6.41474 -4.43284,-13.54579 -14.24006,-13.54579 z m 10.30799,14.57345 c -0.12272,8.03534 -4.17824,10.62033 -9.57356,10.69443 -6.14582,0.0844 -10.59665,-6.47237 -10.61036,-12.01292 -0.12109,-10.12036 6.15743,-11.49973 9.07137,-11.58569 8.43605,0.16046 11.18568,8.11371 11.11255,12.90418 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62-5"
-         d="m 139.89961,102.70719 -0.37324,23.7168 c -0.014,0.89103 -0.17468,1.31752 -0.31805,1.554 -0.24039,0.39655 -0.86073,0.68583 -1.47275,0.6826 -0.26436,-0.001 -0.30089,0.82643 0.0236,0.82643 0.75747,0 2.67875,-0.21072 3.1017,-0.20992 0.34242,5.3e-4 1.8727,0.15573 3.08741,0.15657 0.61256,0 0.41837,-0.76043 0.095,-0.81871 -0.27055,-0.0488 -1.24066,-0.44168 -1.31459,-0.82412 -0.0284,-0.1467 -0.15685,-1.69371 -0.16868,-2.66273 -0.059,-4.83509 -0.071,-9.53141 -0.0523,-14.44595 l 21.14337,19.71286 -0.0541,-23.80413 c 0,-0.68938 0.17375,-1.20182 0.37143,-1.55761 0.28835,-0.51901 0.91397,-0.60476 1.40691,-0.64762 0.25291,-0.022 0.36676,-0.86034 -0.0658,-0.86034 -0.53725,0 -2.50677,0.0341 -3.07048,0.0331 -0.45641,-7.3e-4 -2.79852,-0.16948 -3.46655,-0.18148 -0.59648,-0.01 -0.51589,0.90058 0.0537,0.89521 1.1222,-0.01 1.47204,0.66995 1.7443,1.68232 0.0443,0.16517 0.21934,0.83734 0.29759,2.23392 l 0.13745,15.66736 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-    </g>
-    <path
-       style="fill:#39207c;fill-opacity:1;stroke:none;stroke-width:0.99843764;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="M 373.3418 81.814453 C 361.82049 88.32 354.6691 100.50911 354.60352 113.74805 C 366.6581 120.32034 380.81178 120.09534 391.78125 113.81641 C 391.78261 113.78466 391.78414 113.75422 391.78516 113.72266 C 391.77004 100.55476 384.7423 88.391622 373.34375 81.814453 L 373.3418 81.814453 z M 379.54688 95.910156 C 381.25515 97.071012 381.00171 99.865586 380.72656 101.7793 C 380.37643 103.88736 378.35627 107.35361 375.73047 109.61523 C 376.0701 110.10224 376.26642 110.70195 376.26367 111.3418 C 374.63651 112.16428 373.02302 111.23666 371.07031 109.56445 C 369.1176 107.89224 367.01143 104.54125 366.3125 101.09766 C 365.69258 101.1633 365.05814 101.02509 364.51367 100.68164 C 364.65588 98.75071 366.70521 97.602831 368.52148 96.925781 C 370.33776 96.248751 375.01731 96.020561 378.31641 97.193359 C 378.57364 96.653261 378.99941 96.199807 379.54688 95.912109 L 379.54688 95.910156 z "
-       transform="scale(0.26458333)"
-       id="path817-6-2-9-7-9-93-9-8-1-2" />
-    <rect
-       style="fill:#05030c;fill-opacity:1;stroke:#a6a6a6;stroke-width:0.75042528;stroke-miterlimit:4;stroke-dasharray:0.75042529, 3.00170116;stroke-dashoffset:0;stroke-opacity:1"
-       id="rect1921"
-       width="114.10837"
-       height="46.072655"
-       x="34.699532"
-       y="83.369179" />
-    <g
-       id="g2039"
-       transform="translate(-52.349702,9.4494047)">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67-2"
-         d="m 94.6371,104.71582 -0.255679,4.76999 -0.0012,6e-4 c -0.0179,0.31574 -0.111006,0.36016 -0.129142,0.37758 -0.08424,0.0809 -0.194208,0.0561 -0.2869,0.0644 -0.03801,0.003 -0.05506,0.23234 0.01,0.23234 0.08076,0 0.457759,-0.0186 0.542502,-0.0184 0.06861,1e-4 0.490189,0.0184 0.59063,0.0184 0.04878,0 0.07428,-0.20721 0.02116,-0.21383 -0.06701,-0.008 -0.240459,-0.0621 -0.255274,-0.15114 -0.002,-0.0123 -0.0041,-0.0705 -0.0059,-0.18428 l 0.140953,-2.66532 2.038805,3.46072 2.002972,-3.98216 0.241368,3.12098 c 0.004,0.16027 -0.0079,0.30232 -0.01602,0.31676 -0.03169,0.0564 -0.119396,0.0905 -0.220298,0.11751 -0.07904,0.0212 -0.08238,0.18193 0.03234,0.18193 0.213296,0 0.441285,-0.0517 0.526029,-0.0515 0.06861,1.1e-4 0.683354,0.0492 0.869154,0.0433 0.075,-0.002 0.0973,-0.15753 0.0193,-0.17452 -0.13227,-0.0288 -0.37334,-0.13669 -0.41794,-0.24147 -0.009,-0.0215 -0.09043,-0.23599 -0.105534,-0.35301 l -0.600761,-4.65456 -2.22508,4.43396 z"
-         style="fill:#fffff1;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5-0"
-         d="m 101.36254,104.80572 c -0.0626,-0.005 -0.0839,0.12614 -0.0108,0.14248 0.24017,0.0538 0.30926,0.2103 0.35386,0.31508 0.01,0.023 0.0892,0.27389 0.0891,0.37126 -9.5e-4,1.22688 0.0693,2.43517 0.0271,3.65239 0.0201,0.24921 -0.0388,0.47887 -0.10201,0.5881 -0.0371,0.0641 -0.17714,0.13357 -0.28864,0.13428 -0.0456,2e-4 -0.0665,0.15157 -0.001,0.15157 0.86368,-0.005 1.77982,10e-4 2.5679,-4e-4 l 6e-5,-0.004 c 0.0864,-0.0872 0.31992,-0.41772 0.36658,-0.65532 0.038,-0.10526 0.037,-0.19661 -0.10155,-0.003 -0.0929,0.13009 -0.11828,0.18068 -0.26534,0.23062 -0.36524,0.0772 -0.92161,0.0768 -1.27341,0.008 -0.19767,-0.0388 -0.36857,-0.13578 -0.37141,-0.4164 v -1.60218 h 1.20029 c 0.14812,0 0.26391,0.20826 0.26843,0.32136 0.004,0.0928 0.14936,0.0968 0.15119,0.002 l 0.005,-0.90163 c 8e-4,-0.10693 -0.1564,-0.11274 -0.1564,0.002 0,0.14716 -0.18471,0.14661 -0.28567,0.15421 -0.38898,0 -0.79646,0.003 -1.19291,0.003 v -1.96383 h 1.4329 l -5e-5,0.002 c 0.17117,0.0927 0.25367,0.20413 0.25851,0.32534 0.004,0.0928 0.12602,0.0968 0.12785,0.002 l 0.005,-0.68888 h -0.37763 -1.44977 c -0.0959,-0.0173 -0.1948,-0.0311 -0.28327,-0.0417 -0.32416,-0.0388 -0.52802,-0.083 -0.68096,-0.12539 -0.005,-10e-4 -0.009,-0.002 -0.013,-0.002 z"
-         style="fill:#fffff1;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3-2"
-         d="m 106.94401,104.86987 c -0.0229,4e-5 -0.046,6e-4 -0.0695,10e-4 -0.51812,0.0169 -1.34204,0.52418 -1.31036,1.37519 0.0174,0.46703 0.55033,1.12347 1.00809,1.51962 0.4354,0.37681 1.11936,0.69065 1.11127,1.22372 -0.0102,0.45779 -0.36178,0.85635 -1.05609,0.85635 -0.43383,-0.0229 -0.62946,-0.0332 -0.90841,-0.30589 -0.11233,-0.1106 -0.13888,-0.3718 -0.14126,-0.50477 l -0.2484,-0.002 -0.005,0.8117 c 0.38008,0.23094 0.86228,0.35787 1.28957,0.35033 1.07306,-0.0272 1.53763,-0.66196 1.55415,-1.31326 0.0411,-0.91348 -0.63263,-1.32957 -1.17104,-1.75933 -0.44694,-0.35675 -0.9487,-0.61438 -0.9487,-1.20888 0,-0.25493 0.4078,-0.68479 0.92197,-0.71586 0.2941,-1e-4 0.53367,0.0327 0.71771,0.23888 0.10498,0.1176 0.18356,0.23921 0.18593,0.37217 l 0.19702,0.0111 -0.007,-0.81632 c -0.11661,0.004 -0.24285,-0.0105 -0.35493,-0.034 -0.007,-0.002 -0.0133,-0.002 -0.0194,-0.003 -0.19629,-0.0379 -0.44225,-0.0982 -0.74527,-0.0977 z"
-         style="fill:#fffff1;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5-37"
-         d="m 111.9421,104.86297 c -1.60162,0 -2.72148,1.17797 -2.72148,2.92558 0,1.20578 1.10092,2.49112 2.80571,2.49112 1.84755,0 2.77444,-1.44533 2.76893,-2.70264 -0.006,-1.28527 -0.88817,-2.71406 -2.85316,-2.71406 z m 2.06533,2.91997 c -0.0246,1.60997 -0.83716,2.1279 -1.91818,2.14275 -1.23138,0.0169 -2.12316,-1.29682 -2.12591,-2.40693 -0.0243,-2.02773 1.23372,-2.3041 1.81756,-2.32133 1.69026,0.0322 2.24118,1.62568 2.22653,2.58551 z"
-         style="fill:#fffff1;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62-59"
-         d="m 115.98867,104.80611 -0.0748,4.75193 c -0.003,0.17853 -0.035,0.26398 -0.0637,0.31137 -0.0482,0.0795 -0.17246,0.13741 -0.29509,0.13676 -0.053,-2e-4 -0.0603,0.16559 0.005,0.16559 0.15177,0 0.53672,-0.0422 0.62147,-0.0421 0.0686,1e-4 0.37521,0.0312 0.61859,0.0314 0.12274,0 0.0838,-0.15236 0.019,-0.16404 -0.0542,-0.01 -0.24858,-0.0885 -0.26339,-0.16512 -0.006,-0.0294 -0.0314,-0.33936 -0.0338,-0.53351 -0.0118,-0.96877 -0.0142,-1.90973 -0.0105,-2.89442 l 4.23632,3.94971 -0.0108,-4.76944 c 0,-0.13812 0.0348,-0.2408 0.0744,-0.31208 0.0578,-0.10399 0.18312,-0.12118 0.28189,-0.12976 0.0507,-0.004 0.0735,-0.17238 -0.0132,-0.17238 -0.10764,0 -0.50226,0.007 -0.61521,0.007 -0.0915,-1.5e-4 -0.56071,-0.034 -0.69456,-0.0364 -0.11951,-0.002 -0.10336,0.18044 0.0108,0.17936 0.22485,-0.002 0.29494,0.13424 0.34949,0.33708 0.009,0.0331 0.0439,0.16777 0.0596,0.44759 l 0.0275,3.13914 z"
-         style="fill:#fffff1;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         id="path817-6-2-9-7-9-93-9-8-1-22"
-         d="m 107.65089,86.340169 c -5.24875,2.963417 -8.507587,8.515851 -8.537461,14.546921 5.491291,2.99391 11.939451,2.8918 16.936431,0.0315 5.3e-4,-0.0144 0.001,-0.029 0.003,-0.0434 -0.006,-5.998704 -3.20866,-11.538984 -8.4015,-14.535031 z m 2.82567,6.421313 c 0.77818,0.52881 0.66278,1.801977 0.53743,2.67374 -0.1595,0.960297 -1.08019,2.539037 -2.27634,3.569287 0.15473,0.22185 0.24521,0.49505 0.24391,0.78652 -0.74123,0.374671 -1.47673,-0.048 -2.36626,-0.80977 -0.88953,-0.76176 -1.84893,-2.287933 -2.16731,-3.856613 -0.2824,0.0299 -0.57157,-0.03321 -0.81959,-0.189654 0.0648,-0.879607 0.99835,-1.402069 1.82573,-1.710489 0.82737,-0.30842 2.95888,-0.412813 4.46174,0.121439 0.11718,-0.246033 0.3113,-0.452884 0.56069,-0.583943 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.45482418;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-         inkscape:connector-curvature="0" />
-    </g>
-    <g
-       transform="matrix(0.20036166,0,0,0.20036166,28.237911,51.343593)"
-       id="g1745-3-8">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67-9"
-         d="m 33.334478,102.25658 -1.276087,23.80689 -0.0061,0.003 c -0.08934,1.57587 -0.55403,1.79754 -0.644545,1.88447 -0.420443,0.40386 -0.969288,0.27991 -1.431912,0.32133 -0.189719,0.0171 -0.274798,1.15962 0.04972,1.15962 0.403098,0 2.284665,-0.0926 2.707616,-0.0918 0.34244,5.3e-4 2.446519,0.0918 2.947819,0.0918 0.243445,0 0.370705,-1.03417 0.105626,-1.06723 -0.334434,-0.0417 -1.200125,-0.31005 -1.274063,-0.75434 -0.01017,-0.0614 -0.02059,-0.35182 -0.02945,-0.91973 l 0.703497,-13.30253 10.175621,17.27235 9.996785,-19.87488 1.204659,15.57675 c 0.0199,0.79989 -0.03947,1.50889 -0.07995,1.58096 -0.158144,0.28144 -0.595899,0.45144 -1.099501,0.58649 -0.3945,0.10571 -0.411138,0.90798 0.161424,0.90798 1.064556,0 2.202444,-0.25797 2.625396,-0.25717 0.342437,5.3e-4 3.41059,0.24547 4.337927,0.21604 0.374592,-0.0113 0.485723,-0.78623 0.09622,-0.87103 -0.660138,-0.14372 -1.863341,-0.68218 -2.085916,-1.20514 -0.04562,-0.10717 -0.451347,-1.17783 -0.52673,-1.76188 L 56.99415,102.32777 45.888836,124.45753 Z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5-73"
-         d="m 66.900973,102.70528 c -0.312317,-0.0246 -0.418637,0.62952 -0.05394,0.71112 1.198705,0.26826 1.543521,1.04959 1.766094,1.57255 0.04894,0.11494 0.445239,1.36695 0.44487,1.85292 -0.0047,6.12333 0.345802,12.15388 0.135426,18.22902 0.100256,1.2438 -0.193648,2.39 -0.509132,2.93519 -0.18505,0.31978 -0.884081,0.66664 -1.440569,0.67016 -0.227745,0.001 -0.331782,0.75651 -0.0072,0.75651 4.310608,-0.025 8.883044,0.006 12.816334,-0.002 l 2.7e-4,-0.0188 c 0.43124,-0.43502 1.5967,-2.08483 1.82958,-3.27069 0.18948,-0.52535 0.18474,-0.98124 -0.50683,-0.0127 -0.4636,0.64927 -0.59031,0.90175 -1.32429,1.151 -1.82289,0.3852 -4.59972,0.38331 -6.355561,0.0383 -0.986536,-0.19387 -1.839515,-0.67769 -1.853692,-2.07823 v -7.99646 h 5.990643 c 0.739256,0 1.31716,1.03942 1.3397,1.60391 0.0185,0.46295 0.74548,0.48307 0.75459,0.008 l 0.026,-4.50003 c 0.004,-0.53369 -0.7806,-0.56271 -0.7806,0.008 0,0.73447 -0.921892,0.73171 -1.42577,0.76963 -1.94137,0 -3.97512,0.0127 -5.953786,0.0127 v -9.80142 h 7.151596 l -2.7e-4,0.008 c 0.85429,0.46268 1.26608,1.01883 1.29024,1.6238 0.0185,0.46295 0.62893,0.48309 0.63805,0.008 l 0.0264,-3.43815 h -1.88473 -7.235748 c -0.478738,-0.0866 -0.972265,-0.15524 -1.413794,-0.20809 -1.617876,-0.19366 -2.63534,-0.4144 -3.398684,-0.6258 -0.02257,-0.006 -0.04421,-0.01 -0.06502,-0.0113 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3-6"
-         d="m 94.757975,103.02543 c -0.11408,2e-4 -0.22964,0.003 -0.34695,0.006 -2.58595,0.0843 -6.698092,2.61617 -6.539972,6.86354 0.08677,2.33091 2.746652,5.60719 5.031322,7.5844 2.17308,1.88065 5.586685,3.44697 5.546319,6.10751 -0.051,2.28483 -1.805601,4.27404 -5.270909,4.27404 -2.16525,-0.11423 -3.141615,-0.16572 -4.533845,-1.52671 -0.56065,-0.552 -0.693139,-1.85564 -0.705019,-2.51927 l -1.239776,-0.008 -0.0264,4.0512 c 1.89697,1.15258 4.30363,1.78611 6.4362,1.74849 5.35562,-0.13555 7.674295,-3.30385 7.756735,-6.55447 0.20533,-4.55913 -3.157431,-6.63582 -5.844601,-8.78074 -2.23068,-1.78054 -4.734939,-3.06638 -4.734939,-6.03352 0,-1.27234 2.035285,-3.41774 4.601495,-3.57283 1.467869,-4.8e-4 2.663536,0.16339 3.582067,1.19225 0.523978,0.58691 0.91614,1.19386 0.92798,1.8575 l 0.983328,0.0553 -0.0352,-4.07423 c -0.581995,0.0175 -1.212055,-0.0524 -1.771445,-0.16946 -0.0364,-0.008 -0.0666,-0.01 -0.0969,-0.0127 -0.97967,-0.18924 -2.20726,-0.49013 -3.71961,-0.4877 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5-1"
-         d="m 119.7033,102.99102 c -7.99363,0 -13.58284,5.8792 -13.58284,14.60148 0,6.01803 5.49465,12.43311 14.00323,12.43311 9.22108,0 13.84717,-7.21361 13.81967,-13.4888 -0.0281,-6.41474 -4.43284,-13.54579 -14.24006,-13.54579 z m 10.30799,14.57345 c -0.12272,8.03534 -4.17824,10.62033 -9.57356,10.69443 -6.14582,0.0844 -10.59665,-6.47237 -10.61036,-12.01292 -0.12109,-10.12036 6.15743,-11.49973 9.07137,-11.58569 8.43605,0.16046 11.18568,8.11371 11.11255,12.90418 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62-2"
-         d="m 139.89961,102.70719 -0.37324,23.7168 c -0.014,0.89103 -0.17468,1.31752 -0.31805,1.554 -0.24039,0.39655 -0.86073,0.68583 -1.47275,0.6826 -0.26436,-0.001 -0.30089,0.82643 0.0236,0.82643 0.75747,0 2.67875,-0.21072 3.1017,-0.20992 0.34242,5.3e-4 1.8727,0.15573 3.08741,0.15657 0.61256,0 0.41837,-0.76043 0.095,-0.81871 -0.27055,-0.0488 -1.24066,-0.44168 -1.31459,-0.82412 -0.0284,-0.1467 -0.15685,-1.69371 -0.16868,-2.66273 -0.059,-4.83509 -0.071,-9.53141 -0.0523,-14.44595 l 21.14337,19.71286 -0.0541,-23.80413 c 0,-0.68938 0.17375,-1.20182 0.37143,-1.55761 0.28835,-0.51901 0.91397,-0.60476 1.40691,-0.64762 0.25291,-0.022 0.36676,-0.86034 -0.0658,-0.86034 -0.53725,0 -2.50677,0.0341 -3.07048,0.0331 -0.45641,-7.3e-4 -2.79852,-0.16948 -3.46655,-0.18148 -0.59648,-0.01 -0.51589,0.90058 0.0537,0.89521 1.1222,-0.01 1.47204,0.66995 1.7443,1.68232 0.0443,0.16517 0.21934,0.83734 0.29759,2.23392 l 0.13745,15.66736 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-    </g>
-    <path
-       inkscape:connector-curvature="0"
-       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.45482418;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="m 47.930655,53.45624 c -5.248756,2.963417 -8.507589,8.51585 -8.537463,14.546917 5.491294,2.993913 11.939447,2.891803 16.936434,0.03152 5.29e-4,-0.01445 0.0013,-0.02902 0.0026,-0.04341 -0.0063,-5.9987 -3.208668,-11.53898 -8.401507,-14.535027 z m 2.825668,6.421313 c 0.778182,0.52881 0.662784,1.801977 0.537433,2.673739 -0.159504,0.960298 -1.080196,2.539043 -2.276346,3.569291 0.154729,0.221847 0.245213,0.495043 0.243912,0.786516 -0.741228,0.374671 -1.476732,-0.04802 -2.366264,-0.809771 -0.889529,-0.761756 -1.848925,-2.287931 -2.167308,-3.856611 -0.282398,0.0299 -0.571566,-0.03321 -0.819589,-0.189654 0.06478,-0.879607 0.998352,-1.402069 1.825728,-1.710489 0.827378,-0.30842 2.958888,-0.412813 4.461743,0.121439 0.117184,-0.246033 0.311298,-0.452884 0.560691,-0.583943 z"
-       id="path817-6-2-9-7-9-93-9-8-1-9" />
-    <g
-       transform="matrix(0.20036166,0,0,0.20036166,98.564859,40.45489)"
-       id="g1745-3-3-3">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67-6-1"
-         d="m 33.334478,102.25658 -1.276087,23.80689 -0.0061,0.003 c -0.08934,1.57587 -0.55403,1.79754 -0.644545,1.88447 -0.420443,0.40386 -0.969288,0.27991 -1.431912,0.32133 -0.189719,0.0171 -0.274798,1.15962 0.04972,1.15962 0.403098,0 2.284665,-0.0926 2.707616,-0.0918 0.34244,5.3e-4 2.446519,0.0918 2.947819,0.0918 0.243445,0 0.370705,-1.03417 0.105626,-1.06723 -0.334434,-0.0417 -1.200125,-0.31005 -1.274063,-0.75434 -0.01017,-0.0614 -0.02059,-0.35182 -0.02945,-0.91973 l 0.703497,-13.30253 10.175621,17.27235 9.996785,-19.87488 1.204659,15.57675 c 0.0199,0.79989 -0.03947,1.50889 -0.07995,1.58096 -0.158144,0.28144 -0.595899,0.45144 -1.099501,0.58649 -0.3945,0.10571 -0.411138,0.90798 0.161424,0.90798 1.064556,0 2.202444,-0.25797 2.625396,-0.25717 0.342437,5.3e-4 3.41059,0.24547 4.337927,0.21604 0.374592,-0.0113 0.485723,-0.78623 0.09622,-0.87103 -0.660138,-0.14372 -1.863341,-0.68218 -2.085916,-1.20514 -0.04562,-0.10717 -0.451347,-1.17783 -0.52673,-1.76188 L 56.99415,102.32777 45.888836,124.45753 Z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5-7-9"
-         d="m 66.900973,102.70528 c -0.312317,-0.0246 -0.418637,0.62952 -0.05394,0.71112 1.198705,0.26826 1.543521,1.04959 1.766094,1.57255 0.04894,0.11494 0.445239,1.36695 0.44487,1.85292 -0.0047,6.12333 0.345802,12.15388 0.135426,18.22902 0.100256,1.2438 -0.193648,2.39 -0.509132,2.93519 -0.18505,0.31978 -0.884081,0.66664 -1.440569,0.67016 -0.227745,0.001 -0.331782,0.75651 -0.0072,0.75651 4.310608,-0.025 8.883044,0.006 12.816334,-0.002 l 2.7e-4,-0.0188 c 0.43124,-0.43502 1.5967,-2.08483 1.82958,-3.27069 0.18948,-0.52535 0.18474,-0.98124 -0.50683,-0.0127 -0.4636,0.64927 -0.59031,0.90175 -1.32429,1.151 -1.82289,0.3852 -4.59972,0.38331 -6.355561,0.0383 -0.986536,-0.19387 -1.839515,-0.67769 -1.853692,-2.07823 v -7.99646 h 5.990643 c 0.739256,0 1.31716,1.03942 1.3397,1.60391 0.0185,0.46295 0.74548,0.48307 0.75459,0.008 l 0.026,-4.50003 c 0.004,-0.53369 -0.7806,-0.56271 -0.7806,0.008 0,0.73447 -0.921892,0.73171 -1.42577,0.76963 -1.94137,0 -3.97512,0.0127 -5.953786,0.0127 v -9.80142 h 7.151596 l -2.7e-4,0.008 c 0.85429,0.46268 1.26608,1.01883 1.29024,1.6238 0.0185,0.46295 0.62893,0.48309 0.63805,0.008 l 0.0264,-3.43815 h -1.88473 -7.235748 c -0.478738,-0.0866 -0.972265,-0.15524 -1.413794,-0.20809 -1.617876,-0.19366 -2.63534,-0.4144 -3.398684,-0.6258 -0.02257,-0.006 -0.04421,-0.01 -0.06502,-0.0113 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3-5-4"
-         d="m 94.757975,103.02543 c -0.11408,2e-4 -0.22964,0.003 -0.34695,0.006 -2.58595,0.0843 -6.698092,2.61617 -6.539972,6.86354 0.08677,2.33091 2.746652,5.60719 5.031322,7.5844 2.17308,1.88065 5.586685,3.44697 5.546319,6.10751 -0.051,2.28483 -1.805601,4.27404 -5.270909,4.27404 -2.16525,-0.11423 -3.141615,-0.16572 -4.533845,-1.52671 -0.56065,-0.552 -0.693139,-1.85564 -0.705019,-2.51927 l -1.239776,-0.008 -0.0264,4.0512 c 1.89697,1.15258 4.30363,1.78611 6.4362,1.74849 5.35562,-0.13555 7.674295,-3.30385 7.756735,-6.55447 0.20533,-4.55913 -3.157431,-6.63582 -5.844601,-8.78074 -2.23068,-1.78054 -4.734939,-3.06638 -4.734939,-6.03352 0,-1.27234 2.035285,-3.41774 4.601495,-3.57283 1.467869,-4.8e-4 2.663536,0.16339 3.582067,1.19225 0.523978,0.58691 0.91614,1.19386 0.92798,1.8575 l 0.983328,0.0553 -0.0352,-4.07423 c -0.581995,0.0175 -1.212055,-0.0524 -1.771445,-0.16946 -0.0364,-0.008 -0.0666,-0.01 -0.0969,-0.0127 -0.97967,-0.18924 -2.20726,-0.49013 -3.71961,-0.4877 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5-3-7"
-         d="m 119.7033,102.99102 c -7.99363,0 -13.58284,5.8792 -13.58284,14.60148 0,6.01803 5.49465,12.43311 14.00323,12.43311 9.22108,0 13.84717,-7.21361 13.81967,-13.4888 -0.0281,-6.41474 -4.43284,-13.54579 -14.24006,-13.54579 z m 10.30799,14.57345 c -0.12272,8.03534 -4.17824,10.62033 -9.57356,10.69443 -6.14582,0.0844 -10.59665,-6.47237 -10.61036,-12.01292 -0.12109,-10.12036 6.15743,-11.49973 9.07137,-11.58569 8.43605,0.16046 11.18568,8.11371 11.11255,12.90418 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62-5-8"
-         d="m 139.89961,102.70719 -0.37324,23.7168 c -0.014,0.89103 -0.17468,1.31752 -0.31805,1.554 -0.24039,0.39655 -0.86073,0.68583 -1.47275,0.6826 -0.26436,-0.001 -0.30089,0.82643 0.0236,0.82643 0.75747,0 2.67875,-0.21072 3.1017,-0.20992 0.34242,5.3e-4 1.8727,0.15573 3.08741,0.15657 0.61256,0 0.41837,-0.76043 0.095,-0.81871 -0.27055,-0.0488 -1.24066,-0.44168 -1.31459,-0.82412 -0.0284,-0.1467 -0.15685,-1.69371 -0.16868,-2.66273 -0.059,-4.83509 -0.071,-9.53141 -0.0523,-14.44595 l 21.14337,19.71286 -0.0541,-23.80413 c 0,-0.68938 0.17375,-1.20182 0.37143,-1.55761 0.28835,-0.51901 0.91397,-0.60476 1.40691,-0.64762 0.25291,-0.022 0.36676,-0.86034 -0.0658,-0.86034 -0.53725,0 -2.50677,0.0341 -3.07048,0.0331 -0.45641,-7.3e-4 -2.79852,-0.16948 -3.46655,-0.18148 -0.59648,-0.01 -0.51589,0.90058 0.0537,0.89521 1.1222,-0.01 1.47204,0.66995 1.7443,1.68232 0.0443,0.16517 0.21934,0.83734 0.29759,2.23392 l 0.13745,15.66736 z"
-         style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26458332px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-    </g>
-    <path
-       inkscape:connector-curvature="0"
-       style="fill:#000000;fill-opacity:1;stroke:none;stroke-width:0.26416996;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="m 97.353009,58.922056 c -3.04835,1.721259 -4.94049,4.946295 -4.95784,8.449097 3.18944,1.738919 6.93427,1.679388 9.836611,0.0181 2.7e-4,-0.0084 7.9e-4,-0.01646 0.001,-0.02479 -0.004,-3.484006 -1.86342,-6.70217 -4.879291,-8.442379 z m 1.64176,3.729488 c 0.45198,0.307143 0.38492,1.046541 0.31212,1.552878 -0.0926,0.557757 -0.62713,1.474869 -1.32188,2.073256 0.0899,0.128855 0.14181,0.287528 0.14108,0.456822 -0.43052,0.217614 -0.85742,-0.02782 -1.37408,-0.470257 -0.51665,-0.442439 -1.07391,-1.329055 -1.25884,-2.240172 -0.16402,0.01736 -0.33188,-0.01921 -0.47594,-0.110072 0.0376,-0.510892 0.57985,-0.814601 1.0604,-0.993738 0.48056,-0.17913 1.71869,-0.239506 2.59158,0.0708 0.0681,-0.142901 0.18071,-0.262877 0.32556,-0.338997 z"
-       id="path817-6-2-9-7-9-93-9-8-1-2-4" />
-    <g
-       id="g2084"
-       transform="translate(-9.8273809,24.379464)">
-      <path
-         sodipodi:nodetypes="cccccscscccccccccsccscsccc"
-         inkscape:connector-curvature="0"
-         id="path904-6-67-6-1-0"
-         d="m 114.69321,80.219973 -0.25568,4.769988 -10e-4,6.01e-4 c -0.0179,0.315744 -0.11101,0.360158 -0.12914,0.377576 -0.0842,0.08092 -0.19421,0.05608 -0.2869,0.06438 -0.038,0.0034 -0.0551,0.232343 0.01,0.232343 0.0808,0 0.45776,-0.01855 0.5425,-0.01839 0.0686,1.06e-4 0.49019,0.01839 0.59063,0.01839 0.0488,0 0.0743,-0.207208 0.0212,-0.213832 -0.067,-0.0084 -0.24046,-0.06212 -0.25528,-0.15114 -0.002,-0.0123 -0.004,-0.07049 -0.006,-0.184279 l 0.14096,-2.665317 2.0388,3.460717 2.00297,-3.982164 0.24137,3.120983 c 0.004,0.160267 -0.008,0.302324 -0.016,0.316764 -0.0317,0.05639 -0.11939,0.09045 -0.2203,0.11751 -0.079,0.02118 -0.0824,0.181924 0.0323,0.181924 0.21329,0 0.44128,-0.05169 0.52602,-0.05153 0.0686,1.07e-4 0.68336,0.04918 0.86916,0.04329 0.0751,-0.0023 0.0973,-0.157531 0.0193,-0.174521 -0.13227,-0.0288 -0.37334,-0.136683 -0.41794,-0.241464 -0.009,-0.02147 -0.0904,-0.235992 -0.10554,-0.353014 l -0.60076,-4.654553 -2.22508,4.433955 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccscccccccsccccscccccccccccccccccc"
-         inkscape:connector-curvature="0"
-         id="path906-7-5-7-9-3"
-         d="m 121.41865,80.309875 c -0.0626,-0.0049 -0.0839,0.126132 -0.0108,0.142482 0.24018,0.05375 0.30926,0.210297 0.35386,0.315078 0.01,0.02303 0.0892,0.273885 0.0891,0.371254 -9.4e-4,1.226881 0.0693,2.435172 0.0271,3.652397 0.0201,0.24921 -0.0388,0.478865 -0.10201,0.5881 -0.0371,0.06407 -0.17714,0.133569 -0.28864,0.134274 -0.0456,2e-4 -0.0665,0.151576 -0.001,0.151576 0.86368,-0.005 1.77982,0.0012 2.5679,-4.01e-4 l 6e-5,-0.0038 c 0.0864,-0.08716 0.31991,-0.41772 0.36657,-0.655321 0.038,-0.10526 0.037,-0.196603 -0.10154,-0.0025 -0.0929,0.130088 -0.11828,0.180676 -0.26534,0.230616 -0.36524,0.07718 -0.92161,0.0768 -1.27341,0.0077 -0.19767,-0.03884 -0.36857,-0.135783 -0.37141,-0.416398 v -1.602184 h 1.20029 c 0.14812,0 0.26391,0.20826 0.26843,0.321362 0.004,0.09276 0.14936,0.09679 0.15119,0.0016 l 0.005,-0.901633 c 8e-4,-0.106931 -0.1564,-0.112746 -0.1564,0.0016 0,0.147159 -0.18472,0.146606 -0.28567,0.154204 -0.38898,0 -0.79646,0.0025 -1.19291,0.0025 v -1.963828 h 1.4329 l -5e-5,0.0016 c 0.17117,0.0927 0.25367,0.204134 0.25851,0.325347 0.004,0.09276 0.12602,0.09679 0.12784,0.0016 l 0.005,-0.688874 h -0.37762 -1.44977 c -0.0959,-0.01735 -0.19481,-0.0311 -0.28327,-0.04169 -0.32416,-0.0388 -0.52802,-0.08303 -0.68097,-0.125386 -0.005,-0.0012 -0.009,-0.002 -0.013,-0.0023 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="cccccccccccccscsccccccc"
-         inkscape:connector-curvature="0"
-         id="path908-5-3-5-4-6"
-         d="m 127.00013,80.374021 c -0.0229,4e-5 -0.046,6.01e-4 -0.0695,0.0012 -0.51813,0.01689 -1.34204,0.524181 -1.31036,1.375191 0.0174,0.467025 0.55032,1.123466 1.00808,1.519623 0.43541,0.37681 1.11936,0.69064 1.11127,1.22371 -0.0102,0.457793 -0.36177,0.856354 -1.05608,0.856354 -0.43384,-0.02289 -0.62946,-0.0332 -0.90841,-0.305894 -0.11234,-0.1106 -0.13888,-0.371799 -0.14126,-0.504765 l -0.24841,-0.0016 -0.005,0.811705 c 0.38008,0.230933 0.86228,0.357868 1.28956,0.350331 1.07306,-0.02716 1.53764,-0.661965 1.55416,-1.313265 0.0411,-0.913475 -0.63263,-1.329564 -1.17104,-1.759324 -0.44694,-0.356752 -0.9487,-0.614385 -0.9487,-1.208886 0,-0.254928 0.40779,-0.684784 0.92196,-0.715858 0.29411,-9.6e-5 0.53367,0.03274 0.71771,0.238881 0.10499,0.117595 0.18356,0.239204 0.18593,0.372172 l 0.19703,0.01108 -0.007,-0.816319 c -0.11661,0.0035 -0.24285,-0.0105 -0.35493,-0.03395 -0.007,-0.0016 -0.0133,-0.002 -0.0194,-0.0025 -0.19629,-0.03792 -0.44225,-0.0982 -0.74527,-0.09772 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="ssscsssccs"
-         inkscape:connector-curvature="0"
-         id="path910-3-5-3-7-1"
-         d="m 131.99821,80.367127 c -1.60162,0 -2.72148,1.177966 -2.72148,2.925577 0,1.205782 1.10092,2.491118 2.80571,2.491118 1.84755,0 2.77444,-1.445331 2.76893,-2.702638 -0.006,-1.285268 -0.88817,-2.714057 -2.85316,-2.714057 z m 2.06533,2.91996 c -0.0246,1.609974 -0.83716,2.127907 -1.91818,2.142754 -1.23138,0.01691 -2.12316,-1.296815 -2.12591,-2.406928 -0.0243,-2.027733 1.23372,-2.304105 1.81756,-2.321329 1.69026,0.03215 2.24118,1.625677 2.22653,2.585503 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-      <path
-         sodipodi:nodetypes="csccsccscscccccsccccccc"
-         inkscape:connector-curvature="0"
-         id="path917-5-62-5-8-0"
-         d="m 136.04478,80.310258 -0.0748,4.751938 c -0.003,0.178528 -0.035,0.26398 -0.0637,0.311362 -0.0482,0.07945 -0.17246,0.137414 -0.29508,0.136766 -0.053,-2e-4 -0.0603,0.165585 0.005,0.165585 0.15176,0 0.53671,-0.04222 0.62146,-0.04206 0.0686,1.07e-4 0.37522,0.0312 0.6186,0.03137 0.12273,0 0.0838,-0.152361 0.019,-0.164038 -0.0542,-0.0098 -0.24858,-0.0885 -0.26339,-0.165122 -0.006,-0.02939 -0.0314,-0.339355 -0.0338,-0.533509 -0.0118,-0.968767 -0.0142,-1.909729 -0.0105,-2.894415 l 4.23632,3.949702 -0.0108,-4.769435 c 0,-0.138126 0.0348,-0.240799 0.0744,-0.312086 0.0578,-0.103989 0.18313,-0.12117 0.28189,-0.129758 0.0507,-0.0044 0.0735,-0.172379 -0.0132,-0.172379 -0.10764,0 -0.50226,0.0068 -0.61521,0.0066 -0.0914,-1.46e-4 -0.56071,-0.03396 -0.69456,-0.03636 -0.11951,-0.002 -0.10336,0.180442 0.0108,0.179366 0.22484,-0.002 0.29494,0.134232 0.34949,0.337072 0.009,0.03309 0.0439,0.167771 0.0596,0.447592 l 0.0275,3.139139 z"
-         style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.05301235px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
-    </g>
-    <path
-       inkscape:connector-curvature="0"
-       style="fill:#ffffff;fill-opacity:1;stroke:none;stroke-width:0.26416996;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
-       d="m 96.975039,102.57831 c -3.04835,1.72126 -4.94049,4.94629 -4.95784,8.44909 3.18944,1.73892 6.93427,1.67939 9.836611,0.0181 2.6e-4,-0.008 7.9e-4,-0.0165 0.001,-0.0248 -0.004,-3.484 -1.863431,-6.70217 -4.879301,-8.44238 z m 1.64176,3.72948 c 0.45198,0.30715 0.38492,1.04655 0.31212,1.55288 -0.0926,0.55776 -0.62713,1.47487 -1.32188,2.07326 0.0899,0.12885 0.14181,0.28753 0.14108,0.45682 -0.43052,0.21761 -0.85742,-0.0278 -1.37408,-0.47026 -0.51665,-0.44244 -1.07391,-1.32905 -1.25884,-2.24017 -0.16403,0.0174 -0.33188,-0.0192 -0.47594,-0.11007 0.0376,-0.51089 0.57985,-0.8146 1.0604,-0.99374 0.48056,-0.17913 1.71868,-0.2395 2.59158,0.0708 0.0681,-0.1429 0.18071,-0.26288 0.32556,-0.339 z"
-       id="path817-6-2-9-7-9-93-9-8-1-2-4-6" />
-  </g>
-</svg>
diff --git a/meson/graphics/meson_logo_big.png b/meson/graphics/meson_logo_big.png
deleted file mode 100644 (file)
index e2abe1b..0000000
Binary files a/meson/graphics/meson_logo_big.png and /dev/null differ
diff --git a/meson/graphics/wrap_logo.svg b/meson/graphics/wrap_logo.svg
deleted file mode 100644 (file)
index defc2d8..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<!-- Created with Inkscape (http://www.inkscape.org/) -->
-
-<svg
-   xmlns:dc="http://purl.org/dc/elements/1.1/"
-   xmlns:cc="http://creativecommons.org/ns#"
-   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
-   xmlns:svg="http://www.w3.org/2000/svg"
-   xmlns="http://www.w3.org/2000/svg"
-   xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
-   xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
-   width="744.09448819"
-   height="1052.3622047"
-   id="svg2"
-   version="1.1"
-   inkscape:version="0.91 r13725"
-   sodipodi:docname="wrap_logo.svg">
-  <defs
-     id="defs4" />
-  <sodipodi:namedview
-     id="base"
-     pagecolor="#ffffff"
-     bordercolor="#666666"
-     borderopacity="1.0"
-     inkscape:pageopacity="0.0"
-     inkscape:pageshadow="2"
-     inkscape:zoom="0.49497475"
-     inkscape:cx="357.33594"
-     inkscape:cy="840.95374"
-     inkscape:document-units="px"
-     inkscape:current-layer="layer1"
-     showgrid="false"
-     inkscape:window-width="901"
-     inkscape:window-height="504"
-     inkscape:window-x="196"
-     inkscape:window-y="73"
-     inkscape:window-maximized="0"
-     showguides="true"
-     inkscape:guide-bbox="true">
-    <inkscape:grid
-       type="xygrid"
-       id="grid3755" />
-  </sodipodi:namedview>
-  <metadata
-     id="metadata7">
-    <rdf:RDF>
-      <cc:Work
-         rdf:about="">
-        <dc:format>image/svg+xml</dc:format>
-        <dc:type
-           rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
-        <dc:title />
-      </cc:Work>
-    </rdf:RDF>
-  </metadata>
-  <g
-     inkscape:label="Layer 1"
-     inkscape:groupmode="layer"
-     id="layer1">
-    <path
-       style="fill:#d0c719;fill-opacity:1;stroke:none;stroke-opacity:1"
-       d="m 434.2897,70.235258 c 17.21481,0 47.14006,0.84934 60.97457,13.17571 13.83451,12.32637 16.84556,17.452272 19.09172,35.519332 2.08905,16.80337 2.6481,33.71944 1.49162,50.37795 -3.07225,20.81514 -5.13462,47.62599 -12.05413,67.63597 -6.23548,30.42038 -13.58284,55.16492 -25.9691,83.71647 -5.06527,13.28778 -16.76769,22.55743 -30.27757,25.94896 -15.50334,3.30801 -29.68022,2.91134 -46.74465,1.2459 -14.78626,-1.27468 -30.83798,-17.06625 -32.88238,-34.59782 -2.02303,-17.34845 -1.73385,-22.0552 -3.2728,-37.6258 0.19443,-8.76313 -6.34424,-22.76616 -16.45974,-22.40304 -9.56867,0.34349 -16.48036,12.71843 -17.51509,20.93495 -2.35599,18.70837 0.6551,19.81684 -2.94334,37.3491 -3.59844,17.53227 -14.18885,33.04354 -30.48873,36.54073 -16.26809,2.12031 -28.63094,2.71731 -46.02053,-0.49697 -18.07396,-3.34079 -26.93793,-12.81813 -33.62878,-26.59299 -6.73685,-13.86957 -10.49571,-27.84178 -16.21017,-43.09018 -4.88864,-13.04479 -8.56125,-29.18305 -10.94268,-42.92889 -3.32552,-15.18288 -3.65237,-21.38717 -6.77781,-36.57323 -0.77923,-16.65538 -4.45192,-19.80725 -5.02299,-35.71533 -0.35582,-9.91195 0.29524,-39.12315 2.43742,-46.76046 2.93782,-13.52423 7.12707,-26.026872 16.79636,-33.209232 12.64781,-8.53102 33.08952,-11.60259 47.55104,-12.32486 18.33849,-0.12627 30.65715,-1.24014 48.96624,1.08017 14.10098,2.78518 21.50029,13.82094 20.71192,29.392272 -1.06365,21.00843 -21.00671,22.03777 -35.65227,22.0668 -14.64556,0.029 -35.24942,0.73393 -37.06929,19.42192 -2.88023,18.22229 -0.38467,36.76259 2.58508,54.95764 2.30841,16.30474 8.74904,35.18114 15.47418,50.2434 1.96378,11.35395 19.50871,15.47996 23.80866,4.84187 5.41476,-8.88335 4.61169,-19.77502 7.41008,-29.84512 2.83889,-10.21585 1.44479,-19.7209 5.44492,-32.54371 4.76333,-15.2693 4.62217,-18.45204 20.66557,-24.86079 15.69676,-2.99362 39.52174,-2.95141 55.28152,-0.43903 14.06764,2.44948 22.74154,14.03686 24.98313,27.54206 3.16922,11.4823 2.40407,23.59284 4.92263,35.45854 2.5605,12.06331 6.37931,35.47294 22.0005,29.70058 11.4991,-4.24916 17.39709,-28.66089 22.07262,-43.97384 4.41,-20.15236 9.59637,-40.99697 6.08472,-61.67032 2.34204,-29.06652 -17.85275,-26.14283 -32.49264,-29.17728 -12.50724,0 -38.93213,-0.75389 -40.84562,-17.16664 -1.14528,-9.823532 -1.53864,-23.623812 11.36782,-30.993272 9.67605,-5.54646 25.93319,-4.16152 43.14799,-4.16152 z M 261.22203,247.09904 c 1.14992,1.69089 -1.64273,-0.31937 0,0 z"
-       id="path3783-1"
-       inkscape:connector-curvature="0"
-       sodipodi:nodetypes="zzscccccscsszcsssccsccccszccccsscccsscccsczcc"
-       inkscape:export-filename="/home/jpakkane/workspace/meson/graphics/meson_logo_big.png"
-       inkscape:export-xdpi="300"
-       inkscape:export-ydpi="300" />
-  </g>
-</svg>
diff --git a/meson/lgtm.yml b/meson/lgtm.yml
deleted file mode 100644 (file)
index 62d8cb4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-extraction:
-  python:
-    python_setup:
-      version: 3
\ No newline at end of file
diff --git a/meson/man/meson.1 b/meson/man/meson.1
deleted file mode 100644 (file)
index fbbccfa..0000000
+++ /dev/null
@@ -1,238 +0,0 @@
-.TH MESON "1" "September 2020" "meson 0.55.3" "User Commands"
-.SH NAME
-meson - a high productivity build system
-.SH DESCRIPTION
-
-Meson is a build system designed to optimize programmer
-productivity. It aims to do this by providing simple, out-of-the-box
-support for modern software development tools and practices, such as
-unit tests, coverage reports, Valgrind, Ccache and the like.
-
-The main Meson executable provides many subcommands to access all
-the functionality.
-
-.SH The setup command
-
-Using Meson is simple and follows the common two-phase
-process of most build systems. First you run Meson to
-configure your build:
-
-.B meson setup [
-.I options
-.B ] [
-.I build directory
-.B ] [
-.I source directory
-.B ]
-
-Note that the build directory must be different from the source
-directory. Meson does not support building inside the source directory
-and attempting to do that leads to an error.
-
-After a successful configuration step you can build the source by
-running the actual build command in the build directory. The default
-backend of Meson is Ninja, which can be invoked like this.
-
-\fBninja [\fR \fItarget\fR \fB]\fR
-
-You only need to run the Meson command once: when you first configure
-your build dir. After that you just run the build command. Meson will
-autodetect changes in your source tree and regenerate all files
-needed to build the project.
-
-The setup command is the default operation. If no actual command is
-specified, Meson will assume you meant to do a setup. That means
-that you can set up a build directory without the setup command
-like this:
-
-.B meson [
-.I options
-.B ] [
-.I build directory
-.B ] [
-.I source directory
-.B ]
-
-.SS "options:"
-.TP
-\fB\-\-version\fR
-print version number
-.TP
-\fB\-\-help\fR
-print command line help
-
-.SH The configure command
-
-.B meson configure
-provides a way to configure a Meson project from the command line.
-Its usage is simple:
-
-.B meson configure [
-.I build directory
-.B ] [
-.I options to set
-.B ]
-
-If build directory is omitted, the current directory is used instead.
-
-If no parameters are set,
-.B meson configure
-will print the value of all build options to the console.
-
-To set values, use the \-D command line argument like this.
-
-.B meson configure \-Dopt1=value1 \-Dopt2=value2
-
-.SH The introspect command
-
-Meson introspect is a command designed to make it simple to  integrate with
-other tools, such as IDEs. The output of this command is in JSON.
-
-.B meson introspect [
-.I build directory
-.B ] [
-.I option
-.B ]
-
-If build directory is omitted, the current directory is used instead.
-
-.SS "options:"
-.TP
-\fB\-\-targets\fR
-print all top level targets (executables, libraries, etc)
-.TP
-\fB\-\-target\-files\fR
-print the source files of the given target
-.TP
-\fB\-\-buildsystem\-files\fR
-print all files that make up the build system (meson.build, meson_options.txt etc)
-.TP
-\fB\-\-tests\fR
-print all unit tests
-.TP
-\fB\-\-help\fR
-print command line help
-
-.SH The test command
-
-.B meson test
-is a helper tool for running test suites of projects using Meson.
-The default way of running tests is to invoke the default build command:
-
-\fBninja [\fR \fItest\fR \fB]\fR
-
-.B meson test
-provides a richer set of tools for invoking tests.
-
-.B meson test
-automatically rebuilds the necessary targets to run tests when used with the Ninja backend.
-Upon build failure,
-.B meson test
-will return an exit code of 125.
-This return code tells
-.B git bisect run
-to skip the current commit.
-Thus bisecting using git can be done conveniently like this.
-
-.B git bisect run meson test -C build_dir
-
-.SS "options:"
-.TP
-\fB\-\-repeat\fR
-run tests as many times as specified
-.TP
-\fB\-\-gdb\fR
-run tests under gdb
-.TP
-\fB\-\-list\fR
-list all available tests
-.TP
-\fB\-\-wrapper\fR
-invoke all tests via the given wrapper (e.g. valgrind)
-.TP
-\fB\-C\fR
-Change into the given directory before running tests (must be root of build directory).
-.TP
-\fB\-\-suite\fR
-run tests in this suite
-.TP
-\fB\-\-no\-suite\fR
-do not run tests in this suite
-.TP
-\fB\-\-no\-stdsplit\fR
-do not split stderr and stdout in test logs
-.TP
-\fB\-\-benchmark\fR
-run benchmarks instead of tests
-.TP
-\fB\-\-logbase\fR
-base of file name to use for writing test logs
-.TP
-\fB\-\-num-processes\fR
-how many parallel processes to use to run tests
-.TP
-\fB\-\-verbose\fR
-do not redirect stdout and stderr
-.TP
-\fB\-t\fR
-a multiplier to use for test timeout values (usually something like 100 for Valgrind)
-.TP
-\fB\-\-setup\fR
-use the specified test setup
-
-.SH The wrap command
-
-Wraptool is a helper utility to manage source dependencies
-using the online wrapdb service.
-
-.B meson wrap <
-.I command
-.B > [
-.I options
-.B ]
-
-You should run this command in the top level source directory
-of your project.
-
-.SS "Commands:"
-.TP
-\fBlist\fR
-list all available projects
-.TP
-\fBsearch\fR
-search projects by name
-.TP
-\fBinstall\fR
-install a project with the given name
-.TP
-\fBupdate\fR
-update the specified project to latest available version
-.TP
-\fBinfo\fR
-show available versions of the specified project
-.TP
-\fBstatus\fR
-show installed and available versions of currently used subprojects
-
-.SH EXIT STATUS
-
-.TP
-.B 0
-Successful.
-.TP
-.B 1
-Usage error, or an error parsing or executing meson.build.
-.TP
-.B 2
-Internal error.
-.TP
-.B 125
-.B meson test
-could not rebuild the required targets.
-.TP
-
-.SH SEE ALSO
-
-http://mesonbuild.com/
-
-https://wrapdb.mesonbuild.com/
diff --git a/meson/manual tests/1 wrap/main.c b/meson/manual tests/1 wrap/main.c
deleted file mode 100644 (file)
index df6abe4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#include<sqlite3.h>
-#include<stdio.h>
-
-int main(void) {
-    sqlite3 *db;
-    if(sqlite3_open(":memory:", &db) != SQLITE_OK) {
-        printf("Sqlite failed.\n");
-        return 1;
-    }
-    sqlite3_close(db);
-    return 0;
-}
diff --git a/meson/manual tests/1 wrap/meson.build b/meson/manual tests/1 wrap/meson.build
deleted file mode 100644 (file)
index aee358d..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-project('downloader', 'c')
-
-cc = meson.get_compiler('c')
-
-s = subproject('sqlite').get_variable('sqlite_dep')
-th = dependency('threads')
-
-libdl = cc.find_library('dl', required : false)
-
-e = executable('dtest', 'main.c',
-  dependencies : [th, libdl, s])
-
-test('dltest', e)
diff --git a/meson/manual tests/1 wrap/subprojects/sqlite.wrap b/meson/manual tests/1 wrap/subprojects/sqlite.wrap
deleted file mode 100644 (file)
index 6d14949..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = sqlite-amalgamation-3080802
-
-source_url = http://sqlite.com/2015/sqlite-amalgamation-3080802.zip
-source_filename = sqlite-amalgamation-3080802.zip
-source_hash = 5ebeea0dfb75d090ea0e7ff84799b2a7a1550db3fe61eb5f6f61c2e971e57663
-
-patch_url = https://wrapdb.mesonbuild.com/v1/projects/sqlite/3080802/5/get_zip
-patch_filename = sqlite-3080802-5-wrap.zip
-patch_hash = d66469a73fa1344562d56a1d7627d5d0ee4044a77b32d16cf4bbb85741d4c9fd
diff --git a/meson/manual tests/10 svn wrap/meson.build b/meson/manual tests/10 svn wrap/meson.build
deleted file mode 100644 (file)
index 23ef1f1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-project('Subversion outchecker', 'c')
-
-sp = subproject('samplesubproject')
-
-exe = executable('gitprog', 'prog.c',
-include_directories : sp.get_variable('subproj_inc'),
-link_with : sp.get_variable('subproj_lib'),
-)
-
-test('maintest', exe)
diff --git a/meson/manual tests/10 svn wrap/prog.c b/meson/manual tests/10 svn wrap/prog.c
deleted file mode 100644 (file)
index 6e2c4d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include"subproj.h"
-
-int main(void) {
-    subproj_function();
-    return 0;
-}
diff --git a/meson/manual tests/10 svn wrap/subprojects/samplesubproject.wrap b/meson/manual tests/10 svn wrap/subprojects/samplesubproject.wrap
deleted file mode 100644 (file)
index c8a687e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-[wrap-svn]
-directory=samplesubproject
-url=https://svn.code.sf.net/p/mesonsubproject/code/trunk
-revision=head
diff --git a/meson/manual tests/11 wrap imposter/meson.build b/meson/manual tests/11 wrap imposter/meson.build
deleted file mode 100644 (file)
index d0575ac..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-project('evil URL')
-# showing that new Meson wrap.py code tries to stop imposter WrapDB URLs
-# a WrapException is raised.
-#
-# ERROR: https://wrapdb.mesonbuild.com.invalid/v1/projects/zlib/1.2.11/4/get_zip may be a WrapDB-impersonating URL
-#
-
-subproject('zlib')
\ No newline at end of file
diff --git a/meson/manual tests/11 wrap imposter/subprojects/zlib.wrap b/meson/manual tests/11 wrap imposter/subprojects/zlib.wrap
deleted file mode 100644 (file)
index b88f8f2..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = zlib-1.2.8
-
-source_url = https://zlib.net/zlib-1.2.11.tar.gz
-source_filename = zlib-1.2.11.tar.gz
-source_hash = c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
-
-patch_url = https://wrapdb.mesonbuild.com.invalid/v1/projects/zlib/1.2.11/4/get_zip
-patch_filename = zlib-1.2.11-4-wrap.zip
-patch_hash = 886b67480dbe73b406ad83a1dd6d9596f93089d90c220ccfc91944c95f1c68c4
\ No newline at end of file
diff --git a/meson/manual tests/12 wrap mirror/meson.build b/meson/manual tests/12 wrap mirror/meson.build
deleted file mode 100644 (file)
index 6645bdf..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-project('downloader')
-# this test will timeout, showing that a subdomain isn't caught as masquarading url
-
-subproject('zlib')
diff --git a/meson/manual tests/12 wrap mirror/subprojects/zlib.wrap b/meson/manual tests/12 wrap mirror/subprojects/zlib.wrap
deleted file mode 100644 (file)
index de0b9ad..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = zlib-1.2.8
-
-source_url = https://zlib.net/zlib-1.2.11.tar.gz
-source_filename = zlib-1.2.11.tar.gz
-source_hash = c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
-
-patch_url = https://mirror1.wrapdb.mesonbuild.com/v1/projects/zlib/1.2.11/4/get_zip
-patch_filename = zlib-1.2.11-4-wrap.zip
-patch_hash = 886b67480dbe73b406ad83a1dd6d9596f93089d90c220ccfc91944c95f1c68c4
\ No newline at end of file
diff --git a/meson/manual tests/2 multiwrap/meson.build b/meson/manual tests/2 multiwrap/meson.build
deleted file mode 100644 (file)
index a4c42f4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-project('multiwrap', 'c',
-  default_options : 'c_std=c99')
-
-# Using multiple downloaded projects for great justice.
-
-cc = meson.get_compiler('c')
-
-luadep = dependency('lua', fallback : ['lua', 'lua_dep'])
-pngdep = dependency('libpng', fallback : ['libpng', 'png_dep'])
-
-executable('prog', 'prog.c',
-  dependencies : [pngdep, luadep])
diff --git a/meson/manual tests/2 multiwrap/prog.c b/meson/manual tests/2 multiwrap/prog.c
deleted file mode 100644 (file)
index dd0349e..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#include<lua.h>
-#include<stdio.h>
-#include<stdlib.h>
-#include<png.h>
-#include<string.h>
-#if !defined(_MSC_VER)
-#include<unistd.h>
-#endif
-
-static void *l_alloc (void *ud, void *ptr, size_t osize,
-        size_t nsize) {
-    (void)ud;
-    (void)osize;
-    if (nsize == 0) {
-        free(ptr);
-        return NULL;
-    } else {
-        return realloc(ptr, nsize);
-    }
-}
-
-void open_image(const char *fname) {
-    png_image image;
-
-    memset(&image, 0, (sizeof image));
-    image.version = PNG_IMAGE_VERSION;
-
-    if(png_image_begin_read_from_file(&image, fname) != 0) {
-        png_bytep buffer;
-
-        image.format = PNG_FORMAT_RGBA;
-        buffer = malloc(PNG_IMAGE_SIZE(image));
-
-        if(png_image_finish_read(&image, NULL, buffer, 0, NULL) != 0) {
-            printf("Image %s read failed: %s\n", fname, image.message);
-        }
-//        png_free_image(&image);
-        free(buffer);
-    } else {
-        printf("Image %s open failed: %s", fname, image.message);
-    }
-}
-
-int printer(lua_State *l) {
-    if(!lua_isstring(l, 1)) {
-        fprintf(stderr, "Incorrect call.\n");
-        return 0;
-    }
-    open_image(lua_tostring(l, 1));
-    return 0;
-}
-
-
-int main(int argc, char **argv) {
-    lua_State *l = lua_newstate(l_alloc, NULL);
-    if(!l) {
-        printf("Lua state allocation failed.\n");
-        return 1;
-    }
-    lua_register(l, "printer", printer);
-    lua_getglobal(l, "printer");
-    lua_pushliteral(l, "foobar.png");
-    lua_call(l, 1, 0);
-    lua_close(l);
-    return 0;
-}
diff --git a/meson/manual tests/2 multiwrap/subprojects/libpng.wrap b/meson/manual tests/2 multiwrap/subprojects/libpng.wrap
deleted file mode 100644 (file)
index 283775c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = libpng-1.6.34
-
-source_url = ftp://ftp-osl.osuosl.org/pub/libpng/src/libpng16/libpng-1.6.34.tar.xz
-source_filename = libpng-1.6.34.tar.xz
-source_hash = 2f1e960d92ce3b3abd03d06dfec9637dfbd22febf107a536b44f7a47c60659f6
-
-patch_url = https://wrapdb.mesonbuild.com/v1/projects/libpng/1.6.34/1/get_zip
-patch_filename = libpng-1.6.34-1-wrap.zip
-patch_hash = 2123806eba8180c164e33a210f2892bbeb2473b69e56aecc786574e9221e6f20
diff --git a/meson/manual tests/2 multiwrap/subprojects/lua.wrap b/meson/manual tests/2 multiwrap/subprojects/lua.wrap
deleted file mode 100644 (file)
index c1a179a..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-[wrap-file]
-directory = lua-5.3.0
-
-source_url = http://www.lua.org/ftp/lua-5.3.0.tar.gz
-source_filename = lua-5.3.0.tar.gz
-source_hash = ae4a5eb2d660515eb191bfe3e061f2b8ffe94dce73d32cfd0de090ddcc0ddb01
-
-
-patch_url = https://wrapdb.mesonbuild.com/v1/projects/lua/5.3.0/5/get_zip
-patch_filename = lua-5.3.0-5-wrap.zip
-patch_hash = 439038309a0700adfb67d764b3fe935ed8601b31f819fc369e1438c6e79334dd
diff --git a/meson/manual tests/2 multiwrap/subprojects/zlib.wrap b/meson/manual tests/2 multiwrap/subprojects/zlib.wrap
deleted file mode 100644 (file)
index 6d5896f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-[wrap-file]
-directory = zlib-1.2.8
-
-source_url = http://zlib.net/fossils/zlib-1.2.8.tar.gz
-source_filename = zlib-1.2.8.tar.gz
-source_hash = 36658cb768a54c1d4dec43c3116c27ed893e88b02ecfcb44f2166f9c0b7f2a0d
-
-patch_url = https://wrapdb.mesonbuild.com/v1/projects/zlib/1.2.8/8/get_zip
-patch_filename = zlib-1.2.8-8-wrap.zip
-patch_hash = 17c52a0e0c59ce926d3959005d5cd8178c6c7e2c9a4a1304279a8320c955ac60
diff --git a/meson/manual tests/3 git wrap/meson.build b/meson/manual tests/3 git wrap/meson.build
deleted file mode 100644 (file)
index 7fd5083..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-project('git outcheckker', 'c')
-
-sp = subproject('samplesubproject')
-
-exe = executable('gitprog', 'prog.c',
-include_directories : sp.get_variable('subproj_inc'),
-link_with : sp.get_variable('subproj_lib'),
-)
-
-test('maintest', exe)
diff --git a/meson/manual tests/3 git wrap/prog.c b/meson/manual tests/3 git wrap/prog.c
deleted file mode 100644 (file)
index 6e2c4d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include"subproj.h"
-
-int main(void) {
-    subproj_function();
-    return 0;
-}
diff --git a/meson/manual tests/3 git wrap/subprojects/samplesubproject.wrap b/meson/manual tests/3 git wrap/subprojects/samplesubproject.wrap
deleted file mode 100644 (file)
index f52190b..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-[wrap-git]
-directory=samplesubproject
-url=https://github.com/jpakkane/samplesubproject.git
-revision=head
diff --git a/meson/manual tests/4 standalone binaries/Info.plist b/meson/manual tests/4 standalone binaries/Info.plist
deleted file mode 100644 (file)
index 0f0c90e..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
-  <key>CFBundleGetInfoString</key>
-  <string>MyApp</string>
-  <key>CFBundleExecutable</key>
-  <string>myapp.sh</string>
-  <key>CFBundleIdentifier</key>
-  <string>com.example.me</string>
-  <key>CFBundleName</key>
-  <string>myapp</string>
-  <key>CFBundleIconFile</key>
-  <string>myapp.icns</string>
-  <key>CFBundleShortVersionString</key>
-  <string>1.0</string>
-  <key>CFBundleInfoDictionaryVersion</key>
-  <string>6.0</string>
-  <key>CFBundlePackageType</key>
-  <string>APPL</string>
-  <key>IFMajorVersion</key>
-  <integer>0</integer>
-  <key>IFMinorVersion</key>
-  <integer>1</integer>
-</dict>
-</plist>
diff --git a/meson/manual tests/4 standalone binaries/build_linux_package.sh b/meson/manual tests/4 standalone binaries/build_linux_package.sh
deleted file mode 100755 (executable)
index 783981e..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh -eu
-
-curdir=`pwd`
-rm -rf buildtmp
-mkdir buildtmp
-LDFLAGS=-static-libstdc++ ~/meson/meson.py buildtmp --buildtype=release --prefix=/tmp/myapp --libdir=lib --strip
-ninja -C buildtmp install
-rm -rf buildtmp
-cd /tmp/
-tar czf myapp.tar.gz myapp
-mv myapp.tar.gz "$curdir"
-rm -rf myapp
diff --git a/meson/manual tests/4 standalone binaries/build_osx_package.sh b/meson/manual tests/4 standalone binaries/build_osx_package.sh
deleted file mode 100755 (executable)
index 8a94ca5..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-#!/bin/sh -eu
-
-rm -rf buildtmp
-mkdir buildtmp
-~/meson/meson.py buildtmp --buildtype=release  --prefix=/tmp/myapp.app --bindir=Contents/MacOS
-ninja -C buildtmp install
-rm -rf buildtmp
-mkdir -p mnttmp
-rm -f working.dmg
-gunzip < template.dmg.gz > working.dmg
-hdiutil attach working.dmg -noautoopen -quiet -mountpoint mnttmp
-rm -rf mnttmp/myapp.app
-mv /tmp/myapp.app mnttmp
-# NOTE: output of hdiutil changes every now and then.
-# Verify that this is still working.
-hdiutil detach $(hdiutil info|grep "mnttmp"|awk '{print $1}')
-rm -rf mnttmp
-rm -f myapp.dmg
-hdiutil convert working.dmg -quiet -format UDZO -imagekey zlib-level=9 -o myapp.dmg
-rm -f working.dmg
diff --git a/meson/manual tests/4 standalone binaries/build_windows_package.py b/meson/manual tests/4 standalone binaries/build_windows_package.py
deleted file mode 100755 (executable)
index 0932eac..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/usr/bin/env python3
-
-import os, urllib.request, shutil, subprocess
-from glob import glob
-
-sdl_url = 'http://libsdl.org/release/SDL2-devel-2.0.3-VC.zip'
-sdl_filename = 'SDL2-devel-2.0.3-VC.zip'
-sdl_dir = 'SDL2-2.0.3'
-
-shutil.rmtree('build', ignore_errors=True)
-os.mkdir('build')
-
-if not os.path.exists(sdl_filename):
-    response = urllib.request.urlopen(sdl_url, timeout=600.0)
-    data = response.read()
-    open(sdl_filename, 'wb').write(data)
-
-shutil.unpack_archive(sdl_filename, 'build')
-
-libs = glob(os.path.join('build', sdl_dir, 'lib/x86/*'))
-[shutil.copy(x, 'build') for x in libs]
-
-# Sorry for this hack but this needs to work during development
-# when Meson is not in path.
-subprocess.check_call(['python3', r'..\..\meson.py', 'build',
-                       '--backend=ninja', '--buildtype=release'])
-subprocess.check_call(['ninja'], cwd='build')
-shutil.copy('myapp.iss', 'build')
-subprocess.check_call([r'\Program Files\Inno Setup 5\ISCC.exe', 'myapp.iss'],
-                      cwd='build')
-shutil.copy('build/setup.exe', 'myapp 1.0.exe')
-shutil.rmtree('build')
diff --git a/meson/manual tests/4 standalone binaries/linux_bundler.sh b/meson/manual tests/4 standalone binaries/linux_bundler.sh
deleted file mode 100755 (executable)
index 2a8e907..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/sh -eu
-
-libdir="${MESON_INSTALL_PREFIX}/lib"
-mkdir -p $libdir
-sdlfile=`ldd ${MESON_INSTALL_PREFIX}/bin/myapp | grep libSDL | cut -d ' ' -f 3`
-cp $sdlfile "${libdir}"
-strip "${libdir}/libSDL"*
diff --git a/meson/manual tests/4 standalone binaries/meson.build b/meson/manual tests/4 standalone binaries/meson.build
deleted file mode 100644 (file)
index ad6645f..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-project('myapp', 'cpp')
-
-sdl = dependency('sdl2', required : host_machine.system() != 'windows')
-
-if meson.get_compiler('cpp').get_id() != 'msvc'
-  add_global_arguments('-std=c++11', language : 'cpp')
-endif
-
-if host_machine.system() == 'darwin'
-  install_data('myapp.sh',
-  install_dir : 'Contents/MacOS')
-
-  install_data('myapp.icns',
-  install_dir : 'Contents/Resources')
-
-  install_data('Info.plist',
-  install_dir : 'Contents')
-
-  meson.add_install_script('osx_bundler.sh')
-endif
-
-if host_machine.system() == 'linux'
-  install_data('myapp.sh', install_dir : '.')
-  meson.add_install_script('linux_bundler.sh')
-endif
-
-extra_link_args = []
-
-if host_machine.system() == 'windows'
-  str = '-I@0@/@1@'.format(meson.current_build_dir(), 'SDL2-2.0.3/include')
-  add_global_arguments(str, language : 'cpp')
-  extra_link_args = ['/SUBSYSTEM:CONSOLE', 'SDL2main.lib', 'SDL2.lib']
-endif
-
-prog = executable('myapp', 'myapp.cpp',
-dependencies : sdl,
-link_args : extra_link_args,
-install : true)
diff --git a/meson/manual tests/4 standalone binaries/myapp.cpp b/meson/manual tests/4 standalone binaries/myapp.cpp
deleted file mode 100644 (file)
index 8ddff27..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#include<SDL.h>
-#include<memory>
-#include<iostream>
-#include<string>
-
-int main(void) {
-  SDL_Surface *screenSurface;
-  SDL_Event e;
-  int keepGoing = 1;
-  std::string message;
-
-  if(SDL_Init( SDL_INIT_VIDEO ) < 0) {
-    printf( "SDL could not initialize! SDL_Error: %s\n", SDL_GetError() );
-  }
-  atexit(SDL_Quit);
-
-  std::unique_ptr<SDL_Window, void(*)(SDL_Window*)> window(SDL_CreateWindow( "My application", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN), SDL_DestroyWindow);
-  screenSurface = SDL_GetWindowSurface(window.get());
-
-  // Use iostream to make sure we have not screwed
-  // up libstdc++ linking.
-  message = "Window created.";
-  message += " Starting main loop.";
-  std::cout << message << std::endl;
-
-  while(keepGoing) {
-    while(SDL_PollEvent(&e) != 0) {
-      if(e.type == SDL_QUIT) {
-        keepGoing = 0;
-        break;
-      }
-    }
-    SDL_FillRect(screenSurface, NULL, SDL_MapRGB(screenSurface->format, 0xFF, 0x00, 0x00));
-    SDL_UpdateWindowSurface(window.get());
-    SDL_Delay(100);
-  }
-
-  return 0;
-}
diff --git a/meson/manual tests/4 standalone binaries/myapp.icns b/meson/manual tests/4 standalone binaries/myapp.icns
deleted file mode 100644 (file)
index 6331954..0000000
Binary files a/meson/manual tests/4 standalone binaries/myapp.icns and /dev/null differ
diff --git a/meson/manual tests/4 standalone binaries/myapp.iss b/meson/manual tests/4 standalone binaries/myapp.iss
deleted file mode 100644 (file)
index 2bd441d..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-; Innosetup file for My app.
-
-[Setup]
-AppName=My App
-AppVersion=1.0
-DefaultDirName={pf}\My App
-DefaultGroupName=My App
-UninstallDisplayIcon={app}\myapp.exe
-Compression=lzma2
-SolidCompression=yes
-OutputDir=.
-
-[Files]
-Source: "myapp.exe"; DestDir: "{app}"
-Source: "SDL2.dll"; DestDir: "{app}"
-
-;[Icons]
-;Name: "{group}\My App"; Filename: "{app}\myapp.exe"
diff --git a/meson/manual tests/4 standalone binaries/myapp.sh b/meson/manual tests/4 standalone binaries/myapp.sh
deleted file mode 100755 (executable)
index 3191483..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/bash
-
-cd "${0%/*}"
-
-if [ `uname` == 'Darwin' ]; then
-    ./myapp
-else
-    export LD_LIBRARY_PATH="`pwd`/lib"
-    bin/myapp
-fi
diff --git a/meson/manual tests/4 standalone binaries/osx_bundler.sh b/meson/manual tests/4 standalone binaries/osx_bundler.sh
deleted file mode 100755 (executable)
index 3bad65f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh -eu
-
-mkdir -p ${MESON_INSTALL_PREFIX}/Contents/Frameworks
-cp -R /Library/Frameworks/SDL2.framework ${MESON_INSTALL_PREFIX}/Contents/Frameworks
-
-install_name_tool -change @rpath/SDL2.framework/Versions/A/SDL2 @executable_path/../Frameworks/SDL2.framework/Versions/A/SDL2 ${MESON_INSTALL_PREFIX}/Contents/MacOS/myapp
diff --git a/meson/manual tests/4 standalone binaries/readme.txt b/meson/manual tests/4 standalone binaries/readme.txt
deleted file mode 100644 (file)
index 991b5c6..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-This directory shows how you can build redistributable binaries. On
-OSX this menans building an app bundle and a .dmg installer. On Linux
-it means building an archive that bundles its dependencies. On Windows
-it means building an .exe installer.
-
-To build each package you run the corresponding build_ARCH.sh build
-script.
-
-On Linux you must build the package on the oldest distribution you
-plan to support (Debian stable/oldstable and old CentOS are the common
-choice here).
-
diff --git a/meson/manual tests/4 standalone binaries/template.dmg.gz b/meson/manual tests/4 standalone binaries/template.dmg.gz
deleted file mode 100644 (file)
index fcb6d61..0000000
Binary files a/meson/manual tests/4 standalone binaries/template.dmg.gz and /dev/null differ
diff --git a/meson/manual tests/5 rpm/lib.c b/meson/manual tests/5 rpm/lib.c
deleted file mode 100644 (file)
index efc230a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include"lib.h"
-
-char *meson_print(void)
-{
-  return "Hello, world!";
-}
diff --git a/meson/manual tests/5 rpm/lib.h b/meson/manual tests/5 rpm/lib.h
deleted file mode 100644 (file)
index 08fc961..0000000
+++ /dev/null
@@ -1 +0,0 @@
-char *meson_print(void);
diff --git a/meson/manual tests/5 rpm/main.c b/meson/manual tests/5 rpm/main.c
deleted file mode 100644 (file)
index 8b1d193..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#include<lib.h>
-#include<stdio.h>
-int main(void)
-{
-  char *t = meson_print();
-  printf("%s", t);
-  return 0;
-}
diff --git a/meson/manual tests/5 rpm/meson.build b/meson/manual tests/5 rpm/meson.build
deleted file mode 100644 (file)
index 131da39..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-project('test spec', 'c')
-
-rpm = import('rpm')
-dependency('zlib')
-find_program('nonexistprog', required : false)
-
-lib = shared_library('mesontest_shared', ['lib.c', 'lib.h'],
-                     version : '0.1', soversion : '0',
-                     install : true)
-executable('mesontest-bin', 'main.c',
-           link_with : lib,
-           install : true)
-
-rpm.generate_spec_template()
diff --git a/meson/manual tests/6 hg wrap/meson.build b/meson/manual tests/6 hg wrap/meson.build
deleted file mode 100644 (file)
index c7ac004..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-project('Mercurial outcheckker', 'c')
-
-sp = subproject('samplesubproject')
-
-exe = executable('gitprog', 'prog.c',
-include_directories : sp.get_variable('subproj_inc'),
-link_with : sp.get_variable('subproj_lib'),
-)
-
-test('maintest', exe)
diff --git a/meson/manual tests/6 hg wrap/prog.c b/meson/manual tests/6 hg wrap/prog.c
deleted file mode 100644 (file)
index 6e2c4d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include"subproj.h"
-
-int main(void) {
-    subproj_function();
-    return 0;
-}
diff --git a/meson/manual tests/6 hg wrap/subprojects/samplesubproject.wrap b/meson/manual tests/6 hg wrap/subprojects/samplesubproject.wrap
deleted file mode 100644 (file)
index 6d3b3f2..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-[wrap-hg]
-directory=samplesubproject
-url=https://bitbucket.org/jpakkane/samplesubproject
-revision=tip
diff --git a/meson/manual tests/7 vala composite widgets/meson.build b/meson/manual tests/7 vala composite widgets/meson.build
deleted file mode 100644 (file)
index 579ca51..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-project('composite', 'vala', 'c')
-gnome = import('gnome')
-deps = [
-  dependency('glib-2.0', version : '>=2.38'),
-  dependency('gobject-2.0'),
-  dependency('gtk+-3.0'),
-]
-res = files('my-resources.xml')
-gres = gnome.compile_resources(
-  'my', res,
-  source_dir : '.',
-)
-executable(
-  'demo',
-  sources : [
-    'mywidget.vala',
-    gres,
-  ],
-  dependencies : deps,
-  vala_args : ['--gresources', res],
-)
diff --git a/meson/manual tests/7 vala composite widgets/my-resources.xml b/meson/manual tests/7 vala composite widgets/my-resources.xml
deleted file mode 100644 (file)
index b5743c1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<gresources>
-  <gresource prefix="/org/foo/my">
-    <file compressed="true" preprocess="xml-stripblanks">mywidget.ui</file>
-  </gresource>
-</gresources>
diff --git a/meson/manual tests/7 vala composite widgets/mywidget.ui b/meson/manual tests/7 vala composite widgets/mywidget.ui
deleted file mode 100644 (file)
index 2d6286c..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<interface>
-  <!-- interface-requires gtk+ 3.8 -->
-  <template class="MyWidget" parent="GtkBox">
-    <property name="visible">True</property>
-    <property name="can_focus">False</property>
-    <property name="orientation">vertical</property>
-    <property name="spacing">4</property>
-    <child>
-      <object class="GtkLabel" id="label1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="valign">start</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">This widget is defined with composite GtkBuilder script</property>
-        <property name="wrap">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">0</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkEntry" id="entry">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="invisible_char">•</property>
-        <signal name="changed" handler="on_entry_changed" object="MyWidget" swapped="no"/>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">1</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkLabel" id="label2">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="halign">start</property>
-        <property name="valign">start</property>
-        <property name="xalign">0</property>
-        <property name="label" translatable="yes">Press the button to fetch the internal entry text</property>
-        <property name="wrap">True</property>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="button">
-        <property name="label" translatable="yes">The Button</property>
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="receives_default">True</property>
-        <property name="halign">end</property>
-        <signal name="clicked" handler="on_button_clicked" swapped="no"/>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">3</property>
-      </packing>
-    </child>
-  </template>
-</interface>
diff --git a/meson/manual tests/7 vala composite widgets/mywidget.vala b/meson/manual tests/7 vala composite widgets/mywidget.vala
deleted file mode 100644 (file)
index 68eaecc..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-using Gtk;
-
-[GtkTemplate (ui = "/org/foo/my/mywidget.ui")]
-public class MyWidget : Box {
-    public string text {
-        get { return entry.text; }
-        set { entry.text = value; }
-    }
-
-    [GtkChild]
-    private Entry entry;
-
-    public MyWidget (string text) {
-        this.text = text;
-    }
-
-    [GtkCallback]
-    private void on_button_clicked (Button button) {
-        print ("The button was clicked with entry text: %s\n", entry.text);
-    }
-
-    [GtkCallback]
-    private void on_entry_changed (Editable editable) {
-        print ("The entry text changed: %s\n", entry.text);
-
-        notify_property ("text");
-    }
-}
-
-void main(string[] args) {
-    Gtk.init (ref args);
-    var win = new Window();
-    win.destroy.connect (Gtk.main_quit);
-
-    var widget = new MyWidget ("The entry text!");
-
-    win.add (widget);
-    win.show_all ();
-
-    Gtk.main ();
-}
diff --git a/meson/manual tests/8 timeout/meson.build b/meson/manual tests/8 timeout/meson.build
deleted file mode 100644 (file)
index 8ba7d4b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-project('timeout', 'c')
-
-# This creates a test that times out. It is a manual test
-# because currently there is no test suite for test that are expected
-# to fail during unit test phase.
-
-exe = executable('sleepprog', 'sleepprog.c')
-test('timeout', exe, timeout : 1)
diff --git a/meson/manual tests/8 timeout/sleepprog.c b/meson/manual tests/8 timeout/sleepprog.c
deleted file mode 100644 (file)
index 8875e12..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#include<unistd.h>
-
-int main(void) {
-    sleep(1000);
-    return 0;
-}
diff --git a/meson/manual tests/9 nostdlib/meson.build b/meson/manual tests/9 nostdlib/meson.build
deleted file mode 100644 (file)
index 9c5f949..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-project('own libc', 'c')
-
-# Not related to this test, but could not find a better place for this test.
-assert(meson.get_cross_property('nonexisting', 'defaultvalue') == 'defaultvalue',
-  'Cross prop getting is broken.')
-
-# A simple project that uses its own libc.
-
-# Note that we don't need to specify anything, the flags to use
-# stdlib come from the cross file.
-
-exe = executable('selfcontained', 'prog.c')
-
-test('standalone test', exe)
diff --git a/meson/manual tests/9 nostdlib/prog.c b/meson/manual tests/9 nostdlib/prog.c
deleted file mode 100644 (file)
index b9216ee..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-
-#include<stdio.h>
-
-int main(void) {
-  const char *message = "Hello without stdlib.\n";
-  return simple_print(message, simple_strlen(message));
-}
diff --git a/meson/manual tests/9 nostdlib/subprojects/mylibc/libc.c b/meson/manual tests/9 nostdlib/subprojects/mylibc/libc.c
deleted file mode 100644 (file)
index 67261cb..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Do not use this as the basis of your own libc.
- * The code is probably unoptimal or wonky, as I
- * had no prior experience with this, but instead
- * just fiddled with the code until it worked.
- */
-
-#include<stdio.h>
-
-#define STDOUT 1
-#define SYS_WRITE 4
-
-int simple_print(const char *msg, const long bufsize) {
-  int count;
-  long total_written = 0;
-  while(total_written < bufsize) {
-    asm(
-        "int $0x80\n\t"
-        : "=a"(count)
-        : "0"(SYS_WRITE), "b"(STDOUT), "c"(msg+total_written), "d"(bufsize-total_written)
-        :);
-    if(count == 0) {
-      return 1;
-    }
-    total_written += count;
-  }
-  return 0;
-}
-
-int simple_strlen(const char *str) {
-  int len = 0;
-  while(str[len] != '\0') {
-    len++;
-  }
-  return len;
-}
diff --git a/meson/manual tests/9 nostdlib/subprojects/mylibc/meson.build b/meson/manual tests/9 nostdlib/subprojects/mylibc/meson.build
deleted file mode 100644 (file)
index aa0184e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-project('own libc', 'c')
-
-# A very simple libc implementation
-
-# Do not specify -nostdlib & co. They come from cross specifications.
-
-libc = static_library('c', 'libc.c', 'stubstart.s')
-
-mylibc_dep = declare_dependency(link_with : libc,
-  include_directories : include_directories('.')
-)
diff --git a/meson/manual tests/9 nostdlib/subprojects/mylibc/stdio.h b/meson/manual tests/9 nostdlib/subprojects/mylibc/stdio.h
deleted file mode 100644 (file)
index c3f8f56..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#pragma once
-
-int simple_print(const char *msg, const long bufsize);
-
-int simple_strlen(const char *str);
diff --git a/meson/manual tests/9 nostdlib/subprojects/mylibc/stubstart.s b/meson/manual tests/9 nostdlib/subprojects/mylibc/stubstart.s
deleted file mode 100644 (file)
index 0a6d972..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-.globl _start
-
-_start:
-
-    call main
-    movl %eax, %ebx
-    movl $1, %eax
-    int $0x80
diff --git a/meson/meson.py b/meson/meson.py
deleted file mode 100755 (executable)
index dab08d3..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-from pathlib import Path
-
-# If we're run uninstalled, add the script directory to sys.path to ensure that
-# we always import the correct mesonbuild modules even if PYTHONPATH is mangled
-meson_exe = Path(sys.argv[0]).resolve()
-if (meson_exe.parent / 'mesonbuild').is_dir():
-    sys.path.insert(0, str(meson_exe.parent))
-
-from mesonbuild import mesonmain
-
-if __name__ == '__main__':
-    sys.exit(mesonmain.main())
diff --git a/meson/mesonbuild/__init__.py b/meson/mesonbuild/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/meson/mesonbuild/arglist.py b/meson/mesonbuild/arglist.py
deleted file mode 100644 (file)
index fd4de96..0000000
+++ /dev/null
@@ -1,331 +0,0 @@
-# Copyright 2012-2020 The Meson development team
-# Copyright © 2020 Intel Corporation
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from functools import lru_cache
-import collections
-import enum
-import os
-import re
-import typing as T
-
-from . import mesonlib
-
-if T.TYPE_CHECKING:
-    from .linkers import StaticLinker
-    from .compilers import Compiler
-
-UNIXY_COMPILER_INTERNAL_LIBS = ['m', 'c', 'pthread', 'dl', 'rt']  # type: T.List[str]
-# execinfo is a compiler lib on FreeBSD and NetBSD
-if mesonlib.is_freebsd() or mesonlib.is_netbsd():
-    UNIXY_COMPILER_INTERNAL_LIBS.append('execinfo')
-
-
-class Dedup(enum.Enum):
-
-    """What kind of deduplication can be done to compiler args.
-
-    OVERRIDEN - Whether an argument can be 'overridden' by a later argument.
-        For example, -DFOO defines FOO and -UFOO undefines FOO. In this case,
-        we can safely remove the previous occurrence and add a new one. The
-        same is true for include paths and library paths with -I and -L.
-    UNIQUE - Arguments that once specified cannot be undone, such as `-c` or
-        `-pipe`. New instances of these can be completely skipped.
-    NO_DEDUP - Whether it matters where or how many times on the command-line
-        a particular argument is present. This can matter for symbol
-        resolution in static or shared libraries, so we cannot de-dup or
-        reorder them.
-    """
-
-    NO_DEDUP = 0
-    UNIQUE = 1
-    OVERRIDEN = 2
-
-
-class CompilerArgs(collections.abc.MutableSequence):
-    '''
-    List-like class that manages a list of compiler arguments. Should be used
-    while constructing compiler arguments from various sources. Can be
-    operated with ordinary lists, so this does not need to be used
-    everywhere.
-
-    All arguments must be inserted and stored in GCC-style (-lfoo, -Idir, etc)
-    and can converted to the native type of each compiler by using the
-    .to_native() method to which you must pass an instance of the compiler or
-    the compiler class.
-
-    New arguments added to this class (either with .append(), .extend(), or +=)
-    are added in a way that ensures that they override previous arguments.
-    For example:
-
-    >>> a = ['-Lfoo', '-lbar']
-    >>> a += ['-Lpho', '-lbaz']
-    >>> print(a)
-    ['-Lpho', '-Lfoo', '-lbar', '-lbaz']
-
-    Arguments will also be de-duped if they can be de-duped safely.
-
-    Note that because of all this, this class is not commutative and does not
-    preserve the order of arguments if it is safe to not. For example:
-    >>> ['-Ifoo', '-Ibar'] + ['-Ifez', '-Ibaz', '-Werror']
-    ['-Ifez', '-Ibaz', '-Ifoo', '-Ibar', '-Werror']
-    >>> ['-Ifez', '-Ibaz', '-Werror'] + ['-Ifoo', '-Ibar']
-    ['-Ifoo', '-Ibar', '-Ifez', '-Ibaz', '-Werror']
-
-    '''
-    # Arg prefixes that override by prepending instead of appending
-    prepend_prefixes = ()  # type: T.Tuple[str, ...]
-
-    # Arg prefixes and args that must be de-duped by returning 2
-    dedup2_prefixes = ()   # type: T.Tuple[str, ...]
-    dedup2_suffixes = ()   # type: T.Tuple[str, ...]
-    dedup2_args = ()       # type: T.Tuple[str, ...]
-
-    # Arg prefixes and args that must be de-duped by returning 1
-    #
-    # NOTE: not thorough. A list of potential corner cases can be found in
-    # https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038
-    dedup1_prefixes = ()  # type: T.Tuple[str, ...]
-    dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a')  # type: T.Tuple[str, ...]
-    # Match a .so of the form path/to/libfoo.so.0.1.0
-    # Only UNIX shared libraries require this. Others have a fixed extension.
-    dedup1_regex = re.compile(r'([\/\\]|\A)lib.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
-    dedup1_args = ()  # type: T.Tuple[str, ...]
-    # In generate_link() we add external libs without de-dup, but we must
-    # *always* de-dup these because they're special arguments to the linker
-    # TODO: these should probably move too
-    always_dedup_args = tuple('-l' + lib for lib in UNIXY_COMPILER_INTERNAL_LIBS)  # type : T.Tuple[str, ...]
-
-    def __init__(self, compiler: T.Union['Compiler', 'StaticLinker'],
-                 iterable: T.Optional[T.Iterable[str]] = None):
-        self.compiler = compiler
-        self._container = list(iterable) if iterable is not None else []  # type: T.List[str]
-        self.pre = collections.deque()    # type: T.Deque[str]
-        self.post = collections.deque()   # type: T.Deque[str]
-
-    # Flush the saved pre and post list into the _container list
-    #
-    # This correctly deduplicates the entries after _can_dedup definition
-    # Note: This function is designed to work without delete operations, as deletions are worsening the performance a lot.
-    def flush_pre_post(self) -> None:
-        pre_flush = collections.deque()   # type: T.Deque[str]
-        pre_flush_set = set()             # type: T.Set[str]
-        post_flush = collections.deque()  # type: T.Deque[str]
-        post_flush_set = set()            # type: T.Set[str]
-
-        #The two lists are here walked from the front to the back, in order to not need removals for deduplication
-        for a in self.pre:
-            dedup = self._can_dedup(a)
-            if a not in pre_flush_set:
-                pre_flush.append(a)
-                if dedup is Dedup.OVERRIDEN:
-                    pre_flush_set.add(a)
-        for a in reversed(self.post):
-            dedup = self._can_dedup(a)
-            if a not in post_flush_set:
-                post_flush.appendleft(a)
-                if dedup is Dedup.OVERRIDEN:
-                    post_flush_set.add(a)
-
-        #pre and post will overwrite every element that is in the container
-        #only copy over args that are in _container but not in the post flush or pre flush set
-
-        for a in self._container:
-            if a not in post_flush_set and a not in pre_flush_set:
-                pre_flush.append(a)
-
-        self._container = list(pre_flush) + list(post_flush)
-        self.pre.clear()
-        self.post.clear()
-
-    def __iter__(self) -> T.Iterator[str]:
-        self.flush_pre_post()
-        return iter(self._container)
-
-    @T.overload                                # noqa: F811
-    def __getitem__(self, index: int) -> str:  # noqa: F811
-        pass
-
-    @T.overload                                                     # noqa: F811
-    def __getitem__(self, index: slice) -> T.MutableSequence[str]:  # noqa: F811
-        pass
-
-    def __getitem__(self, index):  # noqa: F811
-        self.flush_pre_post()
-        return self._container[index]
-
-    @T.overload                                             # noqa: F811
-    def __setitem__(self, index: int, value: str) -> None:  # noqa: F811
-        pass
-
-    @T.overload                                                       # noqa: F811
-    def __setitem__(self, index: slice, value: T.Iterable[str]) -> None:  # noqa: F811
-        pass
-
-    def __setitem__(self, index, value) -> None:  # noqa: F811
-        self.flush_pre_post()
-        self._container[index] = value
-
-    def __delitem__(self, index: T.Union[int, slice]) -> None:
-        self.flush_pre_post()
-        del self._container[index]
-
-    def __len__(self) -> int:
-        return len(self._container) + len(self.pre) + len(self.post)
-
-    def insert(self, index: int, value: str) -> None:
-        self.flush_pre_post()
-        self._container.insert(index, value)
-
-    def copy(self) -> 'CompilerArgs':
-        self.flush_pre_post()
-        return type(self)(self.compiler, self._container.copy())
-
-    @classmethod
-    @lru_cache(maxsize=None)
-    def _can_dedup(cls, arg: str) -> Dedup:
-        """Returns whether the argument can be safely de-duped.
-
-        In addition to these, we handle library arguments specially.
-        With GNU ld, we surround library arguments with -Wl,--start/end-gr -> Dedupoup
-        to recursively search for symbols in the libraries. This is not needed
-        with other linkers.
-        """
-
-        # A standalone argument must never be deduplicated because it is
-        # defined by what comes _after_ it. Thus dedupping this:
-        # -D FOO -D BAR
-        # would yield either
-        # -D FOO BAR
-        # or
-        # FOO -D BAR
-        # both of which are invalid.
-        if arg in cls.dedup2_prefixes:
-            return Dedup.NO_DEDUP
-        if arg in cls.dedup2_args or \
-           arg.startswith(cls.dedup2_prefixes) or \
-           arg.endswith(cls.dedup2_suffixes):
-            return Dedup.OVERRIDEN
-        if arg in cls.dedup1_args or \
-           arg.startswith(cls.dedup1_prefixes) or \
-           arg.endswith(cls.dedup1_suffixes) or \
-           re.search(cls.dedup1_regex, arg):
-            return Dedup.UNIQUE
-        return Dedup.NO_DEDUP
-
-    @classmethod
-    @lru_cache(maxsize=None)
-    def _should_prepend(cls, arg: str) -> bool:
-        return arg.startswith(cls.prepend_prefixes)
-
-    def to_native(self, copy: bool = False) -> T.List[str]:
-        # Check if we need to add --start/end-group for circular dependencies
-        # between static libraries, and for recursively searching for symbols
-        # needed by static libraries that are provided by object files or
-        # shared libraries.
-        self.flush_pre_post()
-        if copy:
-            new = self.copy()
-        else:
-            new = self
-        return self.compiler.unix_args_to_native(new._container)
-
-    def append_direct(self, arg: str) -> None:
-        '''
-        Append the specified argument without any reordering or de-dup except
-        for absolute paths to libraries, etc, which can always be de-duped
-        safely.
-        '''
-        self.flush_pre_post()
-        if os.path.isabs(arg):
-            self.append(arg)
-        else:
-            self._container.append(arg)
-
-    def extend_direct(self, iterable: T.Iterable[str]) -> None:
-        '''
-        Extend using the elements in the specified iterable without any
-        reordering or de-dup except for absolute paths where the order of
-        include search directories is not relevant
-        '''
-        self.flush_pre_post()
-        for elem in iterable:
-            self.append_direct(elem)
-
-    def extend_preserving_lflags(self, iterable: T.Iterable[str]) -> None:
-        normal_flags = []
-        lflags = []
-        for i in iterable:
-            if i not in self.always_dedup_args and (i.startswith('-l') or i.startswith('-L')):
-                lflags.append(i)
-            else:
-                normal_flags.append(i)
-        self.extend(normal_flags)
-        self.extend_direct(lflags)
-
-    def __add__(self, args: T.Iterable[str]) -> 'CompilerArgs':
-        self.flush_pre_post()
-        new = self.copy()
-        new += args
-        return new
-
-    def __iadd__(self, args: T.Iterable[str]) -> 'CompilerArgs':
-        '''
-        Add two CompilerArgs while taking into account overriding of arguments
-        and while preserving the order of arguments as much as possible
-        '''
-        tmp_pre = collections.deque()  # type: T.Deque[str]
-        if not isinstance(args, collections.abc.Iterable):
-            raise TypeError('can only concatenate Iterable[str] (not "{}") to CompilerArgs'.format(args))
-        for arg in args:
-            # If the argument can be de-duped, do it either by removing the
-            # previous occurrence of it and adding a new one, or not adding the
-            # new occurrence.
-            dedup = self._can_dedup(arg)
-            if dedup is Dedup.UNIQUE:
-                # Argument already exists and adding a new instance is useless
-                if arg in self._container or arg in self.pre or arg in self.post:
-                    continue
-            if self._should_prepend(arg):
-                tmp_pre.appendleft(arg)
-            else:
-                self.post.append(arg)
-        self.pre.extendleft(tmp_pre)
-        #pre and post is going to be merged later before a iter call
-        return self
-
-    def __radd__(self, args: T.Iterable[str]) -> 'CompilerArgs':
-        self.flush_pre_post()
-        new = type(self)(self.compiler, args)
-        new += self
-        return new
-
-    def __eq__(self, other: T.Any) -> T.Union[bool]:
-        self.flush_pre_post()
-        # Only allow equality checks against other CompilerArgs and lists instances
-        if isinstance(other, CompilerArgs):
-            return self.compiler == other.compiler and self._container == other._container
-        elif isinstance(other, list):
-            return self._container == other
-        return NotImplemented
-
-    def append(self, arg: str) -> None:
-        self.__iadd__([arg])
-
-    def extend(self, args: T.Iterable[str]) -> None:
-        self.__iadd__(args)
-
-    def __repr__(self) -> str:
-        self.flush_pre_post()
-        return 'CompilerArgs({!r}, {!r})'.format(self.compiler, self._container)
diff --git a/meson/mesonbuild/ast/__init__.py b/meson/mesonbuild/ast/__init__.py
deleted file mode 100644 (file)
index 4fb56cb..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-__all__ = [
-    'AstConditionLevel',
-    'AstInterpreter',
-    'AstIDGenerator',
-    'AstIndentationGenerator',
-    'AstJSONPrinter',
-    'AstVisitor',
-    'AstPrinter',
-    'IntrospectionInterpreter',
-    'build_target_functions',
-]
-
-from .interpreter import AstInterpreter
-from .introspection import IntrospectionInterpreter, build_target_functions
-from .visitor import AstVisitor
-from .postprocess import AstConditionLevel, AstIDGenerator, AstIndentationGenerator
-from .printer import AstPrinter, AstJSONPrinter
diff --git a/meson/mesonbuild/ast/interpreter.py b/meson/mesonbuild/ast/interpreter.py
deleted file mode 100644 (file)
index fb77db0..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from .visitor import AstVisitor
-from .. import interpreterbase, mparser, mesonlib
-from .. import environment
-
-from ..interpreterbase import InvalidArguments, BreakRequest, ContinueRequest, TYPE_nvar, TYPE_nkwargs
-from ..mparser import (
-    AndNode,
-    ArgumentNode,
-    ArithmeticNode,
-    ArrayNode,
-    AssignmentNode,
-    BaseNode,
-    ComparisonNode,
-    ElementaryNode,
-    EmptyNode,
-    ForeachClauseNode,
-    IdNode,
-    IfClauseNode,
-    IndexNode,
-    MethodNode,
-    NotNode,
-    OrNode,
-    PlusAssignmentNode,
-    StringNode,
-    TernaryNode,
-    UMinusNode,
-)
-
-import os, sys
-import typing as T
-
-class DontCareObject(interpreterbase.InterpreterObject):
-    pass
-
-class MockExecutable(interpreterbase.InterpreterObject):
-    pass
-
-class MockStaticLibrary(interpreterbase.InterpreterObject):
-    pass
-
-class MockSharedLibrary(interpreterbase.InterpreterObject):
-    pass
-
-class MockCustomTarget(interpreterbase.InterpreterObject):
-    pass
-
-class MockRunTarget(interpreterbase.InterpreterObject):
-    pass
-
-ADD_SOURCE = 0
-REMOVE_SOURCE = 1
-
-class AstInterpreter(interpreterbase.InterpreterBase):
-    def __init__(self, source_root: str, subdir: str, subproject: str, visitors: T.Optional[T.List[AstVisitor]] = None):
-        super().__init__(source_root, subdir, subproject)
-        self.visitors = visitors if visitors is not None else []
-        self.visited_subdirs = {}     # type: T.Dict[str, bool]
-        self.assignments = {}         # type: T.Dict[str, BaseNode]
-        self.assign_vals = {}         # type: T.Dict[str, T.Any]
-        self.reverse_assignment = {}  # type: T.Dict[str, BaseNode]
-        self.funcs.update({'project': self.func_do_nothing,
-                           'test': self.func_do_nothing,
-                           'benchmark': self.func_do_nothing,
-                           'install_headers': self.func_do_nothing,
-                           'install_man': self.func_do_nothing,
-                           'install_data': self.func_do_nothing,
-                           'install_subdir': self.func_do_nothing,
-                           'configuration_data': self.func_do_nothing,
-                           'configure_file': self.func_do_nothing,
-                           'find_program': self.func_do_nothing,
-                           'include_directories': self.func_do_nothing,
-                           'add_global_arguments': self.func_do_nothing,
-                           'add_global_link_arguments': self.func_do_nothing,
-                           'add_project_arguments': self.func_do_nothing,
-                           'add_project_link_arguments': self.func_do_nothing,
-                           'message': self.func_do_nothing,
-                           'generator': self.func_do_nothing,
-                           'error': self.func_do_nothing,
-                           'run_command': self.func_do_nothing,
-                           'assert': self.func_do_nothing,
-                           'subproject': self.func_do_nothing,
-                           'dependency': self.func_do_nothing,
-                           'get_option': self.func_do_nothing,
-                           'join_paths': self.func_do_nothing,
-                           'environment': self.func_do_nothing,
-                           'import': self.func_do_nothing,
-                           'vcs_tag': self.func_do_nothing,
-                           'add_languages': self.func_do_nothing,
-                           'declare_dependency': self.func_do_nothing,
-                           'files': self.func_do_nothing,
-                           'executable': self.func_do_nothing,
-                           'static_library': self.func_do_nothing,
-                           'shared_library': self.func_do_nothing,
-                           'library': self.func_do_nothing,
-                           'build_target': self.func_do_nothing,
-                           'custom_target': self.func_do_nothing,
-                           'run_target': self.func_do_nothing,
-                           'subdir': self.func_subdir,
-                           'set_variable': self.func_do_nothing,
-                           'get_variable': self.func_do_nothing,
-                           'is_disabler': self.func_do_nothing,
-                           'is_variable': self.func_do_nothing,
-                           'disabler': self.func_do_nothing,
-                           'gettext': self.func_do_nothing,
-                           'jar': self.func_do_nothing,
-                           'warning': self.func_do_nothing,
-                           'shared_module': self.func_do_nothing,
-                           'option': self.func_do_nothing,
-                           'both_libraries': self.func_do_nothing,
-                           'add_test_setup': self.func_do_nothing,
-                           'find_library': self.func_do_nothing,
-                           'subdir_done': self.func_do_nothing,
-                           'alias_target': self.func_do_nothing,
-                           'summary': self.func_do_nothing,
-                           })
-
-    def func_do_nothing(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> bool:
-        return True
-
-    def load_root_meson_file(self) -> None:
-        super().load_root_meson_file()
-        for i in self.visitors:
-            self.ast.accept(i)
-
-    def func_subdir(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None:
-        args = self.flatten_args(args)
-        if len(args) != 1 or not isinstance(args[0], str):
-            sys.stderr.write('Unable to evaluate subdir({}) in AstInterpreter --> Skipping\n'.format(args))
-            return
-
-        prev_subdir = self.subdir
-        subdir = os.path.join(prev_subdir, args[0])
-        absdir = os.path.join(self.source_root, subdir)
-        buildfilename = os.path.join(subdir, environment.build_filename)
-        absname = os.path.join(self.source_root, buildfilename)
-        symlinkless_dir = os.path.realpath(absdir)
-        if symlinkless_dir in self.visited_subdirs:
-            sys.stderr.write('Trying to enter {} which has already been visited --> Skipping\n'.format(args[0]))
-            return
-        self.visited_subdirs[symlinkless_dir] = True
-
-        if not os.path.isfile(absname):
-            sys.stderr.write('Unable to find build file {} --> Skipping\n'.format(buildfilename))
-            return
-        with open(absname, encoding='utf8') as f:
-            code = f.read()
-        assert(isinstance(code, str))
-        try:
-            codeblock = mparser.Parser(code, absname).parse()
-        except mesonlib.MesonException as me:
-            me.file = absname
-            raise me
-
-        self.subdir = subdir
-        for i in self.visitors:
-            codeblock.accept(i)
-        self.evaluate_codeblock(codeblock)
-        self.subdir = prev_subdir
-
-    def method_call(self, node: BaseNode) -> bool:
-        return True
-
-    def evaluate_arithmeticstatement(self, cur: ArithmeticNode) -> int:
-        self.evaluate_statement(cur.left)
-        self.evaluate_statement(cur.right)
-        return 0
-
-    def evaluate_uminusstatement(self, cur: UMinusNode) -> int:
-        self.evaluate_statement(cur.value)
-        return 0
-
-    def evaluate_ternary(self, node: TernaryNode) -> None:
-        assert(isinstance(node, TernaryNode))
-        self.evaluate_statement(node.condition)
-        self.evaluate_statement(node.trueblock)
-        self.evaluate_statement(node.falseblock)
-
-    def evaluate_dictstatement(self, node: mparser.DictNode) -> TYPE_nkwargs:
-        (arguments, kwargs) = self.reduce_arguments(node.args, resolve_key_nodes=False)
-        assert (not arguments)
-        self.argument_depth += 1
-        for key, value in kwargs.items():
-            if isinstance(key, BaseNode):
-                self.evaluate_statement(key)
-        self.argument_depth -= 1
-        return {}
-
-    def evaluate_plusassign(self, node: PlusAssignmentNode) -> None:
-        assert(isinstance(node, PlusAssignmentNode))
-        # Cheat by doing a reassignment
-        self.assignments[node.var_name] = node.value  # Save a reference to the value node
-        if node.value.ast_id:
-            self.reverse_assignment[node.value.ast_id] = node
-        self.assign_vals[node.var_name] = self.evaluate_statement(node.value)
-
-    def evaluate_indexing(self, node: IndexNode) -> int:
-        return 0
-
-    def unknown_function_called(self, func_name: str) -> None:
-        pass
-
-    def reduce_arguments(self, args: ArgumentNode, resolve_key_nodes: bool = True) -> T.Tuple[T.List[TYPE_nvar], TYPE_nkwargs]:
-        if isinstance(args, ArgumentNode):
-            kwargs = {}  # type: T.Dict[T.Union[str, BaseNode], TYPE_nvar]
-            for key, val in args.kwargs.items():
-                if resolve_key_nodes and isinstance(key, (StringNode, IdNode)):
-                    assert isinstance(key.value, str)
-                    kwargs[key.value] = val
-                else:
-                    kwargs[key] = val
-            if args.incorrect_order():
-                raise InvalidArguments('All keyword arguments must be after positional arguments.')
-            return self.flatten_args(args.arguments), kwargs
-        else:
-            return self.flatten_args(args), {}
-
-    def evaluate_comparison(self, node: ComparisonNode) -> bool:
-        self.evaluate_statement(node.left)
-        self.evaluate_statement(node.right)
-        return False
-
-    def evaluate_andstatement(self, cur: AndNode) -> bool:
-        self.evaluate_statement(cur.left)
-        self.evaluate_statement(cur.right)
-        return False
-
-    def evaluate_orstatement(self, cur: OrNode) -> bool:
-        self.evaluate_statement(cur.left)
-        self.evaluate_statement(cur.right)
-        return False
-
-    def evaluate_notstatement(self, cur: NotNode) -> bool:
-        self.evaluate_statement(cur.value)
-        return False
-
-    def evaluate_foreach(self, node: ForeachClauseNode) -> None:
-        try:
-            self.evaluate_codeblock(node.block)
-        except ContinueRequest:
-            pass
-        except BreakRequest:
-            pass
-
-    def evaluate_if(self, node: IfClauseNode) -> None:
-        for i in node.ifs:
-            self.evaluate_codeblock(i.block)
-        if not isinstance(node.elseblock, EmptyNode):
-            self.evaluate_codeblock(node.elseblock)
-
-    def get_variable(self, varname: str) -> int:
-        return 0
-
-    def assignment(self, node: AssignmentNode) -> None:
-        assert(isinstance(node, AssignmentNode))
-        self.assignments[node.var_name] = node.value # Save a reference to the value node
-        if node.value.ast_id:
-            self.reverse_assignment[node.value.ast_id] = node
-        self.assign_vals[node.var_name] = self.evaluate_statement(node.value) # Evaluate the value just in case
-
-    def resolve_node(self, node: BaseNode, include_unknown_args: bool = False, id_loop_detect: T.Optional[T.List[str]] = None) -> T.Optional[T.Any]:
-        def quick_resolve(n: BaseNode, loop_detect: T.Optional[T.List[str]] = None) -> T.Any:
-            if loop_detect is None:
-                loop_detect = []
-            if isinstance(n, IdNode):
-                assert isinstance(n.value, str)
-                if n.value in loop_detect or n.value not in self.assignments:
-                    return []
-                return quick_resolve(self.assignments[n.value], loop_detect = loop_detect + [n.value])
-            elif isinstance(n, ElementaryNode):
-                return n.value
-            else:
-                return n
-
-        if id_loop_detect is None:
-            id_loop_detect = []
-        result = None
-
-        if not isinstance(node, BaseNode):
-            return None
-
-        assert node.ast_id
-        if node.ast_id in id_loop_detect:
-            return None # Loop detected
-        id_loop_detect += [node.ast_id]
-
-        # Try to evealuate the value of the node
-        if isinstance(node, IdNode):
-            result = quick_resolve(node)
-
-        elif isinstance(node, ElementaryNode):
-            result = node.value
-
-        elif isinstance(node, NotNode):
-            result = self.resolve_node(node.value, include_unknown_args, id_loop_detect)
-            if isinstance(result, bool):
-                result = not result
-
-        elif isinstance(node, ArrayNode):
-            result = [x for x in node.args.arguments]
-
-        elif isinstance(node, ArgumentNode):
-            result = [x for x in node.arguments]
-
-        elif isinstance(node, ArithmeticNode):
-            if node.operation != 'add':
-                return None # Only handle string and array concats
-            l = quick_resolve(node.left)
-            r = quick_resolve(node.right)
-            if isinstance(l, str) and isinstance(r, str):
-                result = l + r # String concatenation detected
-            else:
-                result = self.flatten_args(l, include_unknown_args, id_loop_detect) + self.flatten_args(r, include_unknown_args, id_loop_detect)
-
-        elif isinstance(node, MethodNode):
-            src = quick_resolve(node.source_object)
-            margs = self.flatten_args(node.args.arguments, include_unknown_args, id_loop_detect)
-            mkwargs = {} # type: T.Dict[str, TYPE_nvar]
-            try:
-                if isinstance(src, str):
-                    result = self.string_method_call(src, node.name, margs, mkwargs)
-                elif isinstance(src, bool):
-                    result = self.bool_method_call(src, node.name, margs, mkwargs)
-                elif isinstance(src, int):
-                    result = self.int_method_call(src, node.name, margs, mkwargs)
-                elif isinstance(src, list):
-                    result = self.array_method_call(src, node.name, margs, mkwargs)
-                elif isinstance(src, dict):
-                    result = self.dict_method_call(src, node.name, margs, mkwargs)
-            except mesonlib.MesonException:
-                return None
-
-        # Ensure that the result is fully resolved (no more nodes)
-        if isinstance(result, BaseNode):
-            result = self.resolve_node(result, include_unknown_args, id_loop_detect)
-        elif isinstance(result, list):
-            new_res = []  # type: T.List[TYPE_nvar]
-            for i in result:
-                if isinstance(i, BaseNode):
-                    resolved = self.resolve_node(i, include_unknown_args, id_loop_detect)
-                    if resolved is not None:
-                        new_res += self.flatten_args(resolved, include_unknown_args, id_loop_detect)
-                else:
-                    new_res += [i]
-            result = new_res
-
-        return result
-
-    def flatten_args(self, args_raw: T.Union[TYPE_nvar, T.Sequence[TYPE_nvar]], include_unknown_args: bool = False, id_loop_detect: T.Optional[T.List[str]] = None) -> T.List[TYPE_nvar]:
-        # Make sure we are always dealing with lists
-        if isinstance(args_raw, list):
-            args = args_raw
-        else:
-            args = [args_raw]
-
-        flattend_args = []  # type: T.List[TYPE_nvar]
-
-        # Resolve the contents of args
-        for i in args:
-            if isinstance(i, BaseNode):
-                resolved = self.resolve_node(i, include_unknown_args, id_loop_detect)
-                if resolved is not None:
-                    if not isinstance(resolved, list):
-                        resolved = [resolved]
-                    flattend_args += resolved
-            elif isinstance(i, (str, bool, int, float)) or include_unknown_args:
-                flattend_args += [i]
-        return flattend_args
-
-    def flatten_kwargs(self, kwargs: T.Dict[str, TYPE_nvar], include_unknown_args: bool = False) -> T.Dict[str, TYPE_nvar]:
-        flattend_kwargs = {}
-        for key, val in kwargs.items():
-            if isinstance(val, BaseNode):
-                resolved = self.resolve_node(val, include_unknown_args)
-                if resolved is not None:
-                    flattend_kwargs[key] = resolved
-            elif isinstance(val, (str, bool, int, float)) or include_unknown_args:
-                flattend_kwargs[key] = val
-        return flattend_kwargs
diff --git a/meson/mesonbuild/ast/introspection.py b/meson/mesonbuild/ast/introspection.py
deleted file mode 100644 (file)
index 142c219..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool
-
-from .interpreter import AstInterpreter
-from .visitor import AstVisitor
-from .. import compilers, environment, mesonlib, optinterpreter
-from .. import coredata as cdata
-from ..mesonlib import MachineChoice
-from ..interpreterbase import InvalidArguments, TYPE_nvar
-from ..build import Executable, Jar, SharedLibrary, SharedModule, StaticLibrary
-from ..mparser import BaseNode, ArithmeticNode, ArrayNode, ElementaryNode, IdNode, FunctionNode, StringNode
-import typing as T
-import os
-
-build_target_functions = ['executable', 'jar', 'library', 'shared_library', 'shared_module', 'static_library', 'both_libraries']
-
-class IntrospectionHelper:
-    # mimic an argparse namespace
-    def __init__(self, cross_file: str):
-        self.cross_file = cross_file  # type: str
-        self.native_file = None       # type: str
-        self.cmd_line_options = {}    # type: T.Dict[str, str]
-
-class IntrospectionInterpreter(AstInterpreter):
-    # Interpreter to detect the options without a build directory
-    # Most of the code is stolen from interpreter.Interpreter
-    def __init__(self,
-                 source_root: str,
-                 subdir: str,
-                 backend: str,
-                 visitors: T.Optional[T.List[AstVisitor]] = None,
-                 cross_file: T.Optional[str] = None,
-                 subproject: str = '',
-                 subproject_dir: str = 'subprojects',
-                 env: T.Optional[environment.Environment] = None):
-        visitors = visitors if visitors is not None else []
-        super().__init__(source_root, subdir, subproject, visitors=visitors)
-
-        options = IntrospectionHelper(cross_file)
-        self.cross_file = cross_file
-        if env is None:
-            self.environment = environment.Environment(source_root, None, options)
-        else:
-            self.environment = env
-        self.subproject_dir = subproject_dir
-        self.coredata = self.environment.get_coredata()
-        self.option_file = os.path.join(self.source_root, self.subdir, 'meson_options.txt')
-        self.backend = backend
-        self.default_options = {'backend': self.backend}
-        self.project_data = {}    # type: T.Dict[str, T.Any]
-        self.targets = []         # type: T.List[T.Dict[str, T.Any]]
-        self.dependencies = []    # type: T.List[T.Dict[str, T.Any]]
-        self.project_node = None  # type: BaseNode
-
-        self.funcs.update({
-            'add_languages': self.func_add_languages,
-            'dependency': self.func_dependency,
-            'executable': self.func_executable,
-            'jar': self.func_jar,
-            'library': self.func_library,
-            'project': self.func_project,
-            'shared_library': self.func_shared_lib,
-            'shared_module': self.func_shared_module,
-            'static_library': self.func_static_lib,
-            'both_libraries': self.func_both_lib,
-        })
-
-    def func_project(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None:
-        if self.project_node:
-            raise InvalidArguments('Second call to project()')
-        self.project_node = node
-        if len(args) < 1:
-            raise InvalidArguments('Not enough arguments to project(). Needs at least the project name.')
-
-        proj_name = args[0]
-        proj_vers = kwargs.get('version', 'undefined')
-        proj_langs = self.flatten_args(args[1:])
-        if isinstance(proj_vers, ElementaryNode):
-            proj_vers = proj_vers.value
-        if not isinstance(proj_vers, str):
-            proj_vers = 'undefined'
-        self.project_data = {'descriptive_name': proj_name, 'version': proj_vers}
-
-        if os.path.exists(self.option_file):
-            oi = optinterpreter.OptionInterpreter(self.subproject)
-            oi.process(self.option_file)
-            self.coredata.merge_user_options(oi.options)
-
-        def_opts = self.flatten_args(kwargs.get('default_options', []))
-        _project_default_options = mesonlib.stringlistify(def_opts)
-        self.project_default_options = cdata.create_options_dict(_project_default_options)
-        self.default_options.update(self.project_default_options)
-        self.coredata.set_default_options(self.default_options, self.subproject, self.environment)
-
-        if not self.is_subproject() and 'subproject_dir' in kwargs:
-            spdirname = kwargs['subproject_dir']
-            if isinstance(spdirname, StringNode):
-                assert isinstance(spdirname.value, str)
-                self.subproject_dir = spdirname.value
-        if not self.is_subproject():
-            self.project_data['subprojects'] = []
-            subprojects_dir = os.path.join(self.source_root, self.subproject_dir)
-            if os.path.isdir(subprojects_dir):
-                for i in os.listdir(subprojects_dir):
-                    if os.path.isdir(os.path.join(subprojects_dir, i)):
-                        self.do_subproject(i)
-
-        self.coredata.init_backend_options(self.backend)
-        options = {k: v for k, v in self.environment.cmd_line_options.items() if k.startswith('backend_')}
-
-        self.coredata.set_options(options)
-        self.func_add_languages(None, proj_langs, None)
-
-    def do_subproject(self, dirname: str) -> None:
-        subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir)
-        subpr = os.path.join(subproject_dir_abs, dirname)
-        try:
-            subi = IntrospectionInterpreter(subpr, '', self.backend, cross_file=self.cross_file, subproject=dirname, subproject_dir=self.subproject_dir, env=self.environment, visitors=self.visitors)
-            subi.analyze()
-            subi.project_data['name'] = dirname
-            self.project_data['subprojects'] += [subi.project_data]
-        except (mesonlib.MesonException, RuntimeError):
-            return
-
-    def func_add_languages(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None:
-        args = self.flatten_args(args)
-        for for_machine in [MachineChoice.BUILD, MachineChoice.HOST]:
-            for lang in sorted(args, key=compilers.sort_clink):
-                if isinstance(lang, StringNode):
-                    assert isinstance(lang.value, str)
-                    lang = lang.value
-                if not isinstance(lang, str):
-                    continue
-                lang = lang.lower()
-                if lang not in self.coredata.compilers[for_machine]:
-                    self.environment.detect_compiler_for(lang, for_machine)
-
-    def func_dependency(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None:
-        args = self.flatten_args(args)
-        kwargs = self.flatten_kwargs(kwargs)
-        if not args:
-            return
-        name = args[0]
-        has_fallback = 'fallback' in kwargs
-        required = kwargs.get('required', True)
-        version = kwargs.get('version', [])
-        if not isinstance(version, list):
-            version = [version]
-        if isinstance(required, ElementaryNode):
-            required = required.value
-        if not isinstance(required, bool):
-            required = False
-        self.dependencies += [{
-            'name': name,
-            'required': required,
-            'version': version,
-            'has_fallback': has_fallback,
-            'conditional': node.condition_level > 0,
-            'node': node
-        }]
-
-    def build_target(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs_raw: T.Dict[str, TYPE_nvar], targetclass) -> T.Optional[T.Dict[str, T.Any]]:
-        args = self.flatten_args(args)
-        if not args or not isinstance(args[0], str):
-            return None
-        name = args[0]
-        srcqueue = [node]
-
-        # Process the sources BEFORE flattening the kwargs, to preserve the original nodes
-        if 'sources' in kwargs_raw:
-            srcqueue += mesonlib.listify(kwargs_raw['sources'])
-
-        kwargs = self.flatten_kwargs(kwargs_raw, True)
-
-        source_nodes = []  # type: T.List[BaseNode]
-        while srcqueue:
-            curr = srcqueue.pop(0)
-            arg_node = None
-            assert(isinstance(curr, BaseNode))
-            if isinstance(curr, FunctionNode):
-                arg_node = curr.args
-            elif isinstance(curr, ArrayNode):
-                arg_node = curr.args
-            elif isinstance(curr, IdNode):
-                # Try to resolve the ID and append the node to the queue
-                assert isinstance(curr.value, str)
-                var_name = curr.value
-                if var_name in self.assignments:
-                    tmp_node = self.assignments[var_name]
-                    if isinstance(tmp_node, (ArrayNode, IdNode, FunctionNode)):
-                        srcqueue += [tmp_node]
-            elif isinstance(curr, ArithmeticNode):
-                srcqueue += [curr.left, curr.right]
-            if arg_node is None:
-                continue
-            arg_nodes = arg_node.arguments.copy()
-            # Pop the first element if the function is a build target function
-            if isinstance(curr, FunctionNode) and curr.func_name in build_target_functions:
-                arg_nodes.pop(0)
-            elemetary_nodes = [x for x in arg_nodes if isinstance(x, (str, StringNode))]
-            srcqueue += [x for x in arg_nodes if isinstance(x, (FunctionNode, ArrayNode, IdNode, ArithmeticNode))]
-            if elemetary_nodes:
-                source_nodes += [curr]
-
-        # Make sure nothing can crash when creating the build class
-        kwargs_reduced = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs and k in ['install', 'build_by_default', 'build_always']}
-        kwargs_reduced = {k: v.value if isinstance(v, ElementaryNode) else v for k, v in kwargs_reduced.items()}
-        kwargs_reduced = {k: v for k, v in kwargs_reduced.items() if not isinstance(v, BaseNode)}
-        for_machine = MachineChoice.HOST
-        objects = []        # type: T.List[T.Any]
-        empty_sources = []  # type: T.List[T.Any]
-        # Passing the unresolved sources list causes errors
-        target = targetclass(name, self.subdir, self.subproject, for_machine, empty_sources, objects, self.environment, kwargs_reduced)
-
-        new_target = {
-            'name': target.get_basename(),
-            'id': target.get_id(),
-            'type': target.get_typename(),
-            'defined_in': os.path.normpath(os.path.join(self.source_root, self.subdir, environment.build_filename)),
-            'subdir': self.subdir,
-            'build_by_default': target.build_by_default,
-            'installed': target.should_install(),
-            'outputs': target.get_outputs(),
-            'sources': source_nodes,
-            'kwargs': kwargs,
-            'node': node,
-        }
-
-        self.targets += [new_target]
-        return new_target
-
-    def build_library(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        default_library = self.coredata.get_builtin_option('default_library')
-        if default_library == 'shared':
-            return self.build_target(node, args, kwargs, SharedLibrary)
-        elif default_library == 'static':
-            return self.build_target(node, args, kwargs, StaticLibrary)
-        elif default_library == 'both':
-            return self.build_target(node, args, kwargs, SharedLibrary)
-        return None
-
-    def func_executable(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, Executable)
-
-    def func_static_lib(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, StaticLibrary)
-
-    def func_shared_lib(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, SharedLibrary)
-
-    def func_both_lib(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, SharedLibrary)
-
-    def func_shared_module(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, SharedModule)
-
-    def func_library(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_library(node, args, kwargs)
-
-    def func_jar(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        return self.build_target(node, args, kwargs, Jar)
-
-    def func_build_target(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> T.Optional[T.Dict[str, T.Any]]:
-        if 'target_type' not in kwargs:
-            return None
-        target_type = kwargs.pop('target_type')
-        if isinstance(target_type, ElementaryNode):
-            target_type = target_type.value
-        if target_type == 'executable':
-            return self.build_target(node, args, kwargs, Executable)
-        elif target_type == 'shared_library':
-            return self.build_target(node, args, kwargs, SharedLibrary)
-        elif target_type == 'static_library':
-            return self.build_target(node, args, kwargs, StaticLibrary)
-        elif target_type == 'both_libraries':
-            return self.build_target(node, args, kwargs, SharedLibrary)
-        elif target_type == 'library':
-            return self.build_library(node, args, kwargs)
-        elif target_type == 'jar':
-            return self.build_target(node, args, kwargs, Jar)
-        return None
-
-    def is_subproject(self) -> bool:
-        return self.subproject != ''
-
-    def analyze(self) -> None:
-        self.load_root_meson_file()
-        self.sanity_check_ast()
-        self.parse_project()
-        self.run()
diff --git a/meson/mesonbuild/ast/postprocess.py b/meson/mesonbuild/ast/postprocess.py
deleted file mode 100644 (file)
index 35fe1d3..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool
-
-from . import AstVisitor
-from .. import mparser
-import typing as T
-
-class AstIndentationGenerator(AstVisitor):
-    def __init__(self):
-        self.level = 0
-
-    def visit_default_func(self, node: mparser.BaseNode) -> None:
-        # Store the current level in the node
-        node.level = self.level
-
-    def visit_ArrayNode(self, node: mparser.ArrayNode) -> None:
-        self.visit_default_func(node)
-        self.level += 1
-        node.args.accept(self)
-        self.level -= 1
-
-    def visit_DictNode(self, node: mparser.DictNode) -> None:
-        self.visit_default_func(node)
-        self.level += 1
-        node.args.accept(self)
-        self.level -= 1
-
-    def visit_MethodNode(self, node: mparser.MethodNode) -> None:
-        self.visit_default_func(node)
-        node.source_object.accept(self)
-        self.level += 1
-        node.args.accept(self)
-        self.level -= 1
-
-    def visit_FunctionNode(self, node: mparser.FunctionNode) -> None:
-        self.visit_default_func(node)
-        self.level += 1
-        node.args.accept(self)
-        self.level -= 1
-
-    def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode) -> None:
-        self.visit_default_func(node)
-        self.level += 1
-        node.items.accept(self)
-        node.block.accept(self)
-        self.level -= 1
-
-    def visit_IfClauseNode(self, node: mparser.IfClauseNode) -> None:
-        self.visit_default_func(node)
-        for i in node.ifs:
-            i.accept(self)
-        if node.elseblock:
-            self.level += 1
-            node.elseblock.accept(self)
-            self.level -= 1
-
-    def visit_IfNode(self, node: mparser.IfNode) -> None:
-        self.visit_default_func(node)
-        self.level += 1
-        node.condition.accept(self)
-        node.block.accept(self)
-        self.level -= 1
-
-class AstIDGenerator(AstVisitor):
-    def __init__(self):
-        self.counter = {}  # type: T.Dict[str, int]
-
-    def visit_default_func(self, node: mparser.BaseNode) -> None:
-        name = type(node).__name__
-        if name not in self.counter:
-            self.counter[name] = 0
-        node.ast_id = name + '#' + str(self.counter[name])
-        self.counter[name] += 1
-
-class AstConditionLevel(AstVisitor):
-    def __init__(self):
-        self.condition_level = 0
-
-    def visit_default_func(self, node: mparser.BaseNode) -> None:
-        node.condition_level = self.condition_level
-
-    def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode) -> None:
-        self.visit_default_func(node)
-        self.condition_level += 1
-        node.items.accept(self)
-        node.block.accept(self)
-        self.condition_level -= 1
-
-    def visit_IfClauseNode(self, node: mparser.IfClauseNode) -> None:
-        self.visit_default_func(node)
-        for i in node.ifs:
-            i.accept(self)
-        if node.elseblock:
-            self.condition_level += 1
-            node.elseblock.accept(self)
-            self.condition_level -= 1
-
-    def visit_IfNode(self, node: mparser.IfNode) -> None:
-        self.visit_default_func(node)
-        self.condition_level += 1
-        node.condition.accept(self)
-        node.block.accept(self)
-        self.condition_level -= 1
diff --git a/meson/mesonbuild/ast/printer.py b/meson/mesonbuild/ast/printer.py
deleted file mode 100644 (file)
index a57ba20..0000000
+++ /dev/null
@@ -1,359 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool
-
-from .. import mparser
-from . import AstVisitor
-import re
-import typing as T
-
-arithmic_map = {
-    'add': '+',
-    'sub': '-',
-    'mod': '%',
-    'mul': '*',
-    'div': '/'
-}
-
-class AstPrinter(AstVisitor):
-    def __init__(self, indent: int = 2, arg_newline_cutoff: int = 5):
-        self.result = ''
-        self.indent = indent
-        self.arg_newline_cutoff = arg_newline_cutoff
-        self.ci = ''
-        self.is_newline = True
-        self.last_level = 0
-
-    def post_process(self) -> None:
-        self.result = re.sub(r'\s+\n', '\n', self.result)
-
-    def append(self, data: str, node: mparser.BaseNode) -> None:
-        self.last_level = node.level
-        if self.is_newline:
-            self.result += ' ' * (node.level * self.indent)
-        self.result += data
-        self.is_newline = False
-
-    def append_padded(self, data: str, node: mparser.BaseNode) -> None:
-        if self.result[-1] not in [' ', '\n']:
-            data = ' ' + data
-        self.append(data + ' ', node)
-
-    def newline(self) -> None:
-        self.result += '\n'
-        self.is_newline = True
-
-    def visit_BooleanNode(self, node: mparser.BooleanNode) -> None:
-        self.append('true' if node.value else 'false', node)
-
-    def visit_IdNode(self, node: mparser.IdNode) -> None:
-        assert isinstance(node.value, str)
-        self.append(node.value, node)
-
-    def visit_NumberNode(self, node: mparser.NumberNode) -> None:
-        self.append(str(node.value), node)
-
-    def visit_StringNode(self, node: mparser.StringNode) -> None:
-        assert isinstance(node.value, str)
-        self.append("'" + node.value + "'", node)
-
-    def visit_ContinueNode(self, node: mparser.ContinueNode) -> None:
-        self.append('continue', node)
-
-    def visit_BreakNode(self, node: mparser.BreakNode) -> None:
-        self.append('break', node)
-
-    def visit_ArrayNode(self, node: mparser.ArrayNode) -> None:
-        self.append('[', node)
-        node.args.accept(self)
-        self.append(']', node)
-
-    def visit_DictNode(self, node: mparser.DictNode) -> None:
-        self.append('{', node)
-        node.args.accept(self)
-        self.append('}', node)
-
-    def visit_OrNode(self, node: mparser.OrNode) -> None:
-        node.left.accept(self)
-        self.append_padded('or', node)
-        node.right.accept(self)
-
-    def visit_AndNode(self, node: mparser.AndNode) -> None:
-        node.left.accept(self)
-        self.append_padded('and', node)
-        node.right.accept(self)
-
-    def visit_ComparisonNode(self, node: mparser.ComparisonNode) -> None:
-        node.left.accept(self)
-        self.append_padded(node.ctype, node)
-        node.right.accept(self)
-
-    def visit_ArithmeticNode(self, node: mparser.ArithmeticNode) -> None:
-        node.left.accept(self)
-        self.append_padded(arithmic_map[node.operation], node)
-        node.right.accept(self)
-
-    def visit_NotNode(self, node: mparser.NotNode) -> None:
-        self.append_padded('not', node)
-        node.value.accept(self)
-
-    def visit_CodeBlockNode(self, node: mparser.CodeBlockNode) -> None:
-        for i in node.lines:
-            i.accept(self)
-            self.newline()
-
-    def visit_IndexNode(self, node: mparser.IndexNode) -> None:
-        node.iobject.accept(self)
-        self.append('[', node)
-        node.index.accept(self)
-        self.append(']', node)
-
-    def visit_MethodNode(self, node: mparser.MethodNode) -> None:
-        node.source_object.accept(self)
-        self.append('.' + node.name + '(', node)
-        node.args.accept(self)
-        self.append(')', node)
-
-    def visit_FunctionNode(self, node: mparser.FunctionNode) -> None:
-        self.append(node.func_name + '(', node)
-        node.args.accept(self)
-        self.append(')', node)
-
-    def visit_AssignmentNode(self, node: mparser.AssignmentNode) -> None:
-        self.append(node.var_name + ' = ', node)
-        node.value.accept(self)
-
-    def visit_PlusAssignmentNode(self, node: mparser.PlusAssignmentNode) -> None:
-        self.append(node.var_name + ' += ', node)
-        node.value.accept(self)
-
-    def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode) -> None:
-        varnames = [x for x in node.varnames]
-        self.append_padded('foreach', node)
-        self.append_padded(', '.join(varnames), node)
-        self.append_padded(':', node)
-        node.items.accept(self)
-        self.newline()
-        node.block.accept(self)
-        self.append('endforeach', node)
-
-    def visit_IfClauseNode(self, node: mparser.IfClauseNode) -> None:
-        prefix = ''
-        for i in node.ifs:
-            self.append_padded(prefix + 'if', node)
-            prefix = 'el'
-            i.accept(self)
-        if not isinstance(node.elseblock, mparser.EmptyNode):
-            self.append('else', node)
-            node.elseblock.accept(self)
-        self.append('endif', node)
-
-    def visit_UMinusNode(self, node: mparser.UMinusNode) -> None:
-        self.append_padded('-', node)
-        node.value.accept(self)
-
-    def visit_IfNode(self, node: mparser.IfNode) -> None:
-        node.condition.accept(self)
-        self.newline()
-        node.block.accept(self)
-
-    def visit_TernaryNode(self, node: mparser.TernaryNode) -> None:
-        node.condition.accept(self)
-        self.append_padded('?', node)
-        node.trueblock.accept(self)
-        self.append_padded(':', node)
-        node.falseblock.accept(self)
-
-    def visit_ArgumentNode(self, node: mparser.ArgumentNode) -> None:
-        break_args = (len(node.arguments) + len(node.kwargs)) > self.arg_newline_cutoff
-        for i in node.arguments + list(node.kwargs.values()):
-            if not isinstance(i, (mparser.ElementaryNode, mparser.IndexNode)):
-                break_args = True
-        if break_args:
-            self.newline()
-        for i in node.arguments:
-            i.accept(self)
-            self.append(', ', node)
-            if break_args:
-                self.newline()
-        for key, val in node.kwargs.items():
-            key.accept(self)
-            self.append_padded(':', node)
-            val.accept(self)
-            self.append(', ', node)
-            if break_args:
-                self.newline()
-        if break_args:
-            self.result = re.sub(r', \n$', '\n', self.result)
-        else:
-            self.result = re.sub(r', $', '', self.result)
-
-class AstJSONPrinter(AstVisitor):
-    def __init__(self) -> None:
-        self.result = {}  # type: T.Dict[str, T.Any]
-        self.current = self.result
-
-    def _accept(self, key: str, node: mparser.BaseNode) -> None:
-        old = self.current
-        data = {}  # type: T.Dict[str, T.Any]
-        self.current = data
-        node.accept(self)
-        self.current = old
-        self.current[key] = data
-
-    def _accept_list(self, key: str, nodes: T.Sequence[mparser.BaseNode]) -> None:
-        old = self.current
-        datalist = []  # type: T.List[T.Dict[str, T.Any]]
-        for i in nodes:
-            self.current = {}
-            i.accept(self)
-            datalist += [self.current]
-        self.current = old
-        self.current[key] = datalist
-
-    def _raw_accept(self, node: mparser.BaseNode, data: T.Dict[str, T.Any]) -> None:
-        old = self.current
-        self.current = data
-        node.accept(self)
-        self.current = old
-
-    def setbase(self, node: mparser.BaseNode) -> None:
-        self.current['node'] = type(node).__name__
-        self.current['lineno'] = node.lineno
-        self.current['colno'] = node.colno
-        self.current['end_lineno'] = node.end_lineno
-        self.current['end_colno'] = node.end_colno
-
-    def visit_default_func(self, node: mparser.BaseNode) -> None:
-        self.setbase(node)
-
-    def gen_ElementaryNode(self, node: mparser.ElementaryNode) -> None:
-        self.current['value'] = node.value
-        self.setbase(node)
-
-    def visit_BooleanNode(self, node: mparser.BooleanNode) -> None:
-        self.gen_ElementaryNode(node)
-
-    def visit_IdNode(self, node: mparser.IdNode) -> None:
-        self.gen_ElementaryNode(node)
-
-    def visit_NumberNode(self, node: mparser.NumberNode) -> None:
-        self.gen_ElementaryNode(node)
-
-    def visit_StringNode(self, node: mparser.StringNode) -> None:
-        self.gen_ElementaryNode(node)
-
-    def visit_ArrayNode(self, node: mparser.ArrayNode) -> None:
-        self._accept('args', node.args)
-        self.setbase(node)
-
-    def visit_DictNode(self, node: mparser.DictNode) -> None:
-        self._accept('args', node.args)
-        self.setbase(node)
-
-    def visit_OrNode(self, node: mparser.OrNode) -> None:
-        self._accept('left', node.left)
-        self._accept('right', node.right)
-        self.setbase(node)
-
-    def visit_AndNode(self, node: mparser.AndNode) -> None:
-        self._accept('left', node.left)
-        self._accept('right', node.right)
-        self.setbase(node)
-
-    def visit_ComparisonNode(self, node: mparser.ComparisonNode) -> None:
-        self._accept('left', node.left)
-        self._accept('right', node.right)
-        self.current['ctype'] = node.ctype
-        self.setbase(node)
-
-    def visit_ArithmeticNode(self, node: mparser.ArithmeticNode) -> None:
-        self._accept('left', node.left)
-        self._accept('right', node.right)
-        self.current['op'] = arithmic_map[node.operation]
-        self.setbase(node)
-
-    def visit_NotNode(self, node: mparser.NotNode) -> None:
-        self._accept('right', node.value)
-        self.setbase(node)
-
-    def visit_CodeBlockNode(self, node: mparser.CodeBlockNode) -> None:
-        self._accept_list('lines', node.lines)
-        self.setbase(node)
-
-    def visit_IndexNode(self, node: mparser.IndexNode) -> None:
-        self._accept('object', node.iobject)
-        self._accept('index', node.index)
-        self.setbase(node)
-
-    def visit_MethodNode(self, node: mparser.MethodNode) -> None:
-        self._accept('object', node.source_object)
-        self._accept('args', node.args)
-        self.current['name'] = node.name
-        self.setbase(node)
-
-    def visit_FunctionNode(self, node: mparser.FunctionNode) -> None:
-        self._accept('args', node.args)
-        self.current['name'] = node.func_name
-        self.setbase(node)
-
-    def visit_AssignmentNode(self, node: mparser.AssignmentNode) -> None:
-        self._accept('value', node.value)
-        self.current['var_name'] = node.var_name
-        self.setbase(node)
-
-    def visit_PlusAssignmentNode(self, node: mparser.PlusAssignmentNode) -> None:
-        self._accept('value', node.value)
-        self.current['var_name'] = node.var_name
-        self.setbase(node)
-
-    def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode) -> None:
-        self._accept('items', node.items)
-        self._accept('block', node.block)
-        self.current['varnames'] = node.varnames
-        self.setbase(node)
-
-    def visit_IfClauseNode(self, node: mparser.IfClauseNode) -> None:
-        self._accept_list('ifs', node.ifs)
-        self._accept('else', node.elseblock)
-        self.setbase(node)
-
-    def visit_UMinusNode(self, node: mparser.UMinusNode) -> None:
-        self._accept('right', node.value)
-        self.setbase(node)
-
-    def visit_IfNode(self, node: mparser.IfNode) -> None:
-        self._accept('condition', node.condition)
-        self._accept('block', node.block)
-        self.setbase(node)
-
-    def visit_TernaryNode(self, node: mparser.TernaryNode) -> None:
-        self._accept('condition', node.condition)
-        self._accept('true', node.trueblock)
-        self._accept('false', node.falseblock)
-        self.setbase(node)
-
-    def visit_ArgumentNode(self, node: mparser.ArgumentNode) -> None:
-        self._accept_list('positional', node.arguments)
-        kwargs_list = []  # type: T.List[T.Dict[str, T.Dict[str, T.Any]]]
-        for key, val in node.kwargs.items():
-            key_res = {}  # type: T.Dict[str, T.Any]
-            val_res = {}  # type: T.Dict[str, T.Any]
-            self._raw_accept(key, key_res)
-            self._raw_accept(val, val_res)
-            kwargs_list += [{'key': key_res, 'val': val_res}]
-        self.current['kwargs'] = kwargs_list
-        self.setbase(node)
diff --git a/meson/mesonbuild/ast/visitor.py b/meson/mesonbuild/ast/visitor.py
deleted file mode 100644 (file)
index 451020d..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool
-
-from .. import mparser
-
-class AstVisitor:
-    def __init__(self):
-        pass
-
-    def visit_default_func(self, node: mparser.BaseNode) -> None:
-        pass
-
-    def visit_BooleanNode(self, node: mparser.BooleanNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_IdNode(self, node: mparser.IdNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_NumberNode(self, node: mparser.NumberNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_StringNode(self, node: mparser.StringNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_ContinueNode(self, node: mparser.ContinueNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_BreakNode(self, node: mparser.BreakNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_ArrayNode(self, node: mparser.ArrayNode) -> None:
-        self.visit_default_func(node)
-        node.args.accept(self)
-
-    def visit_DictNode(self, node: mparser.DictNode) -> None:
-        self.visit_default_func(node)
-        node.args.accept(self)
-
-    def visit_EmptyNode(self, node: mparser.EmptyNode) -> None:
-        self.visit_default_func(node)
-
-    def visit_OrNode(self, node: mparser.OrNode) -> None:
-        self.visit_default_func(node)
-        node.left.accept(self)
-        node.right.accept(self)
-
-    def visit_AndNode(self, node: mparser.AndNode) -> None:
-        self.visit_default_func(node)
-        node.left.accept(self)
-        node.right.accept(self)
-
-    def visit_ComparisonNode(self, node: mparser.ComparisonNode) -> None:
-        self.visit_default_func(node)
-        node.left.accept(self)
-        node.right.accept(self)
-
-    def visit_ArithmeticNode(self, node: mparser.ArithmeticNode) -> None:
-        self.visit_default_func(node)
-        node.left.accept(self)
-        node.right.accept(self)
-
-    def visit_NotNode(self, node: mparser.NotNode) -> None:
-        self.visit_default_func(node)
-        node.value.accept(self)
-
-    def visit_CodeBlockNode(self, node: mparser.CodeBlockNode) -> None:
-        self.visit_default_func(node)
-        for i in node.lines:
-            i.accept(self)
-
-    def visit_IndexNode(self, node: mparser.IndexNode) -> None:
-        self.visit_default_func(node)
-        node.iobject.accept(self)
-        node.index.accept(self)
-
-    def visit_MethodNode(self, node: mparser.MethodNode) -> None:
-        self.visit_default_func(node)
-        node.source_object.accept(self)
-        node.args.accept(self)
-
-    def visit_FunctionNode(self, node: mparser.FunctionNode) -> None:
-        self.visit_default_func(node)
-        node.args.accept(self)
-
-    def visit_AssignmentNode(self, node: mparser.AssignmentNode) -> None:
-        self.visit_default_func(node)
-        node.value.accept(self)
-
-    def visit_PlusAssignmentNode(self, node: mparser.PlusAssignmentNode) -> None:
-        self.visit_default_func(node)
-        node.value.accept(self)
-
-    def visit_ForeachClauseNode(self, node: mparser.ForeachClauseNode) -> None:
-        self.visit_default_func(node)
-        node.items.accept(self)
-        node.block.accept(self)
-
-    def visit_IfClauseNode(self, node: mparser.IfClauseNode) -> None:
-        self.visit_default_func(node)
-        for i in node.ifs:
-            i.accept(self)
-        node.elseblock.accept(self)
-
-    def visit_UMinusNode(self, node: mparser.UMinusNode) -> None:
-        self.visit_default_func(node)
-        node.value.accept(self)
-
-    def visit_IfNode(self, node: mparser.IfNode) -> None:
-        self.visit_default_func(node)
-        node.condition.accept(self)
-        node.block.accept(self)
-
-    def visit_TernaryNode(self, node: mparser.TernaryNode) -> None:
-        self.visit_default_func(node)
-        node.condition.accept(self)
-        node.trueblock.accept(self)
-        node.falseblock.accept(self)
-
-    def visit_ArgumentNode(self, node: mparser.ArgumentNode) -> None:
-        self.visit_default_func(node)
-        for i in node.arguments:
-            i.accept(self)
-        for key, val in node.kwargs.items():
-            key.accept(self)
-            val.accept(self)
diff --git a/meson/mesonbuild/backend/__init__.py b/meson/mesonbuild/backend/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/meson/mesonbuild/backend/backends.py b/meson/mesonbuild/backend/backends.py
deleted file mode 100644 (file)
index c84bb75..0000000
+++ /dev/null
@@ -1,1382 +0,0 @@
-# Copyright 2012-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from collections import OrderedDict
-from functools import lru_cache
-from pathlib import Path
-import enum
-import json
-import os
-import pickle
-import re
-import shlex
-import subprocess
-import textwrap
-import typing as T
-
-from .. import build
-from .. import dependencies
-from .. import mesonlib
-from .. import mlog
-from ..mesonlib import (
-    File, MachineChoice, MesonException, OrderedSet, OptionOverrideProxy,
-    classify_unity_sources, unholder
-)
-
-if T.TYPE_CHECKING:
-    from ..interpreter import Interpreter
-
-
-class TestProtocol(enum.Enum):
-
-    EXITCODE = 0
-    TAP = 1
-    GTEST = 2
-
-    @classmethod
-    def from_str(cls, string: str) -> 'TestProtocol':
-        if string == 'exitcode':
-            return cls.EXITCODE
-        elif string == 'tap':
-            return cls.TAP
-        elif string == 'gtest':
-            return cls.GTEST
-        raise MesonException('unknown test format {}'.format(string))
-
-    def __str__(self) -> str:
-        if self is self.EXITCODE:
-            return 'exitcode'
-        elif self is self.GTEST:
-            return 'gtest'
-        return 'tap'
-
-
-class CleanTrees:
-    '''
-    Directories outputted by custom targets that have to be manually cleaned
-    because on Linux `ninja clean` only deletes empty directories.
-    '''
-    def __init__(self, build_dir, trees):
-        self.build_dir = build_dir
-        self.trees = trees
-
-class InstallData:
-    def __init__(self, source_dir, build_dir, prefix, strip_bin,
-                 install_umask, mesonintrospect):
-        self.source_dir = source_dir
-        self.build_dir = build_dir
-        self.prefix = prefix
-        self.strip_bin = strip_bin
-        self.install_umask = install_umask
-        self.targets = []
-        self.headers = []
-        self.man = []
-        self.data = []
-        self.po_package_name = ''
-        self.po = []
-        self.install_scripts = []
-        self.install_subdirs = []
-        self.mesonintrospect = mesonintrospect
-
-class TargetInstallData:
-    def __init__(self, fname, outdir, aliases, strip, install_name_mappings, rpath_dirs_to_remove, install_rpath, install_mode, optional=False):
-        self.fname = fname
-        self.outdir = outdir
-        self.aliases = aliases
-        self.strip = strip
-        self.install_name_mappings = install_name_mappings
-        self.rpath_dirs_to_remove = rpath_dirs_to_remove
-        self.install_rpath = install_rpath
-        self.install_mode = install_mode
-        self.optional = optional
-
-class ExecutableSerialisation:
-    def __init__(self, cmd_args, env=None, exe_wrapper=None,
-                 workdir=None, extra_paths=None, capture=None):
-        self.cmd_args = cmd_args
-        self.env = env or {}
-        if exe_wrapper is not None:
-            assert(isinstance(exe_wrapper, dependencies.ExternalProgram))
-        self.exe_runner = exe_wrapper
-        self.workdir = workdir
-        self.extra_paths = extra_paths
-        self.capture = capture
-
-class TestSerialisation:
-    def __init__(self, name: str, project: str, suite: str, fname: T.List[str],
-                 is_cross_built: bool, exe_wrapper: T.Optional[dependencies.ExternalProgram],
-                 needs_exe_wrapper: bool, is_parallel: bool, cmd_args: T.List[str],
-                 env: build.EnvironmentVariables, should_fail: bool,
-                 timeout: T.Optional[int], workdir: T.Optional[str],
-                 extra_paths: T.List[str], protocol: TestProtocol, priority: int,
-                 cmd_is_built: bool):
-        self.name = name
-        self.project_name = project
-        self.suite = suite
-        self.fname = fname
-        self.is_cross_built = is_cross_built
-        if exe_wrapper is not None:
-            assert(isinstance(exe_wrapper, dependencies.ExternalProgram))
-        self.exe_runner = exe_wrapper
-        self.is_parallel = is_parallel
-        self.cmd_args = cmd_args
-        self.env = env
-        self.should_fail = should_fail
-        self.timeout = timeout
-        self.workdir = workdir
-        self.extra_paths = extra_paths
-        self.protocol = protocol
-        self.priority = priority
-        self.needs_exe_wrapper = needs_exe_wrapper
-        self.cmd_is_built = cmd_is_built
-
-
-def get_backend_from_name(backend: str, build: T.Optional[build.Build] = None, interpreter: T.Optional['Interpreter'] = None) -> T.Optional['Backend']:
-    if backend == 'ninja':
-        from . import ninjabackend
-        return ninjabackend.NinjaBackend(build, interpreter)
-    elif backend == 'vs':
-        from . import vs2010backend
-        return vs2010backend.autodetect_vs_version(build, interpreter)
-    elif backend == 'vs2010':
-        from . import vs2010backend
-        return vs2010backend.Vs2010Backend(build, interpreter)
-    elif backend == 'vs2015':
-        from . import vs2015backend
-        return vs2015backend.Vs2015Backend(build, interpreter)
-    elif backend == 'vs2017':
-        from . import vs2017backend
-        return vs2017backend.Vs2017Backend(build, interpreter)
-    elif backend == 'vs2019':
-        from . import vs2019backend
-        return vs2019backend.Vs2019Backend(build, interpreter)
-    elif backend == 'xcode':
-        from . import xcodebackend
-        return xcodebackend.XCodeBackend(build, interpreter)
-    return None
-
-# This class contains the basic functionality that is needed by all backends.
-# Feel free to move stuff in and out of it as you see fit.
-class Backend:
-    def __init__(self, build: T.Optional[build.Build], interpreter: T.Optional['Interpreter']):
-        # Make it possible to construct a dummy backend
-        # This is used for introspection without a build directory
-        if build is None:
-            self.environment = None
-            return
-        self.build = build
-        self.interpreter = interpreter
-        self.environment = build.environment
-        self.processed_targets = {}
-        self.build_dir = self.environment.get_build_dir()
-        self.source_dir = self.environment.get_source_dir()
-        self.build_to_src = mesonlib.relpath(self.environment.get_source_dir(),
-                                             self.environment.get_build_dir())
-
-    def get_target_filename(self, t, *, warn_multi_output: bool = True):
-        if isinstance(t, build.CustomTarget):
-            if warn_multi_output and len(t.get_outputs()) != 1:
-                mlog.warning('custom_target {!r} has more than one output! '
-                             'Using the first one.'.format(t.name))
-            filename = t.get_outputs()[0]
-        elif isinstance(t, build.CustomTargetIndex):
-            filename = t.get_outputs()[0]
-        else:
-            assert(isinstance(t, build.BuildTarget))
-            filename = t.get_filename()
-        return os.path.join(self.get_target_dir(t), filename)
-
-    def get_target_filename_abs(self, target):
-        return os.path.join(self.environment.get_build_dir(), self.get_target_filename(target))
-
-    def get_base_options_for_target(self, target):
-        return OptionOverrideProxy(target.option_overrides_base,
-                                   self.environment.coredata.builtins,
-                                   self.environment.coredata.base_options)
-
-    def get_compiler_options_for_target(self, target):
-        comp_reg = self.environment.coredata.compiler_options[target.for_machine]
-        comp_override = target.option_overrides_compiler
-        return {
-            lang: OptionOverrideProxy(comp_override[lang], comp_reg[lang])
-            for lang in set(comp_reg.keys()) | set(comp_override.keys())
-        }
-
-    def get_option_for_target(self, option_name, target):
-        if option_name in target.option_overrides_base:
-            override = target.option_overrides_base[option_name]
-            return self.environment.coredata.validate_option_value(option_name, override)
-        return self.environment.coredata.get_builtin_option(option_name, target.subproject)
-
-    def get_target_filename_for_linking(self, target):
-        # On some platforms (msvc for instance), the file that is used for
-        # dynamic linking is not the same as the dynamic library itself. This
-        # file is called an import library, and we want to link against that.
-        # On all other platforms, we link to the library directly.
-        if isinstance(target, build.SharedLibrary):
-            link_lib = target.get_import_filename() or target.get_filename()
-            return os.path.join(self.get_target_dir(target), link_lib)
-        elif isinstance(target, build.StaticLibrary):
-            return os.path.join(self.get_target_dir(target), target.get_filename())
-        elif isinstance(target, (build.CustomTarget, build.CustomTargetIndex)):
-            if not target.is_linkable_target():
-                raise MesonException('Tried to link against custom target "{}", which is not linkable.'.format(target.name))
-            return os.path.join(self.get_target_dir(target), target.get_filename())
-        elif isinstance(target, build.Executable):
-            if target.import_filename:
-                return os.path.join(self.get_target_dir(target), target.get_import_filename())
-            else:
-                return None
-        raise AssertionError('BUG: Tried to link to {!r} which is not linkable'.format(target))
-
-    @lru_cache(maxsize=None)
-    def get_target_dir(self, target):
-        if self.environment.coredata.get_builtin_option('layout') == 'mirror':
-            dirname = target.get_subdir()
-        else:
-            dirname = 'meson-out'
-        return dirname
-
-    def get_target_dir_relative_to(self, t, o):
-        '''Get a target dir relative to another target's directory'''
-        target_dir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(t))
-        othert_dir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(o))
-        return os.path.relpath(target_dir, othert_dir)
-
-    def get_target_source_dir(self, target):
-        # if target dir is empty, avoid extraneous trailing / from os.path.join()
-        target_dir = self.get_target_dir(target)
-        if target_dir:
-            return os.path.join(self.build_to_src, target_dir)
-        return self.build_to_src
-
-    def get_target_private_dir(self, target):
-        return os.path.join(self.get_target_filename(target, warn_multi_output=False) + '.p')
-
-    def get_target_private_dir_abs(self, target):
-        return os.path.join(self.environment.get_build_dir(), self.get_target_private_dir(target))
-
-    @lru_cache(maxsize=None)
-    def get_target_generated_dir(self, target, gensrc, src):
-        """
-        Takes a BuildTarget, a generator source (CustomTarget or GeneratedList),
-        and a generated source filename.
-        Returns the full path of the generated source relative to the build root
-        """
-        # CustomTarget generators output to the build dir of the CustomTarget
-        if isinstance(gensrc, (build.CustomTarget, build.CustomTargetIndex)):
-            return os.path.join(self.get_target_dir(gensrc), src)
-        # GeneratedList generators output to the private build directory of the
-        # target that the GeneratedList is used in
-        return os.path.join(self.get_target_private_dir(target), src)
-
-    def get_unity_source_file(self, target, suffix, number):
-        # There is a potential conflict here, but it is unlikely that
-        # anyone both enables unity builds and has a file called foo-unity.cpp.
-        osrc = '{}-unity{}.{}'.format(target.name, number, suffix)
-        return mesonlib.File.from_built_file(self.get_target_private_dir(target), osrc)
-
-    def generate_unity_files(self, target, unity_src):
-        abs_files = []
-        result = []
-        compsrcs = classify_unity_sources(target.compilers.values(), unity_src)
-        unity_size = self.get_option_for_target('unity_size', target)
-
-        def init_language_file(suffix, unity_file_number):
-            unity_src = self.get_unity_source_file(target, suffix, unity_file_number)
-            outfileabs = unity_src.absolute_path(self.environment.get_source_dir(),
-                                                 self.environment.get_build_dir())
-            outfileabs_tmp = outfileabs + '.tmp'
-            abs_files.append(outfileabs)
-            outfileabs_tmp_dir = os.path.dirname(outfileabs_tmp)
-            if not os.path.exists(outfileabs_tmp_dir):
-                os.makedirs(outfileabs_tmp_dir)
-            result.append(unity_src)
-            return open(outfileabs_tmp, 'w')
-
-        # For each language, generate unity source files and return the list
-        for comp, srcs in compsrcs.items():
-            files_in_current = unity_size + 1
-            unity_file_number = 0
-            ofile = None
-            for src in srcs:
-                if files_in_current >= unity_size:
-                    if ofile:
-                        ofile.close()
-                    ofile = init_language_file(comp.get_default_suffix(), unity_file_number)
-                    unity_file_number += 1
-                    files_in_current = 0
-                ofile.write('#include<{}>\n'.format(src))
-                files_in_current += 1
-            if ofile:
-                ofile.close()
-
-        [mesonlib.replace_if_different(x, x + '.tmp') for x in abs_files]
-        return result
-
-    def relpath(self, todir, fromdir):
-        return os.path.relpath(os.path.join('dummyprefixdir', todir),
-                               os.path.join('dummyprefixdir', fromdir))
-
-    def flatten_object_list(self, target, proj_dir_to_build_root=''):
-        obj_list = self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root)
-        return list(dict.fromkeys(obj_list))
-
-    def _flatten_object_list(self, target, objects, proj_dir_to_build_root):
-        obj_list = []
-        for obj in objects:
-            if isinstance(obj, str):
-                o = os.path.join(proj_dir_to_build_root,
-                                 self.build_to_src, target.get_subdir(), obj)
-                obj_list.append(o)
-            elif isinstance(obj, mesonlib.File):
-                obj_list.append(obj.rel_to_builddir(self.build_to_src))
-            elif isinstance(obj, build.ExtractedObjects):
-                if obj.recursive:
-                    obj_list += self._flatten_object_list(obj.target, obj.objlist, proj_dir_to_build_root)
-                obj_list += self.determine_ext_objs(obj, proj_dir_to_build_root)
-            else:
-                raise MesonException('Unknown data type in object list.')
-        return obj_list
-
-    def as_meson_exe_cmdline(self, tname, exe, cmd_args, workdir=None,
-                             for_machine=MachineChoice.BUILD,
-                             extra_bdeps=None, capture=None, force_serialize=False):
-        '''
-        Serialize an executable for running with a generator or a custom target
-        '''
-        import hashlib
-        machine = self.environment.machines[for_machine]
-        if machine.is_windows() or machine.is_cygwin():
-            extra_paths = self.determine_windows_extra_paths(exe, extra_bdeps or [])
-        else:
-            extra_paths = []
-
-        if isinstance(exe, dependencies.ExternalProgram):
-            exe_cmd = exe.get_command()
-            exe_for_machine = exe.for_machine
-        elif isinstance(exe, (build.BuildTarget, build.CustomTarget)):
-            exe_cmd = [self.get_target_filename_abs(exe)]
-            exe_for_machine = exe.for_machine
-        else:
-            exe_cmd = [exe]
-            exe_for_machine = MachineChoice.BUILD
-
-        is_cross_built = not self.environment.machines.matches_build_machine(exe_for_machine)
-        if is_cross_built and self.environment.need_exe_wrapper():
-            exe_wrapper = self.environment.get_exe_wrapper()
-            if not exe_wrapper.found():
-                msg = 'The exe_wrapper {!r} defined in the cross file is ' \
-                      'needed by target {!r}, but was not found. Please ' \
-                      'check the command and/or add it to PATH.'
-                raise MesonException(msg.format(exe_wrapper.name, tname))
-        else:
-            if exe_cmd[0].endswith('.jar'):
-                exe_cmd = ['java', '-jar'] + exe_cmd
-            elif exe_cmd[0].endswith('.exe') and not (mesonlib.is_windows() or mesonlib.is_cygwin()):
-                exe_cmd = ['mono'] + exe_cmd
-            exe_wrapper = None
-
-        force_serialize = force_serialize or extra_paths or workdir or \
-            exe_wrapper or any('\n' in c for c in cmd_args)
-        if not force_serialize:
-            if not capture:
-                return None
-            return (self.environment.get_build_command() +
-                    ['--internal', 'exe', '--capture', capture, '--'] + exe_cmd + cmd_args)
-
-        workdir = workdir or self.environment.get_build_dir()
-        env = {}
-        if isinstance(exe, (dependencies.ExternalProgram,
-                            build.BuildTarget, build.CustomTarget)):
-            basename = exe.name
-        else:
-            basename = os.path.basename(exe)
-
-        # Can't just use exe.name here; it will likely be run more than once
-        # Take a digest of the cmd args, env, workdir, and capture. This avoids
-        # collisions and also makes the name deterministic over regenerations
-        # which avoids a rebuild by Ninja because the cmdline stays the same.
-        data = bytes(str(sorted(env.items())) + str(cmd_args) + str(workdir) + str(capture),
-                     encoding='utf-8')
-        digest = hashlib.sha1(data).hexdigest()
-        scratch_file = 'meson_exe_{0}_{1}.dat'.format(basename, digest)
-        exe_data = os.path.join(self.environment.get_scratch_dir(), scratch_file)
-        with open(exe_data, 'wb') as f:
-            es = ExecutableSerialisation(exe_cmd + cmd_args, env,
-                                         exe_wrapper, workdir,
-                                         extra_paths, capture)
-            pickle.dump(es, f)
-        return self.environment.get_build_command() + ['--internal', 'exe', '--unpickle', exe_data]
-
-    def serialize_tests(self):
-        test_data = os.path.join(self.environment.get_scratch_dir(), 'meson_test_setup.dat')
-        with open(test_data, 'wb') as datafile:
-            self.write_test_file(datafile)
-        benchmark_data = os.path.join(self.environment.get_scratch_dir(), 'meson_benchmark_setup.dat')
-        with open(benchmark_data, 'wb') as datafile:
-            self.write_benchmark_file(datafile)
-        return test_data, benchmark_data
-
-    def determine_linker_and_stdlib_args(self, target):
-        '''
-        If we're building a static library, there is only one static linker.
-        Otherwise, we query the target for the dynamic linker.
-        '''
-        if isinstance(target, build.StaticLibrary):
-            return self.build.static_linker[target.for_machine], []
-        l, stdlib_args = target.get_clink_dynamic_linker_and_stdlibs()
-        return l, stdlib_args
-
-    @staticmethod
-    def _libdir_is_system(libdir, compilers, env):
-        libdir = os.path.normpath(libdir)
-        for cc in compilers.values():
-            if libdir in cc.get_library_dirs(env):
-                return True
-        return False
-
-    def get_external_rpath_dirs(self, target):
-        dirs = set()
-        args = []
-        # FIXME: is there a better way?
-        for lang in ['c', 'cpp']:
-            try:
-                args.extend(self.environment.coredata.get_external_link_args(target.for_machine, lang))
-            except Exception:
-                pass
-        # Match rpath formats:
-        # -Wl,-rpath=
-        # -Wl,-rpath,
-        rpath_regex = re.compile(r'-Wl,-rpath[=,]([^,]+)')
-        # Match solaris style compat runpath formats:
-        # -Wl,-R
-        # -Wl,-R,
-        runpath_regex = re.compile(r'-Wl,-R[,]?([^,]+)')
-        # Match symbols formats:
-        # -Wl,--just-symbols=
-        # -Wl,--just-symbols,
-        symbols_regex = re.compile(r'-Wl,--just-symbols[=,]([^,]+)')
-        for arg in args:
-            rpath_match = rpath_regex.match(arg)
-            if rpath_match:
-                for dir in rpath_match.group(1).split(':'):
-                    dirs.add(dir)
-            runpath_match = runpath_regex.match(arg)
-            if runpath_match:
-                for dir in runpath_match.group(1).split(':'):
-                    # The symbols arg is an rpath if the path is a directory
-                    if Path(dir).is_dir():
-                        dirs.add(dir)
-            symbols_match = symbols_regex.match(arg)
-            if symbols_match:
-                for dir in symbols_match.group(1).split(':'):
-                    # Prevent usage of --just-symbols to specify rpath
-                    if Path(dir).is_dir():
-                        raise MesonException('Invalid arg for --just-symbols, {} is a directory.'.format(dir))
-        return dirs
-
-    def rpaths_for_bundled_shared_libraries(self, target, exclude_system=True):
-        paths = []
-        for dep in target.external_deps:
-            if not isinstance(dep, (dependencies.ExternalLibrary, dependencies.PkgConfigDependency)):
-                continue
-            la = dep.link_args
-            if len(la) != 1 or not os.path.isabs(la[0]):
-                continue
-            # The only link argument is an absolute path to a library file.
-            libpath = la[0]
-            libdir = os.path.dirname(libpath)
-            if exclude_system and self._libdir_is_system(libdir, target.compilers, self.environment):
-                # No point in adding system paths.
-                continue
-            # Don't remove rpaths specified in LDFLAGS.
-            if libdir in self.get_external_rpath_dirs(target):
-                continue
-            # Windows doesn't support rpaths, but we use this function to
-            # emulate rpaths by setting PATH, so also accept DLLs here
-            if os.path.splitext(libpath)[1] not in ['.dll', '.lib', '.so', '.dylib']:
-                continue
-            if libdir.startswith(self.environment.get_source_dir()):
-                rel_to_src = libdir[len(self.environment.get_source_dir()) + 1:]
-                assert not os.path.isabs(rel_to_src), 'rel_to_src: {} is absolute'.format(rel_to_src)
-                paths.append(os.path.join(self.build_to_src, rel_to_src))
-            else:
-                paths.append(libdir)
-        return paths
-
-    def determine_rpath_dirs(self, target):
-        if self.environment.coredata.get_builtin_option('layout') == 'mirror':
-            result = target.get_link_dep_subdirs()
-        else:
-            result = OrderedSet()
-            result.add('meson-out')
-        result.update(self.rpaths_for_bundled_shared_libraries(target))
-        target.rpath_dirs_to_remove.update([d.encode('utf8') for d in result])
-        return tuple(result)
-
-    @staticmethod
-    def canonicalize_filename(fname):
-        for ch in ('/', '\\', ':'):
-            fname = fname.replace(ch, '_')
-        return fname
-
-    def object_filename_from_source(self, target, source):
-        assert isinstance(source, mesonlib.File)
-        build_dir = self.environment.get_build_dir()
-        rel_src = source.rel_to_builddir(self.build_to_src)
-
-        # foo.vala files compile down to foo.c and then foo.c.o, not foo.vala.o
-        if rel_src.endswith(('.vala', '.gs')):
-            # See description in generate_vala_compile for this logic.
-            if source.is_built:
-                if os.path.isabs(rel_src):
-                    rel_src = rel_src[len(build_dir) + 1:]
-                rel_src = os.path.relpath(rel_src, self.get_target_private_dir(target))
-            else:
-                rel_src = os.path.basename(rel_src)
-            # A meson- prefixed directory is reserved; hopefully no-one creates a file name with such a weird prefix.
-            source = 'meson-generated_' + rel_src[:-5] + '.c'
-        elif source.is_built:
-            if os.path.isabs(rel_src):
-                rel_src = rel_src[len(build_dir) + 1:]
-            targetdir = self.get_target_private_dir(target)
-            # A meson- prefixed directory is reserved; hopefully no-one creates a file name with such a weird prefix.
-            source = 'meson-generated_' + os.path.relpath(rel_src, targetdir)
-        else:
-            if os.path.isabs(rel_src):
-                # Use the absolute path directly to avoid file name conflicts
-                source = rel_src
-            else:
-                source = os.path.relpath(os.path.join(build_dir, rel_src),
-                                         os.path.join(self.environment.get_source_dir(), target.get_subdir()))
-        machine = self.environment.machines[target.for_machine]
-        return self.canonicalize_filename(source) + '.' + machine.get_object_suffix()
-
-    def determine_ext_objs(self, extobj, proj_dir_to_build_root):
-        result = []
-
-        # Merge sources and generated sources
-        sources = list(extobj.srclist)
-        for gensrc in extobj.genlist:
-            for s in gensrc.get_outputs():
-                path = self.get_target_generated_dir(extobj.target, gensrc, s)
-                dirpart, fnamepart = os.path.split(path)
-                sources.append(File(True, dirpart, fnamepart))
-
-        # Filter out headers and all non-source files
-        filtered_sources = []
-        for s in sources:
-            if self.environment.is_source(s) and not self.environment.is_header(s):
-                filtered_sources.append(s)
-            elif self.environment.is_object(s):
-                result.append(s.relative_name())
-        sources = filtered_sources
-
-        # extobj could contain only objects and no sources
-        if not sources:
-            return result
-
-        targetdir = self.get_target_private_dir(extobj.target)
-
-        # With unity builds, sources don't map directly to objects,
-        # we only support extracting all the objects in this mode,
-        # so just return all object files.
-        if self.is_unity(extobj.target):
-            compsrcs = classify_unity_sources(extobj.target.compilers.values(), sources)
-            sources = []
-            unity_size = self.get_option_for_target('unity_size', extobj.target)
-            for comp, srcs in compsrcs.items():
-                for i in range(len(srcs) // unity_size + 1):
-                    osrc = self.get_unity_source_file(extobj.target,
-                                                      comp.get_default_suffix(), i)
-                    sources.append(osrc)
-
-        for osrc in sources:
-            objname = self.object_filename_from_source(extobj.target, osrc)
-            objpath = os.path.join(proj_dir_to_build_root, targetdir, objname)
-            result.append(objpath)
-
-        return result
-
-    def get_pch_include_args(self, compiler, target):
-        args = []
-        pchpath = self.get_target_private_dir(target)
-        includeargs = compiler.get_include_args(pchpath, False)
-        p = target.get_pch(compiler.get_language())
-        if p:
-            args += compiler.get_pch_use_args(pchpath, p[0])
-        return includeargs + args
-
-    def create_msvc_pch_implementation(self, target, lang, pch_header):
-        # We have to include the language in the file name, otherwise
-        # pch.c and pch.cpp will both end up as pch.obj in VS backends.
-        impl_name = 'meson_pch-{}.{}'.format(lang, lang)
-        pch_rel_to_build = os.path.join(self.get_target_private_dir(target), impl_name)
-        # Make sure to prepend the build dir, since the working directory is
-        # not defined. Otherwise, we might create the file in the wrong path.
-        pch_file = os.path.join(self.build_dir, pch_rel_to_build)
-        os.makedirs(os.path.dirname(pch_file), exist_ok=True)
-
-        content = '#include "{}"'.format(os.path.basename(pch_header))
-        pch_file_tmp = pch_file + '.tmp'
-        with open(pch_file_tmp, 'w') as f:
-            f.write(content)
-        mesonlib.replace_if_different(pch_file, pch_file_tmp)
-        return pch_rel_to_build
-
-    @staticmethod
-    def escape_extra_args(compiler, args):
-        # all backslashes in defines are doubly-escaped
-        extra_args = []
-        for arg in args:
-            if arg.startswith('-D') or arg.startswith('/D'):
-                arg = arg.replace('\\', '\\\\')
-            extra_args.append(arg)
-
-        return extra_args
-
-    def generate_basic_compiler_args(self, target, compiler, no_warn_args=False):
-        # Create an empty commands list, and start adding arguments from
-        # various sources in the order in which they must override each other
-        # starting from hard-coded defaults followed by build options and so on.
-        commands = compiler.compiler_args()
-
-        copt_proxy = self.get_compiler_options_for_target(target)[compiler.language]
-        # First, the trivial ones that are impossible to override.
-        #
-        # Add -nostdinc/-nostdinc++ if needed; can't be overridden
-        commands += self.get_cross_stdlib_args(target, compiler)
-        # Add things like /NOLOGO or -pipe; usually can't be overridden
-        commands += compiler.get_always_args()
-        # Only add warning-flags by default if the buildtype enables it, and if
-        # we weren't explicitly asked to not emit warnings (for Vala, f.ex)
-        if no_warn_args:
-            commands += compiler.get_no_warn_args()
-        elif self.get_option_for_target('buildtype', target) != 'plain':
-            commands += compiler.get_warn_args(self.get_option_for_target('warning_level', target))
-        # Add -Werror if werror=true is set in the build options set on the
-        # command-line or default_options inside project(). This only sets the
-        # action to be done for warnings if/when they are emitted, so it's ok
-        # to set it after get_no_warn_args() or get_warn_args().
-        if self.get_option_for_target('werror', target):
-            commands += compiler.get_werror_args()
-        # Add compile args for c_* or cpp_* build options set on the
-        # command-line or default_options inside project().
-        commands += compiler.get_option_compile_args(copt_proxy)
-        # Add buildtype args: optimization level, debugging, etc.
-        commands += compiler.get_buildtype_args(self.get_option_for_target('buildtype', target))
-        commands += compiler.get_optimization_args(self.get_option_for_target('optimization', target))
-        commands += compiler.get_debug_args(self.get_option_for_target('debug', target))
-        # Add compile args added using add_project_arguments()
-        commands += self.build.get_project_args(compiler, target.subproject, target.for_machine)
-        # Add compile args added using add_global_arguments()
-        # These override per-project arguments
-        commands += self.build.get_global_args(compiler, target.for_machine)
-        # Compile args added from the env: CFLAGS/CXXFLAGS, etc, or the cross
-        # file. We want these to override all the defaults, but not the
-        # per-target compile args.
-        commands += self.environment.coredata.get_external_args(target.for_machine, compiler.get_language())
-        # Always set -fPIC for shared libraries
-        if isinstance(target, build.SharedLibrary):
-            commands += compiler.get_pic_args()
-        # Set -fPIC for static libraries by default unless explicitly disabled
-        if isinstance(target, build.StaticLibrary) and target.pic:
-            commands += compiler.get_pic_args()
-        if isinstance(target, build.Executable) and target.pie:
-            commands += compiler.get_pie_args()
-        # Add compile args needed to find external dependencies. Link args are
-        # added while generating the link command.
-        # NOTE: We must preserve the order in which external deps are
-        # specified, so we reverse the list before iterating over it.
-        for dep in reversed(target.get_external_deps()):
-            if not dep.found():
-                continue
-
-            if compiler.language == 'vala':
-                if isinstance(dep, dependencies.PkgConfigDependency):
-                    if dep.name == 'glib-2.0' and dep.version_reqs is not None:
-                        for req in dep.version_reqs:
-                            if req.startswith(('>=', '==')):
-                                commands += ['--target-glib', req[2:]]
-                                break
-                    commands += ['--pkg', dep.name]
-                elif isinstance(dep, dependencies.ExternalLibrary):
-                    commands += dep.get_link_args('vala')
-            else:
-                commands += compiler.get_dependency_compile_args(dep)
-            # Qt needs -fPIC for executables
-            # XXX: We should move to -fPIC for all executables
-            if isinstance(target, build.Executable):
-                commands += dep.get_exe_args(compiler)
-            # For 'automagic' deps: Boost and GTest. Also dependency('threads').
-            # pkg-config puts the thread flags itself via `Cflags:`
-        # Fortran requires extra include directives.
-        if compiler.language == 'fortran':
-            for lt in target.link_targets:
-                priv_dir = self.get_target_private_dir(lt)
-                commands += compiler.get_include_args(priv_dir, False)
-        return commands
-
-    def build_target_link_arguments(self, compiler, deps):
-        args = []
-        for d in deps:
-            if not (d.is_linkable_target()):
-                raise RuntimeError('Tried to link with a non-library target "{}".'.format(d.get_basename()))
-            arg = self.get_target_filename_for_linking(d)
-            if not arg:
-                continue
-            if compiler.get_language() == 'd':
-                arg = '-Wl,' + arg
-            else:
-                arg = compiler.get_linker_lib_prefix() + arg
-            args.append(arg)
-        return args
-
-    def get_mingw_extra_paths(self, target):
-        paths = OrderedSet()
-        # The cross bindir
-        root = self.environment.properties[target.for_machine].get_root()
-        if root:
-            paths.add(os.path.join(root, 'bin'))
-        # The toolchain bindir
-        sys_root = self.environment.properties[target.for_machine].get_sys_root()
-        if sys_root:
-            paths.add(os.path.join(sys_root, 'bin'))
-        # Get program and library dirs from all target compilers
-        if isinstance(target, build.BuildTarget):
-            for cc in target.compilers.values():
-                paths.update(cc.get_program_dirs(self.environment))
-                paths.update(cc.get_library_dirs(self.environment))
-        return list(paths)
-
-    def determine_windows_extra_paths(self, target: T.Union[build.BuildTarget, str], extra_bdeps):
-        '''On Windows there is no such thing as an rpath.
-        We must determine all locations of DLLs that this exe
-        links to and return them so they can be used in unit
-        tests.'''
-        result = set()
-        prospectives = set()
-        if isinstance(target, build.BuildTarget):
-            prospectives.update(target.get_transitive_link_deps())
-            # External deps
-            for deppath in self.rpaths_for_bundled_shared_libraries(target, exclude_system=False):
-                result.add(os.path.normpath(os.path.join(self.environment.get_build_dir(), deppath)))
-        for bdep in extra_bdeps:
-            prospectives.add(bdep)
-            prospectives.update(bdep.get_transitive_link_deps())
-        # Internal deps
-        for ld in prospectives:
-            if ld == '' or ld == '.':
-                continue
-            dirseg = os.path.join(self.environment.get_build_dir(), self.get_target_dir(ld))
-            result.add(dirseg)
-        if (isinstance(target, build.BuildTarget) and
-                not self.environment.machines.matches_build_machine(target.for_machine)):
-            result.update(self.get_mingw_extra_paths(target))
-        return list(result)
-
-    def write_benchmark_file(self, datafile):
-        self.write_test_serialisation(self.build.get_benchmarks(), datafile)
-
-    def write_test_file(self, datafile):
-        self.write_test_serialisation(self.build.get_tests(), datafile)
-
-    def create_test_serialisation(self, tests):
-        arr = []
-        for t in sorted(tests, key=lambda tst: -1 * tst.priority):
-            exe = t.get_exe()
-            if isinstance(exe, dependencies.ExternalProgram):
-                cmd = exe.get_command()
-            else:
-                cmd = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(t.get_exe()))]
-            if isinstance(exe, (build.BuildTarget, dependencies.ExternalProgram)):
-                test_for_machine = exe.for_machine
-            else:
-                # E.g. an external verifier or simulator program run on a generated executable.
-                # Can always be run without a wrapper.
-                test_for_machine = MachineChoice.BUILD
-
-            # we allow passing compiled executables to tests, which may be cross built.
-            # We need to consider these as well when considering whether the target is cross or not.
-            for a in t.cmd_args:
-                if isinstance(a, build.BuildTarget):
-                    if a.for_machine is MachineChoice.HOST:
-                        test_for_machine = MachineChoice.HOST
-                        break
-
-            is_cross = self.environment.is_cross_build(test_for_machine)
-            if is_cross and self.environment.need_exe_wrapper():
-                exe_wrapper = self.environment.get_exe_wrapper()
-            else:
-                exe_wrapper = None
-            machine = self.environment.machines[exe.for_machine]
-            if machine.is_windows() or machine.is_cygwin():
-                extra_bdeps = []
-                if isinstance(exe, build.CustomTarget):
-                    extra_bdeps = exe.get_transitive_build_target_deps()
-                extra_paths = self.determine_windows_extra_paths(exe, extra_bdeps)
-            else:
-                extra_paths = []
-
-            cmd_args = []
-            for a in unholder(t.cmd_args):
-                if isinstance(a, build.BuildTarget):
-                    extra_paths += self.determine_windows_extra_paths(a, [])
-                if isinstance(a, mesonlib.File):
-                    a = os.path.join(self.environment.get_build_dir(), a.rel_to_builddir(self.build_to_src))
-                    cmd_args.append(a)
-                elif isinstance(a, str):
-                    cmd_args.append(a)
-                elif isinstance(a, build.Executable):
-                    p = self.construct_target_rel_path(a, t.workdir)
-                    if p == a.get_filename():
-                        p = './' + p
-                    cmd_args.append(p)
-                elif isinstance(a, build.Target):
-                    cmd_args.append(self.construct_target_rel_path(a, t.workdir))
-                else:
-                    raise MesonException('Bad object in test command.')
-            ts = TestSerialisation(t.get_name(), t.project_name, t.suite, cmd, is_cross,
-                                   exe_wrapper, self.environment.need_exe_wrapper(),
-                                   t.is_parallel, cmd_args, t.env,
-                                   t.should_fail, t.timeout, t.workdir,
-                                   extra_paths, t.protocol, t.priority,
-                                   isinstance(exe, build.Executable))
-            arr.append(ts)
-        return arr
-
-    def write_test_serialisation(self, tests, datafile):
-        pickle.dump(self.create_test_serialisation(tests), datafile)
-
-    def construct_target_rel_path(self, a, workdir):
-        if workdir is None:
-            return self.get_target_filename(a)
-        assert(os.path.isabs(workdir))
-        abs_path = self.get_target_filename_abs(a)
-        return os.path.relpath(abs_path, workdir)
-
-    def generate_depmf_install(self, d):
-        if self.build.dep_manifest_name is None:
-            return
-        ifilename = os.path.join(self.environment.get_build_dir(), 'depmf.json')
-        ofilename = os.path.join(self.environment.get_prefix(), self.build.dep_manifest_name)
-        mfobj = {'type': 'dependency manifest', 'version': '1.0', 'projects': self.build.dep_manifest}
-        with open(ifilename, 'w') as f:
-            f.write(json.dumps(mfobj))
-        # Copy file from, to, and with mode unchanged
-        d.data.append([ifilename, ofilename, None])
-
-    def get_regen_filelist(self):
-        '''List of all files whose alteration means that the build
-        definition needs to be regenerated.'''
-        deps = [os.path.join(self.build_to_src, df)
-                for df in self.interpreter.get_build_def_files()]
-        if self.environment.is_cross_build():
-            deps.extend(self.environment.coredata.cross_files)
-        deps.extend(self.environment.coredata.config_files)
-        deps.append('meson-private/coredata.dat')
-        self.check_clock_skew(deps)
-        return deps
-
-    def check_clock_skew(self, file_list):
-        # If a file that leads to reconfiguration has a time
-        # stamp in the future, it will trigger an eternal reconfigure
-        # loop.
-        import time
-        now = time.time()
-        for f in file_list:
-            absf = os.path.join(self.environment.get_build_dir(), f)
-            ftime = os.path.getmtime(absf)
-            delta = ftime - now
-            # On Windows disk time stamps sometimes point
-            # to the future by a minuscule amount, less than
-            # 0.001 seconds. I don't know why.
-            if delta > 0.001:
-                raise MesonException('Clock skew detected. File {} has a time stamp {:.4f}s in the future.'.format(absf, delta))
-
-    def build_target_to_cmd_array(self, bt):
-        if isinstance(bt, build.BuildTarget):
-            if isinstance(bt, build.Executable) and bt.for_machine is not MachineChoice.BUILD:
-                if (self.environment.is_cross_build() and
-                        self.environment.exe_wrapper is None and
-                        self.environment.need_exe_wrapper()):
-                    s = textwrap.dedent('''
-                        Cannot use target {} as a generator because it is built for the
-                        host machine and no exe wrapper is defined or needs_exe_wrapper is
-                        true. You might want to set `native: true` instead to build it for
-                        the build machine.'''.format(bt.name))
-                    raise MesonException(s)
-            arr = [os.path.join(self.environment.get_build_dir(), self.get_target_filename(bt))]
-        else:
-            arr = bt.get_command()
-        return arr
-
-    def replace_extra_args(self, args, genlist):
-        final_args = []
-        for a in args:
-            if a == '@EXTRA_ARGS@':
-                final_args += genlist.get_extra_args()
-            else:
-                final_args.append(a)
-        return final_args
-
-    def replace_outputs(self, args, private_dir, output_list):
-        newargs = []
-        regex = re.compile(r'@OUTPUT(\d+)@')
-        for arg in args:
-            m = regex.search(arg)
-            while m is not None:
-                index = int(m.group(1))
-                src = '@OUTPUT{}@'.format(index)
-                arg = arg.replace(src, os.path.join(private_dir, output_list[index]))
-                m = regex.search(arg)
-            newargs.append(arg)
-        return newargs
-
-    def get_build_by_default_targets(self):
-        result = OrderedDict()
-        # Get all build and custom targets that must be built by default
-        for name, t in self.build.get_targets().items():
-            if t.build_by_default:
-                result[name] = t
-        # Get all targets used as test executables and arguments. These must
-        # also be built by default. XXX: Sometime in the future these should be
-        # built only before running tests.
-        for t in self.build.get_tests():
-            exe = unholder(t.exe)
-            if isinstance(exe, (build.CustomTarget, build.BuildTarget)):
-                result[exe.get_id()] = exe
-            for arg in unholder(t.cmd_args):
-                if not isinstance(arg, (build.CustomTarget, build.BuildTarget)):
-                    continue
-                result[arg.get_id()] = arg
-            for dep in t.depends:
-                assert isinstance(dep, (build.CustomTarget, build.BuildTarget))
-                result[dep.get_id()] = dep
-        return result
-
-    @lru_cache(maxsize=None)
-    def get_custom_target_provided_by_generated_source(self, generated_source):
-        libs = []
-        for f in generated_source.get_outputs():
-            if self.environment.is_library(f):
-                libs.append(os.path.join(self.get_target_dir(generated_source), f))
-        return libs
-
-    @lru_cache(maxsize=None)
-    def get_custom_target_provided_libraries(self, target):
-        libs = []
-        for t in target.get_generated_sources():
-            if not isinstance(t, build.CustomTarget):
-                continue
-            l = self.get_custom_target_provided_by_generated_source(t)
-            libs = libs + l
-        return libs
-
-    def is_unity(self, target):
-        optval = self.get_option_for_target('unity', target)
-        if optval == 'on' or (optval == 'subprojects' and target.subproject != ''):
-            return True
-        return False
-
-    def get_custom_target_sources(self, target):
-        '''
-        Custom target sources can be of various object types; strings, File,
-        BuildTarget, even other CustomTargets.
-        Returns the path to them relative to the build root directory.
-        '''
-        srcs = []
-        for i in unholder(target.get_sources()):
-            if isinstance(i, str):
-                fname = [os.path.join(self.build_to_src, target.subdir, i)]
-            elif isinstance(i, build.BuildTarget):
-                fname = [self.get_target_filename(i)]
-            elif isinstance(i, (build.CustomTarget, build.CustomTargetIndex)):
-                fname = [os.path.join(self.get_target_dir(i), p) for p in i.get_outputs()]
-            elif isinstance(i, build.GeneratedList):
-                fname = [os.path.join(self.get_target_private_dir(target), p) for p in i.get_outputs()]
-            elif isinstance(i, build.ExtractedObjects):
-                fname = [os.path.join(self.get_target_private_dir(i.target), p) for p in i.get_outputs(self)]
-            else:
-                fname = [i.rel_to_builddir(self.build_to_src)]
-            if target.absolute_paths:
-                fname = [os.path.join(self.environment.get_build_dir(), f) for f in fname]
-            srcs += fname
-        return srcs
-
-    def get_custom_target_depend_files(self, target, absolute_paths=False):
-        deps = []
-        for i in target.depend_files:
-            if isinstance(i, mesonlib.File):
-                if absolute_paths:
-                    deps.append(i.absolute_path(self.environment.get_source_dir(),
-                                                self.environment.get_build_dir()))
-                else:
-                    deps.append(i.rel_to_builddir(self.build_to_src))
-            else:
-                if absolute_paths:
-                    deps.append(os.path.join(self.environment.get_source_dir(), target.subdir, i))
-                else:
-                    deps.append(os.path.join(self.build_to_src, target.subdir, i))
-        return deps
-
-    def eval_custom_target_command(self, target, absolute_outputs=False):
-        # We want the outputs to be absolute only when using the VS backend
-        # XXX: Maybe allow the vs backend to use relative paths too?
-        source_root = self.build_to_src
-        build_root = '.'
-        outdir = self.get_target_dir(target)
-        if absolute_outputs:
-            source_root = self.environment.get_source_dir()
-            build_root = self.environment.get_build_dir()
-            outdir = os.path.join(self.environment.get_build_dir(), outdir)
-        outputs = []
-        for i in target.get_outputs():
-            outputs.append(os.path.join(outdir, i))
-        inputs = self.get_custom_target_sources(target)
-        # Evaluate the command list
-        cmd = []
-        for i in target.command:
-            if isinstance(i, build.BuildTarget):
-                cmd += self.build_target_to_cmd_array(i)
-                continue
-            elif isinstance(i, build.CustomTarget):
-                # GIR scanner will attempt to execute this binary but
-                # it assumes that it is in path, so always give it a full path.
-                tmp = i.get_outputs()[0]
-                i = os.path.join(self.get_target_dir(i), tmp)
-            elif isinstance(i, mesonlib.File):
-                i = i.rel_to_builddir(self.build_to_src)
-                if target.absolute_paths:
-                    i = os.path.join(self.environment.get_build_dir(), i)
-            # FIXME: str types are blindly added ignoring 'target.absolute_paths'
-            # because we can't know if they refer to a file or just a string
-            elif not isinstance(i, str):
-                err_msg = 'Argument {0} is of unknown type {1}'
-                raise RuntimeError(err_msg.format(str(i), str(type(i))))
-            else:
-                if '@SOURCE_ROOT@' in i:
-                    i = i.replace('@SOURCE_ROOT@', source_root)
-                if '@BUILD_ROOT@' in i:
-                    i = i.replace('@BUILD_ROOT@', build_root)
-                if '@DEPFILE@' in i:
-                    if target.depfile is None:
-                        msg = 'Custom target {!r} has @DEPFILE@ but no depfile ' \
-                              'keyword argument.'.format(target.name)
-                        raise MesonException(msg)
-                    dfilename = os.path.join(outdir, target.depfile)
-                    i = i.replace('@DEPFILE@', dfilename)
-                if '@PRIVATE_DIR@' in i:
-                    if target.absolute_paths:
-                        pdir = self.get_target_private_dir_abs(target)
-                    else:
-                        pdir = self.get_target_private_dir(target)
-                    i = i.replace('@PRIVATE_DIR@', pdir)
-                if '@PRIVATE_OUTDIR_' in i:
-                    match = re.search(r'@PRIVATE_OUTDIR_(ABS_)?([^/\s*]*)@', i)
-                    if not match:
-                        msg = 'Custom target {!r} has an invalid argument {!r}' \
-                              ''.format(target.name, i)
-                        raise MesonException(msg)
-                    source = match.group(0)
-                    if match.group(1) is None and not target.absolute_paths:
-                        lead_dir = ''
-                    else:
-                        lead_dir = self.environment.get_build_dir()
-                    i = i.replace(source, os.path.join(lead_dir, outdir))
-            cmd.append(i)
-        # Substitute the rest of the template strings
-        values = mesonlib.get_filenames_templates_dict(inputs, outputs)
-        cmd = mesonlib.substitute_values(cmd, values)
-        # This should not be necessary but removing it breaks
-        # building GStreamer on Windows. The underlying issue
-        # is problems with quoting backslashes on Windows
-        # which is the seventh circle of hell. The downside is
-        # that this breaks custom targets whose command lines
-        # have backslashes. If you try to fix this be sure to
-        # check that it does not break GST.
-        #
-        # The bug causes file paths such as c:\foo to get escaped
-        # into c:\\foo.
-        #
-        # Unfortunately we have not been able to come up with an
-        # isolated test case for this so unless you manage to come up
-        # with one, the only way is to test the building with Gst's
-        # setup. Note this in your MR or ping us and we will get it
-        # fixed.
-        #
-        # https://github.com/mesonbuild/meson/pull/737
-        cmd = [i.replace('\\', '/') for i in cmd]
-        return inputs, outputs, cmd
-
-    def run_postconf_scripts(self):
-        env = {'MESON_SOURCE_ROOT': self.environment.get_source_dir(),
-               'MESON_BUILD_ROOT': self.environment.get_build_dir(),
-               'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in self.environment.get_build_command() + ['introspect']]),
-               }
-        child_env = os.environ.copy()
-        child_env.update(env)
-
-        for s in self.build.postconf_scripts:
-            cmd = s['exe'] + s['args']
-            subprocess.check_call(cmd, env=child_env)
-
-    def create_install_data(self):
-        strip_bin = self.environment.lookup_binary_entry(MachineChoice.HOST, 'strip')
-        if strip_bin is None:
-            if self.environment.is_cross_build():
-                mlog.warning('Cross file does not specify strip binary, result will not be stripped.')
-            else:
-                # TODO go through all candidates, like others
-                strip_bin = [self.environment.default_strip[0]]
-        d = InstallData(self.environment.get_source_dir(),
-                        self.environment.get_build_dir(),
-                        self.environment.get_prefix(),
-                        strip_bin,
-                        self.environment.coredata.get_builtin_option('install_umask'),
-                        self.environment.get_build_command() + ['introspect'])
-        self.generate_depmf_install(d)
-        self.generate_target_install(d)
-        self.generate_header_install(d)
-        self.generate_man_install(d)
-        self.generate_data_install(d)
-        self.generate_custom_install_script(d)
-        self.generate_subdir_install(d)
-        return d
-
-    def create_install_data_files(self):
-        install_data_file = os.path.join(self.environment.get_scratch_dir(), 'install.dat')
-        with open(install_data_file, 'wb') as ofile:
-            pickle.dump(self.create_install_data(), ofile)
-
-    def generate_target_install(self, d):
-        for t in self.build.get_targets().values():
-            if not t.should_install():
-                continue
-            outdirs, custom_install_dir = t.get_install_dir(self.environment)
-            # Sanity-check the outputs and install_dirs
-            num_outdirs, num_out = len(outdirs), len(t.get_outputs())
-            if num_outdirs != 1 and num_outdirs != num_out:
-                m = 'Target {!r} has {} outputs: {!r}, but only {} "install_dir"s were found.\n' \
-                    "Pass 'false' for outputs that should not be installed and 'true' for\n" \
-                    'using the default installation directory for an output.'
-                raise MesonException(m.format(t.name, num_out, t.get_outputs(), num_outdirs))
-            install_mode = t.get_custom_install_mode()
-            # Install the target output(s)
-            if isinstance(t, build.BuildTarget):
-                # In general, stripping static archives is tricky and full of pitfalls.
-                # Wholesale stripping of static archives with a command such as
-                #
-                #   strip libfoo.a
-                #
-                # is broken, as GNU's strip will remove *every* symbol in a static
-                # archive. One solution to this nonintuitive behaviour would be
-                # to only strip local/debug symbols. Unfortunately, strip arguments
-                # are not specified by POSIX and therefore not portable. GNU's `-g`
-                # option (i.e. remove debug symbols) is equivalent to Apple's `-S`.
-                #
-                # TODO: Create GNUStrip/AppleStrip/etc. hierarchy for more
-                #       fine-grained stripping of static archives.
-                should_strip = not isinstance(t, build.StaticLibrary) and self.get_option_for_target('strip', t)
-                # Install primary build output (library/executable/jar, etc)
-                # Done separately because of strip/aliases/rpath
-                if outdirs[0] is not False:
-                    mappings = t.get_link_deps_mapping(d.prefix, self.environment)
-                    i = TargetInstallData(self.get_target_filename(t), outdirs[0],
-                                          t.get_aliases(), should_strip, mappings,
-                                          t.rpath_dirs_to_remove,
-                                          t.install_rpath, install_mode)
-                    d.targets.append(i)
-
-                    if isinstance(t, (build.SharedLibrary, build.SharedModule, build.Executable)):
-                        # On toolchains/platforms that use an import library for
-                        # linking (separate from the shared library with all the
-                        # code), we need to install that too (dll.a/.lib).
-                        if t.get_import_filename():
-                            if custom_install_dir:
-                                # If the DLL is installed into a custom directory,
-                                # install the import library into the same place so
-                                # it doesn't go into a surprising place
-                                implib_install_dir = outdirs[0]
-                            else:
-                                implib_install_dir = self.environment.get_import_lib_dir()
-                            # Install the import library; may not exist for shared modules
-                            i = TargetInstallData(self.get_target_filename_for_linking(t),
-                                                  implib_install_dir, {}, False, {}, set(), '', install_mode,
-                                                  optional=isinstance(t, build.SharedModule))
-                            d.targets.append(i)
-
-                        if not should_strip and t.get_debug_filename():
-                            debug_file = os.path.join(self.get_target_dir(t), t.get_debug_filename())
-                            i = TargetInstallData(debug_file, outdirs[0],
-                                                  {}, False, {}, set(), '',
-                                                  install_mode, optional=True)
-                            d.targets.append(i)
-                # Install secondary outputs. Only used for Vala right now.
-                if num_outdirs > 1:
-                    for output, outdir in zip(t.get_outputs()[1:], outdirs[1:]):
-                        # User requested that we not install this output
-                        if outdir is False:
-                            continue
-                        f = os.path.join(self.get_target_dir(t), output)
-                        i = TargetInstallData(f, outdir, {}, False, {}, set(), None, install_mode)
-                        d.targets.append(i)
-            elif isinstance(t, build.CustomTarget):
-                # If only one install_dir is specified, assume that all
-                # outputs will be installed into it. This is for
-                # backwards-compatibility and because it makes sense to
-                # avoid repetition since this is a common use-case.
-                #
-                # To selectively install only some outputs, pass `false` as
-                # the install_dir for the corresponding output by index
-                if num_outdirs == 1 and num_out > 1:
-                    for output in t.get_outputs():
-                        f = os.path.join(self.get_target_dir(t), output)
-                        i = TargetInstallData(f, outdirs[0], {}, False, {}, set(), None, install_mode,
-                                              optional=not t.build_by_default)
-                        d.targets.append(i)
-                else:
-                    for output, outdir in zip(t.get_outputs(), outdirs):
-                        # User requested that we not install this output
-                        if outdir is False:
-                            continue
-                        f = os.path.join(self.get_target_dir(t), output)
-                        i = TargetInstallData(f, outdir, {}, False, {}, set(), None, install_mode,
-                                              optional=not t.build_by_default)
-                        d.targets.append(i)
-
-    def generate_custom_install_script(self, d):
-        result = []
-        srcdir = self.environment.get_source_dir()
-        builddir = self.environment.get_build_dir()
-        for i in self.build.install_scripts:
-            exe = i['exe']
-            args = i['args']
-            fixed_args = []
-            for a in args:
-                a = a.replace('@SOURCE_ROOT@', srcdir)
-                a = a.replace('@BUILD_ROOT@', builddir)
-                fixed_args.append(a)
-            result.append(build.RunScript(exe, fixed_args))
-        d.install_scripts = result
-
-    def generate_header_install(self, d):
-        incroot = self.environment.get_includedir()
-        headers = self.build.get_headers()
-
-        srcdir = self.environment.get_source_dir()
-        builddir = self.environment.get_build_dir()
-        for h in headers:
-            outdir = h.get_custom_install_dir()
-            if outdir is None:
-                outdir = os.path.join(incroot, h.get_install_subdir())
-            for f in h.get_sources():
-                if not isinstance(f, File):
-                    msg = 'Invalid header type {!r} can\'t be installed'
-                    raise MesonException(msg.format(f))
-                abspath = f.absolute_path(srcdir, builddir)
-                i = [abspath, outdir, h.get_custom_install_mode()]
-                d.headers.append(i)
-
-    def generate_man_install(self, d):
-        manroot = self.environment.get_mandir()
-        man = self.build.get_man()
-        for m in man:
-            for f in m.get_sources():
-                num = f.split('.')[-1]
-                subdir = m.get_custom_install_dir()
-                if subdir is None:
-                    subdir = os.path.join(manroot, 'man' + num)
-                srcabs = f.absolute_path(self.environment.get_source_dir(), self.environment.get_build_dir())
-                dstabs = os.path.join(subdir, os.path.basename(f.fname))
-                i = [srcabs, dstabs, m.get_custom_install_mode()]
-                d.man.append(i)
-
-    def generate_data_install(self, d):
-        data = self.build.get_data()
-        srcdir = self.environment.get_source_dir()
-        builddir = self.environment.get_build_dir()
-        for de in data:
-            assert(isinstance(de, build.Data))
-            subdir = de.install_dir
-            if not subdir:
-                subdir = os.path.join(self.environment.get_datadir(), self.interpreter.build.project_name)
-            for src_file, dst_name in zip(de.sources, de.rename):
-                assert(isinstance(src_file, mesonlib.File))
-                dst_abs = os.path.join(subdir, dst_name)
-                i = [src_file.absolute_path(srcdir, builddir), dst_abs, de.install_mode]
-                d.data.append(i)
-
-    def generate_subdir_install(self, d):
-        for sd in self.build.get_install_subdirs():
-            src_dir = os.path.join(self.environment.get_source_dir(),
-                                   sd.source_subdir,
-                                   sd.installable_subdir).rstrip('/')
-            dst_dir = os.path.join(self.environment.get_prefix(),
-                                   sd.install_dir)
-            if not sd.strip_directory:
-                dst_dir = os.path.join(dst_dir, os.path.basename(src_dir))
-            d.install_subdirs.append([src_dir, dst_dir, sd.install_mode,
-                                      sd.exclude])
-
-    def get_introspection_data(self, target_id, target):
-        '''
-        Returns a list of source dicts with the following format for a given target:
-        [
-            {
-                "language": "<LANG>",
-                "compiler": ["result", "of", "comp.get_exelist()"],
-                "parameters": ["list", "of", "compiler", "parameters],
-                "sources": ["list", "of", "all", "<LANG>", "source", "files"],
-                "generated_sources": ["list", "of", "generated", "source", "files"]
-            }
-        ]
-
-        This is a limited fallback / reference implementation. The backend should override this method.
-        '''
-        if isinstance(target, (build.CustomTarget, build.BuildTarget)):
-            source_list_raw = target.sources + target.extra_files
-            source_list = []
-            for j in source_list_raw:
-                if isinstance(j, mesonlib.File):
-                    source_list += [j.absolute_path(self.source_dir, self.build_dir)]
-                elif isinstance(j, str):
-                    source_list += [os.path.join(self.source_dir, j)]
-            source_list = list(map(lambda x: os.path.normpath(x), source_list))
-
-            compiler = []
-            if isinstance(target, build.CustomTarget):
-                tmp_compiler = target.command
-                if not isinstance(compiler, list):
-                    tmp_compiler = [compiler]
-                for j in tmp_compiler:
-                    if isinstance(j, mesonlib.File):
-                        compiler += [j.absolute_path(self.source_dir, self.build_dir)]
-                    elif isinstance(j, str):
-                        compiler += [j]
-                    elif isinstance(j, (build.BuildTarget, build.CustomTarget)):
-                        compiler += j.get_outputs()
-                    else:
-                        raise RuntimeError('Type "{}" is not supported in get_introspection_data. This is a bug'.format(type(j).__name__))
-
-            return [{
-                'language': 'unknown',
-                'compiler': compiler,
-                'parameters': [],
-                'sources': source_list,
-                'generated_sources': []
-            }]
-
-        return []
diff --git a/meson/mesonbuild/backend/ninjabackend.py b/meson/mesonbuild/backend/ninjabackend.py
deleted file mode 100644 (file)
index 8afb80e..0000000
+++ /dev/null
@@ -1,3098 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import typing as T
-import os
-import re
-import pickle
-import shlex
-import subprocess
-from collections import OrderedDict
-from enum import Enum, unique
-import itertools
-from pathlib import PurePath, Path
-from functools import lru_cache
-
-from . import backends
-from .. import modules
-from .. import environment, mesonlib
-from .. import build
-from .. import mlog
-from .. import dependencies
-from .. import compilers
-from ..arglist import CompilerArgs
-from ..compilers import (
-    Compiler, CCompiler,
-    DmdDCompiler,
-    FortranCompiler, PGICCompiler,
-    VisualStudioCsCompiler,
-    VisualStudioLikeCompiler,
-)
-from ..linkers import ArLinker, VisualStudioLinker
-from ..mesonlib import (
-    File, LibType, MachineChoice, MesonException, OrderedSet, PerMachine,
-    ProgressBar, quote_arg, unholder,
-)
-from ..mesonlib import get_compiler_for_source, has_path_sep
-from .backends import CleanTrees
-from ..build import InvalidArguments
-from ..interpreter import Interpreter
-
-FORTRAN_INCLUDE_PAT = r"^\s*#?include\s*['\"](\w+\.\w+)['\"]"
-FORTRAN_MODULE_PAT = r"^\s*\bmodule\b\s+(\w+)\s*(?:!+.*)*$"
-FORTRAN_SUBMOD_PAT = r"^\s*\bsubmodule\b\s*\((\w+:?\w+)\)\s*(\w+)"
-FORTRAN_USE_PAT = r"^\s*use,?\s*(?:non_intrinsic)?\s*(?:::)?\s*(\w+)"
-
-def cmd_quote(s):
-    # see: https://docs.microsoft.com/en-us/windows/desktop/api/shellapi/nf-shellapi-commandlinetoargvw#remarks
-
-    # backslash escape any existing double quotes
-    # any existing backslashes preceding a quote are doubled
-    s = re.sub(r'(\\*)"', lambda m: '\\' * (len(m.group(1)) * 2 + 1) + '"', s)
-    # any terminal backslashes likewise need doubling
-    s = re.sub(r'(\\*)$', lambda m: '\\' * (len(m.group(1)) * 2), s)
-    # and double quote
-    s = '"{}"'.format(s)
-
-    return s
-
-def gcc_rsp_quote(s):
-    # see: the function buildargv() in libiberty
-    #
-    # this differs from sh-quoting in that a backslash *always* escapes the
-    # following character, even inside single quotes.
-
-    s = s.replace('\\', '\\\\')
-
-    return shlex.quote(s)
-
-# How ninja executes command lines differs between Unix and Windows
-# (see https://ninja-build.org/manual.html#ref_rule_command)
-if mesonlib.is_windows():
-    quote_func = cmd_quote
-    execute_wrapper = ['cmd', '/c']  # unused
-    rmfile_prefix = ['del', '/f', '/s', '/q', '{}', '&&']
-else:
-    quote_func = quote_arg
-    execute_wrapper = []
-    rmfile_prefix = ['rm', '-f', '{}', '&&']
-
-def get_rsp_threshold():
-    '''Return a conservative estimate of the commandline size in bytes
-    above which a response file should be used.  May be overridden for
-    debugging by setting environment variable MESON_RSP_THRESHOLD.'''
-
-    if mesonlib.is_windows():
-        # Usually 32k, but some projects might use cmd.exe,
-        # and that has a limit of 8k.
-        limit = 8192
-    else:
-        # On Linux, ninja always passes the commandline as a single
-        # big string to /bin/sh, and the kernel limits the size of a
-        # single argument; see MAX_ARG_STRLEN
-        limit = 131072
-    # Be conservative
-    limit = limit / 2
-    return int(os.environ.get('MESON_RSP_THRESHOLD', limit))
-
-# a conservative estimate of the command-line length limit
-rsp_threshold = get_rsp_threshold()
-
-# ninja variables whose value should remain unquoted. The value of these ninja
-# variables (or variables we use them in) is interpreted directly by ninja
-# (e.g. the value of the depfile variable is a pathname that ninja will read
-# from, etc.), so it must not be shell quoted.
-raw_names = {'DEPFILE_UNQUOTED', 'DESC', 'pool', 'description', 'targetdep'}
-
-def ninja_quote(text, is_build_line=False):
-    if is_build_line:
-        qcs = ('$', ' ', ':')
-    else:
-        qcs = ('$', ' ')
-    for char in qcs:
-        text = text.replace(char, '$' + char)
-    if '\n' in text:
-        errmsg = '''Ninja does not support newlines in rules. The content was:
-
-{}
-
-Please report this error with a test case to the Meson bug tracker.'''.format(text)
-        raise MesonException(errmsg)
-    return text
-
-@unique
-class Quoting(Enum):
-    both = 0
-    notShell = 1
-    notNinja = 2
-    none = 3
-
-class NinjaCommandArg:
-    def __init__(self, s, quoting = Quoting.both):
-        self.s = s
-        self.quoting = quoting
-
-    def __str__(self):
-        return self.s
-
-    @staticmethod
-    def list(l, q):
-        return [NinjaCommandArg(i, q) for i in l]
-
-class NinjaComment:
-    def __init__(self, comment):
-        self.comment = comment
-
-    def write(self, outfile):
-        for l in self.comment.split('\n'):
-            outfile.write('# ')
-            outfile.write(l)
-            outfile.write('\n')
-        outfile.write('\n')
-
-class NinjaRule:
-    def __init__(self, rule, command, args, description,
-                 rspable = False, deps = None, depfile = None, extra = None,
-                 rspfile_quote_style = 'gcc'):
-
-        def strToCommandArg(c):
-            if isinstance(c, NinjaCommandArg):
-                return c
-
-            # deal with common cases here, so we don't have to explicitly
-            # annotate the required quoting everywhere
-            if c == '&&':
-                # shell constructs shouldn't be shell quoted
-                return NinjaCommandArg(c, Quoting.notShell)
-            if c.startswith('$'):
-                var = re.search(r'\$\{?(\w*)\}?', c).group(1)
-                if var not in raw_names:
-                    # ninja variables shouldn't be ninja quoted, and their value
-                    # is already shell quoted
-                    return NinjaCommandArg(c, Quoting.none)
-                else:
-                    # shell quote the use of ninja variables whose value must
-                    # not be shell quoted (as it also used by ninja)
-                    return NinjaCommandArg(c, Quoting.notNinja)
-
-            return NinjaCommandArg(c)
-
-        self.name = rule
-        self.command = list(map(strToCommandArg, command))  # includes args which never go into a rspfile
-        self.args = list(map(strToCommandArg, args))  # args which will go into a rspfile, if used
-        self.description = description
-        self.deps = deps  # depstyle 'gcc' or 'msvc'
-        self.depfile = depfile
-        self.extra = extra
-        self.rspable = rspable  # if a rspfile can be used
-        self.refcount = 0
-        self.rsprefcount = 0
-        self.rspfile_quote_style = rspfile_quote_style  # rspfile quoting style is 'gcc' or 'cl'
-
-        if self.depfile == '$DEPFILE':
-            self.depfile += '_UNQUOTED'
-
-    @staticmethod
-    def _quoter(x, qf = quote_func):
-        if isinstance(x, NinjaCommandArg):
-            if x.quoting == Quoting.none:
-                return x.s
-            elif x.quoting == Quoting.notNinja:
-                return qf(x.s)
-            elif x.quoting == Quoting.notShell:
-                return ninja_quote(x.s)
-            # fallthrough
-        return ninja_quote(qf(str(x)))
-
-    def write(self, outfile):
-        if self.rspfile_quote_style == 'cl':
-            rspfile_quote_func = cmd_quote
-        else:
-            rspfile_quote_func = gcc_rsp_quote
-
-        def rule_iter():
-            if self.refcount:
-                yield ''
-            if self.rsprefcount:
-                yield '_RSP'
-
-        for rsp in rule_iter():
-            outfile.write('rule {}{}\n'.format(self.name, rsp))
-            if rsp == '_RSP':
-                outfile.write(' command = {} @$out.rsp\n'.format(' '.join([self._quoter(x) for x in self.command])))
-                outfile.write(' rspfile = $out.rsp\n')
-                outfile.write(' rspfile_content = {}\n'.format(' '.join([self._quoter(x, rspfile_quote_func) for x in self.args])))
-            else:
-                outfile.write(' command = {}\n'.format(' '.join([self._quoter(x) for x in (self.command + self.args)])))
-            if self.deps:
-                outfile.write(' deps = {}\n'.format(self.deps))
-            if self.depfile:
-                outfile.write(' depfile = {}\n'.format(self.depfile))
-            outfile.write(' description = {}\n'.format(self.description))
-            if self.extra:
-                for l in self.extra.split('\n'):
-                    outfile.write(' ')
-                    outfile.write(l)
-                    outfile.write('\n')
-            outfile.write('\n')
-
-    def length_estimate(self, infiles, outfiles, elems):
-        # determine variables
-        # this order of actions only approximates ninja's scoping rules, as
-        # documented at: https://ninja-build.org/manual.html#ref_scope
-        ninja_vars = {}
-        for e in elems:
-            (name, value) = e
-            ninja_vars[name] = value
-        ninja_vars['deps'] = self.deps
-        ninja_vars['depfile'] = self.depfile
-        ninja_vars['in'] = infiles
-        ninja_vars['out'] = outfiles
-
-        # expand variables in command
-        command = ' '.join([self._quoter(x) for x in self.command + self.args])
-        expanded_command = ''
-        for m in re.finditer(r'(\${\w*})|(\$\w*)|([^$]*)', command):
-            chunk = m.group()
-            if chunk.startswith('$'):
-                chunk = chunk[1:]
-                chunk = re.sub(r'{(.*)}', r'\1', chunk)
-                chunk = ninja_vars.get(chunk, [])  # undefined ninja variables are empty
-                chunk = ' '.join(chunk)
-            expanded_command += chunk
-
-        # determine command length
-        return len(expanded_command)
-
-class NinjaBuildElement:
-    def __init__(self, all_outputs, outfilenames, rulename, infilenames, implicit_outs=None):
-        self.implicit_outfilenames = implicit_outs or []
-        if isinstance(outfilenames, str):
-            self.outfilenames = [outfilenames]
-        else:
-            self.outfilenames = outfilenames
-        assert(isinstance(rulename, str))
-        self.rulename = rulename
-        if isinstance(infilenames, str):
-            self.infilenames = [infilenames]
-        else:
-            self.infilenames = infilenames
-        self.deps = OrderedSet()
-        self.orderdeps = OrderedSet()
-        self.elems = []
-        self.all_outputs = all_outputs
-
-    def add_dep(self, dep):
-        if isinstance(dep, list):
-            self.deps.update(dep)
-        else:
-            self.deps.add(dep)
-
-    def add_orderdep(self, dep):
-        if isinstance(dep, list):
-            self.orderdeps.update(dep)
-        else:
-            self.orderdeps.add(dep)
-
-    def add_item(self, name, elems):
-        # Always convert from GCC-style argument naming to the naming used by the
-        # current compiler. Also filter system include paths, deduplicate, etc.
-        if isinstance(elems, CompilerArgs):
-            elems = elems.to_native()
-        if isinstance(elems, str):
-            elems = [elems]
-        self.elems.append((name, elems))
-
-        if name == 'DEPFILE':
-            self.elems.append((name + '_UNQUOTED', elems))
-
-    def _should_use_rspfile(self):
-        # 'phony' is a rule built-in to ninja
-        if self.rulename == 'phony':
-            return False
-
-        if not self.rule.rspable:
-            return False
-
-        infilenames = ' '.join([ninja_quote(i, True) for i in self.infilenames])
-        outfilenames = ' '.join([ninja_quote(i, True) for i in self.outfilenames])
-
-        return self.rule.length_estimate(infilenames,
-                                         outfilenames,
-                                         self.elems) >= rsp_threshold
-
-    def count_rule_references(self):
-        if self.rulename != 'phony':
-            if self._should_use_rspfile():
-                self.rule.rsprefcount += 1
-            else:
-                self.rule.refcount += 1
-
-    def write(self, outfile):
-        self.check_outputs()
-        ins = ' '.join([ninja_quote(i, True) for i in self.infilenames])
-        outs = ' '.join([ninja_quote(i, True) for i in self.outfilenames])
-        implicit_outs = ' '.join([ninja_quote(i, True) for i in self.implicit_outfilenames])
-        if implicit_outs:
-            implicit_outs = ' | ' + implicit_outs
-        use_rspfile = self._should_use_rspfile()
-        if use_rspfile:
-            rulename = self.rulename + '_RSP'
-            mlog.debug("Command line for building %s is long, using a response file" % self.outfilenames)
-        else:
-            rulename = self.rulename
-        line = 'build {}{}: {} {}'.format(outs, implicit_outs, rulename, ins)
-        if len(self.deps) > 0:
-            line += ' | ' + ' '.join([ninja_quote(x, True) for x in self.deps])
-        if len(self.orderdeps) > 0:
-            line += ' || ' + ' '.join([ninja_quote(x, True) for x in self.orderdeps])
-        line += '\n'
-        # This is the only way I could find to make this work on all
-        # platforms including Windows command shell. Slash is a dir separator
-        # on Windows, too, so all characters are unambiguous and, more importantly,
-        # do not require quoting, unless explicitly specified, which is necessary for
-        # the csc compiler.
-        line = line.replace('\\', '/')
-        outfile.write(line)
-
-        if use_rspfile:
-            if self.rule.rspfile_quote_style == 'cl':
-                qf = cmd_quote
-            else:
-                qf = gcc_rsp_quote
-        else:
-            qf = quote_func
-
-        for e in self.elems:
-            (name, elems) = e
-            should_quote = name not in raw_names
-            line = ' {} = '.format(name)
-            newelems = []
-            for i in elems:
-                if not should_quote or i == '&&': # Hackety hack hack
-                    quoter = ninja_quote
-                else:
-                    quoter = lambda x: ninja_quote(qf(x))
-                newelems.append(quoter(i))
-            line += ' '.join(newelems)
-            line += '\n'
-            outfile.write(line)
-        outfile.write('\n')
-
-    def check_outputs(self):
-        for n in self.outfilenames:
-            if n in self.all_outputs:
-                raise MesonException('Multiple producers for Ninja target "{}". Please rename your targets.'.format(n))
-            self.all_outputs[n] = True
-
-class NinjaBackend(backends.Backend):
-
-    def __init__(self, build: T.Optional[build.Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'ninja'
-        self.ninja_filename = 'build.ninja'
-        self.fortran_deps = {}
-        self.all_outputs = {}
-        self.introspection_data = {}
-        self.created_llvm_ir_rule = PerMachine(False, False)
-
-    def create_target_alias(self, to_target):
-        # We need to use aliases for targets that might be used as directory
-        # names to workaround a Ninja bug that breaks `ninja -t clean`.
-        # This is used for 'reserved' targets such as 'test', 'install',
-        # 'benchmark', etc, and also for RunTargets.
-        # https://github.com/mesonbuild/meson/issues/1644
-        if not to_target.startswith('meson-'):
-            m = 'Invalid usage of create_target_alias with {!r}'
-            raise AssertionError(m.format(to_target))
-        from_target = to_target[len('meson-'):]
-        elem = NinjaBuildElement(self.all_outputs, from_target, 'phony', to_target)
-        self.add_build(elem)
-
-    def detect_vs_dep_prefix(self, tempfilename):
-        '''VS writes its dependency in a locale dependent format.
-        Detect the search prefix to use.'''
-        # TODO don't hard-code host
-        for compiler in self.environment.coredata.compilers.host.values():
-            # Have to detect the dependency format
-
-            # IFort on windows is MSVC like, but doesn't have /showincludes
-            if isinstance(compiler, FortranCompiler):
-                continue
-            if isinstance(compiler, PGICCompiler) and mesonlib.is_windows():
-                # for the purpose of this function, PGI doesn't act enough like MSVC
-                return open(tempfilename, 'a', encoding='utf-8')
-            if isinstance(compiler, VisualStudioLikeCompiler):
-                break
-        else:
-            # None of our compilers are MSVC, we're done.
-            return open(tempfilename, 'a', encoding='utf-8')
-        filename = os.path.join(self.environment.get_scratch_dir(),
-                                'incdetect.c')
-        with open(filename, 'w') as f:
-            f.write('''#include<stdio.h>
-int dummy;
-''')
-
-        # The output of cl dependency information is language
-        # and locale dependent. Any attempt at converting it to
-        # Python strings leads to failure. We _must_ do this detection
-        # in raw byte mode and write the result in raw bytes.
-        pc = subprocess.Popen(compiler.get_exelist() +
-                              ['/showIncludes', '/c', 'incdetect.c'],
-                              cwd=self.environment.get_scratch_dir(),
-                              stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        (stdout, stderr) = pc.communicate()
-
-        # We want to match 'Note: including file: ' in the line
-        # 'Note: including file: d:\MyDir\include\stdio.h', however
-        # different locales have different messages with a different
-        # number of colons. Match up to the the drive name 'd:\'.
-        # When used in cross compilation, the path separator is a
-        # backslash rather than a forward slash so handle both.
-        matchre = re.compile(rb"^(.*\s)([a-zA-Z]:\\|\/).*stdio.h$")
-
-        def detect_prefix(out):
-            for line in re.split(rb'\r?\n', out):
-                match = matchre.match(line)
-                if match:
-                    with open(tempfilename, 'ab') as binfile:
-                        binfile.write(b'msvc_deps_prefix = ' + match.group(1) + b'\n')
-                    return open(tempfilename, 'a', encoding='utf-8')
-            return None
-
-        # Some cl wrappers (e.g. Squish Coco) output dependency info
-        # to stderr rather than stdout
-        result = detect_prefix(stdout) or detect_prefix(stderr)
-        if result:
-            return result
-
-        raise MesonException('Could not determine vs dep dependency prefix string.')
-
-    def generate(self):
-        ninja = environment.detect_ninja_command_and_version(log=True)
-        if ninja is None:
-            raise MesonException('Could not detect Ninja v1.7 or newer')
-        (self.ninja_command, self.ninja_version) = ninja
-        outfilename = os.path.join(self.environment.get_build_dir(), self.ninja_filename)
-        tempfilename = outfilename + '~'
-        with open(tempfilename, 'w', encoding='utf-8') as outfile:
-            outfile.write('# This is the build file for project "{}"\n'.format(self.build.get_project()))
-            outfile.write('# It is autogenerated by the Meson build system.\n')
-            outfile.write('# Do not edit by hand.\n\n')
-            outfile.write('ninja_required_version = 1.7.1\n\n')
-
-            num_pools = self.environment.coredata.backend_options['backend_max_links'].value
-            if num_pools > 0:
-                outfile.write('''pool link_pool
-  depth = {}
-
-'''.format(num_pools))
-
-        with self.detect_vs_dep_prefix(tempfilename) as outfile:
-            self.generate_rules()
-
-            self.build_elements = []
-            self.generate_phony()
-            self.add_build_comment(NinjaComment('Build rules for targets'))
-            for t in ProgressBar(self.build.get_targets().values(), desc='Generating targets'):
-                self.generate_target(t)
-            self.add_build_comment(NinjaComment('Test rules'))
-            self.generate_tests()
-            self.add_build_comment(NinjaComment('Install rules'))
-            self.generate_install()
-            self.generate_dist()
-            if 'b_coverage' in self.environment.coredata.base_options and \
-                    self.environment.coredata.base_options['b_coverage'].value:
-                self.add_build_comment(NinjaComment('Coverage rules'))
-                self.generate_coverage_rules()
-            self.add_build_comment(NinjaComment('Suffix'))
-            self.generate_utils()
-            self.generate_ending()
-
-            self.write_rules(outfile)
-            self.write_builds(outfile)
-
-            default = 'default all\n\n'
-            outfile.write(default)
-        # Only overwrite the old build file after the new one has been
-        # fully created.
-        os.replace(tempfilename, outfilename)
-        mlog.cmd_ci_include(outfilename)  # For CI debugging
-        self.generate_compdb()
-
-    # http://clang.llvm.org/docs/JSONCompilationDatabase.html
-    def generate_compdb(self):
-        rules = []
-        # TODO: Rather than an explicit list here, rules could be marked in the
-        # rule store as being wanted in compdb
-        for for_machine in MachineChoice:
-            for lang in self.environment.coredata.compilers[for_machine]:
-                rules += [ "%s%s" % (rule, ext) for rule in [self.get_compiler_rule_name(lang, for_machine)]
-                                                for ext in ['', '_RSP']]
-                rules += [ "%s%s" % (rule, ext) for rule in [self.get_pch_rule_name(lang, for_machine)]
-                                                for ext in ['', '_RSP']]
-        compdb_options = ['-x'] if mesonlib.version_compare(self.ninja_version, '>=1.9') else []
-        ninja_compdb = self.ninja_command + ['-t', 'compdb'] + compdb_options + rules
-        builddir = self.environment.get_build_dir()
-        try:
-            jsondb = subprocess.check_output(ninja_compdb, cwd=builddir)
-            with open(os.path.join(builddir, 'compile_commands.json'), 'wb') as f:
-                f.write(jsondb)
-        except Exception:
-            mlog.warning('Could not create compilation database.')
-
-    # Get all generated headers. Any source file might need them so
-    # we need to add an order dependency to them.
-    def get_generated_headers(self, target):
-        if hasattr(target, 'cached_generated_headers'):
-            return target.cached_generated_headers
-        header_deps = []
-        # XXX: Why don't we add deps to CustomTarget headers here?
-        for genlist in target.get_generated_sources():
-            if isinstance(genlist, (build.CustomTarget, build.CustomTargetIndex)):
-                continue
-            for src in genlist.get_outputs():
-                if self.environment.is_header(src):
-                    header_deps.append(self.get_target_generated_dir(target, genlist, src))
-        if 'vala' in target.compilers and not isinstance(target, build.Executable):
-            vala_header = File.from_built_file(self.get_target_dir(target), target.vala_header)
-            header_deps.append(vala_header)
-        # Recurse and find generated headers
-        for dep in itertools.chain(target.link_targets, target.link_whole_targets):
-            if isinstance(dep, (build.StaticLibrary, build.SharedLibrary)):
-                header_deps += self.get_generated_headers(dep)
-        target.cached_generated_headers = header_deps
-        return header_deps
-
-    def get_target_generated_sources(self, target):
-        """
-        Returns a dictionary with the keys being the path to the file
-        (relative to the build directory) of that type and the value
-        being the GeneratorList or CustomTarget that generated it.
-        """
-        srcs = OrderedDict()
-        for gensrc in target.get_generated_sources():
-            for s in gensrc.get_outputs():
-                f = self.get_target_generated_dir(target, gensrc, s)
-                srcs[f] = s
-        return srcs
-
-    def get_target_sources(self, target):
-        srcs = OrderedDict()
-        for s in target.get_sources():
-            # BuildTarget sources are always mesonlib.File files which are
-            # either in the source root, or generated with configure_file and
-            # in the build root
-            if not isinstance(s, File):
-                raise InvalidArguments('All sources in target {!r} must be of type mesonlib.File'.format(s))
-            f = s.rel_to_builddir(self.build_to_src)
-            srcs[f] = s
-        return srcs
-
-    # Languages that can mix with C or C++ but don't support unity builds yet
-    # because the syntax we use for unity builds is specific to C/++/ObjC/++.
-    # Assembly files cannot be unitified and neither can LLVM IR files
-    langs_cant_unity = ('d', 'fortran')
-
-    def get_target_source_can_unity(self, target, source):
-        if isinstance(source, File):
-            source = source.fname
-        if self.environment.is_llvm_ir(source) or \
-           self.environment.is_assembly(source):
-            return False
-        suffix = os.path.splitext(source)[1][1:]
-        for lang in self.langs_cant_unity:
-            if lang not in target.compilers:
-                continue
-            if suffix in target.compilers[lang].file_suffixes:
-                return False
-        return True
-
-    def create_target_source_introspection(self, target: build.Target, comp: compilers.Compiler, parameters, sources, generated_sources):
-        '''
-        Adds the source file introspection information for a language of a target
-
-        Internal introspection storage formart:
-        self.introspection_data = {
-            '<target ID>': {
-                <id tuple>: {
-                    'language: 'lang',
-                    'compiler': ['comp', 'exe', 'list'],
-                    'parameters': ['UNIQUE', 'parameter', 'list'],
-                    'sources': [],
-                    'generated_sources': [],
-                }
-            }
-        }
-        '''
-        tid = target.get_id()
-        lang = comp.get_language()
-        tgt = self.introspection_data[tid]
-        # Find an existing entry or create a new one
-        id_hash = (lang, tuple(parameters))
-        src_block = tgt.get(id_hash, None)
-        if src_block is None:
-            # Convert parameters
-            if isinstance(parameters, CompilerArgs):
-                parameters = parameters.to_native(copy=True)
-            parameters = comp.compute_parameters_with_absolute_paths(parameters, self.build_dir)
-            # The new entry
-            src_block = {
-                'language': lang,
-                'compiler': comp.get_exelist(),
-                'parameters': parameters,
-                'sources': [],
-                'generated_sources': [],
-            }
-            tgt[id_hash] = src_block
-        # Make source files absolute
-        sources = [x.absolute_path(self.source_dir, self.build_dir) if isinstance(x, File) else os.path.normpath(os.path.join(self.build_dir, x))
-                   for x in sources]
-        generated_sources = [x.absolute_path(self.source_dir, self.build_dir) if isinstance(x, File) else os.path.normpath(os.path.join(self.build_dir, x))
-                             for x in generated_sources]
-        # Add the source files
-        src_block['sources'] += sources
-        src_block['generated_sources'] += generated_sources
-
-    def is_rust_target(self, target):
-        if len(target.sources) > 0:
-            first_file = target.sources[0]
-            if first_file.fname.endswith('.rs'):
-                return True
-        return False
-
-    def generate_target(self, target):
-        if isinstance(target, build.CustomTarget):
-            self.generate_custom_target(target)
-        if isinstance(target, build.RunTarget):
-            self.generate_run_target(target)
-        name = target.get_id()
-        if name in self.processed_targets:
-            return
-        self.processed_targets[name] = True
-        # Initialize an empty introspection source list
-        self.introspection_data[name] = {}
-        # Generate rules for all dependency targets
-        self.process_target_dependencies(target)
-        # If target uses a language that cannot link to C objects,
-        # just generate for that language and return.
-        if isinstance(target, build.Jar):
-            self.generate_jar_target(target)
-            return
-        if self.is_rust_target(target):
-            self.generate_rust_target(target)
-            return
-        if 'cs' in target.compilers:
-            self.generate_cs_target(target)
-            return
-        if 'swift' in target.compilers:
-            self.generate_swift_target(target)
-            return
-
-        # Now we handle the following languages:
-        # ObjC++, ObjC, C++, C, D, Fortran, Vala
-
-        # target_sources:
-        #   Pre-existing target C/C++ sources to be built; dict of full path to
-        #   source relative to build root and the original File object.
-        # generated_sources:
-        #   GeneratedList and CustomTarget sources to be built; dict of the full
-        #   path to source relative to build root and the generating target/list
-        # vala_generated_sources:
-        #   Array of sources generated by valac that have to be compiled
-        if 'vala' in target.compilers:
-            # Sources consumed by valac are filtered out. These only contain
-            # C/C++ sources, objects, generated libs, and unknown sources now.
-            target_sources, generated_sources, \
-                vala_generated_sources = self.generate_vala_compile(target)
-        else:
-            target_sources = self.get_target_sources(target)
-            generated_sources = self.get_target_generated_sources(target)
-            vala_generated_sources = []
-        self.scan_fortran_module_outputs(target)
-        # Generate rules for GeneratedLists
-        self.generate_generator_list_rules(target)
-
-        # Generate rules for building the remaining source files in this target
-        outname = self.get_target_filename(target)
-        obj_list = []
-        is_unity = self.is_unity(target)
-        header_deps = []
-        unity_src = []
-        unity_deps = [] # Generated sources that must be built before compiling a Unity target.
-        header_deps += self.get_generated_headers(target)
-
-        if is_unity:
-            # Warn about incompatible sources if a unity build is enabled
-            langs = set(target.compilers.keys())
-            langs_cant = langs.intersection(self.langs_cant_unity)
-            if langs_cant:
-                langs_are = langs = ', '.join(langs_cant).upper()
-                langs_are += ' are' if len(langs_cant) > 1 else ' is'
-                msg = '{} not supported in Unity builds yet, so {} ' \
-                      'sources in the {!r} target will be compiled normally' \
-                      ''.format(langs_are, langs, target.name)
-                mlog.log(mlog.red('FIXME'), msg)
-
-        # Get a list of all generated headers that will be needed while building
-        # this target's sources (generated sources and pre-existing sources).
-        # This will be set as dependencies of all the target's sources. At the
-        # same time, also deal with generated sources that need to be compiled.
-        generated_source_files = []
-        for rel_src in generated_sources.keys():
-            dirpart, fnamepart = os.path.split(rel_src)
-            raw_src = File(True, dirpart, fnamepart)
-            if self.environment.is_source(rel_src) and not self.environment.is_header(rel_src):
-                if is_unity and self.get_target_source_can_unity(target, rel_src):
-                    unity_deps.append(raw_src)
-                    abs_src = os.path.join(self.environment.get_build_dir(), rel_src)
-                    unity_src.append(abs_src)
-                else:
-                    generated_source_files.append(raw_src)
-            elif self.environment.is_object(rel_src):
-                obj_list.append(rel_src)
-            elif self.environment.is_library(rel_src) or modules.is_module_library(rel_src):
-                pass
-            else:
-                # Assume anything not specifically a source file is a header. This is because
-                # people generate files with weird suffixes (.inc, .fh) that they then include
-                # in their source files.
-                header_deps.append(raw_src)
-        # These are the generated source files that need to be built for use by
-        # this target. We create the Ninja build file elements for this here
-        # because we need `header_deps` to be fully generated in the above loop.
-        for src in generated_source_files:
-            if self.environment.is_llvm_ir(src):
-                o = self.generate_llvm_ir_compile(target, src)
-            else:
-                o = self.generate_single_compile(target, src, True,
-                                                 order_deps=header_deps)
-            obj_list.append(o)
-
-        use_pch = self.environment.coredata.base_options.get('b_pch', False)
-        if use_pch and target.has_pch():
-            pch_objects = self.generate_pch(target, header_deps=header_deps)
-        else:
-            pch_objects = []
-
-        # Generate compilation targets for C sources generated from Vala
-        # sources. This can be extended to other $LANG->C compilers later if
-        # necessary. This needs to be separate for at least Vala
-        vala_generated_source_files = []
-        for src in vala_generated_sources:
-            dirpart, fnamepart = os.path.split(src)
-            raw_src = File(True, dirpart, fnamepart)
-            if is_unity:
-                unity_src.append(os.path.join(self.environment.get_build_dir(), src))
-                header_deps.append(raw_src)
-            else:
-                # Generated targets are ordered deps because the must exist
-                # before the sources compiling them are used. After the first
-                # compile we get precise dependency info from dep files.
-                # This should work in all cases. If it does not, then just
-                # move them from orderdeps to proper deps.
-                if self.environment.is_header(src):
-                    header_deps.append(raw_src)
-                else:
-                    # We gather all these and generate compile rules below
-                    # after `header_deps` (above) is fully generated
-                    vala_generated_source_files.append(raw_src)
-        for src in vala_generated_source_files:
-            # Passing 'vala' here signifies that we want the compile
-            # arguments to be specialized for C code generated by
-            # valac. For instance, no warnings should be emitted.
-            obj_list.append(self.generate_single_compile(target, src, 'vala', [], header_deps))
-
-        # Generate compile targets for all the pre-existing sources for this target
-        for src in target_sources.values():
-            if not self.environment.is_header(src):
-                if self.environment.is_llvm_ir(src):
-                    obj_list.append(self.generate_llvm_ir_compile(target, src))
-                elif is_unity and self.get_target_source_can_unity(target, src):
-                    abs_src = os.path.join(self.environment.get_build_dir(),
-                                           src.rel_to_builddir(self.build_to_src))
-                    unity_src.append(abs_src)
-                else:
-                    obj_list.append(self.generate_single_compile(target, src, False, [], header_deps))
-        obj_list += self.flatten_object_list(target)
-        if is_unity:
-            for src in self.generate_unity_files(target, unity_src):
-                obj_list.append(self.generate_single_compile(target, src, True, unity_deps + header_deps))
-        linker, stdlib_args = self.determine_linker_and_stdlib_args(target)
-        elem = self.generate_link(target, outname, obj_list, linker, pch_objects, stdlib_args=stdlib_args)
-        self.generate_shlib_aliases(target, self.get_target_dir(target))
-        self.add_build(elem)
-
-    def process_target_dependencies(self, target):
-        for t in target.get_dependencies():
-            if t.get_id() not in self.processed_targets:
-                self.generate_target(t)
-
-    def custom_target_generator_inputs(self, target):
-        for s in unholder(target.sources):
-            if isinstance(s, build.GeneratedList):
-                self.generate_genlist_for_target(s, target)
-
-    def unwrap_dep_list(self, target):
-        deps = []
-        for i in target.get_dependencies():
-            # FIXME, should not grab element at zero but rather expand all.
-            if isinstance(i, list):
-                i = i[0]
-            # Add a dependency on all the outputs of this target
-            for output in i.get_outputs():
-                deps.append(os.path.join(self.get_target_dir(i), output))
-        return deps
-
-    def generate_custom_target(self, target):
-        self.custom_target_generator_inputs(target)
-        (srcs, ofilenames, cmd) = self.eval_custom_target_command(target)
-        deps = self.unwrap_dep_list(target)
-        deps += self.get_custom_target_depend_files(target)
-        desc = 'Generating {0} with a {1} command'
-        if target.build_always_stale:
-            deps.append('PHONY')
-        if target.depfile is None:
-            rulename = 'CUSTOM_COMMAND'
-        else:
-            rulename = 'CUSTOM_COMMAND_DEP'
-        elem = NinjaBuildElement(self.all_outputs, ofilenames, rulename, srcs)
-        elem.add_dep(deps)
-        for d in target.extra_depends:
-            # Add a dependency on all the outputs of this target
-            for output in d.get_outputs():
-                elem.add_dep(os.path.join(self.get_target_dir(d), output))
-
-        meson_exe_cmd = self.as_meson_exe_cmdline(target.name, target.command[0], cmd[1:],
-                                                  for_machine=target.for_machine,
-                                                  extra_bdeps=target.get_transitive_build_target_deps(),
-                                                  capture=ofilenames[0] if target.capture else None)
-        if meson_exe_cmd:
-            cmd = meson_exe_cmd
-            cmd_type = 'meson_exe.py custom'
-        else:
-            cmd_type = 'custom'
-        if target.depfile is not None:
-            depfile = target.get_dep_outname(elem.infilenames)
-            rel_dfile = os.path.join(self.get_target_dir(target), depfile)
-            abs_pdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
-            os.makedirs(abs_pdir, exist_ok=True)
-            elem.add_item('DEPFILE', rel_dfile)
-        if target.console:
-            elem.add_item('pool', 'console')
-        cmd = self.replace_paths(target, cmd)
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('description', desc.format(target.name, cmd_type))
-        self.add_build(elem)
-        self.processed_targets[target.get_id()] = True
-
-    def build_run_target_name(self, target):
-        if target.subproject != '':
-            subproject_prefix = '{}@@'.format(target.subproject)
-        else:
-            subproject_prefix = ''
-        return '{}{}'.format(subproject_prefix, target.name)
-
-    def generate_run_target(self, target):
-        cmd = self.environment.get_build_command() + ['--internal', 'commandrunner']
-        deps = self.unwrap_dep_list(target)
-        arg_strings = []
-        for i in target.args:
-            if isinstance(i, str):
-                arg_strings.append(i)
-            elif isinstance(i, (build.BuildTarget, build.CustomTarget)):
-                relfname = self.get_target_filename(i)
-                arg_strings.append(os.path.join(self.environment.get_build_dir(), relfname))
-                deps.append(relfname)
-            elif isinstance(i, mesonlib.File):
-                relfname = i.rel_to_builddir(self.build_to_src)
-                arg_strings.append(os.path.join(self.environment.get_build_dir(), relfname))
-            else:
-                raise AssertionError('Unreachable code in generate_run_target: ' + str(i))
-        cmd += [self.environment.get_source_dir(),
-                self.environment.get_build_dir(),
-                target.subdir] + self.environment.get_build_command()
-        texe = target.command
-        try:
-            texe = texe.held_object
-        except AttributeError:
-            pass
-        if isinstance(texe, build.Executable):
-            abs_exe = os.path.join(self.environment.get_build_dir(), self.get_target_filename(texe))
-            deps.append(self.get_target_filename(texe))
-            if self.environment.is_cross_build():
-                exe_wrap = self.environment.get_exe_wrapper()
-                if exe_wrap:
-                    if not exe_wrap.found():
-                        msg = 'The exe_wrapper {!r} defined in the cross file is ' \
-                              'needed by run target {!r}, but was not found. ' \
-                              'Please check the command and/or add it to PATH.'
-                        raise MesonException(msg.format(exe_wrap.name, target.name))
-                    cmd += exe_wrap.get_command()
-            cmd.append(abs_exe)
-        elif isinstance(texe, dependencies.ExternalProgram):
-            cmd += texe.get_command()
-        elif isinstance(texe, build.CustomTarget):
-            deps.append(self.get_target_filename(texe))
-            cmd += [os.path.join(self.environment.get_build_dir(), self.get_target_filename(texe))]
-        elif isinstance(texe, mesonlib.File):
-            cmd.append(texe.absolute_path(self.environment.get_source_dir(), self.environment.get_build_dir()))
-        else:
-            cmd.append(target.command)
-        cmd += arg_strings
-
-        if texe:
-            target_name = 'meson-{}'.format(self.build_run_target_name(target))
-            elem = NinjaBuildElement(self.all_outputs, target_name, 'CUSTOM_COMMAND', [])
-            elem.add_item('COMMAND', cmd)
-            elem.add_item('description', 'Running external command {}'.format(target.name))
-            elem.add_item('pool', 'console')
-            # Alias that runs the target defined above with the name the user specified
-            self.create_target_alias(target_name)
-        else:
-            target_name = self.build_run_target_name(target)
-            elem = NinjaBuildElement(self.all_outputs, target_name, 'phony', [])
-
-        elem.add_dep(deps)
-        self.add_build(elem)
-        self.processed_targets[target.get_id()] = True
-
-    def generate_coverage_command(self, elem, outputs):
-        targets = self.build.get_targets().values()
-        use_llvm_cov = False
-        for target in targets:
-            if not hasattr(target, 'compilers'):
-                continue
-            for compiler in target.compilers.values():
-                if compiler.get_id() == 'clang' and not compiler.info.is_darwin():
-                    use_llvm_cov = True
-                    break
-        elem.add_item('COMMAND', self.environment.get_build_command() +
-                      ['--internal', 'coverage'] +
-                      outputs +
-                      [self.environment.get_source_dir(),
-                       os.path.join(self.environment.get_source_dir(),
-                                    self.build.get_subproject_dir()),
-                       self.environment.get_build_dir(),
-                       self.environment.get_log_dir()] +
-                       (['--use_llvm_cov'] if use_llvm_cov else []))
-
-    def generate_coverage_rules(self):
-        e = NinjaBuildElement(self.all_outputs, 'meson-coverage', 'CUSTOM_COMMAND', 'PHONY')
-        self.generate_coverage_command(e, [])
-        e.add_item('description', 'Generates coverage reports')
-        self.add_build(e)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-coverage')
-        self.generate_coverage_legacy_rules()
-
-    def generate_coverage_legacy_rules(self):
-        e = NinjaBuildElement(self.all_outputs, 'meson-coverage-xml', 'CUSTOM_COMMAND', 'PHONY')
-        self.generate_coverage_command(e, ['--xml'])
-        e.add_item('description', 'Generates XML coverage report')
-        self.add_build(e)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-coverage-xml')
-
-        e = NinjaBuildElement(self.all_outputs, 'meson-coverage-text', 'CUSTOM_COMMAND', 'PHONY')
-        self.generate_coverage_command(e, ['--text'])
-        e.add_item('description', 'Generates text coverage report')
-        self.add_build(e)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-coverage-text')
-
-        e = NinjaBuildElement(self.all_outputs, 'meson-coverage-html', 'CUSTOM_COMMAND', 'PHONY')
-        self.generate_coverage_command(e, ['--html'])
-        e.add_item('description', 'Generates HTML coverage report')
-        self.add_build(e)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-coverage-html')
-
-    def generate_install(self):
-        self.create_install_data_files()
-        elem = NinjaBuildElement(self.all_outputs, 'meson-install', 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_dep('all')
-        elem.add_item('DESC', 'Installing files.')
-        elem.add_item('COMMAND', self.environment.get_build_command() + ['install', '--no-rebuild'])
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-install')
-
-    def generate_tests(self):
-        self.serialize_tests()
-        cmd = self.environment.get_build_command(True) + ['test', '--no-rebuild']
-        if not self.environment.coredata.get_builtin_option('stdsplit'):
-            cmd += ['--no-stdsplit']
-        if self.environment.coredata.get_builtin_option('errorlogs'):
-            cmd += ['--print-errorlogs']
-        elem = NinjaBuildElement(self.all_outputs, 'meson-test', 'CUSTOM_COMMAND', ['all', 'PHONY'])
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('DESC', 'Running all tests.')
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the above-defined meson-test target
-        self.create_target_alias('meson-test')
-
-        # And then benchmarks.
-        cmd = self.environment.get_build_command(True) + [
-            'test', '--benchmark', '--logbase',
-            'benchmarklog', '--num-processes=1', '--no-rebuild']
-        elem = NinjaBuildElement(self.all_outputs, 'meson-benchmark', 'CUSTOM_COMMAND', ['all', 'PHONY'])
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('DESC', 'Running benchmark suite.')
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the above-defined meson-benchmark target
-        self.create_target_alias('meson-benchmark')
-
-    def generate_rules(self):
-        self.rules = []
-        self.ruledict = {}
-
-        self.add_rule_comment(NinjaComment('Rules for compiling.'))
-        self.generate_compile_rules()
-        self.add_rule_comment(NinjaComment('Rules for linking.'))
-        self.generate_static_link_rules()
-        self.generate_dynamic_link_rules()
-        self.add_rule_comment(NinjaComment('Other rules'))
-        # Ninja errors out if you have deps = gcc but no depfile, so we must
-        # have two rules for custom commands.
-        self.add_rule(NinjaRule('CUSTOM_COMMAND', ['$COMMAND'], [], '$DESC',
-                                extra='restat = 1'))
-        self.add_rule(NinjaRule('CUSTOM_COMMAND_DEP', ['$COMMAND'], [], '$DESC',
-                                deps='gcc', depfile='$DEPFILE',
-                                extra='restat = 1'))
-
-        c = self.environment.get_build_command() + \
-            ['--internal',
-             'regenerate',
-             self.environment.get_source_dir(),
-             self.environment.get_build_dir(),
-             '--backend',
-             'ninja']
-        self.add_rule(NinjaRule('REGENERATE_BUILD',
-                                c, [],
-                                'Regenerating build files.',
-                                extra='generator = 1'))
-
-    def add_rule_comment(self, comment):
-        self.rules.append(comment)
-
-    def add_build_comment(self, comment):
-        self.build_elements.append(comment)
-
-    def add_rule(self, rule):
-        self.rules.append(rule)
-        self.ruledict[rule.name] = rule
-
-    def add_build(self, build):
-        self.build_elements.append(build)
-
-        if build.rulename != 'phony':
-            # reference rule
-            build.rule = self.ruledict[build.rulename]
-
-    def write_rules(self, outfile):
-        for b in self.build_elements:
-            if isinstance(b, NinjaBuildElement):
-                b.count_rule_references()
-
-        for r in self.rules:
-            r.write(outfile)
-
-    def write_builds(self, outfile):
-        for b in ProgressBar(self.build_elements, desc='Writing build.ninja'):
-            b.write(outfile)
-
-    def generate_phony(self):
-        self.add_build_comment(NinjaComment('Phony build target, always out of date'))
-        elem = NinjaBuildElement(self.all_outputs, 'PHONY', 'phony', '')
-        self.add_build(elem)
-
-    def generate_jar_target(self, target):
-        fname = target.get_filename()
-        outname_rel = os.path.join(self.get_target_dir(target), fname)
-        src_list = target.get_sources()
-        class_list = []
-        compiler = target.compilers['java']
-        c = 'c'
-        m = 'm'
-        e = ''
-        f = 'f'
-        main_class = target.get_main_class()
-        if main_class != '':
-            e = 'e'
-
-        # Add possible java generated files to src list
-        generated_sources = self.get_target_generated_sources(target)
-        gen_src_list = []
-        for rel_src in generated_sources.keys():
-            dirpart, fnamepart = os.path.split(rel_src)
-            raw_src = File(True, dirpart, fnamepart)
-            if rel_src.endswith('.java'):
-                gen_src_list.append(raw_src)
-
-        compile_args = self.determine_single_java_compile_args(target, compiler)
-        for src in src_list + gen_src_list:
-            plain_class_path = self.generate_single_java_compile(src, target, compiler, compile_args)
-            class_list.append(plain_class_path)
-        class_dep_list = [os.path.join(self.get_target_private_dir(target), i) for i in class_list]
-        manifest_path = os.path.join(self.get_target_private_dir(target), 'META-INF', 'MANIFEST.MF')
-        manifest_fullpath = os.path.join(self.environment.get_build_dir(), manifest_path)
-        os.makedirs(os.path.dirname(manifest_fullpath), exist_ok=True)
-        with open(manifest_fullpath, 'w') as manifest:
-            if any(target.link_targets):
-                manifest.write('Class-Path: ')
-                cp_paths = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets]
-                manifest.write(' '.join(cp_paths))
-            manifest.write('\n')
-        jar_rule = 'java_LINKER'
-        commands = [c + m + e + f]
-        commands.append(manifest_path)
-        if e != '':
-            commands.append(main_class)
-        commands.append(self.get_target_filename(target))
-        # Java compilation can produce an arbitrary number of output
-        # class files for a single source file. Thus tell jar to just
-        # grab everything in the final package.
-        commands += ['-C', self.get_target_private_dir(target), '.']
-        elem = NinjaBuildElement(self.all_outputs, outname_rel, jar_rule, [])
-        elem.add_dep(class_dep_list)
-        elem.add_item('ARGS', commands)
-        self.add_build(elem)
-        # Create introspection information
-        self.create_target_source_introspection(target, compiler, compile_args, src_list, gen_src_list)
-
-    def generate_cs_resource_tasks(self, target):
-        args = []
-        deps = []
-        for r in target.resources:
-            rel_sourcefile = os.path.join(self.build_to_src, target.subdir, r)
-            if r.endswith('.resources'):
-                a = '-resource:' + rel_sourcefile
-            elif r.endswith('.txt') or r.endswith('.resx'):
-                ofilebase = os.path.splitext(os.path.basename(r))[0] + '.resources'
-                ofilename = os.path.join(self.get_target_private_dir(target), ofilebase)
-                elem = NinjaBuildElement(self.all_outputs, ofilename, "CUSTOM_COMMAND", rel_sourcefile)
-                elem.add_item('COMMAND', ['resgen', rel_sourcefile, ofilename])
-                elem.add_item('DESC', 'Compiling resource {}'.format(rel_sourcefile))
-                self.add_build(elem)
-                deps.append(ofilename)
-                a = '-resource:' + ofilename
-            else:
-                raise InvalidArguments('Unknown resource file {}.'.format(r))
-            args.append(a)
-        return args, deps
-
-    def generate_cs_target(self, target):
-        buildtype = self.get_option_for_target('buildtype', target)
-        fname = target.get_filename()
-        outname_rel = os.path.join(self.get_target_dir(target), fname)
-        src_list = target.get_sources()
-        compiler = target.compilers['cs']
-        rel_srcs = [os.path.normpath(s.rel_to_builddir(self.build_to_src)) for s in src_list]
-        deps = []
-        commands = compiler.compiler_args(target.extra_args.get('cs', []))
-        commands += compiler.get_buildtype_args(buildtype)
-        commands += compiler.get_optimization_args(self.get_option_for_target('optimization', target))
-        commands += compiler.get_debug_args(self.get_option_for_target('debug', target))
-        if isinstance(target, build.Executable):
-            commands.append('-target:exe')
-        elif isinstance(target, build.SharedLibrary):
-            commands.append('-target:library')
-        else:
-            raise MesonException('Unknown C# target type.')
-        (resource_args, resource_deps) = self.generate_cs_resource_tasks(target)
-        commands += resource_args
-        deps += resource_deps
-        commands += compiler.get_output_args(outname_rel)
-        for l in target.link_targets:
-            lname = os.path.join(self.get_target_dir(l), l.get_filename())
-            commands += compiler.get_link_args(lname)
-            deps.append(lname)
-        if '-g' in commands:
-            outputs = [outname_rel, outname_rel + '.mdb']
-        else:
-            outputs = [outname_rel]
-        generated_sources = self.get_target_generated_sources(target)
-        generated_rel_srcs = []
-        for rel_src in generated_sources.keys():
-            if rel_src.lower().endswith('.cs'):
-                generated_rel_srcs.append(os.path.normpath(rel_src))
-            deps.append(os.path.normpath(rel_src))
-
-        for dep in target.get_external_deps():
-            commands.extend_direct(dep.get_link_args())
-        commands += self.build.get_project_args(compiler, target.subproject, target.for_machine)
-        commands += self.build.get_global_args(compiler, target.for_machine)
-
-        elem = NinjaBuildElement(self.all_outputs, outputs, self.get_compiler_rule_name('cs', target.for_machine), rel_srcs + generated_rel_srcs)
-        elem.add_dep(deps)
-        elem.add_item('ARGS', commands)
-        self.add_build(elem)
-
-        self.generate_generator_list_rules(target)
-        self.create_target_source_introspection(target, compiler, commands, rel_srcs, generated_rel_srcs)
-
-    def determine_single_java_compile_args(self, target, compiler):
-        args = []
-        args += compiler.get_buildtype_args(self.get_option_for_target('buildtype', target))
-        args += self.build.get_global_args(compiler, target.for_machine)
-        args += self.build.get_project_args(compiler, target.subproject, target.for_machine)
-        args += target.get_java_args()
-        args += compiler.get_output_args(self.get_target_private_dir(target))
-        args += target.get_classpath_args()
-        curdir = target.get_subdir()
-        sourcepath = os.path.join(self.build_to_src, curdir) + os.pathsep
-        sourcepath += os.path.normpath(curdir) + os.pathsep
-        for i in target.include_dirs:
-            for idir in i.get_incdirs():
-                sourcepath += os.path.join(self.build_to_src, i.curdir, idir) + os.pathsep
-        args += ['-sourcepath', sourcepath]
-        return args
-
-    def generate_single_java_compile(self, src, target, compiler, args):
-        deps = [os.path.join(self.get_target_dir(l), l.get_filename()) for l in target.link_targets]
-        generated_sources = self.get_target_generated_sources(target)
-        for rel_src in generated_sources.keys():
-            if rel_src.endswith('.java'):
-                deps.append(rel_src)
-        rel_src = src.rel_to_builddir(self.build_to_src)
-        plain_class_path = src.fname[:-4] + 'class'
-        rel_obj = os.path.join(self.get_target_private_dir(target), plain_class_path)
-        element = NinjaBuildElement(self.all_outputs, rel_obj, self.compiler_to_rule_name(compiler), rel_src)
-        element.add_dep(deps)
-        element.add_item('ARGS', args)
-        self.add_build(element)
-        return plain_class_path
-
-    def generate_java_link(self):
-        rule = 'java_LINKER'
-        command = ['jar', '$ARGS']
-        description = 'Creating JAR $out'
-        self.add_rule(NinjaRule(rule, command, [], description))
-
-    def determine_dep_vapis(self, target):
-        """
-        Peek into the sources of BuildTargets we're linking with, and if any of
-        them was built with Vala, assume that it also generated a .vapi file of
-        the same name as the BuildTarget and return the path to it relative to
-        the build directory.
-        """
-        result = OrderedSet()
-        for dep in itertools.chain(target.link_targets, target.link_whole_targets):
-            if not dep.is_linkable_target():
-                continue
-            for i in dep.sources:
-                if hasattr(i, 'fname'):
-                    i = i.fname
-                if i.endswith('vala'):
-                    vapiname = dep.vala_vapi
-                    fullname = os.path.join(self.get_target_dir(dep), vapiname)
-                    result.add(fullname)
-                    break
-        return list(result)
-
-    def split_vala_sources(self, t):
-        """
-        Splits the target's sources into .vala, .gs, .vapi, and other sources.
-        Handles both pre-existing and generated sources.
-
-        Returns a tuple (vala, vapi, others) each of which is a dictionary with
-        the keys being the path to the file (relative to the build directory)
-        and the value being the object that generated or represents the file.
-        """
-        vala = OrderedDict()
-        vapi = OrderedDict()
-        others = OrderedDict()
-        othersgen = OrderedDict()
-        # Split pre-existing sources
-        for s in t.get_sources():
-            # BuildTarget sources are always mesonlib.File files which are
-            # either in the source root, or generated with configure_file and
-            # in the build root
-            if not isinstance(s, File):
-                msg = 'All sources in target {!r} must be of type ' \
-                      'mesonlib.File, not {!r}'.format(t, s)
-                raise InvalidArguments(msg)
-            f = s.rel_to_builddir(self.build_to_src)
-            if s.endswith(('.vala', '.gs')):
-                srctype = vala
-            elif s.endswith('.vapi'):
-                srctype = vapi
-            else:
-                srctype = others
-            srctype[f] = s
-        # Split generated sources
-        for gensrc in t.get_generated_sources():
-            for s in gensrc.get_outputs():
-                f = self.get_target_generated_dir(t, gensrc, s)
-                if s.endswith(('.vala', '.gs')):
-                    srctype = vala
-                elif s.endswith('.vapi'):
-                    srctype = vapi
-                # Generated non-Vala (C/C++) sources. Won't be used for
-                # generating the Vala compile rule below.
-                else:
-                    srctype = othersgen
-                # Duplicate outputs are disastrous
-                if f in srctype and srctype[f] is not gensrc:
-                    msg = 'Duplicate output {0!r} from {1!r} {2!r}; ' \
-                          'conflicts with {0!r} from {4!r} {3!r}' \
-                          ''.format(f, type(gensrc).__name__, gensrc.name,
-                                    srctype[f].name, type(srctype[f]).__name__)
-                    raise InvalidArguments(msg)
-                # Store 'somefile.vala': GeneratedList (or CustomTarget)
-                srctype[f] = gensrc
-        return vala, vapi, (others, othersgen)
-
-    def generate_vala_compile(self, target):
-        """Vala is compiled into C. Set up all necessary build steps here."""
-        (vala_src, vapi_src, other_src) = self.split_vala_sources(target)
-        extra_dep_files = []
-        if not vala_src:
-            msg = 'Vala library {!r} has no Vala or Genie source files.'
-            raise InvalidArguments(msg.format(target.name))
-
-        valac = target.compilers['vala']
-        c_out_dir = self.get_target_private_dir(target)
-        # C files generated by valac
-        vala_c_src = []
-        # Files generated by valac
-        valac_outputs = []
-        # All sources that are passed to valac on the commandline
-        all_files = list(vapi_src.keys())
-        # Passed as --basedir
-        srcbasedir = os.path.join(self.build_to_src, target.get_subdir())
-        for (vala_file, gensrc) in vala_src.items():
-            all_files.append(vala_file)
-            # Figure out where the Vala compiler will write the compiled C file
-            #
-            # If the Vala file is in a subdir of the build dir (in our case
-            # because it was generated/built by something else), and is also
-            # a subdir of --basedir (because the builddir is in the source
-            # tree, and the target subdir is the source root), the subdir
-            # components from the source root till the private builddir will be
-            # duplicated inside the private builddir. Otherwise, just the
-            # basename will be used.
-            #
-            # If the Vala file is outside the build directory, the paths from
-            # the --basedir till the subdir will be duplicated inside the
-            # private builddir.
-            if isinstance(gensrc, (build.CustomTarget, build.GeneratedList)) or gensrc.is_built:
-                vala_c_file = os.path.splitext(os.path.basename(vala_file))[0] + '.c'
-                # Check if the vala file is in a subdir of --basedir
-                abs_srcbasedir = os.path.join(self.environment.get_source_dir(), target.get_subdir())
-                abs_vala_file = os.path.join(self.environment.get_build_dir(), vala_file)
-                if PurePath(os.path.commonpath((abs_srcbasedir, abs_vala_file))) == PurePath(abs_srcbasedir):
-                    vala_c_subdir = PurePath(abs_vala_file).parent.relative_to(abs_srcbasedir)
-                    vala_c_file = os.path.join(str(vala_c_subdir), vala_c_file)
-            else:
-                path_to_target = os.path.join(self.build_to_src, target.get_subdir())
-                if vala_file.startswith(path_to_target):
-                    vala_c_file = os.path.splitext(os.path.relpath(vala_file, path_to_target))[0] + '.c'
-                else:
-                    vala_c_file = os.path.splitext(os.path.basename(vala_file))[0] + '.c'
-            # All this will be placed inside the c_out_dir
-            vala_c_file = os.path.join(c_out_dir, vala_c_file)
-            vala_c_src.append(vala_c_file)
-            valac_outputs.append(vala_c_file)
-
-        args = self.generate_basic_compiler_args(target, valac)
-        args += valac.get_colorout_args(self.environment.coredata.base_options.get('b_colorout').value)
-        # Tell Valac to output everything in our private directory. Sadly this
-        # means it will also preserve the directory components of Vala sources
-        # found inside the build tree (generated sources).
-        args += ['--directory', c_out_dir]
-        args += ['--basedir', srcbasedir]
-        if target.is_linkable_target():
-            # Library name
-            args += ['--library', target.name]
-            # Outputted header
-            hname = os.path.join(self.get_target_dir(target), target.vala_header)
-            args += ['--header', hname]
-            if self.is_unity(target):
-                # Without this the declarations will get duplicated in the .c
-                # files and cause a build failure when all of them are
-                # #include-d in one .c file.
-                # https://github.com/mesonbuild/meson/issues/1969
-                args += ['--use-header']
-            valac_outputs.append(hname)
-            # Outputted vapi file
-            vapiname = os.path.join(self.get_target_dir(target), target.vala_vapi)
-            # Force valac to write the vapi and gir files in the target build dir.
-            # Without this, it will write it inside c_out_dir
-            args += ['--vapi', os.path.join('..', target.vala_vapi)]
-            valac_outputs.append(vapiname)
-            target.outputs += [target.vala_header, target.vala_vapi]
-            # Install header and vapi to default locations if user requests this
-            if len(target.install_dir) > 1 and target.install_dir[1] is True:
-                target.install_dir[1] = self.environment.get_includedir()
-            if len(target.install_dir) > 2 and target.install_dir[2] is True:
-                target.install_dir[2] = os.path.join(self.environment.get_datadir(), 'vala', 'vapi')
-            # Generate GIR if requested
-            if isinstance(target.vala_gir, str):
-                girname = os.path.join(self.get_target_dir(target), target.vala_gir)
-                args += ['--gir', os.path.join('..', target.vala_gir)]
-                valac_outputs.append(girname)
-                target.outputs.append(target.vala_gir)
-                # Install GIR to default location if requested by user
-                if len(target.install_dir) > 3 and target.install_dir[3] is True:
-                    target.install_dir[3] = os.path.join(self.environment.get_datadir(), 'gir-1.0')
-        # Detect gresources and add --gresources arguments for each
-        for gensrc in other_src[1].values():
-            if isinstance(gensrc, modules.GResourceTarget):
-                gres_xml, = self.get_custom_target_sources(gensrc)
-                args += ['--gresources=' + gres_xml]
-        extra_args = []
-
-        for a in target.extra_args.get('vala', []):
-            if isinstance(a, File):
-                relname = a.rel_to_builddir(self.build_to_src)
-                extra_dep_files.append(relname)
-                extra_args.append(relname)
-            else:
-                extra_args.append(a)
-        dependency_vapis = self.determine_dep_vapis(target)
-        extra_dep_files += dependency_vapis
-        args += extra_args
-        element = NinjaBuildElement(self.all_outputs, valac_outputs,
-                                    self.compiler_to_rule_name(valac),
-                                    all_files + dependency_vapis)
-        element.add_item('ARGS', args)
-        element.add_dep(extra_dep_files)
-        self.add_build(element)
-        self.create_target_source_introspection(target, valac, args, all_files, [])
-        return other_src[0], other_src[1], vala_c_src
-
-    def generate_rust_target(self, target):
-        rustc = target.compilers['rust']
-        # Rust compiler takes only the main file as input and
-        # figures out what other files are needed via import
-        # statements and magic.
-        main_rust_file = None
-        for i in target.get_sources():
-            if not rustc.can_compile(i):
-                raise InvalidArguments('Rust target {} contains a non-rust source file.'.format(target.get_basename()))
-            if main_rust_file is None:
-                main_rust_file = i.rel_to_builddir(self.build_to_src)
-        if main_rust_file is None:
-            raise RuntimeError('A Rust target has no Rust sources. This is weird. Also a bug. Please report')
-        target_name = os.path.join(target.subdir, target.get_filename())
-        args = ['--crate-type']
-        if isinstance(target, build.Executable):
-            cratetype = 'bin'
-        elif hasattr(target, 'rust_crate_type'):
-            cratetype = target.rust_crate_type
-        elif isinstance(target, build.SharedLibrary):
-            cratetype = 'dylib'
-        elif isinstance(target, build.StaticLibrary):
-            cratetype = 'rlib'
-        else:
-            raise InvalidArguments('Unknown target type for rustc.')
-        args.append(cratetype)
-
-        # If we're dynamically linking, add those arguments
-        #
-        # Rust is super annoying, calling -C link-arg foo does not work, it has
-        # to be -C link-arg=foo
-        if cratetype in {'bin', 'dylib'}:
-            for a in rustc.linker.get_always_args():
-                args += ['-C', 'link-arg={}'.format(a)]
-
-        args += ['--crate-name', target.name]
-        args += rustc.get_buildtype_args(self.get_option_for_target('buildtype', target))
-        args += rustc.get_debug_args(self.get_option_for_target('debug', target))
-        args += rustc.get_optimization_args(self.get_option_for_target('optimization', target))
-        args += self.build.get_global_args(rustc, target.for_machine)
-        args += self.build.get_project_args(rustc, target.subproject, target.for_machine)
-        depfile = os.path.join(target.subdir, target.name + '.d')
-        args += ['--emit', 'dep-info={}'.format(depfile), '--emit', 'link']
-        args += target.get_extra_args('rust')
-        args += ['-o', os.path.join(target.subdir, target.get_filename())]
-        orderdeps = [os.path.join(t.subdir, t.get_filename()) for t in target.link_targets]
-        linkdirs = OrderedDict()
-        for d in target.link_targets:
-            linkdirs[d.subdir] = True
-            # specify `extern CRATE_NAME=OUTPUT_FILE` for each Rust
-            # dependency, so that collisions with libraries in rustc's
-            # sysroot don't cause ambiguity
-            args += ['--extern', '{}={}'.format(d.name, os.path.join(d.subdir, d.filename))]
-        for d in linkdirs.keys():
-            if d == '':
-                d = '.'
-            args += ['-L', d]
-        has_shared_deps = False
-        for dep in target.get_dependencies():
-            if isinstance(dep, build.SharedLibrary):
-                has_shared_deps = True
-        if isinstance(target, build.SharedLibrary) or has_shared_deps:
-            # add prefer-dynamic if any of the Rust libraries we link
-            # against are dynamic, otherwise we'll end up with
-            # multiple implementations of crates
-            args += ['-C', 'prefer-dynamic']
-
-            # build the usual rpath arguments as well...
-
-            # Set runtime-paths so we can run executables without needing to set
-            # LD_LIBRARY_PATH, etc in the environment. Doesn't work on Windows.
-            if has_path_sep(target.name):
-                # Target names really should not have slashes in them, but
-                # unfortunately we did not check for that and some downstream projects
-                # now have them. Once slashes are forbidden, remove this bit.
-                target_slashname_workaround_dir = os.path.join(os.path.dirname(target.name),
-                                                               self.get_target_dir(target))
-            else:
-                target_slashname_workaround_dir = self.get_target_dir(target)
-            (rpath_args, target.rpath_dirs_to_remove) = \
-                         rustc.build_rpath_args(self.environment,
-                                                self.environment.get_build_dir(),
-                                                target_slashname_workaround_dir,
-                                                self.determine_rpath_dirs(target),
-                                                target.build_rpath,
-                                                target.install_rpath)
-            # ... but then add rustc's sysroot to account for rustup
-            # installations
-            for rpath_arg in rpath_args:
-                args += ['-C', 'link-arg=' + rpath_arg + ':' + os.path.join(rustc.get_sysroot(), 'lib')]
-        compiler_name = self.get_compiler_rule_name('rust', target.for_machine)
-        element = NinjaBuildElement(self.all_outputs, target_name, compiler_name, main_rust_file)
-        if len(orderdeps) > 0:
-            element.add_orderdep(orderdeps)
-        element.add_item('ARGS', args)
-        element.add_item('targetdep', depfile)
-        element.add_item('cratetype', cratetype)
-        self.add_build(element)
-        if isinstance(target, build.SharedLibrary):
-            self.generate_shsym(target)
-        self.create_target_source_introspection(target, rustc, args, [main_rust_file], [])
-
-    @staticmethod
-    def get_rule_suffix(for_machine: MachineChoice) -> str:
-        return PerMachine('_FOR_BUILD', '')[for_machine]
-
-    @classmethod
-    def get_compiler_rule_name(cls, lang: str, for_machine: MachineChoice) -> str:
-        return '{}_COMPILER{}'.format(lang, cls.get_rule_suffix(for_machine))
-
-    @classmethod
-    def get_pch_rule_name(cls, lang: str, for_machine: MachineChoice) -> str:
-        return '{}_PCH{}'.format(lang, cls.get_rule_suffix(for_machine))
-
-    @classmethod
-    def compiler_to_rule_name(cls, compiler: Compiler) -> str:
-        return cls.get_compiler_rule_name(compiler.get_language(), compiler.for_machine)
-
-    @classmethod
-    def compiler_to_pch_rule_name(cls, compiler: Compiler) -> str:
-        return cls.get_pch_rule_name(compiler.get_language(), compiler.for_machine)
-
-    def swift_module_file_name(self, target):
-        return os.path.join(self.get_target_private_dir(target),
-                            self.target_swift_modulename(target) + '.swiftmodule')
-
-    def target_swift_modulename(self, target):
-        return target.name
-
-    def is_swift_target(self, target):
-        for s in target.sources:
-            if s.endswith('swift'):
-                return True
-        return False
-
-    def determine_swift_dep_modules(self, target):
-        result = []
-        for l in target.link_targets:
-            if self.is_swift_target(l):
-                result.append(self.swift_module_file_name(l))
-        return result
-
-    def determine_swift_dep_dirs(self, target):
-        result = []
-        for l in target.link_targets:
-            result.append(self.get_target_private_dir_abs(l))
-        return result
-
-    def get_swift_link_deps(self, target):
-        result = []
-        for l in target.link_targets:
-            result.append(self.get_target_filename(l))
-        return result
-
-    def split_swift_generated_sources(self, target):
-        all_srcs = self.get_target_generated_sources(target)
-        srcs = []
-        others = []
-        for i in all_srcs:
-            if i.endswith('.swift'):
-                srcs.append(i)
-            else:
-                others.append(i)
-        return srcs, others
-
-    def generate_swift_target(self, target):
-        module_name = self.target_swift_modulename(target)
-        swiftc = target.compilers['swift']
-        abssrc = []
-        relsrc = []
-        abs_headers = []
-        header_imports = []
-        for i in target.get_sources():
-            if swiftc.can_compile(i):
-                rels = i.rel_to_builddir(self.build_to_src)
-                abss = os.path.normpath(os.path.join(self.environment.get_build_dir(), rels))
-                relsrc.append(rels)
-                abssrc.append(abss)
-            elif self.environment.is_header(i):
-                relh = i.rel_to_builddir(self.build_to_src)
-                absh = os.path.normpath(os.path.join(self.environment.get_build_dir(), relh))
-                abs_headers.append(absh)
-                header_imports += swiftc.get_header_import_args(absh)
-            else:
-                raise InvalidArguments('Swift target {} contains a non-swift source file.'.format(target.get_basename()))
-        os.makedirs(self.get_target_private_dir_abs(target), exist_ok=True)
-        compile_args = swiftc.get_compile_only_args()
-        compile_args += swiftc.get_optimization_args(self.get_option_for_target('optimization', target))
-        compile_args += swiftc.get_debug_args(self.get_option_for_target('debug', target))
-        compile_args += swiftc.get_module_args(module_name)
-        compile_args += self.build.get_project_args(swiftc, target.subproject, target.for_machine)
-        compile_args += self.build.get_global_args(swiftc, target.for_machine)
-        for i in reversed(target.get_include_dirs()):
-            basedir = i.get_curdir()
-            for d in i.get_incdirs():
-                if d not in ('', '.'):
-                    expdir = os.path.join(basedir, d)
-                else:
-                    expdir = basedir
-                srctreedir = os.path.normpath(os.path.join(self.environment.get_build_dir(), self.build_to_src, expdir))
-                sargs = swiftc.get_include_args(srctreedir)
-                compile_args += sargs
-        link_args = swiftc.get_output_args(os.path.join(self.environment.get_build_dir(), self.get_target_filename(target)))
-        link_args += self.build.get_project_link_args(swiftc, target.subproject, target.for_machine)
-        link_args += self.build.get_global_link_args(swiftc, target.for_machine)
-        rundir = self.get_target_private_dir(target)
-        out_module_name = self.swift_module_file_name(target)
-        in_module_files = self.determine_swift_dep_modules(target)
-        abs_module_dirs = self.determine_swift_dep_dirs(target)
-        module_includes = []
-        for x in abs_module_dirs:
-            module_includes += swiftc.get_include_args(x)
-        link_deps = self.get_swift_link_deps(target)
-        abs_link_deps = [os.path.join(self.environment.get_build_dir(), x) for x in link_deps]
-        for d in target.link_targets:
-            reldir = self.get_target_dir(d)
-            if reldir == '':
-                reldir = '.'
-            link_args += ['-L', os.path.normpath(os.path.join(self.environment.get_build_dir(), reldir))]
-        (rel_generated, _) = self.split_swift_generated_sources(target)
-        abs_generated = [os.path.join(self.environment.get_build_dir(), x) for x in rel_generated]
-        # We need absolute paths because swiftc needs to be invoked in a subdir
-        # and this is the easiest way about it.
-        objects = [] # Relative to swift invocation dir
-        rel_objects = [] # Relative to build.ninja
-        for i in abssrc + abs_generated:
-            base = os.path.basename(i)
-            oname = os.path.splitext(base)[0] + '.o'
-            objects.append(oname)
-            rel_objects.append(os.path.join(self.get_target_private_dir(target), oname))
-
-        rulename = self.get_compiler_rule_name('swift', target.for_machine)
-
-        # Swiftc does not seem to be able to emit objects and module files in one go.
-        elem = NinjaBuildElement(self.all_outputs, rel_objects, rulename, abssrc)
-        elem.add_dep(in_module_files + rel_generated)
-        elem.add_dep(abs_headers)
-        elem.add_item('ARGS', compile_args + header_imports + abs_generated + module_includes)
-        elem.add_item('RUNDIR', rundir)
-        self.add_build(elem)
-        elem = NinjaBuildElement(self.all_outputs, out_module_name,
-                                 self.get_compiler_rule_name('swift', target.for_machine),
-                                 abssrc)
-        elem.add_dep(in_module_files + rel_generated)
-        elem.add_item('ARGS', compile_args + abs_generated + module_includes + swiftc.get_mod_gen_args())
-        elem.add_item('RUNDIR', rundir)
-        self.add_build(elem)
-        if isinstance(target, build.StaticLibrary):
-            elem = self.generate_link(target, self.get_target_filename(target),
-                                      rel_objects, self.build.static_linker[target.for_machine])
-            self.add_build(elem)
-        elif isinstance(target, build.Executable):
-            elem = NinjaBuildElement(self.all_outputs, self.get_target_filename(target), rulename, [])
-            elem.add_dep(rel_objects)
-            elem.add_dep(link_deps)
-            elem.add_item('ARGS', link_args + swiftc.get_std_exe_link_args() + objects + abs_link_deps)
-            elem.add_item('RUNDIR', rundir)
-            self.add_build(elem)
-        else:
-            raise MesonException('Swift supports only executable and static library targets.')
-        # Introspection information
-        self.create_target_source_introspection(target, swiftc, compile_args + header_imports + module_includes, relsrc, rel_generated)
-
-    def generate_static_link_rules(self):
-        num_pools = self.environment.coredata.backend_options['backend_max_links'].value
-        if 'java' in self.environment.coredata.compilers.host:
-            self.generate_java_link()
-        for for_machine in MachineChoice:
-            static_linker = self.build.static_linker[for_machine]
-            if static_linker is None:
-                return
-            rule = 'STATIC_LINKER{}'.format(self.get_rule_suffix(for_machine))
-            cmdlist = []
-            args = ['$in']
-            # FIXME: Must normalize file names with pathlib.Path before writing
-            #        them out to fix this properly on Windows. See:
-            # https://github.com/mesonbuild/meson/issues/1517
-            # https://github.com/mesonbuild/meson/issues/1526
-            if isinstance(static_linker, ArLinker) and not mesonlib.is_windows():
-                # `ar` has no options to overwrite archives. It always appends,
-                # which is never what we want. Delete an existing library first if
-                # it exists. https://github.com/mesonbuild/meson/issues/1355
-                cmdlist = execute_wrapper + [c.format('$out') for c in rmfile_prefix]
-            cmdlist += static_linker.get_exelist()
-            cmdlist += ['$LINK_ARGS']
-            cmdlist += NinjaCommandArg.list(static_linker.get_output_args('$out'), Quoting.none)
-            description = 'Linking static target $out'
-            if num_pools > 0:
-                pool = 'pool = link_pool'
-            else:
-                pool = None
-            self.add_rule(NinjaRule(rule, cmdlist, args, description,
-                                    rspable=static_linker.can_linker_accept_rsp(),
-                                    rspfile_quote_style='cl' if isinstance(static_linker, VisualStudioLinker) else 'gcc',
-                                    extra=pool))
-
-    def generate_dynamic_link_rules(self):
-        num_pools = self.environment.coredata.backend_options['backend_max_links'].value
-        for for_machine in MachineChoice:
-            complist = self.environment.coredata.compilers[for_machine]
-            for langname, compiler in complist.items():
-                if langname == 'java' \
-                        or langname == 'vala' \
-                        or langname == 'rust' \
-                        or langname == 'cs':
-                    continue
-                rule = '{}_LINKER{}'.format(langname, self.get_rule_suffix(for_machine))
-                command = compiler.get_linker_exelist()
-                args = ['$ARGS'] + NinjaCommandArg.list(compiler.get_linker_output_args('$out'), Quoting.none) + ['$in', '$LINK_ARGS']
-                description = 'Linking target $out'
-                if num_pools > 0:
-                    pool = 'pool = link_pool'
-                else:
-                    pool = None
-                self.add_rule(NinjaRule(rule, command, args, description,
-                                        rspable=compiler.can_linker_accept_rsp(),
-                                        rspfile_quote_style='cl' if (compiler.get_argument_syntax() == 'msvc' or
-                                                                     isinstance(compiler, DmdDCompiler)) else 'gcc',
-                                        extra=pool))
-
-        args = self.environment.get_build_command() + \
-            ['--internal',
-             'symbolextractor',
-             self.environment.get_build_dir(),
-             '$in',
-             '$IMPLIB',
-             '$out']
-        symrule = 'SHSYM'
-        symcmd = args + ['$CROSS']
-        syndesc = 'Generating symbol file $out'
-        synstat = 'restat = 1'
-        self.add_rule(NinjaRule(symrule, symcmd, [], syndesc, extra=synstat))
-
-    def generate_java_compile_rule(self, compiler):
-        rule = self.compiler_to_rule_name(compiler)
-        command = compiler.get_exelist() + ['$ARGS', '$in']
-        description = 'Compiling Java object $in'
-        self.add_rule(NinjaRule(rule, command, [], description))
-
-    def generate_cs_compile_rule(self, compiler):
-        rule = self.compiler_to_rule_name(compiler)
-        command = compiler.get_exelist()
-        args = ['$ARGS', '$in']
-        description = 'Compiling C Sharp target $out'
-        self.add_rule(NinjaRule(rule, command, args, description,
-                                rspable=mesonlib.is_windows(),
-                                rspfile_quote_style='cl' if isinstance(compiler, VisualStudioCsCompiler) else 'gcc'))
-
-    def generate_vala_compile_rules(self, compiler):
-        rule = self.compiler_to_rule_name(compiler)
-        command = compiler.get_exelist() + ['$ARGS', '$in']
-        description = 'Compiling Vala source $in'
-        self.add_rule(NinjaRule(rule, command, [], description, extra='restat = 1'))
-
-    def generate_rust_compile_rules(self, compiler):
-        rule = self.compiler_to_rule_name(compiler)
-        command = compiler.get_exelist() + ['$ARGS', '$in']
-        description = 'Compiling Rust source $in'
-        depfile = '$targetdep'
-        depstyle = 'gcc'
-        self.add_rule(NinjaRule(rule, command, [], description, deps=depstyle,
-                                depfile=depfile))
-
-    def generate_swift_compile_rules(self, compiler):
-        rule = self.compiler_to_rule_name(compiler)
-        full_exe = self.environment.get_build_command() + [
-            '--internal',
-            'dirchanger',
-            '$RUNDIR',
-        ]
-        invoc = full_exe + compiler.get_exelist()
-        command = invoc + ['$ARGS', '$in']
-        description = 'Compiling Swift source $in'
-        self.add_rule(NinjaRule(rule, command, [], description))
-
-    def generate_fortran_dep_hack(self, crstr):
-        rule = 'FORTRAN_DEP_HACK{}'.format(crstr)
-        if mesonlib.is_windows():
-            cmd = ['cmd', '/C']
-        else:
-            cmd = ['true']
-        self.add_rule_comment(NinjaComment('''Workaround for these issues:
-https://groups.google.com/forum/#!topic/ninja-build/j-2RfBIOd_8
-https://gcc.gnu.org/bugzilla/show_bug.cgi?id=47485'''))
-        self.add_rule(NinjaRule(rule, cmd, [], 'Dep hack', extra='restat = 1'))
-
-    def generate_llvm_ir_compile_rule(self, compiler):
-        if self.created_llvm_ir_rule[compiler.for_machine]:
-            return
-        rule = self.get_compiler_rule_name('llvm_ir', compiler.for_machine)
-        command = compiler.get_exelist()
-        args = ['$ARGS'] + NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none) + compiler.get_compile_only_args() + ['$in']
-        description = 'Compiling LLVM IR object $in'
-        self.add_rule(NinjaRule(rule, command, args, description,
-                                rspable=compiler.can_linker_accept_rsp()))
-        self.created_llvm_ir_rule[compiler.for_machine] = True
-
-    def generate_compile_rule_for(self, langname, compiler):
-        if langname == 'java':
-            if self.environment.machines.matches_build_machine(compiler.for_machine):
-                self.generate_java_compile_rule(compiler)
-            return
-        if langname == 'cs':
-            if self.environment.machines.matches_build_machine(compiler.for_machine):
-                self.generate_cs_compile_rule(compiler)
-            return
-        if langname == 'vala':
-            self.generate_vala_compile_rules(compiler)
-            return
-        if langname == 'rust':
-            self.generate_rust_compile_rules(compiler)
-            return
-        if langname == 'swift':
-            if self.environment.machines.matches_build_machine(compiler.for_machine):
-                self.generate_swift_compile_rules(compiler)
-            return
-        crstr = self.get_rule_suffix(compiler.for_machine)
-        if langname == 'fortran':
-            self.generate_fortran_dep_hack(crstr)
-        rule = self.get_compiler_rule_name(langname, compiler.for_machine)
-        depargs = NinjaCommandArg.list(compiler.get_dependency_gen_args('$out', '$DEPFILE'), Quoting.none)
-        command = compiler.get_exelist()
-        args = ['$ARGS'] + depargs + NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none) + compiler.get_compile_only_args() + ['$in']
-        description = 'Compiling {} object $out'.format(compiler.get_display_language())
-        if isinstance(compiler, VisualStudioLikeCompiler):
-            deps = 'msvc'
-            depfile = None
-        else:
-            deps = 'gcc'
-            depfile = '$DEPFILE'
-        self.add_rule(NinjaRule(rule, command, args, description,
-                                rspable=compiler.can_linker_accept_rsp(),
-                                rspfile_quote_style='cl' if (compiler.get_argument_syntax() == 'msvc' or
-                                                             isinstance(compiler, DmdDCompiler)) else 'gcc',
-                                deps=deps, depfile=depfile))
-
-    def generate_pch_rule_for(self, langname, compiler):
-        if langname != 'c' and langname != 'cpp':
-            return
-        rule = self.compiler_to_pch_rule_name(compiler)
-        depargs = compiler.get_dependency_gen_args('$out', '$DEPFILE')
-
-        if isinstance(compiler, VisualStudioLikeCompiler):
-            output = []
-        else:
-            output = NinjaCommandArg.list(compiler.get_output_args('$out'), Quoting.none)
-        command = compiler.get_exelist() + ['$ARGS'] + depargs + output + compiler.get_compile_only_args() + ['$in']
-        description = 'Precompiling header $in'
-        if isinstance(compiler, VisualStudioLikeCompiler):
-            deps = 'msvc'
-            depfile = None
-        else:
-            deps = 'gcc'
-            depfile = '$DEPFILE'
-        self.add_rule(NinjaRule(rule, command, [], description, deps=deps,
-                                depfile=depfile))
-
-    def generate_compile_rules(self):
-        for for_machine in MachineChoice:
-            clist = self.environment.coredata.compilers[for_machine]
-            for langname, compiler in clist.items():
-                if compiler.get_id() == 'clang':
-                    self.generate_llvm_ir_compile_rule(compiler)
-                self.generate_compile_rule_for(langname, compiler)
-                self.generate_pch_rule_for(langname, compiler)
-
-    def generate_generator_list_rules(self, target):
-        # CustomTargets have already written their rules and
-        # CustomTargetIndexes don't actually get generated, so write rules for
-        # GeneratedLists here
-        for genlist in target.get_generated_sources():
-            if isinstance(genlist, (build.CustomTarget, build.CustomTargetIndex)):
-                continue
-            self.generate_genlist_for_target(genlist, target)
-
-    def replace_paths(self, target, args, override_subdir=None):
-        if override_subdir:
-            source_target_dir = os.path.join(self.build_to_src, override_subdir)
-        else:
-            source_target_dir = self.get_target_source_dir(target)
-        relout = self.get_target_private_dir(target)
-        args = [x.replace("@SOURCE_DIR@", self.build_to_src).replace("@BUILD_DIR@", relout)
-                for x in args]
-        args = [x.replace("@CURRENT_SOURCE_DIR@", source_target_dir) for x in args]
-        args = [x.replace("@SOURCE_ROOT@", self.build_to_src).replace("@BUILD_ROOT@", '.')
-                for x in args]
-        args = [x.replace('\\', '/') for x in args]
-        return args
-
-    def generate_genlist_for_target(self, genlist, target):
-        generator = genlist.get_generator()
-        subdir = genlist.subdir
-        exe = generator.get_exe()
-        exe_arr = self.build_target_to_cmd_array(exe)
-        infilelist = genlist.get_inputs()
-        outfilelist = genlist.get_outputs()
-        extra_dependencies = self.get_custom_target_depend_files(genlist)
-        for i in range(len(infilelist)):
-            curfile = infilelist[i]
-            if len(generator.outputs) == 1:
-                sole_output = os.path.join(self.get_target_private_dir(target), outfilelist[i])
-            else:
-                sole_output = '{}'.format(curfile)
-            infilename = curfile.rel_to_builddir(self.build_to_src)
-            base_args = generator.get_arglist(infilename)
-            outfiles = genlist.get_outputs_for(curfile)
-            outfiles = [os.path.join(self.get_target_private_dir(target), of) for of in outfiles]
-            if generator.depfile is None:
-                rulename = 'CUSTOM_COMMAND'
-                args = base_args
-            else:
-                rulename = 'CUSTOM_COMMAND_DEP'
-                depfilename = generator.get_dep_outname(infilename)
-                depfile = os.path.join(self.get_target_private_dir(target), depfilename)
-                args = [x.replace('@DEPFILE@', depfile) for x in base_args]
-            args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)
-                    for x in args]
-            args = self.replace_outputs(args, self.get_target_private_dir(target), outfilelist)
-            # We have consumed output files, so drop them from the list of remaining outputs.
-            if len(generator.outputs) > 1:
-                outfilelist = outfilelist[len(generator.outputs):]
-            args = self.replace_paths(target, args, override_subdir=subdir)
-            cmdlist = exe_arr + self.replace_extra_args(args, genlist)
-            meson_exe_cmd = self.as_meson_exe_cmdline('generator ' + cmdlist[0],
-                                                      cmdlist[0], cmdlist[1:],
-                                                      capture=outfiles[0] if generator.capture else None)
-            if meson_exe_cmd:
-                cmdlist = meson_exe_cmd
-            abs_pdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
-            os.makedirs(abs_pdir, exist_ok=True)
-
-            elem = NinjaBuildElement(self.all_outputs, outfiles, rulename, infilename)
-            elem.add_dep([self.get_target_filename(x) for x in generator.depends])
-            if generator.depfile is not None:
-                elem.add_item('DEPFILE', depfile)
-            if len(extra_dependencies) > 0:
-                elem.add_dep(extra_dependencies)
-            if len(generator.outputs) == 1:
-                elem.add_item('DESC', 'Generating {!r}.'.format(sole_output))
-            else:
-                # since there are multiple outputs, we log the source that caused the rebuild
-                elem.add_item('DESC', 'Generating source from {!r}.'.format(sole_output))
-            if isinstance(exe, build.BuildTarget):
-                elem.add_dep(self.get_target_filename(exe))
-            elem.add_item('COMMAND', cmdlist)
-            self.add_build(elem)
-
-    def scan_fortran_module_outputs(self, target):
-        """
-        Find all module and submodule made available in a Fortran code file.
-        """
-        compiler = None
-        # TODO other compilers
-        for lang, c in self.environment.coredata.compilers.host.items():
-            if lang == 'fortran':
-                compiler = c
-                break
-        if compiler is None:
-            self.fortran_deps[target.get_basename()] = {}
-            return
-
-        modre = re.compile(FORTRAN_MODULE_PAT, re.IGNORECASE)
-        submodre = re.compile(FORTRAN_SUBMOD_PAT, re.IGNORECASE)
-        module_files = {}
-        submodule_files = {}
-        for s in target.get_sources():
-            # FIXME, does not work for Fortran sources generated by
-            # custom_target() and generator() as those are run after
-            # the configuration (configure_file() is OK)
-            if not compiler.can_compile(s):
-                continue
-            filename = s.absolute_path(self.environment.get_source_dir(),
-                                       self.environment.get_build_dir())
-            # Fortran keywords must be ASCII.
-            with open(filename, encoding='ascii', errors='ignore') as f:
-                for line in f:
-                    modmatch = modre.match(line)
-                    if modmatch is not None:
-                        modname = modmatch.group(1).lower()
-                        if modname in module_files:
-                            raise InvalidArguments(
-                                'Namespace collision: module {} defined in '
-                                'two files {} and {}.'.format(modname, module_files[modname], s))
-                        module_files[modname] = s
-                    else:
-                        submodmatch = submodre.match(line)
-                        if submodmatch is not None:
-                            # '_' is arbitrarily used to distinguish submod from mod.
-                            parents = submodmatch.group(1).lower().split(':')
-                            submodname = parents[0] + '_' + submodmatch.group(2).lower()
-
-                            if submodname in submodule_files:
-                                raise InvalidArguments(
-                                    'Namespace collision: submodule {} defined in '
-                                    'two files {} and {}.'.format(submodname, submodule_files[submodname], s))
-                            submodule_files[submodname] = s
-
-        self.fortran_deps[target.get_basename()] = {**module_files, **submodule_files}
-
-    def get_fortran_deps(self, compiler: FortranCompiler, src: Path, target) -> T.List[str]:
-        """
-        Find all module and submodule needed by a Fortran target
-        """
-
-        dirname = Path(self.get_target_private_dir(target))
-        tdeps = self.fortran_deps[target.get_basename()]
-        srcdir = Path(self.source_dir)
-
-        mod_files = _scan_fortran_file_deps(src, srcdir, dirname, tdeps, compiler)
-        return mod_files
-
-    def get_cross_stdlib_args(self, target, compiler):
-        if self.environment.machines.matches_build_machine(target.for_machine):
-            return []
-        if not self.environment.properties.host.has_stdlib(compiler.language):
-            return []
-        return compiler.get_no_stdinc_args()
-
-    def get_compile_debugfile_args(self, compiler, target, objfile):
-        # The way MSVC uses PDB files is documented exactly nowhere so
-        # the following is what we have been able to decipher via
-        # reverse engineering.
-        #
-        # Each object file gets the path of its PDB file written
-        # inside it.  This can be either the final PDB (for, say,
-        # foo.exe) or an object pdb (for foo.obj). If the former, then
-        # each compilation step locks the pdb file for writing, which
-        # is a bottleneck and object files from one target can not be
-        # used in a different target. The latter seems to be the
-        # sensible one (and what Unix does) but there is a catch.  If
-        # you try to use precompiled headers MSVC will error out
-        # because both source and pch pdbs go in the same file and
-        # they must be the same.
-        #
-        # This means:
-        #
-        # - pch files must be compiled anew for every object file (negating
-        #   the entire point of having them in the first place)
-        # - when using pch, output must go to the target pdb
-        #
-        # Since both of these are broken in some way, use the one that
-        # works for each target. This unfortunately means that you
-        # can't combine pch and object extraction in a single target.
-        #
-        # PDB files also lead to filename collisions. A target foo.exe
-        # has a corresponding foo.pdb. A shared library foo.dll _also_
-        # has pdb file called foo.pdb. So will a static library
-        # foo.lib, which clobbers both foo.pdb _and_ the dll file's
-        # export library called foo.lib (by default, currently we name
-        # them libfoo.a to avoidt this issue). You can give the files
-        # unique names such as foo_exe.pdb but VC also generates a
-        # bunch of other files which take their names from the target
-        # basename (i.e. "foo") and stomp on each other.
-        #
-        # CMake solves this problem by doing two things. First of all
-        # static libraries do not generate pdb files at
-        # all. Presumably you don't need them and VC is smart enough
-        # to look up the original data when linking (speculation, not
-        # tested). The second solution is that you can only have
-        # target named "foo" as an exe, shared lib _or_ static
-        # lib. This makes filename collisions not happen. The downside
-        # is that you can't have an executable foo that uses a shared
-        # library libfoo.so, which is a common idiom on Unix.
-        #
-        # If you feel that the above is completely wrong and all of
-        # this is actually doable, please send patches.
-
-        if target.has_pch():
-            tfilename = self.get_target_filename_abs(target)
-            return compiler.get_compile_debugfile_args(tfilename, pch=True)
-        else:
-            return compiler.get_compile_debugfile_args(objfile, pch=False)
-
-    def get_link_debugfile_name(self, linker, target, outname):
-        return linker.get_link_debugfile_name(outname)
-
-    def get_link_debugfile_args(self, linker, target, outname):
-        return linker.get_link_debugfile_args(outname)
-
-    def generate_llvm_ir_compile(self, target, src):
-        compiler = get_compiler_for_source(target.compilers.values(), src)
-        commands = compiler.compiler_args()
-        # Compiler args for compiling this target
-        commands += compilers.get_base_compile_args(self.environment.coredata.base_options,
-                                                    compiler)
-        if isinstance(src, File):
-            if src.is_built:
-                src_filename = os.path.join(src.subdir, src.fname)
-            else:
-                src_filename = src.fname
-        elif os.path.isabs(src):
-            src_filename = os.path.basename(src)
-        else:
-            src_filename = src
-        obj_basename = self.canonicalize_filename(src_filename)
-        rel_obj = os.path.join(self.get_target_private_dir(target), obj_basename)
-        rel_obj += '.' + self.environment.machines[target.for_machine].get_object_suffix()
-        commands += self.get_compile_debugfile_args(compiler, target, rel_obj)
-        if isinstance(src, File) and src.is_built:
-            rel_src = src.fname
-        elif isinstance(src, File):
-            rel_src = src.rel_to_builddir(self.build_to_src)
-        else:
-            raise InvalidArguments('Invalid source type: {!r}'.format(src))
-        # Write the Ninja build command
-        compiler_name = self.get_compiler_rule_name('llvm_ir', compiler.for_machine)
-        element = NinjaBuildElement(self.all_outputs, rel_obj, compiler_name, rel_src)
-        element.add_item('ARGS', commands)
-        self.add_build(element)
-        return rel_obj
-
-    def get_source_dir_include_args(self, target, compiler):
-        curdir = target.get_subdir()
-        tmppath = os.path.normpath(os.path.join(self.build_to_src, curdir))
-        return compiler.get_include_args(tmppath, False)
-
-    def get_build_dir_include_args(self, target, compiler):
-        curdir = target.get_subdir()
-        if curdir == '':
-            curdir = '.'
-        return compiler.get_include_args(curdir, False)
-
-    @lru_cache(maxsize=None)
-    def get_normpath_target(self, source) -> str:
-        return os.path.normpath(source)
-
-    def get_custom_target_dir_include_args(self, target, compiler):
-        custom_target_include_dirs = []
-        for i in target.get_generated_sources():
-            # Generator output goes into the target private dir which is
-            # already in the include paths list. Only custom targets have their
-            # own target build dir.
-            if not isinstance(i, (build.CustomTarget, build.CustomTargetIndex)):
-                continue
-            idir = self.get_normpath_target(self.get_target_dir(i))
-            if not idir:
-                idir = '.'
-            if idir not in custom_target_include_dirs:
-                custom_target_include_dirs.append(idir)
-        incs = []
-        for i in custom_target_include_dirs:
-            incs += compiler.get_include_args(i, False)
-        return incs
-
-    @lru_cache(maxsize=None)
-    def generate_inc_dir(self, compiler, d, basedir, is_system):
-        # Avoid superfluous '/.' at the end of paths when d is '.'
-        if d not in ('', '.'):
-            expdir = os.path.normpath(os.path.join(basedir, d))
-        else:
-            expdir = basedir
-        srctreedir = os.path.normpath(os.path.join(self.build_to_src, expdir))
-        sargs = compiler.get_include_args(srctreedir, is_system)
-        # There may be include dirs where a build directory has not been
-        # created for some source dir. For example if someone does this:
-        #
-        # inc = include_directories('foo/bar/baz')
-        #
-        # But never subdir()s into the actual dir.
-        if os.path.isdir(os.path.join(self.environment.get_build_dir(), expdir)):
-            bargs = compiler.get_include_args(expdir, is_system)
-        else:
-            bargs = []
-        return (sargs, bargs)
-
-    @lru_cache(maxsize=None)
-    def _generate_single_compile(self, target, compiler, is_generated=False):
-        base_proxy = self.get_base_options_for_target(target)
-        # Create an empty commands list, and start adding arguments from
-        # various sources in the order in which they must override each other
-        commands = compiler.compiler_args()
-        # Start with symbol visibility.
-        commands += compiler.gnu_symbol_visibility_args(target.gnu_symbol_visibility)
-        # Add compiler args for compiling this target derived from 'base' build
-        # options passed on the command-line, in default_options, etc.
-        # These have the lowest priority.
-        commands += compilers.get_base_compile_args(base_proxy,
-                                                    compiler)
-        # The code generated by valac is usually crap and has tons of unused
-        # variables and such, so disable warnings for Vala C sources.
-        no_warn_args = (is_generated == 'vala')
-        # Add compiler args and include paths from several sources; defaults,
-        # build options, external dependencies, etc.
-        commands += self.generate_basic_compiler_args(target, compiler, no_warn_args)
-        # Add custom target dirs as includes automatically, but before
-        # target-specific include directories.
-        # XXX: Not sure if anyone actually uses this? It can cause problems in
-        # situations which increase the likelihood for a header name collision,
-        # such as in subprojects.
-        commands += self.get_custom_target_dir_include_args(target, compiler)
-        # Add include dirs from the `include_directories:` kwarg on the target
-        # and from `include_directories:` of internal deps of the target.
-        #
-        # Target include dirs should override internal deps include dirs.
-        # This is handled in BuildTarget.process_kwargs()
-        #
-        # Include dirs from internal deps should override include dirs from
-        # external deps and must maintain the order in which they are specified.
-        # Hence, we must reverse the list so that the order is preserved.
-        for i in reversed(target.get_include_dirs()):
-            basedir = i.get_curdir()
-            # We should iterate include dirs in reversed orders because
-            # -Ipath will add to begin of array. And without reverse
-            # flags will be added in reversed order.
-            for d in reversed(i.get_incdirs()):
-                # Add source subdir first so that the build subdir overrides it
-                (compile_obj, includeargs) = self.generate_inc_dir(compiler, d, basedir, i.is_system)
-                commands += compile_obj
-                commands += includeargs
-            for d in i.get_extra_build_dirs():
-                commands += compiler.get_include_args(d, i.is_system)
-        # Add per-target compile args, f.ex, `c_args : ['-DFOO']`. We set these
-        # near the end since these are supposed to override everything else.
-        commands += self.escape_extra_args(compiler,
-                                           target.get_extra_args(compiler.get_language()))
-
-        # D specific additional flags
-        if compiler.language == 'd':
-            commands += compiler.get_feature_args(target.d_features, self.build_to_src)
-
-        # Add source dir and build dir. Project-specific and target-specific
-        # include paths must override per-target compile args, include paths
-        # from external dependencies, internal dependencies, and from
-        # per-target `include_directories:`
-        #
-        # We prefer headers in the build dir over the source dir since, for
-        # instance, the user might have an srcdir == builddir Autotools build
-        # in their source tree. Many projects that are moving to Meson have
-        # both Meson and Autotools in parallel as part of the transition.
-        if target.implicit_include_directories:
-            commands += self.get_source_dir_include_args(target, compiler)
-        if target.implicit_include_directories:
-            commands += self.get_build_dir_include_args(target, compiler)
-        # Finally add the private dir for the target to the include path. This
-        # must override everything else and must be the final path added.
-        commands += compiler.get_include_args(self.get_target_private_dir(target), False)
-        return commands
-
-    def generate_single_compile(self, target, src, is_generated=False, header_deps=None, order_deps=None):
-        """
-        Compiles C/C++, ObjC/ObjC++, Fortran, and D sources
-        """
-        header_deps = header_deps if header_deps is not None else []
-        order_deps = order_deps if order_deps is not None else []
-
-        if isinstance(src, str) and src.endswith('.h'):
-            raise AssertionError('BUG: sources should not contain headers {!r}'.format(src))
-
-        compiler = get_compiler_for_source(target.compilers.values(), src)
-        commands = self._generate_single_compile(target, compiler, is_generated)
-        commands = commands.compiler.compiler_args(commands)
-
-        # Create introspection information
-        if is_generated is False:
-            self.create_target_source_introspection(target, compiler, commands, [src], [])
-        else:
-            self.create_target_source_introspection(target, compiler, commands, [], [src])
-
-        build_dir = self.environment.get_build_dir()
-        if isinstance(src, File):
-            rel_src = src.rel_to_builddir(self.build_to_src)
-            if os.path.isabs(rel_src):
-                # Source files may not be from the source directory if they originate in source-only libraries,
-                # so we can't assert that the absolute path is anywhere in particular.
-                if src.is_built:
-                    assert rel_src.startswith(build_dir)
-                    rel_src = rel_src[len(build_dir) + 1:]
-        elif is_generated:
-            raise AssertionError('BUG: broken generated source file handling for {!r}'.format(src))
-        else:
-            raise InvalidArguments('Invalid source type: {!r}'.format(src))
-        obj_basename = self.object_filename_from_source(target, src)
-        rel_obj = os.path.join(self.get_target_private_dir(target), obj_basename)
-        dep_file = compiler.depfile_for_object(rel_obj)
-
-        # Add MSVC debug file generation compile flags: /Fd /FS
-        commands += self.get_compile_debugfile_args(compiler, target, rel_obj)
-
-        # PCH handling
-        if self.environment.coredata.base_options.get('b_pch', False):
-            commands += self.get_pch_include_args(compiler, target)
-            pchlist = target.get_pch(compiler.language)
-        else:
-            pchlist = []
-        if not pchlist:
-            pch_dep = []
-        elif compiler.id == 'intel':
-            pch_dep = []
-        else:
-            arr = []
-            i = os.path.join(self.get_target_private_dir(target), compiler.get_pch_name(pchlist[0]))
-            arr.append(i)
-            pch_dep = arr
-
-        compiler_name = self.compiler_to_rule_name(compiler)
-        extra_deps = []
-        if compiler.get_language() == 'fortran':
-            # Can't read source file to scan for deps if it's generated later
-            # at build-time. Skip scanning for deps, and just set the module
-            # outdir argument instead.
-            # https://github.com/mesonbuild/meson/issues/1348
-            if not is_generated:
-                abs_src = Path(build_dir) / rel_src
-                extra_deps += self.get_fortran_deps(compiler, abs_src, target)
-            # Dependency hack. Remove once multiple outputs in Ninja is fixed:
-            # https://groups.google.com/forum/#!topic/ninja-build/j-2RfBIOd_8
-            for modname, srcfile in self.fortran_deps[target.get_basename()].items():
-                modfile = os.path.join(self.get_target_private_dir(target),
-                                       compiler.module_name_to_filename(modname))
-
-                if srcfile == src:
-                    crstr = self.get_rule_suffix(target.for_machine)
-                    depelem = NinjaBuildElement(self.all_outputs, modfile, 'FORTRAN_DEP_HACK' + crstr, rel_obj)
-                    self.add_build(depelem)
-            commands += compiler.get_module_outdir_args(self.get_target_private_dir(target))
-
-        element = NinjaBuildElement(self.all_outputs, rel_obj, compiler_name, rel_src)
-        self.add_header_deps(target, element, header_deps)
-        for d in extra_deps:
-            element.add_dep(d)
-        for d in order_deps:
-            if isinstance(d, File):
-                d = d.rel_to_builddir(self.build_to_src)
-            elif not self.has_dir_part(d):
-                d = os.path.join(self.get_target_private_dir(target), d)
-            element.add_orderdep(d)
-        element.add_dep(pch_dep)
-        for i in self.get_fortran_orderdeps(target, compiler):
-            element.add_orderdep(i)
-        element.add_item('DEPFILE', dep_file)
-        element.add_item('ARGS', commands)
-        self.add_build(element)
-        return rel_obj
-
-    def add_header_deps(self, target, ninja_element, header_deps):
-        for d in header_deps:
-            if isinstance(d, File):
-                d = d.rel_to_builddir(self.build_to_src)
-            elif not self.has_dir_part(d):
-                d = os.path.join(self.get_target_private_dir(target), d)
-            ninja_element.add_dep(d)
-
-    def has_dir_part(self, fname):
-        # FIXME FIXME: The usage of this is a terrible and unreliable hack
-        if isinstance(fname, File):
-            return fname.subdir != ''
-        return has_path_sep(fname)
-
-    # Fortran is a bit weird (again). When you link against a library, just compiling a source file
-    # requires the mod files that are output when single files are built. To do this right we would need to
-    # scan all inputs and write out explicit deps for each file. That is stoo slow and too much effort so
-    # instead just have an ordered dependency on the library. This ensures all required mod files are created.
-    # The real deps are then detected via dep file generation from the compiler. This breaks on compilers that
-    # produce incorrect dep files but such is life.
-    def get_fortran_orderdeps(self, target, compiler):
-        if compiler.language != 'fortran':
-            return []
-        return [os.path.join(self.get_target_dir(lt), lt.get_filename()) for lt in target.link_targets]
-
-    def generate_msvc_pch_command(self, target, compiler, pch):
-        header = pch[0]
-        pchname = compiler.get_pch_name(header)
-        dst = os.path.join(self.get_target_private_dir(target), pchname)
-
-        commands = []
-        commands += self.generate_basic_compiler_args(target, compiler)
-
-        if len(pch) == 1:
-            # Auto generate PCH.
-            source = self.create_msvc_pch_implementation(target, compiler.get_language(), pch[0])
-            pch_header_dir = os.path.dirname(os.path.join(self.build_to_src, target.get_source_subdir(), header))
-            commands += compiler.get_include_args(pch_header_dir, False)
-        else:
-            source = os.path.join(self.build_to_src, target.get_source_subdir(), pch[1])
-
-        just_name = os.path.basename(header)
-        (objname, pch_args) = compiler.gen_pch_args(just_name, source, dst)
-        commands += pch_args
-        commands += self._generate_single_compile(target, compiler)
-        commands += self.get_compile_debugfile_args(compiler, target, objname)
-        dep = dst + '.' + compiler.get_depfile_suffix()
-        return commands, dep, dst, [objname], source
-
-    def generate_gcc_pch_command(self, target, compiler, pch):
-        commands = self._generate_single_compile(target, compiler)
-        if pch.split('.')[-1] == 'h' and compiler.language == 'cpp':
-            # Explicitly compile pch headers as C++. If Clang is invoked in C++ mode, it actually warns if
-            # this option is not set, and for gcc it also makes sense to use it.
-            commands += ['-x', 'c++-header']
-        dst = os.path.join(self.get_target_private_dir(target),
-                           os.path.basename(pch) + '.' + compiler.get_pch_suffix())
-        dep = dst + '.' + compiler.get_depfile_suffix()
-        return commands, dep, dst, []  # Gcc does not create an object file during pch generation.
-
-    def generate_pch(self, target, header_deps=None):
-        header_deps = header_deps if header_deps is not None else []
-        pch_objects = []
-        for lang in ['c', 'cpp']:
-            pch = target.get_pch(lang)
-            if not pch:
-                continue
-            if not has_path_sep(pch[0]) or not has_path_sep(pch[-1]):
-                msg = 'Precompiled header of {!r} must not be in the same ' \
-                      'directory as source, please put it in a subdirectory.' \
-                      ''.format(target.get_basename())
-                raise InvalidArguments(msg)
-            compiler = target.compilers[lang]
-            if isinstance(compiler, VisualStudioLikeCompiler):
-                (commands, dep, dst, objs, src) = self.generate_msvc_pch_command(target, compiler, pch)
-                extradep = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0])
-            elif compiler.id == 'intel':
-                # Intel generates on target generation
-                continue
-            else:
-                src = os.path.join(self.build_to_src, target.get_source_subdir(), pch[0])
-                (commands, dep, dst, objs) = self.generate_gcc_pch_command(target, compiler, pch[0])
-                extradep = None
-            pch_objects += objs
-            rulename = self.compiler_to_pch_rule_name(compiler)
-            elem = NinjaBuildElement(self.all_outputs, dst, rulename, src)
-            if extradep is not None:
-                elem.add_dep(extradep)
-            self.add_header_deps(target, elem, header_deps)
-            elem.add_item('ARGS', commands)
-            elem.add_item('DEPFILE', dep)
-            self.add_build(elem)
-        return pch_objects
-
-    def get_target_shsym_filename(self, target):
-        # Always name the .symbols file after the primary build output because it always exists
-        targetdir = self.get_target_private_dir(target)
-        return os.path.join(targetdir, target.get_filename() + '.symbols')
-
-    def generate_shsym(self, target):
-        target_file = self.get_target_filename(target)
-        symname = self.get_target_shsym_filename(target)
-        elem = NinjaBuildElement(self.all_outputs, symname, 'SHSYM', target_file)
-        # The library we will actually link to, which is an import library on Windows (not the DLL)
-        elem.add_item('IMPLIB', self.get_target_filename_for_linking(target))
-        if self.environment.is_cross_build():
-            elem.add_item('CROSS', '--cross-host=' + self.environment.machines[target.for_machine].system)
-        self.add_build(elem)
-
-    def get_cross_stdlib_link_args(self, target, linker):
-        if isinstance(target, build.StaticLibrary) or \
-           self.environment.machines.matches_build_machine(target.for_machine):
-            return []
-        if not self.environment.properties.host.has_stdlib(linker.language):
-            return []
-        return linker.get_no_stdlib_link_args()
-
-    def get_import_filename(self, target):
-        return os.path.join(self.get_target_dir(target), target.import_filename)
-
-    def get_target_type_link_args(self, target, linker):
-        commands = []
-        if isinstance(target, build.Executable):
-            # Currently only used with the Swift compiler to add '-emit-executable'
-            commands += linker.get_std_exe_link_args()
-            # If export_dynamic, add the appropriate linker arguments
-            if target.export_dynamic:
-                commands += linker.gen_export_dynamic_link_args(self.environment)
-            # If implib, and that's significant on this platform (i.e. Windows using either GCC or Visual Studio)
-            if target.import_filename:
-                commands += linker.gen_import_library_args(self.get_import_filename(target))
-            if target.pie:
-                commands += linker.get_pie_link_args()
-        elif isinstance(target, build.SharedLibrary):
-            if isinstance(target, build.SharedModule):
-                options = self.environment.coredata.base_options
-                commands += linker.get_std_shared_module_link_args(options)
-            else:
-                commands += linker.get_std_shared_lib_link_args()
-            # All shared libraries are PIC
-            commands += linker.get_pic_args()
-            # Add -Wl,-soname arguments on Linux, -install_name on OS X
-            commands += linker.get_soname_args(
-                self.environment, target.prefix, target.name, target.suffix,
-                target.soversion, target.darwin_versions,
-                isinstance(target, build.SharedModule))
-            # This is only visited when building for Windows using either GCC or Visual Studio
-            if target.vs_module_defs and hasattr(linker, 'gen_vs_module_defs_args'):
-                commands += linker.gen_vs_module_defs_args(target.vs_module_defs.rel_to_builddir(self.build_to_src))
-            # This is only visited when building for Windows using either GCC or Visual Studio
-            if target.import_filename:
-                commands += linker.gen_import_library_args(self.get_import_filename(target))
-        elif isinstance(target, build.StaticLibrary):
-            commands += linker.get_std_link_args()
-        else:
-            raise RuntimeError('Unknown build target type.')
-        return commands
-
-    def get_target_type_link_args_post_dependencies(self, target, linker):
-        commands = []
-        if isinstance(target, build.Executable):
-            # If gui_app is significant on this platform, add the appropriate linker arguments.
-            # Unfortunately this can't be done in get_target_type_link_args, because some misguided
-            # libraries (such as SDL2) add -mwindows to their link flags.
-            commands += linker.get_gui_app_args(target.gui_app)
-        return commands
-
-    def get_link_whole_args(self, linker, target):
-        target_args = self.build_target_link_arguments(linker, target.link_whole_targets)
-        return linker.get_link_whole_for(target_args) if len(target_args) else []
-
-    @lru_cache(maxsize=None)
-    def guess_library_absolute_path(self, linker, libname, search_dirs, patterns):
-        for d in search_dirs:
-            for p in patterns:
-                trial = CCompiler._get_trials_from_pattern(p, d, libname)
-                if not trial:
-                    continue
-                trial = CCompiler._get_file_from_list(self.environment, trial)
-                if not trial:
-                    continue
-                # Return the first result
-                return trial
-
-    def guess_external_link_dependencies(self, linker, target, commands, internal):
-        # Ideally the linker would generate dependency information that could be used.
-        # But that has 2 problems:
-        # * currently ld can not create dependency information in a way that ninja can use:
-        #   https://sourceware.org/bugzilla/show_bug.cgi?id=22843
-        # * Meson optimizes libraries from the same build using the symbol extractor.
-        #   Just letting ninja use ld generated dependencies would undo this optimization.
-        search_dirs = OrderedSet()
-        libs = OrderedSet()
-        absolute_libs = []
-
-        build_dir = self.environment.get_build_dir()
-        # the following loop sometimes consumes two items from command in one pass
-        it = iter(linker.native_args_to_unix(commands))
-        for item in it:
-            if item in internal and not item.startswith('-'):
-                continue
-
-            if item.startswith('-L'):
-                if len(item) > 2:
-                    path = item[2:]
-                else:
-                    try:
-                        path = next(it)
-                    except StopIteration:
-                        mlog.warning("Generated linker command has -L argument without following path")
-                        break
-                if not os.path.isabs(path):
-                    path = os.path.join(build_dir, path)
-                search_dirs.add(path)
-            elif item.startswith('-l'):
-                if len(item) > 2:
-                    lib = item[2:]
-                else:
-                    try:
-                        lib = next(it)
-                    except StopIteration:
-                        mlog.warning("Generated linker command has '-l' argument without following library name")
-                        break
-                libs.add(lib)
-            elif os.path.isabs(item) and self.environment.is_library(item) and os.path.isfile(item):
-                absolute_libs.append(item)
-
-        guessed_dependencies = []
-        # TODO The get_library_naming requirement currently excludes link targets that use d or fortran as their main linker
-        if hasattr(linker, 'get_library_naming'):
-            search_dirs = tuple(search_dirs) + tuple(linker.get_library_dirs(self.environment))
-            static_patterns = linker.get_library_naming(self.environment, LibType.STATIC, strict=True)
-            shared_patterns = linker.get_library_naming(self.environment, LibType.SHARED, strict=True)
-            for libname in libs:
-                # be conservative and record most likely shared and static resolution, because we don't know exactly
-                # which one the linker will prefer
-                staticlibs = self.guess_library_absolute_path(linker, libname,
-                                                              search_dirs, static_patterns)
-                sharedlibs = self.guess_library_absolute_path(linker, libname,
-                                                              search_dirs, shared_patterns)
-                if staticlibs:
-                    guessed_dependencies.append(staticlibs.resolve().as_posix())
-                if sharedlibs:
-                    guessed_dependencies.append(sharedlibs.resolve().as_posix())
-
-        return guessed_dependencies + absolute_libs
-
-    def generate_link(self, target, outname, obj_list, linker, extra_args=None, stdlib_args=None):
-        extra_args = extra_args if extra_args is not None else []
-        stdlib_args = stdlib_args if stdlib_args is not None else []
-        implicit_outs = []
-        if isinstance(target, build.StaticLibrary):
-            linker_base = 'STATIC'
-        else:
-            linker_base = linker.get_language() # Fixme.
-        if isinstance(target, build.SharedLibrary):
-            self.generate_shsym(target)
-        crstr = self.get_rule_suffix(target.for_machine)
-        linker_rule = linker_base + '_LINKER' + crstr
-        # Create an empty commands list, and start adding link arguments from
-        # various sources in the order in which they must override each other
-        # starting from hard-coded defaults followed by build options and so on.
-        #
-        # Once all the linker options have been passed, we will start passing
-        # libraries and library paths from internal and external sources.
-        commands = linker.compiler_args()
-        # First, the trivial ones that are impossible to override.
-        #
-        # Add linker args for linking this target derived from 'base' build
-        # options passed on the command-line, in default_options, etc.
-        # These have the lowest priority.
-        if isinstance(target, build.StaticLibrary):
-            commands += linker.get_base_link_args(self.get_base_options_for_target(target))
-        else:
-            commands += compilers.get_base_link_args(self.get_base_options_for_target(target),
-                                                     linker,
-                                                     isinstance(target, build.SharedModule))
-        # Add -nostdlib if needed; can't be overridden
-        commands += self.get_cross_stdlib_link_args(target, linker)
-        # Add things like /NOLOGO; usually can't be overridden
-        commands += linker.get_linker_always_args()
-        # Add buildtype linker args: optimization level, etc.
-        commands += linker.get_buildtype_linker_args(self.get_option_for_target('buildtype', target))
-        # Add /DEBUG and the pdb filename when using MSVC
-        if self.get_option_for_target('debug', target):
-            commands += self.get_link_debugfile_args(linker, target, outname)
-            debugfile = self.get_link_debugfile_name(linker, target, outname)
-            if debugfile is not None:
-                implicit_outs += [debugfile]
-        # Add link args specific to this BuildTarget type, such as soname args,
-        # PIC, import library generation, etc.
-        commands += self.get_target_type_link_args(target, linker)
-        # Archives that are copied wholesale in the result. Must be before any
-        # other link targets so missing symbols from whole archives are found in those.
-        if not isinstance(target, build.StaticLibrary):
-            commands += self.get_link_whole_args(linker, target)
-
-        if not isinstance(target, build.StaticLibrary):
-            # Add link args added using add_project_link_arguments()
-            commands += self.build.get_project_link_args(linker, target.subproject, target.for_machine)
-            # Add link args added using add_global_link_arguments()
-            # These override per-project link arguments
-            commands += self.build.get_global_link_args(linker, target.for_machine)
-            # Link args added from the env: LDFLAGS. We want these to override
-            # all the defaults but not the per-target link args.
-            commands += self.environment.coredata.get_external_link_args(target.for_machine, linker.get_language())
-
-        # Now we will add libraries and library paths from various sources
-
-        # Add link args to link to all internal libraries (link_with:) and
-        # internal dependencies needed by this target.
-        if linker_base == 'STATIC':
-            # Link arguments of static libraries are not put in the command
-            # line of the library. They are instead appended to the command
-            # line where the static library is used.
-            dependencies = []
-        else:
-            dependencies = target.get_dependencies()
-        internal = self.build_target_link_arguments(linker, dependencies)
-        commands += internal
-        # Only non-static built targets need link args and link dependencies
-        if not isinstance(target, build.StaticLibrary):
-            # For 'automagic' deps: Boost and GTest. Also dependency('threads').
-            # pkg-config puts the thread flags itself via `Cflags:`
-
-            commands += linker.get_target_link_args(target)
-            # External deps must be last because target link libraries may depend on them.
-            for dep in target.get_external_deps():
-                # Extend without reordering or de-dup to preserve `-L -l` sets
-                # https://github.com/mesonbuild/meson/issues/1718
-                commands.extend_preserving_lflags(linker.get_dependency_link_args(dep))
-            for d in target.get_dependencies():
-                if isinstance(d, build.StaticLibrary):
-                    for dep in d.get_external_deps():
-                        commands.extend_preserving_lflags(linker.get_dependency_link_args(dep))
-
-        # Add link args specific to this BuildTarget type that must not be overridden by dependencies
-        commands += self.get_target_type_link_args_post_dependencies(target, linker)
-
-        # Add link args for c_* or cpp_* build options. Currently this only
-        # adds c_winlibs and cpp_winlibs when building for Windows. This needs
-        # to be after all internal and external libraries so that unresolved
-        # symbols from those can be found here. This is needed when the
-        # *_winlibs that we want to link to are static mingw64 libraries.
-        if hasattr(linker, 'get_language'):
-            # The static linker doesn't know what language it is building, so we
-            # don't know what option. Fortunately, it doesn't care to see the
-            # language-specific options either.
-            #
-            # We shouldn't check whether we are making a static library, because
-            # in the LTO case we do use a real compiler here.
-            commands += linker.get_option_link_args(self.environment.coredata.compiler_options[target.for_machine][linker.get_language()])
-
-        dep_targets = []
-        dep_targets.extend(self.guess_external_link_dependencies(linker, target, commands, internal))
-
-        # Set runtime-paths so we can run executables without needing to set
-        # LD_LIBRARY_PATH, etc in the environment. Doesn't work on Windows.
-        if has_path_sep(target.name):
-            # Target names really should not have slashes in them, but
-            # unfortunately we did not check for that and some downstream projects
-            # now have them. Once slashes are forbidden, remove this bit.
-            target_slashname_workaround_dir = os.path.join(
-                os.path.dirname(target.name),
-                self.get_target_dir(target))
-        else:
-            target_slashname_workaround_dir = self.get_target_dir(target)
-        (rpath_args, target.rpath_dirs_to_remove) = \
-                    linker.build_rpath_args(self.environment,
-                                            self.environment.get_build_dir(),
-                                            target_slashname_workaround_dir,
-                                            self.determine_rpath_dirs(target),
-                                            target.build_rpath,
-                                            target.install_rpath)
-        commands += rpath_args
-        # Add libraries generated by custom targets
-        custom_target_libraries = self.get_custom_target_provided_libraries(target)
-        commands += extra_args
-        commands += custom_target_libraries
-        commands += stdlib_args # Standard library arguments go last, because they never depend on anything.
-        dep_targets.extend([self.get_dependency_filename(t) for t in dependencies])
-        dep_targets.extend([self.get_dependency_filename(t)
-                            for t in target.link_depends])
-        elem = NinjaBuildElement(self.all_outputs, outname, linker_rule, obj_list, implicit_outs=implicit_outs)
-        elem.add_dep(dep_targets + custom_target_libraries)
-        elem.add_item('LINK_ARGS', commands)
-        return elem
-
-    def get_dependency_filename(self, t):
-        if isinstance(t, build.SharedLibrary):
-            return self.get_target_shsym_filename(t)
-        elif isinstance(t, mesonlib.File):
-            if t.is_built:
-                return t.relative_name()
-            else:
-                return t.absolute_path(self.environment.get_source_dir(),
-                                       self.environment.get_build_dir())
-        return self.get_target_filename(t)
-
-    def generate_shlib_aliases(self, target, outdir):
-        aliases = target.get_aliases()
-        for alias, to in aliases.items():
-            aliasfile = os.path.join(self.environment.get_build_dir(), outdir, alias)
-            try:
-                os.remove(aliasfile)
-            except Exception:
-                pass
-            try:
-                os.symlink(to, aliasfile)
-            except NotImplementedError:
-                mlog.debug("Library versioning disabled because symlinks are not supported.")
-            except OSError:
-                mlog.debug("Library versioning disabled because we do not have symlink creation privileges.")
-
-    def generate_custom_target_clean(self, trees):
-        e = NinjaBuildElement(self.all_outputs, 'meson-clean-ctlist', 'CUSTOM_COMMAND', 'PHONY')
-        d = CleanTrees(self.environment.get_build_dir(), trees)
-        d_file = os.path.join(self.environment.get_scratch_dir(), 'cleantrees.dat')
-        e.add_item('COMMAND', self.environment.get_build_command() + ['--internal', 'cleantrees', d_file])
-        e.add_item('description', 'Cleaning custom target directories')
-        self.add_build(e)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-clean-ctlist')
-        # Write out the data file passed to the script
-        with open(d_file, 'wb') as ofile:
-            pickle.dump(d, ofile)
-        return 'clean-ctlist'
-
-    def generate_gcov_clean(self):
-        gcno_elem = NinjaBuildElement(self.all_outputs, 'meson-clean-gcno', 'CUSTOM_COMMAND', 'PHONY')
-        gcno_elem.add_item('COMMAND', mesonlib.meson_command + ['--internal', 'delwithsuffix', '.', 'gcno'])
-        gcno_elem.add_item('description', 'Deleting gcno files')
-        self.add_build(gcno_elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-clean-gcno')
-
-        gcda_elem = NinjaBuildElement(self.all_outputs, 'meson-clean-gcda', 'CUSTOM_COMMAND', 'PHONY')
-        gcda_elem.add_item('COMMAND', mesonlib.meson_command + ['--internal', 'delwithsuffix', '.', 'gcda'])
-        gcda_elem.add_item('description', 'Deleting gcda files')
-        self.add_build(gcda_elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-clean-gcda')
-
-    def get_user_option_args(self):
-        cmds = []
-        for (k, v) in self.environment.coredata.user_options.items():
-            cmds.append('-D' + k + '=' + (v.value if isinstance(v.value, str) else str(v.value).lower()))
-        # The order of these arguments must be the same between runs of Meson
-        # to ensure reproducible output. The order we pass them shouldn't
-        # affect behavior in any other way.
-        return sorted(cmds)
-
-    def generate_dist(self):
-        elem = NinjaBuildElement(self.all_outputs, 'meson-dist', 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('DESC', 'Creating source packages')
-        elem.add_item('COMMAND', self.environment.get_build_command() + ['dist'])
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-dist')
-
-    def generate_scanbuild(self):
-        if not environment.detect_scanbuild():
-            return
-        if ('', 'scan-build') in self.build.run_target_names:
-            return
-        cmd = self.environment.get_build_command() + \
-            ['--internal', 'scanbuild', self.environment.source_dir, self.environment.build_dir] + \
-            self.environment.get_build_command() + self.get_user_option_args()
-        elem = NinjaBuildElement(self.all_outputs, 'meson-scan-build', 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-scan-build')
-
-    def generate_clangtool(self, name):
-        target_name = 'clang-' + name
-        if not os.path.exists(os.path.join(self.environment.source_dir, '.clang-' + name)) and \
-                not os.path.exists(os.path.join(self.environment.source_dir, '_clang-' + name)):
-            return
-        if target_name in self.all_outputs:
-            return
-        if ('', target_name) in self.build.run_target_names:
-            return
-        cmd = self.environment.get_build_command() + \
-            ['--internal', 'clang' + name, self.environment.source_dir, self.environment.build_dir]
-        elem = NinjaBuildElement(self.all_outputs, 'meson-' + target_name, 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        self.create_target_alias('meson-' + target_name)
-
-    def generate_clangformat(self):
-        if not environment.detect_clangformat():
-            return
-        self.generate_clangtool('format')
-
-    def generate_clangtidy(self):
-        import shutil
-        if not shutil.which('clang-tidy'):
-            return
-        self.generate_clangtool('tidy')
-
-    def generate_tags(self, tool, target_name):
-        import shutil
-        if not shutil.which(tool):
-            return
-        if ('', target_name) in self.build.run_target_names:
-            return
-        if target_name in self.all_outputs:
-            return
-        cmd = self.environment.get_build_command() + \
-            ['--internal', 'tags', tool, self.environment.source_dir]
-        elem = NinjaBuildElement(self.all_outputs, 'meson-' + target_name, 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-' + target_name)
-
-    # For things like scan-build and other helper tools we might have.
-    def generate_utils(self):
-        self.generate_scanbuild()
-        self.generate_clangformat()
-        self.generate_clangtidy()
-        self.generate_tags('etags', 'TAGS')
-        self.generate_tags('ctags', 'ctags')
-        self.generate_tags('cscope', 'cscope')
-        cmd = self.environment.get_build_command() + ['--internal', 'uninstall']
-        elem = NinjaBuildElement(self.all_outputs, 'meson-uninstall', 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('COMMAND', cmd)
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-        # Alias that runs the target defined above
-        self.create_target_alias('meson-uninstall')
-
-    def generate_ending(self):
-        targetlist = []
-        for t in self.get_build_by_default_targets().values():
-            # Add the first output of each target to the 'all' target so that
-            # they are all built
-            targetlist.append(os.path.join(self.get_target_dir(t), t.get_outputs()[0]))
-
-        elem = NinjaBuildElement(self.all_outputs, 'all', 'phony', targetlist)
-        self.add_build(elem)
-
-        elem = NinjaBuildElement(self.all_outputs, 'meson-clean', 'CUSTOM_COMMAND', 'PHONY')
-        elem.add_item('COMMAND', self.ninja_command + ['-t', 'clean'])
-        elem.add_item('description', 'Cleaning')
-        # Alias that runs the above-defined meson-clean target
-        self.create_target_alias('meson-clean')
-
-        # If we have custom targets in this project, add all their outputs to
-        # the list that is passed to the `cleantrees.py` script. The script
-        # will manually delete all custom_target outputs that are directories
-        # instead of files. This is needed because on platforms other than
-        # Windows, Ninja only deletes directories while cleaning if they are
-        # empty. https://github.com/mesonbuild/meson/issues/1220
-        ctlist = []
-        for t in self.build.get_targets().values():
-            if isinstance(t, build.CustomTarget):
-                # Create a list of all custom target outputs
-                for o in t.get_outputs():
-                    ctlist.append(os.path.join(self.get_target_dir(t), o))
-        if ctlist:
-            elem.add_dep(self.generate_custom_target_clean(ctlist))
-
-        if 'b_coverage' in self.environment.coredata.base_options and \
-           self.environment.coredata.base_options['b_coverage'].value:
-            self.generate_gcov_clean()
-            elem.add_dep('clean-gcda')
-            elem.add_dep('clean-gcno')
-        self.add_build(elem)
-
-        deps = self.get_regen_filelist()
-        elem = NinjaBuildElement(self.all_outputs, 'build.ninja', 'REGENERATE_BUILD', deps)
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-
-        elem = NinjaBuildElement(self.all_outputs, 'reconfigure', 'REGENERATE_BUILD', 'PHONY')
-        elem.add_item('pool', 'console')
-        self.add_build(elem)
-
-        elem = NinjaBuildElement(self.all_outputs, deps, 'phony', '')
-        self.add_build(elem)
-
-    def get_introspection_data(self, target_id, target):
-        if target_id not in self.introspection_data or len(self.introspection_data[target_id]) == 0:
-            return super().get_introspection_data(target_id, target)
-
-        result = []
-        for i in self.introspection_data[target_id].values():
-            result += [i]
-        return result
-
-def load(build_dir):
-    filename = os.path.join(build_dir, 'meson-private', 'install.dat')
-    with open(filename, 'rb') as f:
-        obj = pickle.load(f)
-    return obj
-
-
-def _scan_fortran_file_deps(src: Path, srcdir: Path, dirname: Path, tdeps, compiler) -> T.List[str]:
-    """
-    scan a Fortran file for dependencies. Needs to be distinct from target
-    to allow for recursion induced by `include` statements.er
-
-    It makes a number of assumptions, including
-
-    * `use`, `module`, `submodule` name is not on a continuation line
-
-    Regex
-    -----
-
-    * `incre` works for `#include "foo.f90"` and `include "foo.f90"`
-    * `usere` works for legacy and Fortran 2003 `use` statements
-    * `submodre` is for Fortran >= 2008 `submodule`
-    """
-
-    incre = re.compile(FORTRAN_INCLUDE_PAT, re.IGNORECASE)
-    usere = re.compile(FORTRAN_USE_PAT, re.IGNORECASE)
-    submodre = re.compile(FORTRAN_SUBMOD_PAT, re.IGNORECASE)
-
-    mod_files = []
-    src = Path(src)
-    with src.open(encoding='ascii', errors='ignore') as f:
-        for line in f:
-            # included files
-            incmatch = incre.match(line)
-            if incmatch is not None:
-                incfile = srcdir / incmatch.group(1)
-                if incfile.suffix.lower()[1:] in compiler.file_suffixes:
-                    mod_files.extend(_scan_fortran_file_deps(incfile, srcdir, dirname, tdeps, compiler))
-            # modules
-            usematch = usere.match(line)
-            if usematch is not None:
-                usename = usematch.group(1).lower()
-                if usename == 'intrinsic':  # this keeps the regex simpler
-                    continue
-                if usename not in tdeps:
-                    # The module is not provided by any source file. This
-                    # is due to:
-                    #   a) missing file/typo/etc
-                    #   b) using a module provided by the compiler, such as
-                    #      OpenMP
-                    # There's no easy way to tell which is which (that I
-                    # know of) so just ignore this and go on. Ideally we
-                    # would print a warning message to the user but this is
-                    # a common occurrence, which would lead to lots of
-                    # distracting noise.
-                    continue
-                srcfile = srcdir / tdeps[usename].fname  # type: Path
-                if not srcfile.is_file():
-                    if srcfile.name != src.name:  # generated source file
-                        pass
-                    else:  # subproject
-                        continue
-                elif srcfile.samefile(src):  # self-reference
-                    continue
-
-                mod_name = compiler.module_name_to_filename(usename)
-                mod_files.append(str(dirname / mod_name))
-            else:  # submodules
-                submodmatch = submodre.match(line)
-                if submodmatch is not None:
-                    parents = submodmatch.group(1).lower().split(':')
-                    assert len(parents) in (1, 2), (
-                        'submodule ancestry must be specified as'
-                        ' ancestor:parent but Meson found {}'.format(parents))
-
-                    ancestor_child = '_'.join(parents)
-                    if ancestor_child not in tdeps:
-                        raise MesonException("submodule {} relies on ancestor module {} that was not found.".format(submodmatch.group(2).lower(), ancestor_child.split('_')[0]))
-                    submodsrcfile = srcdir / tdeps[ancestor_child].fname  # type: Path
-                    if not submodsrcfile.is_file():
-                        if submodsrcfile.name != src.name:  # generated source file
-                            pass
-                        else:  # subproject
-                            continue
-                    elif submodsrcfile.samefile(src):  # self-reference
-                        continue
-                    mod_name = compiler.module_name_to_filename(ancestor_child)
-                    mod_files.append(str(dirname / mod_name))
-    return mod_files
diff --git a/meson/mesonbuild/backend/vs2010backend.py b/meson/mesonbuild/backend/vs2010backend.py
deleted file mode 100644 (file)
index f282d02..0000000
+++ /dev/null
@@ -1,1517 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import copy
-import os
-import pickle
-import xml.dom.minidom
-import xml.etree.ElementTree as ET
-import uuid
-import typing as T
-from pathlib import Path, PurePath
-
-from . import backends
-from .. import build
-from .. import dependencies
-from .. import mlog
-from .. import compilers
-from ..interpreter import Interpreter
-from ..mesonlib import (
-    MesonException, File, python_command, replace_if_different
-)
-from ..environment import Environment, build_filename
-
-def autodetect_vs_version(build: T.Optional[build.Build], interpreter: T.Optional[Interpreter]):
-    vs_version = os.getenv('VisualStudioVersion', None)
-    vs_install_dir = os.getenv('VSINSTALLDIR', None)
-    if not vs_install_dir:
-        raise MesonException('Could not detect Visual Studio: Environment variable VSINSTALLDIR is not set!\n'
-                             'Are you running meson from the Visual Studio Developer Command Prompt?')
-    # VisualStudioVersion is set since Visual Studio 12.0, but sometimes
-    # vcvarsall.bat doesn't set it, so also use VSINSTALLDIR
-    if vs_version == '14.0' or 'Visual Studio 14' in vs_install_dir:
-        from mesonbuild.backend.vs2015backend import Vs2015Backend
-        return Vs2015Backend(build, interpreter)
-    if vs_version == '15.0' or 'Visual Studio 17' in vs_install_dir or \
-       'Visual Studio\\2017' in vs_install_dir:
-        from mesonbuild.backend.vs2017backend import Vs2017Backend
-        return Vs2017Backend(build, interpreter)
-    if vs_version == '16.0' or 'Visual Studio 19' in vs_install_dir or \
-       'Visual Studio\\2019' in vs_install_dir:
-        from mesonbuild.backend.vs2019backend import Vs2019Backend
-        return Vs2019Backend(build, interpreter)
-    if 'Visual Studio 10.0' in vs_install_dir:
-        return Vs2010Backend(build, interpreter)
-    raise MesonException('Could not detect Visual Studio using VisualStudioVersion: {!r} or VSINSTALLDIR: {!r}!\n'
-                         'Please specify the exact backend to use.'.format(vs_version, vs_install_dir))
-
-def split_o_flags_args(args):
-    """
-    Splits any /O args and returns them. Does not take care of flags overriding
-    previous ones. Skips non-O flag arguments.
-
-    ['/Ox', '/Ob1'] returns ['/Ox', '/Ob1']
-    ['/Oxj', '/MP'] returns ['/Ox', '/Oj']
-    """
-    o_flags = []
-    for arg in args:
-        if not arg.startswith('/O'):
-            continue
-        flags = list(arg[2:])
-        # Assume that this one can't be clumped with the others since it takes
-        # an argument itself
-        if 'b' in flags:
-            o_flags.append(arg)
-        else:
-            o_flags += ['/O' + f for f in flags]
-    return o_flags
-
-def generate_guid_from_path(path, path_type):
-    return str(uuid.uuid5(uuid.NAMESPACE_URL, 'meson-vs-' + path_type + ':' + str(path))).upper()
-
-class RegenInfo:
-    def __init__(self, source_dir, build_dir, depfiles):
-        self.source_dir = source_dir
-        self.build_dir = build_dir
-        self.depfiles = depfiles
-
-class Vs2010Backend(backends.Backend):
-    def __init__(self, build: T.Optional[build.Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'vs2010'
-        self.project_file_version = '10.0.30319.1'
-        self.platform_toolset = None
-        self.vs_version = '2010'
-        self.windows_target_platform_version = None
-        self.subdirs = {}
-        self.handled_target_deps = {}
-
-    def get_target_private_dir(self, target):
-        return os.path.join(self.get_target_dir(target), target.get_id())
-
-    def generate_custom_generator_commands(self, target, parent_node):
-        generator_output_files = []
-        custom_target_include_dirs = []
-        custom_target_output_files = []
-        target_private_dir = self.relpath(self.get_target_private_dir(target), self.get_target_dir(target))
-        down = self.target_to_build_root(target)
-        for genlist in target.get_generated_sources():
-            if isinstance(genlist, (build.CustomTarget, build.CustomTargetIndex)):
-                for i in genlist.get_outputs():
-                    # Path to the generated source from the current vcxproj dir via the build root
-                    ipath = os.path.join(down, self.get_target_dir(genlist), i)
-                    custom_target_output_files.append(ipath)
-                idir = self.relpath(self.get_target_dir(genlist), self.get_target_dir(target))
-                if idir not in custom_target_include_dirs:
-                    custom_target_include_dirs.append(idir)
-            else:
-                generator = genlist.get_generator()
-                exe = generator.get_exe()
-                infilelist = genlist.get_inputs()
-                outfilelist = genlist.get_outputs()
-                source_dir = os.path.join(down, self.build_to_src, genlist.subdir)
-                exe_arr = self.build_target_to_cmd_array(exe)
-                idgroup = ET.SubElement(parent_node, 'ItemGroup')
-                for i in range(len(infilelist)):
-                    if len(infilelist) == len(outfilelist):
-                        sole_output = os.path.join(target_private_dir, outfilelist[i])
-                    else:
-                        sole_output = ''
-                    curfile = infilelist[i]
-                    infilename = os.path.join(down, curfile.rel_to_builddir(self.build_to_src))
-                    deps = self.get_custom_target_depend_files(genlist, True)
-                    base_args = generator.get_arglist(infilename)
-                    outfiles_rel = genlist.get_outputs_for(curfile)
-                    outfiles = [os.path.join(target_private_dir, of) for of in outfiles_rel]
-                    generator_output_files += outfiles
-                    args = [x.replace("@INPUT@", infilename).replace('@OUTPUT@', sole_output)
-                            for x in base_args]
-                    args = self.replace_outputs(args, target_private_dir, outfiles_rel)
-                    args = [x.replace("@SOURCE_DIR@", self.environment.get_source_dir())
-                             .replace("@BUILD_DIR@", target_private_dir)
-                            for x in args]
-                    args = [x.replace("@CURRENT_SOURCE_DIR@", source_dir) for x in args]
-                    args = [x.replace("@SOURCE_ROOT@", self.environment.get_source_dir())
-                             .replace("@BUILD_ROOT@", self.environment.get_build_dir())
-                            for x in args]
-                    args = [x.replace('\\', '/') for x in args]
-                    cmd = exe_arr + self.replace_extra_args(args, genlist)
-                    # Always use a wrapper because MSBuild eats random characters when
-                    # there are many arguments.
-                    tdir_abs = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
-                    cmd = self.as_meson_exe_cmdline(
-                        'generator ' + cmd[0],
-                        cmd[0],
-                        cmd[1:],
-                        workdir=tdir_abs,
-                        capture=outfiles[0] if generator.capture else None,
-                        force_serialize=True
-                    )
-                    deps = cmd[-1:] + deps
-                    abs_pdir = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
-                    os.makedirs(abs_pdir, exist_ok=True)
-                    cbs = ET.SubElement(idgroup, 'CustomBuild', Include=infilename)
-                    ET.SubElement(cbs, 'Command').text = ' '.join(self.quote_arguments(cmd))
-                    ET.SubElement(cbs, 'Outputs').text = ';'.join(outfiles)
-                    ET.SubElement(cbs, 'AdditionalInputs').text = ';'.join(deps)
-        return generator_output_files, custom_target_output_files, custom_target_include_dirs
-
-    def generate(self):
-        target_machine = self.interpreter.builtin['target_machine'].cpu_family_method(None, None)
-        if target_machine == '64' or target_machine == 'x86_64':
-            # amd64 or x86_64
-            self.platform = 'x64'
-        elif target_machine == 'x86':
-            # x86
-            self.platform = 'Win32'
-        elif target_machine == 'aarch64' or target_machine == 'arm64':
-            self.platform = 'arm64'
-        elif 'arm' in target_machine.lower():
-            self.platform = 'ARM'
-        else:
-            raise MesonException('Unsupported Visual Studio platform: ' + target_machine)
-        self.buildtype = self.environment.coredata.get_builtin_option('buildtype')
-        sln_filename = os.path.join(self.environment.get_build_dir(), self.build.project_name + '.sln')
-        projlist = self.generate_projects()
-        self.gen_testproj('RUN_TESTS', os.path.join(self.environment.get_build_dir(), 'RUN_TESTS.vcxproj'))
-        self.gen_installproj('RUN_INSTALL', os.path.join(self.environment.get_build_dir(), 'RUN_INSTALL.vcxproj'))
-        self.gen_regenproj('REGEN', os.path.join(self.environment.get_build_dir(), 'REGEN.vcxproj'))
-        self.generate_solution(sln_filename, projlist)
-        self.generate_regen_info()
-        Vs2010Backend.touch_regen_timestamp(self.environment.get_build_dir())
-
-    @staticmethod
-    def get_regen_stampfile(build_dir):
-        return os.path.join(os.path.join(build_dir, Environment.private_dir), 'regen.stamp')
-
-    @staticmethod
-    def touch_regen_timestamp(build_dir):
-        with open(Vs2010Backend.get_regen_stampfile(build_dir), 'w'):
-            pass
-
-    def generate_regen_info(self):
-        deps = self.get_regen_filelist()
-        regeninfo = RegenInfo(self.environment.get_source_dir(),
-                              self.environment.get_build_dir(),
-                              deps)
-        filename = os.path.join(self.environment.get_scratch_dir(),
-                                'regeninfo.dump')
-        with open(filename, 'wb') as f:
-            pickle.dump(regeninfo, f)
-
-    def get_vcvars_command(self):
-        has_arch_values = 'VSCMD_ARG_TGT_ARCH' in os.environ and 'VSCMD_ARG_HOST_ARCH' in os.environ
-
-        # Use vcvarsall.bat if we found it.
-        if 'VCINSTALLDIR' in os.environ:
-            vs_version = os.environ['VisualStudioVersion'] \
-                if 'VisualStudioVersion' in os.environ else None
-            relative_path = 'Auxiliary\\Build\\' if vs_version >= '15.0' else ''
-            script_path = os.environ['VCINSTALLDIR'] + relative_path + 'vcvarsall.bat'
-            if os.path.exists(script_path):
-                if has_arch_values:
-                    target_arch = os.environ['VSCMD_ARG_TGT_ARCH']
-                    host_arch = os.environ['VSCMD_ARG_HOST_ARCH']
-                else:
-                    target_arch = os.environ.get('Platform', 'x86')
-                    host_arch = target_arch
-                arch = host_arch + '_' + target_arch if host_arch != target_arch else target_arch
-                return '"%s" %s' % (script_path, arch)
-
-        # Otherwise try the VS2017 Developer Command Prompt.
-        if 'VS150COMNTOOLS' in os.environ and has_arch_values:
-            script_path = os.environ['VS150COMNTOOLS'] + 'VsDevCmd.bat'
-            if os.path.exists(script_path):
-                return '"%s" -arch=%s -host_arch=%s' % \
-                    (script_path, os.environ['VSCMD_ARG_TGT_ARCH'], os.environ['VSCMD_ARG_HOST_ARCH'])
-        return ''
-
-    def get_obj_target_deps(self, obj_list):
-        result = {}
-        for o in obj_list:
-            if isinstance(o, build.ExtractedObjects):
-                result[o.target.get_id()] = o.target
-        return result.items()
-
-    def get_target_deps(self, t, recursive=False):
-        all_deps = {}
-        for target in t.values():
-            if isinstance(target, build.CustomTarget):
-                for d in target.get_target_dependencies():
-                    all_deps[d.get_id()] = d
-            elif isinstance(target, build.RunTarget):
-                for d in [target.command] + target.args:
-                    if isinstance(d, (build.BuildTarget, build.CustomTarget)):
-                        all_deps[d.get_id()] = d
-            elif isinstance(target, build.BuildTarget):
-                for ldep in target.link_targets:
-                    if isinstance(ldep, build.CustomTargetIndex):
-                        all_deps[ldep.get_id()] = ldep.target
-                    else:
-                        all_deps[ldep.get_id()] = ldep
-                for ldep in target.link_whole_targets:
-                    if isinstance(ldep, build.CustomTargetIndex):
-                        all_deps[ldep.get_id()] = ldep.target
-                    else:
-                        all_deps[ldep.get_id()] = ldep
-                for obj_id, objdep in self.get_obj_target_deps(target.objects):
-                    all_deps[obj_id] = objdep
-                for gendep in target.get_generated_sources():
-                    if isinstance(gendep, build.CustomTarget):
-                        all_deps[gendep.get_id()] = gendep
-                    elif isinstance(gendep, build.CustomTargetIndex):
-                        all_deps[gendep.target.get_id()] = gendep.target
-                    else:
-                        gen_exe = gendep.generator.get_exe()
-                        if isinstance(gen_exe, build.Executable):
-                            all_deps[gen_exe.get_id()] = gen_exe
-            else:
-                raise MesonException('Unknown target type for target %s' % target)
-        if not t or not recursive:
-            return all_deps
-        ret = self.get_target_deps(all_deps, recursive)
-        ret.update(all_deps)
-        return ret
-
-    def generate_solution_dirs(self, ofile, parents):
-        prj_templ = 'Project("{%s}") = "%s", "%s", "{%s}"\n'
-        iterpaths = reversed(parents)
-        # Skip first path
-        next(iterpaths)
-        for path in iterpaths:
-            if path not in self.subdirs:
-                basename = path.name
-                identifier = generate_guid_from_path(path, 'subdir')
-                # top-level directories have None as their parent_dir
-                parent_dir = path.parent
-                parent_identifier = self.subdirs[parent_dir][0] \
-                    if parent_dir != PurePath('.') else None
-                self.subdirs[path] = (identifier, parent_identifier)
-                prj_line = prj_templ % (
-                    self.environment.coredata.lang_guids['directory'],
-                    basename, basename, self.subdirs[path][0])
-                ofile.write(prj_line)
-                ofile.write('EndProject\n')
-
-    def generate_solution(self, sln_filename, projlist):
-        default_projlist = self.get_build_by_default_targets()
-        sln_filename_tmp = sln_filename + '~'
-        with open(sln_filename_tmp, 'w', encoding='utf-8') as ofile:
-            ofile.write('Microsoft Visual Studio Solution File, Format '
-                        'Version 11.00\n')
-            ofile.write('# Visual Studio ' + self.vs_version + '\n')
-            prj_templ = 'Project("{%s}") = "%s", "%s", "{%s}"\n'
-            for prj in projlist:
-                coredata = self.environment.coredata
-                if coredata.get_builtin_option('layout') == 'mirror':
-                    self.generate_solution_dirs(ofile, prj[1].parents)
-                target = self.build.targets[prj[0]]
-                lang = 'default'
-                if hasattr(target, 'compilers') and target.compilers:
-                    for lang_out in target.compilers.keys():
-                        lang = lang_out
-                        break
-                prj_line = prj_templ % (
-                    self.environment.coredata.lang_guids[lang],
-                    prj[0], prj[1], prj[2])
-                ofile.write(prj_line)
-                target_dict = {target.get_id(): target}
-                # Get recursive deps
-                recursive_deps = self.get_target_deps(
-                    target_dict, recursive=True)
-                ofile.write('EndProject\n')
-                for dep, target in recursive_deps.items():
-                    if prj[0] in default_projlist:
-                        default_projlist[dep] = target
-
-            test_line = prj_templ % (self.environment.coredata.lang_guids['default'],
-                                     'RUN_TESTS', 'RUN_TESTS.vcxproj',
-                                     self.environment.coredata.test_guid)
-            ofile.write(test_line)
-            ofile.write('EndProject\n')
-            regen_line = prj_templ % (self.environment.coredata.lang_guids['default'],
-                                      'REGEN', 'REGEN.vcxproj',
-                                      self.environment.coredata.regen_guid)
-            ofile.write(regen_line)
-            ofile.write('EndProject\n')
-            install_line = prj_templ % (self.environment.coredata.lang_guids['default'],
-                                        'RUN_INSTALL', 'RUN_INSTALL.vcxproj',
-                                        self.environment.coredata.install_guid)
-            ofile.write(install_line)
-            ofile.write('EndProject\n')
-            ofile.write('Global\n')
-            ofile.write('\tGlobalSection(SolutionConfigurationPlatforms) = '
-                        'preSolution\n')
-            ofile.write('\t\t%s|%s = %s|%s\n' %
-                        (self.buildtype, self.platform, self.buildtype,
-                         self.platform))
-            ofile.write('\tEndGlobalSection\n')
-            ofile.write('\tGlobalSection(ProjectConfigurationPlatforms) = '
-                        'postSolution\n')
-            ofile.write('\t\t{%s}.%s|%s.ActiveCfg = %s|%s\n' %
-                        (self.environment.coredata.regen_guid, self.buildtype,
-                         self.platform, self.buildtype, self.platform))
-            ofile.write('\t\t{%s}.%s|%s.Build.0 = %s|%s\n' %
-                        (self.environment.coredata.regen_guid, self.buildtype,
-                         self.platform, self.buildtype, self.platform))
-            # Create the solution configuration
-            for p in projlist:
-                # Add to the list of projects in this solution
-                ofile.write('\t\t{%s}.%s|%s.ActiveCfg = %s|%s\n' %
-                            (p[2], self.buildtype, self.platform,
-                             self.buildtype, self.platform))
-                if p[0] in default_projlist and \
-                   not isinstance(self.build.targets[p[0]], build.RunTarget):
-                    # Add to the list of projects to be built
-                    ofile.write('\t\t{%s}.%s|%s.Build.0 = %s|%s\n' %
-                                (p[2], self.buildtype, self.platform,
-                                 self.buildtype, self.platform))
-            ofile.write('\t\t{%s}.%s|%s.ActiveCfg = %s|%s\n' %
-                        (self.environment.coredata.test_guid, self.buildtype,
-                         self.platform, self.buildtype, self.platform))
-            ofile.write('\t\t{%s}.%s|%s.ActiveCfg = %s|%s\n' %
-                        (self.environment.coredata.install_guid, self.buildtype,
-                         self.platform, self.buildtype, self.platform))
-            ofile.write('\tEndGlobalSection\n')
-            ofile.write('\tGlobalSection(SolutionProperties) = preSolution\n')
-            ofile.write('\t\tHideSolutionNode = FALSE\n')
-            ofile.write('\tEndGlobalSection\n')
-            if self.subdirs:
-                ofile.write('\tGlobalSection(NestedProjects) = '
-                            'preSolution\n')
-                for p in projlist:
-                    if p[1].parent != PurePath('.'):
-                        ofile.write("\t\t{%s} = {%s}\n" % (p[2], self.subdirs[p[1].parent][0]))
-                for subdir in self.subdirs.values():
-                    if subdir[1]:
-                        ofile.write("\t\t{%s} = {%s}\n" % (subdir[0], subdir[1]))
-                ofile.write('\tEndGlobalSection\n')
-            ofile.write('EndGlobal\n')
-        replace_if_different(sln_filename, sln_filename_tmp)
-
-    def generate_projects(self):
-        startup_project = self.environment.coredata.backend_options['backend_startup_project'].value
-        projlist = []
-        startup_idx = 0
-        for (i, (name, target)) in enumerate(self.build.targets.items()):
-            if startup_project and startup_project == target.get_basename():
-                startup_idx = i
-            outdir = Path(
-                self.environment.get_build_dir(),
-                self.get_target_dir(target)
-            )
-            outdir.mkdir(exist_ok=True, parents=True)
-            fname = name + '.vcxproj'
-            target_dir = PurePath(self.get_target_dir(target))
-            relname = target_dir / fname
-            projfile_path = outdir / fname
-            proj_uuid = self.environment.coredata.target_guids[name]
-            self.gen_vcxproj(target, str(projfile_path), proj_uuid)
-            projlist.append((name, relname, proj_uuid))
-
-        # Put the startup project first in the project list
-        if startup_idx:
-            projlist = [projlist[startup_idx]] + projlist[0:startup_idx] + projlist[startup_idx + 1:-1]
-
-        return projlist
-
-    def split_sources(self, srclist):
-        sources = []
-        headers = []
-        objects = []
-        languages = []
-        for i in srclist:
-            if self.environment.is_header(i):
-                headers.append(i)
-            elif self.environment.is_object(i):
-                objects.append(i)
-            elif self.environment.is_source(i):
-                sources.append(i)
-                lang = self.lang_from_source_file(i)
-                if lang not in languages:
-                    languages.append(lang)
-            elif self.environment.is_library(i):
-                pass
-            else:
-                # Everything that is not an object or source file is considered a header.
-                headers.append(i)
-        return sources, headers, objects, languages
-
-    def target_to_build_root(self, target):
-        if self.get_target_dir(target) == '':
-            return ''
-
-        directories = os.path.normpath(self.get_target_dir(target)).split(os.sep)
-        return os.sep.join(['..'] * len(directories))
-
-    def quote_arguments(self, arr):
-        return ['"%s"' % i for i in arr]
-
-    def add_project_reference(self, root, include, projid, link_outputs=False):
-        ig = ET.SubElement(root, 'ItemGroup')
-        pref = ET.SubElement(ig, 'ProjectReference', Include=include)
-        ET.SubElement(pref, 'Project').text = '{%s}' % projid
-        if not link_outputs:
-            # Do not link in generated .lib files from dependencies automatically.
-            # We only use the dependencies for ordering and link in the generated
-            # objects and .lib files manually.
-            ET.SubElement(pref, 'LinkLibraryDependencies').text = 'false'
-
-    def add_target_deps(self, root, target):
-        target_dict = {target.get_id(): target}
-        for dep in self.get_target_deps(target_dict).values():
-            if dep.get_id() in self.handled_target_deps[target.get_id()]:
-                # This dependency was already handled manually.
-                continue
-            relpath = self.get_target_dir_relative_to(dep, target)
-            vcxproj = os.path.join(relpath, dep.get_id() + '.vcxproj')
-            tid = self.environment.coredata.target_guids[dep.get_id()]
-            self.add_project_reference(root, vcxproj, tid)
-
-    def create_basic_crap(self, target, guid):
-        project_name = target.name
-        root = ET.Element('Project', {'DefaultTargets': "Build",
-                                      'ToolsVersion': '4.0',
-                                      'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
-        confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'})
-        prjconf = ET.SubElement(confitems, 'ProjectConfiguration',
-                                {'Include': self.buildtype + '|' + self.platform})
-        p = ET.SubElement(prjconf, 'Configuration')
-        p.text = self.buildtype
-        pl = ET.SubElement(prjconf, 'Platform')
-        pl.text = self.platform
-        globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals')
-        guidelem = ET.SubElement(globalgroup, 'ProjectGuid')
-        guidelem.text = '{%s}' % guid
-        kw = ET.SubElement(globalgroup, 'Keyword')
-        kw.text = self.platform + 'Proj'
-        p = ET.SubElement(globalgroup, 'Platform')
-        p.text = self.platform
-        pname = ET.SubElement(globalgroup, 'ProjectName')
-        pname.text = project_name
-        if self.windows_target_platform_version:
-            ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props')
-        type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
-        ET.SubElement(type_config, 'ConfigurationType')
-        ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte'
-        ET.SubElement(type_config, 'UseOfMfc').text = 'false'
-        if self.platform_toolset:
-            ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props')
-        direlem = ET.SubElement(root, 'PropertyGroup')
-        fver = ET.SubElement(direlem, '_ProjectFileVersion')
-        fver.text = self.project_file_version
-        outdir = ET.SubElement(direlem, 'OutDir')
-        outdir.text = '.\\'
-        intdir = ET.SubElement(direlem, 'IntDir')
-        intdir.text = target.get_id() + '\\'
-        tname = ET.SubElement(direlem, 'TargetName')
-        tname.text = target.name
-        return root
-
-    def gen_run_target_vcxproj(self, target, ofname, guid):
-        root = self.create_basic_crap(target, guid)
-        if not target.command:
-            # FIXME: This is an alias target that doesn't run any command, there
-            # is probably a better way than running a this dummy command.
-            cmd_raw = python_command + ['-c', 'exit']
-        else:
-            cmd_raw = [target.command] + target.args
-        cmd = python_command + \
-            [os.path.join(self.environment.get_script_dir(), 'commandrunner.py'),
-             self.environment.get_source_dir(),
-             self.environment.get_build_dir(),
-             self.get_target_dir(target)] + self.environment.get_build_command()
-        for i in cmd_raw:
-            if isinstance(i, build.BuildTarget):
-                cmd.append(os.path.join(self.environment.get_build_dir(), self.get_target_filename(i)))
-            elif isinstance(i, dependencies.ExternalProgram):
-                cmd += i.get_command()
-            elif isinstance(i, File):
-                relfname = i.rel_to_builddir(self.build_to_src)
-                cmd.append(os.path.join(self.environment.get_build_dir(), relfname))
-            elif isinstance(i, str):
-                # Escape embedded quotes, because we quote the entire argument below.
-                cmd.append(i.replace('"', '\\"'))
-            else:
-                cmd.append(i)
-        cmd_templ = '''"%s" ''' * len(cmd)
-        self.add_custom_build(root, 'run_target', cmd_templ % tuple(cmd))
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        self.add_regen_dependency(root)
-        self.add_target_deps(root, target)
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    def gen_custom_target_vcxproj(self, target, ofname, guid):
-        root = self.create_basic_crap(target, guid)
-        # We need to always use absolute paths because our invocation is always
-        # from the target dir, not the build root.
-        target.absolute_paths = True
-        (srcs, ofilenames, cmd) = self.eval_custom_target_command(target, True)
-        depend_files = self.get_custom_target_depend_files(target, True)
-        # Always use a wrapper because MSBuild eats random characters when
-        # there are many arguments.
-        tdir_abs = os.path.join(self.environment.get_build_dir(), self.get_target_dir(target))
-        extra_bdeps = target.get_transitive_build_target_deps()
-        wrapper_cmd = self.as_meson_exe_cmdline(target.name, target.command[0], cmd[1:],
-                                                # All targets run from the target dir
-                                                workdir=tdir_abs,
-                                                extra_bdeps=extra_bdeps,
-                                                capture=ofilenames[0] if target.capture else None,
-                                                force_serialize=True)
-        if target.build_always_stale:
-            # Use a nonexistent file to always consider the target out-of-date.
-            ofilenames += [self.nonexistent_file(os.path.join(self.environment.get_scratch_dir(),
-                                                 'outofdate.file'))]
-        self.add_custom_build(root, 'custom_target', ' '.join(self.quote_arguments(wrapper_cmd)),
-                              deps=wrapper_cmd[-1:] + srcs + depend_files, outputs=ofilenames)
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        self.generate_custom_generator_commands(target, root)
-        self.add_regen_dependency(root)
-        self.add_target_deps(root, target)
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    @classmethod
-    def lang_from_source_file(cls, src):
-        ext = src.split('.')[-1]
-        if ext in compilers.c_suffixes:
-            return 'c'
-        if ext in compilers.cpp_suffixes:
-            return 'cpp'
-        raise MesonException('Could not guess language from source file %s.' % src)
-
-    def add_pch(self, pch_sources, lang, inc_cl):
-        if lang in pch_sources:
-            self.use_pch(pch_sources, lang, inc_cl)
-
-    def create_pch(self, pch_sources, lang, inc_cl):
-        pch = ET.SubElement(inc_cl, 'PrecompiledHeader')
-        pch.text = 'Create'
-        self.add_pch_files(pch_sources, lang, inc_cl)
-
-    def use_pch(self, pch_sources, lang, inc_cl):
-        pch = ET.SubElement(inc_cl, 'PrecompiledHeader')
-        pch.text = 'Use'
-        header = self.add_pch_files(pch_sources, lang, inc_cl)
-        pch_include = ET.SubElement(inc_cl, 'ForcedIncludeFiles')
-        pch_include.text = header + ';%(ForcedIncludeFiles)'
-
-    def add_pch_files(self, pch_sources, lang, inc_cl):
-        header = os.path.basename(pch_sources[lang][0])
-        pch_file = ET.SubElement(inc_cl, 'PrecompiledHeaderFile')
-        # When USING PCHs, MSVC will not do the regular include
-        # directory lookup, but simply use a string match to find the
-        # PCH to use. That means the #include directive must match the
-        # pch_file.text used during PCH CREATION verbatim.
-        # When CREATING a PCH, MSVC will do the include directory
-        # lookup to find the actual PCH header to use. Thus, the PCH
-        # header must either be in the include_directories of the target
-        # or be in the same directory as the PCH implementation.
-        pch_file.text = header
-        pch_out = ET.SubElement(inc_cl, 'PrecompiledHeaderOutputFile')
-        pch_out.text = '$(IntDir)$(TargetName)-%s.pch' % lang
-        return header
-
-    def is_argument_with_msbuild_xml_entry(self, entry):
-        # Remove arguments that have a top level XML entry so
-        # they are not used twice.
-        # FIXME add args as needed.
-        return entry[1:].startswith('M')
-
-    def add_additional_options(self, lang, parent_node, file_args):
-        args = []
-        for arg in file_args[lang].to_native():
-            if self.is_argument_with_msbuild_xml_entry(arg):
-                continue
-            if arg == '%(AdditionalOptions)':
-                args.append(arg)
-            else:
-                args.append(self.escape_additional_option(arg))
-        ET.SubElement(parent_node, "AdditionalOptions").text = ' '.join(args)
-
-    def add_preprocessor_defines(self, lang, parent_node, file_defines):
-        defines = []
-        for define in file_defines[lang]:
-            if define == '%(PreprocessorDefinitions)':
-                defines.append(define)
-            else:
-                defines.append(self.escape_preprocessor_define(define))
-        ET.SubElement(parent_node, "PreprocessorDefinitions").text = ';'.join(defines)
-
-    def add_include_dirs(self, lang, parent_node, file_inc_dirs):
-        dirs = file_inc_dirs[lang]
-        ET.SubElement(parent_node, "AdditionalIncludeDirectories").text = ';'.join(dirs)
-
-    @staticmethod
-    def has_objects(objects, additional_objects, generated_objects):
-        # Ignore generated objects, those are automatically used by MSBuild because they are part of
-        # the CustomBuild Outputs.
-        return len(objects) + len(additional_objects) > 0
-
-    @staticmethod
-    def add_generated_objects(node, generated_objects):
-        # Do not add generated objects to project file. Those are automatically used by MSBuild, because
-        # they are part of the CustomBuild Outputs.
-        return
-
-    @staticmethod
-    def escape_preprocessor_define(define):
-        # See: https://msdn.microsoft.com/en-us/library/bb383819.aspx
-        table = str.maketrans({'%': '%25', '$': '%24', '@': '%40',
-                               "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A',
-                               # We need to escape backslash because it'll be un-escaped by
-                               # Windows during process creation when it parses the arguments
-                               # Basically, this converts `\` to `\\`.
-                               '\\': '\\\\'})
-        return define.translate(table)
-
-    @staticmethod
-    def escape_additional_option(option):
-        # See: https://msdn.microsoft.com/en-us/library/bb383819.aspx
-        table = str.maketrans({'%': '%25', '$': '%24', '@': '%40',
-                               "'": '%27', ';': '%3B', '?': '%3F', '*': '%2A', ' ': '%20'})
-        option = option.translate(table)
-        # Since we're surrounding the option with ", if it ends in \ that will
-        # escape the " when the process arguments are parsed and the starting
-        # " will not terminate. So we escape it if that's the case.  I'm not
-        # kidding, this is how escaping works for process args on Windows.
-        if option.endswith('\\'):
-            option += '\\'
-        return '"{}"'.format(option)
-
-    @staticmethod
-    def split_link_args(args):
-        """
-        Split a list of link arguments into three lists:
-        * library search paths
-        * library filenames (or paths)
-        * other link arguments
-        """
-        lpaths = []
-        libs = []
-        other = []
-        for arg in args:
-            if arg.startswith('/LIBPATH:'):
-                lpath = arg[9:]
-                # De-dup library search paths by removing older entries when
-                # a new one is found. This is necessary because unlike other
-                # search paths such as the include path, the library is
-                # searched for in the newest (right-most) search path first.
-                if lpath in lpaths:
-                    lpaths.remove(lpath)
-                lpaths.append(lpath)
-            elif arg.startswith(('/', '-')):
-                other.append(arg)
-            # It's ok if we miss libraries with non-standard extensions here.
-            # They will go into the general link arguments.
-            elif arg.endswith('.lib') or arg.endswith('.a'):
-                # De-dup
-                if arg not in libs:
-                    libs.append(arg)
-            else:
-                other.append(arg)
-        return lpaths, libs, other
-
-    def _get_cl_compiler(self, target):
-        for lang, c in target.compilers.items():
-            if lang in ('c', 'cpp'):
-                return c
-        # No source files, only objects, but we still need a compiler, so
-        # return a found compiler
-        if len(target.objects) > 0:
-            for lang, c in self.environment.coredata.compilers[target.for_machine].items():
-                if lang in ('c', 'cpp'):
-                    return c
-        raise MesonException('Could not find a C or C++ compiler. MSVC can only build C/C++ projects.')
-
-    def _prettyprint_vcxproj_xml(self, tree, ofname):
-        ofname_tmp = ofname + '~'
-        tree.write(ofname_tmp, encoding='utf-8', xml_declaration=True)
-
-        # ElementTree can not do prettyprinting so do it manually
-        doc = xml.dom.minidom.parse(ofname_tmp)
-        with open(ofname_tmp, 'w', encoding='utf-8') as of:
-            of.write(doc.toprettyxml())
-        replace_if_different(ofname, ofname_tmp)
-
-    def gen_vcxproj(self, target, ofname, guid):
-        mlog.debug('Generating vcxproj %s.' % target.name)
-        subsystem = 'Windows'
-        self.handled_target_deps[target.get_id()] = []
-        if isinstance(target, build.Executable):
-            conftype = 'Application'
-            if not target.gui_app:
-                subsystem = 'Console'
-        elif isinstance(target, build.StaticLibrary):
-            conftype = 'StaticLibrary'
-        elif isinstance(target, build.SharedLibrary):
-            conftype = 'DynamicLibrary'
-        elif isinstance(target, build.CustomTarget):
-            return self.gen_custom_target_vcxproj(target, ofname, guid)
-        elif isinstance(target, build.RunTarget):
-            return self.gen_run_target_vcxproj(target, ofname, guid)
-        else:
-            raise MesonException('Unknown target type for %s' % target.get_basename())
-        # Prefix to use to access the build root from the vcxproj dir
-        down = self.target_to_build_root(target)
-        # Prefix to use to access the source tree's root from the vcxproj dir
-        proj_to_src_root = os.path.join(down, self.build_to_src)
-        # Prefix to use to access the source tree's subdir from the vcxproj dir
-        proj_to_src_dir = os.path.join(proj_to_src_root, self.get_target_dir(target))
-        (sources, headers, objects, languages) = self.split_sources(target.sources)
-        if self.is_unity(target):
-            sources = self.generate_unity_files(target, sources)
-        compiler = self._get_cl_compiler(target)
-        buildtype_args = compiler.get_buildtype_args(self.buildtype)
-        buildtype_link_args = compiler.get_buildtype_linker_args(self.buildtype)
-        vscrt_type = self.environment.coredata.base_options['b_vscrt']
-        project_name = target.name
-        target_name = target.name
-        root = ET.Element('Project', {'DefaultTargets': "Build",
-                                      'ToolsVersion': '4.0',
-                                      'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
-        confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'})
-        prjconf = ET.SubElement(confitems, 'ProjectConfiguration',
-                                {'Include': self.buildtype + '|' + self.platform})
-        p = ET.SubElement(prjconf, 'Configuration')
-        p.text = self.buildtype
-        pl = ET.SubElement(prjconf, 'Platform')
-        pl.text = self.platform
-        # Globals
-        globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals')
-        guidelem = ET.SubElement(globalgroup, 'ProjectGuid')
-        guidelem.text = '{%s}' % guid
-        kw = ET.SubElement(globalgroup, 'Keyword')
-        kw.text = self.platform + 'Proj'
-        ns = ET.SubElement(globalgroup, 'RootNamespace')
-        ns.text = target_name
-        p = ET.SubElement(globalgroup, 'Platform')
-        p.text = self.platform
-        pname = ET.SubElement(globalgroup, 'ProjectName')
-        pname.text = project_name
-        if self.windows_target_platform_version:
-            ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props')
-        # Start configuration
-        type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
-        ET.SubElement(type_config, 'ConfigurationType').text = conftype
-        ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte'
-        if self.platform_toolset:
-            ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset
-        # FIXME: Meson's LTO support needs to be integrated here
-        ET.SubElement(type_config, 'WholeProgramOptimization').text = 'false'
-        # Let VS auto-set the RTC level
-        ET.SubElement(type_config, 'BasicRuntimeChecks').text = 'Default'
-        # Incremental linking increases code size
-        if '/INCREMENTAL:NO' in buildtype_link_args:
-            ET.SubElement(type_config, 'LinkIncremental').text = 'false'
-
-        # Build information
-        compiles = ET.SubElement(root, 'ItemDefinitionGroup')
-        clconf = ET.SubElement(compiles, 'ClCompile')
-        # CRT type; debug or release
-        if vscrt_type.value == 'from_buildtype':
-            if self.buildtype == 'debug':
-                ET.SubElement(type_config, 'UseDebugLibraries').text = 'true'
-                ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDebugDLL'
-            else:
-                ET.SubElement(type_config, 'UseDebugLibraries').text = 'false'
-                ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDLL'
-        elif vscrt_type.value == 'mdd':
-            ET.SubElement(type_config, 'UseDebugLibraries').text = 'true'
-            ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDebugDLL'
-        elif vscrt_type.value == 'mt':
-            # FIXME, wrong
-            ET.SubElement(type_config, 'UseDebugLibraries').text = 'false'
-            ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreaded'
-        elif vscrt_type.value == 'mtd':
-            # FIXME, wrong
-            ET.SubElement(type_config, 'UseDebugLibraries').text = 'true'
-            ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDebug'
-        else:
-            ET.SubElement(type_config, 'UseDebugLibraries').text = 'false'
-            ET.SubElement(clconf, 'RuntimeLibrary').text = 'MultiThreadedDLL'
-        # Debug format
-        if '/ZI' in buildtype_args:
-            ET.SubElement(clconf, 'DebugInformationFormat').text = 'EditAndContinue'
-        elif '/Zi' in buildtype_args:
-            ET.SubElement(clconf, 'DebugInformationFormat').text = 'ProgramDatabase'
-        elif '/Z7' in buildtype_args:
-            ET.SubElement(clconf, 'DebugInformationFormat').text = 'OldStyle'
-        # Runtime checks
-        if '/RTC1' in buildtype_args:
-            ET.SubElement(clconf, 'BasicRuntimeChecks').text = 'EnableFastChecks'
-        elif '/RTCu' in buildtype_args:
-            ET.SubElement(clconf, 'BasicRuntimeChecks').text = 'UninitializedLocalUsageCheck'
-        elif '/RTCs' in buildtype_args:
-            ET.SubElement(clconf, 'BasicRuntimeChecks').text = 'StackFrameRuntimeCheck'
-        # Exception handling has to be set in the xml in addition to the "AdditionalOptions" because otherwise
-        # cl will give warning D9025: overriding '/Ehs' with cpp_eh value
-        if 'cpp' in target.compilers:
-            eh = self.environment.coredata.compiler_options[target.for_machine]['cpp']['eh']
-            if eh.value == 'a':
-                ET.SubElement(clconf, 'ExceptionHandling').text = 'Async'
-            elif eh.value == 's':
-                ET.SubElement(clconf, 'ExceptionHandling').text = 'SyncCThrow'
-            elif eh.value == 'none':
-                ET.SubElement(clconf, 'ExceptionHandling').text = 'false'
-            else: # 'sc' or 'default'
-                ET.SubElement(clconf, 'ExceptionHandling').text = 'Sync'
-        # End configuration
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props')
-        generated_files, custom_target_output_files, generated_files_include_dirs = self.generate_custom_generator_commands(target, root)
-        (gen_src, gen_hdrs, gen_objs, gen_langs) = self.split_sources(generated_files)
-        (custom_src, custom_hdrs, custom_objs, custom_langs) = self.split_sources(custom_target_output_files)
-        gen_src += custom_src
-        gen_hdrs += custom_hdrs
-        gen_langs += custom_langs
-        # Project information
-        direlem = ET.SubElement(root, 'PropertyGroup')
-        fver = ET.SubElement(direlem, '_ProjectFileVersion')
-        fver.text = self.project_file_version
-        outdir = ET.SubElement(direlem, 'OutDir')
-        outdir.text = '.\\'
-        intdir = ET.SubElement(direlem, 'IntDir')
-        intdir.text = target.get_id() + '\\'
-        tfilename = os.path.splitext(target.get_filename())
-        ET.SubElement(direlem, 'TargetName').text = tfilename[0]
-        ET.SubElement(direlem, 'TargetExt').text = tfilename[1]
-
-        # Arguments, include dirs, defines for all files in the current target
-        target_args = []
-        target_defines = []
-        target_inc_dirs = []
-        # Arguments, include dirs, defines passed to individual files in
-        # a target; perhaps because the args are language-specific
-        #
-        # file_args is also later split out into defines and include_dirs in
-        # case someone passed those in there
-        file_args = {l: c.compiler_args() for l, c in target.compilers.items()}
-        file_defines = {l: [] for l in target.compilers}
-        file_inc_dirs = {l: [] for l in target.compilers}
-        # The order in which these compile args are added must match
-        # generate_single_compile() and generate_basic_compiler_args()
-        for l, comp in target.compilers.items():
-            if l in file_args:
-                file_args[l] += compilers.get_base_compile_args(
-                        self.get_base_options_for_target(target), comp)
-                file_args[l] += comp.get_option_compile_args(
-                        self.environment.coredata.compiler_options[target.for_machine][comp.language])
-
-        # Add compile args added using add_project_arguments()
-        for l, args in self.build.projects_args[target.for_machine].get(target.subproject, {}).items():
-            if l in file_args:
-                file_args[l] += args
-        # Add compile args added using add_global_arguments()
-        # These override per-project arguments
-        for l, args in self.build.global_args[target.for_machine].items():
-            if l in file_args:
-                file_args[l] += args
-        # Compile args added from the env or cross file: CFLAGS/CXXFLAGS, etc. We want these
-        # to override all the defaults, but not the per-target compile args.
-        for l in file_args.keys():
-            opts = self.environment.coredata.compiler_options[target.for_machine][l]
-            k = 'args'
-            if k in opts:
-                file_args[l] += opts[k].value
-        for args in file_args.values():
-            # This is where Visual Studio will insert target_args, target_defines,
-            # etc, which are added later from external deps (see below).
-            args += ['%(AdditionalOptions)', '%(PreprocessorDefinitions)', '%(AdditionalIncludeDirectories)']
-            # Add custom target dirs as includes automatically, but before
-            # target-specific include dirs. See _generate_single_compile() in
-            # the ninja backend for caveats.
-            args += ['-I' + arg for arg in generated_files_include_dirs]
-            # Add include dirs from the `include_directories:` kwarg on the target
-            # and from `include_directories:` of internal deps of the target.
-            #
-            # Target include dirs should override internal deps include dirs.
-            # This is handled in BuildTarget.process_kwargs()
-            #
-            # Include dirs from internal deps should override include dirs from
-            # external deps and must maintain the order in which they are
-            # specified. Hence, we must reverse so that the order is preserved.
-            #
-            # These are per-target, but we still add them as per-file because we
-            # need them to be looked in first.
-            for d in reversed(target.get_include_dirs()):
-                # reversed is used to keep order of includes
-                for i in reversed(d.get_incdirs()):
-                    curdir = os.path.join(d.get_curdir(), i)
-                    args.append('-I' + self.relpath(curdir, target.subdir)) # build dir
-                    args.append('-I' + os.path.join(proj_to_src_root, curdir)) # src dir
-                for i in d.get_extra_build_dirs():
-                    curdir = os.path.join(d.get_curdir(), i)
-                    args.append('-I' + self.relpath(curdir, target.subdir))  # build dir
-        # Add per-target compile args, f.ex, `c_args : ['/DFOO']`. We set these
-        # near the end since these are supposed to override everything else.
-        for l, args in target.extra_args.items():
-            if l in file_args:
-                file_args[l] += args
-        # The highest priority includes. In order of directory search:
-        # target private dir, target build dir, target source dir
-        for args in file_args.values():
-            t_inc_dirs = [self.relpath(self.get_target_private_dir(target),
-                                       self.get_target_dir(target))]
-            if target.implicit_include_directories:
-                t_inc_dirs += ['.']
-            if target.implicit_include_directories:
-                t_inc_dirs += [proj_to_src_dir]
-            args += ['-I' + arg for arg in t_inc_dirs]
-
-        # Split preprocessor defines and include directories out of the list of
-        # all extra arguments. The rest go into %(AdditionalOptions).
-        for l, args in file_args.items():
-            for arg in args[:]:
-                if arg.startswith(('-D', '/D')) or arg == '%(PreprocessorDefinitions)':
-                    file_args[l].remove(arg)
-                    # Don't escape the marker
-                    if arg == '%(PreprocessorDefinitions)':
-                        define = arg
-                    else:
-                        define = arg[2:]
-                    # De-dup
-                    if define in file_defines[l]:
-                        file_defines[l].remove(define)
-                    file_defines[l].append(define)
-                elif arg.startswith(('-I', '/I')) or arg == '%(AdditionalIncludeDirectories)':
-                    file_args[l].remove(arg)
-                    # Don't escape the marker
-                    if arg == '%(AdditionalIncludeDirectories)':
-                        inc_dir = arg
-                    else:
-                        inc_dir = arg[2:]
-                    # De-dup
-                    if inc_dir not in file_inc_dirs[l]:
-                        file_inc_dirs[l].append(inc_dir)
-
-        # Split compile args needed to find external dependencies
-        # Link args are added while generating the link command
-        for d in reversed(target.get_external_deps()):
-            # Cflags required by external deps might have UNIX-specific flags,
-            # so filter them out if needed
-            if isinstance(d, dependencies.OpenMPDependency):
-                ET.SubElement(clconf, 'OpenMPSupport').text = 'true'
-            else:
-                d_compile_args = compiler.unix_args_to_native(d.get_compile_args())
-                for arg in d_compile_args:
-                    if arg.startswith(('-D', '/D')):
-                        define = arg[2:]
-                        # De-dup
-                        if define in target_defines:
-                            target_defines.remove(define)
-                        target_defines.append(define)
-                    elif arg.startswith(('-I', '/I')):
-                        inc_dir = arg[2:]
-                        # De-dup
-                        if inc_dir not in target_inc_dirs:
-                            target_inc_dirs.append(inc_dir)
-                    else:
-                        target_args.append(arg)
-
-        languages += gen_langs
-        if len(target_args) > 0:
-            target_args.append('%(AdditionalOptions)')
-            ET.SubElement(clconf, "AdditionalOptions").text = ' '.join(target_args)
-
-        target_inc_dirs.append('%(AdditionalIncludeDirectories)')
-        ET.SubElement(clconf, 'AdditionalIncludeDirectories').text = ';'.join(target_inc_dirs)
-        target_defines.append('%(PreprocessorDefinitions)')
-        ET.SubElement(clconf, 'PreprocessorDefinitions').text = ';'.join(target_defines)
-        ET.SubElement(clconf, 'FunctionLevelLinking').text = 'true'
-        # Warning level
-        warning_level = self.get_option_for_target('warning_level', target)
-        ET.SubElement(clconf, 'WarningLevel').text = 'Level' + str(1 + int(warning_level))
-        if self.get_option_for_target('werror', target):
-            ET.SubElement(clconf, 'TreatWarningAsError').text = 'true'
-        # Optimization flags
-        o_flags = split_o_flags_args(buildtype_args)
-        if '/Ox' in o_flags:
-            ET.SubElement(clconf, 'Optimization').text = 'Full'
-        elif '/O2' in o_flags:
-            ET.SubElement(clconf, 'Optimization').text = 'MaxSpeed'
-        elif '/O1' in o_flags:
-            ET.SubElement(clconf, 'Optimization').text = 'MinSpace'
-        elif '/Od' in o_flags:
-            ET.SubElement(clconf, 'Optimization').text = 'Disabled'
-        if '/Oi' in o_flags:
-            ET.SubElement(clconf, 'IntrinsicFunctions').text = 'true'
-        if '/Ob1' in o_flags:
-            ET.SubElement(clconf, 'InlineFunctionExpansion').text = 'OnlyExplicitInline'
-        elif '/Ob2' in o_flags:
-            ET.SubElement(clconf, 'InlineFunctionExpansion').text = 'AnySuitable'
-        # Size-preserving flags
-        if '/Os' in o_flags:
-            ET.SubElement(clconf, 'FavorSizeOrSpeed').text = 'Size'
-        else:
-            ET.SubElement(clconf, 'FavorSizeOrSpeed').text = 'Speed'
-        # Note: SuppressStartupBanner is /NOLOGO and is 'true' by default
-        pch_sources = {}
-        if self.environment.coredata.base_options.get('b_pch', False):
-            for lang in ['c', 'cpp']:
-                pch = target.get_pch(lang)
-                if not pch:
-                    continue
-                if compiler.id == 'msvc':
-                    if len(pch) == 1:
-                        # Auto generate PCH.
-                        src = os.path.join(down, self.create_msvc_pch_implementation(target, lang, pch[0]))
-                        pch_header_dir = os.path.dirname(os.path.join(proj_to_src_dir, pch[0]))
-                    else:
-                        src = os.path.join(proj_to_src_dir, pch[1])
-                        pch_header_dir = None
-                    pch_sources[lang] = [pch[0], src, lang, pch_header_dir]
-                else:
-                    # I don't know whether its relevant but let's handle other compilers
-                    # used with a vs backend
-                    pch_sources[lang] = [pch[0], None, lang, None]
-
-        resourcecompile = ET.SubElement(compiles, 'ResourceCompile')
-        ET.SubElement(resourcecompile, 'PreprocessorDefinitions')
-
-        # Linker options
-        link = ET.SubElement(compiles, 'Link')
-        extra_link_args = compiler.compiler_args()
-        # FIXME: Can these buildtype linker args be added as tags in the
-        # vcxproj file (similar to buildtype compiler args) instead of in
-        # AdditionalOptions?
-        extra_link_args += compiler.get_buildtype_linker_args(self.buildtype)
-        # Generate Debug info
-        if self.buildtype.startswith('debug'):
-            self.generate_debug_information(link)
-        if not isinstance(target, build.StaticLibrary):
-            if isinstance(target, build.SharedModule):
-                options = self.environment.coredata.base_options
-                extra_link_args += compiler.get_std_shared_module_link_args(options)
-            # Add link args added using add_project_link_arguments()
-            extra_link_args += self.build.get_project_link_args(compiler, target.subproject, target.for_machine)
-            # Add link args added using add_global_link_arguments()
-            # These override per-project link arguments
-            extra_link_args += self.build.get_global_link_args(compiler, target.for_machine)
-            # Link args added from the env: LDFLAGS, or the cross file. We want
-            # these to override all the defaults but not the per-target link
-            # args.
-            extra_link_args += self.environment.coredata.get_external_link_args(target.for_machine, compiler.get_language())
-            # Only non-static built targets need link args and link dependencies
-            extra_link_args += target.link_args
-            # External deps must be last because target link libraries may depend on them.
-            for dep in target.get_external_deps():
-                # Extend without reordering or de-dup to preserve `-L -l` sets
-                # https://github.com/mesonbuild/meson/issues/1718
-                if isinstance(dep, dependencies.OpenMPDependency):
-                    ET.SubElement(clconf, 'OpenMPSuppport').text = 'true'
-                else:
-                    extra_link_args.extend_direct(dep.get_link_args())
-            for d in target.get_dependencies():
-                if isinstance(d, build.StaticLibrary):
-                    for dep in d.get_external_deps():
-                        if isinstance(dep, dependencies.OpenMPDependency):
-                            ET.SubElement(clconf, 'OpenMPSuppport').text = 'true'
-                        else:
-                            extra_link_args.extend_direct(dep.get_link_args())
-        # Add link args for c_* or cpp_* build options. Currently this only
-        # adds c_winlibs and cpp_winlibs when building for Windows. This needs
-        # to be after all internal and external libraries so that unresolved
-        # symbols from those can be found here. This is needed when the
-        # *_winlibs that we want to link to are static mingw64 libraries.
-        extra_link_args += compiler.get_option_link_args(
-                self.environment.coredata.compiler_options[compiler.for_machine][comp.language])
-        (additional_libpaths, additional_links, extra_link_args) = self.split_link_args(extra_link_args.to_native())
-
-        # Add more libraries to be linked if needed
-        for t in target.get_dependencies():
-            if isinstance(t, build.CustomTargetIndex):
-                # We don't need the actual project here, just the library name
-                lobj = t
-            else:
-                lobj = self.build.targets[t.get_id()]
-            linkname = os.path.join(down, self.get_target_filename_for_linking(lobj))
-            if t in target.link_whole_targets:
-                # /WHOLEARCHIVE:foo must go into AdditionalOptions
-                extra_link_args += compiler.get_link_whole_for(linkname)
-                # To force Visual Studio to build this project even though it
-                # has no sources, we include a reference to the vcxproj file
-                # that builds this target. Technically we should add this only
-                # if the current target has no sources, but it doesn't hurt to
-                # have 'extra' references.
-                trelpath = self.get_target_dir_relative_to(t, target)
-                tvcxproj = os.path.join(trelpath, t.get_id() + '.vcxproj')
-                tid = self.environment.coredata.target_guids[t.get_id()]
-                self.add_project_reference(root, tvcxproj, tid, link_outputs=True)
-                # Mark the dependency as already handled to not have
-                # multiple references to the same target.
-                self.handled_target_deps[target.get_id()].append(t.get_id())
-            else:
-                # Other libraries go into AdditionalDependencies
-                if linkname not in additional_links:
-                    additional_links.append(linkname)
-        for lib in self.get_custom_target_provided_libraries(target):
-            additional_links.append(self.relpath(lib, self.get_target_dir(target)))
-        additional_objects = []
-        for o in self.flatten_object_list(target, down):
-            assert(isinstance(o, str))
-            additional_objects.append(o)
-        for o in custom_objs:
-            additional_objects.append(o)
-
-        if len(extra_link_args) > 0:
-            extra_link_args.append('%(AdditionalOptions)')
-            ET.SubElement(link, "AdditionalOptions").text = ' '.join(extra_link_args)
-        if len(additional_libpaths) > 0:
-            additional_libpaths.insert(0, '%(AdditionalLibraryDirectories)')
-            ET.SubElement(link, 'AdditionalLibraryDirectories').text = ';'.join(additional_libpaths)
-        if len(additional_links) > 0:
-            additional_links.append('%(AdditionalDependencies)')
-            ET.SubElement(link, 'AdditionalDependencies').text = ';'.join(additional_links)
-        ofile = ET.SubElement(link, 'OutputFile')
-        ofile.text = '$(OutDir)%s' % target.get_filename()
-        subsys = ET.SubElement(link, 'SubSystem')
-        subsys.text = subsystem
-        if (isinstance(target, build.SharedLibrary) or isinstance(target, build.Executable)) and target.get_import_filename():
-            # DLLs built with MSVC always have an import library except when
-            # they're data-only DLLs, but we don't support those yet.
-            ET.SubElement(link, 'ImportLibrary').text = target.get_import_filename()
-        if isinstance(target, build.SharedLibrary):
-            # Add module definitions file, if provided
-            if target.vs_module_defs:
-                relpath = os.path.join(down, target.vs_module_defs.rel_to_builddir(self.build_to_src))
-                ET.SubElement(link, 'ModuleDefinitionFile').text = relpath
-        if '/ZI' in buildtype_args or '/Zi' in buildtype_args:
-            pdb = ET.SubElement(link, 'ProgramDataBaseFileName')
-            pdb.text = '$(OutDir}%s.pdb' % target_name
-        targetmachine = ET.SubElement(link, 'TargetMachine')
-        targetplatform = self.platform.lower()
-        if targetplatform == 'win32':
-            targetmachine.text = 'MachineX86'
-        elif targetplatform == 'x64':
-            targetmachine.text = 'MachineX64'
-        elif targetplatform == 'arm':
-            targetmachine.text = 'MachineARM'
-        elif targetplatform == 'arm64':
-            targetmachine.text = 'MachineARM64'
-        else:
-            raise MesonException('Unsupported Visual Studio target machine: ' + targetplatform)
-        # /nologo
-        ET.SubElement(link, 'SuppressStartupBanner').text = 'true'
-        # /release
-        if not self.environment.coredata.get_builtin_option('debug'):
-            ET.SubElement(link, 'SetChecksum').text = 'true'
-
-        meson_file_group = ET.SubElement(root, 'ItemGroup')
-        ET.SubElement(meson_file_group, 'None', Include=os.path.join(proj_to_src_dir, build_filename))
-
-        # Visual Studio can't load projects that present duplicated items. Filter them out
-        # by keeping track of already added paths.
-        def path_normalize_add(path, lis):
-            normalized = os.path.normcase(os.path.normpath(path))
-            if normalized not in lis:
-                lis.append(normalized)
-                return True
-            else:
-                return False
-
-        previous_includes = []
-        if len(headers) + len(gen_hdrs) + len(target.extra_files) + len(pch_sources) > 0:
-            inc_hdrs = ET.SubElement(root, 'ItemGroup')
-            for h in headers:
-                relpath = os.path.join(down, h.rel_to_builddir(self.build_to_src))
-                if path_normalize_add(relpath, previous_includes):
-                    ET.SubElement(inc_hdrs, 'CLInclude', Include=relpath)
-            for h in gen_hdrs:
-                if path_normalize_add(h, previous_includes):
-                    ET.SubElement(inc_hdrs, 'CLInclude', Include=h)
-            for h in target.extra_files:
-                relpath = os.path.join(down, h.rel_to_builddir(self.build_to_src))
-                if path_normalize_add(relpath, previous_includes):
-                    ET.SubElement(inc_hdrs, 'CLInclude', Include=relpath)
-            for lang in pch_sources:
-                h = pch_sources[lang][0]
-                path = os.path.join(proj_to_src_dir, h)
-                if path_normalize_add(path, previous_includes):
-                    ET.SubElement(inc_hdrs, 'CLInclude', Include=path)
-
-        previous_sources = []
-        if len(sources) + len(gen_src) + len(pch_sources) > 0:
-            inc_src = ET.SubElement(root, 'ItemGroup')
-            for s in sources:
-                relpath = os.path.join(down, s.rel_to_builddir(self.build_to_src))
-                if path_normalize_add(relpath, previous_sources):
-                    inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=relpath)
-                    lang = Vs2010Backend.lang_from_source_file(s)
-                    self.add_pch(pch_sources, lang, inc_cl)
-                    self.add_additional_options(lang, inc_cl, file_args)
-                    self.add_preprocessor_defines(lang, inc_cl, file_defines)
-                    self.add_include_dirs(lang, inc_cl, file_inc_dirs)
-                    ET.SubElement(inc_cl, 'ObjectFileName').text = "$(IntDir)" + self.object_filename_from_source(target, s)
-            for s in gen_src:
-                if path_normalize_add(s, previous_sources):
-                    inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=s)
-                    lang = Vs2010Backend.lang_from_source_file(s)
-                    self.add_pch(pch_sources, lang, inc_cl)
-                    self.add_additional_options(lang, inc_cl, file_args)
-                    self.add_preprocessor_defines(lang, inc_cl, file_defines)
-                    self.add_include_dirs(lang, inc_cl, file_inc_dirs)
-            for lang in pch_sources:
-                impl = pch_sources[lang][1]
-                if impl and path_normalize_add(impl, previous_sources):
-                    inc_cl = ET.SubElement(inc_src, 'CLCompile', Include=impl)
-                    self.create_pch(pch_sources, lang, inc_cl)
-                    self.add_additional_options(lang, inc_cl, file_args)
-                    self.add_preprocessor_defines(lang, inc_cl, file_defines)
-                    pch_header_dir = pch_sources[lang][3]
-                    if pch_header_dir:
-                        inc_dirs = copy.deepcopy(file_inc_dirs)
-                        inc_dirs[lang] = [pch_header_dir] + inc_dirs[lang]
-                    else:
-                        inc_dirs = file_inc_dirs
-                    self.add_include_dirs(lang, inc_cl, inc_dirs)
-
-        previous_objects = []
-        if self.has_objects(objects, additional_objects, gen_objs):
-            inc_objs = ET.SubElement(root, 'ItemGroup')
-            for s in objects:
-                relpath = os.path.join(down, s.rel_to_builddir(self.build_to_src))
-                if path_normalize_add(relpath, previous_objects):
-                    ET.SubElement(inc_objs, 'Object', Include=relpath)
-            for s in additional_objects:
-                if path_normalize_add(s, previous_objects):
-                    ET.SubElement(inc_objs, 'Object', Include=s)
-            self.add_generated_objects(inc_objs, gen_objs)
-
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        self.add_regen_dependency(root)
-        self.add_target_deps(root, target)
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    def gen_regenproj(self, project_name, ofname):
-        root = ET.Element('Project', {'DefaultTargets': 'Build',
-                                      'ToolsVersion': '4.0',
-                                      'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
-        confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'})
-        prjconf = ET.SubElement(confitems, 'ProjectConfiguration',
-                                {'Include': self.buildtype + '|' + self.platform})
-        p = ET.SubElement(prjconf, 'Configuration')
-        p.text = self.buildtype
-        pl = ET.SubElement(prjconf, 'Platform')
-        pl.text = self.platform
-        globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals')
-        guidelem = ET.SubElement(globalgroup, 'ProjectGuid')
-        guidelem.text = '{%s}' % self.environment.coredata.regen_guid
-        kw = ET.SubElement(globalgroup, 'Keyword')
-        kw.text = self.platform + 'Proj'
-        p = ET.SubElement(globalgroup, 'Platform')
-        p.text = self.platform
-        pname = ET.SubElement(globalgroup, 'ProjectName')
-        pname.text = project_name
-        if self.windows_target_platform_version:
-            ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props')
-        type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
-        ET.SubElement(type_config, 'ConfigurationType').text = "Utility"
-        ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte'
-        ET.SubElement(type_config, 'UseOfMfc').text = 'false'
-        if self.platform_toolset:
-            ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props')
-        direlem = ET.SubElement(root, 'PropertyGroup')
-        fver = ET.SubElement(direlem, '_ProjectFileVersion')
-        fver.text = self.project_file_version
-        outdir = ET.SubElement(direlem, 'OutDir')
-        outdir.text = '.\\'
-        intdir = ET.SubElement(direlem, 'IntDir')
-        intdir.text = 'regen-temp\\'
-        tname = ET.SubElement(direlem, 'TargetName')
-        tname.text = project_name
-
-        action = ET.SubElement(root, 'ItemDefinitionGroup')
-        midl = ET.SubElement(action, 'Midl')
-        ET.SubElement(midl, "AdditionalIncludeDirectories").text = '%(AdditionalIncludeDirectories)'
-        ET.SubElement(midl, "OutputDirectory").text = '$(IntDir)'
-        ET.SubElement(midl, 'HeaderFileName').text = '%(Filename).h'
-        ET.SubElement(midl, 'TypeLibraryName').text = '%(Filename).tlb'
-        ET.SubElement(midl, 'InterfaceIdentifierFilename').text = '%(Filename)_i.c'
-        ET.SubElement(midl, 'ProxyFileName').text = '%(Filename)_p.c'
-        regen_command = self.environment.get_build_command() + ['--internal', 'regencheck']
-        cmd_templ = '''call %s > NUL
-"%s" "%s"'''
-        regen_command = cmd_templ % \
-            (self.get_vcvars_command(), '" "'.join(regen_command), self.environment.get_scratch_dir())
-        self.add_custom_build(root, 'regen', regen_command, deps=self.get_regen_filelist(),
-                              outputs=[Vs2010Backend.get_regen_stampfile(self.environment.get_build_dir())],
-                              msg='Checking whether solution needs to be regenerated.')
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        ET.SubElement(root, 'ImportGroup', Label='ExtensionTargets')
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    def gen_testproj(self, target_name, ofname):
-        project_name = target_name
-        root = ET.Element('Project', {'DefaultTargets': "Build",
-                                      'ToolsVersion': '4.0',
-                                      'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
-        confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'})
-        prjconf = ET.SubElement(confitems, 'ProjectConfiguration',
-                                {'Include': self.buildtype + '|' + self.platform})
-        p = ET.SubElement(prjconf, 'Configuration')
-        p.text = self.buildtype
-        pl = ET.SubElement(prjconf, 'Platform')
-        pl.text = self.platform
-        globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals')
-        guidelem = ET.SubElement(globalgroup, 'ProjectGuid')
-        guidelem.text = '{%s}' % self.environment.coredata.test_guid
-        kw = ET.SubElement(globalgroup, 'Keyword')
-        kw.text = self.platform + 'Proj'
-        p = ET.SubElement(globalgroup, 'Platform')
-        p.text = self.platform
-        pname = ET.SubElement(globalgroup, 'ProjectName')
-        pname.text = project_name
-        if self.windows_target_platform_version:
-            ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props')
-        type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
-        ET.SubElement(type_config, 'ConfigurationType')
-        ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte'
-        ET.SubElement(type_config, 'UseOfMfc').text = 'false'
-        if self.platform_toolset:
-            ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props')
-        direlem = ET.SubElement(root, 'PropertyGroup')
-        fver = ET.SubElement(direlem, '_ProjectFileVersion')
-        fver.text = self.project_file_version
-        outdir = ET.SubElement(direlem, 'OutDir')
-        outdir.text = '.\\'
-        intdir = ET.SubElement(direlem, 'IntDir')
-        intdir.text = 'test-temp\\'
-        tname = ET.SubElement(direlem, 'TargetName')
-        tname.text = target_name
-
-        action = ET.SubElement(root, 'ItemDefinitionGroup')
-        midl = ET.SubElement(action, 'Midl')
-        ET.SubElement(midl, "AdditionalIncludeDirectories").text = '%(AdditionalIncludeDirectories)'
-        ET.SubElement(midl, "OutputDirectory").text = '$(IntDir)'
-        ET.SubElement(midl, 'HeaderFileName').text = '%(Filename).h'
-        ET.SubElement(midl, 'TypeLibraryName').text = '%(Filename).tlb'
-        ET.SubElement(midl, 'InterfaceIdentifierFilename').text = '%(Filename)_i.c'
-        ET.SubElement(midl, 'ProxyFileName').text = '%(Filename)_p.c'
-        # FIXME: No benchmarks?
-        test_command = self.environment.get_build_command() + ['test', '--no-rebuild']
-        if not self.environment.coredata.get_builtin_option('stdsplit'):
-            test_command += ['--no-stdsplit']
-        if self.environment.coredata.get_builtin_option('errorlogs'):
-            test_command += ['--print-errorlogs']
-        self.serialize_tests()
-        self.add_custom_build(root, 'run_tests', '"%s"' % ('" "'.join(test_command)))
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        self.add_regen_dependency(root)
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    def gen_installproj(self, target_name, ofname):
-        self.create_install_data_files()
-        project_name = target_name
-        root = ET.Element('Project', {'DefaultTargets': "Build",
-                                      'ToolsVersion': '4.0',
-                                      'xmlns': 'http://schemas.microsoft.com/developer/msbuild/2003'})
-        confitems = ET.SubElement(root, 'ItemGroup', {'Label': 'ProjectConfigurations'})
-        prjconf = ET.SubElement(confitems, 'ProjectConfiguration',
-                                {'Include': self.buildtype + '|' + self.platform})
-        p = ET.SubElement(prjconf, 'Configuration')
-        p.text = self.buildtype
-        pl = ET.SubElement(prjconf, 'Platform')
-        pl.text = self.platform
-        globalgroup = ET.SubElement(root, 'PropertyGroup', Label='Globals')
-        guidelem = ET.SubElement(globalgroup, 'ProjectGuid')
-        guidelem.text = '{%s}' % self.environment.coredata.install_guid
-        kw = ET.SubElement(globalgroup, 'Keyword')
-        kw.text = self.platform + 'Proj'
-        p = ET.SubElement(globalgroup, 'Platform')
-        p.text = self.platform
-        pname = ET.SubElement(globalgroup, 'ProjectName')
-        pname.text = project_name
-        if self.windows_target_platform_version:
-            ET.SubElement(globalgroup, 'WindowsTargetPlatformVersion').text = self.windows_target_platform_version
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.Default.props')
-        type_config = ET.SubElement(root, 'PropertyGroup', Label='Configuration')
-        ET.SubElement(type_config, 'ConfigurationType')
-        ET.SubElement(type_config, 'CharacterSet').text = 'MultiByte'
-        ET.SubElement(type_config, 'UseOfMfc').text = 'false'
-        if self.platform_toolset:
-            ET.SubElement(type_config, 'PlatformToolset').text = self.platform_toolset
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.props')
-        direlem = ET.SubElement(root, 'PropertyGroup')
-        fver = ET.SubElement(direlem, '_ProjectFileVersion')
-        fver.text = self.project_file_version
-        outdir = ET.SubElement(direlem, 'OutDir')
-        outdir.text = '.\\'
-        intdir = ET.SubElement(direlem, 'IntDir')
-        intdir.text = 'install-temp\\'
-        tname = ET.SubElement(direlem, 'TargetName')
-        tname.text = target_name
-
-        action = ET.SubElement(root, 'ItemDefinitionGroup')
-        midl = ET.SubElement(action, 'Midl')
-        ET.SubElement(midl, "AdditionalIncludeDirectories").text = '%(AdditionalIncludeDirectories)'
-        ET.SubElement(midl, "OutputDirectory").text = '$(IntDir)'
-        ET.SubElement(midl, 'HeaderFileName').text = '%(Filename).h'
-        ET.SubElement(midl, 'TypeLibraryName').text = '%(Filename).tlb'
-        ET.SubElement(midl, 'InterfaceIdentifierFilename').text = '%(Filename)_i.c'
-        ET.SubElement(midl, 'ProxyFileName').text = '%(Filename)_p.c'
-        install_command = self.environment.get_build_command() + ['install', '--no-rebuild']
-        self.add_custom_build(root, 'run_install', '"%s"' % ('" "'.join(install_command)))
-        ET.SubElement(root, 'Import', Project=r'$(VCTargetsPath)\Microsoft.Cpp.targets')
-        self.add_regen_dependency(root)
-        self._prettyprint_vcxproj_xml(ET.ElementTree(root), ofname)
-
-    def add_custom_build(self, node, rulename, command, deps=None, outputs=None, msg=None):
-        igroup = ET.SubElement(node, 'ItemGroup')
-        rulefile = os.path.join(self.environment.get_scratch_dir(), rulename + '.rule')
-        if not os.path.exists(rulefile):
-            with open(rulefile, 'w', encoding='utf-8') as f:
-                f.write("# Meson regen file.")
-        custombuild = ET.SubElement(igroup, 'CustomBuild', Include=rulefile)
-        if msg:
-            message = ET.SubElement(custombuild, 'Message')
-            message.text = msg
-        cmd_templ = '''setlocal
-%s
-if %%errorlevel%% neq 0 goto :cmEnd
-:cmEnd
-endlocal & call :cmErrorLevel %%errorlevel%% & goto :cmDone
-:cmErrorLevel
-exit /b %%1
-:cmDone
-if %%errorlevel%% neq 0 goto :VCEnd'''
-        ET.SubElement(custombuild, 'Command').text = cmd_templ % command
-        if not outputs:
-            # Use a nonexistent file to always consider the target out-of-date.
-            outputs = [self.nonexistent_file(os.path.join(self.environment.get_scratch_dir(),
-                                                          'outofdate.file'))]
-        ET.SubElement(custombuild, 'Outputs').text = ';'.join(outputs)
-        if deps:
-            ET.SubElement(custombuild, 'AdditionalInputs').text = ';'.join(deps)
-
-    @staticmethod
-    def nonexistent_file(prefix):
-        i = 0
-        file = prefix
-        while os.path.exists(file):
-            file = '%s%d' % (prefix, i)
-        return file
-
-    def generate_debug_information(self, link):
-        # valid values for vs2015 is 'false', 'true', 'DebugFastLink'
-        ET.SubElement(link, 'GenerateDebugInformation').text = 'true'
-
-    def add_regen_dependency(self, root):
-        regen_vcxproj = os.path.join(self.environment.get_build_dir(), 'REGEN.vcxproj')
-        self.add_project_reference(root, regen_vcxproj, self.environment.coredata.regen_guid)
diff --git a/meson/mesonbuild/backend/vs2015backend.py b/meson/mesonbuild/backend/vs2015backend.py
deleted file mode 100644 (file)
index bdc1675..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .vs2010backend import Vs2010Backend
-from ..mesonlib import MesonException
-from ..interpreter import Interpreter
-from ..build import Build
-import typing as T
-
-
-class Vs2015Backend(Vs2010Backend):
-    def __init__(self, build: T.Optional[Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'vs2015'
-        self.vs_version = '2015'
-        if self.environment is not None:
-            # TODO: we assume host == build
-            comps = self.environment.coredata.compilers.host
-            if comps and all(c.id == 'intel-cl' for c in comps.values()):
-                c = list(comps.values())[0]
-                if c.version.startswith('19'):
-                    self.platform_toolset = 'Intel C++ Compiler 19.0'
-                else:
-                    # We don't have support for versions older than 2019 right now.
-                    raise MesonException('There is currently no support for ICL before 19, patches welcome.')
-            if self.platform_toolset is None:
-                self.platform_toolset = 'v140'
diff --git a/meson/mesonbuild/backend/vs2017backend.py b/meson/mesonbuild/backend/vs2017backend.py
deleted file mode 100644 (file)
index fa21606..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import typing as T
-import xml.etree.ElementTree as ET
-
-from .vs2010backend import Vs2010Backend
-from ..mesonlib import MesonException
-from ..interpreter import Interpreter
-from ..build import Build
-
-
-class Vs2017Backend(Vs2010Backend):
-    def __init__(self, build: T.Optional[Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'vs2017'
-        self.vs_version = '2017'
-        # We assume that host == build
-        if self.environment is not None:
-            comps = self.environment.coredata.compilers.host
-            if comps:
-                if comps and all(c.id == 'clang-cl' for c in comps.values()):
-                    self.platform_toolset = 'llvm'
-                elif comps and all(c.id == 'intel-cl' for c in comps.values()):
-                    c = list(comps.values())[0]
-                    if c.version.startswith('19'):
-                        self.platform_toolset = 'Intel C++ Compiler 19.0'
-                    else:
-                        # We don't have support for versions older than 2019 right now.
-                        raise MesonException('There is currently no support for ICL before 19, patches welcome.')
-        if self.platform_toolset is None:
-            self.platform_toolset = 'v141'
-        # WindowsSDKVersion should be set by command prompt.
-        sdk_version = os.environ.get('WindowsSDKVersion', None)
-        if sdk_version:
-            self.windows_target_platform_version = sdk_version.rstrip('\\')
-
-    def generate_debug_information(self, link):
-        # valid values for vs2017 is 'false', 'true', 'DebugFastLink', 'DebugFull'
-        ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'
diff --git a/meson/mesonbuild/backend/vs2019backend.py b/meson/mesonbuild/backend/vs2019backend.py
deleted file mode 100644 (file)
index e089cb4..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-# Copyright 2014-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import typing as T
-import xml.etree.ElementTree as ET
-
-from .vs2010backend import Vs2010Backend
-from ..interpreter import Interpreter
-from ..build import Build
-
-
-class Vs2019Backend(Vs2010Backend):
-    def __init__(self, build: T.Optional[Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'vs2019'
-        if self.environment is not None:
-            comps = self.environment.coredata.compilers.host
-            if comps and all(c.id == 'clang-cl' for c in comps.values()):
-                self.platform_toolset = 'llvm'
-            elif comps and all(c.id == 'intel-cl' for c in comps.values()):
-                c = list(comps.values())[0]
-                if c.version.startswith('19'):
-                    self.platform_toolset = 'Intel C++ Compiler 19.0'
-                # We don't have support for versions older than 2019 right now.
-            if not self.platform_toolset:
-                self.platform_toolset = 'v142'
-            self.vs_version = '2019'
-        # WindowsSDKVersion should be set by command prompt.
-        sdk_version = os.environ.get('WindowsSDKVersion', None)
-        if sdk_version:
-            self.windows_target_platform_version = sdk_version.rstrip('\\')
-
-    def generate_debug_information(self, link):
-        # valid values for vs2019 is 'false', 'true', 'DebugFastLink', 'DebugFull'
-        ET.SubElement(link, 'GenerateDebugInformation').text = 'DebugFull'
diff --git a/meson/mesonbuild/backend/xcodebackend.py b/meson/mesonbuild/backend/xcodebackend.py
deleted file mode 100644 (file)
index 3fe6574..0000000
+++ /dev/null
@@ -1,915 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from . import backends
-from .. import build
-from .. import dependencies
-from .. import mesonlib
-from .. import mlog
-import uuid, os, operator
-import typing as T
-
-from ..mesonlib import MesonException
-from ..interpreter import Interpreter
-
-class XCodeBackend(backends.Backend):
-    def __init__(self, build: T.Optional[build.Build], interpreter: T.Optional[Interpreter]):
-        super().__init__(build, interpreter)
-        self.name = 'xcode'
-        self.project_uid = self.environment.coredata.lang_guids['default'].replace('-', '')[:24]
-        self.project_conflist = self.gen_id()
-        self.indent = '\t' # Recent versions of Xcode uses tabs
-        self.indent_level = 0
-        self.xcodetypemap = {'c': 'sourcecode.c.c',
-                             'a': 'archive.ar',
-                             'cc': 'sourcecode.cpp.cpp',
-                             'cxx': 'sourcecode.cpp.cpp',
-                             'cpp': 'sourcecode.cpp.cpp',
-                             'c++': 'sourcecode.cpp.cpp',
-                             'm': 'sourcecode.c.objc',
-                             'mm': 'sourcecode.cpp.objcpp',
-                             'h': 'sourcecode.c.h',
-                             'hpp': 'sourcecode.cpp.h',
-                             'hxx': 'sourcecode.cpp.h',
-                             'hh': 'sourcecode.cpp.hh',
-                             'inc': 'sourcecode.c.h',
-                             'dylib': 'compiled.mach-o.dylib',
-                             'o': 'compiled.mach-o.objfile',
-                             's': 'sourcecode.asm',
-                             'asm': 'sourcecode.asm',
-                             }
-        self.maingroup_id = self.gen_id()
-        self.all_id = self.gen_id()
-        self.all_buildconf_id = self.gen_id()
-        self.buildtypes = ['debug']
-        self.test_id = self.gen_id()
-        self.test_command_id = self.gen_id()
-        self.test_buildconf_id = self.gen_id()
-
-    def gen_id(self):
-        return str(uuid.uuid4()).upper().replace('-', '')[:24]
-
-    def get_target_dir(self, target):
-        dirname = os.path.join(target.get_subdir(), self.environment.coredata.get_builtin_option('buildtype'))
-        os.makedirs(os.path.join(self.environment.get_build_dir(), dirname), exist_ok=True)
-        return dirname
-
-    def target_to_build_root(self, target):
-        if self.get_target_dir(target) == '':
-            return ''
-        directories = os.path.normpath(self.get_target_dir(target)).split(os.sep)
-        return os.sep.join(['..'] * len(directories))
-
-    def write_line(self, text):
-        self.ofile.write(self.indent * self.indent_level + text)
-        if not text.endswith('\n'):
-            self.ofile.write('\n')
-
-    def generate(self):
-        test_data = self.serialize_tests()[0]
-        self.generate_filemap()
-        self.generate_buildmap()
-        self.generate_buildstylemap()
-        self.generate_build_phase_map()
-        self.generate_build_configuration_map()
-        self.generate_build_configurationlist_map()
-        self.generate_project_configurations_map()
-        self.generate_buildall_configurations_map()
-        self.generate_test_configurations_map()
-        self.generate_native_target_map()
-        self.generate_native_frameworks_map()
-        self.generate_source_phase_map()
-        self.generate_target_dependency_map()
-        self.generate_pbxdep_map()
-        self.generate_containerproxy_map()
-        self.proj_dir = os.path.join(self.environment.get_build_dir(), self.build.project_name + '.xcodeproj')
-        os.makedirs(self.proj_dir, exist_ok=True)
-        self.proj_file = os.path.join(self.proj_dir, 'project.pbxproj')
-        with open(self.proj_file, 'w') as self.ofile:
-            self.generate_prefix()
-            self.generate_pbx_aggregate_target()
-            self.generate_pbx_build_file()
-            self.generate_pbx_build_style()
-            self.generate_pbx_container_item_proxy()
-            self.generate_pbx_file_reference()
-            self.generate_pbx_frameworks_buildphase()
-            self.generate_pbx_group()
-            self.generate_pbx_native_target()
-            self.generate_pbx_project()
-            self.generate_pbx_shell_build_phase(test_data)
-            self.generate_pbx_sources_build_phase()
-            self.generate_pbx_target_dependency()
-            self.generate_xc_build_configuration()
-            self.generate_xc_configurationList()
-            self.generate_suffix()
-
-    def get_xcodetype(self, fname):
-        xcodetype = self.xcodetypemap.get(fname.split('.')[-1].lower())
-        if not xcodetype:
-            xcodetype = 'sourcecode.unknown'
-            mlog.warning('Unknown file type "%s" fallbacking to "%s". Xcode project might be malformed.' % (fname, xcodetype))
-        return xcodetype
-
-    def generate_filemap(self):
-        self.filemap = {} # Key is source file relative to src root.
-        self.target_filemap = {}
-        for name, t in self.build.targets.items():
-            for s in t.sources:
-                if isinstance(s, mesonlib.File):
-                    s = os.path.join(s.subdir, s.fname)
-                    self.filemap[s] = self.gen_id()
-            for o in t.objects:
-                if isinstance(o, str):
-                    o = os.path.join(t.subdir, o)
-                    self.filemap[o] = self.gen_id()
-            self.target_filemap[name] = self.gen_id()
-
-    def generate_buildmap(self):
-        self.buildmap = {}
-        for t in self.build.targets.values():
-            for s in t.sources:
-                s = os.path.join(s.subdir, s.fname)
-                self.buildmap[s] = self.gen_id()
-            for o in t.objects:
-                o = os.path.join(t.subdir, o)
-                if isinstance(o, str):
-                    self.buildmap[o] = self.gen_id()
-
-    def generate_buildstylemap(self):
-        self.buildstylemap = {'debug': self.gen_id()}
-
-    def generate_build_phase_map(self):
-        for tname, t in self.build.targets.items():
-            # generate id for our own target-name
-            t.buildphasemap = {}
-            t.buildphasemap[tname] = self.gen_id()
-            # each target can have it's own Frameworks/Sources/..., generate id's for those
-            t.buildphasemap['Frameworks'] = self.gen_id()
-            t.buildphasemap['Resources'] = self.gen_id()
-            t.buildphasemap['Sources'] = self.gen_id()
-
-    def generate_build_configuration_map(self):
-        self.buildconfmap = {}
-        for t in self.build.targets:
-            bconfs = {'debug': self.gen_id()}
-            self.buildconfmap[t] = bconfs
-
-    def generate_project_configurations_map(self):
-        self.project_configurations = {'debug': self.gen_id()}
-
-    def generate_buildall_configurations_map(self):
-        self.buildall_configurations = {'debug': self.gen_id()}
-
-    def generate_test_configurations_map(self):
-        self.test_configurations = {'debug': self.gen_id()}
-
-    def generate_build_configurationlist_map(self):
-        self.buildconflistmap = {}
-        for t in self.build.targets:
-            self.buildconflistmap[t] = self.gen_id()
-
-    def generate_native_target_map(self):
-        self.native_targets = {}
-        for t in self.build.targets:
-            self.native_targets[t] = self.gen_id()
-
-    def generate_native_frameworks_map(self):
-        self.native_frameworks = {}
-        self.native_frameworks_fileref = {}
-        for t in self.build.targets.values():
-            for dep in t.get_external_deps():
-                if isinstance(dep, dependencies.AppleFrameworks):
-                    for f in dep.frameworks:
-                        self.native_frameworks[f] = self.gen_id()
-                        self.native_frameworks_fileref[f] = self.gen_id()
-
-    def generate_target_dependency_map(self):
-        self.target_dependency_map = {}
-        for tname, t in self.build.targets.items():
-            for target in t.link_targets:
-                self.target_dependency_map[(tname, target.get_basename())] = self.gen_id()
-
-    def generate_pbxdep_map(self):
-        self.pbx_dep_map = {}
-        for t in self.build.targets:
-            self.pbx_dep_map[t] = self.gen_id()
-
-    def generate_containerproxy_map(self):
-        self.containerproxy_map = {}
-        for t in self.build.targets:
-            self.containerproxy_map[t] = self.gen_id()
-
-    def generate_source_phase_map(self):
-        self.source_phase = {}
-        for t in self.build.targets:
-            self.source_phase[t] = self.gen_id()
-
-    def generate_pbx_aggregate_target(self):
-        target_dependencies = list(map(lambda t: self.pbx_dep_map[t], self.build.targets))
-        aggregated_targets = []
-        aggregated_targets.append((self.all_id, 'ALL_BUILD', self.all_buildconf_id, [], target_dependencies))
-        aggregated_targets.append((self.test_id, 'RUN_TESTS', self.test_buildconf_id, [self.test_command_id], []))
-        # Sort objects by ID before writing
-        sorted_aggregated_targets = sorted(aggregated_targets, key=operator.itemgetter(0))
-        self.ofile.write('\n/* Begin PBXAggregateTarget section */\n')
-        for t in sorted_aggregated_targets:
-            name = t[1]
-            buildconf_id = t[2]
-            build_phases = t[3]
-            dependencies = t[4]
-            self.write_line('%s /* %s */ = {' % (t[0], name))
-            self.indent_level += 1
-            self.write_line('isa = PBXAggregateTarget;')
-            self.write_line('buildConfigurationList = %s /* Build configuration list for PBXAggregateTarget "%s" */;' % (buildconf_id, name))
-            self.write_line('buildPhases = (')
-            self.indent_level += 1
-            for bp in build_phases:
-                self.write_line('%s /* ShellScript */,' % bp)
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('dependencies = (')
-            self.indent_level += 1
-            for td in dependencies:
-                self.write_line('%s /* PBXTargetDependency */,' % td)
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('name = %s;' % name)
-            self.write_line('productName = %s;' % name)
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End PBXAggregateTarget section */\n')
-
-    def generate_pbx_build_file(self):
-        self.ofile.write('\n/* Begin PBXBuildFile section */\n')
-        templ = '%s /* %s */ = { isa = PBXBuildFile; fileRef = %s /* %s */; settings = { COMPILER_FLAGS = "%s"; }; };\n'
-        otempl = '%s /* %s */ = { isa = PBXBuildFile; fileRef = %s /* %s */;};\n'
-
-        for t in self.build.targets.values():
-
-            for dep in t.get_external_deps():
-                if isinstance(dep, dependencies.AppleFrameworks):
-                    for f in dep.frameworks:
-                        self.write_line('%s /* %s.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = %s /* %s.framework */; };\n' % (self.native_frameworks[f], f, self.native_frameworks_fileref[f], f))
-
-            for s in t.sources:
-                if isinstance(s, mesonlib.File):
-                    s = s.fname
-
-                if isinstance(s, str):
-                    s = os.path.join(t.subdir, s)
-                    idval = self.buildmap[s]
-                    fullpath = os.path.join(self.environment.get_source_dir(), s)
-                    fileref = self.filemap[s]
-                    fullpath2 = fullpath
-                    compiler_args = ''
-                    self.write_line(templ % (idval, fullpath, fileref, fullpath2, compiler_args))
-            for o in t.objects:
-                o = os.path.join(t.subdir, o)
-                idval = self.buildmap[o]
-                fileref = self.filemap[o]
-                fullpath = os.path.join(self.environment.get_source_dir(), o)
-                fullpath2 = fullpath
-                self.write_line(otempl % (idval, fullpath, fileref, fullpath2))
-        self.ofile.write('/* End PBXBuildFile section */\n')
-
-    def generate_pbx_build_style(self):
-        # FIXME: Xcode 9 and later does not uses PBXBuildStyle and it gets removed. Maybe we can remove this part.
-        self.ofile.write('\n/* Begin PBXBuildStyle section */\n')
-        for name, idval in self.buildstylemap.items():
-            self.write_line('%s /* %s */ = {\n' % (idval, name))
-            self.indent_level += 1
-            self.write_line('isa = PBXBuildStyle;\n')
-            self.write_line('buildSettings = {\n')
-            self.indent_level += 1
-            self.write_line('COPY_PHASE_STRIP = NO;\n')
-            self.indent_level -= 1
-            self.write_line('};\n')
-            self.write_line('name = "%s";\n' % name)
-            self.indent_level -= 1
-            self.write_line('};\n')
-        self.ofile.write('/* End PBXBuildStyle section */\n')
-
-    def generate_pbx_container_item_proxy(self):
-        self.ofile.write('\n/* Begin PBXContainerItemProxy section */\n')
-        for t in self.build.targets:
-            self.write_line('%s /* PBXContainerItemProxy */ = {' % self.containerproxy_map[t])
-            self.indent_level += 1
-            self.write_line('isa = PBXContainerItemProxy;')
-            self.write_line('containerPortal = %s /* Project object */;' % self.project_uid)
-            self.write_line('proxyType = 1;')
-            self.write_line('remoteGlobalIDString = %s;' % self.native_targets[t])
-            self.write_line('remoteInfo = "%s";' % t)
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End PBXContainerItemProxy section */\n')
-
-    def generate_pbx_file_reference(self):
-        self.ofile.write('\n/* Begin PBXFileReference section */\n')
-        for t in self.build.targets.values():
-            for dep in t.get_external_deps():
-                if isinstance(dep, dependencies.AppleFrameworks):
-                    for f in dep.frameworks:
-                        self.write_line('%s /* %s.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = %s.framework; path = System/Library/Frameworks/%s.framework; sourceTree = SDKROOT; };\n' % (self.native_frameworks_fileref[f], f, f, f))
-        src_templ = '%s /* %s */ = { isa = PBXFileReference; explicitFileType = "%s"; fileEncoding = 4; name = "%s"; path = "%s"; sourceTree = SOURCE_ROOT; };\n'
-        for fname, idval in self.filemap.items():
-            fullpath = os.path.join(self.environment.get_source_dir(), fname)
-            xcodetype = self.get_xcodetype(fname)
-            name = os.path.basename(fname)
-            path = fname
-            self.write_line(src_templ % (idval, fullpath, xcodetype, name, path))
-        target_templ = '%s /* %s */ = { isa = PBXFileReference; explicitFileType = "%s"; path = %s; refType = %d; sourceTree = BUILT_PRODUCTS_DIR; };\n'
-        for tname, idval in self.target_filemap.items():
-            t = self.build.targets[tname]
-            fname = t.get_filename()
-            reftype = 0
-            if isinstance(t, build.Executable):
-                typestr = 'compiled.mach-o.executable'
-                path = fname
-            elif isinstance(t, build.SharedLibrary):
-                typestr = self.get_xcodetype('dummy.dylib')
-                path = fname
-            else:
-                typestr = self.get_xcodetype(fname)
-                path = '"%s"' % t.get_filename()
-            self.write_line(target_templ % (idval, tname, typestr, path, reftype))
-        self.ofile.write('/* End PBXFileReference section */\n')
-
-    def generate_pbx_frameworks_buildphase(self):
-        for t in self.build.targets.values():
-            self.ofile.write('\n/* Begin PBXFrameworksBuildPhase section */\n')
-            self.write_line('%s /* %s */ = {\n' % (t.buildphasemap['Frameworks'], 'Frameworks'))
-            self.indent_level += 1
-            self.write_line('isa = PBXFrameworksBuildPhase;\n')
-            self.write_line('buildActionMask = %s;\n' % (2147483647))
-            self.write_line('files = (\n')
-            self.indent_level += 1
-            for dep in t.get_external_deps():
-                if isinstance(dep, dependencies.AppleFrameworks):
-                    for f in dep.frameworks:
-                        self.write_line('%s /* %s.framework in Frameworks */,\n' % (self.native_frameworks[f], f))
-            self.indent_level -= 1
-            self.write_line(');\n')
-            self.write_line('runOnlyForDeploymentPostprocessing = 0;\n')
-            self.indent_level -= 1
-            self.write_line('};\n')
-        self.ofile.write('/* End PBXFrameworksBuildPhase section */\n')
-
-    def generate_pbx_group(self):
-        groupmap = {}
-        target_src_map = {}
-        for t in self.build.targets:
-            groupmap[t] = self.gen_id()
-            target_src_map[t] = self.gen_id()
-        self.ofile.write('\n/* Begin PBXGroup section */\n')
-        sources_id = self.gen_id()
-        resources_id = self.gen_id()
-        products_id = self.gen_id()
-        frameworks_id = self.gen_id()
-        self.write_line('%s = {' % self.maingroup_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXGroup;')
-        self.write_line('children = (')
-        self.indent_level += 1
-        self.write_line('%s /* Sources */,' % sources_id)
-        self.write_line('%s /* Resources */,' % resources_id)
-        self.write_line('%s /* Products */,' % products_id)
-        self.write_line('%s /* Frameworks */,' % frameworks_id)
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('sourceTree = "<group>";')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        # Sources
-        self.write_line('%s /* Sources */ = {' % sources_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXGroup;')
-        self.write_line('children = (')
-        self.indent_level += 1
-        for t in self.build.targets:
-            self.write_line('%s /* %s */,' % (groupmap[t], t))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('name = Sources;')
-        self.write_line('sourceTree = "<group>";')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        self.write_line('%s /* Resources */ = {' % resources_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXGroup;')
-        self.write_line('children = (')
-        self.write_line(');')
-        self.write_line('name = Resources;')
-        self.write_line('sourceTree = "<group>";')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        self.write_line('%s /* Frameworks */ = {' % frameworks_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXGroup;')
-        self.write_line('children = (')
-        # write frameworks
-        self.indent_level += 1
-
-        for t in self.build.targets.values():
-            for dep in t.get_external_deps():
-                if isinstance(dep, dependencies.AppleFrameworks):
-                    for f in dep.frameworks:
-                        self.write_line('%s /* %s.framework */,\n' % (self.native_frameworks_fileref[f], f))
-
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('name = Frameworks;')
-        self.write_line('sourceTree = "<group>";')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        # Targets
-        for t in self.build.targets:
-            self.write_line('%s /* %s */ = {' % (groupmap[t], t))
-            self.indent_level += 1
-            self.write_line('isa = PBXGroup;')
-            self.write_line('children = (')
-            self.indent_level += 1
-            self.write_line('%s /* Source files */,' % target_src_map[t])
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('name = "%s";' % t)
-            self.write_line('sourceTree = "<group>";')
-            self.indent_level -= 1
-            self.write_line('};')
-            self.write_line('%s /* Source files */ = {' % target_src_map[t])
-            self.indent_level += 1
-            self.write_line('isa = PBXGroup;')
-            self.write_line('children = (')
-            self.indent_level += 1
-            for s in self.build.targets[t].sources:
-                s = os.path.join(s.subdir, s.fname)
-                if isinstance(s, str):
-                    self.write_line('%s /* %s */,' % (self.filemap[s], s))
-            for o in self.build.targets[t].objects:
-                o = os.path.join(self.build.targets[t].subdir, o)
-                self.write_line('%s /* %s */,' % (self.filemap[o], o))
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('name = "Source files";')
-            self.write_line('sourceTree = "<group>";')
-            self.indent_level -= 1
-            self.write_line('};')
-
-        # And finally products
-        self.write_line('%s /* Products */ = {' % products_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXGroup;')
-        self.write_line('children = (')
-        self.indent_level += 1
-        for t in self.build.targets:
-            self.write_line('%s /* %s */,' % (self.target_filemap[t], t))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('name = Products;')
-        self.write_line('sourceTree = "<group>";')
-        self.indent_level -= 1
-        self.write_line('};')
-        self.ofile.write('/* End PBXGroup section */\n')
-
-    def generate_pbx_native_target(self):
-        self.ofile.write('\n/* Begin PBXNativeTarget section */\n')
-        for tname, idval in self.native_targets.items():
-            t = self.build.targets[tname]
-            self.write_line('%s /* %s */ = {' % (idval, tname))
-            self.indent_level += 1
-            self.write_line('isa = PBXNativeTarget;')
-            self.write_line('buildConfigurationList = %s /* Build configuration list for PBXNativeTarget "%s" */;'
-                            % (self.buildconflistmap[tname], tname))
-            self.write_line('buildPhases = (')
-            self.indent_level += 1
-            for bpname, bpval in t.buildphasemap.items():
-                self.write_line('%s /* %s yyy */,' % (bpval, bpname))
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('buildRules = (')
-            self.write_line(');')
-            self.write_line('dependencies = (')
-            self.indent_level += 1
-            for lt in self.build.targets[tname].link_targets:
-                # NOT DOCUMENTED, may need to make different links
-                # to same target have different targetdependency item.
-                idval = self.pbx_dep_map[lt.get_id()]
-                self.write_line('%s /* PBXTargetDependency */,' % idval)
-            self.indent_level -= 1
-            self.write_line(");")
-            self.write_line('name = "%s";' % tname)
-            self.write_line('productName = "%s";' % tname)
-            self.write_line('productReference = %s /* %s */;' % (self.target_filemap[tname], tname))
-            if isinstance(t, build.Executable):
-                typestr = 'com.apple.product-type.tool'
-            elif isinstance(t, build.StaticLibrary):
-                typestr = 'com.apple.product-type.library.static'
-            elif isinstance(t, build.SharedLibrary):
-                typestr = 'com.apple.product-type.library.dynamic'
-            else:
-                raise MesonException('Unknown target type for %s' % tname)
-            self.write_line('productType = "%s";' % typestr)
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End PBXNativeTarget section */\n')
-
-    def generate_pbx_project(self):
-        self.ofile.write('\n/* Begin PBXProject section */\n')
-        self.write_line('%s /* Project object */ = {' % self.project_uid)
-        self.indent_level += 1
-        self.write_line('isa = PBXProject;')
-        self.write_line('attributes = {')
-        self.indent_level += 1
-        self.write_line('BuildIndependentTargetsInParallel = YES;')
-        self.indent_level -= 1
-        self.write_line('};')
-        conftempl = 'buildConfigurationList = %s /* Build configuration list for PBXProject "%s" */;'
-        self.write_line(conftempl % (self.project_conflist, self.build.project_name))
-        self.write_line('buildSettings = {')
-        self.write_line('};')
-        self.write_line('buildStyles = (')
-        self.indent_level += 1
-        for name, idval in self.buildstylemap.items():
-            self.write_line('%s /* %s */,' % (idval, name))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('compatibilityVersion = "Xcode 3.2";')
-        self.write_line('hasScannedForEncodings = 0;')
-        self.write_line('mainGroup = %s;' % self.maingroup_id)
-        self.write_line('projectDirPath = "%s";' % self.build_to_src)
-        self.write_line('projectRoot = "";')
-        self.write_line('targets = (')
-        self.indent_level += 1
-        self.write_line('%s /* ALL_BUILD */,' % self.all_id)
-        self.write_line('%s /* RUN_TESTS */,' % self.test_id)
-        for t in self.build.targets:
-            self.write_line('%s /* %s */,' % (self.native_targets[t], t))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.indent_level -= 1
-        self.write_line('};')
-        self.ofile.write('/* End PBXProject section */\n')
-
-    def generate_pbx_shell_build_phase(self, test_data):
-        self.ofile.write('\n/* Begin PBXShellScriptBuildPhase section */\n')
-        self.write_line('%s /* ShellScript */ = {' % self.test_command_id)
-        self.indent_level += 1
-        self.write_line('isa = PBXShellScriptBuildPhase;')
-        self.write_line('buildActionMask = 2147483647;')
-        self.write_line('files = (')
-        self.write_line(');')
-        self.write_line('inputPaths = (')
-        self.write_line(');')
-        self.write_line('outputPaths = (')
-        self.write_line(');')
-        self.write_line('runOnlyForDeploymentPostprocessing = 0;')
-        self.write_line('shellPath = /bin/sh;')
-        cmd = mesonlib.meson_command + ['test', test_data, '-C', self.environment.get_build_dir()]
-        cmdstr = ' '.join(["'%s'" % i for i in cmd])
-        self.write_line('shellScript = "%s";' % cmdstr)
-        self.write_line('showEnvVarsInLog = 0;')
-        self.indent_level -= 1
-        self.write_line('};')
-        self.ofile.write('/* End PBXShellScriptBuildPhase section */\n')
-
-    def generate_pbx_sources_build_phase(self):
-        self.ofile.write('\n/* Begin PBXSourcesBuildPhase section */\n')
-        for name in self.source_phase.keys():
-            t = self.build.targets[name]
-            self.write_line('%s /* Sources */ = {' % (t.buildphasemap[name]))
-            self.indent_level += 1
-            self.write_line('isa = PBXSourcesBuildPhase;')
-            self.write_line('buildActionMask = 2147483647;')
-            self.write_line('files = (')
-            self.indent_level += 1
-            for s in self.build.targets[name].sources:
-                s = os.path.join(s.subdir, s.fname)
-                if not self.environment.is_header(s):
-                    self.write_line('%s /* %s */,' % (self.buildmap[s], os.path.join(self.environment.get_source_dir(), s)))
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('runOnlyForDeploymentPostprocessing = 0;')
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End PBXSourcesBuildPhase section */\n')
-
-    def generate_pbx_target_dependency(self):
-        targets = []
-        for t in self.build.targets:
-            idval = self.pbx_dep_map[t] # VERIFY: is this correct?
-            targets.append((idval, self.native_targets[t], t, self.containerproxy_map[t]))
-
-        # Sort object by ID
-        sorted_targets = sorted(targets, key=operator.itemgetter(0))
-        self.ofile.write('\n/* Begin PBXTargetDependency section */\n')
-        for t in sorted_targets:
-            self.write_line('%s /* PBXTargetDependency */ = {' % t[0])
-            self.indent_level += 1
-            self.write_line('isa = PBXTargetDependency;')
-            self.write_line('target = %s /* %s */;' % (t[1], t[2]))
-            self.write_line('targetProxy = %s /* PBXContainerItemProxy */;' % t[3])
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End PBXTargetDependency section */\n')
-
-    def generate_xc_build_configuration(self):
-        self.ofile.write('\n/* Begin XCBuildConfiguration section */\n')
-        # First the setup for the toplevel project.
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */ = {' % (self.project_configurations[buildtype], buildtype))
-            self.indent_level += 1
-            self.write_line('isa = XCBuildConfiguration;')
-            self.write_line('buildSettings = {')
-            self.indent_level += 1
-            self.write_line('ARCHS = "$(ARCHS_STANDARD_64_BIT)";')
-            self.write_line('ONLY_ACTIVE_ARCH = YES;')
-            self.write_line('SDKROOT = "macosx";')
-            self.write_line('SYMROOT = "%s/build";' % self.environment.get_build_dir())
-            self.indent_level -= 1
-            self.write_line('};')
-            self.write_line('name = "%s";' % buildtype)
-            self.indent_level -= 1
-            self.write_line('};')
-
-        # Then the all target.
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */ = {' % (self.buildall_configurations[buildtype], buildtype))
-            self.indent_level += 1
-            self.write_line('isa = XCBuildConfiguration;')
-            self.write_line('buildSettings = {')
-            self.indent_level += 1
-            self.write_line('COMBINE_HIDPI_IMAGES = YES;')
-            self.write_line('GCC_GENERATE_DEBUGGING_SYMBOLS = NO;')
-            self.write_line('GCC_INLINES_ARE_PRIVATE_EXTERN = NO;')
-            self.write_line('GCC_OPTIMIZATION_LEVEL = 0;')
-            self.write_line('GCC_PREPROCESSOR_DEFINITIONS = "";')
-            self.write_line('GCC_SYMBOLS_PRIVATE_EXTERN = NO;')
-            self.write_line('INSTALL_PATH = "";')
-            self.write_line('OTHER_CFLAGS = "  ";')
-            self.write_line('OTHER_LDFLAGS = " ";')
-            self.write_line('OTHER_REZFLAGS = "";')
-            self.write_line('PRODUCT_NAME = ALL_BUILD;')
-            self.write_line('SECTORDER_FLAGS = "";')
-            self.write_line('SYMROOT = "%s";' % self.environment.get_build_dir())
-            self.write_line('USE_HEADERMAP = NO;')
-            self.write_build_setting_line('WARNING_CFLAGS', ['-Wmost', '-Wno-four-char-constants', '-Wno-unknown-pragmas'])
-            self.indent_level -= 1
-            self.write_line('};')
-            self.write_line('name = "%s";' % buildtype)
-            self.indent_level -= 1
-            self.write_line('};')
-
-        # Then the test target.
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */ = {' % (self.test_configurations[buildtype], buildtype))
-            self.indent_level += 1
-            self.write_line('isa = XCBuildConfiguration;')
-            self.write_line('buildSettings = {')
-            self.indent_level += 1
-            self.write_line('COMBINE_HIDPI_IMAGES = YES;')
-            self.write_line('GCC_GENERATE_DEBUGGING_SYMBOLS = NO;')
-            self.write_line('GCC_INLINES_ARE_PRIVATE_EXTERN = NO;')
-            self.write_line('GCC_OPTIMIZATION_LEVEL = 0;')
-            self.write_line('GCC_PREPROCESSOR_DEFINITIONS = "";')
-            self.write_line('GCC_SYMBOLS_PRIVATE_EXTERN = NO;')
-            self.write_line('INSTALL_PATH = "";')
-            self.write_line('OTHER_CFLAGS = "  ";')
-            self.write_line('OTHER_LDFLAGS = " ";')
-            self.write_line('OTHER_REZFLAGS = "";')
-            self.write_line('PRODUCT_NAME = RUN_TESTS;')
-            self.write_line('SECTORDER_FLAGS = "";')
-            self.write_line('SYMROOT = "%s";' % self.environment.get_build_dir())
-            self.write_line('USE_HEADERMAP = NO;')
-            self.write_build_setting_line('WARNING_CFLAGS', ['-Wmost', '-Wno-four-char-constants', '-Wno-unknown-pragmas'])
-            self.indent_level -= 1
-            self.write_line('};')
-            self.write_line('name = "%s";' % buildtype)
-            self.indent_level -= 1
-            self.write_line('};')
-
-        # Now finally targets.
-        langnamemap = {'c': 'C', 'cpp': 'CPLUSPLUS', 'objc': 'OBJC', 'objcpp': 'OBJCPLUSPLUS'}
-        for target_name, target in self.build.targets.items():
-            for buildtype in self.buildtypes:
-                dep_libs = []
-                links_dylib = False
-                headerdirs = []
-                for d in target.include_dirs:
-                    for sd in d.incdirs:
-                        cd = os.path.join(d.curdir, sd)
-                        headerdirs.append(os.path.join(self.environment.get_source_dir(), cd))
-                        headerdirs.append(os.path.join(self.environment.get_build_dir(), cd))
-                for l in target.link_targets:
-                    abs_path = os.path.join(self.environment.get_build_dir(),
-                                            l.subdir, buildtype, l.get_filename())
-                    dep_libs.append("'%s'" % abs_path)
-                    if isinstance(l, build.SharedLibrary):
-                        links_dylib = True
-                if links_dylib:
-                    dep_libs = ['-Wl,-search_paths_first', '-Wl,-headerpad_max_install_names'] + dep_libs
-                dylib_version = None
-                if isinstance(target, build.SharedLibrary):
-                    ldargs = ['-dynamiclib', '-Wl,-headerpad_max_install_names'] + dep_libs
-                    install_path = os.path.join(self.environment.get_build_dir(), target.subdir, buildtype)
-                    dylib_version = target.soversion
-                else:
-                    ldargs = dep_libs
-                    install_path = ''
-                if dylib_version is not None:
-                    product_name = target.get_basename() + '.' + dylib_version
-                else:
-                    product_name = target.get_basename()
-                ldargs += target.link_args
-                for dep in target.get_external_deps():
-                    ldargs += dep.get_link_args()
-                ldstr = ' '.join(ldargs)
-                valid = self.buildconfmap[target_name][buildtype]
-                langargs = {}
-                for lang in self.environment.coredata.compilers[target.for_machine]:
-                    if lang not in langnamemap:
-                        continue
-                    # Add compile args added using add_project_arguments()
-                    pargs = self.build.projects_args[target.for_machine].get(target.subproject, {}).get(lang, [])
-                    # Add compile args added using add_global_arguments()
-                    # These override per-project arguments
-                    gargs = self.build.global_args[target.for_machine].get(lang, [])
-                    targs = target.get_extra_args(lang)
-                    args = pargs + gargs + targs
-                    if args:
-                        langargs[langnamemap[lang]] = args
-                symroot = os.path.join(self.environment.get_build_dir(), target.subdir)
-                self.write_line('%s /* %s */ = {' % (valid, buildtype))
-                self.indent_level += 1
-                self.write_line('isa = XCBuildConfiguration;')
-                self.write_line('buildSettings = {')
-                self.indent_level += 1
-                self.write_line('COMBINE_HIDPI_IMAGES = YES;')
-                if dylib_version is not None:
-                    self.write_line('DYLIB_CURRENT_VERSION = "%s";' % dylib_version)
-                self.write_line('EXECUTABLE_PREFIX = "%s";' % target.prefix)
-                if target.suffix == '':
-                    suffix = ''
-                else:
-                    suffix = '.' + target.suffix
-                self.write_line('EXECUTABLE_SUFFIX = "%s";' % suffix)
-                self.write_line('GCC_GENERATE_DEBUGGING_SYMBOLS = YES;')
-                self.write_line('GCC_INLINES_ARE_PRIVATE_EXTERN = NO;')
-                self.write_line('GCC_OPTIMIZATION_LEVEL = 0;')
-                if target.has_pch:
-                    # Xcode uses GCC_PREFIX_HEADER which only allows one file per target/executable. Precompiling various header files and
-                    # applying a particular pch to each source file will require custom scripts (as a build phase) and build flags per each
-                    # file. Since Xcode itself already discourages precompiled headers in favor of modules we don't try much harder here.
-                    pchs = target.get_pch('c') + target.get_pch('cpp') + target.get_pch('objc') + target.get_pch('objcpp')
-                    # Make sure to use headers (other backends require implementation files like *.c *.cpp, etc; these should not be used here)
-                    pchs = [pch for pch in pchs if pch.endswith('.h') or pch.endswith('.hh') or pch.endswith('hpp')]
-                    if pchs:
-                        if len(pchs) > 1:
-                            mlog.warning('Unsupported Xcode configuration: More than 1 precompiled header found "%s". Target "%s" might not compile correctly.' % (str(pchs), target.name))
-                        relative_pch_path = os.path.join(target.get_subdir(), pchs[0]) # Path relative to target so it can be used with "$(PROJECT_DIR)"
-                        self.write_line('GCC_PRECOMPILE_PREFIX_HEADER = YES;')
-                        self.write_line('GCC_PREFIX_HEADER = "$(PROJECT_DIR)/%s";' % relative_pch_path)
-                self.write_line('GCC_PREPROCESSOR_DEFINITIONS = "";')
-                self.write_line('GCC_SYMBOLS_PRIVATE_EXTERN = NO;')
-                if headerdirs:
-                    quotedh = ','.join(['"\\"%s\\""' % i for i in headerdirs])
-                    self.write_line('HEADER_SEARCH_PATHS=(%s);' % quotedh)
-                self.write_line('INSTALL_PATH = "%s";' % install_path)
-                self.write_line('LIBRARY_SEARCH_PATHS = "";')
-                if isinstance(target, build.SharedLibrary):
-                    self.write_line('LIBRARY_STYLE = DYNAMIC;')
-                for langname, args in langargs.items():
-                    self.write_build_setting_line('OTHER_%sFLAGS' % langname, args)
-                self.write_line('OTHER_LDFLAGS = "%s";' % ldstr)
-                self.write_line('OTHER_REZFLAGS = "";')
-                self.write_line('PRODUCT_NAME = %s;' % product_name)
-                self.write_line('SECTORDER_FLAGS = "";')
-                self.write_line('SYMROOT = "%s";' % symroot)
-                self.write_build_setting_line('SYSTEM_HEADER_SEARCH_PATHS', [self.environment.get_build_dir()])
-                self.write_line('USE_HEADERMAP = NO;')
-                self.write_build_setting_line('WARNING_CFLAGS', ['-Wmost', '-Wno-four-char-constants', '-Wno-unknown-pragmas'])
-                self.indent_level -= 1
-                self.write_line('};')
-                self.write_line('name = %s;' % buildtype)
-                self.indent_level -= 1
-                self.write_line('};')
-        self.ofile.write('/* End XCBuildConfiguration section */\n')
-
-    def generate_xc_configurationList(self):
-        # FIXME: sort items
-        self.ofile.write('\n/* Begin XCConfigurationList section */\n')
-        self.write_line('%s /* Build configuration list for PBXProject "%s" */ = {' % (self.project_conflist, self.build.project_name))
-        self.indent_level += 1
-        self.write_line('isa = XCConfigurationList;')
-        self.write_line('buildConfigurations = (')
-        self.indent_level += 1
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */,' % (self.project_configurations[buildtype], buildtype))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('defaultConfigurationIsVisible = 0;')
-        self.write_line('defaultConfigurationName = debug;')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        # Now the all target
-        self.write_line('%s /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */ = {' % self.all_buildconf_id)
-        self.indent_level += 1
-        self.write_line('isa = XCConfigurationList;')
-        self.write_line('buildConfigurations = (')
-        self.indent_level += 1
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */,' % (self.buildall_configurations[buildtype], buildtype))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('defaultConfigurationIsVisible = 0;')
-        self.write_line('defaultConfigurationName = debug;')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        # Test target
-        self.write_line('%s /* Build configuration list for PBXAggregateTarget "ALL_BUILD" */ = {' % self.test_buildconf_id)
-        self.indent_level += 1
-        self.write_line('isa = XCConfigurationList;')
-        self.write_line('buildConfigurations = (')
-        self.indent_level += 1
-        for buildtype in self.buildtypes:
-            self.write_line('%s /* %s */,' % (self.test_configurations[buildtype], buildtype))
-        self.indent_level -= 1
-        self.write_line(');')
-        self.write_line('defaultConfigurationIsVisible = 0;')
-        self.write_line('defaultConfigurationName = debug;')
-        self.indent_level -= 1
-        self.write_line('};')
-
-        for target_name in self.build.targets:
-            listid = self.buildconflistmap[target_name]
-            self.write_line('%s /* Build configuration list for PBXNativeTarget "%s" */ = {' % (listid, target_name))
-            self.indent_level += 1
-            self.write_line('isa = XCConfigurationList;')
-            self.write_line('buildConfigurations = (')
-            self.indent_level += 1
-            typestr = 'debug'
-            idval = self.buildconfmap[target_name][typestr]
-            self.write_line('%s /* %s */,' % (idval, typestr))
-            self.indent_level -= 1
-            self.write_line(');')
-            self.write_line('defaultConfigurationIsVisible = 0;')
-            self.write_line('defaultConfigurationName = %s;' % typestr)
-            self.indent_level -= 1
-            self.write_line('};')
-        self.ofile.write('/* End XCConfigurationList section */\n')
-
-    def write_build_setting_line(self, flag_name, flag_values, explicit=False):
-        if flag_values:
-            if len(flag_values) == 1:
-                value = flag_values[0]
-                if (' ' in value):
-                    # If path contains spaces surround it with double colon
-                    self.write_line('%s = "\\"%s\\"";' % (flag_name, value))
-                else:
-                    self.write_line('%s = "%s";' % (flag_name, value))
-            else:
-                self.write_line('%s = (' % flag_name)
-                self.indent_level += 1
-                for value in flag_values:
-                    if (' ' in value):
-                        # If path contains spaces surround it with double colon
-                        self.write_line('"\\"%s\\"",' % value)
-                    else:
-                        self.write_line('"%s",' % value)
-                self.indent_level -= 1
-                self.write_line(');')
-        else:
-            if explicit:
-                self.write_line('%s = "";' % flag_name)
-
-    def generate_prefix(self):
-        self.ofile.write('// !$*UTF8*$!\n{\n')
-        self.indent_level += 1
-        self.write_line('archiveVersion = 1;\n')
-        self.write_line('classes = {\n')
-        self.write_line('};\n')
-        self.write_line('objectVersion = 46;\n')
-        self.write_line('objects = {\n')
-        self.indent_level += 1
-
-    def generate_suffix(self):
-        self.indent_level -= 1
-        self.write_line('};\n')
-        self.write_line('rootObject = ' + self.project_uid + ' /* Project object */;')
-        self.indent_level -= 1
-        self.write_line('}\n')
diff --git a/meson/mesonbuild/build.py b/meson/mesonbuild/build.py
deleted file mode 100644 (file)
index a06979c..0000000
+++ /dev/null
@@ -1,2520 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from collections import OrderedDict, defaultdict
-from functools import lru_cache
-import copy
-import hashlib
-import itertools, pathlib
-import os
-import pickle
-import re
-import typing as T
-
-from . import environment
-from . import dependencies
-from . import mlog
-from .mesonlib import (
-    File, MesonException, MachineChoice, PerMachine, OrderedSet, listify,
-    extract_as_list, typeslistify, stringlistify, classify_unity_sources,
-    get_filenames_templates_dict, substitute_values, has_path_sep, unholder
-)
-from .compilers import (
-    Compiler, all_languages, is_object, clink_langs, sort_clink, lang_suffixes,
-    is_known_suffix
-)
-from .linkers import StaticLinker
-from .interpreterbase import FeatureNew
-
-pch_kwargs = set(['c_pch', 'cpp_pch'])
-
-lang_arg_kwargs = set([
-    'c_args',
-    'cpp_args',
-    'cuda_args',
-    'd_args',
-    'd_import_dirs',
-    'd_unittest',
-    'd_module_versions',
-    'd_debug',
-    'fortran_args',
-    'java_args',
-    'objc_args',
-    'objcpp_args',
-    'rust_args',
-    'vala_args',
-    'cs_args',
-])
-
-vala_kwargs = set(['vala_header', 'vala_gir', 'vala_vapi'])
-rust_kwargs = set(['rust_crate_type'])
-cs_kwargs = set(['resources', 'cs_args'])
-
-buildtarget_kwargs = set([
-    'build_by_default',
-    'build_rpath',
-    'dependencies',
-    'extra_files',
-    'gui_app',
-    'link_with',
-    'link_whole',
-    'link_args',
-    'link_depends',
-    'implicit_include_directories',
-    'include_directories',
-    'install',
-    'install_rpath',
-    'install_dir',
-    'install_mode',
-    'name_prefix',
-    'name_suffix',
-    'native',
-    'objects',
-    'override_options',
-    'sources',
-    'gnu_symbol_visibility',
-    'link_language',
-])
-
-known_build_target_kwargs = (
-    buildtarget_kwargs |
-    lang_arg_kwargs |
-    pch_kwargs |
-    vala_kwargs |
-    rust_kwargs |
-    cs_kwargs)
-
-known_exe_kwargs = known_build_target_kwargs | {'implib', 'export_dynamic', 'pie'}
-known_shlib_kwargs = known_build_target_kwargs | {'version', 'soversion', 'vs_module_defs', 'darwin_versions'}
-known_shmod_kwargs = known_build_target_kwargs | {'vs_module_defs'}
-known_stlib_kwargs = known_build_target_kwargs | {'pic'}
-known_jar_kwargs = known_exe_kwargs | {'main_class'}
-
-@lru_cache(maxsize=None)
-def get_target_macos_dylib_install_name(ld) -> str:
-    name = ['@rpath/', ld.prefix, ld.name]
-    if ld.soversion is not None:
-        name.append('.' + ld.soversion)
-    name.append('.dylib')
-    return ''.join(name)
-
-class InvalidArguments(MesonException):
-    pass
-
-class DependencyOverride:
-    def __init__(self, dep, node, explicit=True):
-        self.dep = dep
-        self.node = node
-        self.explicit = explicit
-
-class Build:
-    """A class that holds the status of one build including
-    all dependencies and so on.
-    """
-
-    def __init__(self, environment: environment.Environment):
-        self.project_name = 'name of master project'
-        self.project_version = None
-        self.environment = environment
-        self.projects = {}
-        self.targets = OrderedDict()
-        self.run_target_names = set() # type: T.Set[T.Tuple[str, str]]
-        self.global_args = PerMachine({}, {})         # type: PerMachine[T.Dict[str, T.List[str]]]
-        self.projects_args = PerMachine({}, {})       # type: PerMachine[T.Dict[str, T.List[str]]]
-        self.global_link_args = PerMachine({}, {})    # type: PerMachine[T.Dict[str, T.List[str]]]
-        self.projects_link_args = PerMachine({}, {})  # type: PerMachine[T.Dict[str, T.List[str]]]
-        self.tests = []
-        self.benchmarks = []
-        self.headers = []
-        self.man = []
-        self.data = []
-        self.static_linker = PerMachine(None, None)   # type: PerMachine[StaticLinker]
-        self.subprojects = {}
-        self.subproject_dir = ''
-        self.install_scripts = []
-        self.postconf_scripts = []
-        self.dist_scripts = []
-        self.install_dirs = []
-        self.dep_manifest_name = None
-        self.dep_manifest = {}
-        self.stdlibs = PerMachine({}, {})
-        self.test_setups = {}                         # type: T.Dict[str, TestSetup]
-        self.test_setup_default_name = None
-        self.find_overrides = {}
-        self.searched_programs = set() # The list of all programs that have been searched for.
-        self.dependency_overrides = PerMachine({}, {})
-
-    def copy(self):
-        other = Build(self.environment)
-        for k, v in self.__dict__.items():
-            if isinstance(v, (list, dict, set, OrderedDict)):
-                other.__dict__[k] = v.copy()
-            else:
-                other.__dict__[k] = v
-        return other
-
-    def merge(self, other):
-        for k, v in other.__dict__.items():
-            self.__dict__[k] = v
-
-    def ensure_static_linker(self, compiler):
-        if self.static_linker[compiler.for_machine] is None and compiler.needs_static_linker():
-            self.static_linker[compiler.for_machine] = self.environment.detect_static_linker(compiler)
-
-    def get_project(self):
-        return self.projects['']
-
-    def get_subproject_dir(self):
-        return self.subproject_dir
-
-    def get_targets(self):
-        return self.targets
-
-    def get_tests(self):
-        return self.tests
-
-    def get_benchmarks(self):
-        return self.benchmarks
-
-    def get_headers(self):
-        return self.headers
-
-    def get_man(self):
-        return self.man
-
-    def get_data(self):
-        return self.data
-
-    def get_install_subdirs(self):
-        return self.install_dirs
-
-    def get_global_args(self, compiler, for_machine):
-        d = self.global_args[for_machine]
-        return d.get(compiler.get_language(), [])
-
-    def get_project_args(self, compiler, project, for_machine):
-        d = self.projects_args[for_machine]
-        args = d.get(project)
-        if not args:
-            return []
-        return args.get(compiler.get_language(), [])
-
-    def get_global_link_args(self, compiler, for_machine):
-        d = self.global_link_args[for_machine]
-        return d.get(compiler.get_language(), [])
-
-    def get_project_link_args(self, compiler, project, for_machine):
-        d = self.projects_link_args[for_machine]
-
-        link_args = d.get(project)
-        if not link_args:
-            return []
-
-        return link_args.get(compiler.get_language(), [])
-
-class IncludeDirs:
-    def __init__(self, curdir, dirs, is_system, extra_build_dirs=None):
-        self.curdir = curdir
-        self.incdirs = dirs
-        self.is_system = is_system
-        # Interpreter has validated that all given directories
-        # actually exist.
-        if extra_build_dirs is None:
-            self.extra_build_dirs = []
-        else:
-            self.extra_build_dirs = extra_build_dirs
-
-    def __repr__(self):
-        r = '<{} {}/{}>'
-        return r.format(self.__class__.__name__, self.curdir, self.incdirs)
-
-    def get_curdir(self):
-        return self.curdir
-
-    def get_incdirs(self):
-        return self.incdirs
-
-    def get_extra_build_dirs(self):
-        return self.extra_build_dirs
-
-class ExtractedObjects:
-    '''
-    Holds a list of sources for which the objects must be extracted
-    '''
-    def __init__(self, target, srclist=None, genlist=None, objlist=None, recursive=True):
-        self.target = target
-        self.recursive = recursive
-        self.srclist = srclist if srclist is not None else []
-        self.genlist = genlist if genlist is not None else []
-        self.objlist = objlist if objlist is not None else []
-        if self.target.is_unity:
-            self.check_unity_compatible()
-
-    def __repr__(self):
-        r = '<{0} {1!r}: {2}>'
-        return r.format(self.__class__.__name__, self.target.name, self.srclist)
-
-    def classify_all_sources(self, sources, generated_sources):
-        # Merge sources and generated sources
-        sources = list(sources)
-        for gensrc in generated_sources:
-            for s in gensrc.get_outputs():
-                # We cannot know the path where this source will be generated,
-                # but all we need here is the file extension to determine the
-                # compiler.
-                sources.append(s)
-
-        # Filter out headers and all non-source files
-        sources = [s for s in sources if environment.is_source(s) and not environment.is_header(s)]
-
-        return classify_unity_sources(self.target.compilers.values(), sources)
-
-    def check_unity_compatible(self):
-        # Figure out if the extracted object list is compatible with a Unity
-        # build. When we're doing a Unified build, we go through the sources,
-        # and create a single source file from each subset of the sources that
-        # can be compiled with a specific compiler. Then we create one object
-        # from each unified source file. So for each compiler we can either
-        # extra all its sources or none.
-        cmpsrcs = self.classify_all_sources(self.target.sources, self.target.generated)
-        extracted_cmpsrcs = self.classify_all_sources(self.srclist, self.genlist)
-
-        for comp, srcs in extracted_cmpsrcs.items():
-            if set(srcs) != set(cmpsrcs[comp]):
-                raise MesonException('Single object files can not be extracted '
-                                     'in Unity builds. You can only extract all '
-                                     'the object files for each compiler at once.')
-
-    def get_outputs(self, backend):
-        # TODO: Consider if we need to handle genlist here
-        return [
-            backend.object_filename_from_source(self.target, source)
-            for source in self.srclist
-        ]
-
-class EnvironmentVariables:
-    def __init__(self):
-        self.envvars = []
-        # The set of all env vars we have operations for. Only used for self.has_name()
-        self.varnames = set()
-
-    def __repr__(self):
-        repr_str = "<{0}: {1}>"
-        return repr_str.format(self.__class__.__name__, self.envvars)
-
-    def add_var(self, method, name, args, kwargs):
-        self.varnames.add(name)
-        self.envvars.append((method, name, args, kwargs))
-
-    def has_name(self, name):
-        return name in self.varnames
-
-    def get_value(self, values, kwargs):
-        separator = kwargs.get('separator', os.pathsep)
-
-        value = ''
-        for var in values:
-            value += separator + var
-        return separator, value.strip(separator)
-
-    def set(self, env, name, values, kwargs):
-        return self.get_value(values, kwargs)[1]
-
-    def append(self, env, name, values, kwargs):
-        sep, value = self.get_value(values, kwargs)
-        if name in env:
-            return env[name] + sep + value
-        return value
-
-    def prepend(self, env, name, values, kwargs):
-        sep, value = self.get_value(values, kwargs)
-        if name in env:
-            return value + sep + env[name]
-
-        return value
-
-    def get_env(self, full_env: T.Dict[str, str]) -> T.Dict[str, str]:
-        env = full_env.copy()
-        for method, name, values, kwargs in self.envvars:
-            env[name] = method(full_env, name, values, kwargs)
-        return env
-
-class Target:
-    def __init__(self, name, subdir, subproject, build_by_default, for_machine: MachineChoice):
-        if has_path_sep(name):
-            # Fix failing test 53 when this becomes an error.
-            mlog.warning('''Target "{}" has a path separator in its name.
-This is not supported, it can cause unexpected failures and will become
-a hard error in the future.'''.format(name))
-        self.name = name
-        self.subdir = subdir
-        self.subproject = subproject
-        self.build_by_default = build_by_default
-        self.for_machine = for_machine
-        self.install = False
-        self.build_always_stale = False
-        self.option_overrides_base = {}
-        self.option_overrides_compiler = defaultdict(dict)
-        if not hasattr(self, 'typename'):
-            raise RuntimeError('Target type is not set for target class "{}". This is a bug'.format(type(self).__name__))
-
-    def __lt__(self, other: T.Any) -> T.Union[bool, type(NotImplemented)]:
-        if not hasattr(other, 'get_id') and not callable(other.get_id):
-            return NotImplemented
-        return self.get_id() < other.get_id()
-
-    def __le__(self, other: T.Any) -> T.Union[bool, type(NotImplemented)]:
-        if not hasattr(other, 'get_id') and not callable(other.get_id):
-            return NotImplemented
-        return self.get_id() <= other.get_id()
-
-    def __gt__(self, other: T.Any) -> T.Union[bool, type(NotImplemented)]:
-        if not hasattr(other, 'get_id') and not callable(other.get_id):
-            return NotImplemented
-        return self.get_id() > other.get_id()
-
-    def __ge__(self, other: T.Any) -> T.Union[bool, type(NotImplemented)]:
-        if not hasattr(other, 'get_id') and not callable(other.get_id):
-            return NotImplemented
-        return self.get_id() >= other.get_id()
-
-    def get_install_dir(self, environment):
-        # Find the installation directory.
-        default_install_dir = self.get_default_install_dir(environment)
-        outdirs = self.get_custom_install_dir()
-        if outdirs[0] is not None and outdirs[0] != default_install_dir and outdirs[0] is not True:
-            # Either the value is set to a non-default value, or is set to
-            # False (which means we want this specific output out of many
-            # outputs to not be installed).
-            custom_install_dir = True
-        else:
-            custom_install_dir = False
-            outdirs[0] = default_install_dir
-        return outdirs, custom_install_dir
-
-    def get_basename(self):
-        return self.name
-
-    def get_subdir(self):
-        return self.subdir
-
-    def get_typename(self):
-        return self.typename
-
-    @staticmethod
-    def _get_id_hash(target_id):
-        # We don't really need cryptographic security here.
-        # Small-digest hash function with unlikely collision is good enough.
-        h = hashlib.sha256()
-        h.update(target_id.encode(encoding='utf-8', errors='replace'))
-        # This ID should be case-insensitive and should work in Visual Studio,
-        # e.g. it should not start with leading '-'.
-        return h.hexdigest()[:7]
-
-    @staticmethod
-    def construct_id_from_path(subdir, name, type_suffix):
-        """Construct target ID from subdir, name and type suffix.
-
-        This helper function is made public mostly for tests."""
-        # This ID must also be a valid file name on all OSs.
-        # It should also avoid shell metacharacters for obvious
-        # reasons. '@' is not used as often as '_' in source code names.
-        # In case of collisions consider using checksums.
-        # FIXME replace with assert when slash in names is prohibited
-        name_part = name.replace('/', '@').replace('\\', '@')
-        assert not has_path_sep(type_suffix)
-        my_id = name_part + type_suffix
-        if subdir:
-            subdir_part = Target._get_id_hash(subdir)
-            # preserve myid for better debuggability
-            return subdir_part + '@@' + my_id
-        return my_id
-
-    def get_id(self):
-        return self.construct_id_from_path(
-            self.subdir, self.name, self.type_suffix())
-
-    def process_kwargs_base(self, kwargs):
-        if 'build_by_default' in kwargs:
-            self.build_by_default = kwargs['build_by_default']
-            if not isinstance(self.build_by_default, bool):
-                raise InvalidArguments('build_by_default must be a boolean value.')
-        elif kwargs.get('install', False):
-            # For backward compatibility, if build_by_default is not explicitly
-            # set, use the value of 'install' if it's enabled.
-            self.build_by_default = True
-
-        option_overrides = self.parse_overrides(kwargs)
-
-        for k, v in option_overrides.items():
-            if '_' in k:
-               lang, k2 = k.split('_', 1)
-               if lang in all_languages:
-                   self.option_overrides_compiler[lang][k2] = v
-                   continue
-            self.option_overrides_base[k] = v
-
-    def parse_overrides(self, kwargs) -> dict:
-        result = {}
-        overrides = stringlistify(kwargs.get('override_options', []))
-        for o in overrides:
-            if '=' not in o:
-                raise InvalidArguments('Overrides must be of form "key=value"')
-            k, v = o.split('=', 1)
-            k = k.strip()
-            v = v.strip()
-            result[k] = v
-        return result
-
-    def is_linkable_target(self) -> bool:
-        return False
-
-class BuildTarget(Target):
-    known_kwargs = known_build_target_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        super().__init__(name, subdir, subproject, True, for_machine)
-        unity_opt = environment.coredata.get_builtin_option('unity')
-        self.is_unity = unity_opt == 'on' or (unity_opt == 'subprojects' and subproject != '')
-        self.environment = environment
-        self.sources = []
-        self.compilers = OrderedDict() # type: OrderedDict[str, Compiler]
-        self.objects = []
-        self.external_deps = []
-        self.include_dirs = []
-        self.link_language = kwargs.get('link_language')
-        self.link_targets = []
-        self.link_whole_targets = []
-        self.link_depends = []
-        self.added_deps = set()
-        self.name_prefix_set = False
-        self.name_suffix_set = False
-        self.filename = 'no_name'
-        # The list of all files outputted by this target. Useful in cases such
-        # as Vala which generates .vapi and .h besides the compiled output.
-        self.outputs = [self.filename]
-        self.need_install = False
-        self.pch = {}
-        self.extra_args = {}
-        self.generated = []
-        self.extra_files = []
-        self.d_features = {}
-        self.pic = False
-        self.pie = False
-        # Track build_rpath entries so we can remove them at install time
-        self.rpath_dirs_to_remove = set()
-        # Sources can be:
-        # 1. Pre-existing source files in the source tree
-        # 2. Pre-existing sources generated by configure_file in the build tree
-        # 3. Sources files generated by another target or a Generator
-        self.process_sourcelist(sources)
-        # Objects can be:
-        # 1. Pre-existing objects provided by the user with the `objects:` kwarg
-        # 2. Compiled objects created by and extracted from another target
-        self.process_objectlist(objects)
-        self.process_kwargs(kwargs, environment)
-        self.check_unknown_kwargs(kwargs)
-        self.process_compilers()
-        if not any([self.sources, self.generated, self.objects, self.link_whole]):
-            raise InvalidArguments('Build target {} has no sources.'.format(name))
-        self.process_compilers_late()
-        self.validate_sources()
-        self.validate_install(environment)
-        self.check_module_linking()
-
-    def __repr__(self):
-        repr_str = "<{0} {1}: {2}>"
-        return repr_str.format(self.__class__.__name__, self.get_id(), self.filename)
-
-    def __str__(self):
-        return "{}".format(self.name)
-
-    def validate_install(self, environment):
-        if self.for_machine is MachineChoice.BUILD and self.need_install:
-            if environment.is_cross_build():
-                raise InvalidArguments('Tried to install a target for the build machine in a cross build.')
-            else:
-                mlog.warning('Installing target build for the build machine. This will fail in a cross build.')
-
-    def check_unknown_kwargs(self, kwargs):
-        # Override this method in derived classes that have more
-        # keywords.
-        self.check_unknown_kwargs_int(kwargs, self.known_kwargs)
-
-    def check_unknown_kwargs_int(self, kwargs, known_kwargs):
-        unknowns = []
-        for k in kwargs:
-            if k not in known_kwargs:
-                unknowns.append(k)
-        if len(unknowns) > 0:
-            mlog.warning('Unknown keyword argument(s) in target {}: {}.'.format(self.name, ', '.join(unknowns)))
-
-    def process_objectlist(self, objects):
-        assert(isinstance(objects, list))
-        for s in unholder(objects):
-            if isinstance(s, (str, File, ExtractedObjects)):
-                self.objects.append(s)
-            elif isinstance(s, (GeneratedList, CustomTarget)):
-                msg = 'Generated files are not allowed in the \'objects\' kwarg ' + \
-                    'for target {!r}.\nIt is meant only for '.format(self.name) + \
-                    'pre-built object files that are shipped with the\nsource ' + \
-                    'tree. Try adding it in the list of sources.'
-                raise InvalidArguments(msg)
-            else:
-                msg = 'Bad object of type {!r} in target {!r}.'.format(type(s).__name__, self.name)
-                raise InvalidArguments(msg)
-
-    def process_sourcelist(self, sources):
-        sources = listify(sources)
-        added_sources = {} # If the same source is defined multiple times, use it only once.
-        for s in unholder(sources):
-            if isinstance(s, File):
-                if s not in added_sources:
-                    self.sources.append(s)
-                    added_sources[s] = True
-            elif isinstance(s, (GeneratedList, CustomTarget, CustomTargetIndex)):
-                self.generated.append(s)
-            else:
-                msg = 'Bad source of type {!r} in target {!r}.'.format(type(s).__name__, self.name)
-                raise InvalidArguments(msg)
-
-    @staticmethod
-    def can_compile_remove_sources(compiler, sources):
-        removed = False
-        for s in sources[:]:
-            if compiler.can_compile(s):
-                sources.remove(s)
-                removed = True
-        return removed
-
-    def process_compilers_late(self):
-        """Processes additional compilers after kwargs have been evaluated.
-
-        This can add extra compilers that might be required by keyword
-        arguments, such as link_with or dependencies. It will also try to guess
-        which compiler to use if one hasn't been selected already.
-        """
-        # Populate list of compilers
-        compilers = self.environment.coredata.compilers[self.for_machine]
-
-        # did user override clink_langs for this target?
-        link_langs = [self.link_language] if self.link_language else clink_langs
-
-        # If this library is linked against another library we need to consider
-        # the languages of those libraries as well.
-        if self.link_targets or self.link_whole_targets:
-            extra = set()
-            for t in itertools.chain(self.link_targets, self.link_whole_targets):
-                if isinstance(t, CustomTarget) or isinstance(t, CustomTargetIndex):
-                    continue # We can't know anything about these.
-                for name, compiler in t.compilers.items():
-                    if name in link_langs:
-                        extra.add((name, compiler))
-            for name, compiler in sorted(extra, key=lambda p: sort_clink(p[0])):
-                self.compilers[name] = compiler
-
-        if not self.compilers:
-            # No source files or parent targets, target consists of only object
-            # files of unknown origin. Just add the first clink compiler
-            # that we have and hope that it can link these objects
-            for lang in link_langs:
-                if lang in compilers:
-                    self.compilers[lang] = compilers[lang]
-                    break
-
-    def process_compilers(self):
-        '''
-        Populate self.compilers, which is the list of compilers that this
-        target will use for compiling all its sources.
-        We also add compilers that were used by extracted objects to simplify
-        dynamic linker determination.
-        '''
-        if not self.sources and not self.generated and not self.objects:
-            return
-        # Populate list of compilers
-        compilers = self.environment.coredata.compilers[self.for_machine]
-        # Pre-existing sources
-        sources = list(self.sources)
-        # All generated sources
-        for gensrc in self.generated:
-            for s in gensrc.get_outputs():
-                # Generated objects can't be compiled, so don't use them for
-                # compiler detection. If our target only has generated objects,
-                # we will fall back to using the first c-like compiler we find,
-                # which is what we need.
-                if not is_object(s):
-                    sources.append(s)
-        for d in unholder(self.external_deps):
-            for s in d.sources:
-                if isinstance(s, (str, File)):
-                    sources.append(s)
-
-        # Sources that were used to create our extracted objects
-        for o in self.objects:
-            if not isinstance(o, ExtractedObjects):
-                continue
-            for s in o.srclist:
-                # Don't add Vala sources since that will pull in the Vala
-                # compiler even though we will never use it since we are
-                # dealing with compiled C code.
-                if not s.endswith(lang_suffixes['vala']):
-                    sources.append(s)
-        if sources:
-            # For each source, try to add one compiler that can compile it.
-            #
-            # If it has a suffix that belongs to a known language, we must have
-            # a compiler for that language.
-            #
-            # Otherwise, it's ok if no compilers can compile it, because users
-            # are expected to be able to add arbitrary non-source files to the
-            # sources list
-            for s in sources:
-                for lang, compiler in compilers.items():
-                    if compiler.can_compile(s):
-                        if lang not in self.compilers:
-                            self.compilers[lang] = compiler
-                        break
-                else:
-                    if is_known_suffix(s):
-                        raise MesonException('No {} machine compiler for "{}"'.
-                                             format(self.for_machine.get_lower_case_name(), s))
-
-            # Re-sort according to clink_langs
-            self.compilers = OrderedDict(sorted(self.compilers.items(),
-                                                key=lambda t: sort_clink(t[0])))
-
-        # If all our sources are Vala, our target also needs the C compiler but
-        # it won't get added above.
-        if 'vala' in self.compilers and 'c' not in self.compilers:
-            self.compilers['c'] = compilers['c']
-
-    def validate_sources(self):
-        if not self.sources:
-            return
-        for lang in ('cs', 'java'):
-            if lang in self.compilers:
-                check_sources = list(self.sources)
-                compiler = self.compilers[lang]
-                if not self.can_compile_remove_sources(compiler, check_sources):
-                    m = 'No {} sources found in target {!r}'.format(lang, self.name)
-                    raise InvalidArguments(m)
-                if check_sources:
-                    m = '{0} targets can only contain {0} files:\n'.format(lang.capitalize())
-                    m += '\n'.join([repr(c) for c in check_sources])
-                    raise InvalidArguments(m)
-                # CSharp and Java targets can't contain any other file types
-                assert(len(self.compilers) == 1)
-                return
-
-    def process_link_depends(self, sources, environment):
-        """Process the link_depends keyword argument.
-
-        This is designed to handle strings, Files, and the output of Custom
-        Targets. Notably it doesn't handle generator() returned objects, since
-        adding them as a link depends would inherently cause them to be
-        generated twice, since the output needs to be passed to the ld_args and
-        link_depends.
-        """
-        sources = listify(sources)
-        for s in unholder(sources):
-            if isinstance(s, File):
-                self.link_depends.append(s)
-            elif isinstance(s, str):
-                self.link_depends.append(
-                    File.from_source_file(environment.source_dir, self.subdir, s))
-            elif hasattr(s, 'get_outputs'):
-                self.link_depends.extend(
-                    [File.from_built_file(s.get_subdir(), p) for p in s.get_outputs()])
-            else:
-                raise InvalidArguments(
-                    'Link_depends arguments must be strings, Files, '
-                    'or a Custom Target, or lists thereof.')
-
-    def get_original_kwargs(self):
-        return self.kwargs
-
-    def unpack_holder(self, d):
-        d = listify(d)
-        newd = []
-        for i in d:
-            if isinstance(i, list):
-                i = self.unpack_holder(i)
-            elif hasattr(i, 'held_object'):
-                i = i.held_object
-            for t in ['dependencies', 'link_with', 'include_directories', 'sources']:
-                if hasattr(i, t):
-                    setattr(i, t, self.unpack_holder(getattr(i, t)))
-            newd.append(i)
-        return newd
-
-    def copy_kwargs(self, kwargs):
-        self.kwargs = copy.copy(kwargs)
-        # This sucks quite badly. Arguments
-        # are holders but they can't be pickled
-        # so unpack those known.
-        for k, v in self.kwargs.items():
-            if isinstance(v, list):
-                self.kwargs[k] = self.unpack_holder(v)
-            if hasattr(v, 'held_object'):
-                self.kwargs[k] = v.held_object
-        for t in ['dependencies', 'link_with', 'include_directories', 'sources']:
-            if t in self.kwargs:
-                self.kwargs[t] = self.unpack_holder(self.kwargs[t])
-
-    def extract_objects(self, srclist):
-        obj_src = []
-        for src in srclist:
-            if isinstance(src, str):
-                src = File(False, self.subdir, src)
-            elif isinstance(src, File):
-                FeatureNew.single_use('File argument for extract_objects', '0.50.0', self.subproject)
-            else:
-                raise MesonException('Object extraction arguments must be strings or Files.')
-            # FIXME: It could be a generated source
-            if src not in self.sources:
-                raise MesonException('Tried to extract unknown source {}.'.format(src))
-            obj_src.append(src)
-        return ExtractedObjects(self, obj_src)
-
-    def extract_all_objects(self, recursive=True):
-        return ExtractedObjects(self, self.sources, self.generated, self.objects,
-                                recursive)
-
-    def get_all_link_deps(self):
-        return self.get_transitive_link_deps()
-
-    @lru_cache(maxsize=None)
-    def get_transitive_link_deps(self):
-        result = []
-        for i in self.link_targets:
-            result += i.get_all_link_deps()
-        return result
-
-    def get_link_deps_mapping(self, prefix, environment):
-        return self.get_transitive_link_deps_mapping(prefix, environment)
-
-    @lru_cache(maxsize=None)
-    def get_transitive_link_deps_mapping(self, prefix, environment):
-        result = {}
-        for i in self.link_targets:
-            mapping = i.get_link_deps_mapping(prefix, environment)
-            #we are merging two dictionaries, while keeping the earlier one dominant
-            result_tmp = mapping.copy()
-            result_tmp.update(result)
-            result = result_tmp
-        return result
-
-    @lru_cache(maxsize=None)
-    def get_link_dep_subdirs(self):
-        result = OrderedSet()
-        for i in self.link_targets:
-            if not isinstance(i, StaticLibrary):
-                result.add(i.get_subdir())
-            result.update(i.get_link_dep_subdirs())
-        return result
-
-    def get_default_install_dir(self, environment):
-        return environment.get_libdir()
-
-    def get_custom_install_dir(self):
-        return self.install_dir
-
-    def get_custom_install_mode(self):
-        return self.install_mode
-
-    def process_kwargs(self, kwargs, environment):
-        self.process_kwargs_base(kwargs)
-        self.copy_kwargs(kwargs)
-        kwargs.get('modules', [])
-        self.need_install = kwargs.get('install', self.need_install)
-        llist = extract_as_list(kwargs, 'link_with')
-        for linktarget in unholder(llist):
-            if isinstance(linktarget, dependencies.ExternalLibrary):
-                raise MesonException('''An external library was used in link_with keyword argument, which
-is reserved for libraries built as part of this project. External
-libraries must be passed using the dependencies keyword argument
-instead, because they are conceptually "external dependencies",
-just like those detected with the dependency() function.''')
-            self.link(linktarget)
-        lwhole = extract_as_list(kwargs, 'link_whole')
-        for linktarget in lwhole:
-            self.link_whole(linktarget)
-
-        c_pchlist, cpp_pchlist, clist, cpplist, cudalist, cslist, valalist,  objclist, objcpplist, fortranlist, rustlist \
-            = [extract_as_list(kwargs, c) for c in ['c_pch', 'cpp_pch', 'c_args', 'cpp_args', 'cuda_args', 'cs_args', 'vala_args', 'objc_args', 'objcpp_args', 'fortran_args', 'rust_args']]
-
-        self.add_pch('c', c_pchlist)
-        self.add_pch('cpp', cpp_pchlist)
-        compiler_args = {'c': clist, 'cpp': cpplist, 'cuda': cudalist, 'cs': cslist, 'vala': valalist, 'objc': objclist, 'objcpp': objcpplist,
-                         'fortran': fortranlist, 'rust': rustlist
-                         }
-        for key, value in compiler_args.items():
-            self.add_compiler_args(key, value)
-
-        if not isinstance(self, Executable) or 'export_dynamic' in kwargs:
-            self.vala_header = kwargs.get('vala_header', self.name + '.h')
-            self.vala_vapi = kwargs.get('vala_vapi', self.name + '.vapi')
-            self.vala_gir = kwargs.get('vala_gir', None)
-
-        dlist = stringlistify(kwargs.get('d_args', []))
-        self.add_compiler_args('d', dlist)
-        dfeatures = dict()
-        dfeature_unittest = kwargs.get('d_unittest', False)
-        if dfeature_unittest:
-            dfeatures['unittest'] = dfeature_unittest
-        dfeature_versions = kwargs.get('d_module_versions', [])
-        if dfeature_versions:
-            dfeatures['versions'] = dfeature_versions
-        dfeature_debug = kwargs.get('d_debug', [])
-        if dfeature_debug:
-            dfeatures['debug'] = dfeature_debug
-        if 'd_import_dirs' in kwargs:
-            dfeature_import_dirs = unholder(extract_as_list(kwargs, 'd_import_dirs'))
-            for d in dfeature_import_dirs:
-                if not isinstance(d, IncludeDirs):
-                    raise InvalidArguments('Arguments to d_import_dirs must be include_directories.')
-            dfeatures['import_dirs'] = dfeature_import_dirs
-        if dfeatures:
-            self.d_features = dfeatures
-
-        self.link_args = extract_as_list(kwargs, 'link_args')
-        for i in self.link_args:
-            if not isinstance(i, str):
-                raise InvalidArguments('Link_args arguments must be strings.')
-        for l in self.link_args:
-            if '-Wl,-rpath' in l or l.startswith('-rpath'):
-                mlog.warning('''Please do not define rpath with a linker argument, use install_rpath or build_rpath properties instead.
-This will become a hard error in a future Meson release.''')
-        self.process_link_depends(kwargs.get('link_depends', []), environment)
-        # Target-specific include dirs must be added BEFORE include dirs from
-        # internal deps (added inside self.add_deps()) to override them.
-        inclist = extract_as_list(kwargs, 'include_directories')
-        self.add_include_dirs(inclist)
-        # Add dependencies (which also have include_directories)
-        deplist = extract_as_list(kwargs, 'dependencies')
-        self.add_deps(deplist)
-        # If an item in this list is False, the output corresponding to
-        # the list index of that item will not be installed
-        self.install_dir = typeslistify(kwargs.get('install_dir', [None]),
-                                        (str, bool))
-        self.install_mode = kwargs.get('install_mode', None)
-        main_class = kwargs.get('main_class', '')
-        if not isinstance(main_class, str):
-            raise InvalidArguments('Main class must be a string')
-        self.main_class = main_class
-        if isinstance(self, Executable):
-            self.gui_app = kwargs.get('gui_app', False)
-            if not isinstance(self.gui_app, bool):
-                raise InvalidArguments('Argument gui_app must be boolean.')
-        elif 'gui_app' in kwargs:
-            raise InvalidArguments('Argument gui_app can only be used on executables.')
-        extra_files = extract_as_list(kwargs, 'extra_files')
-        for i in extra_files:
-            assert(isinstance(i, File))
-            trial = os.path.join(environment.get_source_dir(), i.subdir, i.fname)
-            if not(os.path.isfile(trial)):
-                raise InvalidArguments('Tried to add non-existing extra file {}.'.format(i))
-        self.extra_files = extra_files
-        self.install_rpath = kwargs.get('install_rpath', '')
-        if not isinstance(self.install_rpath, str):
-            raise InvalidArguments('Install_rpath is not a string.')
-        self.build_rpath = kwargs.get('build_rpath', '')
-        if not isinstance(self.build_rpath, str):
-            raise InvalidArguments('Build_rpath is not a string.')
-        resources = extract_as_list(kwargs, 'resources')
-        for r in resources:
-            if not isinstance(r, str):
-                raise InvalidArguments('Resource argument is not a string.')
-            trial = os.path.join(environment.get_source_dir(), self.subdir, r)
-            if not os.path.isfile(trial):
-                raise InvalidArguments('Tried to add non-existing resource {}.'.format(r))
-        self.resources = resources
-        if 'name_prefix' in kwargs:
-            name_prefix = kwargs['name_prefix']
-            if isinstance(name_prefix, list):
-                if name_prefix:
-                    raise InvalidArguments('name_prefix array must be empty to signify default.')
-            else:
-                if not isinstance(name_prefix, str):
-                    raise InvalidArguments('name_prefix must be a string.')
-                self.prefix = name_prefix
-                self.name_prefix_set = True
-        if 'name_suffix' in kwargs:
-            name_suffix = kwargs['name_suffix']
-            if isinstance(name_suffix, list):
-                if name_suffix:
-                    raise InvalidArguments('name_suffix array must be empty to signify default.')
-            else:
-                if not isinstance(name_suffix, str):
-                    raise InvalidArguments('name_suffix must be a string.')
-                if name_suffix == '':
-                    raise InvalidArguments('name_suffix should not be an empty string. '
-                                           'If you want meson to use the default behaviour '
-                                           'for each platform pass `[]` (empty array)')
-                self.suffix = name_suffix
-                self.name_suffix_set = True
-        if isinstance(self, StaticLibrary):
-            # You can't disable PIC on OS X. The compiler ignores -fno-PIC.
-            # PIC is always on for Windows (all code is position-independent
-            # since library loading is done differently)
-            m = self.environment.machines[self.for_machine]
-            if m.is_darwin() or m.is_windows():
-                self.pic = True
-            else:
-                self.pic = self._extract_pic_pie(kwargs, 'pic')
-        if isinstance(self, Executable):
-            # Executables must be PIE on Android
-            if self.environment.machines[self.for_machine].is_android():
-                self.pie = True
-            else:
-                self.pie = self._extract_pic_pie(kwargs, 'pie')
-        self.implicit_include_directories = kwargs.get('implicit_include_directories', True)
-        if not isinstance(self.implicit_include_directories, bool):
-            raise InvalidArguments('Implicit_include_directories must be a boolean.')
-        self.gnu_symbol_visibility = kwargs.get('gnu_symbol_visibility', '')
-        if not isinstance(self.gnu_symbol_visibility, str):
-            raise InvalidArguments('GNU symbol visibility must be a string.')
-        if self.gnu_symbol_visibility != '':
-            permitted = ['default', 'internal', 'hidden', 'protected', 'inlineshidden']
-            if self.gnu_symbol_visibility not in permitted:
-                raise InvalidArguments('GNU symbol visibility arg {} not one of: {}'.format(self.symbol_visibility, ', '.join(permitted)))
-
-    def _extract_pic_pie(self, kwargs, arg):
-        # Check if we have -fPIC, -fpic, -fPIE, or -fpie in cflags
-        all_flags = self.extra_args['c'] + self.extra_args['cpp']
-        if '-f' + arg.lower() in all_flags or '-f' + arg.upper() in all_flags:
-            mlog.warning("Use the '{}' kwarg instead of passing '{}' manually to {!r}".format(arg, '-f' + arg, self.name))
-            return True
-
-        val = kwargs.get(arg, False)
-        if not isinstance(val, bool):
-            raise InvalidArguments('Argument {} to {!r} must be boolean'.format(arg, self.name))
-        return val
-
-    def get_filename(self):
-        return self.filename
-
-    def get_outputs(self):
-        return self.outputs
-
-    def get_extra_args(self, language):
-        return self.extra_args.get(language, [])
-
-    def get_dependencies(self, exclude=None, for_pkgconfig=False):
-        transitive_deps = []
-        if exclude is None:
-            exclude = []
-        for t in itertools.chain(self.link_targets, self.link_whole_targets):
-            if t in transitive_deps or t in exclude:
-                continue
-            # When generating `Libs:` and `Libs.private:` lists in pkg-config
-            # files we don't want to include static libraries that we link_whole
-            # or are uninstalled (they're implicitly promoted to link_whole).
-            # But we still need to include their transitive dependencies,
-            # a static library we link_whole would itself link to a shared
-            # library or an installed static library.
-            if not for_pkgconfig or (not t.is_internal() and t not in self.link_whole_targets):
-                transitive_deps.append(t)
-            if isinstance(t, StaticLibrary):
-                transitive_deps += t.get_dependencies(transitive_deps + exclude, for_pkgconfig)
-        return transitive_deps
-
-    def get_source_subdir(self):
-        return self.subdir
-
-    def get_sources(self):
-        return self.sources
-
-    def get_objects(self):
-        return self.objects
-
-    def get_generated_sources(self):
-        return self.generated
-
-    def should_install(self):
-        return self.need_install
-
-    def has_pch(self):
-        return len(self.pch) > 0
-
-    def get_pch(self, language):
-        try:
-            return self.pch[language]
-        except KeyError:
-            return[]
-
-    def get_include_dirs(self):
-        return self.include_dirs
-
-    def add_deps(self, deps):
-        deps = listify(deps)
-        for dep in unholder(deps):
-            if dep in self.added_deps:
-                continue
-            if isinstance(dep, dependencies.InternalDependency):
-                # Those parts that are internal.
-                self.process_sourcelist(dep.sources)
-                self.add_include_dirs(dep.include_directories, dep.get_include_type())
-                for l in dep.libraries:
-                    self.link(l)
-                for l in dep.whole_libraries:
-                    self.link_whole(l)
-                if dep.get_compile_args() or dep.get_link_args():
-                    # Those parts that are external.
-                    extpart = dependencies.InternalDependency('undefined',
-                                                              [],
-                                                              dep.get_compile_args(),
-                                                              dep.get_link_args(),
-                                                              [], [], [], [], {})
-                    self.external_deps.append(extpart)
-                # Deps of deps.
-                self.add_deps(dep.ext_deps)
-            elif isinstance(dep, dependencies.Dependency):
-                if dep not in self.external_deps:
-                    self.external_deps.append(dep)
-                    self.process_sourcelist(dep.get_sources())
-                self.add_deps(dep.ext_deps)
-            elif isinstance(dep, BuildTarget):
-                raise InvalidArguments('''Tried to use a build target as a dependency.
-You probably should put it in link_with instead.''')
-            else:
-                # This is a bit of a hack. We do not want Build to know anything
-                # about the interpreter so we can't import it and use isinstance.
-                # This should be reliable enough.
-                if hasattr(dep, 'project_args_frozen') or hasattr(dep, 'global_args_frozen'):
-                    raise InvalidArguments('Tried to use subproject object as a dependency.\n'
-                                           'You probably wanted to use a dependency declared in it instead.\n'
-                                           'Access it by calling get_variable() on the subproject object.')
-                raise InvalidArguments('Argument is of an unacceptable type {!r}.\nMust be '
-                                       'either an external dependency (returned by find_library() or '
-                                       'dependency()) or an internal dependency (returned by '
-                                       'declare_dependency()).'.format(type(dep).__name__))
-            self.added_deps.add(dep)
-
-    def get_external_deps(self):
-        return self.external_deps
-
-    def is_internal(self):
-        return isinstance(self, StaticLibrary) and not self.need_install
-
-    def link(self, target):
-        for t in unholder(listify(target)):
-            if isinstance(self, StaticLibrary) and self.need_install and t.is_internal():
-                # When we're a static library and we link_with to an
-                # internal/convenience library, promote to link_whole.
-                return self.link_whole(t)
-            if not isinstance(t, (Target, CustomTargetIndex)):
-                raise InvalidArguments('{!r} is not a target.'.format(t))
-            if not t.is_linkable_target():
-                raise InvalidArguments("Link target '{!s}' is not linkable.".format(t))
-            if isinstance(self, SharedLibrary) and isinstance(t, StaticLibrary) and not t.pic:
-                msg = "Can't link non-PIC static library {!r} into shared library {!r}. ".format(t.name, self.name)
-                msg += "Use the 'pic' option to static_library to build with PIC."
-                raise InvalidArguments(msg)
-            if self.for_machine is not t.for_machine:
-                msg = 'Tried to mix libraries for machines {} and {} in target {!r}'.format(self.for_machine, t.for_machine, self.name)
-                if self.environment.is_cross_build():
-                    raise InvalidArguments(msg + ' This is not possible in a cross build.')
-                else:
-                    mlog.warning(msg + ' This will fail in cross build.')
-            self.link_targets.append(t)
-
-    def link_whole(self, target):
-        for t in unholder(listify(target)):
-            if isinstance(t, (CustomTarget, CustomTargetIndex)):
-                if not t.is_linkable_target():
-                    raise InvalidArguments('Custom target {!r} is not linkable.'.format(t))
-                if not t.get_filename().endswith('.a'):
-                    raise InvalidArguments('Can only link_whole custom targets that are .a archives.')
-                if isinstance(self, StaticLibrary):
-                    # FIXME: We could extract the .a archive to get object files
-                    raise InvalidArguments('Cannot link_whole a custom target into a static library')
-            elif not isinstance(t, StaticLibrary):
-                raise InvalidArguments('{!r} is not a static library.'.format(t))
-            elif isinstance(self, SharedLibrary) and not t.pic:
-                msg = "Can't link non-PIC static library {!r} into shared library {!r}. ".format(t.name, self.name)
-                msg += "Use the 'pic' option to static_library to build with PIC."
-                raise InvalidArguments(msg)
-            if self.for_machine is not t.for_machine:
-                msg = 'Tried to mix libraries for machines {1} and {2} in target {0!r}'.format(self.name, self.for_machine, t.for_machine)
-                if self.environment.is_cross_build():
-                    raise InvalidArguments(msg + ' This is not possible in a cross build.')
-                else:
-                    mlog.warning(msg + ' This will fail in cross build.')
-            if isinstance(self, StaticLibrary):
-                # When we're a static library and we link_whole: to another static
-                # library, we need to add that target's objects to ourselves.
-                self.objects += t.extract_all_objects_recurse()
-            self.link_whole_targets.append(t)
-
-    def extract_all_objects_recurse(self):
-        objs = [self.extract_all_objects()]
-        for t in self.link_targets:
-            if t.is_internal():
-                objs += t.extract_all_objects_recurse()
-        return objs
-
-    def add_pch(self, language, pchlist):
-        if not pchlist:
-            return
-        elif len(pchlist) == 1:
-            if not environment.is_header(pchlist[0]):
-                raise InvalidArguments('PCH argument {} is not a header.'.format(pchlist[0]))
-        elif len(pchlist) == 2:
-            if environment.is_header(pchlist[0]):
-                if not environment.is_source(pchlist[1]):
-                    raise InvalidArguments('PCH definition must contain one header and at most one source.')
-            elif environment.is_source(pchlist[0]):
-                if not environment.is_header(pchlist[1]):
-                    raise InvalidArguments('PCH definition must contain one header and at most one source.')
-                pchlist = [pchlist[1], pchlist[0]]
-            else:
-                raise InvalidArguments('PCH argument {} is of unknown type.'.format(pchlist[0]))
-
-            if (os.path.dirname(pchlist[0]) != os.path.dirname(pchlist[1])):
-                raise InvalidArguments('PCH files must be stored in the same folder.')
-
-            mlog.warning('PCH source files are deprecated, only a single header file should be used.')
-        elif len(pchlist) > 2:
-            raise InvalidArguments('PCH definition may have a maximum of 2 files.')
-        for f in pchlist:
-            if not isinstance(f, str):
-                raise MesonException('PCH arguments must be strings.')
-            if not os.path.isfile(os.path.join(self.environment.source_dir, self.subdir, f)):
-                raise MesonException('File {} does not exist.'.format(f))
-        self.pch[language] = pchlist
-
-    def add_include_dirs(self, args, set_is_system: T.Optional[str] = None):
-        ids = []
-        for a in unholder(args):
-            if not isinstance(a, IncludeDirs):
-                raise InvalidArguments('Include directory to be added is not an include directory object.')
-            ids.append(a)
-        if set_is_system is None:
-            set_is_system = 'preserve'
-        if set_is_system != 'preserve':
-            is_system = set_is_system == 'system'
-            ids = [IncludeDirs(x.get_curdir(), x.get_incdirs(), is_system, x.get_extra_build_dirs()) for x in ids]
-        self.include_dirs += ids
-
-    def add_compiler_args(self, language, args):
-        args = listify(args)
-        for a in args:
-            if not isinstance(a, (str, File)):
-                raise InvalidArguments('A non-string passed to compiler args.')
-        if language in self.extra_args:
-            self.extra_args[language] += args
-        else:
-            self.extra_args[language] = args
-
-    def get_aliases(self):
-        return {}
-
-    def get_langs_used_by_deps(self) -> T.List[str]:
-        '''
-        Sometimes you want to link to a C++ library that exports C API, which
-        means the linker must link in the C++ stdlib, and we must use a C++
-        compiler for linking. The same is also applicable for objc/objc++, etc,
-        so we can keep using clink_langs for the priority order.
-
-        See: https://github.com/mesonbuild/meson/issues/1653
-        '''
-        langs = [] # type: T.List[str]
-
-        # Check if any of the external libraries were written in this language
-        for dep in self.external_deps:
-            if dep.language is None:
-                continue
-            if dep.language not in langs:
-                langs.append(dep.language)
-        # Check if any of the internal libraries this target links to were
-        # written in this language
-        for link_target in itertools.chain(self.link_targets, self.link_whole_targets):
-            if isinstance(link_target, (CustomTarget, CustomTargetIndex)):
-                continue
-            for language in link_target.compilers:
-                if language not in langs:
-                    langs.append(language)
-
-        return langs
-
-    def get_clink_dynamic_linker_and_stdlibs(self):
-        '''
-        We use the order of languages in `clink_langs` to determine which
-        linker to use in case the target has sources compiled with multiple
-        compilers. All languages other than those in this list have their own
-        linker.
-        Note that Vala outputs C code, so Vala sources can use any linker
-        that can link compiled C. We don't actually need to add an exception
-        for Vala here because of that.
-        '''
-        # Populate list of all compilers, not just those being used to compile
-        # sources in this target
-        all_compilers = self.environment.coredata.compilers[self.for_machine]
-
-        # If the user set the link_language, just return that.
-        if self.link_language:
-            comp = all_compilers[self.link_language]
-            return comp, comp.language_stdlib_only_link_flags()
-
-        # Languages used by dependencies
-        dep_langs = self.get_langs_used_by_deps()
-        # Pick a compiler based on the language priority-order
-        for l in clink_langs:
-            if l in self.compilers or l in dep_langs:
-                try:
-                    linker = all_compilers[l]
-                except KeyError:
-                    raise MesonException(
-                        'Could not get a dynamic linker for build target {!r}. '
-                        'Requires a linker for language "{}", but that is not '
-                        'a project language.'.format(self.name, l))
-                stdlib_args = []
-                added_languages = set()
-                for dl in itertools.chain(self.compilers, dep_langs):
-                    if dl != linker.language:
-                        stdlib_args += all_compilers[dl].language_stdlib_only_link_flags()
-                        added_languages.add(dl)
-                # Type of var 'linker' is Compiler.
-                # Pretty hard to fix because the return value is passed everywhere
-                return linker, stdlib_args
-
-        m = 'Could not get a dynamic linker for build target {!r}'
-        raise AssertionError(m.format(self.name))
-
-    def get_using_rustc(self):
-        if len(self.sources) > 0 and self.sources[0].fname.endswith('.rs'):
-            return True
-
-    def get_using_msvc(self):
-        '''
-        Check if the dynamic linker is MSVC. Used by Executable, StaticLibrary,
-        and SharedLibrary for deciding when to use MSVC-specific file naming
-        and debug filenames.
-
-        If at least some code is built with MSVC and the final library is
-        linked with MSVC, we can be sure that some debug info will be
-        generated. We only check the dynamic linker here because the static
-        linker is guaranteed to be of the same type.
-
-        Interesting cases:
-        1. The Vala compiler outputs C code to be compiled by whatever
-           C compiler we're using, so all objects will still be created by the
-           MSVC compiler.
-        2. If the target contains only objects, process_compilers guesses and
-           picks the first compiler that smells right.
-        '''
-        compiler, _ = self.get_clink_dynamic_linker_and_stdlibs()
-        # Mixing many languages with MSVC is not supported yet so ignore stdlibs.
-        if compiler and compiler.get_linker_id() in {'link', 'lld-link', 'xilink', 'optlink'}:
-            return True
-        return False
-
-    def check_module_linking(self):
-        '''
-        Warn if shared modules are linked with target: (link_with) #2865
-        '''
-        for link_target in self.link_targets:
-            if isinstance(link_target, SharedModule):
-                if self.environment.machines[self.for_machine].is_darwin():
-                    raise MesonException('''target links against shared modules.
-This is not permitted on OSX''')
-                else:
-                    mlog.warning('''target links against shared modules. This is not
-recommended as it is not supported on some platforms''')
-                return
-
-class Generator:
-    def __init__(self, args, kwargs):
-        if len(args) != 1:
-            raise InvalidArguments('Generator requires exactly one positional argument: the executable')
-        exe = unholder(args[0])
-        if not isinstance(exe, (Executable, dependencies.ExternalProgram)):
-            raise InvalidArguments('First generator argument must be an executable.')
-        self.exe = exe
-        self.depfile = None
-        self.capture = False
-        self.depends = []
-        self.process_kwargs(kwargs)
-
-    def __repr__(self):
-        repr_str = "<{0}: {1}>"
-        return repr_str.format(self.__class__.__name__, self.exe)
-
-    def get_exe(self):
-        return self.exe
-
-    def process_kwargs(self, kwargs):
-        if 'arguments' not in kwargs:
-            raise InvalidArguments('Generator must have "arguments" keyword argument.')
-        args = kwargs['arguments']
-        if isinstance(args, str):
-            args = [args]
-        if not isinstance(args, list):
-            raise InvalidArguments('"Arguments" keyword argument must be a string or a list of strings.')
-        for a in args:
-            if not isinstance(a, str):
-                raise InvalidArguments('A non-string object in "arguments" keyword argument.')
-        self.arglist = args
-        if 'output' not in kwargs:
-            raise InvalidArguments('Generator must have "output" keyword argument.')
-        outputs = listify(kwargs['output'])
-        for rule in outputs:
-            if not isinstance(rule, str):
-                raise InvalidArguments('"output" may only contain strings.')
-            if '@BASENAME@' not in rule and '@PLAINNAME@' not in rule:
-                raise InvalidArguments('Every element of "output" must contain @BASENAME@ or @PLAINNAME@.')
-            if has_path_sep(rule):
-                raise InvalidArguments('"outputs" must not contain a directory separator.')
-        if len(outputs) > 1:
-            for o in outputs:
-                if '@OUTPUT@' in o:
-                    raise InvalidArguments('Tried to use @OUTPUT@ in a rule with more than one output.')
-        self.outputs = outputs
-        if 'depfile' in kwargs:
-            depfile = kwargs['depfile']
-            if not isinstance(depfile, str):
-                raise InvalidArguments('Depfile must be a string.')
-            if os.path.basename(depfile) != depfile:
-                raise InvalidArguments('Depfile must be a plain filename without a subdirectory.')
-            self.depfile = depfile
-        if 'capture' in kwargs:
-            capture = kwargs['capture']
-            if not isinstance(capture, bool):
-                raise InvalidArguments('Capture must be boolean.')
-            self.capture = capture
-        if 'depends' in kwargs:
-            depends = unholder(listify(kwargs['depends']))
-            for d in depends:
-                if not (isinstance(d, (BuildTarget, CustomTarget))):
-                    raise InvalidArguments('Depends entries must be build targets.')
-                self.depends.append(d)
-
-    def get_base_outnames(self, inname):
-        plainname = os.path.basename(inname)
-        basename = os.path.splitext(plainname)[0]
-        bases = [x.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname) for x in self.outputs]
-        return bases
-
-    def get_dep_outname(self, inname):
-        if self.depfile is None:
-            raise InvalidArguments('Tried to get dep name for rule that does not have dependency file defined.')
-        plainname = os.path.basename(inname)
-        basename = os.path.splitext(plainname)[0]
-        return self.depfile.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname)
-
-    def get_arglist(self, inname):
-        plainname = os.path.basename(inname)
-        basename = os.path.splitext(plainname)[0]
-        return [x.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname) for x in self.arglist]
-
-    def is_parent_path(self, parent, trial):
-        relpath = pathlib.PurePath(trial).relative_to(parent)
-        return relpath.parts[0] != '..' # For subdirs we can only go "down".
-
-    def process_files(self, name, files, state, preserve_path_from=None, extra_args=None):
-        output = GeneratedList(self, state.subdir, preserve_path_from, extra_args=extra_args if extra_args is not None else [])
-        for f in files:
-            if isinstance(f, str):
-                f = File.from_source_file(state.environment.source_dir, state.subdir, f)
-            elif not isinstance(f, File):
-                raise InvalidArguments('{} arguments must be strings or files not {!r}.'.format(name, f))
-            if preserve_path_from:
-                abs_f = f.absolute_path(state.environment.source_dir, state.environment.build_dir)
-                if not self.is_parent_path(preserve_path_from, abs_f):
-                    raise InvalidArguments('When using preserve_path_from, all input files must be in a subdirectory of the given dir.')
-            output.add_file(f, state)
-        return output
-
-
-class GeneratedList:
-    def __init__(self, generator, subdir, preserve_path_from=None, extra_args=None):
-        self.generator = unholder(generator)
-        self.name = self.generator.exe
-        self.subdir = subdir
-        self.infilelist = []
-        self.outfilelist = []
-        self.outmap = {}
-        self.extra_depends = []
-        self.depend_files = []
-        self.preserve_path_from = preserve_path_from
-        self.extra_args = extra_args if extra_args is not None else []
-        if isinstance(self.generator.exe, dependencies.ExternalProgram):
-            if not self.generator.exe.found():
-                raise InvalidArguments('Tried to use not-found external program as generator')
-            path = self.generator.exe.get_path()
-            if os.path.isabs(path):
-                # Can only add a dependency on an external program which we
-                # know the absolute path of
-                self.depend_files.append(File.from_absolute_file(path))
-
-    def add_preserved_path_segment(self, infile, outfiles, state):
-        result = []
-        in_abs = infile.absolute_path(state.environment.source_dir, state.environment.build_dir)
-        assert(os.path.isabs(self.preserve_path_from))
-        rel = os.path.relpath(in_abs, self.preserve_path_from)
-        path_segment = os.path.dirname(rel)
-        for of in outfiles:
-            result.append(os.path.join(path_segment, of))
-        return result
-
-    def add_file(self, newfile, state):
-        self.infilelist.append(newfile)
-        outfiles = self.generator.get_base_outnames(newfile.fname)
-        if self.preserve_path_from:
-            outfiles = self.add_preserved_path_segment(newfile, outfiles, state)
-        self.outfilelist += outfiles
-        self.outmap[newfile] = outfiles
-
-    def get_inputs(self):
-        return self.infilelist
-
-    def get_outputs(self):
-        return self.outfilelist
-
-    def get_outputs_for(self, filename):
-        return self.outmap[filename]
-
-    def get_generator(self):
-        return self.generator
-
-    def get_extra_args(self):
-        return self.extra_args
-
-class Executable(BuildTarget):
-    known_kwargs = known_exe_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        self.typename = 'executable'
-        if 'pie' not in kwargs and 'b_pie' in environment.coredata.base_options:
-            kwargs['pie'] = environment.coredata.base_options['b_pie'].value
-        super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs)
-        # Unless overridden, executables have no suffix or prefix. Except on
-        # Windows and with C#/Mono executables where the suffix is 'exe'
-        if not hasattr(self, 'prefix'):
-            self.prefix = ''
-        if not hasattr(self, 'suffix'):
-            machine = environment.machines[for_machine]
-            # Executable for Windows or C#/Mono
-            if machine.is_windows() or machine.is_cygwin() or 'cs' in self.compilers:
-                self.suffix = 'exe'
-            elif machine.system.startswith('wasm') or machine.system == 'emscripten':
-                self.suffix = 'js'
-            elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('arm') or
-                  'cpp' in self.compilers and self.compilers['cpp'].get_id().startswith('arm')):
-                self.suffix = 'axf'
-            elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('ccrx') or
-                  'cpp' in self.compilers and self.compilers['cpp'].get_id().startswith('ccrx')):
-                self.suffix = 'abs'
-            elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('xc16')):
-                self.suffix = 'elf'
-            elif ('c' in self.compilers and self.compilers['c'].get_id().startswith('c2000') or
-                  'cpp' in self.compilers and self.compilers['cpp'].get_id().startswith('c2000')):
-                self.suffix = 'out'
-            else:
-                self.suffix = environment.machines[for_machine].get_exe_suffix()
-        self.filename = self.name
-        if self.suffix:
-            self.filename += '.' + self.suffix
-        self.outputs = [self.filename]
-
-        # The import library this target will generate
-        self.import_filename = None
-        # The import library that Visual Studio would generate (and accept)
-        self.vs_import_filename = None
-        # The import library that GCC would generate (and prefer)
-        self.gcc_import_filename = None
-        # The debugging information file this target will generate
-        self.debug_filename = None
-
-        # Check for export_dynamic
-        self.export_dynamic = False
-        if kwargs.get('export_dynamic'):
-            if not isinstance(kwargs['export_dynamic'], bool):
-                raise InvalidArguments('"export_dynamic" keyword argument must be a boolean')
-            self.export_dynamic = True
-        if kwargs.get('implib'):
-            self.export_dynamic = True
-        if self.export_dynamic and kwargs.get('implib') is False:
-            raise InvalidArguments('"implib" keyword argument must not be false for if "export_dynamic" is true')
-
-        m = environment.machines[for_machine]
-
-        # If using export_dynamic, set the import library name
-        if self.export_dynamic:
-            implib_basename = self.name + '.exe'
-            if not isinstance(kwargs.get('implib', False), bool):
-                implib_basename = kwargs['implib']
-            if m.is_windows() or m.is_cygwin():
-                self.vs_import_filename = '{0}.lib'.format(implib_basename)
-                self.gcc_import_filename = 'lib{0}.a'.format(implib_basename)
-                if self.get_using_msvc():
-                    self.import_filename = self.vs_import_filename
-                else:
-                    self.import_filename = self.gcc_import_filename
-
-        if m.is_windows() and ('cs' in self.compilers or
-                               self.get_using_rustc() or
-                               self.get_using_msvc()):
-            self.debug_filename = self.name + '.pdb'
-
-        # Only linkwithable if using export_dynamic
-        self.is_linkwithable = self.export_dynamic
-
-    def get_default_install_dir(self, environment):
-        return environment.get_bindir()
-
-    def description(self):
-        '''Human friendly description of the executable'''
-        return self.name
-
-    def type_suffix(self):
-        return "@exe"
-
-    def get_import_filename(self):
-        """
-        The name of the import library that will be outputted by the compiler
-
-        Returns None if there is no import library required for this platform
-        """
-        return self.import_filename
-
-    def get_import_filenameslist(self):
-        if self.import_filename:
-            return [self.vs_import_filename, self.gcc_import_filename]
-        return []
-
-    def get_debug_filename(self):
-        """
-        The name of debuginfo file that will be created by the compiler
-
-        Returns None if the build won't create any debuginfo file
-        """
-        return self.debug_filename
-
-    def is_linkable_target(self):
-        return self.is_linkwithable
-
-class StaticLibrary(BuildTarget):
-    known_kwargs = known_stlib_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        self.typename = 'static library'
-        if 'pic' not in kwargs and 'b_staticpic' in environment.coredata.base_options:
-            kwargs['pic'] = environment.coredata.base_options['b_staticpic'].value
-        super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs)
-        if 'cs' in self.compilers:
-            raise InvalidArguments('Static libraries not supported for C#.')
-        if 'rust' in self.compilers:
-            # If no crate type is specified, or it's the generic lib type, use rlib
-            if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'lib':
-                mlog.debug('Defaulting Rust static library target crate type to rlib')
-                self.rust_crate_type = 'rlib'
-            # Don't let configuration proceed with a non-static crate type
-            elif self.rust_crate_type not in ['rlib', 'staticlib']:
-                raise InvalidArguments('Crate type "{0}" invalid for static libraries; must be "rlib" or "staticlib"'.format(self.rust_crate_type))
-        # By default a static library is named libfoo.a even on Windows because
-        # MSVC does not have a consistent convention for what static libraries
-        # are called. The MSVC CRT uses libfoo.lib syntax but nothing else uses
-        # it and GCC only looks for static libraries called foo.lib and
-        # libfoo.a. However, we cannot use foo.lib because that's the same as
-        # the import library. Using libfoo.a is ok because people using MSVC
-        # always pass the library filename while linking anyway.
-        if not hasattr(self, 'prefix'):
-            self.prefix = 'lib'
-        if not hasattr(self, 'suffix'):
-            if 'rust' in self.compilers:
-                if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'rlib':
-                    # default Rust static library suffix
-                    self.suffix = 'rlib'
-                elif self.rust_crate_type == 'staticlib':
-                    self.suffix = 'a'
-            else:
-                self.suffix = 'a'
-        self.filename = self.prefix + self.name + '.' + self.suffix
-        self.outputs = [self.filename]
-
-    def get_link_deps_mapping(self, prefix, environment):
-        return {}
-
-    def get_default_install_dir(self, environment):
-        return environment.get_static_lib_dir()
-
-    def type_suffix(self):
-        return "@sta"
-
-    def process_kwargs(self, kwargs, environment):
-        super().process_kwargs(kwargs, environment)
-        if 'rust_crate_type' in kwargs:
-            rust_crate_type = kwargs['rust_crate_type']
-            if isinstance(rust_crate_type, str):
-                self.rust_crate_type = rust_crate_type
-            else:
-                raise InvalidArguments('Invalid rust_crate_type "{0}": must be a string.'.format(rust_crate_type))
-
-    def is_linkable_target(self):
-        return True
-
-class SharedLibrary(BuildTarget):
-    known_kwargs = known_shlib_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        self.typename = 'shared library'
-        self.soversion = None
-        self.ltversion = None
-        # Max length 2, first element is compatibility_version, second is current_version
-        self.darwin_versions = []
-        self.vs_module_defs = None
-        # The import library this target will generate
-        self.import_filename = None
-        # The import library that Visual Studio would generate (and accept)
-        self.vs_import_filename = None
-        # The import library that GCC would generate (and prefer)
-        self.gcc_import_filename = None
-        # The debugging information file this target will generate
-        self.debug_filename = None
-        super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs)
-        if 'rust' in self.compilers:
-            # If no crate type is specified, or it's the generic lib type, use dylib
-            if not hasattr(self, 'rust_crate_type') or self.rust_crate_type == 'lib':
-                mlog.debug('Defaulting Rust dynamic library target crate type to "dylib"')
-                self.rust_crate_type = 'dylib'
-            # Don't let configuration proceed with a non-dynamic crate type
-            elif self.rust_crate_type not in ['dylib', 'cdylib']:
-                raise InvalidArguments('Crate type "{0}" invalid for dynamic libraries; must be "dylib" or "cdylib"'.format(self.rust_crate_type))
-        if not hasattr(self, 'prefix'):
-            self.prefix = None
-        if not hasattr(self, 'suffix'):
-            self.suffix = None
-        self.basic_filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        self.determine_filenames(environment)
-
-    def get_link_deps_mapping(self, prefix, environment):
-        result = {}
-        mappings = self.get_transitive_link_deps_mapping(prefix, environment)
-        old = get_target_macos_dylib_install_name(self)
-        if old not in mappings:
-            fname = self.get_filename()
-            outdirs, _ = self.get_install_dir(self.environment)
-            new = os.path.join(prefix, outdirs[0], fname)
-            result.update({old: new})
-        mappings.update(result)
-        return mappings
-
-    def get_default_install_dir(self, environment):
-        return environment.get_shared_lib_dir()
-
-    def determine_filenames(self, env):
-        """
-        See https://github.com/mesonbuild/meson/pull/417 for details.
-
-        First we determine the filename template (self.filename_tpl), then we
-        set the output filename (self.filename).
-
-        The template is needed while creating aliases (self.get_aliases),
-        which are needed while generating .so shared libraries for Linux.
-
-        Besides this, there's also the import library name, which is only used
-        on Windows since on that platform the linker uses a separate library
-        called the "import library" during linking instead of the shared
-        library (DLL). The toolchain will output an import library in one of
-        two formats: GCC or Visual Studio.
-
-        When we're building with Visual Studio, the import library that will be
-        generated by the toolchain is self.vs_import_filename, and with
-        MinGW/GCC, it's self.gcc_import_filename. self.import_filename will
-        always contain the import library name this target will generate.
-        """
-        prefix = ''
-        suffix = ''
-        create_debug_file = False
-        self.filename_tpl = self.basic_filename_tpl
-        # NOTE: manual prefix/suffix override is currently only tested for C/C++
-        # C# and Mono
-        if 'cs' in self.compilers:
-            prefix = ''
-            suffix = 'dll'
-            self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-            create_debug_file = True
-        # C, C++, Swift, Vala
-        # Only Windows uses a separate import library for linking
-        # For all other targets/platforms import_filename stays None
-        elif env.machines[self.for_machine].is_windows():
-            suffix = 'dll'
-            self.vs_import_filename = '{0}{1}.lib'.format(self.prefix if self.prefix is not None else '', self.name)
-            self.gcc_import_filename = '{0}{1}.dll.a'.format(self.prefix if self.prefix is not None else 'lib', self.name)
-            if self.get_using_rustc():
-                # Shared library is of the form foo.dll
-                prefix = ''
-                # Import library is called foo.dll.lib
-                self.import_filename = '{0}.dll.lib'.format(self.name)
-                create_debug_file = True
-            elif self.get_using_msvc():
-                # Shared library is of the form foo.dll
-                prefix = ''
-                # Import library is called foo.lib
-                self.import_filename = self.vs_import_filename
-                create_debug_file = True
-            # Assume GCC-compatible naming
-            else:
-                # Shared library is of the form libfoo.dll
-                prefix = 'lib'
-                # Import library is called libfoo.dll.a
-                self.import_filename = self.gcc_import_filename
-            # Shared library has the soversion if it is defined
-            if self.soversion:
-                self.filename_tpl = '{0.prefix}{0.name}-{0.soversion}.{0.suffix}'
-            else:
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        elif env.machines[self.for_machine].is_cygwin():
-            suffix = 'dll'
-            self.gcc_import_filename = '{0}{1}.dll.a'.format(self.prefix if self.prefix is not None else 'lib', self.name)
-            # Shared library is of the form cygfoo.dll
-            # (ld --dll-search-prefix=cyg is the default)
-            prefix = 'cyg'
-            # Import library is called libfoo.dll.a
-            self.import_filename = self.gcc_import_filename
-            if self.soversion:
-                self.filename_tpl = '{0.prefix}{0.name}-{0.soversion}.{0.suffix}'
-            else:
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        elif env.machines[self.for_machine].is_darwin():
-            prefix = 'lib'
-            suffix = 'dylib'
-            # On macOS, the filename can only contain the major version
-            if self.soversion:
-                # libfoo.X.dylib
-                self.filename_tpl = '{0.prefix}{0.name}.{0.soversion}.{0.suffix}'
-            else:
-                # libfoo.dylib
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        elif env.machines[self.for_machine].is_android():
-            prefix = 'lib'
-            suffix = 'so'
-            # Android doesn't support shared_library versioning
-            self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        else:
-            prefix = 'lib'
-            suffix = 'so'
-            if self.ltversion:
-                # libfoo.so.X[.Y[.Z]] (.Y and .Z are optional)
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}.{0.ltversion}'
-            elif self.soversion:
-                # libfoo.so.X
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}.{0.soversion}'
-            else:
-                # No versioning, libfoo.so
-                self.filename_tpl = '{0.prefix}{0.name}.{0.suffix}'
-        if self.prefix is None:
-            self.prefix = prefix
-        if self.suffix is None:
-            self.suffix = suffix
-        self.filename = self.filename_tpl.format(self)
-        self.outputs = [self.filename]
-        if create_debug_file:
-            self.debug_filename = os.path.splitext(self.filename)[0] + '.pdb'
-
-    @staticmethod
-    def _validate_darwin_versions(darwin_versions):
-        try:
-            if isinstance(darwin_versions, int):
-                darwin_versions = str(darwin_versions)
-            if isinstance(darwin_versions, str):
-                darwin_versions = 2 * [darwin_versions]
-            if not isinstance(darwin_versions, list):
-                raise InvalidArguments('Shared library darwin_versions: must be a string, integer,'
-                                       'or a list, not {!r}'.format(darwin_versions))
-            if len(darwin_versions) > 2:
-                raise InvalidArguments('Shared library darwin_versions: list must contain 2 or fewer elements')
-            if len(darwin_versions) == 1:
-                darwin_versions = 2 * darwin_versions
-            for i, v in enumerate(darwin_versions[:]):
-                if isinstance(v, int):
-                    v = str(v)
-                if not isinstance(v, str):
-                    raise InvalidArguments('Shared library darwin_versions: list elements '
-                                           'must be strings or integers, not {!r}'.format(v))
-                if not re.fullmatch(r'[0-9]+(\.[0-9]+){0,2}', v):
-                    raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z where '
-                                           'X, Y, Z are numbers, and Y and Z are optional')
-                parts = v.split('.')
-                if len(parts) in (1, 2, 3) and int(parts[0]) > 65535:
-                    raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z '
-                                           'where X is [0, 65535] and Y, Z are optional')
-                if len(parts) in (2, 3) and int(parts[1]) > 255:
-                    raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z '
-                                           'where Y is [0, 255] and Y, Z are optional')
-                if len(parts) == 3 and int(parts[2]) > 255:
-                    raise InvalidArguments('Shared library darwin_versions: must be X.Y.Z '
-                                           'where Z is [0, 255] and Y, Z are optional')
-                darwin_versions[i] = v
-        except ValueError:
-            raise InvalidArguments('Shared library darwin_versions: value is invalid')
-        return darwin_versions
-
-    def process_kwargs(self, kwargs, environment):
-        super().process_kwargs(kwargs, environment)
-
-        if not self.environment.machines[self.for_machine].is_android():
-            supports_versioning = True
-        else:
-            supports_versioning = False
-
-        if supports_versioning:
-            # Shared library version
-            if 'version' in kwargs:
-                self.ltversion = kwargs['version']
-                if not isinstance(self.ltversion, str):
-                    raise InvalidArguments('Shared library version needs to be a string, not ' + type(self.ltversion).__name__)
-                if not re.fullmatch(r'[0-9]+(\.[0-9]+){0,2}', self.ltversion):
-                    raise InvalidArguments('Invalid Shared library version "{0}". Must be of the form X.Y.Z where all three are numbers. Y and Z are optional.'.format(self.ltversion))
-            # Try to extract/deduce the soversion
-            if 'soversion' in kwargs:
-                self.soversion = kwargs['soversion']
-                if isinstance(self.soversion, int):
-                    self.soversion = str(self.soversion)
-                if not isinstance(self.soversion, str):
-                    raise InvalidArguments('Shared library soversion is not a string or integer.')
-            elif self.ltversion:
-                # library version is defined, get the soversion from that
-                # We replicate what Autotools does here and take the first
-                # number of the version by default.
-                self.soversion = self.ltversion.split('.')[0]
-            # macOS, iOS and tvOS dylib compatibility_version and current_version
-            if 'darwin_versions' in kwargs:
-                self.darwin_versions = self._validate_darwin_versions(kwargs['darwin_versions'])
-            elif self.soversion:
-                # If unspecified, pick the soversion
-                self.darwin_versions = 2 * [self.soversion]
-
-        # Visual Studio module-definitions file
-        if 'vs_module_defs' in kwargs:
-            path = unholder(kwargs['vs_module_defs'])
-            if isinstance(path, str):
-                if os.path.isabs(path):
-                    self.vs_module_defs = File.from_absolute_file(path)
-                else:
-                    self.vs_module_defs = File.from_source_file(environment.source_dir, self.subdir, path)
-                self.link_depends.append(self.vs_module_defs)
-            elif isinstance(path, File):
-                # When passing a generated file.
-                self.vs_module_defs = path
-                self.link_depends.append(path)
-            elif hasattr(path, 'get_filename'):
-                # When passing output of a Custom Target
-                path = File.from_built_file(path.subdir, path.get_filename())
-                self.vs_module_defs = path
-                self.link_depends.append(path)
-            else:
-                raise InvalidArguments(
-                    'Shared library vs_module_defs must be either a string, '
-                    'a file object or a Custom Target')
-        if 'rust_crate_type' in kwargs:
-            rust_crate_type = kwargs['rust_crate_type']
-            if isinstance(rust_crate_type, str):
-                self.rust_crate_type = rust_crate_type
-            else:
-                raise InvalidArguments('Invalid rust_crate_type "{0}": must be a string.'.format(rust_crate_type))
-
-    def get_import_filename(self):
-        """
-        The name of the import library that will be outputted by the compiler
-
-        Returns None if there is no import library required for this platform
-        """
-        return self.import_filename
-
-    def get_debug_filename(self):
-        """
-        The name of debuginfo file that will be created by the compiler
-
-        Returns None if the build won't create any debuginfo file
-        """
-        return self.debug_filename
-
-    def get_import_filenameslist(self):
-        if self.import_filename:
-            return [self.vs_import_filename, self.gcc_import_filename]
-        return []
-
-    def get_all_link_deps(self):
-        return [self] + self.get_transitive_link_deps()
-
-    def get_aliases(self):
-        """
-        If the versioned library name is libfoo.so.0.100.0, aliases are:
-        * libfoo.so.0 (soversion) -> libfoo.so.0.100.0
-        * libfoo.so (unversioned; for linking) -> libfoo.so.0
-        Same for dylib:
-        * libfoo.dylib (unversioned; for linking) -> libfoo.0.dylib
-        """
-        aliases = {}
-        # Aliases are only useful with .so and .dylib libraries. Also if
-        # there's no self.soversion (no versioning), we don't need aliases.
-        if self.suffix not in ('so', 'dylib') or not self.soversion:
-            return {}
-        # With .so libraries, the minor and micro versions are also in the
-        # filename. If ltversion != soversion we create an soversion alias:
-        # libfoo.so.0 -> libfoo.so.0.100.0
-        # Where libfoo.so.0.100.0 is the actual library
-        if self.suffix == 'so' and self.ltversion and self.ltversion != self.soversion:
-            alias_tpl = self.filename_tpl.replace('ltversion', 'soversion')
-            ltversion_filename = alias_tpl.format(self)
-            aliases[ltversion_filename] = self.filename
-        # libfoo.so.0/libfoo.0.dylib is the actual library
-        else:
-            ltversion_filename = self.filename
-        # Unversioned alias:
-        #  libfoo.so -> libfoo.so.0
-        #  libfoo.dylib -> libfoo.0.dylib
-        aliases[self.basic_filename_tpl.format(self)] = ltversion_filename
-        return aliases
-
-    def type_suffix(self):
-        return "@sha"
-
-    def is_linkable_target(self):
-        return True
-
-# A shared library that is meant to be used with dlopen rather than linking
-# into something else.
-class SharedModule(SharedLibrary):
-    known_kwargs = known_shmod_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        if 'version' in kwargs:
-            raise MesonException('Shared modules must not specify the version kwarg.')
-        if 'soversion' in kwargs:
-            raise MesonException('Shared modules must not specify the soversion kwarg.')
-        super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs)
-        self.typename = 'shared module'
-
-    def get_default_install_dir(self, environment):
-        return environment.get_shared_module_dir()
-
-
-class CustomTarget(Target):
-    known_kwargs = set([
-        'input',
-        'output',
-        'command',
-        'capture',
-        'install',
-        'install_dir',
-        'install_mode',
-        'build_always',
-        'build_always_stale',
-        'depends',
-        'depend_files',
-        'depfile',
-        'build_by_default',
-        'override_options',
-        'console',
-    ])
-
-    def __init__(self, name, subdir, subproject, kwargs, absolute_paths=False, backend=None):
-        self.typename = 'custom'
-        # TODO expose keyword arg to make MachineChoice.HOST configurable
-        super().__init__(name, subdir, subproject, False, MachineChoice.HOST)
-        self.dependencies = []
-        self.extra_depends = []
-        self.depend_files = [] # Files that this target depends on but are not on the command line.
-        self.depfile = None
-        self.process_kwargs(kwargs, backend)
-        self.extra_files = []
-        # Whether to use absolute paths for all files on the commandline
-        self.absolute_paths = absolute_paths
-        unknowns = []
-        for k in kwargs:
-            if k not in CustomTarget.known_kwargs:
-                unknowns.append(k)
-        if len(unknowns) > 0:
-            mlog.warning('Unknown keyword arguments in target {}: {}'.format(self.name, ', '.join(unknowns)))
-
-    def get_default_install_dir(self, environment):
-        return None
-
-    def __repr__(self):
-        repr_str = "<{0} {1}: {2}>"
-        return repr_str.format(self.__class__.__name__, self.get_id(), self.command)
-
-    def get_target_dependencies(self):
-        deps = self.dependencies[:]
-        deps += self.extra_depends
-        for c in unholder(self.sources):
-            if isinstance(c, (BuildTarget, CustomTarget)):
-                deps.append(c)
-        return deps
-
-    def get_transitive_build_target_deps(self):
-        '''
-        Recursively fetch the build targets that this custom target depends on,
-        whether through `command:`, `depends:`, or `sources:` The recursion is
-        only performed on custom targets.
-        This is useful for setting PATH on Windows for finding required DLLs.
-        F.ex, if you have a python script that loads a C module that links to
-        other DLLs in your project.
-        '''
-        bdeps = set()
-        deps = self.get_target_dependencies()
-        for d in deps:
-            if isinstance(d, BuildTarget):
-                bdeps.add(d)
-            elif isinstance(d, CustomTarget):
-                bdeps.update(d.get_transitive_build_target_deps())
-        return bdeps
-
-    def flatten_command(self, cmd):
-        cmd = unholder(listify(cmd))
-        final_cmd = []
-        for c in cmd:
-            if isinstance(c, str):
-                final_cmd.append(c)
-            elif isinstance(c, File):
-                self.depend_files.append(c)
-                final_cmd.append(c)
-            elif isinstance(c, dependencies.ExternalProgram):
-                if not c.found():
-                    raise InvalidArguments('Tried to use not-found external program in "command"')
-                path = c.get_path()
-                if os.path.isabs(path):
-                    # Can only add a dependency on an external program which we
-                    # know the absolute path of
-                    self.depend_files.append(File.from_absolute_file(path))
-                final_cmd += c.get_command()
-            elif isinstance(c, (BuildTarget, CustomTarget)):
-                self.dependencies.append(c)
-                final_cmd.append(c)
-            elif isinstance(c, list):
-                final_cmd += self.flatten_command(c)
-            else:
-                raise InvalidArguments('Argument {!r} in "command" is invalid'.format(c))
-        return final_cmd
-
-    def process_kwargs(self, kwargs, backend):
-        self.process_kwargs_base(kwargs)
-        self.sources = unholder(extract_as_list(kwargs, 'input'))
-        if 'output' not in kwargs:
-            raise InvalidArguments('Missing keyword argument "output".')
-        self.outputs = listify(kwargs['output'])
-        # This will substitute values from the input into output and return it.
-        inputs = get_sources_string_names(self.sources, backend)
-        values = get_filenames_templates_dict(inputs, [])
-        for i in self.outputs:
-            if not(isinstance(i, str)):
-                raise InvalidArguments('Output argument not a string.')
-            if i == '':
-                raise InvalidArguments('Output must not be empty.')
-            if i.strip() == '':
-                raise InvalidArguments('Output must not consist only of whitespace.')
-            if has_path_sep(i):
-                raise InvalidArguments('Output {!r} must not contain a path segment.'.format(i))
-            if '@INPUT@' in i or '@INPUT0@' in i:
-                m = 'Output cannot contain @INPUT@ or @INPUT0@, did you ' \
-                    'mean @PLAINNAME@ or @BASENAME@?'
-                raise InvalidArguments(m)
-            # We already check this during substitution, but the error message
-            # will be unclear/confusing, so check it here.
-            if len(inputs) != 1 and ('@PLAINNAME@' in i or '@BASENAME@' in i):
-                m = "Output cannot contain @PLAINNAME@ or @BASENAME@ when " \
-                    "there is more than one input (we can't know which to use)"
-                raise InvalidArguments(m)
-        self.outputs = substitute_values(self.outputs, values)
-        self.capture = kwargs.get('capture', False)
-        if self.capture and len(self.outputs) != 1:
-            raise InvalidArguments('Capturing can only output to a single file.')
-        self.console = kwargs.get('console', False)
-        if not isinstance(self.console, bool):
-            raise InvalidArguments('"console" kwarg only accepts booleans')
-        if self.capture and self.console:
-            raise InvalidArguments("Can't both capture output and output to console")
-        if 'command' not in kwargs:
-            raise InvalidArguments('Missing keyword argument "command".')
-        if 'depfile' in kwargs:
-            depfile = kwargs['depfile']
-            if not isinstance(depfile, str):
-                raise InvalidArguments('Depfile must be a string.')
-            if os.path.basename(depfile) != depfile:
-                raise InvalidArguments('Depfile must be a plain filename without a subdirectory.')
-            self.depfile = depfile
-        self.command = self.flatten_command(kwargs['command'])
-        if self.capture:
-            for c in self.command:
-                if isinstance(c, str) and '@OUTPUT@' in c:
-                    raise InvalidArguments('@OUTPUT@ is not allowed when capturing output.')
-        if 'install' in kwargs:
-            self.install = kwargs['install']
-            if not isinstance(self.install, bool):
-                raise InvalidArguments('"install" must be boolean.')
-            if self.install:
-                if 'install_dir' not in kwargs:
-                    raise InvalidArguments('"install_dir" must be specified '
-                                           'when installing a target')
-
-                if isinstance(kwargs['install_dir'], list):
-                    FeatureNew.single_use('multiple install_dir for custom_target', '0.40.0', self.subproject)
-                # If an item in this list is False, the output corresponding to
-                # the list index of that item will not be installed
-                self.install_dir = typeslistify(kwargs['install_dir'], (str, bool))
-                self.install_mode = kwargs.get('install_mode', None)
-        else:
-            self.install = False
-            self.install_dir = [None]
-            self.install_mode = None
-        if 'build_always' in kwargs and 'build_always_stale' in kwargs:
-            raise InvalidArguments('build_always and build_always_stale are mutually exclusive. Combine build_by_default and build_always_stale.')
-        elif 'build_always' in kwargs:
-            if 'build_by_default' not in kwargs:
-                self.build_by_default = kwargs['build_always']
-            self.build_always_stale = kwargs['build_always']
-        elif 'build_always_stale' in kwargs:
-            self.build_always_stale = kwargs['build_always_stale']
-        if not isinstance(self.build_always_stale, bool):
-            raise InvalidArguments('Argument build_always_stale must be a boolean.')
-        extra_deps, depend_files = [extract_as_list(kwargs, c, pop=False) for c in ['depends', 'depend_files']]
-        for ed in unholder(extra_deps):
-            if not isinstance(ed, (CustomTarget, BuildTarget)):
-                raise InvalidArguments('Can only depend on toplevel targets: custom_target or build_target (executable or a library) got: {}({})'
-                                      .format(type(ed), ed))
-            self.extra_depends.append(ed)
-        for i in depend_files:
-            if isinstance(i, (File, str)):
-                self.depend_files.append(i)
-            else:
-                mlog.debug(i)
-                raise InvalidArguments('Unknown type {!r} in depend_files.'.format(type(i).__name__))
-
-    def get_dependencies(self):
-        return self.dependencies
-
-    def should_install(self):
-        return self.install
-
-    def get_custom_install_dir(self):
-        return self.install_dir
-
-    def get_custom_install_mode(self):
-        return self.install_mode
-
-    def get_outputs(self):
-        return self.outputs
-
-    def get_filename(self):
-        return self.outputs[0]
-
-    def get_sources(self):
-        return self.sources
-
-    def get_generated_lists(self):
-        genlists = []
-        for c in unholder(self.sources):
-            if isinstance(c, GeneratedList):
-                genlists.append(c)
-        return genlists
-
-    def get_generated_sources(self):
-        return self.get_generated_lists()
-
-    def get_dep_outname(self, infilenames):
-        if self.depfile is None:
-            raise InvalidArguments('Tried to get depfile name for custom_target that does not have depfile defined.')
-        if len(infilenames):
-            plainname = os.path.basename(infilenames[0])
-            basename = os.path.splitext(plainname)[0]
-            return self.depfile.replace('@BASENAME@', basename).replace('@PLAINNAME@', plainname)
-        else:
-            if '@BASENAME@' in self.depfile or '@PLAINNAME@' in self.depfile:
-                raise InvalidArguments('Substitution in depfile for custom_target that does not have an input file.')
-            return self.depfile
-
-    def is_linkable_target(self):
-        if len(self.outputs) != 1:
-            return False
-        suf = os.path.splitext(self.outputs[0])[-1]
-        if suf == '.a' or suf == '.dll' or suf == '.lib' or suf == '.so':
-            return True
-
-    def get_link_deps_mapping(self, prefix, environment):
-        return {}
-
-    def get_link_dep_subdirs(self):
-        return OrderedSet()
-
-    def get_all_link_deps(self):
-        return []
-
-    def type_suffix(self):
-        return "@cus"
-
-    def __getitem__(self, index):
-        return CustomTargetIndex(self, self.outputs[index])
-
-    def __setitem__(self, index, value):
-        raise NotImplementedError
-
-    def __delitem__(self, index):
-        raise NotImplementedError
-
-    def __iter__(self):
-        for i in self.outputs:
-            yield CustomTargetIndex(self, i)
-
-class RunTarget(Target):
-    def __init__(self, name, command, args, dependencies, subdir, subproject):
-        self.typename = 'run'
-        # These don't produce output artifacts
-        super().__init__(name, subdir, subproject, False, MachineChoice.BUILD)
-        self.command = command
-        self.args = args
-        self.dependencies = dependencies
-
-    def __repr__(self):
-        repr_str = "<{0} {1}: {2}>"
-        return repr_str.format(self.__class__.__name__, self.get_id(), self.command)
-
-    def process_kwargs(self, kwargs):
-        return self.process_kwargs_base(kwargs)
-
-    def get_dependencies(self):
-        return self.dependencies
-
-    def get_generated_sources(self):
-        return []
-
-    def get_sources(self):
-        return []
-
-    def should_install(self):
-        return False
-
-    def get_filename(self):
-        return self.name
-
-    def get_outputs(self):
-        if isinstance(self.name, str):
-            return [self.name]
-        elif isinstance(self.name, list):
-            return self.name
-        else:
-            raise RuntimeError('RunTarget: self.name is neither a list nor a string. This is a bug')
-
-    def type_suffix(self):
-        return "@run"
-
-class AliasTarget(RunTarget):
-    def __init__(self, name, dependencies, subdir, subproject):
-        super().__init__(name, '', [], dependencies, subdir, subproject)
-
-class Jar(BuildTarget):
-    known_kwargs = known_jar_kwargs
-
-    def __init__(self, name, subdir, subproject, for_machine: MachineChoice, sources, objects, environment, kwargs):
-        self.typename = 'jar'
-        super().__init__(name, subdir, subproject, for_machine, sources, objects, environment, kwargs)
-        for s in self.sources:
-            if not s.endswith('.java'):
-                raise InvalidArguments('Jar source {} is not a java file.'.format(s))
-        for t in self.link_targets:
-            if not isinstance(t, Jar):
-                raise InvalidArguments('Link target {} is not a jar target.'.format(t))
-        self.filename = self.name + '.jar'
-        self.outputs = [self.filename]
-        self.java_args = kwargs.get('java_args', [])
-
-    def get_main_class(self):
-        return self.main_class
-
-    def type_suffix(self):
-        return "@jar"
-
-    def get_java_args(self):
-        return self.java_args
-
-    def validate_install(self, environment):
-        # All jar targets are installable.
-        pass
-
-    def is_linkable_target(self):
-        return True
-
-    def get_classpath_args(self):
-        cp_paths = [os.path.join(l.get_subdir(), l.get_filename()) for l in self.link_targets]
-        cp_string = os.pathsep.join(cp_paths)
-        if cp_string:
-            return ['-cp', os.pathsep.join(cp_paths)]
-        return []
-
-class CustomTargetIndex:
-
-    """A special opaque object returned by indexing a CustomTarget. This object
-    exists in meson, but acts as a proxy in the backends, making targets depend
-    on the CustomTarget it's derived from, but only adding one source file to
-    the sources.
-    """
-
-    def __init__(self, target, output):
-        self.typename = 'custom'
-        self.target = target
-        self.output = output
-        self.for_machine = target.for_machine
-
-    def __repr__(self):
-        return '<CustomTargetIndex: {!r}[{}]>'.format(
-            self.target, self.target.get_outputs().index(self.output))
-
-    def get_outputs(self):
-        return [self.output]
-
-    def get_subdir(self):
-        return self.target.get_subdir()
-
-    def get_filename(self):
-        return self.output
-
-    def get_id(self):
-        return self.target.get_id()
-
-    def get_all_link_deps(self):
-        return self.target.get_all_link_deps()
-
-    def get_link_deps_mapping(self, prefix, environment):
-        return self.target.get_link_deps_mapping(prefix, environment)
-
-    def get_link_dep_subdirs(self):
-        return self.target.get_link_dep_subdirs()
-
-    def is_linkable_target(self):
-        suf = os.path.splitext(self.output)[-1]
-        if suf == '.a' or suf == '.dll' or suf == '.lib' or suf == '.so':
-            return True
-
-class ConfigureFile:
-
-    def __init__(self, subdir, sourcename, targetname, configuration_data):
-        self.subdir = subdir
-        self.sourcename = sourcename
-        self.targetname = targetname
-        self.configuration_data = configuration_data
-
-    def __repr__(self):
-        repr_str = "<{0}: {1} -> {2}>"
-        src = os.path.join(self.subdir, self.sourcename)
-        dst = os.path.join(self.subdir, self.targetname)
-        return repr_str.format(self.__class__.__name__, src, dst)
-
-    def get_configuration_data(self):
-        return self.configuration_data
-
-    def get_subdir(self):
-        return self.subdir
-
-    def get_source_name(self):
-        return self.sourcename
-
-    def get_target_name(self):
-        return self.targetname
-
-class ConfigurationData:
-    def __init__(self) -> None:
-        super().__init__()
-        self.values = {}  # T.Dict[str, T.Union[str, int, bool]]
-
-    def __repr__(self):
-        return repr(self.values)
-
-    def __contains__(self, value: str) -> bool:
-        return value in self.values
-
-    def get(self, name: str) -> T.Tuple[T.Union[str, int, bool], T.Optional[str]]:
-        return self.values[name] # (val, desc)
-
-    def keys(self) -> T.Iterator[str]:
-        return self.values.keys()
-
-# A bit poorly named, but this represents plain data files to copy
-# during install.
-class Data:
-    def __init__(self, sources, install_dir, install_mode=None, rename=None):
-        self.sources = sources
-        self.install_dir = install_dir
-        self.install_mode = install_mode
-        self.sources = listify(self.sources)
-        for s in self.sources:
-            assert(isinstance(s, File))
-        if rename is None:
-            self.rename = [os.path.basename(f.fname) for f in self.sources]
-        else:
-            self.rename = stringlistify(rename)
-            if len(self.rename) != len(self.sources):
-                raise MesonException('Size of rename argument is different from number of sources')
-
-class RunScript(dict):
-    def __init__(self, script, args):
-        super().__init__()
-        assert(isinstance(script, list))
-        assert(isinstance(args, list))
-        self['exe'] = script
-        self['args'] = args
-
-class TestSetup:
-    def __init__(self, exe_wrapper: T.Optional[T.List[str]], gdb: bool,
-                 timeout_multiplier: int, env: EnvironmentVariables):
-        self.exe_wrapper = exe_wrapper
-        self.gdb = gdb
-        self.timeout_multiplier = timeout_multiplier
-        self.env = env
-
-def get_sources_string_names(sources, backend):
-    '''
-    For the specified list of @sources which can be strings, Files, or targets,
-    get all the output basenames.
-    '''
-    names = []
-    for s in unholder(sources):
-        if isinstance(s, str):
-            names.append(s)
-        elif isinstance(s, (BuildTarget, CustomTarget, CustomTargetIndex, GeneratedList)):
-            names += s.get_outputs()
-        elif isinstance(s, ExtractedObjects):
-            names += s.get_outputs(backend)
-        elif isinstance(s, File):
-            names.append(s.fname)
-        else:
-            raise AssertionError('Unknown source type: {!r}'.format(s))
-    return names
-
-def load(build_dir: str) -> Build:
-    filename = os.path.join(build_dir, 'meson-private', 'build.dat')
-    load_fail_msg = 'Build data file {!r} is corrupted. Try with a fresh build tree.'.format(filename)
-    nonexisting_fail_msg = 'No such build data file as "{!r}".'.format(filename)
-    try:
-        with open(filename, 'rb') as f:
-            obj = pickle.load(f)
-    except FileNotFoundError:
-        raise MesonException(nonexisting_fail_msg)
-    except (pickle.UnpicklingError, EOFError):
-        raise MesonException(load_fail_msg)
-    except AttributeError:
-        raise MesonException(
-            "Build data file {!r} references functions or classes that don't "
-            "exist. This probably means that it was generated with an old "
-            "version of meson. Try running from the source directory "
-            "meson {} --wipe".format(filename, build_dir))
-    if not isinstance(obj, Build):
-        raise MesonException(load_fail_msg)
-    return obj
-
-def save(obj, filename):
-    with open(filename, 'wb') as f:
-        pickle.dump(obj, f)
diff --git a/meson/mesonbuild/cmake/__init__.py b/meson/mesonbuild/cmake/__init__.py
deleted file mode 100644 (file)
index db7aefd..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-__all__ = [
-    'CMakeClient',
-    'CMakeExecutor',
-    'CMakeException',
-    'CMakeFileAPI',
-    'CMakeInterpreter',
-    'CMakeTarget',
-    'CMakeTraceLine',
-    'CMakeTraceParser',
-    'SingleTargetOptions',
-    'TargetOptions',
-    'parse_generator_expressions',
-    'language_map',
-    'cmake_defines_to_args',
-]
-
-from .common import CMakeException, SingleTargetOptions, TargetOptions, cmake_defines_to_args
-from .client import CMakeClient
-from .executor import CMakeExecutor
-from .fileapi import CMakeFileAPI
-from .generator import parse_generator_expressions
-from .interpreter import CMakeInterpreter, language_map
-from .traceparser import CMakeTarget, CMakeTraceLine, CMakeTraceParser
diff --git a/meson/mesonbuild/cmake/client.py b/meson/mesonbuild/cmake/client.py
deleted file mode 100644 (file)
index b88a673..0000000
+++ /dev/null
@@ -1,369 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from .common import CMakeException, CMakeConfiguration, CMakeBuildFile
-from .executor import CMakeExecutor
-from ..environment import Environment
-from ..mesonlib import MachineChoice
-from .. import mlog
-from contextlib import contextmanager
-from subprocess import Popen, PIPE, TimeoutExpired
-import typing as T
-import json
-import os
-
-CMAKE_SERVER_BEGIN_STR = '[== "CMake Server" ==['
-CMAKE_SERVER_END_STR = ']== "CMake Server" ==]'
-
-CMAKE_MESSAGE_TYPES = {
-    'error': ['cookie', 'errorMessage'],
-    'hello': ['supportedProtocolVersions'],
-    'message': ['cookie', 'message'],
-    'progress': ['cookie'],
-    'reply': ['cookie', 'inReplyTo'],
-    'signal': ['cookie', 'name'],
-}
-
-CMAKE_REPLY_TYPES = {
-    'handshake': [],
-    'configure': [],
-    'compute': [],
-    'cmakeInputs': ['buildFiles', 'cmakeRootDirectory', 'sourceDirectory'],
-    'codemodel': ['configurations']
-}
-
-# Base CMake server message classes
-
-class MessageBase:
-    def __init__(self, msg_type: str, cookie: str):
-        self.type = msg_type
-        self.cookie = cookie
-
-    def to_dict(self) -> dict:
-        return {'type': self.type, 'cookie': self.cookie}
-
-    def log(self) -> None:
-        mlog.warning('CMake server message of type', mlog.bold(type(self).__name__), 'has no log function')
-
-class RequestBase(MessageBase):
-    cookie_counter = 0
-
-    def __init__(self, msg_type: str):
-        super().__init__(msg_type, self.gen_cookie())
-
-    @staticmethod
-    def gen_cookie():
-        RequestBase.cookie_counter += 1
-        return 'meson_{}'.format(RequestBase.cookie_counter)
-
-class ReplyBase(MessageBase):
-    def __init__(self, cookie: str, in_reply_to: str):
-        super().__init__('reply', cookie)
-        self.in_reply_to = in_reply_to
-
-class SignalBase(MessageBase):
-    def __init__(self, cookie: str, signal_name: str):
-        super().__init__('signal', cookie)
-        self.signal_name = signal_name
-
-    def log(self) -> None:
-        mlog.log(mlog.bold('CMake signal:'), mlog.yellow(self.signal_name))
-
-# Special Message classes
-
-class Error(MessageBase):
-    def __init__(self, cookie: str, message: str):
-        super().__init__('error', cookie)
-        self.message = message
-
-    def log(self) -> None:
-        mlog.error(mlog.bold('CMake server error:'), mlog.red(self.message))
-
-class Message(MessageBase):
-    def __init__(self, cookie: str, message: str):
-        super().__init__('message', cookie)
-        self.message = message
-
-    def log(self) -> None:
-        #mlog.log(mlog.bold('CMake:'), self.message)
-        pass
-
-class Progress(MessageBase):
-    def __init__(self, cookie: str):
-        super().__init__('progress', cookie)
-
-    def log(self) -> None:
-        pass
-
-class MessageHello(MessageBase):
-    def __init__(self, supported_protocol_versions: T.List[dict]):
-        super().__init__('hello', '')
-        self.supported_protocol_versions = supported_protocol_versions
-
-    def supports(self, major: int, minor: T.Optional[int] = None) -> bool:
-        for i in self.supported_protocol_versions:
-            if major == i['major']:
-                if minor is None or minor == i['minor']:
-                    return True
-        return False
-
-# Request classes
-
-class RequestHandShake(RequestBase):
-    def __init__(self, src_dir: str, build_dir: str, generator: str, vers_major: int, vers_minor: T.Optional[int] = None):
-        super().__init__('handshake')
-        self.src_dir = src_dir
-        self.build_dir = build_dir
-        self.generator = generator
-        self.vers_major = vers_major
-        self.vers_minor = vers_minor
-
-    def to_dict(self) -> dict:
-        vers = {'major': self.vers_major}
-        if self.vers_minor is not None:
-            vers['minor'] = self.vers_minor
-
-        # Old CMake versions (3.7) want '/' even on Windows
-        src_list = os.path.normpath(self.src_dir).split(os.sep)
-        bld_list = os.path.normpath(self.build_dir).split(os.sep)
-
-        return {
-            **super().to_dict(),
-            'sourceDirectory': '/'.join(src_list),
-            'buildDirectory': '/'.join(bld_list),
-            'generator': self.generator,
-            'protocolVersion': vers
-        }
-
-class RequestConfigure(RequestBase):
-    def __init__(self, args: T.Optional[T.List[str]] = None):
-        super().__init__('configure')
-        self.args = args
-
-    def to_dict(self) -> dict:
-        res = super().to_dict()
-        if self.args:
-            res['cacheArguments'] = self.args
-        return res
-
-class RequestCompute(RequestBase):
-    def __init__(self):
-        super().__init__('compute')
-
-class RequestCMakeInputs(RequestBase):
-    def __init__(self):
-        super().__init__('cmakeInputs')
-
-class RequestCodeModel(RequestBase):
-    def __init__(self):
-        super().__init__('codemodel')
-
-# Reply classes
-
-class ReplyHandShake(ReplyBase):
-    def __init__(self, cookie: str):
-        super().__init__(cookie, 'handshake')
-
-class ReplyConfigure(ReplyBase):
-    def __init__(self, cookie: str):
-        super().__init__(cookie, 'configure')
-
-class ReplyCompute(ReplyBase):
-    def __init__(self, cookie: str):
-        super().__init__(cookie, 'compute')
-
-class ReplyCMakeInputs(ReplyBase):
-    def __init__(self, cookie: str, cmake_root: str, src_dir: str, build_files: T.List[CMakeBuildFile]):
-        super().__init__(cookie, 'cmakeInputs')
-        self.cmake_root = cmake_root
-        self.src_dir = src_dir
-        self.build_files = build_files
-
-    def log(self) -> None:
-        mlog.log('CMake root: ', mlog.bold(self.cmake_root))
-        mlog.log('Source dir: ', mlog.bold(self.src_dir))
-        mlog.log('Build files:', mlog.bold(str(len(self.build_files))))
-        with mlog.nested():
-            for i in self.build_files:
-                mlog.log(str(i))
-
-class ReplyCodeModel(ReplyBase):
-    def __init__(self, data: dict):
-        super().__init__(data['cookie'], 'codemodel')
-        self.configs = []
-        for i in data['configurations']:
-            self.configs += [CMakeConfiguration(i)]
-
-    def log(self) -> None:
-        mlog.log('CMake code mode:')
-        for idx, i in enumerate(self.configs):
-            mlog.log('Configuration {}:'.format(idx))
-            with mlog.nested():
-                i.log()
-
-# Main client class
-
-class CMakeClient:
-    def __init__(self, env: Environment):
-        self.env = env
-        self.proc = None
-        self.type_map = {
-            'error': lambda data: Error(data['cookie'], data['errorMessage']),
-            'hello': lambda data: MessageHello(data['supportedProtocolVersions']),
-            'message': lambda data: Message(data['cookie'], data['message']),
-            'progress': lambda data: Progress(data['cookie']),
-            'reply': self.resolve_type_reply,
-            'signal': lambda data: SignalBase(data['cookie'], data['name'])
-        }
-
-        self.reply_map = {
-            'handshake': lambda data: ReplyHandShake(data['cookie']),
-            'configure': lambda data: ReplyConfigure(data['cookie']),
-            'compute': lambda data: ReplyCompute(data['cookie']),
-            'cmakeInputs': self.resolve_reply_cmakeInputs,
-            'codemodel': lambda data: ReplyCodeModel(data),
-        }
-
-    def readMessageRaw(self) -> dict:
-        assert(self.proc is not None)
-        rawData = []
-        begin = False
-        while self.proc.poll() is None:
-            line = self.proc.stdout.readline()
-            if not line:
-                break
-            line = line.decode('utf-8')
-            line = line.strip()
-
-            if begin and line == CMAKE_SERVER_END_STR:
-                break # End of the message
-            elif begin:
-                rawData += [line]
-            elif line == CMAKE_SERVER_BEGIN_STR:
-                begin = True # Begin of the message
-
-        if rawData:
-            return json.loads('\n'.join(rawData))
-        raise CMakeException('Failed to read data from the CMake server')
-
-    def readMessage(self) -> MessageBase:
-        raw_data = self.readMessageRaw()
-        if 'type' not in raw_data:
-            raise CMakeException('The "type" attribute is missing from the message')
-        msg_type = raw_data['type']
-        func = self.type_map.get(msg_type, None)
-        if not func:
-            raise CMakeException('Recieved unknown message type "{}"'.format(msg_type))
-        for i in CMAKE_MESSAGE_TYPES[msg_type]:
-            if i not in raw_data:
-                raise CMakeException('Key "{}" is missing from CMake server message type {}'.format(i, msg_type))
-        return func(raw_data)
-
-    def writeMessage(self, msg: MessageBase) -> None:
-        raw_data = '\n{}\n{}\n{}\n'.format(CMAKE_SERVER_BEGIN_STR, json.dumps(msg.to_dict(), indent=2), CMAKE_SERVER_END_STR)
-        self.proc.stdin.write(raw_data.encode('ascii'))
-        self.proc.stdin.flush()
-
-    def query(self, request: RequestBase) -> MessageBase:
-        self.writeMessage(request)
-        while True:
-            reply = self.readMessage()
-            if reply.cookie == request.cookie and reply.type in ['reply', 'error']:
-                return reply
-
-            reply.log()
-
-    def query_checked(self, request: RequestBase, message: str) -> ReplyBase:
-        reply = self.query(request)
-        h = mlog.green('SUCCEEDED') if reply.type == 'reply' else mlog.red('FAILED')
-        mlog.log(message + ':', h)
-        if reply.type != 'reply':
-            reply.log()
-            raise CMakeException('CMake server query failed')
-        return reply
-
-    def do_handshake(self, src_dir: str, build_dir: str, generator: str, vers_major: int, vers_minor: T.Optional[int] = None) -> None:
-        # CMake prints the hello message on startup
-        msg = self.readMessage()
-        if not isinstance(msg, MessageHello):
-            raise CMakeException('Recieved an unexpected message from the CMake server')
-
-        request = RequestHandShake(src_dir, build_dir, generator, vers_major, vers_minor)
-        self.query_checked(request, 'CMake server handshake')
-
-    def resolve_type_reply(self, data: dict) -> ReplyBase:
-        reply_type = data['inReplyTo']
-        func = self.reply_map.get(reply_type, None)
-        if not func:
-            raise CMakeException('Recieved unknown reply type "{}"'.format(reply_type))
-        for i in ['cookie'] + CMAKE_REPLY_TYPES[reply_type]:
-            if i not in data:
-                raise CMakeException('Key "{}" is missing from CMake server message type {}'.format(i, type))
-        return func(data)
-
-    def resolve_reply_cmakeInputs(self, data: dict) -> ReplyCMakeInputs:
-        files = []
-        for i in data['buildFiles']:
-            for j in i['sources']:
-                files += [CMakeBuildFile(j, i['isCMake'], i['isTemporary'])]
-        return ReplyCMakeInputs(data['cookie'], data['cmakeRootDirectory'], data['sourceDirectory'], files)
-
-    @contextmanager
-    def connect(self):
-        self.startup()
-        try:
-            yield
-        finally:
-            self.shutdown()
-
-    def startup(self) -> None:
-        if self.proc is not None:
-            raise CMakeException('The CMake server was already started')
-        for_machine = MachineChoice.HOST # TODO make parameter
-        cmake_exe = CMakeExecutor(self.env, '>=3.7', for_machine)
-        if not cmake_exe.found():
-            raise CMakeException('Unable to find CMake')
-
-        mlog.debug('Starting CMake server with CMake', mlog.bold(' '.join(cmake_exe.get_command())), 'version', mlog.cyan(cmake_exe.version()))
-        self.proc = Popen(cmake_exe.get_command() + ['-E', 'server', '--experimental', '--debug'], stdin=PIPE, stdout=PIPE)
-
-    def shutdown(self) -> None:
-        if self.proc is None:
-            return
-
-        mlog.debug('Shutting down the CMake server')
-
-        # Close the pipes to exit
-        self.proc.stdin.close()
-        self.proc.stdout.close()
-
-        # Wait for CMake to finish
-        try:
-            self.proc.wait(timeout=2)
-        except TimeoutExpired:
-            # Terminate CMake if there is a timeout
-            # terminate() may throw a platform specific exception if the process has already
-            # terminated. This may be the case if there is a race condition (CMake exited after
-            # the timeout but before the terminate() call). Additionally, this behavior can
-            # also be triggered on cygwin if CMake crashes.
-            # See https://github.com/mesonbuild/meson/pull/4969#issuecomment-499413233
-            try:
-                self.proc.terminate()
-            except Exception:
-                pass
-
-        self.proc = None
diff --git a/meson/mesonbuild/cmake/common.py b/meson/mesonbuild/cmake/common.py
deleted file mode 100644 (file)
index 4510b5d..0000000
+++ /dev/null
@@ -1,260 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from ..mesonlib import MesonException
-from .. import mlog
-import typing as T
-
-class CMakeException(MesonException):
-    pass
-
-class CMakeBuildFile:
-    def __init__(self, file: str, is_cmake: bool, is_temp: bool):
-        self.file = file
-        self.is_cmake = is_cmake
-        self.is_temp = is_temp
-
-    def __repr__(self):
-        return '<{}: {}; cmake={}; temp={}>'.format(self.__class__.__name__, self.file, self.is_cmake, self.is_temp)
-
-def _flags_to_list(raw: str) -> T.List[str]:
-    # Convert a raw commandline string into a list of strings
-    res = []
-    curr = ''
-    escape = False
-    in_string = False
-    for i in raw:
-        if escape:
-            # If the current char is not a quote, the '\' is probably important
-            if i not in ['"', "'"]:
-                curr += '\\'
-            curr += i
-            escape = False
-        elif i == '\\':
-            escape = True
-        elif i in ['"', "'"]:
-            in_string = not in_string
-        elif i in [' ', '\n']:
-            if in_string:
-                curr += i
-            else:
-                res += [curr]
-                curr = ''
-        else:
-            curr += i
-    res += [curr]
-    res = list(filter(lambda x: len(x) > 0, res))
-    return res
-
-def cmake_defines_to_args(raw: T.Any, permissive: bool = False) -> T.List[str]:
-    res = []  # type: T.List[str]
-    if not isinstance(raw, list):
-        raw = [raw]
-
-    for i in raw:
-        if not isinstance(i, dict):
-            raise MesonException('Invalid CMake defines. Expected a dict, but got a {}'.format(type(i).__name__))
-        for key, val in i.items():
-            assert isinstance(key, str)
-            if isinstance(val, (str, int, float)):
-                res += ['-D{}={}'.format(key, val)]
-            elif isinstance(val, bool):
-                val_str = 'ON' if val else 'OFF'
-                res += ['-D{}={}'.format(key, val_str)]
-            else:
-                raise MesonException('Type "{}" of "{}" is not supported as for a CMake define value'.format(type(val).__name__, key))
-
-    return res
-
-class CMakeFileGroup:
-    def __init__(self, data: dict):
-        self.defines = data.get('defines', '')
-        self.flags = _flags_to_list(data.get('compileFlags', ''))
-        self.includes = data.get('includePath', [])
-        self.is_generated = data.get('isGenerated', False)
-        self.language = data.get('language', 'C')
-        self.sources = data.get('sources', [])
-
-        # Fix the include directories
-        tmp = []
-        for i in self.includes:
-            if isinstance(i, dict) and 'path' in i:
-                i['isSystem'] = i.get('isSystem', False)
-                tmp += [i]
-            elif isinstance(i, str):
-                tmp += [{'path': i, 'isSystem': False}]
-        self.includes = tmp
-
-    def log(self) -> None:
-        mlog.log('flags        =', mlog.bold(', '.join(self.flags)))
-        mlog.log('defines      =', mlog.bold(', '.join(self.defines)))
-        mlog.log('includes     =', mlog.bold(', '.join(self.includes)))
-        mlog.log('is_generated =', mlog.bold('true' if self.is_generated else 'false'))
-        mlog.log('language     =', mlog.bold(self.language))
-        mlog.log('sources:')
-        for i in self.sources:
-            with mlog.nested():
-                mlog.log(i)
-
-class CMakeTarget:
-    def __init__(self, data: dict):
-        self.artifacts = data.get('artifacts', [])
-        self.src_dir = data.get('sourceDirectory', '')
-        self.build_dir = data.get('buildDirectory', '')
-        self.name = data.get('name', '')
-        self.full_name = data.get('fullName', '')
-        self.install = data.get('hasInstallRule', False)
-        self.install_paths = list(set(data.get('installPaths', [])))
-        self.link_lang = data.get('linkerLanguage', '')
-        self.link_libraries = _flags_to_list(data.get('linkLibraries', ''))
-        self.link_flags = _flags_to_list(data.get('linkFlags', ''))
-        self.link_lang_flags = _flags_to_list(data.get('linkLanguageFlags', ''))
-        # self.link_path = data.get('linkPath', '')
-        self.type = data.get('type', 'EXECUTABLE')
-        # self.is_generator_provided = data.get('isGeneratorProvided', False)
-        self.files = []
-
-        for i in data.get('fileGroups', []):
-            self.files += [CMakeFileGroup(i)]
-
-    def log(self) -> None:
-        mlog.log('artifacts             =', mlog.bold(', '.join(self.artifacts)))
-        mlog.log('src_dir               =', mlog.bold(self.src_dir))
-        mlog.log('build_dir             =', mlog.bold(self.build_dir))
-        mlog.log('name                  =', mlog.bold(self.name))
-        mlog.log('full_name             =', mlog.bold(self.full_name))
-        mlog.log('install               =', mlog.bold('true' if self.install else 'false'))
-        mlog.log('install_paths         =', mlog.bold(', '.join(self.install_paths)))
-        mlog.log('link_lang             =', mlog.bold(self.link_lang))
-        mlog.log('link_libraries        =', mlog.bold(', '.join(self.link_libraries)))
-        mlog.log('link_flags            =', mlog.bold(', '.join(self.link_flags)))
-        mlog.log('link_lang_flags       =', mlog.bold(', '.join(self.link_lang_flags)))
-        # mlog.log('link_path             =', mlog.bold(self.link_path))
-        mlog.log('type                  =', mlog.bold(self.type))
-        # mlog.log('is_generator_provided =', mlog.bold('true' if self.is_generator_provided else 'false'))
-        for idx, i in enumerate(self.files):
-            mlog.log('Files {}:'.format(idx))
-            with mlog.nested():
-                i.log()
-
-class CMakeProject:
-    def __init__(self, data: dict):
-        self.src_dir = data.get('sourceDirectory', '')
-        self.build_dir = data.get('buildDirectory', '')
-        self.name = data.get('name', '')
-        self.targets = []
-
-        for i in data.get('targets', []):
-            self.targets += [CMakeTarget(i)]
-
-    def log(self) -> None:
-        mlog.log('src_dir   =', mlog.bold(self.src_dir))
-        mlog.log('build_dir =', mlog.bold(self.build_dir))
-        mlog.log('name      =', mlog.bold(self.name))
-        for idx, i in enumerate(self.targets):
-            mlog.log('Target {}:'.format(idx))
-            with mlog.nested():
-                i.log()
-
-class CMakeConfiguration:
-    def __init__(self, data: dict):
-        self.name = data.get('name', '')
-        self.projects = []
-        for i in data.get('projects', []):
-            self.projects += [CMakeProject(i)]
-
-    def log(self) -> None:
-        mlog.log('name =', mlog.bold(self.name))
-        for idx, i in enumerate(self.projects):
-            mlog.log('Project {}:'.format(idx))
-            with mlog.nested():
-                i.log()
-
-class SingleTargetOptions:
-    def __init__(self) -> None:
-        self.opts = {}       # type: T.Dict[str, str]
-        self.lang_args = {}  # type: T.Dict[str, T.List[str]]
-        self.link_args = []  # type: T.List[str]
-        self.install = 'preserve'
-
-    def set_opt(self, opt: str, val: str) -> None:
-        self.opts[opt] = val
-
-    def append_args(self, lang: str, args: T.List[str]) -> None:
-        if lang not in self.lang_args:
-            self.lang_args[lang] = []
-        self.lang_args[lang] += args
-
-    def append_link_args(self, args: T.List[str]) -> None:
-        self.link_args += args
-
-    def set_install(self, install: bool) -> None:
-        self.install = 'true' if install else 'false'
-
-    def get_override_options(self, initial: T.List[str]) -> T.List[str]:
-        res = []  # type: T.List[str]
-        for i in initial:
-            opt = i[:i.find('=')]
-            if opt not in self.opts:
-                res += [i]
-        res += ['{}={}'.format(k, v) for k, v in self.opts.items()]
-        return res
-
-    def get_compile_args(self, lang: str, initial: T.List[str]) -> T.List[str]:
-        if lang in self.lang_args:
-            return initial + self.lang_args[lang]
-        return initial
-
-    def get_link_args(self, initial: T.List[str]) -> T.List[str]:
-        return initial + self.link_args
-
-    def get_install(self, initial: bool) -> bool:
-        return {'preserve': initial, 'true': True, 'false': False}[self.install]
-
-class TargetOptions:
-    def __init__(self) -> None:
-        self.global_options = SingleTargetOptions()
-        self.target_options = {}  # type: T.Dict[str, SingleTargetOptions]
-
-    def __getitem__(self, tgt: str) -> SingleTargetOptions:
-        if tgt not in self.target_options:
-            self.target_options[tgt] = SingleTargetOptions()
-        return self.target_options[tgt]
-
-    def get_override_options(self, tgt: str, initial: T.List[str]) -> T.List[str]:
-        initial = self.global_options.get_override_options(initial)
-        if tgt in self.target_options:
-            initial = self.target_options[tgt].get_override_options(initial)
-        return initial
-
-    def get_compile_args(self, tgt: str, lang: str, initial: T.List[str]) -> T.List[str]:
-        initial = self.global_options.get_compile_args(lang, initial)
-        if tgt in self.target_options:
-            initial = self.target_options[tgt].get_compile_args(lang, initial)
-        return initial
-
-    def get_link_args(self, tgt: str, initial: T.List[str]) -> T.List[str]:
-        initial = self.global_options.get_link_args(initial)
-        if tgt in self.target_options:
-            initial = self.target_options[tgt].get_link_args(initial)
-        return initial
-
-    def get_install(self, tgt: str, initial: bool) -> bool:
-        initial = self.global_options.get_install(initial)
-        if tgt in self.target_options:
-            initial = self.target_options[tgt].get_install(initial)
-        return initial
diff --git a/meson/mesonbuild/cmake/data/preload.cmake b/meson/mesonbuild/cmake/data/preload.cmake
deleted file mode 100644 (file)
index f8caae9..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-if(MESON_PS_LOADED)
-  return()
-endif()
-
-set(MESON_PS_LOADED ON)
-
-# Dummy macros that have a special meaning in the meson code
-macro(meson_ps_execute_delayed_calls)
-endmacro()
-
-macro(meson_ps_reload_vars)
-endmacro()
-
-# Helper macro to inspect the current CMake state
-macro(meson_ps_inspect_vars)
-  set(MESON_PS_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-  set(MESON_PS_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-  meson_ps_execute_delayed_calls()
-endmacro()
-
-
-# Override some system functions with custom code and forward the args
-# to the original function
-macro(add_custom_command)
-  meson_ps_inspect_vars()
-  _add_custom_command(${ARGV})
-endmacro()
-
-macro(add_custom_target)
-  meson_ps_inspect_vars()
-  _add_custom_target(${ARGV})
-endmacro()
-
-macro(set_property)
-  meson_ps_inspect_vars()
-  _set_property(${ARGV})
-endmacro()
-
-function(set_source_files_properties)
-  set(FILES)
-  set(I 0)
-  set(PROPERTIES OFF)
-
-  while(I LESS ARGC)
-    if(NOT PROPERTIES)
-      if("${ARGV${I}}" STREQUAL "PROPERTIES")
-        set(PROPERTIES ON)
-      else()
-        list(APPEND FILES "${ARGV${I}}")
-      endif()
-
-      math(EXPR I "${I} + 1")
-    else()
-      set(ID_IDX ${I})
-      math(EXPR PROP_IDX "${ID_IDX} + 1")
-
-      set(ID   "${ARGV${ID_IDX}}")
-      set(PROP "${ARGV${PROP_IDX}}")
-
-      set_property(SOURCE ${FILES} PROPERTY "${ID}" "${PROP}")
-      math(EXPR I "${I} + 2")
-    endif()
-  endwhile()
-endfunction()
-
-set(MESON_PS_DELAYED_CALLS add_custom_command;add_custom_target;set_property)
-meson_ps_reload_vars()
diff --git a/meson/mesonbuild/cmake/executor.py b/meson/mesonbuild/cmake/executor.py
deleted file mode 100644 (file)
index 2226c02..0000000
+++ /dev/null
@@ -1,426 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-import subprocess as S
-from pathlib import Path
-from threading import Thread
-import typing as T
-import re
-import os
-import shutil
-import ctypes
-import textwrap
-
-from .. import mlog, mesonlib
-from ..mesonlib import PerMachine, Popen_safe, version_compare, MachineChoice
-from ..environment import Environment
-from ..envconfig import get_env_var
-from ..compilers import (
-    AppleClangCCompiler, AppleClangCPPCompiler, AppleClangObjCCompiler,
-    AppleClangObjCPPCompiler
-)
-
-if T.TYPE_CHECKING:
-    from ..dependencies.base import ExternalProgram
-    from ..compilers import Compiler
-
-TYPE_result = T.Tuple[int, T.Optional[str], T.Optional[str]]
-
-_MESON_TO_CMAKE_MAPPING = {
-    'arm':          'ARMCC',
-    'armclang':     'ARMClang',
-    'clang':        'Clang',
-    'clang-cl':     'MSVC',
-    'flang':        'Flang',
-    'g95':          'G95',
-    'gcc':          'GNU',
-    'intel':        'Intel',
-    'intel-cl':     'MSVC',
-    'msvc':         'MSVC',
-    'pathscale':    'PathScale',
-    'pgi':          'PGI',
-    'sun':          'SunPro',
-}
-
-def meson_compiler_to_cmake_id(cobj: 'Compiler') -> str:
-    """Translate meson compiler's into CMAKE compiler ID's.
-
-    Most of these can be handled by a simple table lookup, with a few
-    exceptions.
-
-    Clang and Apple's Clang are both identified as "clang" by meson. To make
-    things more complicated gcc and vanilla clang both use Apple's ld64 on
-    macOS. The only way to know for sure is to do an isinstance() check.
-    """
-    if isinstance(cobj, (AppleClangCCompiler, AppleClangCPPCompiler,
-                         AppleClangObjCCompiler, AppleClangObjCPPCompiler)):
-        return 'AppleClang'
-    # If no mapping, try GNU and hope that the build files don't care
-    return _MESON_TO_CMAKE_MAPPING.get(cobj.get_id(), 'GNU')
-
-
-class CMakeExecutor:
-    # The class's copy of the CMake path. Avoids having to search for it
-    # multiple times in the same Meson invocation.
-    class_cmakebin = PerMachine(None, None)
-    class_cmakevers = PerMachine(None, None)
-    class_cmake_cache = {}  # type: T.Dict[T.Any, TYPE_result]
-
-    def __init__(self, environment: Environment, version: str, for_machine: MachineChoice, silent: bool = False):
-        self.min_version = version
-        self.environment = environment
-        self.for_machine = for_machine
-        self.cmakebin, self.cmakevers = self.find_cmake_binary(self.environment, silent=silent)
-        self.always_capture_stderr = True
-        self.print_cmout = False
-        self.prefix_paths = []      # type: T.List[str]
-        self.extra_cmake_args = []  # type: T.List[str]
-        if self.cmakebin is False:
-            self.cmakebin = None
-            return
-
-        if not version_compare(self.cmakevers, self.min_version):
-            mlog.warning(
-                'The version of CMake', mlog.bold(self.cmakebin.get_path()),
-                'is', mlog.bold(self.cmakevers), 'but version', mlog.bold(self.min_version),
-                'is required')
-            self.cmakebin = None
-            return
-
-        self.prefix_paths = self.environment.coredata.builtins_per_machine[self.for_machine]['cmake_prefix_path'].value
-        env_pref_path = get_env_var(
-            self.for_machine,
-            self.environment.is_cross_build(),
-            'CMAKE_PREFIX_PATH')
-        if env_pref_path is not None:
-            if mesonlib.is_windows():
-                # Cannot split on ':' on Windows because its in the drive letter
-                env_pref_path = env_pref_path.split(os.pathsep)
-            else:
-                # https://github.com/mesonbuild/meson/issues/7294
-                env_pref_path = re.split(r':|;', env_pref_path)
-            env_pref_path = [x for x in env_pref_path if x]  # Filter out empty strings
-            if not self.prefix_paths:
-                self.prefix_paths = []
-            self.prefix_paths += env_pref_path
-
-        if self.prefix_paths:
-            self.extra_cmake_args += ['-DCMAKE_PREFIX_PATH={}'.format(';'.join(self.prefix_paths))]
-
-    def find_cmake_binary(self, environment: Environment, silent: bool = False) -> T.Tuple['ExternalProgram', str]:
-        from ..dependencies.base import find_external_program
-
-        # Only search for CMake the first time and store the result in the class
-        # definition
-        if CMakeExecutor.class_cmakebin[self.for_machine] is False:
-            mlog.debug('CMake binary for %s is cached as not found' % self.for_machine)
-        elif CMakeExecutor.class_cmakebin[self.for_machine] is not None:
-            mlog.debug('CMake binary for %s is cached.' % self.for_machine)
-        else:
-            assert CMakeExecutor.class_cmakebin[self.for_machine] is None
-
-            mlog.debug('CMake binary for %s is not cached' % self.for_machine)
-            for potential_cmakebin in find_external_program(
-                    environment, self.for_machine, 'cmake', 'CMake',
-                    environment.default_cmake, allow_default_for_cross=False):
-                version_if_ok = self.check_cmake(potential_cmakebin)
-                if not version_if_ok:
-                    continue
-                if not silent:
-                    mlog.log('Found CMake:', mlog.bold(potential_cmakebin.get_path()),
-                             '(%s)' % version_if_ok)
-                CMakeExecutor.class_cmakebin[self.for_machine] = potential_cmakebin
-                CMakeExecutor.class_cmakevers[self.for_machine] = version_if_ok
-                break
-            else:
-                if not silent:
-                    mlog.log('Found CMake:', mlog.red('NO'))
-                # Set to False instead of None to signify that we've already
-                # searched for it and not found it
-                CMakeExecutor.class_cmakebin[self.for_machine] = False
-                CMakeExecutor.class_cmakevers[self.for_machine] = None
-
-        return CMakeExecutor.class_cmakebin[self.for_machine], CMakeExecutor.class_cmakevers[self.for_machine]
-
-    def check_cmake(self, cmakebin: 'ExternalProgram') -> T.Optional[str]:
-        if not cmakebin.found():
-            mlog.log('Did not find CMake {!r}'.format(cmakebin.name))
-            return None
-        try:
-            p, out = Popen_safe(cmakebin.get_command() + ['--version'])[0:2]
-            if p.returncode != 0:
-                mlog.warning('Found CMake {!r} but couldn\'t run it'
-                             ''.format(' '.join(cmakebin.get_command())))
-                return None
-        except FileNotFoundError:
-            mlog.warning('We thought we found CMake {!r} but now it\'s not there. How odd!'
-                         ''.format(' '.join(cmakebin.get_command())))
-            return None
-        except PermissionError:
-            msg = 'Found CMake {!r} but didn\'t have permissions to run it.'.format(' '.join(cmakebin.get_command()))
-            if not mesonlib.is_windows():
-                msg += '\n\nOn Unix-like systems this is often caused by scripts that are not executable.'
-            mlog.warning(msg)
-            return None
-        cmvers = re.search(r'(cmake|cmake3)\s*version\s*([\d.]+)', out).group(2)
-        return cmvers
-
-    def set_exec_mode(self, print_cmout: T.Optional[bool] = None, always_capture_stderr: T.Optional[bool] = None) -> None:
-        if print_cmout is not None:
-            self.print_cmout = print_cmout
-        if always_capture_stderr is not None:
-            self.always_capture_stderr = always_capture_stderr
-
-    def _cache_key(self, args: T.List[str], build_dir: str, env):
-        fenv = frozenset(env.items()) if env is not None else None
-        targs = tuple(args)
-        return (self.cmakebin, targs, build_dir, fenv)
-
-    def _call_cmout_stderr(self, args: T.List[str], build_dir: str, env) -> TYPE_result:
-        cmd = self.cmakebin.get_command() + args
-        proc = S.Popen(cmd, stdout=S.PIPE, stderr=S.PIPE, cwd=build_dir, env=env)
-
-        # stdout and stderr MUST be read at the same time to avoid pipe
-        # blocking issues. The easiest way to do this is with a separate
-        # thread for one of the pipes.
-        def print_stdout():
-            while True:
-                line = proc.stdout.readline()
-                if not line:
-                    break
-                mlog.log(line.decode(errors='ignore').strip('\n'))
-            proc.stdout.close()
-
-        t = Thread(target=print_stdout)
-        t.start()
-
-        try:
-            # Read stderr line by line and log non trace lines
-            raw_trace = ''
-            tline_start_reg = re.compile(r'^\s*(.*\.(cmake|txt))\(([0-9]+)\):\s*(\w+)\(.*$')
-            inside_multiline_trace = False
-            while True:
-                line = proc.stderr.readline()
-                if not line:
-                    break
-                line = line.decode(errors='ignore')
-                if tline_start_reg.match(line):
-                    raw_trace += line
-                    inside_multiline_trace = not line.endswith(' )\n')
-                elif inside_multiline_trace:
-                    raw_trace += line
-                else:
-                    mlog.warning(line.strip('\n'))
-
-        finally:
-            proc.stderr.close()
-            t.join()
-            proc.wait()
-
-        return proc.returncode, None, raw_trace
-
-    def _call_cmout(self, args: T.List[str], build_dir: str, env) -> TYPE_result:
-        cmd = self.cmakebin.get_command() + args
-        proc = S.Popen(cmd, stdout=S.PIPE, stderr=S.STDOUT, cwd=build_dir, env=env)
-        while True:
-            line = proc.stdout.readline()
-            if not line:
-                break
-            mlog.log(line.decode(errors='ignore').strip('\n'))
-        proc.stdout.close()
-        proc.wait()
-        return proc.returncode, None, None
-
-    def _call_quiet(self, args: T.List[str], build_dir: str, env) -> TYPE_result:
-        os.makedirs(build_dir, exist_ok=True)
-        cmd = self.cmakebin.get_command() + args
-        ret = S.run(cmd, env=env, cwd=build_dir, close_fds=False,
-                    stdout=S.PIPE, stderr=S.PIPE, universal_newlines=False)
-        rc = ret.returncode
-        out = ret.stdout.decode(errors='ignore')
-        err = ret.stderr.decode(errors='ignore')
-        call = ' '.join(cmd)
-        mlog.debug("Called `{}` in {} -> {}".format(call, build_dir, rc))
-        return rc, out, err
-
-    def _call_impl(self, args: T.List[str], build_dir: str, env) -> TYPE_result:
-        if not self.print_cmout:
-            return self._call_quiet(args, build_dir, env)
-        else:
-            if self.always_capture_stderr:
-                return self._call_cmout_stderr(args, build_dir, env)
-            else:
-                return self._call_cmout(args, build_dir, env)
-
-    def call(self, args: T.List[str], build_dir: str, env=None, disable_cache: bool = False) -> TYPE_result:
-        if env is None:
-            env = os.environ
-
-        args = args + self.extra_cmake_args
-        if disable_cache:
-            return self._call_impl(args, build_dir, env)
-
-        # First check if cached, if not call the real cmake function
-        cache = CMakeExecutor.class_cmake_cache
-        key = self._cache_key(args, build_dir, env)
-        if key not in cache:
-            cache[key] = self._call_impl(args, build_dir, env)
-        return cache[key]
-
-    def call_with_fake_build(self, args: T.List[str], build_dir: str, env=None) -> TYPE_result:
-        # First check the cache
-        cache = CMakeExecutor.class_cmake_cache
-        key = self._cache_key(args, build_dir, env)
-        if key in cache:
-            return cache[key]
-
-        os.makedirs(build_dir, exist_ok=True)
-
-        # Try to set the correct compiler for C and C++
-        # This step is required to make try_compile work inside CMake
-        fallback = os.path.realpath(__file__)  # A file used as a fallback wehen everything else fails
-        compilers = self.environment.coredata.compilers[MachineChoice.BUILD]
-
-        def make_abs(exe: str, lang: str) -> str:
-            if os.path.isabs(exe):
-                return exe
-
-            p = shutil.which(exe)
-            if p is None:
-                mlog.debug('Failed to find a {} compiler for CMake. This might cause CMake to fail.'.format(lang))
-                p = fallback
-            return p
-
-        def choose_compiler(lang: str) -> T.Tuple[str, str, str, str]:
-            comp_obj = None
-            exe_list = []
-            if lang in compilers:
-                comp_obj = compilers[lang]
-            else:
-                try:
-                    comp_obj = self.environment.compiler_from_language(lang, MachineChoice.BUILD)
-                except Exception:
-                    pass
-
-            if comp_obj is not None:
-                exe_list = comp_obj.get_exelist()
-                comp_id = meson_compiler_to_cmake_id(comp_obj)
-                comp_version = comp_obj.version.upper()
-
-            if len(exe_list) == 1:
-                return make_abs(exe_list[0], lang), '', comp_id, comp_version
-            elif len(exe_list) == 2:
-                return make_abs(exe_list[1], lang), make_abs(exe_list[0], lang), comp_id, comp_version
-            else:
-                mlog.debug('Failed to find a {} compiler for CMake. This might cause CMake to fail.'.format(lang))
-                return fallback, '', 'GNU', ''
-
-        c_comp, c_launcher, c_id, c_version = choose_compiler('c')
-        cxx_comp, cxx_launcher, cxx_id, cxx_version = choose_compiler('cpp')
-        fortran_comp, fortran_launcher, _, _ = choose_compiler('fortran')
-
-        # on Windows, choose_compiler returns path with \ as separator - replace by / before writing to CMAKE file
-        c_comp = c_comp.replace('\\', '/')
-        c_launcher = c_launcher.replace('\\', '/')
-        cxx_comp = cxx_comp.replace('\\', '/')
-        cxx_launcher = cxx_launcher.replace('\\', '/')
-        fortran_comp = fortran_comp.replace('\\', '/')
-        fortran_launcher = fortran_launcher.replace('\\', '/')
-
-        # Reset the CMake cache
-        (Path(build_dir) / 'CMakeCache.txt').write_text('CMAKE_PLATFORM_INFO_INITIALIZED:INTERNAL=1\n')
-
-        # Fake the compiler files
-        comp_dir = Path(build_dir) / 'CMakeFiles' / self.cmakevers
-        comp_dir.mkdir(parents=True, exist_ok=True)
-
-        c_comp_file = comp_dir / 'CMakeCCompiler.cmake'
-        cxx_comp_file = comp_dir / 'CMakeCXXCompiler.cmake'
-        fortran_comp_file = comp_dir / 'CMakeFortranCompiler.cmake'
-
-        if c_comp and not c_comp_file.is_file():
-            is_gnu = '1' if c_id == 'GNU' else ''
-            c_comp_file.write_text(textwrap.dedent('''\
-                # Fake CMake file to skip the boring and slow stuff
-                set(CMAKE_C_COMPILER "{}") # Should be a valid compiler for try_compile, etc.
-                set(CMAKE_C_COMPILER_LAUNCHER "{}") # The compiler launcher (if presentt)
-                set(CMAKE_COMPILER_IS_GNUCC {})
-                set(CMAKE_C_COMPILER_ID "{}")
-                set(CMAKE_C_COMPILER_VERSION "{}")
-                set(CMAKE_C_COMPILER_LOADED 1)
-                set(CMAKE_C_COMPILER_FORCED 1)
-                set(CMAKE_C_COMPILER_WORKS TRUE)
-                set(CMAKE_C_ABI_COMPILED TRUE)
-                set(CMAKE_C_SOURCE_FILE_EXTENSIONS c;m)
-                set(CMAKE_C_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
-                set(CMAKE_SIZEOF_VOID_P "{}")
-            '''.format(c_comp, c_launcher, is_gnu, c_id, c_version,
-                       ctypes.sizeof(ctypes.c_voidp))))
-
-        if cxx_comp and not cxx_comp_file.is_file():
-            is_gnu = '1' if cxx_id == 'GNU' else ''
-            cxx_comp_file.write_text(textwrap.dedent('''\
-                # Fake CMake file to skip the boring and slow stuff
-                set(CMAKE_CXX_COMPILER "{}") # Should be a valid compiler for try_compile, etc.
-                set(CMAKE_CXX_COMPILER_LAUNCHER "{}") # The compiler launcher (if presentt)
-                set(CMAKE_COMPILER_IS_GNUCXX {})
-                set(CMAKE_CXX_COMPILER_ID "{}")
-                set(CMAKE_CXX_COMPILER_VERSION "{}")
-                set(CMAKE_CXX_COMPILER_LOADED 1)
-                set(CMAKE_CXX_COMPILER_FORCED 1)
-                set(CMAKE_CXX_COMPILER_WORKS TRUE)
-                set(CMAKE_CXX_ABI_COMPILED TRUE)
-                set(CMAKE_CXX_IGNORE_EXTENSIONS inl;h;hpp;HPP;H;o;O;obj;OBJ;def;DEF;rc;RC)
-                set(CMAKE_CXX_SOURCE_FILE_EXTENSIONS C;M;c++;cc;cpp;cxx;mm;CPP)
-                set(CMAKE_SIZEOF_VOID_P "{}")
-            '''.format(cxx_comp, cxx_launcher, is_gnu, cxx_id, cxx_version,
-                       ctypes.sizeof(ctypes.c_voidp))))
-
-        if fortran_comp and not fortran_comp_file.is_file():
-            fortran_comp_file.write_text(textwrap.dedent('''\
-                # Fake CMake file to skip the boring and slow stuff
-                set(CMAKE_Fortran_COMPILER "{}") # Should be a valid compiler for try_compile, etc.
-                set(CMAKE_Fortran_COMPILER_LAUNCHER "{}") # The compiler launcher (if presentt)
-                set(CMAKE_Fortran_COMPILER_ID "GNU") # Pretend we have found GCC
-                set(CMAKE_COMPILER_IS_GNUG77 1)
-                set(CMAKE_Fortran_COMPILER_LOADED 1)
-                set(CMAKE_Fortran_COMPILER_WORKS TRUE)
-                set(CMAKE_Fortran_ABI_COMPILED TRUE)
-                set(CMAKE_Fortran_IGNORE_EXTENSIONS h;H;o;O;obj;OBJ;def;DEF;rc;RC)
-                set(CMAKE_Fortran_SOURCE_FILE_EXTENSIONS f;F;fpp;FPP;f77;F77;f90;F90;for;For;FOR;f95;F95)
-                set(CMAKE_SIZEOF_VOID_P "{}")
-            '''.format(fortran_comp, fortran_launcher, ctypes.sizeof(ctypes.c_voidp))))
-
-        return self.call(args, build_dir, env)
-
-    def found(self) -> bool:
-        return self.cmakebin is not None
-
-    def version(self) -> str:
-        return self.cmakevers
-
-    def executable_path(self) -> str:
-        return self.cmakebin.get_path()
-
-    def get_command(self) -> T.List[str]:
-        return self.cmakebin.get_command()
-
-    def get_cmake_prefix_paths(self) -> T.List[str]:
-        return self.prefix_paths
-
-    def machine_choice(self) -> MachineChoice:
-        return self.for_machine
diff --git a/meson/mesonbuild/cmake/fileapi.py b/meson/mesonbuild/cmake/fileapi.py
deleted file mode 100644 (file)
index f219f16..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .common import CMakeException, CMakeBuildFile, CMakeConfiguration
-import typing as T
-from .. import mlog
-import os
-import json
-import re
-
-STRIP_KEYS = ['cmake', 'reply', 'backtrace', 'backtraceGraph', 'version']
-
-class CMakeFileAPI:
-    def __init__(self, build_dir: str):
-        self.build_dir = build_dir
-        self.api_base_dir = os.path.join(self.build_dir, '.cmake', 'api', 'v1')
-        self.request_dir = os.path.join(self.api_base_dir, 'query', 'client-meson')
-        self.reply_dir = os.path.join(self.api_base_dir, 'reply')
-        self.cmake_sources = []
-        self.cmake_configurations = []
-        self.kind_resolver_map = {
-            'codemodel': self._parse_codemodel,
-            'cmakeFiles': self._parse_cmakeFiles,
-        }
-
-    def get_cmake_sources(self) -> T.List[CMakeBuildFile]:
-        return self.cmake_sources
-
-    def get_cmake_configurations(self) -> T.List[CMakeConfiguration]:
-        return self.cmake_configurations
-
-    def setup_request(self) -> None:
-        os.makedirs(self.request_dir, exist_ok=True)
-
-        query = {
-            'requests': [
-                {'kind': 'codemodel', 'version': {'major': 2, 'minor': 0}},
-                {'kind': 'cmakeFiles', 'version': {'major': 1, 'minor': 0}},
-            ]
-        }
-
-        with open(os.path.join(self.request_dir, 'query.json'), 'w') as fp:
-            json.dump(query, fp, indent=2)
-
-    def load_reply(self) -> None:
-        if not os.path.isdir(self.reply_dir):
-            raise CMakeException('No response from the CMake file API')
-
-        files = os.listdir(self.reply_dir)
-        root = None
-        reg_index = re.compile(r'^index-.*\.json$')
-        for i in files:
-            if reg_index.match(i):
-                root = i
-                break
-
-        if not root:
-            raise CMakeException('Failed to find the CMake file API index')
-
-        index = self._reply_file_content(root)   # Load the root index
-        index = self._strip_data(index)          # Avoid loading duplicate files
-        index = self._resolve_references(index)  # Load everything
-        index = self._strip_data(index)          # Strip unused data (again for loaded files)
-
-        # Debug output
-        debug_json = os.path.normpath(os.path.join(self.build_dir, '..', 'fileAPI.json'))
-        with open(debug_json, 'w') as fp:
-            json.dump(index, fp, indent=2)
-        mlog.cmd_ci_include(debug_json)
-
-        # parse the JSON
-        for i in index['objects']:
-            assert(isinstance(i, dict))
-            assert('kind' in i)
-            assert(i['kind'] in self.kind_resolver_map)
-
-            self.kind_resolver_map[i['kind']](i)
-
-    def _parse_codemodel(self, data: dict) -> None:
-        assert('configurations' in data)
-        assert('paths' in data)
-
-        source_dir = data['paths']['source']
-        build_dir = data['paths']['build']
-
-        # The file API output differs quite a bit from the server
-        # output. It is more flat than the server output and makes
-        # heavy use of references. Here these references are
-        # resolved and the resulting data structure is identical
-        # to the CMake serve output.
-
-        def helper_parse_dir(dir_entry: dict) -> T.Tuple[str, str]:
-            src_dir = dir_entry.get('source', '.')
-            bld_dir = dir_entry.get('build', '.')
-            src_dir = src_dir if os.path.isabs(src_dir) else os.path.join(source_dir, src_dir)
-            bld_dir = bld_dir if os.path.isabs(bld_dir) else os.path.join(source_dir, bld_dir)
-            src_dir = os.path.normpath(src_dir)
-            bld_dir = os.path.normpath(bld_dir)
-
-            return src_dir, bld_dir
-
-        def parse_sources(comp_group: dict, tgt: dict) -> T.Tuple[T.List[str], T.List[str], T.List[int]]:
-            gen = []
-            src = []
-            idx = []
-
-            src_list_raw = tgt.get('sources', [])
-            for i in comp_group.get('sourceIndexes', []):
-                if i >= len(src_list_raw) or 'path' not in src_list_raw[i]:
-                    continue
-                if src_list_raw[i].get('isGenerated', False):
-                    gen += [src_list_raw[i]['path']]
-                else:
-                    src += [src_list_raw[i]['path']]
-                idx += [i]
-
-            return src, gen, idx
-
-        def parse_target(tgt: dict) -> dict:
-            src_dir, bld_dir = helper_parse_dir(cnf.get('paths', {}))
-
-            # Parse install paths (if present)
-            install_paths = []
-            if 'install' in tgt:
-                prefix = tgt['install']['prefix']['path']
-                install_paths = [os.path.join(prefix, x['path']) for x in tgt['install']['destinations']]
-                install_paths = list(set(install_paths))
-
-            # On the first look, it looks really nice that the CMake devs have
-            # decided to use arrays for the linker flags. However, this feeling
-            # soon turns into despair when you realize that there only one entry
-            # per type in most cases, and we still have to do manual string splitting.
-            link_flags = []
-            link_libs = []
-            for i in tgt.get('link', {}).get('commandFragments', []):
-                if i['role'] == 'flags':
-                    link_flags += [i['fragment']]
-                elif i['role'] == 'libraries':
-                    link_libs += [i['fragment']]
-                elif i['role'] == 'libraryPath':
-                    link_flags += ['-L{}'.format(i['fragment'])]
-                elif i['role'] == 'frameworkPath':
-                    link_flags += ['-F{}'.format(i['fragment'])]
-            for i in tgt.get('archive', {}).get('commandFragments', []):
-                if i['role'] == 'flags':
-                    link_flags += [i['fragment']]
-
-            # TODO The `dependencies` entry is new in the file API.
-            #      maybe we can make use of that in addition to the
-            #      implicit dependency detection
-            tgt_data = {
-                'artifacts': [x.get('path', '') for x in tgt.get('artifacts', [])],
-                'sourceDirectory': src_dir,
-                'buildDirectory': bld_dir,
-                'name': tgt.get('name', ''),
-                'fullName': tgt.get('nameOnDisk', ''),
-                'hasInstallRule': 'install' in tgt,
-                'installPaths': install_paths,
-                'linkerLanguage': tgt.get('link', {}).get('language', 'CXX'),
-                'linkLibraries': ' '.join(link_libs),  # See previous comment block why we join the array
-                'linkFlags': ' '.join(link_flags),     # See previous comment block why we join the array
-                'type': tgt.get('type', 'EXECUTABLE'),
-                'fileGroups': [],
-            }
-
-            processed_src_idx = []
-            for cg in tgt.get('compileGroups', []):
-                # Again, why an array, when there is usually only one element
-                # and arguments are separated with spaces...
-                flags = []
-                for i in cg.get('compileCommandFragments', []):
-                    flags += [i['fragment']]
-
-                cg_data = {
-                    'defines': [x.get('define', '') for x in cg.get('defines', [])],
-                    'compileFlags': ' '.join(flags),
-                    'language': cg.get('language', 'C'),
-                    'isGenerated': None,  # Set later, flag is stored per source file
-                    'sources': [],
-                    'includePath': cg.get('includes', []),
-                }
-
-                normal_src, generated_src, src_idx = parse_sources(cg, tgt)
-                if normal_src:
-                    cg_data = dict(cg_data)
-                    cg_data['isGenerated'] = False
-                    cg_data['sources'] = normal_src
-                    tgt_data['fileGroups'] += [cg_data]
-                if generated_src:
-                    cg_data = dict(cg_data)
-                    cg_data['isGenerated'] = True
-                    cg_data['sources'] = generated_src
-                    tgt_data['fileGroups'] += [cg_data]
-                processed_src_idx += src_idx
-
-            # Object libraries have no compile groups, only source groups.
-            # So we add all the source files to a dummy source group that were
-            # not found in the previous loop
-            normal_src = []
-            generated_src = []
-            for idx, src in enumerate(tgt.get('sources', [])):
-                if idx in processed_src_idx:
-                    continue
-
-                if src.get('isGenerated', False):
-                    generated_src += [src['path']]
-                else:
-                    normal_src += [src['path']]
-
-            if normal_src:
-                tgt_data['fileGroups'] += [{
-                    'isGenerated': False,
-                    'sources': normal_src,
-                }]
-            if generated_src:
-                tgt_data['fileGroups'] += [{
-                    'isGenerated': True,
-                    'sources': generated_src,
-                }]
-            return tgt_data
-
-        def parse_project(pro: dict) -> dict:
-            # Only look at the first directory specified in directoryIndexes
-            # TODO Figure out what the other indexes are there for
-            p_src_dir = source_dir
-            p_bld_dir = build_dir
-            try:
-                p_src_dir, p_bld_dir = helper_parse_dir(cnf['directories'][pro['directoryIndexes'][0]])
-            except (IndexError, KeyError):
-                pass
-
-            pro_data = {
-                'name': pro.get('name', ''),
-                'sourceDirectory': p_src_dir,
-                'buildDirectory': p_bld_dir,
-                'targets': [],
-            }
-
-            for ref in pro.get('targetIndexes', []):
-                tgt = {}
-                try:
-                    tgt = cnf['targets'][ref]
-                except (IndexError, KeyError):
-                    pass
-                pro_data['targets'] += [parse_target(tgt)]
-
-            return pro_data
-
-        for cnf in data.get('configurations', []):
-            cnf_data = {
-                'name': cnf.get('name', ''),
-                'projects': [],
-            }
-
-            for pro in cnf.get('projects', []):
-                cnf_data['projects'] += [parse_project(pro)]
-
-            self.cmake_configurations += [CMakeConfiguration(cnf_data)]
-
-    def _parse_cmakeFiles(self, data: dict) -> None:
-        assert('inputs' in data)
-        assert('paths' in data)
-
-        src_dir = data['paths']['source']
-
-        for i in data['inputs']:
-            path = i['path']
-            path = path if os.path.isabs(path) else os.path.join(src_dir, path)
-            self.cmake_sources += [CMakeBuildFile(path, i.get('isCMake', False), i.get('isGenerated', False))]
-
-    def _strip_data(self, data: T.Any) -> T.Any:
-        if isinstance(data, list):
-            for idx, i in enumerate(data):
-                data[idx] = self._strip_data(i)
-
-        elif isinstance(data, dict):
-            new = {}
-            for key, val in data.items():
-                if key not in STRIP_KEYS:
-                    new[key] = self._strip_data(val)
-            data = new
-
-        return data
-
-    def _resolve_references(self, data: T.Any) -> T.Any:
-        if isinstance(data, list):
-            for idx, i in enumerate(data):
-                data[idx] = self._resolve_references(i)
-
-        elif isinstance(data, dict):
-            # Check for the "magic" reference entry and insert
-            # it into the root data dict
-            if 'jsonFile' in data:
-                data.update(self._reply_file_content(data['jsonFile']))
-
-            for key, val in data.items():
-                data[key] = self._resolve_references(val)
-
-        return data
-
-    def _reply_file_content(self, filename: str) -> dict:
-        real_path = os.path.join(self.reply_dir, filename)
-        if not os.path.exists(real_path):
-            raise CMakeException('File "{}" does not exist'.format(real_path))
-
-        with open(real_path, 'r') as fp:
-            return json.load(fp)
diff --git a/meson/mesonbuild/cmake/generator.py b/meson/mesonbuild/cmake/generator.py
deleted file mode 100644 (file)
index a30d2de..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .. import mesonlib
-
-def parse_generator_expressions(raw: str) -> str:
-    '''Parse CMake generator expressions
-
-    Most generator expressions are simply ignored for
-    simplicety, however some are required for some common
-    use cases.
-    '''
-
-    out = ''  # type: str
-    i = 0     # type: int
-
-    def equal(arg: str) -> str:
-        col_pos = arg.find(',')
-        if col_pos < 0:
-            return '0'
-        else:
-            return '1' if arg[:col_pos] == arg[col_pos + 1:] else '0'
-
-    def vers_comp(op: str, arg: str) -> str:
-        col_pos = arg.find(',')
-        if col_pos < 0:
-            return '0'
-        else:
-            return '1' if mesonlib.version_compare(arg[:col_pos], '{}{}'.format(op, arg[col_pos + 1:])) else '0'
-
-    supported = {
-        # Boolean functions
-        'BOOL': lambda x: '0' if x.upper() in ['0', 'FALSE', 'OFF', 'N', 'NO', 'IGNORE', 'NOTFOUND'] or x.endswith('-NOTFOUND') else '1',
-        'AND': lambda x: '1' if all([y == '1' for y in x.split(',')]) else '0',
-        'OR': lambda x: '1' if any([y == '1' for y in x.split(',')]) else '0',
-        'NOT': lambda x: '0' if x == '1' else '1',
-
-        '0': lambda x: '',
-        '1': lambda x: x,
-
-        # String operations
-        'STREQUAL': equal,
-        'EQUAL': equal,
-        'VERSION_LESS': lambda x: vers_comp('<', x),
-        'VERSION_GREATER': lambda x: vers_comp('>', x),
-        'VERSION_EQUAL': lambda x: vers_comp('=', x),
-        'VERSION_LESS_EQUAL': lambda x: vers_comp('<=', x),
-        'VERSION_GREATER_EQUAL': lambda x: vers_comp('>=', x),
-
-        # String modification
-        'LOWER_CASE': lambda x: x.lower(),
-        'UPPER_CASE': lambda x: x.upper(),
-
-        # Always assume the BUILD_INTERFACE is valid.
-        # INSTALL_INTERFACE is always invalid for subprojects and
-        # it should also never appear in CMake config files, used
-        # for dependencies
-        'INSTALL_INTERFACE': lambda x: '',
-        'BUILD_INTERFACE': lambda x: x,
-
-        # Constants
-        'ANGLE-R': lambda x: '>',
-        'COMMA': lambda x: ',',
-        'SEMICOLON': lambda x: ';',
-    }
-
-    # Recursively evaluate generator expressions
-    def eval_generator_expressions() -> str:
-        nonlocal i
-        i += 2
-
-        func = ''  # type: str
-        args = ''  # type: str
-        res = ''   # type: str
-        exp = ''   # type: str
-
-        # Determine the body of the expression
-        while i < len(raw):
-            if raw[i] == '>':
-                # End of the generator expression
-                break
-            elif i < len(raw) - 1 and raw[i] == '$' and raw[i + 1] == '<':
-                # Nested generator expression
-                exp += eval_generator_expressions()
-            else:
-                # Generator expression body
-                exp += raw[i]
-
-            i += 1
-
-        # Split the expression into a function and arguments part
-        col_pos = exp.find(':')
-        if col_pos < 0:
-            func = exp
-        else:
-            func = exp[:col_pos]
-            args = exp[col_pos + 1:]
-
-        func = func.strip()
-        args = args.strip()
-
-        # Evaluate the function
-        if func in supported:
-            res = supported[func](args)
-
-        return res
-
-    while i < len(raw):
-        if i < len(raw) - 1 and raw[i] == '$' and raw[i + 1] == '<':
-            # Generator expression detected --> try resolving it
-            out += eval_generator_expressions()
-        else:
-            # Normal string, leave unchanged
-            out += raw[i]
-
-        i += 1
-
-    return out
diff --git a/meson/mesonbuild/cmake/interpreter.py b/meson/mesonbuild/cmake/interpreter.py
deleted file mode 100644 (file)
index 2fdb328..0000000
+++ /dev/null
@@ -1,1328 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from .common import CMakeException, CMakeTarget, TargetOptions
-from .client import CMakeClient, RequestCMakeInputs, RequestConfigure, RequestCompute, RequestCodeModel
-from .fileapi import CMakeFileAPI
-from .executor import CMakeExecutor
-from .traceparser import CMakeTraceParser, CMakeGeneratorTarget
-from .. import mlog, mesonlib
-from ..environment import Environment
-from ..mesonlib import MachineChoice, OrderedSet, version_compare
-from ..mesondata import mesondata
-from ..compilers.compilers import lang_suffixes, header_suffixes, obj_suffixes, lib_suffixes, is_header
-from enum import Enum
-from functools import lru_cache
-from pathlib import Path
-import typing as T
-import os, re
-
-from ..mparser import (
-    Token,
-    BaseNode,
-    CodeBlockNode,
-    FunctionNode,
-    ArrayNode,
-    ArgumentNode,
-    AssignmentNode,
-    BooleanNode,
-    StringNode,
-    IdNode,
-    IndexNode,
-    MethodNode,
-    NumberNode,
-)
-
-
-if T.TYPE_CHECKING:
-    from ..build import Build
-    from ..backend.backends import Backend
-
-# Disable all warnings automaticall enabled with --trace and friends
-# See https://cmake.org/cmake/help/latest/variable/CMAKE_POLICY_WARNING_CMPNNNN.html
-disable_policy_warnings = [
-    'CMP0025',
-    'CMP0047',
-    'CMP0056',
-    'CMP0060',
-    'CMP0065',
-    'CMP0066',
-    'CMP0067',
-    'CMP0082',
-    'CMP0089',
-]
-
-backend_generator_map = {
-    'ninja': 'Ninja',
-    'xcode': 'Xcode',
-    'vs2010': 'Visual Studio 10 2010',
-    'vs2015': 'Visual Studio 15 2017',
-    'vs2017': 'Visual Studio 15 2017',
-    'vs2019': 'Visual Studio 16 2019',
-}
-
-language_map = {
-    'c': 'C',
-    'cpp': 'CXX',
-    'cuda': 'CUDA',
-    'objc': 'OBJC',
-    'objcpp': 'OBJCXX',
-    'cs': 'CSharp',
-    'java': 'Java',
-    'fortran': 'Fortran',
-    'swift': 'Swift',
-}
-
-target_type_map = {
-    'STATIC_LIBRARY': 'static_library',
-    'MODULE_LIBRARY': 'shared_module',
-    'SHARED_LIBRARY': 'shared_library',
-    'EXECUTABLE': 'executable',
-    'OBJECT_LIBRARY': 'static_library',
-    'INTERFACE_LIBRARY': 'header_only'
-}
-
-skip_targets = ['UTILITY']
-
-blacklist_compiler_flags = [
-    '-Wall', '-Wextra', '-Weverything', '-Werror', '-Wpedantic', '-pedantic', '-w',
-    '/W1', '/W2', '/W3', '/W4', '/Wall', '/WX', '/w',
-    '/O1', '/O2', '/Ob', '/Od', '/Og', '/Oi', '/Os', '/Ot', '/Ox', '/Oy', '/Ob0',
-    '/RTC1', '/RTCc', '/RTCs', '/RTCu',
-    '/Z7', '/Zi', '/ZI',
-]
-
-blacklist_link_flags = [
-    '/machine:x64', '/machine:x86', '/machine:arm', '/machine:ebc',
-    '/debug', '/debug:fastlink', '/debug:full', '/debug:none',
-    '/incremental',
-]
-
-blacklist_clang_cl_link_flags = ['/GR', '/EHsc', '/MDd', '/Zi', '/RTC1']
-
-blacklist_link_libs = [
-    'kernel32.lib',
-    'user32.lib',
-    'gdi32.lib',
-    'winspool.lib',
-    'shell32.lib',
-    'ole32.lib',
-    'oleaut32.lib',
-    'uuid.lib',
-    'comdlg32.lib',
-    'advapi32.lib'
-]
-
-transfer_dependencies_from = ['header_only']
-
-_cmake_name_regex = re.compile(r'[^_a-zA-Z0-9]')
-def _sanitize_cmake_name(name: str) -> str:
-    name = _cmake_name_regex.sub('_', name)
-    return 'cm_' + name
-
-class OutputTargetMap:
-    rm_so_version = re.compile(r'(\.[0-9]+)+$')
-
-    def __init__(self, build_dir: str):
-        self.tgt_map = {}
-        self.build_dir = build_dir
-
-    def add(self, tgt: T.Union['ConverterTarget', 'ConverterCustomTarget']) -> None:
-        def assign_keys(keys: T.List[str]) -> None:
-            for i in [x for x in keys if x]:
-                self.tgt_map[i] = tgt
-        keys = [self._target_key(tgt.cmake_name)]
-        if isinstance(tgt, ConverterTarget):
-            keys += [tgt.full_name]
-            keys += [self._rel_artifact_key(x) for x in tgt.artifacts]
-            keys += [self._base_artifact_key(x) for x in tgt.artifacts]
-        if isinstance(tgt, ConverterCustomTarget):
-            keys += [self._rel_generated_file_key(x) for x in tgt.original_outputs]
-            keys += [self._base_generated_file_key(x) for x in tgt.original_outputs]
-        assign_keys(keys)
-
-    def _return_first_valid_key(self, keys: T.List[str]) -> T.Optional[T.Union['ConverterTarget', 'ConverterCustomTarget']]:
-        for i in keys:
-            if i and i in self.tgt_map:
-                return self.tgt_map[i]
-        return None
-
-    def target(self, name: str) -> T.Optional[T.Union['ConverterTarget', 'ConverterCustomTarget']]:
-        return self._return_first_valid_key([self._target_key(name)])
-
-    def executable(self, name: str) -> T.Optional['ConverterTarget']:
-        tgt = self.target(name)
-        if tgt is None or not isinstance(tgt, ConverterTarget):
-            return None
-        if tgt.meson_func() != 'executable':
-            return None
-        return tgt
-
-    def artifact(self, name: str) -> T.Optional[T.Union['ConverterTarget', 'ConverterCustomTarget']]:
-        keys = []
-        candidates = [name, OutputTargetMap.rm_so_version.sub('', name)]
-        for i in lib_suffixes:
-            if not name.endswith('.' + i):
-                continue
-            new_name = name[:-len(i) - 1]
-            new_name = OutputTargetMap.rm_so_version.sub('', new_name)
-            candidates += ['{}.{}'.format(new_name, i)]
-        for i in candidates:
-            keys += [self._rel_artifact_key(i), os.path.basename(i), self._base_artifact_key(i)]
-        return self._return_first_valid_key(keys)
-
-    def generated(self, name: str) -> T.Optional[T.Union['ConverterTarget', 'ConverterCustomTarget']]:
-        return self._return_first_valid_key([self._rel_generated_file_key(name), self._base_generated_file_key(name)])
-
-    # Utility functions to generate local keys
-    def _rel_path(self, fname: str) -> T.Optional[str]:
-        fname = os.path.normpath(os.path.join(self.build_dir, fname))
-        if os.path.commonpath([self.build_dir, fname]) != self.build_dir:
-            return None
-        return os.path.relpath(fname, self.build_dir)
-
-    def _target_key(self, tgt_name: str) -> str:
-        return '__tgt_{}__'.format(tgt_name)
-
-    def _rel_generated_file_key(self, fname: str) -> T.Optional[str]:
-        path = self._rel_path(fname)
-        return '__relgen_{}__'.format(path) if path else None
-
-    def _base_generated_file_key(self, fname: str) -> str:
-        return '__gen_{}__'.format(os.path.basename(fname))
-
-    def _rel_artifact_key(self, fname: str) -> T.Optional[str]:
-        path = self._rel_path(fname)
-        return '__relart_{}__'.format(path) if path else None
-
-    def _base_artifact_key(self, fname: str) -> str:
-        return '__art_{}__'.format(os.path.basename(fname))
-
-class ConverterTarget:
-    def __init__(self, target: CMakeTarget, env: Environment):
-        self.env = env
-        self.artifacts = target.artifacts
-        self.src_dir = target.src_dir
-        self.build_dir = target.build_dir
-        self.name = target.name
-        self.cmake_name = target.name
-        self.full_name = target.full_name
-        self.type = target.type
-        self.install = target.install
-        self.install_dir = ''
-        self.link_libraries = target.link_libraries
-        self.link_flags = target.link_flags + target.link_lang_flags
-        self.depends_raw = []
-        self.depends = []
-
-        if target.install_paths:
-            self.install_dir = target.install_paths[0]
-
-        self.languages = []
-        self.sources = []
-        self.generated = []
-        self.includes = []
-        self.sys_includes = []
-        self.link_with = []
-        self.object_libs = []
-        self.compile_opts = {}
-        self.public_compile_opts = []
-        self.pie = False
-
-        # Project default override options (c_std, cpp_std, etc.)
-        self.override_options = []
-
-        # Convert the target name to a valid meson target name
-        self.name = _sanitize_cmake_name(self.name)
-
-        for i in target.files:
-            # Determine the meson language
-            lang_cmake_to_meson = {val.lower(): key for key, val in language_map.items()}
-            lang = lang_cmake_to_meson.get(i.language.lower(), 'c')
-            if lang not in self.languages:
-                self.languages += [lang]
-            if lang not in self.compile_opts:
-                self.compile_opts[lang] = []
-
-            # Add arguments, but avoid duplicates
-            args = i.flags
-            args += ['-D{}'.format(x) for x in i.defines]
-            self.compile_opts[lang] += [x for x in args if x not in self.compile_opts[lang]]
-
-            # Handle include directories
-            self.includes += [x['path'] for x in i.includes if x not in self.includes and not x['isSystem']]
-            self.sys_includes += [x['path'] for x in i.includes if x not in self.sys_includes and x['isSystem']]
-
-            # Add sources to the right array
-            if i.is_generated:
-                self.generated += i.sources
-            else:
-                self.sources += i.sources
-
-    def __repr__(self) -> str:
-        return '<{}: {}>'.format(self.__class__.__name__, self.name)
-
-    std_regex = re.compile(r'([-]{1,2}std=|/std:v?|[-]{1,2}std:)(.*)')
-
-    def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, install_prefix: str, trace: CMakeTraceParser) -> None:
-        # Detect setting the C and C++ standard and do additional compiler args manipulation
-        for i in ['c', 'cpp']:
-            if i not in self.compile_opts:
-                continue
-
-            temp = []
-            for j in self.compile_opts[i]:
-                m = ConverterTarget.std_regex.match(j)
-                ctgt = output_target_map.generated(j)
-                if m:
-                    std = m.group(2)
-                    supported = self._all_lang_stds(i)
-                    if std not in supported:
-                        mlog.warning(
-                            'Unknown {0}_std "{1}" -> Ignoring. Try setting the project-'
-                            'level {0}_std if build errors occur. Known '
-                            '{0}_stds are: {2}'.format(i, std, ' '.join(supported)),
-                            once=True
-                        )
-                        continue
-                    self.override_options += ['{}_std={}'.format(i, std)]
-                elif j in ['-fPIC', '-fpic', '-fPIE', '-fpie']:
-                    self.pie = True
-                elif isinstance(ctgt, ConverterCustomTarget):
-                    # Sometimes projects pass generated source files as compiler
-                    # flags. Add these as generated sources to ensure that the
-                    # corresponding custom target is run.2
-                    self.generated += [j]
-                    temp += [j]
-                elif j in blacklist_compiler_flags:
-                    pass
-                else:
-                    temp += [j]
-
-            self.compile_opts[i] = temp
-
-        # Make sure to force enable -fPIC for OBJECT libraries
-        if self.type.upper() == 'OBJECT_LIBRARY':
-            self.pie = True
-
-        # Use the CMake trace, if required
-        tgt = trace.targets.get(self.cmake_name)
-        if tgt:
-            self.depends_raw = trace.targets[self.cmake_name].depends
-
-            # TODO refactor this copy paste from CMakeDependency for future releases
-            reg_is_lib = re.compile(r'^(-l[a-zA-Z0-9_]+|-l?pthread)$')
-            to_process = [self.cmake_name]
-            processed = []
-            while len(to_process) > 0:
-                curr = to_process.pop(0)
-
-                if curr in processed or curr not in trace.targets:
-                    continue
-
-                tgt = trace.targets[curr]
-                cfgs = []
-                cfg = ''
-                otherDeps = []
-                libraries = []
-                mlog.debug(tgt)
-
-                if 'INTERFACE_INCLUDE_DIRECTORIES' in tgt.properties:
-                    self.includes += [x for x in tgt.properties['INTERFACE_INCLUDE_DIRECTORIES'] if x]
-
-                if 'INTERFACE_LINK_OPTIONS' in tgt.properties:
-                    self.link_flags += [x for x in tgt.properties['INTERFACE_LINK_OPTIONS'] if x]
-
-                if 'INTERFACE_COMPILE_DEFINITIONS' in tgt.properties:
-                    self.public_compile_opts += ['-D' + re.sub('^-D', '', x) for x in tgt.properties['INTERFACE_COMPILE_DEFINITIONS'] if x]
-
-                if 'INTERFACE_COMPILE_OPTIONS' in tgt.properties:
-                    self.public_compile_opts += [x for x in tgt.properties['INTERFACE_COMPILE_OPTIONS'] if x]
-
-                if 'IMPORTED_CONFIGURATIONS' in tgt.properties:
-                    cfgs += [x for x in tgt.properties['IMPORTED_CONFIGURATIONS'] if x]
-                    cfg = cfgs[0]
-
-                if 'CONFIGURATIONS' in tgt.properties:
-                    cfgs += [x for x in tgt.properties['CONFIGURATIONS'] if x]
-                    cfg = cfgs[0]
-
-                is_debug = self.env.coredata.get_builtin_option('debug');
-                if is_debug:
-                    if 'DEBUG' in cfgs:
-                        cfg = 'DEBUG'
-                    elif 'RELEASE' in cfgs:
-                        cfg = 'RELEASE'
-                else:
-                    if 'RELEASE' in cfgs:
-                        cfg = 'RELEASE'
-
-                if 'IMPORTED_IMPLIB_{}'.format(cfg) in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_IMPLIB_{}'.format(cfg)] if x]
-                elif 'IMPORTED_IMPLIB' in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_IMPLIB'] if x]
-                elif 'IMPORTED_LOCATION_{}'.format(cfg) in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_LOCATION_{}'.format(cfg)] if x]
-                elif 'IMPORTED_LOCATION' in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_LOCATION'] if x]
-
-                if 'LINK_LIBRARIES' in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['LINK_LIBRARIES'] if x]
-
-                if 'INTERFACE_LINK_LIBRARIES' in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['INTERFACE_LINK_LIBRARIES'] if x]
-
-                if 'IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg) in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg)] if x]
-                elif 'IMPORTED_LINK_DEPENDENT_LIBRARIES' in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['IMPORTED_LINK_DEPENDENT_LIBRARIES'] if x]
-
-                for j in otherDeps:
-                    if j in trace.targets:
-                        to_process += [j]
-                    elif reg_is_lib.match(j) or os.path.exists(j):
-                        libraries += [j]
-
-                for j in libraries:
-                    if j not in self.link_libraries:
-                        self.link_libraries += [j]
-
-                processed += [curr]
-        elif self.type.upper() not in ['EXECUTABLE', 'OBJECT_LIBRARY']:
-            mlog.warning('CMake: Target', mlog.bold(self.cmake_name), 'not found in CMake trace. This can lead to build errors')
-
-        temp = []
-        for i in self.link_libraries:
-            # Let meson handle this arcane magic
-            if ',-rpath,' in i:
-                continue
-            if not os.path.isabs(i):
-                link_with = output_target_map.artifact(i)
-                if link_with:
-                    self.link_with += [link_with]
-                    continue
-
-            temp += [i]
-        self.link_libraries = temp
-
-        # Filter out files that are not supported by the language
-        supported = list(header_suffixes) + list(obj_suffixes)
-        for i in self.languages:
-            supported += list(lang_suffixes[i])
-        supported = ['.{}'.format(x) for x in supported]
-        self.sources = [x for x in self.sources if any([x.endswith(y) for y in supported])]
-        self.generated = [x for x in self.generated if any([x.endswith(y) for y in supported])]
-
-        # Make paths relative
-        def rel_path(x: str, is_header: bool, is_generated: bool) -> T.Optional[str]:
-            if not os.path.isabs(x):
-                x = os.path.join(self.src_dir, x)
-            x = os.path.normpath(x)
-            if not os.path.exists(x) and not any([x.endswith(y) for y in obj_suffixes]) and not is_generated:
-                if (
-                    any([os.path.commonpath([x, os.path.normpath(os.path.join(root_src_dir, y))]) == x for y in self.generated])
-                        and os.path.commonpath([x, self.env.get_build_dir()]) == self.env.get_build_dir()
-                    ):
-                    os.makedirs(x)
-                    return os.path.relpath(x, os.path.join(self.env.get_build_dir(), subdir))
-                else:
-                    mlog.warning('CMake: path', mlog.bold(x), 'does not exist.')
-                    mlog.warning(' --> Ignoring. This can lead to build errors.')
-                    return None
-            if Path(x) in trace.explicit_headers:
-                return None
-            if (
-                os.path.isabs(x)
-                    and os.path.commonpath([x, self.env.get_source_dir()]) == self.env.get_source_dir()
-                    and not (
-                        os.path.commonpath([x, root_src_dir]) == root_src_dir or
-                        os.path.commonpath([x, self.env.get_build_dir()]) == self.env.get_build_dir()
-                    )
-                ):
-                mlog.warning('CMake: path', mlog.bold(x), 'is inside the root project but', mlog.bold('not'), 'inside the subproject.')
-                mlog.warning(' --> Ignoring. This can lead to build errors.')
-                return None
-            if os.path.isabs(x) and os.path.commonpath([x, self.env.get_build_dir()]) == self.env.get_build_dir():
-                if is_header:
-                    return os.path.relpath(x, os.path.join(self.env.get_build_dir(), subdir))
-                else:
-                    return os.path.relpath(x, root_src_dir)
-            if os.path.isabs(x) and os.path.commonpath([x, root_src_dir]) == root_src_dir:
-                return os.path.relpath(x, root_src_dir)
-            return x
-
-        def custom_target(x: str):
-            ctgt = output_target_map.generated(x)
-            if ctgt:
-                assert(isinstance(ctgt, ConverterCustomTarget))
-                ref = ctgt.get_ref(x)
-                assert(isinstance(ref, CustomTargetReference) and ref.valid())
-                return ref
-            return x
-
-        build_dir_rel = os.path.relpath(self.build_dir, os.path.join(self.env.get_build_dir(), subdir))
-        self.generated = [rel_path(x, False, True) for x in self.generated]
-        self.includes = list(OrderedSet([rel_path(x, True, False) for x in OrderedSet(self.includes)] + [build_dir_rel]))
-        self.sys_includes = list(OrderedSet([rel_path(x, True, False) for x in OrderedSet(self.sys_includes)]))
-        self.sources = [rel_path(x, False, False) for x in self.sources]
-
-        # Resolve custom targets
-        self.generated = [custom_target(x) for x in self.generated]
-
-        # Remove delete entries
-        self.includes = [x for x in self.includes if x is not None]
-        self.sys_includes = [x for x in self.sys_includes if x is not None]
-        self.sources = [x for x in self.sources if x is not None]
-        self.generated = [x for x in self.generated if x is not None]
-
-        # Make sure '.' is always in the include directories
-        if '.' not in self.includes:
-            self.includes += ['.']
-
-        # make install dir relative to the install prefix
-        if self.install_dir and os.path.isabs(self.install_dir):
-            if os.path.commonpath([self.install_dir, install_prefix]) == install_prefix:
-                self.install_dir = os.path.relpath(self.install_dir, install_prefix)
-
-        # Remove blacklisted options and libs
-        def check_flag(flag: str) -> bool:
-            if flag.lower() in blacklist_link_flags or flag in blacklist_compiler_flags + blacklist_clang_cl_link_flags:
-                return False
-            if flag.startswith('/D'):
-                return False
-            return True
-
-        self.link_libraries = [x for x in self.link_libraries if x.lower() not in blacklist_link_libs]
-        self.link_flags = [x for x in self.link_flags if check_flag(x)]
-
-        # Handle explicit CMake add_dependency() calls
-        for i in self.depends_raw:
-            tgt = output_target_map.target(i)
-            if tgt:
-                self.depends.append(tgt)
-
-    def process_object_libs(self, obj_target_list: T.List['ConverterTarget'], linker_workaround: bool):
-        # Try to detect the object library(s) from the generated input sources
-        temp = [x for x in self.generated if isinstance(x, str)]
-        temp = [os.path.basename(x) for x in temp]
-        temp = [x for x in temp if any([x.endswith('.' + y) for y in obj_suffixes])]
-        temp = [os.path.splitext(x)[0] for x in temp]
-        exts = self._all_source_suffixes()
-        # Temp now stores the source filenames of the object files
-        for i in obj_target_list:
-            source_files = [x for x in i.sources + i.generated if isinstance(x, str)]
-            source_files = [os.path.basename(x) for x in source_files]
-            for j in temp:
-                # On some platforms (specifically looking at you Windows with vs20xy backend) CMake does
-                # not produce object files with the format `foo.cpp.obj`, instead it skipps the language
-                # suffix and just produces object files like `foo.obj`. Thus we have to do our best to
-                # undo this step and guess the correct language suffix of the object file. This is done
-                # by trying all language suffixes meson knows and checking if one of them fits.
-                candidates = [j]  # type: T.List[str]
-                if not any([j.endswith('.' + x) for x in exts]):
-                    mlog.warning('Object files do not contain source file extensions, thus falling back to guessing them.', once=True)
-                    candidates += ['{}.{}'.format(j, x) for x in exts]
-                if any([x in source_files for x in candidates]):
-                    if linker_workaround:
-                        self._append_objlib_sources(i)
-                    else:
-                        self.includes += i.includes
-                        self.includes = list(OrderedSet(self.includes))
-                        self.object_libs += [i]
-                    break
-
-        # Filter out object files from the sources
-        self.generated = [x for x in self.generated if not isinstance(x, str) or not any([x.endswith('.' + y) for y in obj_suffixes])]
-
-    def _append_objlib_sources(self, tgt: 'ConverterTarget') -> None:
-        self.includes += tgt.includes
-        self.sources += tgt.sources
-        self.generated += tgt.generated
-        self.sources = list(OrderedSet(self.sources))
-        self.generated = list(OrderedSet(self.generated))
-        self.includes = list(OrderedSet(self.includes))
-
-        # Inherit compiler arguments since they may be required for building
-        for lang, opts in tgt.compile_opts.items():
-            if lang not in self.compile_opts:
-                self.compile_opts[lang] = []
-            self.compile_opts[lang] += [x for x in opts if x not in self.compile_opts[lang]]
-
-    @lru_cache(maxsize=None)
-    def _all_source_suffixes(self) -> T.List[str]:
-        suffixes = []  # type: T.List[str]
-        for exts in lang_suffixes.values():
-            suffixes += [x for x in exts]
-        return suffixes
-
-    @lru_cache(maxsize=None)
-    def _all_lang_stds(self, lang: str) -> T.List[str]:
-        lang_opts = self.env.coredata.compiler_options.build.get(lang, None)
-        if not lang_opts or 'std' not in lang_opts:
-            return []
-        return lang_opts['std'].choices
-
-    def process_inter_target_dependencies(self):
-        # Move the dependencies from all transfer_dependencies_from to the target
-        to_process = list(self.depends)
-        processed = []
-        new_deps = []
-        for i in to_process:
-            processed += [i]
-            if isinstance(i, ConverterTarget) and i.meson_func() in transfer_dependencies_from:
-                to_process += [x for x in i.depends if x not in processed]
-            else:
-                new_deps += [i]
-        self.depends = list(OrderedSet(new_deps))
-
-    def cleanup_dependencies(self):
-        # Clear the dependencies from targets that where moved from
-        if self.meson_func() in transfer_dependencies_from:
-            self.depends = []
-
-    def meson_func(self) -> str:
-        return target_type_map.get(self.type.upper())
-
-    def log(self) -> None:
-        mlog.log('Target', mlog.bold(self.name), '({})'.format(self.cmake_name))
-        mlog.log('  -- artifacts:      ', mlog.bold(str(self.artifacts)))
-        mlog.log('  -- full_name:      ', mlog.bold(self.full_name))
-        mlog.log('  -- type:           ', mlog.bold(self.type))
-        mlog.log('  -- install:        ', mlog.bold('true' if self.install else 'false'))
-        mlog.log('  -- install_dir:    ', mlog.bold(self.install_dir))
-        mlog.log('  -- link_libraries: ', mlog.bold(str(self.link_libraries)))
-        mlog.log('  -- link_with:      ', mlog.bold(str(self.link_with)))
-        mlog.log('  -- object_libs:    ', mlog.bold(str(self.object_libs)))
-        mlog.log('  -- link_flags:     ', mlog.bold(str(self.link_flags)))
-        mlog.log('  -- languages:      ', mlog.bold(str(self.languages)))
-        mlog.log('  -- includes:       ', mlog.bold(str(self.includes)))
-        mlog.log('  -- sys_includes:   ', mlog.bold(str(self.sys_includes)))
-        mlog.log('  -- sources:        ', mlog.bold(str(self.sources)))
-        mlog.log('  -- generated:      ', mlog.bold(str(self.generated)))
-        mlog.log('  -- pie:            ', mlog.bold('true' if self.pie else 'false'))
-        mlog.log('  -- override_opts:  ', mlog.bold(str(self.override_options)))
-        mlog.log('  -- depends:        ', mlog.bold(str(self.depends)))
-        mlog.log('  -- options:')
-        for key, val in self.compile_opts.items():
-            mlog.log('    -', key, '=', mlog.bold(str(val)))
-
-class CustomTargetReference:
-    def __init__(self, ctgt: 'ConverterCustomTarget', index: int):
-        self.ctgt = ctgt    # type: ConverterCustomTarget
-        self.index = index  # type: int
-
-    def __repr__(self) -> str:
-        if self.valid():
-            return '<{}: {} [{}]>'.format(self.__class__.__name__, self.ctgt.name, self.ctgt.outputs[self.index])
-        else:
-            return '<{}: INVALID REFERENCE>'.format(self.__class__.__name__)
-
-    def valid(self) -> bool:
-        return self.ctgt is not None and self.index >= 0
-
-    def filename(self) -> str:
-        return self.ctgt.outputs[self.index]
-
-class ConverterCustomTarget:
-    tgt_counter = 0  # type: int
-    out_counter = 0  # type: int
-
-    def __init__(self, target: CMakeGeneratorTarget):
-        assert(target.current_bin_dir is not None)
-        assert(target.current_src_dir is not None)
-        self.name = target.name
-        if not self.name:
-            self.name = 'custom_tgt_{}'.format(ConverterCustomTarget.tgt_counter)
-            ConverterCustomTarget.tgt_counter += 1
-        self.cmake_name = str(self.name)
-        self.original_outputs = list(target.outputs)
-        self.outputs = [os.path.basename(x) for x in self.original_outputs]
-        self.conflict_map = {}
-        self.command = target.command
-        self.working_dir = target.working_dir
-        self.depends_raw = target.depends
-        self.inputs = []
-        self.depends = []
-        self.current_bin_dir = Path(target.current_bin_dir)
-        self.current_src_dir = Path(target.current_src_dir)
-
-        # Convert the target name to a valid meson target name
-        self.name = _sanitize_cmake_name(self.name)
-
-    def __repr__(self) -> str:
-        return '<{}: {} {}>'.format(self.__class__.__name__, self.name, self.outputs)
-
-    def postprocess(self, output_target_map: OutputTargetMap, root_src_dir: str, subdir: str, all_outputs: T.List[str], trace: CMakeTraceParser) -> None:
-        # Default the working directory to ${CMAKE_CURRENT_BINARY_DIR}
-        if not self.working_dir:
-            self.working_dir = self.current_bin_dir.as_posix()
-
-        # relative paths in the working directory are always relative
-        # to ${CMAKE_CURRENT_BINARY_DIR}
-        if not os.path.isabs(self.working_dir):
-            self.working_dir = (self.current_bin_dir / self.working_dir).as_posix()
-
-        # Modify the original outputs if they are relative. Again,
-        # relative paths are relative to ${CMAKE_CURRENT_BINARY_DIR}
-        def ensure_absolute(x: Path) -> Path:
-            if x.is_absolute():
-                return x
-            else:
-                return self.current_bin_dir / x
-        self.original_outputs = [ensure_absolute(Path(x)).as_posix() for x in self.original_outputs]
-
-        # Ensure that there is no duplicate output in the project so
-        # that meson can handle cases where the same filename is
-        # generated in multiple directories
-        temp_outputs = []  # type: T.List[str]
-        for i in self.outputs:
-            if i in all_outputs:
-                old = str(i)
-                i = 'c{}_{}'.format(ConverterCustomTarget.out_counter, i)
-                ConverterCustomTarget.out_counter += 1
-                self.conflict_map[old] = i
-            all_outputs += [i]
-            temp_outputs += [i]
-        self.outputs = temp_outputs
-
-        # Check if the command is a build target
-        commands = []
-        for i in self.command:
-            assert(isinstance(i, list))
-            cmd = []
-
-            for j in i:
-                if not j:
-                    continue
-                target = output_target_map.executable(j)
-                if target:
-                    cmd += [target]
-                    continue
-                elif j in trace.targets:
-                    trace_tgt = trace.targets[j]
-                    if trace_tgt.type == 'EXECUTABLE' and 'IMPORTED_LOCATION' in trace_tgt.properties:
-                        cmd += trace_tgt.properties['IMPORTED_LOCATION']
-                        continue
-                    mlog.debug('CMake: Found invalid CMake target "{}" --> ignoring \n{}'.format(j, trace_tgt))
-
-                # Fallthrough on error
-                cmd += [j]
-
-            commands += [cmd]
-        self.command = commands
-
-        # If the custom target does not declare any output, create a dummy
-        # one that can be used as dependency.
-        if not self.outputs:
-            self.outputs = [self.name + '.h']
-
-        # Check dependencies and input files
-        root = Path(root_src_dir)
-        for i in self.depends_raw:
-            if not i:
-                continue
-            raw = Path(i)
-            art = output_target_map.artifact(i)
-            tgt = output_target_map.target(i)
-            gen = output_target_map.generated(i)
-
-            rel_to_root = None
-            try:
-                rel_to_root = raw.relative_to(root)
-            except ValueError:
-                rel_to_root = None
-
-            # First check for existing files. Only then check for existing
-            # targets, etc. This reduces the chance of misdetecting input files
-            # as outputs from other targets.
-            # See https://github.com/mesonbuild/meson/issues/6632
-            if not raw.is_absolute() and (self.current_src_dir / raw).exists():
-                self.inputs += [(self.current_src_dir / raw).relative_to(root).as_posix()]
-            elif raw.is_absolute() and raw.exists() and rel_to_root is not None:
-                self.inputs += [rel_to_root.as_posix()]
-            elif art:
-                self.depends += [art]
-            elif tgt:
-                self.depends += [tgt]
-            elif gen:
-                self.inputs += [gen.get_ref(i)]
-
-    def process_inter_target_dependencies(self):
-        # Move the dependencies from all transfer_dependencies_from to the target
-        to_process = list(self.depends)
-        processed = []
-        new_deps = []
-        for i in to_process:
-            processed += [i]
-            if isinstance(i, ConverterTarget) and i.meson_func() in transfer_dependencies_from:
-                to_process += [x for x in i.depends if x not in processed]
-            else:
-                new_deps += [i]
-        self.depends = list(OrderedSet(new_deps))
-
-    def get_ref(self, fname: str) -> T.Optional[CustomTargetReference]:
-        fname = os.path.basename(fname)
-        try:
-            if fname in self.conflict_map:
-                fname = self.conflict_map[fname]
-            idx = self.outputs.index(fname)
-            return CustomTargetReference(self, idx)
-        except ValueError:
-            return None
-
-    def log(self) -> None:
-        mlog.log('Custom Target', mlog.bold(self.name), '({})'.format(self.cmake_name))
-        mlog.log('  -- command:      ', mlog.bold(str(self.command)))
-        mlog.log('  -- outputs:      ', mlog.bold(str(self.outputs)))
-        mlog.log('  -- conflict_map: ', mlog.bold(str(self.conflict_map)))
-        mlog.log('  -- working_dir:  ', mlog.bold(str(self.working_dir)))
-        mlog.log('  -- depends_raw:  ', mlog.bold(str(self.depends_raw)))
-        mlog.log('  -- inputs:       ', mlog.bold(str(self.inputs)))
-        mlog.log('  -- depends:      ', mlog.bold(str(self.depends)))
-
-class CMakeAPI(Enum):
-    SERVER = 1
-    FILE = 2
-
-class CMakeInterpreter:
-    def __init__(self, build: 'Build', subdir: str, src_dir: str, install_prefix: str, env: Environment, backend: 'Backend'):
-        assert(hasattr(backend, 'name'))
-        self.build = build
-        self.subdir = subdir
-        self.src_dir = src_dir
-        self.build_dir_rel = os.path.join(subdir, '__CMake_build')
-        self.build_dir = os.path.join(env.get_build_dir(), self.build_dir_rel)
-        self.install_prefix = install_prefix
-        self.env = env
-        self.backend_name = backend.name
-        self.linkers = set()  # type: T.Set[str]
-        self.cmake_api = CMakeAPI.SERVER
-        self.client = CMakeClient(self.env)
-        self.fileapi = CMakeFileAPI(self.build_dir)
-
-        # Raw CMake results
-        self.bs_files = []
-        self.codemodel_configs = None
-        self.raw_trace = None
-
-        # Analysed data
-        self.project_name = ''
-        self.languages = []
-        self.targets = []
-        self.custom_targets = []  # type: T.List[ConverterCustomTarget]
-        self.trace = CMakeTraceParser('', '')  # Will be replaced in analyse
-        self.output_target_map = OutputTargetMap(self.build_dir)
-
-        # Generated meson data
-        self.generated_targets = {}
-        self.internal_name_map = {}
-
-    def configure(self, extra_cmake_options: T.List[str]) -> None:
-        for_machine = MachineChoice.HOST # TODO make parameter
-        # Find CMake
-        cmake_exe = CMakeExecutor(self.env, '>=3.7', for_machine)
-        if not cmake_exe.found():
-            raise CMakeException('Unable to find CMake')
-        self.trace = CMakeTraceParser(cmake_exe.version(), self.build_dir, permissive=True)
-
-        preload_file = mesondata['cmake/data/preload.cmake'].write_to_private(self.env)
-
-        # Prefere CMAKE_PROJECT_INCLUDE over CMAKE_TOOLCHAIN_FILE if possible,
-        # since CMAKE_PROJECT_INCLUDE was actually designed for code injection.
-        preload_var = 'CMAKE_PROJECT_INCLUDE'
-        if version_compare(cmake_exe.version(), '<3.15'):
-            preload_var = 'CMAKE_TOOLCHAIN_FILE'
-
-        generator = backend_generator_map[self.backend_name]
-        cmake_args = []
-        trace_args = self.trace.trace_args()
-        cmcmp_args = ['-DCMAKE_POLICY_WARNING_{}=OFF'.format(x) for x in disable_policy_warnings]
-        pload_args = ['-D{}={}'.format(preload_var, str(preload_file))]
-
-        if version_compare(cmake_exe.version(), '>=3.14'):
-            self.cmake_api = CMakeAPI.FILE
-            self.fileapi.setup_request()
-
-        # Map meson compiler to CMake variables
-        for lang, comp in self.env.coredata.compilers[for_machine].items():
-            if lang not in language_map:
-                continue
-            self.linkers.add(comp.get_linker_id())
-            cmake_lang = language_map[lang]
-            exelist = comp.get_exelist()
-            if len(exelist) == 1:
-                cmake_args += ['-DCMAKE_{}_COMPILER={}'.format(cmake_lang, exelist[0])]
-            elif len(exelist) == 2:
-                cmake_args += ['-DCMAKE_{}_COMPILER_LAUNCHER={}'.format(cmake_lang, exelist[0]),
-                               '-DCMAKE_{}_COMPILER={}'.format(cmake_lang, exelist[1])]
-            if hasattr(comp, 'get_linker_exelist') and comp.get_id() == 'clang-cl':
-                cmake_args += ['-DCMAKE_LINKER={}'.format(comp.get_linker_exelist()[0])]
-        cmake_args += ['-G', generator]
-        cmake_args += ['-DCMAKE_INSTALL_PREFIX={}'.format(self.install_prefix)]
-        cmake_args += extra_cmake_options
-
-        # Run CMake
-        mlog.log()
-        with mlog.nested():
-            mlog.log('Configuring the build directory with', mlog.bold('CMake'), 'version', mlog.cyan(cmake_exe.version()))
-            mlog.log(mlog.bold('Running:'), ' '.join(cmake_args))
-            mlog.log(mlog.bold('  - build directory:         '), self.build_dir)
-            mlog.log(mlog.bold('  - source directory:        '), self.src_dir)
-            mlog.log(mlog.bold('  - trace args:              '), ' '.join(trace_args))
-            mlog.log(mlog.bold('  - preload file:            '), str(preload_file))
-            mlog.log(mlog.bold('  - disabled policy warnings:'), '[{}]'.format(', '.join(disable_policy_warnings)))
-            mlog.log()
-            os.makedirs(self.build_dir, exist_ok=True)
-            os_env = os.environ.copy()
-            os_env['LC_ALL'] = 'C'
-            final_args = cmake_args + trace_args + cmcmp_args + pload_args + [self.src_dir]
-
-            cmake_exe.set_exec_mode(print_cmout=True, always_capture_stderr=self.trace.requires_stderr())
-            rc, _, self.raw_trace = cmake_exe.call(final_args, self.build_dir, env=os_env, disable_cache=True)
-
-        mlog.log()
-        h = mlog.green('SUCCEEDED') if rc == 0 else mlog.red('FAILED')
-        mlog.log('CMake configuration:', h)
-        if rc != 0:
-            raise CMakeException('Failed to configure the CMake subproject')
-
-    def initialise(self, extra_cmake_options: T.List[str]) -> None:
-        # Run configure the old way because doing it
-        # with the server doesn't work for some reason
-        # Additionally, the File API requires a configure anyway
-        self.configure(extra_cmake_options)
-
-        # Continue with the file API If supported
-        if self.cmake_api is CMakeAPI.FILE:
-            # Parse the result
-            self.fileapi.load_reply()
-
-            # Load the buildsystem file list
-            cmake_files = self.fileapi.get_cmake_sources()
-            self.bs_files = [x.file for x in cmake_files if not x.is_cmake and not x.is_temp]
-            self.bs_files = [os.path.relpath(x, self.env.get_source_dir()) for x in self.bs_files]
-            self.bs_files = list(OrderedSet(self.bs_files))
-
-            # Load the codemodel configurations
-            self.codemodel_configs = self.fileapi.get_cmake_configurations()
-            return
-
-        with self.client.connect():
-            generator = backend_generator_map[self.backend_name]
-            self.client.do_handshake(self.src_dir, self.build_dir, generator, 1)
-
-            # Do a second configure to initialise the server
-            self.client.query_checked(RequestConfigure(), 'CMake server configure')
-
-            # Generate the build system files
-            self.client.query_checked(RequestCompute(), 'Generating build system files')
-
-            # Get CMake build system files
-            bs_reply = self.client.query_checked(RequestCMakeInputs(), 'Querying build system files')
-
-            # Now get the CMake code model
-            cm_reply = self.client.query_checked(RequestCodeModel(), 'Querying the CMake code model')
-
-        src_dir = bs_reply.src_dir
-        self.bs_files = [x.file for x in bs_reply.build_files if not x.is_cmake and not x.is_temp]
-        self.bs_files = [os.path.relpath(os.path.join(src_dir, x), self.env.get_source_dir()) for x in self.bs_files]
-        self.bs_files = list(OrderedSet(self.bs_files))
-        self.codemodel_configs = cm_reply.configs
-
-    def analyse(self) -> None:
-        if self.codemodel_configs is None:
-            raise CMakeException('CMakeInterpreter was not initialized')
-
-        # Clear analyser data
-        self.project_name = ''
-        self.languages = []
-        self.targets = []
-        self.custom_targets = []
-
-        # Parse the trace
-        self.trace.parse(self.raw_trace)
-
-        # Find all targets
-        added_target_names = []  # type: T.List[str]
-        for i in self.codemodel_configs:
-            for j in i.projects:
-                if not self.project_name:
-                    self.project_name = j.name
-                for k in j.targets:
-                    # Avoid duplicate targets from different configurations and known
-                    # dummy CMake internal target types
-                    if k.type not in skip_targets and k.name not in added_target_names:
-                        added_target_names += [k.name]
-                        self.targets += [ConverterTarget(k, self.env)]
-
-        # Add interface targets from trace, if not already present.
-        # This step is required because interface targets were removed from
-        # the CMake file API output.
-        api_target_name_list = [x.name for x in self.targets]
-        for i in self.trace.targets.values():
-            if i.type != 'INTERFACE' or i.name in api_target_name_list or i.imported:
-                continue
-            dummy = CMakeTarget({
-                'name': i.name,
-                'type': 'INTERFACE_LIBRARY',
-                'sourceDirectory': self.src_dir,
-                'buildDirectory': self.build_dir,
-            })
-            self.targets += [ConverterTarget(dummy, self.env)]
-
-        for i in self.trace.custom_targets:
-            self.custom_targets += [ConverterCustomTarget(i)]
-
-        # generate the output_target_map
-        for i in [*self.targets, *self.custom_targets]:
-            self.output_target_map.add(i)
-
-        # First pass: Basic target cleanup
-        object_libs = []
-        custom_target_outputs = []  # type: T.List[str]
-        for i in self.custom_targets:
-            i.postprocess(self.output_target_map, self.src_dir, self.subdir, custom_target_outputs, self.trace)
-        for i in self.targets:
-            i.postprocess(self.output_target_map, self.src_dir, self.subdir, self.install_prefix, self.trace)
-            if i.type == 'OBJECT_LIBRARY':
-                object_libs += [i]
-            self.languages += [x for x in i.languages if x not in self.languages]
-
-        # Second pass: Detect object library dependencies
-        for i in self.targets:
-            i.process_object_libs(object_libs, self._object_lib_workaround())
-
-        # Third pass: Reassign dependencies to avoid some loops
-        for i in self.targets:
-            i.process_inter_target_dependencies()
-        for i in self.custom_targets:
-            i.process_inter_target_dependencies()
-
-        # Fourth pass: Remove rassigned dependencies
-        for i in self.targets:
-            i.cleanup_dependencies()
-
-        mlog.log('CMake project', mlog.bold(self.project_name), 'has', mlog.bold(str(len(self.targets) + len(self.custom_targets))), 'build targets.')
-
-    def pretend_to_be_meson(self, options: TargetOptions) -> CodeBlockNode:
-        if not self.project_name:
-            raise CMakeException('CMakeInterpreter was not analysed')
-
-        def token(tid: str = 'string', val='') -> Token:
-            return Token(tid, self.subdir, 0, 0, 0, None, val)
-
-        def string(value: str) -> StringNode:
-            return StringNode(token(val=value))
-
-        def id_node(value: str) -> IdNode:
-            return IdNode(token(val=value))
-
-        def number(value: int) -> NumberNode:
-            return NumberNode(token(val=value))
-
-        def nodeify(value):
-            if isinstance(value, str):
-                return string(value)
-            elif isinstance(value, bool):
-                return BooleanNode(token(val=value))
-            elif isinstance(value, int):
-                return number(value)
-            elif isinstance(value, list):
-                return array(value)
-            return value
-
-        def indexed(node: BaseNode, index: int) -> IndexNode:
-            return IndexNode(node, nodeify(index))
-
-        def array(elements) -> ArrayNode:
-            args = ArgumentNode(token())
-            if not isinstance(elements, list):
-                elements = [args]
-            args.arguments += [nodeify(x) for x in elements if x is not None]
-            return ArrayNode(args, 0, 0, 0, 0)
-
-        def function(name: str, args=None, kwargs=None) -> FunctionNode:
-            args = [] if args is None else args
-            kwargs = {} if kwargs is None else kwargs
-            args_n = ArgumentNode(token())
-            if not isinstance(args, list):
-                args = [args]
-            args_n.arguments = [nodeify(x) for x in args if x is not None]
-            args_n.kwargs = {id_node(k): nodeify(v) for k, v in kwargs.items() if v is not None}
-            func_n = FunctionNode(self.subdir, 0, 0, 0, 0, name, args_n)
-            return func_n
-
-        def method(obj: BaseNode, name: str, args=None, kwargs=None) -> MethodNode:
-            args = [] if args is None else args
-            kwargs = {} if kwargs is None else kwargs
-            args_n = ArgumentNode(token())
-            if not isinstance(args, list):
-                args = [args]
-            args_n.arguments = [nodeify(x) for x in args if x is not None]
-            args_n.kwargs = {id_node(k): nodeify(v) for k, v in kwargs.items() if v is not None}
-            return MethodNode(self.subdir, 0, 0, obj, name, args_n)
-
-        def assign(var_name: str, value: BaseNode) -> AssignmentNode:
-            return AssignmentNode(self.subdir, 0, 0, var_name, value)
-
-        # Generate the root code block and the project function call
-        root_cb = CodeBlockNode(token())
-        root_cb.lines += [function('project', [self.project_name] + self.languages)]
-
-        # Add the run script for custom commands
-
-        # Add the targets
-        processing = []
-        processed = {}
-        name_map = {}
-
-        def extract_tgt(tgt: T.Union[ConverterTarget, ConverterCustomTarget, CustomTargetReference]) -> IdNode:
-            tgt_name = None
-            if isinstance(tgt, (ConverterTarget, ConverterCustomTarget)):
-                tgt_name = tgt.name
-            elif isinstance(tgt, CustomTargetReference):
-                tgt_name = tgt.ctgt.name
-            assert(tgt_name is not None and tgt_name in processed)
-            res_var = processed[tgt_name]['tgt']
-            return id_node(res_var) if res_var else None
-
-        def detect_cycle(tgt: T.Union[ConverterTarget, ConverterCustomTarget]) -> None:
-            if tgt.name in processing:
-                raise CMakeException('Cycle in CMake inputs/dependencies detected')
-            processing.append(tgt.name)
-
-        def resolve_ctgt_ref(ref: CustomTargetReference) -> BaseNode:
-            tgt_var = extract_tgt(ref)
-            if len(ref.ctgt.outputs) == 1:
-                return tgt_var
-            else:
-                return indexed(tgt_var, ref.index)
-
-        def process_target(tgt: ConverterTarget):
-            detect_cycle(tgt)
-
-            # First handle inter target dependencies
-            link_with = []
-            objec_libs = []  # type: T.List[IdNode]
-            sources = []
-            generated = []
-            generated_filenames = []
-            custom_targets = []
-            dependencies = []
-            for i in tgt.link_with:
-                assert(isinstance(i, ConverterTarget))
-                if i.name not in processed:
-                    process_target(i)
-                link_with += [extract_tgt(i)]
-            for i in tgt.object_libs:
-                assert(isinstance(i, ConverterTarget))
-                if i.name not in processed:
-                    process_target(i)
-                objec_libs += [extract_tgt(i)]
-            for i in tgt.depends:
-                if not isinstance(i, ConverterCustomTarget):
-                    continue
-                if i.name not in processed:
-                    process_custom_target(i)
-                dependencies += [extract_tgt(i)]
-
-            # Generate the source list and handle generated sources
-            for i in tgt.sources + tgt.generated:
-                if isinstance(i, CustomTargetReference):
-                    if i.ctgt.name not in processed:
-                        process_custom_target(i.ctgt)
-                    generated += [resolve_ctgt_ref(i)]
-                    generated_filenames += [i.filename()]
-                    if i.ctgt not in custom_targets:
-                        custom_targets += [i.ctgt]
-                else:
-                    sources += [i]
-
-            # Add all header files from all used custom targets. This
-            # ensures that all custom targets are built before any
-            # sources of the current target are compiled and thus all
-            # header files are present. This step is necessary because
-            # CMake always ensures that a custom target is executed
-            # before another target if at least one output is used.
-            for i in custom_targets:
-                for j in i.outputs:
-                    if not is_header(j) or j in generated_filenames:
-                        continue
-
-                    generated += [resolve_ctgt_ref(i.get_ref(j))]
-                    generated_filenames += [j]
-
-            # Determine the meson function to use for the build target
-            tgt_func = tgt.meson_func()
-            if not tgt_func:
-                raise CMakeException('Unknown target type "{}"'.format(tgt.type))
-
-            # Determine the variable names
-            inc_var = '{}_inc'.format(tgt.name)
-            dir_var = '{}_dir'.format(tgt.name)
-            sys_var = '{}_sys'.format(tgt.name)
-            src_var = '{}_src'.format(tgt.name)
-            dep_var = '{}_dep'.format(tgt.name)
-            tgt_var = tgt.name
-
-            install_tgt = options.get_install(tgt.cmake_name, tgt.install)
-
-            # Generate target kwargs
-            tgt_kwargs = {
-                'build_by_default': install_tgt,
-                'link_args': options.get_link_args(tgt.cmake_name, tgt.link_flags + tgt.link_libraries),
-                'link_with': link_with,
-                'include_directories': id_node(inc_var),
-                'install': install_tgt,
-                'override_options': options.get_override_options(tgt.cmake_name, tgt.override_options),
-                'objects': [method(x, 'extract_all_objects') for x in objec_libs],
-            }
-
-            # Only set if installed and only override if it is set
-            if install_tgt and tgt.install_dir:
-                tgt_kwargs['install_dir'] = tgt.install_dir
-
-            # Handle compiler args
-            for key, val in tgt.compile_opts.items():
-                tgt_kwargs['{}_args'.format(key)] = options.get_compile_args(tgt.cmake_name, key, val)
-
-            # Handle -fPCI, etc
-            if tgt_func == 'executable':
-                tgt_kwargs['pie'] = tgt.pie
-            elif tgt_func == 'static_library':
-                tgt_kwargs['pic'] = tgt.pie
-
-            # declare_dependency kwargs
-            dep_kwargs = {
-                'link_args': tgt.link_flags + tgt.link_libraries,
-                'link_with': id_node(tgt_var),
-                'compile_args': tgt.public_compile_opts,
-                'include_directories': id_node(inc_var),
-            }
-
-            if dependencies:
-                generated += dependencies
-
-            # Generate the function nodes
-            dir_node = assign(dir_var, function('include_directories', tgt.includes))
-            sys_node = assign(sys_var, function('include_directories', tgt.sys_includes, {'is_system': True}))
-            inc_node = assign(inc_var, array([id_node(dir_var), id_node(sys_var)]))
-            node_list = [dir_node, sys_node, inc_node]
-            if tgt_func == 'header_only':
-                del dep_kwargs['link_with']
-                dep_node = assign(dep_var, function('declare_dependency', kwargs=dep_kwargs))
-                node_list += [dep_node]
-                src_var = None
-                tgt_var = None
-            else:
-                src_node = assign(src_var, function('files', sources))
-                tgt_node = assign(tgt_var, function(tgt_func, [tgt_var, [id_node(src_var)] + generated], tgt_kwargs))
-                node_list += [src_node, tgt_node]
-                if tgt_func in ['static_library', 'shared_library']:
-                    dep_node = assign(dep_var, function('declare_dependency', kwargs=dep_kwargs))
-                    node_list += [dep_node]
-                elif tgt_func in ['shared_module']:
-                    del dep_kwargs['link_with']
-                    dep_node = assign(dep_var, function('declare_dependency', kwargs=dep_kwargs))
-                    node_list += [dep_node]
-                else:
-                    dep_var = None
-
-            # Add the nodes to the ast
-            root_cb.lines += node_list
-            processed[tgt.name] = {'inc': inc_var, 'src': src_var, 'dep': dep_var, 'tgt': tgt_var, 'func': tgt_func}
-            name_map[tgt.cmake_name] = tgt.name
-
-        def process_custom_target(tgt: ConverterCustomTarget) -> None:
-            # CMake allows to specify multiple commands in a custom target.
-            # To map this to meson, a helper script is used to execute all
-            # commands in order. This additionally allows setting the working
-            # directory.
-
-            detect_cycle(tgt)
-            tgt_var = tgt.name  # type: str
-
-            def resolve_source(x: T.Any) -> T.Any:
-                if isinstance(x, ConverterTarget):
-                    if x.name not in processed:
-                        process_target(x)
-                    return extract_tgt(x)
-                if isinstance(x, ConverterCustomTarget):
-                    if x.name not in processed:
-                        process_custom_target(x)
-                    return extract_tgt(x)
-                elif isinstance(x, CustomTargetReference):
-                    if x.ctgt.name not in processed:
-                        process_custom_target(x.ctgt)
-                    return resolve_ctgt_ref(x)
-                else:
-                    return x
-
-            # Generate the command list
-            command = []
-            command += mesonlib.meson_command
-            command += ['--internal', 'cmake_run_ctgt']
-            command += ['-o', '@OUTPUT@']
-            if tgt.original_outputs:
-                command += ['-O'] + tgt.original_outputs
-            command += ['-d', tgt.working_dir]
-
-            # Generate the commands. Subcommands are separated by ';;;'
-            for cmd in tgt.command:
-                command += [resolve_source(x) for x in cmd] + [';;;']
-
-            tgt_kwargs = {
-                'input': [resolve_source(x) for x in tgt.inputs],
-                'output': tgt.outputs,
-                'command': command,
-                'depends': [resolve_source(x) for x in tgt.depends],
-            }
-
-            root_cb.lines += [assign(tgt_var, function('custom_target', [tgt.name], tgt_kwargs))]
-            processed[tgt.name] = {'inc': None, 'src': None, 'dep': None, 'tgt': tgt_var, 'func': 'custom_target'}
-            name_map[tgt.cmake_name] = tgt.name
-
-        # Now generate the target function calls
-        for i in self.custom_targets:
-            if i.name not in processed:
-                process_custom_target(i)
-        for i in self.targets:
-            if i.name not in processed:
-                process_target(i)
-
-        self.generated_targets = processed
-        self.internal_name_map = name_map
-        return root_cb
-
-    def target_info(self, target: str) -> T.Optional[T.Dict[str, str]]:
-        # Try resolving the target name
-        # start by checking if there is a 100% match (excluding the name prefix)
-        prx_tgt = _sanitize_cmake_name(target)
-        if prx_tgt in self.generated_targets:
-            return self.generated_targets[prx_tgt]
-        # check if there exists a name mapping
-        if target in self.internal_name_map:
-            target = self.internal_name_map[target]
-            assert(target in self.generated_targets)
-            return self.generated_targets[target]
-        return None
-
-    def target_list(self) -> T.List[str]:
-        return list(self.internal_name_map.keys())
-
-    def _object_lib_workaround(self) -> bool:
-        return 'link' in self.linkers and self.backend_name.startswith('vs')
diff --git a/meson/mesonbuild/cmake/traceparser.py b/meson/mesonbuild/cmake/traceparser.py
deleted file mode 100644 (file)
index 98b56f5..0000000
+++ /dev/null
@@ -1,702 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from .common import CMakeException
-from .generator import parse_generator_expressions
-from .. import mlog
-from ..mesonlib import version_compare
-
-import typing as T
-from pathlib import Path
-import re
-import os
-import json
-import textwrap
-
-class CMakeTraceLine:
-    def __init__(self, file, line, func, args):
-        self.file = file
-        self.line = line
-        self.func = func.lower()
-        self.args = args
-
-    def __repr__(self):
-        s = 'CMake TRACE: {0}:{1} {2}({3})'
-        return s.format(self.file, self.line, self.func, self.args)
-
-class CMakeTarget:
-    def __init__(self, name, target_type, properties=None, imported: bool = False, tline: T.Optional[CMakeTraceLine] = None):
-        if properties is None:
-            properties = {}
-        self.name = name
-        self.type = target_type
-        self.properties = properties
-        self.imported = imported
-        self.tline = tline
-        self.depends = []
-        self.current_bin_dir = None
-        self.current_src_dir = None
-
-    def __repr__(self):
-        s = 'CMake TARGET:\n  -- name:      {}\n  -- type:      {}\n  -- imported:  {}\n  -- properties: {{\n{}     }}\n  -- tline: {}'
-        propSTR = ''
-        for i in self.properties:
-            propSTR += "      '{}': {}\n".format(i, self.properties[i])
-        return s.format(self.name, self.type, self.imported, propSTR, self.tline)
-
-    def strip_properties(self) -> None:
-        # Strip the strings in the properties
-        if not self.properties:
-            return
-        for key, val in self.properties.items():
-            self.properties[key] = [x.strip() for x in val]
-            assert all([';' not in x for x in self.properties[key]])
-
-class CMakeGeneratorTarget(CMakeTarget):
-    def __init__(self, name):
-        super().__init__(name, 'CUSTOM', {})
-        self.outputs = []        # type: T.List[str]
-        self.command = []        # type: T.List[T.List[str]]
-        self.working_dir = None  # type: T.Optional[str]
-
-class CMakeTraceParser:
-    def __init__(self, cmake_version: str, build_dir: str, permissive: bool = True):
-        self.vars = {}     # type: T.Dict[str, T.List[str]]
-        self.targets = {}  # type: T.Dict[str, CMakeTarget]
-
-        self.explicit_headers = set()  # type: T.Set[Path]
-
-        # T.List of targes that were added with add_custom_command to generate files
-        self.custom_targets = []  # type: T.List[CMakeGeneratorTarget]
-
-        self.permissive = permissive  # type: bool
-        self.cmake_version = cmake_version  # type: str
-        self.trace_file = 'cmake_trace.txt'
-        self.trace_file_path = Path(build_dir) / self.trace_file
-        self.trace_format = 'json-v1' if version_compare(cmake_version, '>=3.17') else 'human'
-
-        # State for delayed command execution. Delayed command execution is realised
-        # with a custom CMake file that overrides some functions and adds some
-        # introspection information to the trace.
-        self.delayed_commands = []  # type: T.List[str]
-        self.stored_commands = []   # type: T.List[CMakeTraceLine]
-
-        # All supported functions
-        self.functions = {
-            'set': self._cmake_set,
-            'unset': self._cmake_unset,
-            'add_executable': self._cmake_add_executable,
-            'add_library': self._cmake_add_library,
-            'add_custom_command': self._cmake_add_custom_command,
-            'add_custom_target': self._cmake_add_custom_target,
-            'set_property': self._cmake_set_property,
-            'set_target_properties': self._cmake_set_target_properties,
-            'target_compile_definitions': self._cmake_target_compile_definitions,
-            'target_compile_options': self._cmake_target_compile_options,
-            'target_include_directories': self._cmake_target_include_directories,
-            'target_link_libraries': self._cmake_target_link_libraries,
-            'target_link_options': self._cmake_target_link_options,
-            'add_dependencies': self._cmake_add_dependencies,
-
-            # Special functions defined in the preload script.
-            # These functions do nothing in the CMake code, but have special
-            # meaning here in the trace parser.
-            'meson_ps_execute_delayed_calls': self._meson_ps_execute_delayed_calls,
-            'meson_ps_reload_vars': self._meson_ps_reload_vars,
-        }
-
-    def trace_args(self) -> T.List[str]:
-        arg_map = {
-            'human': ['--trace', '--trace-expand'],
-            'json-v1': ['--trace-expand', '--trace-format=json-v1'],
-        }
-
-        base_args = ['--no-warn-unused-cli']
-        if not self.requires_stderr():
-            base_args += ['--trace-redirect={}'.format(self.trace_file)]
-
-        return arg_map[self.trace_format] + base_args
-
-    def requires_stderr(self) -> bool:
-        return version_compare(self.cmake_version, '<3.16')
-
-    def parse(self, trace: T.Optional[str] = None) -> None:
-        # First load the trace (if required)
-        if not self.requires_stderr():
-            if not self.trace_file_path.exists and not self.trace_file_path.is_file():
-                raise CMakeException('CMake: Trace file "{}" not found'.format(str(self.trace_file_path)))
-            trace = self.trace_file_path.read_text(errors='ignore')
-        if not trace:
-            raise CMakeException('CMake: The CMake trace was not provided or is empty')
-
-        # Second parse the trace
-        lexer1 = None
-        if self.trace_format == 'human':
-            lexer1 = self._lex_trace_human(trace)
-        elif self.trace_format == 'json-v1':
-            lexer1 = self._lex_trace_json(trace)
-        else:
-            raise CMakeException('CMake: Internal error: Invalid trace format {}. Expected [human, json-v1]'.format(self.trace_format))
-
-        # Primary pass -- parse everything
-        for l in lexer1:
-            # store the function if its execution should be delayed
-            if l.func in self.delayed_commands:
-                self.stored_commands += [l]
-                continue
-
-            # "Execute" the CMake function if supported
-            fn = self.functions.get(l.func, None)
-            if(fn):
-                fn(l)
-
-        # Postprocess
-        for tgt in self.targets.values():
-            tgt.strip_properties()
-
-    def get_first_cmake_var_of(self, var_list: T.List[str]) -> T.List[str]:
-        # Return the first found CMake variable in list var_list
-        for i in var_list:
-            if i in self.vars:
-                return self.vars[i]
-
-        return []
-
-    def get_cmake_var(self, var: str) -> T.List[str]:
-        # Return the value of the CMake variable var or an empty list if var does not exist
-        if var in self.vars:
-            return self.vars[var]
-
-        return []
-
-    def var_to_str(self, var: str) -> T.Optional[str]:
-        if var in self.vars and self.vars[var]:
-            return self.vars[var][0]
-
-        return None
-
-    def _str_to_bool(self, expr: T.Union[str, T.List[str]]) -> bool:
-        if not expr:
-            return False
-        if isinstance(expr, list):
-            expr_str = expr[0]
-        else:
-            expr_str = expr
-        expr_str = expr_str.upper()
-        return expr_str not in ['0', 'OFF', 'NO', 'FALSE', 'N', 'IGNORE'] and not expr_str.endswith('NOTFOUND')
-
-    def var_to_bool(self, var: str) -> bool:
-        return self._str_to_bool(self.vars.get(var, []))
-
-    def _gen_exception(self, function: str, error: str, tline: CMakeTraceLine) -> None:
-        # Generate an exception if the parser is not in permissive mode
-
-        if self.permissive:
-            mlog.debug('CMake trace warning: {}() {}\n{}'.format(function, error, tline))
-            return None
-        raise CMakeException('CMake: {}() {}\n{}'.format(function, error, tline))
-
-    def _cmake_set(self, tline: CMakeTraceLine) -> None:
-        """Handler for the CMake set() function in all variaties.
-
-        comes in three flavors:
-        set(<var> <value> [PARENT_SCOPE])
-        set(<var> <value> CACHE <type> <docstring> [FORCE])
-        set(ENV{<var>} <value>)
-
-        We don't support the ENV variant, and any uses of it will be ignored
-        silently. the other two variates are supported, with some caveats:
-        - we don't properly handle scoping, so calls to set() inside a
-          function without PARENT_SCOPE set could incorrectly shadow the
-          outer scope.
-        - We don't honor the type of CACHE arguments
-        """
-        # DOC: https://cmake.org/cmake/help/latest/command/set.html
-
-        # 1st remove PARENT_SCOPE and CACHE from args
-        args = []
-        for i in tline.args:
-            if not i or i == 'PARENT_SCOPE':
-                continue
-
-            # Discard everything after the CACHE keyword
-            if i == 'CACHE':
-                break
-
-            args.append(i)
-
-        if len(args) < 1:
-            return self._gen_exception('set', 'requires at least one argument', tline)
-
-        # Now that we've removed extra arguments all that should be left is the
-        # variable identifier and the value, join the value back together to
-        # ensure spaces in the value are correctly handled. This assumes that
-        # variable names don't have spaces. Please don't do that...
-        identifier = args.pop(0)
-        value = ' '.join(args)
-
-        if not value:
-            # Same as unset
-            if identifier in self.vars:
-                del self.vars[identifier]
-        else:
-            self.vars[identifier] = value.split(';')
-
-    def _cmake_unset(self, tline: CMakeTraceLine):
-        # DOC: https://cmake.org/cmake/help/latest/command/unset.html
-        if len(tline.args) < 1:
-            return self._gen_exception('unset', 'requires at least one argument', tline)
-
-        if tline.args[0] in self.vars:
-            del self.vars[tline.args[0]]
-
-    def _cmake_add_executable(self, tline: CMakeTraceLine):
-        # DOC: https://cmake.org/cmake/help/latest/command/add_executable.html
-        args = list(tline.args) # Make a working copy
-
-        # Make sure the exe is imported
-        is_imported = True
-        if 'IMPORTED' not in args:
-            return self._gen_exception('add_executable', 'non imported executables are not supported', tline)
-
-        args.remove('IMPORTED')
-
-        if len(args) < 1:
-            return self._gen_exception('add_executable', 'requires at least 1 argument', tline)
-
-        self.targets[args[0]] = CMakeTarget(args[0], 'EXECUTABLE', {}, tline=tline, imported=is_imported)
-
-    def _cmake_add_library(self, tline: CMakeTraceLine):
-        # DOC: https://cmake.org/cmake/help/latest/command/add_library.html
-        args = list(tline.args) # Make a working copy
-
-        # Make sure the lib is imported
-        if 'INTERFACE' in args:
-            args.remove('INTERFACE')
-
-            if len(args) < 1:
-                return self._gen_exception('add_library', 'interface library name not specified', tline)
-
-            self.targets[args[0]] = CMakeTarget(args[0], 'INTERFACE', {}, tline=tline, imported='IMPORTED' in args)
-        elif 'IMPORTED' in args:
-            args.remove('IMPORTED')
-
-            # Now, only look at the first two arguments (target_name and target_type) and ignore the rest
-            if len(args) < 2:
-                return self._gen_exception('add_library', 'requires at least 2 arguments', tline)
-
-            self.targets[args[0]] = CMakeTarget(args[0], args[1], {}, tline=tline, imported=True)
-        elif 'ALIAS' in args:
-            args.remove('ALIAS')
-
-            # Now, only look at the first two arguments (target_name and target_ref) and ignore the rest
-            if len(args) < 2:
-                return self._gen_exception('add_library', 'requires at least 2 arguments', tline)
-
-            # Simulate the ALIAS with INTERFACE_LINK_LIBRARIES
-            self.targets[args[0]] = CMakeTarget(args[0], 'ALIAS', {'INTERFACE_LINK_LIBRARIES': [args[1]]}, tline=tline)
-        elif 'OBJECT' in args:
-            return self._gen_exception('add_library', 'OBJECT libraries are not supported', tline)
-        else:
-            self.targets[args[0]] = CMakeTarget(args[0], 'NORMAL', {}, tline=tline)
-
-    def _cmake_add_custom_command(self, tline: CMakeTraceLine, name=None):
-        # DOC: https://cmake.org/cmake/help/latest/command/add_custom_command.html
-        args = self._flatten_args(list(tline.args))  # Commands can be passed as ';' seperated lists
-
-        if not args:
-            return self._gen_exception('add_custom_command', 'requires at least 1 argument', tline)
-
-        # Skip the second function signature
-        if args[0] == 'TARGET':
-            return self._gen_exception('add_custom_command', 'TARGET syntax is currently not supported', tline)
-
-        magic_keys = ['OUTPUT', 'COMMAND', 'MAIN_DEPENDENCY', 'DEPENDS', 'BYPRODUCTS',
-                      'IMPLICIT_DEPENDS', 'WORKING_DIRECTORY', 'COMMENT', 'DEPFILE',
-                      'JOB_POOL', 'VERBATIM', 'APPEND', 'USES_TERMINAL', 'COMMAND_EXPAND_LISTS']
-
-        target = CMakeGeneratorTarget(name)
-
-        def handle_output(key: str, target: CMakeGeneratorTarget) -> None:
-            target.outputs += [key]
-
-        def handle_command(key: str, target: CMakeGeneratorTarget) -> None:
-            if key == 'ARGS':
-                return
-            target.command[-1] += [key]
-
-        def handle_depends(key: str, target: CMakeGeneratorTarget) -> None:
-            target.depends += [key]
-
-        def handle_working_dir(key: str, target: CMakeGeneratorTarget) -> None:
-            if target.working_dir is None:
-                target.working_dir = key
-            else:
-                target.working_dir += ' '
-                target.working_dir += key
-
-        fn = None
-
-        for i in args:
-            if i in magic_keys:
-                if i == 'OUTPUT':
-                    fn = handle_output
-                elif i == 'DEPENDS':
-                    fn = handle_depends
-                elif i == 'WORKING_DIRECTORY':
-                    fn = handle_working_dir
-                elif i == 'COMMAND':
-                    fn = handle_command
-                    target.command += [[]]
-                else:
-                    fn = None
-                continue
-
-            if fn is not None:
-                fn(i, target)
-
-        target.current_bin_dir = self.var_to_str('MESON_PS_CMAKE_CURRENT_BINARY_DIR')
-        target.current_src_dir = self.var_to_str('MESON_PS_CMAKE_CURRENT_SOURCE_DIR')
-        target.outputs = self._guess_files(target.outputs)
-        target.depends = self._guess_files(target.depends)
-        target.command = [self._guess_files(x) for x in target.command]
-
-        self.custom_targets += [target]
-        if name:
-            self.targets[name] = target
-
-    def _cmake_add_custom_target(self, tline: CMakeTraceLine):
-        # DOC: https://cmake.org/cmake/help/latest/command/add_custom_target.html
-        # We only the first parameter (the target name) is interesting
-        if len(tline.args) < 1:
-            return self._gen_exception('add_custom_target', 'requires at least one argument', tline)
-
-        # It's pretty much the same as a custom command
-        self._cmake_add_custom_command(tline, tline.args[0])
-
-    def _cmake_set_property(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/set_property.html
-        args = list(tline.args)
-
-        scope = args.pop(0)
-
-        append = False
-        targets = []
-        while args:
-            curr = args.pop(0)
-            # XXX: APPEND_STRING is specifically *not* supposed to create a
-            # list, is treating them as aliases really okay?
-            if curr == 'APPEND' or curr == 'APPEND_STRING':
-                append = True
-                continue
-
-            if curr == 'PROPERTY':
-                break
-
-            targets += curr.split(';')
-
-        if not args:
-            return self._gen_exception('set_property', 'faild to parse argument list', tline)
-
-        if len(args) == 1:
-            # Tries to set property to nothing so nothing has to be done
-            return
-
-        identifier = args.pop(0)
-        if self.trace_format == 'human':
-            value = ' '.join(args).split(';')
-        else:
-            value = [y for x in args for y in x.split(';')]
-        if not value:
-            return
-
-        def do_target(tgt: str) -> None:
-            if i not in self.targets:
-                return self._gen_exception('set_property', 'TARGET {} not found'.format(i), tline)
-
-            if identifier not in self.targets[i].properties:
-                self.targets[i].properties[identifier] = []
-
-            if append:
-                self.targets[i].properties[identifier] += value
-            else:
-                self.targets[i].properties[identifier] = value
-
-        def do_source(src: str) -> None:
-            if identifier != 'HEADER_FILE_ONLY' or not self._str_to_bool(value):
-                return
-
-            current_src_dir = self.var_to_str('MESON_PS_CMAKE_CURRENT_SOURCE_DIR')
-            if not current_src_dir:
-                mlog.warning(textwrap.dedent('''\
-                    CMake trace: set_property(SOURCE) called before the preload script was loaded.
-                    Unable to determine CMAKE_CURRENT_SOURCE_DIR. This can lead to build errors.
-                '''))
-                current_src_dir = '.'
-
-            cur_p = Path(current_src_dir)
-            src_p = Path(src)
-
-            if not src_p.is_absolute():
-                src_p = cur_p / src_p
-            self.explicit_headers.add(src_p)
-
-        if scope == 'TARGET':
-            for i in targets:
-                do_target(i)
-        elif scope == 'SOURCE':
-            files = self._guess_files(targets)
-            for i in files:
-                do_source(i)
-
-    def _cmake_set_target_properties(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/set_target_properties.html
-        args = list(tline.args)
-
-        targets = []
-        while args:
-            curr = args.pop(0)
-            if curr == 'PROPERTIES':
-                break
-
-            targets.append(curr)
-
-        # Now we need to try to reconsitute the original quoted format of the
-        # arguments, as a property value could have spaces in it. Unlike
-        # set_property() this is not context free. There are two approaches I
-        # can think of, both have drawbacks:
-        #
-        #   1. Assume that the property will be capitalized ([A-Z_]), this is
-        #      convention but cmake doesn't require it.
-        #   2. Maintain a copy of the list here: https://cmake.org/cmake/help/latest/manual/cmake-properties.7.html#target-properties
-        #
-        # Neither of these is awesome for obvious reasons. I'm going to try
-        # option 1 first and fall back to 2, as 1 requires less code and less
-        # synchroniztion for cmake changes.
-        #
-        # With the JSON output format, introduced in CMake 3.17, spaces are
-        # handled properly and we don't have to do either options
-
-        arglist = []  # type: T.List[T.Tuple[str, T.List[str]]]
-        if self.trace_format == 'human':
-            name = args.pop(0)
-            values = []
-            prop_regex = re.compile(r'^[A-Z_]+$')
-            for a in args:
-                if prop_regex.match(a):
-                    if values:
-                        arglist.append((name, ' '.join(values).split(';')))
-                    name = a
-                    values = []
-                else:
-                    values.append(a)
-            if values:
-                arglist.append((name, ' '.join(values).split(';')))
-        else:
-            arglist = [(x[0], x[1].split(';')) for x in zip(args[::2], args[1::2])]
-
-        for name, value in arglist:
-            for i in targets:
-                if i not in self.targets:
-                    return self._gen_exception('set_target_properties', 'TARGET {} not found'.format(i), tline)
-
-                self.targets[i].properties[name] = value
-
-    def _cmake_add_dependencies(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/add_dependencies.html
-        args = list(tline.args)
-
-        if len(args) < 2:
-            return self._gen_exception('add_dependencies', 'takes at least 2 arguments', tline)
-
-        target = self.targets.get(args[0])
-        if not target:
-            return self._gen_exception('add_dependencies', 'target not found', tline)
-
-        for i in args[1:]:
-            target.depends += i.split(';')
-
-    def _cmake_target_compile_definitions(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/target_compile_definitions.html
-        self._parse_common_target_options('target_compile_definitions', 'COMPILE_DEFINITIONS', 'INTERFACE_COMPILE_DEFINITIONS', tline)
-
-    def _cmake_target_compile_options(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/target_compile_options.html
-        self._parse_common_target_options('target_compile_options', 'COMPILE_OPTIONS', 'INTERFACE_COMPILE_OPTIONS', tline)
-
-    def _cmake_target_include_directories(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/target_include_directories.html
-        self._parse_common_target_options('target_include_directories', 'INCLUDE_DIRECTORIES', 'INTERFACE_INCLUDE_DIRECTORIES', tline, ignore=['SYSTEM', 'BEFORE'], paths=True)
-
-    def _cmake_target_link_options(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/target_link_options.html
-        self._parse_common_target_options('target_link_options', 'LINK_OPTIONS', 'INTERFACE_LINK_OPTIONS', tline)
-
-    def _cmake_target_link_libraries(self, tline: CMakeTraceLine) -> None:
-        # DOC: https://cmake.org/cmake/help/latest/command/target_link_libraries.html
-        self._parse_common_target_options('target_link_options', 'LINK_LIBRARIES', 'INTERFACE_LINK_LIBRARIES', tline)
-
-    def _parse_common_target_options(self, func: str, private_prop: str, interface_prop: str, tline: CMakeTraceLine, ignore: T.Optional[T.List[str]] = None, paths: bool = False):
-        if ignore is None:
-            ignore = ['BEFORE']
-
-        args = list(tline.args)
-
-        if len(args) < 1:
-            return self._gen_exception(func, 'requires at least one argument', tline)
-
-        target = args[0]
-        if target not in self.targets:
-            return self._gen_exception(func, 'TARGET {} not found'.format(target), tline)
-
-        interface = []
-        private = []
-
-        mode = 'PUBLIC'
-        for i in args[1:]:
-            if i in ignore:
-                continue
-
-            if i in ['INTERFACE', 'LINK_INTERFACE_LIBRARIES', 'PUBLIC', 'PRIVATE', 'LINK_PUBLIC', 'LINK_PRIVATE']:
-                mode = i
-                continue
-
-            if mode in ['INTERFACE', 'LINK_INTERFACE_LIBRARIES', 'PUBLIC', 'LINK_PUBLIC']:
-                interface += i.split(';')
-
-            if mode in ['PUBLIC', 'PRIVATE', 'LINK_PRIVATE']:
-                private += i.split(';')
-
-        if paths:
-            interface = self._guess_files(interface)
-            private = self._guess_files(private)
-
-        interface = [x for x in interface if x]
-        private = [x for x in private if x]
-
-        for i in [(private_prop, private), (interface_prop, interface)]:
-            if not i[0] in self.targets[target].properties:
-                self.targets[target].properties[i[0]] = []
-
-            self.targets[target].properties[i[0]] += i[1]
-
-    def _meson_ps_execute_delayed_calls(self, tline: CMakeTraceLine) -> None:
-        for l in self.stored_commands:
-            fn = self.functions.get(l.func, None)
-            if(fn):
-                fn(l)
-
-        # clear the stored commands
-        self.stored_commands = []
-
-    def _meson_ps_reload_vars(self, tline: CMakeTraceLine) -> None:
-        self.delayed_commands = self.get_cmake_var('MESON_PS_DELAYED_CALLS')
-
-    def _lex_trace_human(self, trace):
-        # The trace format is: '<file>(<line>):  <func>(<args -- can contain \n> )\n'
-        reg_tline = re.compile(r'\s*(.*\.(cmake|txt))\(([0-9]+)\):\s*(\w+)\(([\s\S]*?) ?\)\s*\n', re.MULTILINE)
-        reg_other = re.compile(r'[^\n]*\n')
-        loc = 0
-        while loc < len(trace):
-            mo_file_line = reg_tline.match(trace, loc)
-            if not mo_file_line:
-                skip_match = reg_other.match(trace, loc)
-                if not skip_match:
-                    print(trace[loc:])
-                    raise CMakeException('Failed to parse CMake trace')
-
-                loc = skip_match.end()
-                continue
-
-            loc = mo_file_line.end()
-
-            file = mo_file_line.group(1)
-            line = mo_file_line.group(3)
-            func = mo_file_line.group(4)
-            args = mo_file_line.group(5)
-            args = parse_generator_expressions(args)
-            args = args.split(' ')
-            args = list(map(lambda x: x.strip(), args))
-
-            yield CMakeTraceLine(file, line, func, args)
-
-    def _lex_trace_json(self, trace: str):
-        lines = trace.splitlines(keepends=False)
-        lines.pop(0)  # The first line is the version
-        for i in lines:
-            data = json.loads(i)
-            args = data['args']
-            args = [parse_generator_expressions(x) for x in args]
-            yield CMakeTraceLine(data['file'], data['line'], data['cmd'], args)
-
-    def _flatten_args(self, args: T.List[str]) -> T.List[str]:
-        # Split lists in arguments
-        res = []  # type: T.List[str]
-        for i in args:
-            res += i.split(';')
-        return res
-
-    def _guess_files(self, broken_list: T.List[str]) -> T.List[str]:
-        # Nothing has to be done for newer formats
-        if self.trace_format != 'human':
-            return broken_list
-
-        # Try joining file paths that contain spaces
-
-        reg_start = re.compile(r'^([A-Za-z]:)?/(.*/)*[^./]+$')
-        reg_end = re.compile(r'^.*\.[a-zA-Z]+$')
-
-        fixed_list = []  # type: T.List[str]
-        curr_str = None  # type: T.Optional[str]
-        path_found = False # type: bool
-
-        for i in broken_list:
-            if curr_str is None:
-                curr_str = i
-                path_found = False
-            elif os.path.isfile(curr_str):
-                # Abort concatenation if curr_str is an existing file
-                fixed_list += [curr_str]
-                curr_str = i
-                path_found = False
-            elif not reg_start.match(curr_str):
-                # Abort concatenation if curr_str no longer matches the regex
-                fixed_list += [curr_str]
-                curr_str = i
-                path_found = False
-            elif reg_end.match(i):
-                # File detected
-                curr_str = '{} {}'.format(curr_str, i)
-                fixed_list += [curr_str]
-                curr_str = None
-                path_found = False
-            elif os.path.exists('{} {}'.format(curr_str, i)):
-                # Path detected
-                curr_str = '{} {}'.format(curr_str, i)
-                path_found = True
-            elif path_found:
-                # Add path to fixed_list after ensuring the whole path is in curr_str
-                fixed_list += [curr_str]
-                curr_str = i
-                path_found = False
-            else:
-                curr_str = '{} {}'.format(curr_str, i)
-                path_found = False
-
-        if curr_str:
-            fixed_list += [curr_str]
-        return fixed_list
diff --git a/meson/mesonbuild/compilers/__init__.py b/meson/mesonbuild/compilers/__init__.py
deleted file mode 100644 (file)
index 5b765a6..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Public symbols for compilers sub-package when using 'from . import compilers'
-__all__ = [
-    'Compiler',
-
-    'all_languages',
-    'base_options',
-    'clib_langs',
-    'clink_langs',
-    'c_suffixes',
-    'cpp_suffixes',
-    'get_base_compile_args',
-    'get_base_link_args',
-    'is_assembly',
-    'is_header',
-    'is_library',
-    'is_llvm_ir',
-    'is_object',
-    'is_source',
-    'is_known_suffix',
-    'lang_suffixes',
-    'sort_clink',
-
-    'AppleClangCCompiler',
-    'AppleClangCPPCompiler',
-    'AppleClangObjCCompiler',
-    'AppleClangObjCPPCompiler',
-    'ArmCCompiler',
-    'ArmCPPCompiler',
-    'ArmclangCCompiler',
-    'ArmclangCPPCompiler',
-    'CCompiler',
-    'ClangCCompiler',
-    'ClangCompiler',
-    'ClangCPPCompiler',
-    'ClangObjCCompiler',
-    'ClangObjCPPCompiler',
-    'ClangClCCompiler',
-    'ClangClCPPCompiler',
-    'CPPCompiler',
-    'DCompiler',
-    'DmdDCompiler',
-    'FortranCompiler',
-    'G95FortranCompiler',
-    'GnuCCompiler',
-    'ElbrusCCompiler',
-    'EmscriptenCCompiler',
-    'GnuCompiler',
-    'GnuLikeCompiler',
-    'GnuCPPCompiler',
-    'ElbrusCPPCompiler',
-    'EmscriptenCPPCompiler',
-    'GnuDCompiler',
-    'GnuFortranCompiler',
-    'ElbrusFortranCompiler',
-    'FlangFortranCompiler',
-    'GnuObjCCompiler',
-    'GnuObjCPPCompiler',
-    'IntelGnuLikeCompiler',
-    'IntelVisualStudioLikeCompiler',
-    'IntelCCompiler',
-    'IntelCPPCompiler',
-    'IntelClCCompiler',
-    'IntelClCPPCompiler',
-    'IntelFortranCompiler',
-    'IntelClFortranCompiler',
-    'JavaCompiler',
-    'LLVMDCompiler',
-    'MonoCompiler',
-    'CudaCompiler',
-    'VisualStudioCsCompiler',
-    'NAGFortranCompiler',
-    'ObjCCompiler',
-    'ObjCPPCompiler',
-    'Open64FortranCompiler',
-    'PathScaleFortranCompiler',
-    'PGICCompiler',
-    'PGICPPCompiler',
-    'PGIFortranCompiler',
-    'RustCompiler',
-    'CcrxCCompiler',
-    'CcrxCPPCompiler',
-    'Xc16CCompiler',
-    'C2000CCompiler',
-    'C2000CPPCompiler',
-    'SunFortranCompiler',
-    'SwiftCompiler',
-    'ValaCompiler',
-    'VisualStudioLikeCompiler',
-    'VisualStudioCCompiler',
-    'VisualStudioCPPCompiler',
-]
-
-# Bring symbols from each module into compilers sub-package namespace
-from .compilers import (
-    Compiler,
-    all_languages,
-    base_options,
-    clib_langs,
-    clink_langs,
-    c_suffixes,
-    cpp_suffixes,
-    get_base_compile_args,
-    get_base_link_args,
-    is_header,
-    is_source,
-    is_assembly,
-    is_llvm_ir,
-    is_object,
-    is_library,
-    is_known_suffix,
-    lang_suffixes,
-    sort_clink,
-)
-from .c import (
-    CCompiler,
-    AppleClangCCompiler,
-    ArmCCompiler,
-    ArmclangCCompiler,
-    ClangCCompiler,
-    ClangClCCompiler,
-    GnuCCompiler,
-    ElbrusCCompiler,
-    EmscriptenCCompiler,
-    IntelCCompiler,
-    IntelClCCompiler,
-    PGICCompiler,
-    CcrxCCompiler,
-    Xc16CCompiler,
-    C2000CCompiler,
-    VisualStudioCCompiler,
-)
-from .cpp import (
-    CPPCompiler,
-    AppleClangCPPCompiler,
-    ArmCPPCompiler,
-    ArmclangCPPCompiler,
-    ClangCPPCompiler,
-    ClangClCPPCompiler,
-    GnuCPPCompiler,
-    ElbrusCPPCompiler,
-    EmscriptenCPPCompiler,
-    IntelCPPCompiler,
-    IntelClCPPCompiler,
-    PGICPPCompiler,
-    CcrxCPPCompiler,
-    C2000CPPCompiler,
-    VisualStudioCPPCompiler,
-)
-from .cs import MonoCompiler, VisualStudioCsCompiler
-from .d import (
-    DCompiler,
-    DmdDCompiler,
-    GnuDCompiler,
-    LLVMDCompiler,
-)
-from .cuda import CudaCompiler
-from .fortran import (
-    FortranCompiler,
-    G95FortranCompiler,
-    GnuFortranCompiler,
-    ElbrusFortranCompiler,
-    FlangFortranCompiler,
-    IntelFortranCompiler,
-    IntelClFortranCompiler,
-    NAGFortranCompiler,
-    Open64FortranCompiler,
-    PathScaleFortranCompiler,
-    PGIFortranCompiler,
-    SunFortranCompiler,
-)
-from .java import JavaCompiler
-from .objc import (
-    ObjCCompiler,
-    AppleClangObjCCompiler,
-    ClangObjCCompiler,
-    GnuObjCCompiler,
-)
-from .objcpp import (
-    ObjCPPCompiler,
-    AppleClangObjCPPCompiler,
-    ClangObjCPPCompiler,
-    GnuObjCPPCompiler,
-)
-from .rust import RustCompiler
-from .swift import SwiftCompiler
-from .vala import ValaCompiler
-from .mixins.visualstudio import VisualStudioLikeCompiler
-from .mixins.gnu import GnuCompiler, GnuLikeCompiler
-from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler
-from .mixins.clang import ClangCompiler
diff --git a/meson/mesonbuild/compilers/c.py b/meson/mesonbuild/compilers/c.py
deleted file mode 100644 (file)
index aac99b4..0000000
+++ /dev/null
@@ -1,561 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path
-import typing as T
-
-from .. import coredata
-from ..mesonlib import MachineChoice, MesonException, mlog, version_compare
-from ..linkers import LinkerEnvVarsMixin
-from .c_function_attributes import C_FUNC_ATTRIBUTES
-from .mixins.clike import CLikeCompiler
-from .mixins.ccrx import CcrxCompiler
-from .mixins.xc16 import Xc16Compiler
-from .mixins.c2000 import C2000Compiler
-from .mixins.arm import ArmCompiler, ArmclangCompiler
-from .mixins.visualstudio import MSVCCompiler, ClangClCompiler
-from .mixins.gnu import GnuCompiler
-from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler
-from .mixins.clang import ClangCompiler
-from .mixins.elbrus import ElbrusCompiler
-from .mixins.pgi import PGICompiler
-from .mixins.emscripten import EmscriptenMixin
-from .compilers import (
-    gnu_winlibs,
-    msvc_winlibs,
-    Compiler,
-)
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-
-class CCompiler(CLikeCompiler, Compiler):
-
-    @staticmethod
-    def attribute_check_func(name):
-        try:
-            return C_FUNC_ATTRIBUTES[name]
-        except KeyError:
-            raise MesonException('Unknown function attribute "{}"'.format(name))
-
-    language = 'c'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool,
-                 info: 'MachineInfo', exe_wrapper: T.Optional[str] = None, **kwargs):
-        # If a child ObjC or CPP class has already set it, don't set it ourselves
-        Compiler.__init__(self, exelist, version, for_machine, info, **kwargs)
-        CLikeCompiler.__init__(self, is_cross, exe_wrapper)
-
-    def get_no_stdinc_args(self):
-        return ['-nostdinc']
-
-    def sanity_check(self, work_dir, environment):
-        code = 'int main(void) { int class=0; return class; }\n'
-        return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
-
-    def has_header_symbol(self, hname, symbol, prefix, env, *, extra_args=None, dependencies=None):
-        fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
-        t = '''{prefix}
-        #include <{header}>
-        int main(void) {{
-            /* If it's not defined as a macro, try to use as a symbol */
-            #ifndef {symbol}
-                {symbol};
-            #endif
-            return 0;
-        }}'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-
-class ClangCCompiler(ClangCompiler, CCompiler):
-
-    _C17_VERSION = '>=6.0.0'
-    _C18_VERSION = '>=8.0.0'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines: T.Optional[T.List[str]] = None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
-        ClangCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        c_stds = ['c89', 'c99', 'c11']
-        g_stds = ['gnu89', 'gnu99', 'gnu11']
-        # https://releases.llvm.org/6.0.0/tools/clang/docs/ReleaseNotes.html
-        # https://en.wikipedia.org/wiki/Xcode#Latest_versions
-        if version_compare(self.version, self._C17_VERSION):
-            c_stds += ['c17']
-            g_stds += ['gnu17']
-        if version_compare(self.version, self._C18_VERSION):
-            c_stds += ['c18']
-            g_stds += ['gnu18']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none'] + c_stds + g_stds,
-                'none',
-            ),
-        })
-        if self.info.is_windows() or self.info.is_cygwin():
-            opts.update({
-                'winlibs': coredata.UserArrayOption(
-                    'Standard Win libraries to link against',
-                    gnu_winlibs,
-                ),
-            })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-        return args
-
-    def get_option_link_args(self, options):
-        if self.info.is_windows() or self.info.is_cygwin():
-            return options['winlibs'].value[:]
-        return []
-
-
-class AppleClangCCompiler(ClangCCompiler):
-
-    """Handle the differences between Apple Clang and Vanilla Clang.
-
-    Right now this just handles the differences between the versions that new
-    C standards were added.
-    """
-
-    _C17_VERSION = '>=10.0.0'
-    _C18_VERSION = '>=11.0.0'
-
-
-class EmscriptenCCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        if not is_cross:
-            raise MesonException('Emscripten compiler can only be used for cross compilation.')
-        ClangCCompiler.__init__(self, exelist=exelist, version=version,
-                                for_machine=for_machine, is_cross=is_cross,
-                                info=info, exe_wrapper=exe_wrapper, **kwargs)
-        self.id = 'emscripten'
-
-
-class ArmclangCCompiler(ArmclangCompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        ArmclangCompiler.__init__(self)
-        default_warn_args = ['-Wall', '-Winvalid-pch']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none', 'c90', 'c99', 'c11', 'gnu90', 'gnu99', 'gnu11'],
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-        return args
-
-    def get_option_link_args(self, options):
-        return []
-
-
-class GnuCCompiler(GnuCompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        GnuCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        c_stds = ['c89', 'c99', 'c11']
-        g_stds = ['gnu89', 'gnu99', 'gnu11']
-        v = '>=8.0.0'
-        if version_compare(self.version, v):
-            c_stds += ['c17', 'c18']
-            g_stds += ['gnu17', 'gnu18']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none'] + c_stds + g_stds,
-                'none',
-            ),
-        })
-        if self.info.is_windows() or self.info.is_cygwin():
-            opts.update({
-                'winlibs': coredata.UserArrayOption(
-                    'Standard Win libraries to link against',
-                    gnu_winlibs,
-                ),
-            })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-        return args
-
-    def get_option_link_args(self, options):
-        if self.info.is_windows() or self.info.is_cygwin():
-            return options['winlibs'].value[:]
-        return []
-
-    def get_pch_use_args(self, pch_dir, header):
-        return ['-fpch-preprocess', '-include', os.path.basename(header)]
-
-
-class PGICCompiler(PGICompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        PGICompiler.__init__(self)
-
-
-class ElbrusCCompiler(GnuCCompiler, ElbrusCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        GnuCCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                              info, exe_wrapper, defines, **kwargs)
-        ElbrusCompiler.__init__(self)
-
-    # It does support some various ISO standards and c/gnu 90, 9x, 1x in addition to those which GNU CC supports.
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                [
-                    'none', 'c89', 'c90', 'c9x', 'c99', 'c1x', 'c11',
-                    'gnu89', 'gnu90', 'gnu9x', 'gnu99', 'gnu1x', 'gnu11',
-                    'iso9899:2011', 'iso9899:1990', 'iso9899:199409', 'iso9899:1999',
-                ],
-                'none',
-            ),
-        })
-        return opts
-
-    # Elbrus C compiler does not have lchmod, but there is only linker warning, not compiler error.
-    # So we should explicitly fail at this case.
-    def has_function(self, funcname, prefix, env, *, extra_args=None, dependencies=None):
-        if funcname == 'lchmod':
-            return False, False
-        else:
-            return super().has_function(funcname, prefix, env,
-                                        extra_args=extra_args,
-                                        dependencies=dependencies)
-
-
-class IntelCCompiler(IntelGnuLikeCompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        IntelGnuLikeCompiler.__init__(self)
-        self.lang_header = 'c-header'
-        default_warn_args = ['-Wall', '-w3', '-diag-disable:remark']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra']}
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        c_stds = ['c89', 'c99']
-        g_stds = ['gnu89', 'gnu99']
-        if version_compare(self.version, '>=16.0.0'):
-            c_stds += ['c11']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none'] + c_stds + g_stds,
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-        return args
-
-
-class VisualStudioLikeCCompilerMixin:
-
-    """Shared methods that apply to MSVC-like C compilers."""
-
-    def get_options(self):
-        opts = super().get_options()
-        opts.update({
-            'winlibs': coredata.UserArrayOption(
-                'Windows libs to link against.',
-                msvc_winlibs,
-            ),
-        })
-        return opts
-
-    def get_option_link_args(self, options):
-        return options['winlibs'].value[:]
-
-
-class VisualStudioCCompiler(MSVCCompiler, VisualStudioLikeCCompilerMixin, CCompiler):
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, target: str,
-                 **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrap, **kwargs)
-        MSVCCompiler.__init__(self, target)
-
-
-class ClangClCCompiler(ClangClCompiler, VisualStudioLikeCCompilerMixin, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, target, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrap, **kwargs)
-        ClangClCompiler.__init__(self, target)
-
-
-class IntelClCCompiler(IntelVisualStudioLikeCompiler, VisualStudioLikeCCompilerMixin, CCompiler):
-
-    """Intel "ICL" compiler abstraction."""
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, target, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrap, **kwargs)
-        IntelVisualStudioLikeCompiler.__init__(self, target)
-
-    def get_options(self):
-        opts = super().get_options()
-        c_stds = ['none', 'c89', 'c99', 'c11']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                c_stds,
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value == 'c89':
-            mlog.warning("ICL doesn't explicitly implement c89, setting the standard to 'none', which is close.", once=True)
-        elif std.value != 'none':
-            args.append('/Qstd:' + std.value)
-        return args
-
-
-class ArmCCompiler(ArmCompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        ArmCompiler.__init__(self)
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none', 'c90', 'c99'],
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('--' + std.value)
-        return args
-
-
-class CcrxCCompiler(CcrxCompiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        CcrxCompiler.__init__(self)
-
-    # Override CCompiler.get_always_args
-    def get_always_args(self):
-        return ['-nologo']
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C language standard to use',
-                ['none', 'c89', 'c99'],
-                'none',
-            ),
-        })
-        return opts
-
-    def get_no_stdinc_args(self):
-        return []
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value == 'c89':
-            args.append('-lang=c')
-        elif std.value == 'c99':
-            args.append('-lang=c99')
-        return args
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_no_optimization_args(self):
-        return ['-optimize=0']
-
-    def get_output_args(self, target):
-        return ['-output=obj=%s' % target]
-
-    def get_werror_args(self):
-        return ['-change_message=error']
-
-    def get_include_args(self, path, is_system):
-        if path == '':
-            path = '.'
-        return ['-include=' + path]
-
-
-class Xc16CCompiler(Xc16Compiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        Xc16Compiler.__init__(self)
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({'c_std': coredata.UserComboOption('C language standard to use',
-                                                       ['none', 'c89', 'c99', 'gnu89', 'gnu99'],
-                                                       'none')})
-        return opts
-
-    def get_no_stdinc_args(self):
-        return []
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['c_std']
-        if std.value != 'none':
-            args.append('-ansi')
-            args.append('-std=' + std.value)
-        return args
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_no_optimization_args(self):
-        return ['-O0']
-
-    def get_output_args(self, target):
-        return ['-o%s' % target]
-
-    def get_werror_args(self):
-        return ['-change_message=error']
-
-    def get_include_args(self, path, is_system):
-        if path == '':
-            path = '.'
-        return ['-I' + path]
-
-
-class C2000CCompiler(C2000Compiler, CCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                           info, exe_wrapper, **kwargs)
-        C2000Compiler.__init__(self)
-
-    # Override CCompiler.get_always_args
-    def get_always_args(self):
-        return []
-
-    def get_options(self):
-        opts = CCompiler.get_options(self)
-        opts.update({'c_std': coredata.UserComboOption('C language standard to use',
-                                                       ['none', 'c89', 'c99', 'c11'],
-                                                       'none')})
-        return opts
-
-    def get_no_stdinc_args(self):
-        return []
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['c_std']
-        if std.value != 'none':
-            args.append('--' + std.value)
-        return args
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_no_optimization_args(self):
-        return ['-Ooff']
-
-    def get_output_args(self, target):
-        return ['--output_file=%s' % target]
-
-    def get_werror_args(self):
-        return ['-change_message=error']
-
-    def get_include_args(self, path, is_system):
-        if path == '':
-            path = '.'
-        return ['--include_path=' + path]
diff --git a/meson/mesonbuild/compilers/c_function_attributes.py b/meson/mesonbuild/compilers/c_function_attributes.py
deleted file mode 100644 (file)
index f31229e..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-# These functions are based on the following code:
-# https://git.savannah.gnu.org/gitweb/?p=autoconf-archive.git;a=blob_plain;f=m4/ax_gcc_func_attribute.m4,
-# which is licensed under the following terms:
-#
-#   Copyright (c) 2013 Gabriele Svelto <gabriele.svelto@gmail.com>
-#
-#   Copying and distribution of this file, with or without modification, are
-#   permitted in any medium without royalty provided the copyright notice
-#   and this notice are preserved.  This file is offered as-is, without any
-#   warranty.
-#
-
-C_FUNC_ATTRIBUTES = {
-    'alias': '''
-        int foo(void) { return 0; }
-        int bar(void) __attribute__((alias("foo")));''',
-    'aligned':
-        'int foo(void) __attribute__((aligned(32)));',
-    'alloc_size':
-        'void *foo(int a) __attribute__((alloc_size(1)));',
-    'always_inline':
-        'inline __attribute__((always_inline)) int foo(void) { return 0; }',
-    'artificial':
-        'inline __attribute__((artificial)) int foo(void) { return 0; }',
-    'cold':
-        'int foo(void) __attribute__((cold));',
-    'const':
-        'int foo(void) __attribute__((const));',
-    'constructor':
-        'int foo(void) __attribute__((constructor));',
-    'constructor_priority':
-        'int foo( void ) __attribute__((__constructor__(65535/2)));',
-    'deprecated':
-        'int foo(void) __attribute__((deprecated("")));',
-    'destructor':
-        'int foo(void) __attribute__((destructor));',
-    'dllexport':
-        '__declspec(dllexport) int foo(void) { return 0; }',
-    'dllimport':
-        '__declspec(dllimport) int foo(void);',
-    'error':
-        'int foo(void) __attribute__((error("")));',
-    'externally_visible':
-        'int foo(void) __attribute__((externally_visible));',
-    'fallthrough': '''
-        int foo( void ) {
-          switch (0) {
-            case 1: __attribute__((fallthrough));
-            case 2: break;
-          }
-          return 0;
-        };''',
-    'flatten':
-        'int foo(void) __attribute__((flatten));',
-    'format':
-        'int foo(const char * p, ...) __attribute__((format(printf, 1, 2)));',
-    'format_arg':
-        'char * foo(const char * p) __attribute__((format_arg(1)));',
-    'force_align_arg_pointer':
-        '__attribute__((force_align_arg_pointer)) int foo(void) { return 0; }',
-    'gnu_inline':
-        'inline __attribute__((gnu_inline)) int foo(void) { return 0; }',
-    'hot':
-        'int foo(void) __attribute__((hot));',
-    'ifunc':
-        ('int my_foo(void) { return 0; }'
-         'static int (*resolve_foo(void))(void) { return my_foo; }'
-         'int foo(void) __attribute__((ifunc("resolve_foo")));'),
-    'leaf':
-        '__attribute__((leaf)) int foo(void) { return 0; }',
-    'malloc':
-        'int *foo(void) __attribute__((malloc));',
-    'noclone':
-        'int foo(void) __attribute__((noclone));',
-    'noinline':
-        '__attribute__((noinline)) int foo(void) { return 0; }',
-    'nonnull':
-        'int foo(char * p) __attribute__((nonnull(1)));',
-    'noreturn':
-        'int foo(void) __attribute__((noreturn));',
-    'nothrow':
-        'int foo(void) __attribute__((nothrow));',
-    'optimize':
-        '__attribute__((optimize(3))) int foo(void) { return 0; }',
-    'packed':
-        'struct __attribute__((packed)) foo { int bar; };',
-    'pure':
-        'int foo(void) __attribute__((pure));',
-    'returns_nonnull':
-        'int *foo(void) __attribute__((returns_nonnull));',
-    'unused':
-        'int foo(void) __attribute__((unused));',
-    'used':
-        'int foo(void) __attribute__((used));',
-    'visibility': '''
-        int foo_def(void) __attribute__((visibility("default")));
-        int foo_hid(void) __attribute__((visibility("hidden")));
-        int foo_int(void) __attribute__((visibility("internal")));''',
-    'visibility:default':
-        'int foo(void) __attribute__((visibility("default")));',
-    'visibility:hidden':
-        'int foo(void) __attribute__((visibility("hidden")));',
-    'visibility:internal':
-        'int foo(void) __attribute__((visibility("internal")));',
-    'visibility:protected':
-        'int foo(void) __attribute__((visibility("protected")));',
-    'warning':
-        'int foo(void) __attribute__((warning("")));',
-    'warn_unused_result':
-        'int foo(void) __attribute__((warn_unused_result));',
-    'weak':
-        'int foo(void) __attribute__((weak));',
-    'weakref': '''
-        static int foo(void) { return 0; }
-        static int var(void) __attribute__((weakref("foo")));''',
-}
-
-CXX_FUNC_ATTRIBUTES = {
-    # Alias must be applied to the mangled name in C++
-    'alias':
-        ('extern "C" {'
-         'int foo(void) { return 0; }'
-         '}'
-         'int bar(void) __attribute__((alias("foo")));'
-         ),
-    'ifunc':
-        ('extern "C" {'
-         'int my_foo(void) { return 0; }'
-         'static int (*resolve_foo(void))(void) { return my_foo; }'
-         '}'
-         'int foo(void) __attribute__((ifunc("resolve_foo")));'),
-}
diff --git a/meson/mesonbuild/compilers/compilers.py b/meson/mesonbuild/compilers/compilers.py
deleted file mode 100644 (file)
index 0de59a4..0000000
+++ /dev/null
@@ -1,982 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import abc
-import contextlib, os.path, re, tempfile
-import itertools
-import typing as T
-from functools import lru_cache
-
-from .. import coredata
-from .. import mlog
-from .. import mesonlib
-from ..linkers import LinkerEnvVarsMixin
-from ..mesonlib import (
-    EnvironmentException, MachineChoice, MesonException,
-    Popen_safe, split_args
-)
-from ..envconfig import (
-    Properties, get_env_var
-)
-from ..arglist import CompilerArgs
-
-if T.TYPE_CHECKING:
-    from ..coredata import OptionDictType
-    from ..envconfig import MachineInfo
-    from ..environment import Environment
-    from ..linkers import DynamicLinker  # noqa: F401
-
-    CompilerType = T.TypeVar('CompilerType', bound=Compiler)
-
-"""This file contains the data files of all compilers Meson knows
-about. To support a new compiler, add its information below.
-Also add corresponding autodetection code in environment.py."""
-
-header_suffixes = ('h', 'hh', 'hpp', 'hxx', 'H', 'ipp', 'moc', 'vapi', 'di')
-obj_suffixes = ('o', 'obj', 'res')
-lib_suffixes = ('a', 'lib', 'dll', 'dll.a', 'dylib', 'so')
-# Mapping of language to suffixes of files that should always be in that language
-# This means we can't include .h headers here since they could be C, C++, ObjC, etc.
-lang_suffixes = {
-    'c': ('c',),
-    'cpp': ('cpp', 'cc', 'cxx', 'c++', 'hh', 'hpp', 'ipp', 'hxx', 'ino'),
-    'cuda': ('cu',),
-    # f90, f95, f03, f08 are for free-form fortran ('f90' recommended)
-    # f, for, ftn, fpp are for fixed-form fortran ('f' or 'for' recommended)
-    'fortran': ('f90', 'f95', 'f03', 'f08', 'f', 'for', 'ftn', 'fpp'),
-    'd': ('d', 'di'),
-    'objc': ('m',),
-    'objcpp': ('mm',),
-    'rust': ('rs',),
-    'vala': ('vala', 'vapi', 'gs'),
-    'cs': ('cs',),
-    'swift': ('swift',),
-    'java': ('java',),
-}
-all_languages = lang_suffixes.keys()
-cpp_suffixes = lang_suffixes['cpp'] + ('h',)
-c_suffixes = lang_suffixes['c'] + ('h',)
-# List of languages that by default consume and output libraries following the
-# C ABI; these can generally be used interchangebly
-clib_langs = ('objcpp', 'cpp', 'objc', 'c', 'fortran',)
-# List of languages that can be linked with C code directly by the linker
-# used in build.py:process_compilers() and build.py:get_dynamic_linker()
-clink_langs = ('d', 'cuda') + clib_langs
-clink_suffixes = ()
-for _l in clink_langs + ('vala',):
-    clink_suffixes += lang_suffixes[_l]
-clink_suffixes += ('h', 'll', 's')
-all_suffixes = set(itertools.chain(*lang_suffixes.values(), clink_suffixes))
-
-# Languages that should use LDFLAGS arguments when linking.
-languages_using_ldflags = {'objcpp', 'cpp', 'objc', 'c', 'fortran', 'd', 'cuda'}
-# Languages that should use CPPFLAGS arguments when linking.
-languages_using_cppflags = {'c', 'cpp', 'objc', 'objcpp'}
-soregex = re.compile(r'.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
-
-# Environment variables that each lang uses.
-cflags_mapping = {'c': 'CFLAGS',
-                  'cpp': 'CXXFLAGS',
-                  'cuda': 'CUFLAGS',
-                  'objc': 'OBJCFLAGS',
-                  'objcpp': 'OBJCXXFLAGS',
-                  'fortran': 'FFLAGS',
-                  'd': 'DFLAGS',
-                  'vala': 'VALAFLAGS',
-                  'rust': 'RUSTFLAGS'}
-
-# All these are only for C-linkable languages; see `clink_langs` above.
-
-def sort_clink(lang):
-    '''
-    Sorting function to sort the list of languages according to
-    reversed(compilers.clink_langs) and append the unknown langs in the end.
-    The purpose is to prefer C over C++ for files that can be compiled by
-    both such as assembly, C, etc. Also applies to ObjC, ObjC++, etc.
-    '''
-    if lang not in clink_langs:
-        return 1
-    return -clink_langs.index(lang)
-
-def is_header(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    suffix = fname.split('.')[-1]
-    return suffix in header_suffixes
-
-def is_source(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    suffix = fname.split('.')[-1].lower()
-    return suffix in clink_suffixes
-
-def is_assembly(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    return fname.split('.')[-1].lower() == 's'
-
-def is_llvm_ir(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    return fname.split('.')[-1] == 'll'
-
-@lru_cache(maxsize=None)
-def cached_by_name(fname):
-    suffix = fname.split('.')[-1]
-    return suffix in obj_suffixes
-
-def is_object(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    return cached_by_name(fname)
-
-def is_library(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-
-    if soregex.match(fname):
-        return True
-
-    suffix = fname.split('.')[-1]
-    return suffix in lib_suffixes
-
-def is_known_suffix(fname):
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    suffix = fname.split('.')[-1]
-
-    return suffix in all_suffixes
-
-cuda_buildtype_args = {'plain': [],
-                       'debug': [],
-                       'debugoptimized': [],
-                       'release': [],
-                       'minsize': [],
-                       }
-java_buildtype_args = {'plain': [],
-                       'debug': ['-g'],
-                       'debugoptimized': ['-g'],
-                       'release': [],
-                       'minsize': [],
-                       'custom': [],
-                       }
-
-rust_buildtype_args = {'plain': [],
-                       'debug': [],
-                       'debugoptimized': [],
-                       'release': [],
-                       'minsize': [],
-                       'custom': [],
-                       }
-
-d_gdc_buildtype_args = {'plain': [],
-                        'debug': [],
-                        'debugoptimized': ['-finline-functions'],
-                        'release': ['-finline-functions'],
-                        'minsize': [],
-                        'custom': [],
-                        }
-
-d_ldc_buildtype_args = {'plain': [],
-                        'debug': [],
-                        'debugoptimized': ['-enable-inlining', '-Hkeep-all-bodies'],
-                        'release': ['-enable-inlining', '-Hkeep-all-bodies'],
-                        'minsize': [],
-                        'custom': [],
-                        }
-
-d_dmd_buildtype_args = {'plain': [],
-                        'debug': [],
-                        'debugoptimized': ['-inline'],
-                        'release': ['-inline'],
-                        'minsize': [],
-                        'custom': [],
-                        }
-
-mono_buildtype_args = {'plain': [],
-                       'debug': [],
-                       'debugoptimized': ['-optimize+'],
-                       'release': ['-optimize+'],
-                       'minsize': [],
-                       'custom': [],
-                       }
-
-swift_buildtype_args = {'plain': [],
-                        'debug': [],
-                        'debugoptimized': [],
-                        'release': [],
-                        'minsize': [],
-                        'custom': [],
-                        }
-
-gnu_winlibs = ['-lkernel32', '-luser32', '-lgdi32', '-lwinspool', '-lshell32',
-               '-lole32', '-loleaut32', '-luuid', '-lcomdlg32', '-ladvapi32']
-
-msvc_winlibs = ['kernel32.lib', 'user32.lib', 'gdi32.lib',
-                'winspool.lib', 'shell32.lib', 'ole32.lib', 'oleaut32.lib',
-                'uuid.lib', 'comdlg32.lib', 'advapi32.lib']
-
-clike_optimization_args = {'0': [],
-                           'g': [],
-                           '1': ['-O1'],
-                           '2': ['-O2'],
-                           '3': ['-O3'],
-                           's': ['-Os'],
-                           }
-
-cuda_optimization_args = {'0': [],
-                          'g': ['-O0'],
-                          '1': ['-O1'],
-                          '2': ['-O2'],
-                          '3': ['-O3'],
-                          's': ['-O3']
-                          }
-
-cuda_debug_args = {False: [],
-                   True: ['-g']}
-
-clike_debug_args = {False: [],
-                    True: ['-g']}
-
-base_options = {'b_pch': coredata.UserBooleanOption('Use precompiled headers', True),
-                'b_lto': coredata.UserBooleanOption('Use link time optimization', False),
-                'b_sanitize': coredata.UserComboOption('Code sanitizer to use',
-                                                       ['none', 'address', 'thread', 'undefined', 'memory', 'address,undefined'],
-                                                       'none'),
-                'b_lundef': coredata.UserBooleanOption('Use -Wl,--no-undefined when linking', True),
-                'b_asneeded': coredata.UserBooleanOption('Use -Wl,--as-needed when linking', True),
-                'b_pgo': coredata.UserComboOption('Use profile guided optimization',
-                                                  ['off', 'generate', 'use'],
-                                                  'off'),
-                'b_coverage': coredata.UserBooleanOption('Enable coverage tracking.',
-                                                         False),
-                'b_colorout': coredata.UserComboOption('Use colored output',
-                                                       ['auto', 'always', 'never'],
-                                                       'always'),
-                'b_ndebug': coredata.UserComboOption('Disable asserts',
-                                                     ['true', 'false', 'if-release'], 'false'),
-                'b_staticpic': coredata.UserBooleanOption('Build static libraries as position independent',
-                                                          True),
-                'b_pie': coredata.UserBooleanOption('Build executables as position independent',
-                                                    False),
-                'b_bitcode': coredata.UserBooleanOption('Generate and embed bitcode (only macOS/iOS/tvOS)',
-                                                        False),
-                'b_vscrt': coredata.UserComboOption('VS run-time library type to use.',
-                                                    ['none', 'md', 'mdd', 'mt', 'mtd', 'from_buildtype'],
-                                                    'from_buildtype'),
-                }
-
-def option_enabled(boptions, options, option):
-    try:
-        if option not in boptions:
-            return False
-        return options[option].value
-    except KeyError:
-        return False
-
-def get_base_compile_args(options, compiler):
-    args = []
-    try:
-        if options['b_lto'].value:
-            args.extend(compiler.get_lto_compile_args())
-    except KeyError:
-        pass
-    try:
-        args += compiler.get_colorout_args(options['b_colorout'].value)
-    except KeyError:
-        pass
-    try:
-        args += compiler.sanitizer_compile_args(options['b_sanitize'].value)
-    except KeyError:
-        pass
-    try:
-        pgo_val = options['b_pgo'].value
-        if pgo_val == 'generate':
-            args.extend(compiler.get_profile_generate_args())
-        elif pgo_val == 'use':
-            args.extend(compiler.get_profile_use_args())
-    except KeyError:
-        pass
-    try:
-        if options['b_coverage'].value:
-            args += compiler.get_coverage_args()
-    except KeyError:
-        pass
-    try:
-        if (options['b_ndebug'].value == 'true' or
-                (options['b_ndebug'].value == 'if-release' and
-                 options['buildtype'].value in {'release', 'plain'})):
-            args += compiler.get_disable_assert_args()
-    except KeyError:
-        pass
-    # This does not need a try...except
-    if option_enabled(compiler.base_options, options, 'b_bitcode'):
-        args.append('-fembed-bitcode')
-    try:
-        crt_val = options['b_vscrt'].value
-        buildtype = options['buildtype'].value
-        try:
-            args += compiler.get_crt_compile_args(crt_val, buildtype)
-        except AttributeError:
-            pass
-    except KeyError:
-        pass
-    return args
-
-def get_base_link_args(options, linker, is_shared_module):
-    args = []
-    try:
-        if options['b_lto'].value:
-            args.extend(linker.get_lto_link_args())
-    except KeyError:
-        pass
-    try:
-        args += linker.sanitizer_link_args(options['b_sanitize'].value)
-    except KeyError:
-        pass
-    try:
-        pgo_val = options['b_pgo'].value
-        if pgo_val == 'generate':
-            args.extend(linker.get_profile_generate_args())
-        elif pgo_val == 'use':
-            args.extend(linker.get_profile_use_args())
-    except KeyError:
-        pass
-    try:
-        if options['b_coverage'].value:
-            args += linker.get_coverage_link_args()
-    except KeyError:
-        pass
-
-    as_needed = option_enabled(linker.base_options, options, 'b_asneeded')
-    bitcode = option_enabled(linker.base_options, options, 'b_bitcode')
-    # Shared modules cannot be built with bitcode_bundle because
-    # -bitcode_bundle is incompatible with -undefined and -bundle
-    if bitcode and not is_shared_module:
-        args.extend(linker.bitcode_args())
-    elif as_needed:
-        # -Wl,-dead_strip_dylibs is incompatible with bitcode
-        args.extend(linker.get_asneeded_args())
-
-    # Apple's ld (the only one that supports bitcode) does not like -undefined
-    # arguments or -headerpad_max_install_names when bitcode is enabled
-    if not bitcode:
-        args.extend(linker.headerpad_args())
-        if (not is_shared_module and
-                option_enabled(linker.base_options, options, 'b_lundef')):
-            args.extend(linker.no_undefined_link_args())
-        else:
-            args.extend(linker.get_allow_undefined_link_args())
-
-    try:
-        crt_val = options['b_vscrt'].value
-        buildtype = options['buildtype'].value
-        try:
-            args += linker.get_crt_link_args(crt_val, buildtype)
-        except AttributeError:
-            pass
-    except KeyError:
-        pass
-    return args
-
-
-class CrossNoRunException(MesonException):
-    pass
-
-class RunResult:
-    def __init__(self, compiled, returncode=999, stdout='UNDEFINED', stderr='UNDEFINED'):
-        self.compiled = compiled
-        self.returncode = returncode
-        self.stdout = stdout
-        self.stderr = stderr
-
-
-class Compiler(metaclass=abc.ABCMeta):
-    # Libraries to ignore in find_library() since they are provided by the
-    # compiler or the C library. Currently only used for MSVC.
-    ignore_libs = ()
-    # Libraries that are internal compiler implementations, and must not be
-    # manually searched.
-    internal_libs = ()
-
-    LINKER_PREFIX = None  # type: T.Union[None, str, T.List[str]]
-    INVOKES_LINKER = True
-
-    def __init__(self, exelist, version, for_machine: MachineChoice, info: 'MachineInfo',
-                 linker: T.Optional['DynamicLinker'] = None, **kwargs):
-        if isinstance(exelist, str):
-            self.exelist = [exelist]
-        elif isinstance(exelist, list):
-            self.exelist = exelist
-        else:
-            raise TypeError('Unknown argument to Compiler')
-        # In case it's been overridden by a child class already
-        if not hasattr(self, 'file_suffixes'):
-            self.file_suffixes = lang_suffixes[self.language]
-        if not hasattr(self, 'can_compile_suffixes'):
-            self.can_compile_suffixes = set(self.file_suffixes)
-        self.default_suffix = self.file_suffixes[0]
-        self.version = version
-        if 'full_version' in kwargs:
-            self.full_version = kwargs['full_version']
-        else:
-            self.full_version = None
-        self.for_machine = for_machine
-        self.base_options = []
-        self.linker = linker
-        self.info = info
-
-    def __repr__(self):
-        repr_str = "<{0}: v{1} `{2}`>"
-        return repr_str.format(self.__class__.__name__, self.version,
-                               ' '.join(self.exelist))
-
-    @lru_cache(maxsize=None)
-    def can_compile(self, src) -> bool:
-        if hasattr(src, 'fname'):
-            src = src.fname
-        suffix = os.path.splitext(src)[1].lower()
-        if suffix and suffix[1:] in self.can_compile_suffixes:
-            return True
-        return False
-
-    def get_id(self) -> str:
-        return self.id
-
-    def get_linker_id(self) -> str:
-        # There is not guarantee that we have a dynamic linker instance, as
-        # some languages don't have separate linkers and compilers. In those
-        # cases return the compiler id
-        try:
-            return self.linker.id
-        except AttributeError:
-            return self.id
-
-    def get_version_string(self) -> str:
-        details = [self.id, self.version]
-        if self.full_version:
-            details += ['"%s"' % (self.full_version)]
-        return '(%s)' % (' '.join(details))
-
-    def get_language(self) -> str:
-        return self.language
-
-    @classmethod
-    def get_display_language(cls) -> str:
-        return cls.language.capitalize()
-
-    def get_default_suffix(self) -> str:
-        return self.default_suffix
-
-    def get_define(self, dname, prefix, env, extra_args, dependencies) -> T.Tuple[str, bool]:
-        raise EnvironmentException('%s does not support get_define ' % self.get_id())
-
-    def compute_int(self, expression, low, high, guess, prefix, env, extra_args, dependencies) -> int:
-        raise EnvironmentException('%s does not support compute_int ' % self.get_id())
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        raise EnvironmentException('%s does not support compute_parameters_with_absolute_paths ' % self.get_id())
-
-    def has_members(self, typename, membernames, prefix, env, *,
-                    extra_args=None, dependencies=None) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('%s does not support has_member(s) ' % self.get_id())
-
-    def has_type(self, typename, prefix, env, extra_args, *,
-                 dependencies=None) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('%s does not support has_type ' % self.get_id())
-
-    def symbols_have_underscore_prefix(self, env) -> bool:
-        raise EnvironmentException('%s does not support symbols_have_underscore_prefix ' % self.get_id())
-
-    def get_exelist(self):
-        return self.exelist[:]
-
-    def get_linker_exelist(self) -> T.List[str]:
-        return self.linker.get_exelist()
-
-    def get_linker_output_args(self, outputname: str) -> T.List[str]:
-        return self.linker.get_output_args(outputname)
-
-    def get_builtin_define(self, *args, **kwargs):
-        raise EnvironmentException('%s does not support get_builtin_define.' % self.id)
-
-    def has_builtin_define(self, *args, **kwargs):
-        raise EnvironmentException('%s does not support has_builtin_define.' % self.id)
-
-    def get_always_args(self):
-        return []
-
-    def can_linker_accept_rsp(self) -> bool:
-        """
-        Determines whether the linker can accept arguments using the @rsp syntax.
-        """
-        return self.linker.get_accepts_rsp()
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return self.linker.get_always_args()
-
-    def get_linker_lib_prefix(self):
-        return self.linker.get_lib_prefix()
-
-    def gen_import_library_args(self, implibname):
-        """
-        Used only on Windows for libraries that need an import library.
-        This currently means C, C++, Fortran.
-        """
-        return []
-
-    def get_linker_args_from_envvars(self,
-                                     for_machine: MachineChoice,
-                                     is_cross: bool) -> T.List[str]:
-        return self.linker.get_args_from_envvars(for_machine, is_cross)
-
-    def get_options(self) -> T.Dict[str, coredata.UserOption]:
-        return {}
-
-    def get_option_compile_args(self, options):
-        return []
-
-    def get_option_link_args(self, options: 'OptionDictType') -> T.List[str]:
-        return self.linker.get_option_args(options)
-
-    def check_header(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support header checks.' % self.get_display_language())
-
-    def has_header(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support header checks.' % self.get_display_language())
-
-    def has_header_symbol(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support header symbol checks.' % self.get_display_language())
-
-    def compiles(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support compile checks.' % self.get_display_language())
-
-    def links(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support link checks.' % self.get_display_language())
-
-    def run(self, *args, **kwargs) -> RunResult:
-        raise EnvironmentException('Language %s does not support run checks.' % self.get_display_language())
-
-    def sizeof(self, *args, **kwargs) -> int:
-        raise EnvironmentException('Language %s does not support sizeof checks.' % self.get_display_language())
-
-    def alignment(self, *args, **kwargs) -> int:
-        raise EnvironmentException('Language %s does not support alignment checks.' % self.get_display_language())
-
-    def has_function(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        raise EnvironmentException('Language %s does not support function checks.' % self.get_display_language())
-
-    @classmethod
-    def unix_args_to_native(cls, args):
-        "Always returns a copy that can be independently mutated"
-        return args[:]
-
-    @classmethod
-    def native_args_to_unix(cls, args: T.List[str]) -> T.List[str]:
-        "Always returns a copy that can be independently mutated"
-        return args[:]
-
-    def find_library(self, *args, **kwargs):
-        raise EnvironmentException('Language {} does not support library finding.'.format(self.get_display_language()))
-
-    def get_library_dirs(self, *args, **kwargs):
-        return ()
-
-    def get_program_dirs(self, *args, **kwargs):
-        return []
-
-    def has_multi_arguments(self, args, env) -> T.Tuple[bool, bool]:
-        raise EnvironmentException(
-            'Language {} does not support has_multi_arguments.'.format(
-                self.get_display_language()))
-
-    def has_multi_link_arguments(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]:
-        return self.linker.has_multi_arguments(args, env)
-
-    def _get_compile_output(self, dirname, mode):
-        # In pre-processor mode, the output is sent to stdout and discarded
-        if mode == 'preprocess':
-            return None
-        # Extension only matters if running results; '.exe' is
-        # guaranteed to be executable on every platform.
-        if mode == 'link':
-            suffix = 'exe'
-        else:
-            suffix = 'obj'
-        return os.path.join(dirname, 'output.' + suffix)
-
-    def get_compiler_args_for_mode(self, mode):
-        args = []
-        args += self.get_always_args()
-        if mode == 'compile':
-            args += self.get_compile_only_args()
-        if mode == 'preprocess':
-            args += self.get_preprocess_only_args()
-        return args
-
-    def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> CompilerArgs:
-        """Return an appropriate CompilerArgs instance for this class."""
-        return CompilerArgs(self, args)
-
-    @contextlib.contextmanager
-    def compile(self, code: str, extra_args: list = None, *, mode: str = 'link', want_output: bool = False, temp_dir: str = None):
-        if extra_args is None:
-            extra_args = []
-        try:
-            with tempfile.TemporaryDirectory(dir=temp_dir) as tmpdirname:
-                no_ccache = False
-                if isinstance(code, str):
-                    srcname = os.path.join(tmpdirname,
-                                           'testfile.' + self.default_suffix)
-                    with open(srcname, 'w') as ofile:
-                        ofile.write(code)
-                    # ccache would result in a cache miss
-                    no_ccache = True
-                elif isinstance(code, mesonlib.File):
-                    srcname = code.fname
-
-                # Construct the compiler command-line
-                commands = self.compiler_args()
-                commands.append(srcname)
-                # Preprocess mode outputs to stdout, so no output args
-                if mode != 'preprocess':
-                    output = self._get_compile_output(tmpdirname, mode)
-                    commands += self.get_output_args(output)
-                commands.extend(self.get_compiler_args_for_mode(mode))
-                # extra_args must be last because it could contain '/link' to
-                # pass args to VisualStudio's linker. In that case everything
-                # in the command line after '/link' is given to the linker.
-                commands += extra_args
-                # Generate full command-line with the exelist
-                commands = self.get_exelist() + commands.to_native()
-                mlog.debug('Running compile:')
-                mlog.debug('Working directory: ', tmpdirname)
-                mlog.debug('Command line: ', ' '.join(commands), '\n')
-                mlog.debug('Code:\n', code)
-                os_env = os.environ.copy()
-                os_env['LC_ALL'] = 'C'
-                if no_ccache:
-                    os_env['CCACHE_DISABLE'] = '1'
-                p, p.stdo, p.stde = Popen_safe(commands, cwd=tmpdirname, env=os_env)
-                mlog.debug('Compiler stdout:\n', p.stdo)
-                mlog.debug('Compiler stderr:\n', p.stde)
-                p.commands = commands
-                p.input_name = srcname
-                if want_output:
-                    p.output_name = output
-                p.cached = False  # Make sure that the cached attribute always exists
-                yield p
-        except OSError:
-            # On Windows antivirus programs and the like hold on to files so
-            # they can't be deleted. There's not much to do in this case. Also,
-            # catch OSError because the directory is then no longer empty.
-            pass
-
-    @contextlib.contextmanager
-    def cached_compile(self, code, cdata: coredata.CoreData, *, extra_args=None, mode: str = 'link', temp_dir=None):
-        assert(isinstance(cdata, coredata.CoreData))
-
-        # Calculate the key
-        textra_args = tuple(extra_args) if extra_args is not None else None
-        key = (tuple(self.exelist), self.version, code, textra_args, mode)
-
-        # Check if not cached
-        if key not in cdata.compiler_check_cache:
-            with self.compile(code, extra_args=extra_args, mode=mode, want_output=False, temp_dir=temp_dir) as p:
-                # Remove all attributes except the following
-                # This way the object can be serialized
-                tokeep = ['args', 'commands', 'input_name', 'output_name',
-                          'pid', 'returncode', 'stdo', 'stde', 'text_mode']
-                todel = [x for x in vars(p).keys() if x not in tokeep]
-                for i in todel:
-                    delattr(p, i)
-                p.cached = False
-                cdata.compiler_check_cache[key] = p
-                yield p
-                return
-
-        # Return cached
-        p = cdata.compiler_check_cache[key]
-        p.cached = True
-        mlog.debug('Using cached compile:')
-        mlog.debug('Cached command line: ', ' '.join(p.commands), '\n')
-        mlog.debug('Code:\n', code)
-        mlog.debug('Cached compiler stdout:\n', p.stdo)
-        mlog.debug('Cached compiler stderr:\n', p.stde)
-        yield p
-
-    def get_colorout_args(self, colortype):
-        return []
-
-    # Some compilers (msvc) write debug info to a separate file.
-    # These args specify where it should be written.
-    def get_compile_debugfile_args(self, rel_obj, **kwargs):
-        return []
-
-    def get_link_debugfile_name(self, targetfile: str) -> str:
-        return self.linker.get_debugfile_name(targetfile)
-
-    def get_link_debugfile_args(self, targetfile: str) -> T.List[str]:
-        return self.linker.get_debugfile_args(targetfile)
-
-    def get_std_shared_lib_link_args(self) -> T.List[str]:
-        return self.linker.get_std_shared_lib_args()
-
-    def get_std_shared_module_link_args(self, options: 'OptionDictType') -> T.List[str]:
-        return self.linker.get_std_shared_module_args(options)
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        return self.linker.get_link_whole_for(args)
-
-    def get_allow_undefined_link_args(self) -> T.List[str]:
-        return self.linker.get_allow_undefined_args()
-
-    def no_undefined_link_args(self) -> T.List[str]:
-        return self.linker.no_undefined_args()
-
-    # Compiler arguments needed to enable the given instruction set.
-    # May be [] meaning nothing needed or None meaning the given set
-    # is not supported.
-    def get_instruction_set_args(self, instruction_set):
-        return None
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return self.linker.build_rpath_args(
-            env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
-
-    def thread_flags(self, env):
-        return []
-
-    def openmp_flags(self):
-        raise EnvironmentException('Language %s does not support OpenMP flags.' % self.get_display_language())
-
-    def openmp_link_flags(self):
-        return self.openmp_flags()
-
-    def language_stdlib_only_link_flags(self):
-        return []
-
-    def gnu_symbol_visibility_args(self, vistype):
-        return []
-
-    def get_gui_app_args(self, value):
-        return []
-
-    def has_func_attribute(self, name, env):
-        raise EnvironmentException(
-            'Language {} does not support function attributes.'.format(self.get_display_language()))
-
-    def get_pic_args(self):
-        m = 'Language {} does not support position-independent code'
-        raise EnvironmentException(m.format(self.get_display_language()))
-
-    def get_pie_args(self):
-        m = 'Language {} does not support position-independent executable'
-        raise EnvironmentException(m.format(self.get_display_language()))
-
-    def get_pie_link_args(self) -> T.List[str]:
-        return self.linker.get_pie_args()
-
-    def get_argument_syntax(self):
-        """Returns the argument family type.
-
-        Compilers fall into families if they try to emulate the command line
-        interface of another compiler. For example, clang is in the GCC family
-        since it accepts most of the same arguments as GCC. ICL (ICC on
-        windows) is in the MSVC family since it accepts most of the same
-        arguments as MSVC.
-        """
-        return 'other'
-
-    def get_profile_generate_args(self):
-        raise EnvironmentException(
-            '%s does not support get_profile_generate_args ' % self.get_id())
-
-    def get_profile_use_args(self):
-        raise EnvironmentException(
-            '%s does not support get_profile_use_args ' % self.get_id())
-
-    def get_undefined_link_args(self) -> T.List[str]:
-        return self.linker.get_undefined_link_args()
-
-    def remove_linkerlike_args(self, args):
-        rm_exact = ('-headerpad_max_install_names',)
-        rm_prefixes = ('-Wl,', '-L',)
-        rm_next = ('-L', '-framework',)
-        ret = []
-        iargs = iter(args)
-        for arg in iargs:
-            # Remove this argument
-            if arg in rm_exact:
-                continue
-            # If the argument starts with this, but is not *exactly* this
-            # f.ex., '-L' should match ['-Lfoo'] but not ['-L', 'foo']
-            if arg.startswith(rm_prefixes) and arg not in rm_prefixes:
-                continue
-            # Ignore this argument and the one after it
-            if arg in rm_next:
-                next(iargs)
-                continue
-            ret.append(arg)
-        return ret
-
-    def get_lto_compile_args(self) -> T.List[str]:
-        return []
-
-    def get_lto_link_args(self) -> T.List[str]:
-        return self.linker.get_lto_args()
-
-    def sanitizer_compile_args(self, value: str) -> T.List[str]:
-        return []
-
-    def sanitizer_link_args(self, value: str) -> T.List[str]:
-        return self.linker.sanitizer_args(value)
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return self.linker.get_asneeded_args()
-
-    def headerpad_args(self) -> T.List[str]:
-        return self.linker.headerpad_args()
-
-    def bitcode_args(self) -> T.List[str]:
-        return self.linker.bitcode_args()
-
-    def get_buildtype_linker_args(self, buildtype: str) -> T.List[str]:
-        return self.linker.get_buildtype_args(buildtype)
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str,
-                        darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return self.linker.get_soname_args(
-            env, prefix, shlib_name, suffix, soversion,
-            darwin_versions, is_shared_module)
-
-    def get_target_link_args(self, target):
-        return target.link_args
-
-    def get_dependency_compile_args(self, dep):
-        return dep.get_compile_args()
-
-    def get_dependency_link_args(self, dep):
-        return dep.get_link_args()
-
-    @classmethod
-    def use_linker_args(cls, linker: str) -> T.List[str]:
-        """Get a list of arguments to pass to the compiler to set the linker.
-        """
-        return []
-
-    def get_coverage_link_args(self) -> T.List[str]:
-        return self.linker.get_coverage_args()
-
-    def get_disable_assert_args(self) -> T.List[str]:
-        return []
-
-
-def get_largefile_args(compiler):
-    '''
-    Enable transparent large-file-support for 32-bit UNIX systems
-    '''
-    if not (compiler.get_argument_syntax() == 'msvc' or compiler.info.is_darwin()):
-        # Enable large-file support unconditionally on all platforms other
-        # than macOS and MSVC. macOS is now 64-bit-only so it doesn't
-        # need anything special, and MSVC doesn't have automatic LFS.
-        # You must use the 64-bit counterparts explicitly.
-        # glibc, musl, and uclibc, and all BSD libcs support this. On Android,
-        # support for transparent LFS is available depending on the version of
-        # Bionic: https://github.com/android/platform_bionic#32-bit-abi-bugs
-        # https://code.google.com/p/android/issues/detail?id=64613
-        #
-        # If this breaks your code, fix it! It's been 20+ years!
-        return ['-D_FILE_OFFSET_BITS=64']
-        # We don't enable -D_LARGEFILE64_SOURCE since that enables
-        # transitionary features and must be enabled by programs that use
-        # those features explicitly.
-    return []
-
-
-def get_args_from_envvars(lang: str,
-                          for_machine: MachineChoice,
-                          is_cross: bool,
-                          use_linker_args: bool) -> T.Tuple[T.List[str], T.List[str]]:
-    """
-    Returns a tuple of (compile_flags, link_flags) for the specified language
-    from the inherited environment
-    """
-    if lang not in cflags_mapping:
-        return [], []
-
-    compile_flags = []  # type: T.List[str]
-    link_flags = []     # type: T.List[str]
-
-    env_compile_flags = get_env_var(for_machine, is_cross, cflags_mapping[lang])
-    if env_compile_flags is not None:
-        compile_flags += split_args(env_compile_flags)
-
-    # Link flags (same for all languages)
-    if lang in languages_using_ldflags:
-        link_flags += LinkerEnvVarsMixin.get_args_from_envvars(for_machine, is_cross)
-    if use_linker_args:
-        # When the compiler is used as a wrapper around the linker (such as
-        # with GCC and Clang), the compile flags can be needed while linking
-        # too. This is also what Autotools does. However, we don't want to do
-        # this when the linker is stand-alone such as with MSVC C/C++, etc.
-        link_flags = compile_flags + link_flags
-
-    # Pre-processor flags for certain languages
-    if lang in languages_using_cppflags:
-        env_preproc_flags = get_env_var(for_machine, is_cross, 'CPPFLAGS')
-        if env_preproc_flags is not None:
-            compile_flags += split_args(env_preproc_flags)
-
-    return compile_flags, link_flags
-
-
-def get_global_options(lang: str,
-                       comp: T.Type[Compiler],
-                       for_machine: MachineChoice,
-                       is_cross: bool,
-                       properties: Properties) -> T.Dict[str, coredata.UserOption]:
-    """Retreive options that apply to all compilers for a given language."""
-    description = 'Extra arguments passed to the {}'.format(lang)
-    opts = {
-        'args': coredata.UserArrayOption(
-            description + ' compiler',
-            [], split_args=True, user_input=True, allow_dups=True),
-        'link_args': coredata.UserArrayOption(
-            description + ' linker',
-            [], split_args=True, user_input=True, allow_dups=True),
-    }
-
-    # Get from env vars.
-    compile_args, link_args = get_args_from_envvars(
-        lang,
-        for_machine,
-        is_cross,
-        comp.INVOKES_LINKER)
-
-    for k, o in opts.items():
-        user_k = lang + '_' + k
-        if user_k in properties:
-            # Get from configuration files.
-            o.set_value(properties[user_k])
-        elif k == 'args':
-            o.set_value(compile_args)
-        elif k == 'link_args':
-            o.set_value(link_args)
-
-    return opts
diff --git a/meson/mesonbuild/compilers/cpp.py b/meson/mesonbuild/compilers/cpp.py
deleted file mode 100644 (file)
index 478a68c..0000000
+++ /dev/null
@@ -1,726 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import copy
-import functools
-import os.path
-import typing as T
-
-from .. import coredata
-from .. import mlog
-from ..mesonlib import MesonException, MachineChoice, version_compare
-
-from ..linkers import LinkerEnvVarsMixin
-from .compilers import (
-    gnu_winlibs,
-    msvc_winlibs,
-    Compiler,
-)
-from .c_function_attributes import CXX_FUNC_ATTRIBUTES, C_FUNC_ATTRIBUTES
-from .mixins.clike import CLikeCompiler
-from .mixins.ccrx import CcrxCompiler
-from .mixins.c2000 import C2000Compiler
-from .mixins.arm import ArmCompiler, ArmclangCompiler
-from .mixins.visualstudio import MSVCCompiler, ClangClCompiler
-from .mixins.gnu import GnuCompiler
-from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler
-from .mixins.clang import ClangCompiler
-from .mixins.elbrus import ElbrusCompiler
-from .mixins.pgi import PGICompiler
-from .mixins.emscripten import EmscriptenMixin
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-
-def non_msvc_eh_options(eh, args):
-    if eh == 'none':
-        args.append('-fno-exceptions')
-    elif eh == 's' or eh == 'c':
-        mlog.warning('non-MSVC compilers do not support ' + eh + ' exception handling.' +
-                     'You may want to set eh to \'default\'.')
-
-class CPPCompiler(CLikeCompiler, Compiler):
-
-    @classmethod
-    def attribute_check_func(cls, name):
-        try:
-            return CXX_FUNC_ATTRIBUTES.get(name, C_FUNC_ATTRIBUTES[name])
-        except KeyError:
-            raise MesonException('Unknown function attribute "{}"'.format(name))
-
-    language = 'cpp'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice, is_cross: bool,
-                 info: 'MachineInfo', exe_wrap: T.Optional[str] = None, **kwargs):
-        # If a child ObjCPP class has already set it, don't set it ourselves
-        Compiler.__init__(self, exelist, version, for_machine, info, **kwargs)
-        CLikeCompiler.__init__(self, is_cross, exe_wrap)
-
-    @staticmethod
-    def get_display_language():
-        return 'C++'
-
-    def get_no_stdinc_args(self):
-        return ['-nostdinc++']
-
-    def sanity_check(self, work_dir, environment):
-        code = 'class breakCCompiler;int main(void) { return 0; }\n'
-        return self.sanity_check_impl(work_dir, environment, 'sanitycheckcpp.cc', code)
-
-    def get_compiler_check_args(self):
-        # -fpermissive allows non-conforming code to compile which is necessary
-        # for many C++ checks. Particularly, the has_header_symbol check is
-        # too strict without this and always fails.
-        return super().get_compiler_check_args() + ['-fpermissive']
-
-    def has_header_symbol(self, hname, symbol, prefix, env, *, extra_args=None, dependencies=None):
-        # Check if it's a C-like symbol
-        found, cached = super().has_header_symbol(hname, symbol, prefix, env,
-                                                  extra_args=extra_args,
-                                                  dependencies=dependencies)
-        if found:
-            return True, cached
-        # Check if it's a class or a template
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
-        t = '''{prefix}
-        #include <{header}>
-        using {symbol};
-        int main(void) {{ return 0; }}'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-    def _test_cpp_std_arg(self, cpp_std_value):
-        # Test whether the compiler understands a -std=XY argument
-        assert(cpp_std_value.startswith('-std='))
-
-        # This test does not use has_multi_arguments() for two reasons:
-        # 1. has_multi_arguments() requires an env argument, which the compiler
-        #    object does not have at this point.
-        # 2. even if it did have an env object, that might contain another more
-        #    recent -std= argument, which might lead to a cascaded failure.
-        CPP_TEST = 'int i = static_cast<int>(0);'
-        with self.compile(CPP_TEST, extra_args=[cpp_std_value], mode='compile') as p:
-            if p.returncode == 0:
-                mlog.debug('Compiler accepts {}:'.format(cpp_std_value), 'YES')
-                return True
-            else:
-                mlog.debug('Compiler accepts {}:'.format(cpp_std_value), 'NO')
-                return False
-
-    @functools.lru_cache()
-    def _find_best_cpp_std(self, cpp_std):
-        # The initial version mapping approach to make falling back
-        # from '-std=c++14' to '-std=c++1y' was too brittle. For instance,
-        # Apple's Clang uses a different versioning scheme to upstream LLVM,
-        # making the whole detection logic awfully brittle. Instead, let's
-        # just see if feeding GCC or Clang our '-std=' setting works, and
-        # if not, try the fallback argument.
-        CPP_FALLBACKS = {
-            'c++11': 'c++0x',
-            'gnu++11': 'gnu++0x',
-            'c++14': 'c++1y',
-            'gnu++14': 'gnu++1y',
-            'c++17': 'c++1z',
-            'gnu++17': 'gnu++1z'
-        }
-
-        # Currently, remapping is only supported for Clang, Elbrus and GCC
-        assert(self.id in frozenset(['clang', 'lcc', 'gcc', 'emscripten']))
-
-        if cpp_std not in CPP_FALLBACKS:
-            # 'c++03' and 'c++98' don't have fallback types
-            return '-std=' + cpp_std
-
-        for i in (cpp_std, CPP_FALLBACKS[cpp_std]):
-            cpp_std_value = '-std=' + i
-            if self._test_cpp_std_arg(cpp_std_value):
-                return cpp_std_value
-
-        raise MesonException('C++ Compiler does not support -std={}'.format(cpp_std))
-
-
-class ClangCPPCompiler(ClangCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines : T.Optional[T.List[str]] = None, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrapper, **kwargs)
-        ClangCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'rtti': coredata.UserBooleanOption('Enable RTTI', True),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
-                 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
-                'none',
-            ),
-        })
-        if self.info.is_windows() or self.info.is_cygwin():
-            opts.update({
-                'winlibs': coredata.UserArrayOption(
-                    'Standard Win libraries to link against',
-                    gnu_winlibs,
-                ),
-            })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append(self._find_best_cpp_std(std.value))
-
-        non_msvc_eh_options(options['eh'].value, args)
-
-        if not options['rtti'].value:
-            args.append('-fno-rtti')
-
-        return args
-
-    def get_option_link_args(self, options):
-        if self.info.is_windows() or self.info.is_cygwin():
-            return options['winlibs'].value[:]
-        return []
-
-    def language_stdlib_only_link_flags(self):
-        return ['-lstdc++']
-
-
-class AppleClangCPPCompiler(ClangCPPCompiler):
-    def language_stdlib_only_link_flags(self):
-        return ['-lc++']
-
-
-class EmscriptenCPPCompiler(EmscriptenMixin, LinkerEnvVarsMixin, ClangCPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross: bool, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        if not is_cross:
-            raise MesonException('Emscripten compiler can only be used for cross compilation.')
-        ClangCPPCompiler.__init__(self, exelist=exelist, version=version,
-                                  for_machine=for_machine, is_cross=is_cross,
-                                  info=info, exe_wrapper=exe_wrapper, **kwargs)
-        self.id = 'emscripten'
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append(self._find_best_cpp_std(std.value))
-        return args
-
-
-class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CPPCompiler.__init__(self, exelist=exelist, version=version,
-                                  for_machine=for_machine, is_cross=is_cross,
-                                  info=info, exe_wrapper=exe_wrapper, **kwargs)
-        ArmclangCompiler.__init__(self)
-        default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                [
-                    'none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17',
-                    'gnu++98', 'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17',
-                ],
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-
-        non_msvc_eh_options(options['eh'].value, args)
-
-        return args
-
-    def get_option_link_args(self, options):
-        return []
-
-
-class GnuCPPCompiler(GnuCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, defines, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrap, **kwargs)
-        GnuCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'rtti': coredata.UserBooleanOption('Enable RTTI', True),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                ['none', 'c++98', 'c++03', 'c++11', 'c++14', 'c++17', 'c++1z', 'c++2a',
-                'gnu++03', 'gnu++11', 'gnu++14', 'gnu++17', 'gnu++1z', 'gnu++2a'],
-                'none',
-            ),
-            'debugstl': coredata.UserBooleanOption(
-                'STL debug mode',
-                False,
-            )
-        })
-        if self.info.is_windows() or self.info.is_cygwin():
-            opts.update({
-                'winlibs': coredata.UserArrayOption(
-                    'Standard Win libraries to link against',
-                    gnu_winlibs,
-                ),
-            })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append(self._find_best_cpp_std(std.value))
-
-        non_msvc_eh_options(options['eh'].value, args)
-
-        if not options['rtti'].value:
-            args.append('-fno-rtti')
-
-        if options['debugstl'].value:
-            args.append('-D_GLIBCXX_DEBUG=1')
-        return args
-
-    def get_option_link_args(self, options):
-        if self.info.is_windows() or self.info.is_cygwin():
-            return options['winlibs'].value[:]
-        return []
-
-    def get_pch_use_args(self, pch_dir, header):
-        return ['-fpch-preprocess', '-include', os.path.basename(header)]
-
-    def language_stdlib_only_link_flags(self):
-        return ['-lstdc++']
-
-
-class PGICPPCompiler(PGICompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
-        PGICompiler.__init__(self)
-
-
-class ElbrusCPPCompiler(GnuCPPCompiler, ElbrusCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        GnuCPPCompiler.__init__(self, exelist, version, for_machine,
-                                is_cross, info, exe_wrapper, defines,
-                                **kwargs)
-        ElbrusCompiler.__init__(self)
-
-    # It does not support c++/gnu++ 17 and 1z, but still does support 0x, 1y, and gnu++98.
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                [
-                    'none', 'c++98', 'c++03', 'c++0x', 'c++11', 'c++14', 'c++1y',
-                    'gnu++98', 'gnu++03', 'gnu++0x', 'gnu++11', 'gnu++14', 'gnu++1y',
-                ],
-                'none',
-            ),
-            'debugstl': coredata.UserBooleanOption(
-                'STL debug mode',
-                False,
-            ),
-        })
-        return opts
-
-    # Elbrus C++ compiler does not have lchmod, but there is only linker warning, not compiler error.
-    # So we should explicitly fail at this case.
-    def has_function(self, funcname, prefix, env, *, extra_args=None, dependencies=None):
-        if funcname == 'lchmod':
-            return False, False
-        else:
-            return super().has_function(funcname, prefix, env,
-                                        extra_args=extra_args,
-                                        dependencies=dependencies)
-
-    # Elbrus C++ compiler does not support RTTI, so don't check for it.
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append(self._find_best_cpp_std(std.value))
-
-        non_msvc_eh_options(options['eh'].value, args)
-
-        if options['debugstl'].value:
-            args.append('-D_GLIBCXX_DEBUG=1')
-        return args
-
-
-class IntelCPPCompiler(IntelGnuLikeCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        IntelGnuLikeCompiler.__init__(self)
-        self.lang_header = 'c++-header'
-        default_warn_args = ['-Wall', '-w3', '-diag-disable:remark',
-                             '-Wpch-messages', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra']}
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        # Every Unix compiler under the sun seems to accept -std=c++03,
-        # with the exception of ICC. Instead of preventing the user from
-        # globally requesting C++03, we transparently remap it to C++98
-        c_stds = ['c++98', 'c++03']
-        g_stds = ['gnu++98', 'gnu++03']
-        if version_compare(self.version, '>=15.0.0'):
-            c_stds += ['c++11', 'c++14']
-            g_stds += ['gnu++11']
-        if version_compare(self.version, '>=16.0.0'):
-            c_stds += ['c++17']
-        if version_compare(self.version, '>=17.0.0'):
-            g_stds += ['gnu++14']
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'rtti': coredata.UserBooleanOption('Enable RTTI', True),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                ['none'] + c_stds + g_stds,
-                'none',
-            ),
-            'debugstl': coredata.UserBooleanOption('STL debug mode', False),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            remap_cpp03 = {
-                'c++03': 'c++98',
-                'gnu++03': 'gnu++98'
-            }
-            args.append('-std=' + remap_cpp03.get(std.value, std.value))
-        if options['eh'].value == 'none':
-            args.append('-fno-exceptions')
-        if not options['rtti'].value:
-            args.append('-fno-rtti')
-        if options['debugstl'].value:
-            args.append('-D_GLIBCXX_DEBUG=1')
-        return args
-
-    def get_option_link_args(self, options):
-        return []
-
-
-class VisualStudioLikeCPPCompilerMixin:
-
-    """Mixin for C++ specific method overrides in MSVC-like compilers."""
-
-    VC_VERSION_MAP = {
-        'none': (True, None),
-        'vc++11': (True, 11),
-        'vc++14': (True, 14),
-        'vc++17': (True, 17),
-        'vc++latest': (True, "latest"),
-        'c++11': (False, 11),
-        'c++14': (False, 14),
-        'c++17': (False, 17),
-        'c++latest': (False, "latest"),
-    }
-
-    def get_option_link_args(self, options):
-        return options['winlibs'].value[:]
-
-    def _get_options_impl(self, opts, cpp_stds: T.List[str]):
-        opts.update({
-            'eh': coredata.UserComboOption(
-                'C++ exception handling type.',
-                ['none', 'default', 'a', 's', 'sc'],
-                'default',
-            ),
-            'rtti': coredata.UserBooleanOption('Enable RTTI', True),
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                cpp_stds,
-                'none',
-            ),
-            'winlibs': coredata.UserArrayOption(
-                'Windows libs to link against.',
-                msvc_winlibs,
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-
-        eh = options['eh']
-        if eh.value == 'default':
-            args.append('/EHsc')
-        elif eh.value == 'none':
-            args.append('/EHs-c-')
-        else:
-            args.append('/EH' + eh.value)
-
-        if not options['rtti'].value:
-            args.append('/GR-')
-
-        permissive, ver = self.VC_VERSION_MAP[options['std'].value]
-
-        if ver is not None:
-            args.append('/std:c++{}'.format(ver))
-
-        if not permissive:
-            args.append('/permissive-')
-
-        return args
-
-    def get_compiler_check_args(self):
-        # XXX: this is a hack because so much GnuLike stuff is in the base CPPCompiler class.
-        return CLikeCompiler.get_compiler_check_args(self)
-
-
-class CPP11AsCPP14Mixin:
-
-    """Mixin class for VisualStudio and ClangCl to replace C++11 std with C++14.
-
-    This is a limitation of Clang and MSVC that ICL doesn't share.
-    """
-
-    def get_option_compile_args(self, options):
-        # Note: there is no explicit flag for supporting C++11; we attempt to do the best we can
-        # which means setting the C++ standard version to C++14, in compilers that support it
-        # (i.e., after VS2015U3)
-        # if one is using anything before that point, one cannot set the standard.
-        if options['std'].value in {'vc++11', 'c++11'}:
-            mlog.warning(self.id, 'does not support C++11;',
-                         'attempting best effort; setting the standard to C++14', once=True)
-            # Don't mutate anything we're going to change, we need to use
-            # deepcopy since we're messing with members, and we can't simply
-            # copy the members because the option proxy doesn't support it.
-            options = copy.deepcopy(options)
-            if options['std'].value == 'vc++11':
-                options['std'].value = 'vc++14'
-            else:
-                options['std'].value = 'c++14'
-        return super().get_option_compile_args(options)
-
-
-class VisualStudioCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixin, MSVCCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross: bool, info: 'MachineInfo', exe_wrap, target, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrap, **kwargs)
-        MSVCCompiler.__init__(self, target)
-        self.base_options = ['b_pch', 'b_vscrt'] # FIXME add lto, pgo and the like
-        self.id = 'msvc'
-
-    def get_options(self):
-        cpp_stds = ['none', 'c++11', 'vc++11']
-        # Visual Studio 2015 and later
-        if version_compare(self.version, '>=19'):
-            cpp_stds.extend(['c++14', 'c++latest', 'vc++latest'])
-        # Visual Studio 2017 and later
-        if version_compare(self.version, '>=19.11'):
-            cpp_stds.extend(['vc++14', 'c++17', 'vc++17'])
-        return self._get_options_impl(super().get_options(), cpp_stds)
-
-    def get_option_compile_args(self, options):
-        if options['std'].value != 'none' and version_compare(self.version, '<19.00.24210'):
-            mlog.warning('This version of MSVC does not support cpp_std arguments')
-            options = copy.copy(options)
-            options['std'].value = 'none'
-
-        args = super().get_option_compile_args(options)
-
-        if version_compare(self.version, '<19.11'):
-            try:
-                i = args.index('/permissive-')
-            except ValueError:
-                return args
-            del args[i]
-        return args
-
-class ClangClCPPCompiler(CPP11AsCPP14Mixin, VisualStudioLikeCPPCompilerMixin, ClangClCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, target, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        ClangClCompiler.__init__(self, target)
-        self.id = 'clang-cl'
-
-    def get_options(self):
-        cpp_stds = ['none', 'c++11', 'vc++11', 'c++14', 'vc++14', 'c++17', 'vc++17', 'c++latest']
-        return self._get_options_impl(super().get_options(), cpp_stds)
-
-
-class IntelClCPPCompiler(VisualStudioLikeCPPCompilerMixin, IntelVisualStudioLikeCompiler, CPPCompiler):
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap, target, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        IntelVisualStudioLikeCompiler.__init__(self, target)
-
-    def get_options(self):
-        # This has only been tested with version 19.0,
-        cpp_stds = ['none', 'c++11', 'vc++11', 'c++14', 'vc++14', 'c++17', 'vc++17', 'c++latest']
-        return self._get_options_impl(super().get_options(), cpp_stds)
-
-
-class ArmCPPCompiler(ArmCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap=None, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        ArmCompiler.__init__(self)
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({
-            'std': coredata.UserComboOption(
-                'C++ language standard to use',
-                ['none', 'c++03', 'c++11'],
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options):
-        args = []
-        std = options['std']
-        if std.value == 'c++11':
-            args.append('--cpp11')
-        elif std.value == 'c++03':
-            args.append('--cpp')
-        return args
-
-    def get_option_link_args(self, options):
-        return []
-
-    def get_compiler_check_args(self):
-        return []
-
-
-class CcrxCPPCompiler(CcrxCompiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap=None, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        CcrxCompiler.__init__(self)
-
-    # Override CCompiler.get_always_args
-    def get_always_args(self):
-        return ['-nologo', '-lang=cpp']
-
-    def get_option_compile_args(self, options):
-        return []
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_output_args(self, target):
-        return ['-output=obj=%s' % target]
-
-    def get_option_link_args(self, options):
-        return []
-
-    def get_compiler_check_args(self):
-        return []
-
-class C2000CPPCompiler(C2000Compiler, CPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrap=None, **kwargs):
-        CPPCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                             info, exe_wrap, **kwargs)
-        C2000Compiler.__init__(self)
-
-    def get_options(self):
-        opts = CPPCompiler.get_options(self)
-        opts.update({'cpp_std': coredata.UserComboOption('C++ language standard to use',
-                                                         ['none', 'c++03'],
-                                                         'none')})
-        return opts
-
-    def get_always_args(self):
-        return ['-nologo', '-lang=cpp']
-
-    def get_option_compile_args(self, options):
-        return []
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_output_args(self, target):
-        return ['-output=obj=%s' % target]
-
-    def get_option_link_args(self, options):
-        return []
-
-    def get_compiler_check_args(self):
-        return []
diff --git a/meson/mesonbuild/compilers/cs.py b/meson/mesonbuild/compilers/cs.py
deleted file mode 100644 (file)
index 843348e..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path, subprocess
-import typing as T
-
-from ..mesonlib import EnvironmentException
-
-from .compilers import Compiler, MachineChoice, mono_buildtype_args
-from .mixins.islinker import BasicLinkerIsCompilerMixin
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-cs_optimization_args = {'0': [],
-                        'g': [],
-                        '1': ['-optimize+'],
-                        '2': ['-optimize+'],
-                        '3': ['-optimize+'],
-                        's': ['-optimize+'],
-                        }
-
-
-class CsCompiler(BasicLinkerIsCompilerMixin, Compiler):
-
-    language = 'cs'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo', comp_id, runner=None):
-        super().__init__(exelist, version, for_machine, info)
-        self.id = comp_id
-        self.is_cross = False
-        self.runner = runner
-
-    @classmethod
-    def get_display_language(cls):
-        return 'C sharp'
-
-    def get_always_args(self):
-        return ['/nologo']
-
-    def get_linker_always_args(self):
-        return ['/nologo']
-
-    def get_output_args(self, fname):
-        return ['-out:' + fname]
-
-    def get_link_args(self, fname):
-        return ['-r:' + fname]
-
-    def get_werror_args(self):
-        return ['-warnaserror']
-
-    def split_shlib_to_parts(self, fname):
-        return None, fname
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return []
-
-    def get_linker_exelist(self):
-        return self.exelist[:]
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_coverage_args(self):
-        return []
-
-    def get_std_exe_link_args(self):
-        return []
-
-    def get_include_args(self, path):
-        return []
-
-    def get_pic_args(self):
-        return []
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-            if i[:5] == '-lib:':
-                parameter_list[idx] = i[:5] + os.path.normpath(os.path.join(build_dir, i[5:]))
-
-        return parameter_list
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def get_pch_use_args(self, pch_dir, header):
-        return []
-
-    def get_pch_name(self, header_name):
-        return ''
-
-    def sanity_check(self, work_dir, environment):
-        src = 'sanity.cs'
-        obj = 'sanity.exe'
-        source_name = os.path.join(work_dir, src)
-        with open(source_name, 'w') as ofile:
-            ofile.write('''public class Sanity {
-    static public void Main () {
-    }
-}
-''')
-        pc = subprocess.Popen(self.exelist + self.get_always_args() + [src], cwd=work_dir)
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('Mono compiler %s can not compile programs.' % self.name_string())
-        if self.runner:
-            cmdlist = [self.runner, obj]
-        else:
-            cmdlist = [os.path.join(work_dir, obj)]
-        pe = subprocess.Popen(cmdlist, cwd=work_dir)
-        pe.wait()
-        if pe.returncode != 0:
-            raise EnvironmentException('Executables created by Mono compiler %s are not runnable.' % self.name_string())
-
-    def needs_static_linker(self):
-        return False
-
-    def get_buildtype_args(self, buildtype):
-        return mono_buildtype_args[buildtype]
-
-    def get_debug_args(self, is_debug):
-        return ['-debug'] if is_debug else []
-
-    def get_optimization_args(self, optimization_level):
-        return cs_optimization_args[optimization_level]
-
-
-class MonoCompiler(CsCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo'):
-        super().__init__(exelist, version, for_machine, info, 'mono',
-                         runner='mono')
-
-
-class VisualStudioCsCompiler(CsCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo'):
-        super().__init__(exelist, version, for_machine, info, 'csc')
-
-    def get_buildtype_args(self, buildtype):
-        res = mono_buildtype_args[buildtype]
-        if not self.info.is_windows():
-            tmp = []
-            for flag in res:
-                if flag == '-debug':
-                    flag = '-debug:portable'
-                tmp.append(flag)
-            res = tmp
-        return res
diff --git a/meson/mesonbuild/compilers/cuda.py b/meson/mesonbuild/compilers/cuda.py
deleted file mode 100644 (file)
index 934ad12..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path
-import typing as T
-from functools import partial
-
-from .. import coredata
-from .. import mlog
-from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe, OptionOverrideProxy, is_windows, LibType
-from .compilers import (Compiler, cuda_buildtype_args, cuda_optimization_args,
-                        cuda_debug_args)
-
-if T.TYPE_CHECKING:
-    from ..environment import Environment  # noqa: F401
-    from ..envconfig import MachineInfo
-
-
-class CudaCompiler(Compiler):
-
-    LINKER_PREFIX = '-Xlinker='
-    language = 'cuda'
-
-    _universal_flags = {'compiler': ['-I', '-D', '-U', '-E'], 'linker': ['-l', '-L']}
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, exe_wrapper, host_compiler, info: 'MachineInfo', **kwargs):
-        super().__init__(exelist, version, for_machine, info, **kwargs)
-        self.is_cross = is_cross
-        self.exe_wrapper = exe_wrapper
-        self.host_compiler = host_compiler
-        self.base_options = host_compiler.base_options
-        self.id = 'nvcc'
-        self.warn_args = {level: self._to_host_flags(flags) for level, flags in host_compiler.warn_args.items()}
-
-    @classmethod
-    def _to_host_flags(cls, flags, phase='compiler'):
-        return list(map(partial(cls._to_host_flag, phase=phase), flags))
-
-    @classmethod
-    def _to_host_flag(cls, flag, phase):
-        if not flag[0] in ['-', '/'] or flag[:2] in cls._universal_flags[phase]:
-            return flag
-
-        return '-X{}={}'.format(phase, flag)
-
-    def needs_static_linker(self):
-        return False
-
-    def get_always_args(self):
-        return []
-
-    def get_no_stdinc_args(self):
-        return []
-
-    def thread_link_flags(self, environment):
-        return self._to_host_flags(self.host_compiler.thread_link_flags(environment))
-
-    def sanity_check(self, work_dir, environment):
-        mlog.debug('Sanity testing ' + self.get_display_language() + ' compiler:', ' '.join(self.exelist))
-        mlog.debug('Is cross compiler: %s.' % str(self.is_cross))
-
-        sname = 'sanitycheckcuda.cu'
-        code = r'''
-        #include <cuda_runtime.h>
-        #include <stdio.h>
-
-        __global__ void kernel (void) {}
-
-        int main(void){
-            struct cudaDeviceProp prop;
-            int count, i;
-            cudaError_t ret = cudaGetDeviceCount(&count);
-            if(ret != cudaSuccess){
-                fprintf(stderr, "%d\n", (int)ret);
-            }else{
-                for(i=0;i<count;i++){
-                    if(cudaGetDeviceProperties(&prop, i) == cudaSuccess){
-                        fprintf(stdout, "%d.%d\n", prop.major, prop.minor);
-                    }
-                }
-            }
-            fflush(stderr);
-            fflush(stdout);
-            return 0;
-        }
-        '''
-        binname = sname.rsplit('.', 1)[0]
-        binname += '_cross' if self.is_cross else ''
-        source_name = os.path.join(work_dir, sname)
-        binary_name = os.path.join(work_dir, binname + '.exe')
-        with open(source_name, 'w') as ofile:
-            ofile.write(code)
-
-        # The Sanity Test for CUDA language will serve as both a sanity test
-        # and a native-build GPU architecture detection test, useful later.
-        #
-        # For this second purpose, NVCC has very handy flags, --run and
-        # --run-args, that allow one to run an application with the
-        # environment set up properly. Of course, this only works for native
-        # builds; For cross builds we must still use the exe_wrapper (if any).
-        self.detected_cc = ''
-        flags = ['-w', '-cudart', 'static', source_name]
-        if self.is_cross and self.exe_wrapper is None:
-            # Linking cross built apps is painful. You can't really
-            # tell if you should use -nostdlib or not and for example
-            # on OSX the compiler binary is the same but you need
-            # a ton of compiler flags to differentiate between
-            # arm and x86_64. So just compile.
-            flags += self.get_compile_only_args()
-        flags += self.get_output_args(binary_name)
-
-        # Compile sanity check
-        cmdlist = self.exelist + flags
-        mlog.debug('Sanity check compiler command line: ', ' '.join(cmdlist))
-        pc, stdo, stde = Popen_safe(cmdlist, cwd=work_dir)
-        mlog.debug('Sanity check compile stdout: ')
-        mlog.debug(stdo)
-        mlog.debug('-----\nSanity check compile stderr:')
-        mlog.debug(stde)
-        mlog.debug('-----')
-        if pc.returncode != 0:
-            raise EnvironmentException('Compiler {0} can not compile programs.'.format(self.name_string()))
-
-        # Run sanity check (if possible)
-        if self.is_cross:
-            if self.exe_wrapper is None:
-                return
-            else:
-                cmdlist = self.exe_wrapper + [binary_name]
-        else:
-            cmdlist = self.exelist + ['--run', '"' + binary_name + '"']
-        mlog.debug('Sanity check run command line: ', ' '.join(cmdlist))
-        pe, stdo, stde = Popen_safe(cmdlist, cwd=work_dir)
-        mlog.debug('Sanity check run stdout: ')
-        mlog.debug(stdo)
-        mlog.debug('-----\nSanity check run stderr:')
-        mlog.debug(stde)
-        mlog.debug('-----')
-        pe.wait()
-        if pe.returncode != 0:
-            raise EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string()))
-
-        # Interpret the result of the sanity test.
-        # As mentioned above, it is not only a sanity test but also a GPU
-        # architecture detection test.
-        if stde == '':
-            self.detected_cc = stdo
-        else:
-            mlog.debug('cudaGetDeviceCount() returned ' + stde)
-
-    def has_header_symbol(self, hname, symbol, prefix, env, extra_args=None, dependencies=None):
-        result, cached = super().has_header_symbol(hname, symbol, prefix, env, extra_args, dependencies)
-        if result:
-            return True, cached
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
-        t = '''{prefix}
-        #include <{header}>
-        using {symbol};
-        int main(void) {{ return 0; }}'''
-        return self.compiles(t.format(**fargs), env, extra_args, dependencies)
-
-    def get_options(self):
-        opts = super().get_options()
-        opts.update({'cuda_std': coredata.UserComboOption('C++ language standard to use',
-                                                          ['none', 'c++03', 'c++11', 'c++14'],
-                                                          'none')})
-        return opts
-
-    def _to_host_compiler_options(self, options):
-        overrides = {name: opt.value for name, opt in options.copy().items()}
-        return OptionOverrideProxy(overrides, self.host_compiler.get_options())
-
-    def get_option_compile_args(self, options):
-        args = []
-        # On Windows, the version of the C++ standard used by nvcc is dictated by
-        # the combination of CUDA version and MSVC version; the --std= is thus ignored
-        # and attempting to use it will result in a warning: https://stackoverflow.com/a/51272091/741027
-        if not is_windows():
-            std = options['cuda_std']
-            if std.value != 'none':
-                args.append('--std=' + std.value)
-
-        return args + self._to_host_flags(self.host_compiler.get_option_compile_args(self._to_host_compiler_options(options)))
-
-    @classmethod
-    def _cook_link_args(cls, args: T.List[str]) -> T.List[str]:
-        # Prepare link args for nvcc
-        cooked = []  # type: T.List[str]
-        for arg in args:
-            if arg.startswith('-Wl,'): # strip GNU-style -Wl prefix
-                arg = arg.replace('-Wl,', '', 1)
-            arg = arg.replace(' ', '\\') # espace whitespace
-            cooked.append(arg)
-        return cls._to_host_flags(cooked, 'linker')
-
-    def get_option_link_args(self, options):
-        return self._cook_link_args(self.host_compiler.get_option_link_args(self._to_host_compiler_options(options)))
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def get_soname_args(self, *args):
-        return self._cook_link_args(self.host_compiler.get_soname_args(*args))
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return []
-
-    def get_compile_only_args(self):
-        return ['-c']
-
-    def get_no_optimization_args(self):
-        return ['-O0']
-
-    def get_optimization_args(self, optimization_level):
-        # alternatively, consider simply redirecting this to the host compiler, which would
-        # give us more control over options like "optimize for space" (which nvcc doesn't support):
-        # return self._to_host_flags(self.host_compiler.get_optimization_args(optimization_level))
-        return cuda_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug):
-        return cuda_debug_args[is_debug]
-
-    def get_werror_args(self):
-        return ['-Werror=cross-execution-space-call,deprecated-declarations,reorder']
-
-    def get_warn_args(self, level):
-        return self.warn_args[level]
-
-    def get_buildtype_args(self, buildtype):
-        # nvcc doesn't support msvc's "Edit and Continue" PDB format; "downgrade" to
-        # a regular PDB to avoid cl's warning to that effect (D9025 : overriding '/ZI' with '/Zi')
-        host_args = ['/Zi' if arg == '/ZI' else arg for arg in self.host_compiler.get_buildtype_args(buildtype)]
-        return cuda_buildtype_args[buildtype] + self._to_host_flags(host_args)
-
-    def get_include_args(self, path, is_system):
-        if path == '':
-            path = '.'
-        return ['-I' + path]
-
-    def get_compile_debugfile_args(self, rel_obj, **kwargs):
-        return self._to_host_flags(self.host_compiler.get_compile_debugfile_args(rel_obj, **kwargs))
-
-    def get_link_debugfile_args(self, targetfile):
-        return self._cook_link_args(self.host_compiler.get_link_debugfile_args(targetfile))
-
-    def depfile_for_object(self, objfile):
-        return objfile + '.' + self.get_depfile_suffix()
-
-    def get_depfile_suffix(self):
-        return 'd'
-
-    def get_buildtype_linker_args(self, buildtype):
-        return self._cook_link_args(self.host_compiler.get_buildtype_linker_args(buildtype))
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        (rpath_args, rpath_dirs_to_remove) = self.host_compiler.build_rpath_args(
-            env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
-        return (self._cook_link_args(rpath_args), rpath_dirs_to_remove)
-
-    def linker_to_compiler_args(self, args):
-        return args
-
-    def get_pic_args(self):
-        return self._to_host_flags(self.host_compiler.get_pic_args())
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        return []
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['-o', target]
-
-    def get_std_exe_link_args(self) -> T.List[str]:
-        return self._cook_link_args(self.host_compiler.get_std_exe_link_args())
-
-    def find_library(self, libname, env, extra_dirs, libtype: LibType = LibType.PREFER_SHARED):
-        return ['-l' + libname] # FIXME
-
-    def get_crt_compile_args(self, crt_val, buildtype):
-        return self._to_host_flags(self.host_compiler.get_crt_compile_args(crt_val, buildtype))
-
-    def get_crt_link_args(self, crt_val, buildtype):
-        # nvcc defaults to static, release version of msvc runtime and provides no
-        # native option to override it; override it with /NODEFAULTLIB
-        host_link_arg_overrides = []
-        host_crt_compile_args = self.host_compiler.get_crt_compile_args(crt_val, buildtype)
-        if any(arg in ['/MDd', '/MD', '/MTd'] for arg in host_crt_compile_args):
-            host_link_arg_overrides += ['/NODEFAULTLIB:LIBCMT.lib']
-        return self._cook_link_args(host_link_arg_overrides + self.host_compiler.get_crt_link_args(crt_val, buildtype))
-
-    def get_target_link_args(self, target):
-        return self._cook_link_args(super().get_target_link_args(target))
-
-    def get_dependency_compile_args(self, dep):
-        return self._to_host_flags(super().get_dependency_compile_args(dep))
-
-    def get_dependency_link_args(self, dep):
-        return self._cook_link_args(super().get_dependency_link_args(dep))
diff --git a/meson/mesonbuild/compilers/d.py b/meson/mesonbuild/compilers/d.py
deleted file mode 100644 (file)
index a74dc95..0000000
+++ /dev/null
@@ -1,822 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path, subprocess
-import typing as T
-
-from ..mesonlib import (
-    EnvironmentException, MachineChoice, version_compare,
-)
-
-from ..arglist import CompilerArgs
-from .compilers import (
-    d_dmd_buildtype_args,
-    d_gdc_buildtype_args,
-    d_ldc_buildtype_args,
-    clike_debug_args,
-    Compiler,
-)
-from .mixins.gnu import GnuCompiler
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-d_feature_args = {'gcc':  {'unittest': '-funittest',
-                           'debug': '-fdebug',
-                           'version': '-fversion',
-                           'import_dir': '-J'
-                           },
-                  'llvm': {'unittest': '-unittest',
-                           'debug': '-d-debug',
-                           'version': '-d-version',
-                           'import_dir': '-J'
-                           },
-                  'dmd':  {'unittest': '-unittest',
-                           'debug': '-debug',
-                           'version': '-version',
-                           'import_dir': '-J'
-                           }
-                  }
-
-ldc_optimization_args = {'0': [],
-                         'g': [],
-                         '1': ['-O1'],
-                         '2': ['-O2'],
-                         '3': ['-O3'],
-                         's': ['-Os'],
-                         }
-
-dmd_optimization_args = {'0': [],
-                         'g': [],
-                         '1': ['-O'],
-                         '2': ['-O'],
-                         '3': ['-O'],
-                         's': ['-O'],
-                         }
-
-
-class DmdLikeCompilerMixin:
-
-    LINKER_PREFIX = '-L='
-
-    def get_output_args(self, target):
-        return ['-of=' + target]
-
-    def get_linker_output_args(self, target):
-        return ['-of=' + target]
-
-    def get_include_args(self, path, is_system):
-        return ['-I=' + path]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:3] == '-I=':
-                parameter_list[idx] = i[:3] + os.path.normpath(os.path.join(build_dir, i[3:]))
-            if i[:4] == '-L-L':
-                parameter_list[idx] = i[:4] + os.path.normpath(os.path.join(build_dir, i[4:]))
-            if i[:5] == '-L=-L':
-                parameter_list[idx] = i[:5] + os.path.normpath(os.path.join(build_dir, i[5:]))
-            if i[:6] == '-Wl,-L':
-                parameter_list[idx] = i[:6] + os.path.normpath(os.path.join(build_dir, i[6:]))
-
-        return parameter_list
-
-    def get_warn_args(self, level):
-        return ['-wi']
-
-    def get_werror_args(self):
-        return ['-w']
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        # DMD and LDC does not currently return Makefile-compatible dependency info.
-        return []
-
-    def get_coverage_args(self):
-        return ['-cov']
-
-    def get_coverage_link_args(self):
-        return []
-
-    def get_preprocess_only_args(self):
-        return ['-E']
-
-    def get_compile_only_args(self):
-        return ['-c']
-
-    def depfile_for_object(self, objfile):
-        return objfile + '.' + self.get_depfile_suffix()
-
-    def get_depfile_suffix(self):
-        return 'deps'
-
-    def get_pic_args(self):
-        if self.info.is_windows():
-            return []
-        return ['-fPIC']
-
-    def get_feature_args(self, kwargs, build_to_src):
-        res = []
-        if 'unittest' in kwargs:
-            unittest = kwargs.pop('unittest')
-            unittest_arg = d_feature_args[self.id]['unittest']
-            if not unittest_arg:
-                raise EnvironmentException('D compiler %s does not support the "unittest" feature.' % self.name_string())
-            if unittest:
-                res.append(unittest_arg)
-
-        if 'debug' in kwargs:
-            debug_level = -1
-            debugs = kwargs.pop('debug')
-            if not isinstance(debugs, list):
-                debugs = [debugs]
-
-            debug_arg = d_feature_args[self.id]['debug']
-            if not debug_arg:
-                raise EnvironmentException('D compiler %s does not support conditional debug identifiers.' % self.name_string())
-
-            # Parse all debug identifiers and the largest debug level identifier
-            for d in debugs:
-                if isinstance(d, int):
-                    if d > debug_level:
-                        debug_level = d
-                elif isinstance(d, str) and d.isdigit():
-                    if int(d) > debug_level:
-                        debug_level = int(d)
-                else:
-                    res.append('{0}={1}'.format(debug_arg, d))
-
-            if debug_level >= 0:
-                res.append('{0}={1}'.format(debug_arg, debug_level))
-
-        if 'versions' in kwargs:
-            version_level = -1
-            versions = kwargs.pop('versions')
-            if not isinstance(versions, list):
-                versions = [versions]
-
-            version_arg = d_feature_args[self.id]['version']
-            if not version_arg:
-                raise EnvironmentException('D compiler %s does not support conditional version identifiers.' % self.name_string())
-
-            # Parse all version identifiers and the largest version level identifier
-            for v in versions:
-                if isinstance(v, int):
-                    if v > version_level:
-                        version_level = v
-                elif isinstance(v, str) and v.isdigit():
-                    if int(v) > version_level:
-                        version_level = int(v)
-                else:
-                    res.append('{0}={1}'.format(version_arg, v))
-
-            if version_level >= 0:
-                res.append('{0}={1}'.format(version_arg, version_level))
-
-        if 'import_dirs' in kwargs:
-            import_dirs = kwargs.pop('import_dirs')
-            if not isinstance(import_dirs, list):
-                import_dirs = [import_dirs]
-
-            import_dir_arg = d_feature_args[self.id]['import_dir']
-            if not import_dir_arg:
-                raise EnvironmentException('D compiler %s does not support the "string import directories" feature.' % self.name_string())
-            for idir_obj in import_dirs:
-                basedir = idir_obj.get_curdir()
-                for idir in idir_obj.get_incdirs():
-                    # Avoid superfluous '/.' at the end of paths when d is '.'
-                    if idir not in ('', '.'):
-                        expdir = os.path.join(basedir, idir)
-                    else:
-                        expdir = basedir
-                    srctreedir = os.path.join(build_to_src, expdir)
-                    res.append('{0}{1}'.format(import_dir_arg, srctreedir))
-
-        if kwargs:
-            raise EnvironmentException('Unknown D compiler feature(s) selected: %s' % ', '.join(kwargs.keys()))
-
-        return res
-
-    def get_buildtype_linker_args(self, buildtype):
-        if buildtype != 'plain':
-            return self.get_target_arch_args()
-        return []
-
-    def get_std_exe_link_args(self):
-        return []
-
-    def gen_import_library_args(self, implibname):
-        return self.linker.import_library_args(implibname)
-
-    def build_rpath_args(self, env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath):
-        if self.info.is_windows():
-            return ([], set())
-
-        # GNU ld, solaris ld, and lld acting like GNU ld
-        if self.linker.id.startswith('ld'):
-            # The way that dmd and ldc pass rpath to gcc is different than we would
-            # do directly, each argument -rpath and the value to rpath, need to be
-            # split into two separate arguments both prefaced with the -L=.
-            args = []
-            (rpath_args, rpath_dirs_to_remove) = super().build_rpath_args(
-                    env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
-            for r in rpath_args:
-                if ',' in r:
-                    a, b = r.split(',', maxsplit=1)
-                    args.append(a)
-                    args.append(self.LINKER_PREFIX + b)
-                else:
-                    args.append(r)
-            return (args, rpath_dirs_to_remove)
-
-        return super().build_rpath_args(
-            env, build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
-
-    def translate_args_to_nongnu(self, args):
-        dcargs = []
-        # Translate common arguments to flags the LDC/DMD compilers
-        # can understand.
-        # The flags might have been added by pkg-config files,
-        # and are therefore out of the user's control.
-        for arg in args:
-            # Translate OS specific arguments first.
-            osargs = []
-            if self.info.is_windows():
-                osargs = self.translate_arg_to_windows(arg)
-            elif self.info.is_darwin():
-                osargs = self.translate_arg_to_osx(arg)
-            if osargs:
-                dcargs.extend(osargs)
-                continue
-
-            # Translate common D arguments here.
-            if arg == '-pthread':
-                continue
-            if arg.startswith('-fstack-protector'):
-                continue
-            if arg.startswith('-D'):
-                continue
-            if arg.startswith('-Wl,'):
-                # Translate linker arguments here.
-                linkargs = arg[arg.index(',') + 1:].split(',')
-                for la in linkargs:
-                    dcargs.append('-L=' + la.strip())
-                continue
-            elif arg.startswith(('-link-defaultlib', '-linker', '-link-internally', '-linkonce-templates', '-lib')):
-                # these are special arguments to the LDC linker call,
-                # arguments like "-link-defaultlib-shared" do *not*
-                # denote a library to be linked, but change the default
-                # Phobos/DRuntime linking behavior, while "-linker" sets the
-                # default linker.
-                dcargs.append(arg)
-                continue
-            elif arg.startswith('-l'):
-                # translate library link flag
-                dcargs.append('-L=' + arg)
-                continue
-            elif arg.startswith('-isystem'):
-                # translate -isystem system include path
-                # this flag might sometimes be added by C library Cflags via
-                # pkg-config.
-                # NOTE: -isystem and -I are not 100% equivalent, so this is just
-                # a workaround for the most common cases.
-                if arg.startswith('-isystem='):
-                    dcargs.append('-I=' + arg[9:])
-                else:
-                    dcargs.append('-I' + arg[8:])
-                continue
-            elif arg.startswith('-idirafter'):
-                # same as -isystem, but appends the path instead
-                if arg.startswith('-idirafter='):
-                    dcargs.append('-I=' + arg[11:])
-                else:
-                    dcargs.append('-I' + arg[10:])
-                continue
-            elif arg.startswith('-L/') or arg.startswith('-L./'):
-                # we need to handle cases where -L is set by e.g. a pkg-config
-                # setting to select a linker search path. We can however not
-                # unconditionally prefix '-L' with '-L' because the user might
-                # have set this flag too to do what it is intended to for this
-                # compiler (pass flag through to the linker)
-                # Hence, we guess here whether the flag was intended to pass
-                # a linker search path.
-
-                # Make sure static library files are passed properly to the linker.
-                if arg.endswith('.a') or arg.endswith('.lib'):
-                    if arg.startswith('-L='):
-                        farg = arg[3:]
-                    else:
-                        farg = arg[2:]
-                    if len(farg) > 0 and not farg.startswith('-'):
-                        dcargs.append('-L=' + farg)
-                        continue
-
-                dcargs.append('-L=' + arg)
-                continue
-            elif not arg.startswith('-') and arg.endswith(('.a', '.lib')):
-                # ensure static libraries are passed through to the linker
-                dcargs.append('-L=' + arg)
-                continue
-            else:
-                dcargs.append(arg)
-
-        return dcargs
-
-    @classmethod
-    def translate_arg_to_windows(cls, arg):
-        args = []
-        if arg.startswith('-Wl,'):
-            # Translate linker arguments here.
-            linkargs = arg[arg.index(',') + 1:].split(',')
-            for la in linkargs:
-                if la.startswith('--out-implib='):
-                    # Import library name
-                    args.append('-L=/IMPLIB:' + la[13:].strip())
-        elif arg.startswith('-mscrtlib='):
-            args.append(arg)
-            mscrtlib = arg[10:].lower()
-            if cls is LLVMDCompiler:
-                # Default crt libraries for LDC2 must be excluded for other
-                # selected crt options.
-                if mscrtlib != 'libcmt':
-                    args.append('-L=/NODEFAULTLIB:libcmt')
-                    args.append('-L=/NODEFAULTLIB:libvcruntime')
-
-                # Fixes missing definitions for printf-functions in VS2017
-                if mscrtlib.startswith('msvcrt'):
-                    args.append('-L=/DEFAULTLIB:legacy_stdio_definitions.lib')
-
-        return args
-
-    @classmethod
-    def translate_arg_to_osx(cls, arg):
-        args = []
-        if arg.startswith('-install_name'):
-            args.append('-L=' + arg)
-        return args
-
-    def get_debug_args(self, is_debug):
-        ddebug_args = []
-        if is_debug:
-            ddebug_args = [d_feature_args[self.id]['debug']]
-
-        return clike_debug_args[is_debug] + ddebug_args
-
-    def get_crt_args(self, crt_val, buildtype):
-        if not self.info.is_windows():
-            return []
-
-        if crt_val in self.mscrt_args:
-            return self.mscrt_args[crt_val]
-        assert(crt_val == 'from_buildtype')
-
-        # Match what build type flags used to do.
-        if buildtype == 'plain':
-            return []
-        elif buildtype == 'debug':
-            return self.mscrt_args['mdd']
-        elif buildtype == 'debugoptimized':
-            return self.mscrt_args['md']
-        elif buildtype == 'release':
-            return self.mscrt_args['md']
-        elif buildtype == 'minsize':
-            return self.mscrt_args['md']
-        else:
-            assert(buildtype == 'custom')
-            raise EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".')
-
-    def get_soname_args(self, *args, **kwargs) -> T.List[str]:
-        # LDC and DMD actually do use a linker, but they proxy all of that with
-        # their own arguments
-        if self.linker.id.startswith('ld.'):
-            soargs = []
-            for arg in super().get_soname_args(*args, **kwargs):
-                a, b = arg.split(',', maxsplit=1)
-                soargs.append(a)
-                soargs.append(self.LINKER_PREFIX + b)
-            return soargs
-        elif self.linker.id.startswith('ld64'):
-            soargs = []
-            for arg in super().get_soname_args(*args, **kwargs):
-                if not arg.startswith(self.LINKER_PREFIX):
-                    soargs.append(self.LINKER_PREFIX + arg)
-                else:
-                    soargs.append(arg)
-            return soargs
-        else:
-            return super().get_soname_args(*args, **kwargs)
-
-    def get_allow_undefined_link_args(self) -> T.List[str]:
-        args = self.linker.get_allow_undefined_args()
-        if self.info.is_darwin():
-            # On macOS we're passing these options to the C compiler, but
-            # they're linker options and need -Wl, so clang/gcc knows what to
-            # do with them. I'm assuming, but don't know for certain, that
-            # ldc/dmd do some kind of mapping internally for arguments they
-            # understand, but pass arguments they don't understand directly.
-            args = [a.replace('-L=', '-Xcc=-Wl,') for a in args]
-        return args
-
-class DCompilerArgs(CompilerArgs):
-    prepend_prefixes = ('-I', '-L')
-    dedup2_prefixes = ('-I')
-
-class DCompiler(Compiler):
-    mscrt_args = {
-        'none': ['-mscrtlib='],
-        'md': ['-mscrtlib=msvcrt'],
-        'mdd': ['-mscrtlib=msvcrtd'],
-        'mt': ['-mscrtlib=libcmt'],
-        'mtd': ['-mscrtlib=libcmtd'],
-    }
-
-    language = 'd'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo', arch, is_cross, exe_wrapper, **kwargs):
-        super().__init__(exelist, version, for_machine, info, **kwargs)
-        self.id = 'unknown'
-        self.arch = arch
-        self.exe_wrapper = exe_wrapper
-        self.is_cross = is_cross
-
-    def sanity_check(self, work_dir, environment):
-        source_name = os.path.join(work_dir, 'sanity.d')
-        output_name = os.path.join(work_dir, 'dtest')
-        with open(source_name, 'w') as ofile:
-            ofile.write('''void main() { }''')
-        pc = subprocess.Popen(self.exelist + self.get_output_args(output_name) + self.get_target_arch_args() + [source_name], cwd=work_dir)
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('D compiler %s can not compile programs.' % self.name_string())
-        if self.is_cross:
-            if self.exe_wrapper is None:
-                # Can't check if the binaries run so we have to assume they do
-                return
-            cmdlist = self.exe_wrapper.get_command() + [output_name]
-        else:
-            cmdlist = [output_name]
-        if subprocess.call(cmdlist) != 0:
-            raise EnvironmentException('Executables created by D compiler %s are not runnable.' % self.name_string())
-
-    def needs_static_linker(self):
-        return True
-
-    def depfile_for_object(self, objfile):
-        return objfile + '.' + self.get_depfile_suffix()
-
-    def get_depfile_suffix(self):
-        return 'deps'
-
-    def get_pic_args(self):
-        if self.info.is_windows():
-            return []
-        return ['-fPIC']
-
-    def get_feature_args(self, kwargs, build_to_src):
-        res = []
-        if 'unittest' in kwargs:
-            unittest = kwargs.pop('unittest')
-            unittest_arg = d_feature_args[self.id]['unittest']
-            if not unittest_arg:
-                raise EnvironmentException('D compiler %s does not support the "unittest" feature.' % self.name_string())
-            if unittest:
-                res.append(unittest_arg)
-
-        if 'debug' in kwargs:
-            debug_level = -1
-            debugs = kwargs.pop('debug')
-            if not isinstance(debugs, list):
-                debugs = [debugs]
-
-            debug_arg = d_feature_args[self.id]['debug']
-            if not debug_arg:
-                raise EnvironmentException('D compiler %s does not support conditional debug identifiers.' % self.name_string())
-
-            # Parse all debug identifiers and the largest debug level identifier
-            for d in debugs:
-                if isinstance(d, int):
-                    if d > debug_level:
-                        debug_level = d
-                elif isinstance(d, str) and d.isdigit():
-                    if int(d) > debug_level:
-                        debug_level = int(d)
-                else:
-                    res.append('{0}={1}'.format(debug_arg, d))
-
-            if debug_level >= 0:
-                res.append('{0}={1}'.format(debug_arg, debug_level))
-
-        if 'versions' in kwargs:
-            version_level = -1
-            versions = kwargs.pop('versions')
-            if not isinstance(versions, list):
-                versions = [versions]
-
-            version_arg = d_feature_args[self.id]['version']
-            if not version_arg:
-                raise EnvironmentException('D compiler %s does not support conditional version identifiers.' % self.name_string())
-
-            # Parse all version identifiers and the largest version level identifier
-            for v in versions:
-                if isinstance(v, int):
-                    if v > version_level:
-                        version_level = v
-                elif isinstance(v, str) and v.isdigit():
-                    if int(v) > version_level:
-                        version_level = int(v)
-                else:
-                    res.append('{0}={1}'.format(version_arg, v))
-
-            if version_level >= 0:
-                res.append('{0}={1}'.format(version_arg, version_level))
-
-        if 'import_dirs' in kwargs:
-            import_dirs = kwargs.pop('import_dirs')
-            if not isinstance(import_dirs, list):
-                import_dirs = [import_dirs]
-
-            import_dir_arg = d_feature_args[self.id]['import_dir']
-            if not import_dir_arg:
-                raise EnvironmentException('D compiler %s does not support the "string import directories" feature.' % self.name_string())
-            for idir_obj in import_dirs:
-                basedir = idir_obj.get_curdir()
-                for idir in idir_obj.get_incdirs():
-                    # Avoid superfluous '/.' at the end of paths when d is '.'
-                    if idir not in ('', '.'):
-                        expdir = os.path.join(basedir, idir)
-                    else:
-                        expdir = basedir
-                    srctreedir = os.path.join(build_to_src, expdir)
-                    res.append('{0}{1}'.format(import_dir_arg, srctreedir))
-
-        if kwargs:
-            raise EnvironmentException('Unknown D compiler feature(s) selected: %s' % ', '.join(kwargs.keys()))
-
-        return res
-
-    def get_buildtype_linker_args(self, buildtype):
-        if buildtype != 'plain':
-            return self.get_target_arch_args()
-        return []
-
-    def get_std_exe_link_args(self):
-        return []
-
-    def _get_compiler_check_args(self, env, extra_args, dependencies, mode='compile'):
-        if callable(extra_args):
-            extra_args = extra_args(mode)
-        if extra_args is None:
-            extra_args = []
-        elif isinstance(extra_args, str):
-            extra_args = [extra_args]
-        if dependencies is None:
-            dependencies = []
-        elif not isinstance(dependencies, list):
-            dependencies = [dependencies]
-        # Collect compiler arguments
-        args = self.compiler_args()
-        for d in dependencies:
-            # Add compile flags needed by dependencies
-            args += d.get_compile_args()
-            if mode == 'link':
-                # Add link flags needed to find dependencies
-                args += d.get_link_args()
-
-        if mode == 'compile':
-            # Add DFLAGS from the env
-            args += env.coredata.get_external_args(self.for_machine, self.language)
-        elif mode == 'link':
-            # Add LDFLAGS from the env
-            args += env.coredata.get_external_link_args(self.for_machine, self.language)
-        # extra_args must override all other arguments, so we add them last
-        args += extra_args
-        return args
-
-    def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> DCompilerArgs:
-        return DCompilerArgs(self, args)
-
-    def compiles(self, code, env, *, extra_args=None, dependencies=None, mode='compile'):
-        args = self._get_compiler_check_args(env, extra_args, dependencies, mode)
-
-        with self.cached_compile(code, env.coredata, extra_args=args, mode=mode) as p:
-            return p.returncode == 0, p.cached
-
-    def has_multi_arguments(self, args, env):
-        return self.compiles('int i;\n', env, extra_args=args)
-
-    def get_target_arch_args(self):
-        # LDC2 on Windows targets to current OS architecture, but
-        # it should follow the target specified by the MSVC toolchain.
-        if self.info.is_windows():
-            if self.arch == 'x86_64':
-                return ['-m64']
-            return ['-m32']
-        return []
-
-    def get_crt_compile_args(self, crt_val, buildtype):
-        return []
-
-    def get_crt_link_args(self, crt_val, buildtype):
-        return []
-
-    def thread_link_flags(self, env):
-        return self.linker.thread_flags(env)
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-
-class GnuDCompiler(GnuCompiler, DCompiler):
-
-    # we mostly want DCompiler, but that gives us the Compiler.LINKER_PREFIX instead
-    LINKER_PREFIX = GnuCompiler.LINKER_PREFIX
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo', is_cross, exe_wrapper, arch, **kwargs):
-        DCompiler.__init__(self, exelist, version, for_machine, info, is_cross, exe_wrapper, arch, **kwargs)
-        GnuCompiler.__init__(self, {})
-        self.id = 'gcc'
-        default_warn_args = ['-Wall', '-Wdeprecated']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-        self.base_options = ['b_colorout', 'b_sanitize', 'b_staticpic',
-                             'b_vscrt', 'b_coverage', 'b_pgo', 'b_ndebug']
-
-        self._has_color_support = version_compare(self.version, '>=4.9')
-        # dependencies were implemented before, but broken - support was fixed in GCC 7.1+
-        # (and some backported versions)
-        self._has_deps_support = version_compare(self.version, '>=7.1')
-
-    def get_colorout_args(self, colortype):
-        if self._has_color_support:
-            super().get_colorout_args(colortype)
-        return []
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        if self._has_deps_support:
-            return super().get_dependency_gen_args(outtarget, outfile)
-        return []
-
-    def get_warn_args(self, level):
-        return self.warn_args[level]
-
-    def get_buildtype_args(self, buildtype):
-        return d_gdc_buildtype_args[buildtype]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
-
-    def get_allow_undefined_link_args(self) -> T.List[str]:
-        return self.linker.get_allow_undefined_args()
-
-    def get_linker_always_args(self) -> T.List[str]:
-        args = super().get_linker_always_args()
-        if self.info.is_windows():
-            return args
-        return args + ['-shared-libphobos']
-
-    def get_disable_assert_args(self):
-        return ['-frelease']
-
-
-class LLVMDCompiler(DmdLikeCompilerMixin, DCompiler):
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo', arch, **kwargs):
-        DCompiler.__init__(self, exelist, version, for_machine, info, arch, False, None, **kwargs)
-        self.id = 'llvm'
-        self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']
-
-    def get_colorout_args(self, colortype):
-        if colortype == 'always':
-            return ['-enable-color']
-        return []
-
-    def get_warn_args(self, level):
-        if level == '2' or level == '3':
-            return ['-wi', '-dw']
-        elif level == '1':
-            return ['-wi']
-        else:
-            return []
-
-    def get_buildtype_args(self, buildtype):
-        if buildtype != 'plain':
-            return self.get_target_arch_args() + d_ldc_buildtype_args[buildtype]
-        return d_ldc_buildtype_args[buildtype]
-
-    def get_pic_args(self):
-        return ['-relocation-model=pic']
-
-    def get_crt_link_args(self, crt_val, buildtype):
-        return self.get_crt_args(crt_val, buildtype)
-
-    def unix_args_to_native(self, args):
-        return self.translate_args_to_nongnu(args)
-
-    def get_optimization_args(self, optimization_level):
-        return ldc_optimization_args[optimization_level]
-
-    @classmethod
-    def use_linker_args(cls, linker: str) -> T.List[str]:
-        return ['-linker={}'.format(linker)]
-
-    def get_linker_always_args(self) -> T.List[str]:
-        args = super().get_linker_always_args()
-        if self.info.is_windows():
-            return args
-        return args + ['-link-defaultlib-shared']
-
-    def get_disable_assert_args(self) -> T.List[str]:
-        return ['--release']
-
-
-class DmdDCompiler(DmdLikeCompilerMixin, DCompiler):
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo', arch, **kwargs):
-        DCompiler.__init__(self, exelist, version, for_machine, info, arch, False, None, **kwargs)
-        self.id = 'dmd'
-        self.base_options = ['b_coverage', 'b_colorout', 'b_vscrt', 'b_ndebug']
-
-    def get_colorout_args(self, colortype):
-        if colortype == 'always':
-            return ['-color=on']
-        return []
-
-    def get_buildtype_args(self, buildtype):
-        if buildtype != 'plain':
-            return self.get_target_arch_args() + d_dmd_buildtype_args[buildtype]
-        return d_dmd_buildtype_args[buildtype]
-
-    def get_std_exe_link_args(self):
-        if self.info.is_windows():
-            # DMD links against D runtime only when main symbol is found,
-            # so these needs to be inserted when linking static D libraries.
-            if self.arch == 'x86_64':
-                return ['phobos64.lib']
-            elif self.arch == 'x86_mscoff':
-                return ['phobos32mscoff.lib']
-            return ['phobos.lib']
-        return []
-
-    def get_std_shared_lib_link_args(self):
-        libname = 'libphobos2.so'
-        if self.info.is_windows():
-            if self.arch == 'x86_64':
-                libname = 'phobos64.lib'
-            elif self.arch == 'x86_mscoff':
-                libname = 'phobos32mscoff.lib'
-            else:
-                libname = 'phobos.lib'
-        return ['-shared', '-defaultlib=' + libname]
-
-    def get_target_arch_args(self):
-        # DMD32 and DMD64 on 64-bit Windows defaults to 32-bit (OMF).
-        # Force the target to 64-bit in order to stay consistent
-        # across the different platforms.
-        if self.info.is_windows():
-            if self.arch == 'x86_64':
-                return ['-m64']
-            elif self.arch == 'x86_mscoff':
-                return ['-m32mscoff']
-            return ['-m32']
-        return []
-
-    def get_crt_compile_args(self, crt_val, buildtype):
-        return self.get_crt_args(crt_val, buildtype)
-
-    def unix_args_to_native(self, args):
-        return self.translate_args_to_nongnu(args)
-
-    def get_optimization_args(self, optimization_level):
-        return dmd_optimization_args[optimization_level]
-
-    def can_linker_accept_rsp(self) -> bool:
-        return False
-
-    def get_linker_always_args(self) -> T.List[str]:
-        args = super().get_linker_always_args()
-        if self.info.is_windows():
-            return args
-        return args + ['-defaultlib=phobos2', '-debuglib=phobos2']
-
-    def get_disable_assert_args(self) -> T.List[str]:
-        return ['-release']
diff --git a/meson/mesonbuild/compilers/fortran.py b/meson/mesonbuild/compilers/fortran.py
deleted file mode 100644 (file)
index af83c0e..0000000
+++ /dev/null
@@ -1,470 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from pathlib import Path
-import typing as T
-import subprocess, os
-
-from .. import coredata
-from .compilers import (
-    clike_debug_args,
-    Compiler,
-)
-from .mixins.clike import CLikeCompiler
-from .mixins.gnu import (
-    GnuCompiler, gnulike_buildtype_args, gnu_optimization_args,
-)
-from .mixins.intel import IntelGnuLikeCompiler, IntelVisualStudioLikeCompiler
-from .mixins.clang import ClangCompiler
-from .mixins.elbrus import ElbrusCompiler
-from .mixins.pgi import PGICompiler
-from .. import mlog
-
-from mesonbuild.mesonlib import (
-    version_compare, EnvironmentException, MesonException, MachineChoice, LibType
-)
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-
-class FortranCompiler(CLikeCompiler, Compiler):
-
-    language = 'fortran'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        Compiler.__init__(self, exelist, version, for_machine, info, **kwargs)
-        CLikeCompiler.__init__(self, is_cross, exe_wrapper)
-        self.id = 'unknown'
-
-    def has_function(self, funcname, prefix, env, *, extra_args=None, dependencies=None):
-        raise MesonException('Fortran does not have "has_function" capability.\n'
-                             'It is better to test if a Fortran capability is working like:\n\n'
-                             "meson.get_compiler('fortran').links('block; end block; end program')\n\n"
-                             'that example is to see if the compiler has Fortran 2008 Block element.')
-
-    def sanity_check(self, work_dir: Path, environment):
-        """
-        Check to be sure a minimal program can compile and execute
-          with this compiler & platform.
-        """
-        work_dir = Path(work_dir)
-        source_name = work_dir / 'sanitycheckf.f90'
-        binary_name = work_dir / 'sanitycheckf'
-        if binary_name.is_file():
-            binary_name.unlink()
-
-        source_name.write_text('print *, "Fortran compilation is working."; end')
-
-        extra_flags = []
-        extra_flags += environment.coredata.get_external_args(self.for_machine, self.language)
-        extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
-        extra_flags += self.get_always_args()
-        # %% build the test executable "sanitycheckf"
-        # cwd=work_dir is necessary on Windows especially for Intel compilers to avoid error: cannot write on sanitycheckf.obj
-        # this is a defect with how Windows handles files and ifort's object file-writing behavior vis concurrent ProcessPoolExecutor.
-        # This simple workaround solves the issue.
-        # FIXME: cwd=str(work_dir) is for Python 3.5 on Windows, when 3.5 is deprcated, this can become cwd=work_dir
-        returncode = subprocess.run(self.exelist + extra_flags + [str(source_name), '-o', str(binary_name)],
-                                    cwd=str(work_dir)).returncode
-        if returncode != 0:
-            raise EnvironmentException('Compiler %s can not compile programs.' % self.name_string())
-        if self.is_cross:
-            if self.exe_wrapper is None:
-                # Can't check if the binaries run so we have to assume they do
-                return
-            cmdlist = self.exe_wrapper + [str(binary_name)]
-        else:
-            cmdlist = [str(binary_name)]
-        # %% Run the test executable
-        try:
-            returncode = subprocess.run(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL).returncode
-            if returncode != 0:
-                raise EnvironmentException('Executables created by Fortran compiler %s are not runnable.' % self.name_string())
-        except OSError:
-            raise EnvironmentException('Executables created by Fortran compiler %s are not runnable.' % self.name_string())
-
-    def get_std_warn_args(self, level):
-        return FortranCompiler.std_warn_args
-
-    def get_buildtype_args(self, buildtype):
-        return gnulike_buildtype_args[buildtype]
-
-    def get_optimization_args(self, optimization_level):
-        return gnu_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug):
-        return clike_debug_args[is_debug]
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return []
-
-    def get_preprocess_only_args(self):
-        return ['-cpp'] + super().get_preprocess_only_args()
-
-    def get_module_incdir_args(self):
-        return ('-I', )
-
-    def get_module_outdir_args(self, path):
-        return ['-module', path]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
-
-    def module_name_to_filename(self, module_name: str) -> str:
-        if '_' in module_name:  # submodule
-            s = module_name.lower()
-            if self.id in ('gcc', 'intel', 'intel-cl'):
-                filename = s.replace('_', '@') + '.smod'
-            elif self.id in ('pgi', 'flang'):
-                filename = s.replace('_', '-') + '.mod'
-            else:
-                filename = s + '.mod'
-        else:  # module
-            filename = module_name.lower() + '.mod'
-
-        return filename
-
-    def find_library(self, libname, env, extra_dirs, libtype: LibType = LibType.PREFER_SHARED):
-        code = 'stop; end program'
-        return self.find_library_impl(libname, env, extra_dirs, code, libtype)
-
-    def has_multi_arguments(self, args: T.Sequence[str], env):
-        for arg in args[:]:
-            # some compilers, e.g. GCC, don't warn for unsupported warning-disable
-            # flags, so when we are testing a flag like "-Wno-forgotten-towel", also
-            # check the equivalent enable flag too "-Wforgotten-towel"
-            # GCC does error for "-fno-foobar"
-            if arg.startswith('-Wno-'):
-                args.append('-W' + arg[5:])
-            if arg.startswith('-Wl,'):
-                mlog.warning('{} looks like a linker argument, '
-                             'but has_argument and other similar methods only '
-                             'support checking compiler arguments. Using them '
-                             'to check linker arguments are never supported, '
-                             'and results are likely to be wrong regardless of '
-                             'the compiler you are using. has_link_argument or '
-                             'other similar method can be used instead.'
-                             .format(arg))
-        code = 'stop; end program'
-        return self.has_arguments(args, env, code, mode='compile')
-
-
-class GnuFortranCompiler(GnuCompiler, FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        GnuCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic', '-fimplicit-none']}
-
-    def get_options(self):
-        opts = FortranCompiler.get_options(self)
-        fortran_stds = ['legacy', 'f95', 'f2003']
-        if version_compare(self.version, '>=4.4.0'):
-            fortran_stds += ['f2008']
-        if version_compare(self.version, '>=8.0.0'):
-            fortran_stds += ['f2018']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'Fortran language standard to use',
-                ['none'] + fortran_stds,
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options) -> T.List[str]:
-        args = []
-        std = options['std']
-        if std.value != 'none':
-            args.append('-std=' + std.value)
-        return args
-
-    def get_dependency_gen_args(self, outtarget, outfile) -> T.List[str]:
-        # Disabled until this is fixed:
-        # https://gcc.gnu.org/bugzilla/show_bug.cgi?id=62162
-        # return ['-cpp', '-MD', '-MQ', outtarget]
-        return []
-
-    def get_module_outdir_args(self, path: str) -> T.List[str]:
-        return ['-J' + path]
-
-    def language_stdlib_only_link_flags(self) -> T.List[str]:
-        return ['-lgfortran', '-lm']
-
-    def has_header(self, hname, prefix, env, *, extra_args=None, dependencies=None, disable_cache=False):
-        '''
-        Derived from mixins/clike.py:has_header, but without C-style usage of
-        __has_include which breaks with GCC-Fortran 10:
-        https://github.com/mesonbuild/meson/issues/7017
-        '''
-        fargs = {'prefix': prefix, 'header': hname}
-        code = '{prefix}\n#include <{header}>'
-        return self.compiles(code.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies, mode='preprocess', disable_cache=disable_cache)
-
-
-class ElbrusFortranCompiler(GnuFortranCompiler, ElbrusCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        GnuFortranCompiler.__init__(self, exelist, version, for_machine,
-                                    is_cross, info, exe_wrapper, defines,
-                                    **kwargs)
-        ElbrusCompiler.__init__(self)
-
-class G95FortranCompiler(FortranCompiler):
-
-    LINKER_PREFIX = '-Wl,'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        self.id = 'g95'
-        default_warn_args = ['-Wall']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-pedantic']}
-
-    def get_module_outdir_args(self, path: str) -> T.List[str]:
-        return ['-fmod=' + path]
-
-    def get_no_warn_args(self):
-        # FIXME: Confirm that there's no compiler option to disable all warnings
-        return []
-
-
-class SunFortranCompiler(FortranCompiler):
-
-    LINKER_PREFIX = '-Wl,'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
-        self.id = 'sun'
-
-    def get_dependency_gen_args(self, outtarget, outfile) -> T.List[str]:
-        return ['-fpp']
-
-    def get_always_args(self):
-        return []
-
-    def get_warn_args(self, level):
-        return []
-
-    def get_module_incdir_args(self):
-        return ('-M', )
-
-    def get_module_outdir_args(self, path: str) -> T.List[str]:
-        return ['-moddir=' + path]
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-xopenmp']
-
-
-class IntelFortranCompiler(IntelGnuLikeCompiler, FortranCompiler):
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        self.file_suffixes = ('f90', 'f', 'for', 'ftn', 'fpp')
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        # FIXME: Add support for OS X and Windows in detect_fortran_compiler so
-        # we are sent the type of compiler
-        IntelGnuLikeCompiler.__init__(self)
-        self.id = 'intel'
-        default_warn_args = ['-warn', 'general', '-warn', 'truncated_source']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-warn', 'unused'],
-                          '3': ['-warn', 'all']}
-
-    def get_options(self):
-        opts = FortranCompiler.get_options(self)
-        fortran_stds = ['legacy', 'f95', 'f2003', 'f2008', 'f2018']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'Fortran language standard to use',
-                ['none'] + fortran_stds,
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options) -> T.List[str]:
-        args = []
-        std = options['std']
-        stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
-        if std.value != 'none':
-            args.append('-stand=' + stds[std.value])
-        return args
-
-    def get_preprocess_only_args(self) -> T.List[str]:
-        return ['-cpp', '-EP']
-
-    def get_always_args(self):
-        """Ifort doesn't have -pipe."""
-        val = super().get_always_args()
-        val.remove('-pipe')
-        return val
-
-    def language_stdlib_only_link_flags(self) -> T.List[str]:
-        return ['-lifcore', '-limf']
-
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return ['-gen-dep=' + outtarget, '-gen-depformat=make']
-
-
-class IntelClFortranCompiler(IntelVisualStudioLikeCompiler, FortranCompiler):
-
-    file_suffixes = ['f90', 'f', 'for', 'ftn', 'fpp']
-    always_args = ['/nologo']
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, target: str, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        IntelVisualStudioLikeCompiler.__init__(self, target)
-
-        default_warn_args = ['/warn:general', '/warn:truncated_source']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['/warn:unused'],
-                          '3': ['/warn:all']}
-
-    def get_options(self):
-        opts = FortranCompiler.get_options(self)
-        fortran_stds = ['legacy', 'f95', 'f2003', 'f2008', 'f2018']
-        opts.update({
-            'std': coredata.UserComboOption(
-                'Fortran language standard to use',
-                ['none'] + fortran_stds,
-                'none',
-            ),
-        })
-        return opts
-
-    def get_option_compile_args(self, options) -> T.List[str]:
-        args = []
-        std = options['std']
-        stds = {'legacy': 'none', 'f95': 'f95', 'f2003': 'f03', 'f2008': 'f08', 'f2018': 'f18'}
-        if std.value != 'none':
-            args.append('/stand:' + stds[std.value])
-        return args
-
-    def get_module_outdir_args(self, path) -> T.List[str]:
-        return ['/module:' + path]
-
-
-class PathScaleFortranCompiler(FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        self.id = 'pathscale'
-        default_warn_args = ['-fullwarn']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args,
-                          '3': default_warn_args}
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-mp']
-
-
-class PGIFortranCompiler(PGICompiler, FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        PGICompiler.__init__(self)
-
-        default_warn_args = ['-Minform=inform']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args,
-                          '3': default_warn_args + ['-Mdclchk']}
-
-    def language_stdlib_only_link_flags(self) -> T.List[str]:
-        return ['-lpgf90rtl', '-lpgf90', '-lpgf90_rpm1', '-lpgf902',
-                '-lpgf90rtl', '-lpgftnrtl', '-lrt']
-
-class FlangFortranCompiler(ClangCompiler, FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        ClangCompiler.__init__(self, [])
-        self.id = 'flang'
-        default_warn_args = ['-Minform=inform']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args,
-                          '3': default_warn_args}
-
-    def language_stdlib_only_link_flags(self) -> T.List[str]:
-        return ['-lflang', '-lpgmath']
-
-class Open64FortranCompiler(FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        self.id = 'open64'
-        default_warn_args = ['-fullwarn']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args,
-                          '3': default_warn_args}
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-mp']
-
-
-class NAGFortranCompiler(FortranCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        FortranCompiler.__init__(self, exelist, version, for_machine,
-                                 is_cross, info, exe_wrapper, **kwargs)
-        self.id = 'nagfor'
-
-    def get_warn_args(self, level):
-        return []
-
-    def get_module_outdir_args(self, path) -> T.List[str]:
-        return ['-mdir', path]
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-openmp']
diff --git a/meson/mesonbuild/compilers/java.py b/meson/mesonbuild/compilers/java.py
deleted file mode 100644 (file)
index 5aeb250..0000000
+++ /dev/null
@@ -1,119 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path
-import shutil
-import subprocess
-import typing as T
-
-from ..mesonlib import EnvironmentException, MachineChoice
-from .compilers import Compiler, java_buildtype_args
-from .mixins.islinker import BasicLinkerIsCompilerMixin
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-class JavaCompiler(BasicLinkerIsCompilerMixin, Compiler):
-
-    language = 'java'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 info: 'MachineInfo'):
-        super().__init__(exelist, version, for_machine, info)
-        self.id = 'unknown'
-        self.is_cross = False
-        self.javarunner = 'java'
-
-    def get_werror_args(self):
-        return ['-Werror']
-
-    def split_shlib_to_parts(self, fname):
-        return None, fname
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return []
-
-    def get_compile_only_args(self):
-        return []
-
-    def get_output_args(self, subdir):
-        if subdir == '':
-            subdir = './'
-        return ['-d', subdir, '-s', subdir]
-
-    def get_coverage_args(self):
-        return []
-
-    def get_std_exe_link_args(self):
-        return []
-
-    def get_include_args(self, path):
-        return []
-
-    def get_pic_args(self):
-        return []
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def get_pch_use_args(self, pch_dir, header):
-        return []
-
-    def get_pch_name(self, header_name):
-        return ''
-
-    def get_buildtype_args(self, buildtype):
-        return java_buildtype_args[buildtype]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i in ['-cp', '-classpath', '-sourcepath'] and idx + 1 < len(parameter_list):
-                path_list = parameter_list[idx + 1].split(os.pathsep)
-                path_list = [os.path.normpath(os.path.join(build_dir, x)) for x in path_list]
-                parameter_list[idx + 1] = os.pathsep.join(path_list)
-
-        return parameter_list
-
-    def sanity_check(self, work_dir, environment):
-        src = 'SanityCheck.java'
-        obj = 'SanityCheck'
-        source_name = os.path.join(work_dir, src)
-        with open(source_name, 'w') as ofile:
-            ofile.write('''class SanityCheck {
-  public static void main(String[] args) {
-    int i;
-  }
-}
-''')
-        pc = subprocess.Popen(self.exelist + [src], cwd=work_dir)
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('Java compiler %s can not compile programs.' % self.name_string())
-        runner = shutil.which(self.javarunner)
-        if runner:
-            cmdlist = [runner, obj]
-            pe = subprocess.Popen(cmdlist, cwd=work_dir)
-            pe.wait()
-            if pe.returncode != 0:
-                raise EnvironmentException('Executables created by Java compiler %s are not runnable.' % self.name_string())
-        else:
-            m = "Java Virtual Machine wasn't found, but it's needed by Meson. " \
-                "Please install a JRE.\nIf you have specific needs where this " \
-                "requirement doesn't make sense, please open a bug at " \
-                "https://github.com/mesonbuild/meson/issues/new and tell us " \
-                "all about it."
-            raise EnvironmentException(m)
-
-    def needs_static_linker(self):
-        return False
diff --git a/meson/mesonbuild/compilers/mixins/__init__.py b/meson/mesonbuild/compilers/mixins/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/meson/mesonbuild/compilers/mixins/arm.py b/meson/mesonbuild/compilers/mixins/arm.py
deleted file mode 100644 (file)
index b331d8f..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Representations specific to the arm family of compilers."""
-
-import os
-import re
-import typing as T
-
-from ... import mesonlib
-from ..compilers import clike_debug_args
-from .clang import clang_color_args
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-arm_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-arm_optimization_args = {
-    '0': ['-O0'],
-    'g': ['-g'],
-    '1': ['-O1'],
-    '2': [], # Compiler defaults to -O2
-    '3': ['-O3', '-Otime'],
-    's': ['-O3'], # Compiler defaults to -Ospace
-}  # type: T.Dict[str, T.List[str]]
-
-armclang_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-armclang_optimization_args = {
-    '0': [], # Compiler defaults to -O0
-    'g': ['-g'],
-    '1': ['-O1'],
-    '2': ['-O2'],
-    '3': ['-O3'],
-    's': ['-Oz']
-}  # type: T.Dict[str, T.List[str]]
-
-
-class ArmCompiler:
-    # Functionality that is common to all ARM family compilers.
-    def __init__(self):
-        if not self.is_cross:
-            raise mesonlib.EnvironmentException('armcc supports only cross-compilation.')
-        self.id = 'arm'
-        default_warn_args = []  # type: T.List[str]
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + [],
-                          '3': default_warn_args + []}
-        # Assembly
-        self.can_compile_suffixes.add('s')
-
-    def get_pic_args(self) -> T.List[str]:
-        # FIXME: Add /ropi, /rwpi, /fpic etc. qualifiers to --apcs
-        return []
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return arm_buildtype_args[buildtype]
-
-    # Override CCompiler.get_always_args
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-    # Override CCompiler.get_dependency_gen_args
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return ['--depend_target', outtarget, '--depend', outfile, '--depend_single_line']
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        # FIXME: Add required arguments
-        # NOTE from armcc user guide:
-        # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05
-        # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported
-        # PCH files."
-        return []
-
-    def get_pch_suffix(self) -> str:
-        # NOTE from armcc user guide:
-        # "Support for Precompiled Header (PCH) files is deprecated from ARM Compiler 5.05
-        # onwards on all platforms. Note that ARM Compiler on Windows 8 never supported
-        # PCH files."
-        return 'pch'
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def get_coverage_args(self) -> T.List[str]:
-        return []
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return arm_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return clike_debug_args[is_debug]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
-
-
-class ArmclangCompiler:
-    def __init__(self):
-        if not self.is_cross:
-            raise mesonlib.EnvironmentException('armclang supports only cross-compilation.')
-        # Check whether 'armlink' is available in path
-        self.linker_exe = 'armlink'
-        args = '--vsn'
-        try:
-            p, stdo, stderr = mesonlib.Popen_safe(self.linker_exe, args)
-        except OSError as e:
-            err_msg = 'Unknown linker\nRunning "{0}" gave \n"{1}"'.format(' '.join([self.linker_exe] + [args]), e)
-            raise mesonlib.EnvironmentException(err_msg)
-        # Verify the armlink version
-        ver_str = re.search('.*Component.*', stdo)
-        if ver_str:
-            ver_str = ver_str.group(0)
-        else:
-            raise mesonlib.EnvironmentException('armlink version string not found')
-        assert ver_str  # makes mypy happy
-        # Using the regular expression from environment.search_version,
-        # which is used for searching compiler version
-        version_regex = r'(?<!(\d|\.))(\d{1,2}(\.\d+)+(-[a-zA-Z0-9]+)?)'
-        linker_ver = re.search(version_regex, ver_str)
-        if linker_ver:
-            linker_ver = linker_ver.group(0)
-        if not mesonlib.version_compare(self.version, '==' + linker_ver):
-            raise mesonlib.EnvironmentException('armlink version does not match with compiler version')
-        self.id = 'armclang'
-        self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_sanitize', 'b_coverage',
-                             'b_ndebug', 'b_staticpic', 'b_colorout']
-        # Assembly
-        self.can_compile_suffixes.add('s')
-
-    def get_pic_args(self) -> T.List[str]:
-        # PIC support is not enabled by default for ARM,
-        # if users want to use it, they need to add the required arguments explicitly
-        return []
-
-    def get_colorout_args(self, colortype: str) -> T.List[str]:
-        return clang_color_args[colortype][:]
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return armclang_buildtype_args[buildtype]
-
-    def get_pch_suffix(self) -> str:
-        return 'gch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        # Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136
-        # This flag is internal to Clang (or at least not documented on the man page)
-        # so it might change semantics at any time.
-        return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))]
-
-    # Override CCompiler.get_dependency_gen_args
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return ['-MD', '-MT', outtarget, '-MF', outfile]
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return armclang_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return clike_debug_args[is_debug]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
diff --git a/meson/mesonbuild/compilers/mixins/c2000.py b/meson/mesonbuild/compilers/mixins/c2000.py
deleted file mode 100644 (file)
index 65a2cea..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Representations specific to the Texas Instruments C2000 compiler family."""
-
-import os
-import typing as T
-
-from ...mesonlib import EnvironmentException
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-c2000_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-c2000_optimization_args = {
-    '0': ['-O0'],
-    'g': ['-Ooff'],
-    '1': ['-O1'],
-    '2': ['-O2'],
-    '3': ['-O3'],
-    's': ['-04']
-}  # type: T.Dict[str, T.List[str]]
-
-c2000_debug_args = {
-    False: [],
-    True: []
-}  # type: T.Dict[bool, T.List[str]]
-
-
-class C2000Compiler:
-    def __init__(self):
-        if not self.is_cross:
-            raise EnvironmentException('c2000 supports only cross-compilation.')
-        self.id = 'c2000'
-        # Assembly
-        self.can_compile_suffixes.add('asm')
-        default_warn_args = []  # type: T.List[str]
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + [],
-                          '3': default_warn_args + []}
-
-    def get_pic_args(self) -> T.List[str]:
-        # PIC support is not enabled by default for c2000,
-        # if users want to use it, they need to add the required arguments explicitly
-        return []
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return c2000_buildtype_args[buildtype]
-
-    def get_pch_suffix(self) -> str:
-        return 'pch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        return []
-
-    # Override CCompiler.get_dependency_gen_args
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return []
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def get_coverage_args(self) -> T.List[str]:
-        return []
-
-    def get_no_stdinc_args(self) -> T.List[str]:
-        return []
-
-    def get_no_stdlib_link_args(self) -> T.List[str]:
-        return []
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return c2000_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return c2000_debug_args[is_debug]
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        result = []
-        for i in args:
-            if i.startswith('-D'):
-                i = '-define=' + i[2:]
-            if i.startswith('-I'):
-                i = '-include=' + i[2:]
-            if i.startswith('-Wl,-rpath='):
-                continue
-            elif i == '--print-search-dirs':
-                continue
-            elif i.startswith('-L'):
-                continue
-            result.append(i)
-        return result
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:9] == '-include=':
-                parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:]))
-
-        return parameter_list
diff --git a/meson/mesonbuild/compilers/mixins/ccrx.py b/meson/mesonbuild/compilers/mixins/ccrx.py
deleted file mode 100644 (file)
index b859215..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Representations specific to the Renesas CC-RX compiler family."""
-
-import os
-import typing as T
-
-from ...mesonlib import EnvironmentException
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-ccrx_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-ccrx_optimization_args = {
-    '0': ['-optimize=0'],
-    'g': ['-optimize=0'],
-    '1': ['-optimize=1'],
-    '2': ['-optimize=2'],
-    '3': ['-optimize=max'],
-    's': ['-optimize=2', '-size']
-}  # type: T.Dict[str, T.List[str]]
-
-ccrx_debug_args = {
-    False: [],
-    True: ['-debug']
-}  # type: T.Dict[bool, T.List[str]]
-
-
-class CcrxCompiler:
-    def __init__(self):
-        if not self.is_cross:
-            raise EnvironmentException('ccrx supports only cross-compilation.')
-        self.id = 'ccrx'
-        # Assembly
-        self.can_compile_suffixes.add('src')
-        default_warn_args = []  # type: T.List[str]
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + [],
-                          '3': default_warn_args + []}
-
-    def get_pic_args(self) -> T.List[str]:
-        # PIC support is not enabled by default for CCRX,
-        # if users want to use it, they need to add the required arguments explicitly
-        return []
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return ccrx_buildtype_args[buildtype]
-
-    def get_pch_suffix(self) -> str:
-        return 'pch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        return []
-
-    # Override CCompiler.get_dependency_gen_args
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return []
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def get_coverage_args(self) -> T.List[str]:
-        return []
-
-    def get_no_stdinc_args(self) -> T.List[str]:
-        return []
-
-    def get_no_stdlib_link_args(self) -> T.List[str]:
-        return []
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return ccrx_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return ccrx_debug_args[is_debug]
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        result = []
-        for i in args:
-            if i.startswith('-D'):
-                i = '-define=' + i[2:]
-            if i.startswith('-I'):
-                i = '-include=' + i[2:]
-            if i.startswith('-Wl,-rpath='):
-                continue
-            elif i == '--print-search-dirs':
-                continue
-            elif i.startswith('-L'):
-                continue
-            elif not i.startswith('-lib=') and i.endswith(('.a', '.lib')):
-                i = '-lib=' + i
-            result.append(i)
-        return result
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:9] == '-include=':
-                parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:]))
-
-        return parameter_list
diff --git a/meson/mesonbuild/compilers/mixins/clang.py b/meson/mesonbuild/compilers/mixins/clang.py
deleted file mode 100644 (file)
index ecfbc64..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstractions for the LLVM/Clang compiler family."""
-
-import os
-import shutil
-import typing as T
-
-from ... import mesonlib
-from ...linkers import AppleDynamicLinker
-from .gnu import GnuLikeCompiler
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-    from ...dependencies import Dependency  # noqa: F401
-
-clang_color_args = {
-    'auto': ['-Xclang', '-fcolor-diagnostics'],
-    'always': ['-Xclang', '-fcolor-diagnostics'],
-    'never': ['-Xclang', '-fno-color-diagnostics'],
-}  # type: T.Dict[str, T.List[str]]
-
-clang_optimization_args = {
-    '0': [],
-    'g': ['-Og'],
-    '1': ['-O1'],
-    '2': ['-O2'],
-    '3': ['-O3'],
-    's': ['-Os'],
-}  # type: T.Dict[str, T.List[str]]
-
-class ClangCompiler(GnuLikeCompiler):
-    def __init__(self, defines: T.Optional[T.Dict[str, str]]):
-        super().__init__()
-        self.id = 'clang'
-        self.defines = defines or {}
-        self.base_options.append('b_colorout')
-        # TODO: this really should be part of the linker base_options, but
-        # linkers don't have base_options.
-        if isinstance(self.linker, AppleDynamicLinker):
-            self.base_options.append('b_bitcode')
-        # All Clang backends can also do LLVM IR
-        self.can_compile_suffixes.add('ll')
-
-    def get_colorout_args(self, colortype: str) -> T.List[str]:
-        return clang_color_args[colortype][:]
-
-    def has_builtin_define(self, define: str) -> bool:
-        return define in self.defines
-
-    def get_builtin_define(self, define: str) -> T.Optional[str]:
-        return self.defines.get(define)
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return clang_optimization_args[optimization_level]
-
-    def get_pch_suffix(self) -> str:
-        return 'pch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        # Workaround for Clang bug http://llvm.org/bugs/show_bug.cgi?id=15136
-        # This flag is internal to Clang (or at least not documented on the man page)
-        # so it might change semantics at any time.
-        return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))]
-
-    def has_multi_arguments(self, args: T.List[str], env: 'Environment') -> T.List[str]:
-        myargs = ['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument']
-        if mesonlib.version_compare(self.version, '>=3.6.0'):
-            myargs.append('-Werror=ignored-optimization-argument')
-        return super().has_multi_arguments(
-            myargs + args,
-            env)
-
-    def has_function(self, funcname: str, prefix: str, env: 'Environment', *,
-                     extra_args: T.Optional[T.List[str]] = None,
-                     dependencies: T.Optional[T.List['Dependency']] = None) -> bool:
-        if extra_args is None:
-            extra_args = []
-        # Starting with XCode 8, we need to pass this to force linker
-        # visibility to obey OS X/iOS/tvOS minimum version targets with
-        # -mmacosx-version-min, -miphoneos-version-min, -mtvos-version-min etc.
-        # https://github.com/Homebrew/homebrew-core/issues/3727
-        # TODO: this really should be communicated by the linker
-        if isinstance(self.linker, AppleDynamicLinker) and mesonlib.version_compare(self.version, '>=8.0'):
-            extra_args.append('-Wl,-no_weak_imports')
-        return super().has_function(funcname, prefix, env, extra_args=extra_args,
-                                    dependencies=dependencies)
-
-    def openmp_flags(self) -> T.List[str]:
-        if mesonlib.version_compare(self.version, '>=3.8.0'):
-            return ['-fopenmp']
-        elif mesonlib.version_compare(self.version, '>=3.7.0'):
-            return ['-fopenmp=libomp']
-        else:
-            # Shouldn't work, but it'll be checked explicitly in the OpenMP dependency.
-            return []
-
-    @classmethod
-    def use_linker_args(cls, linker: str) -> T.List[str]:
-        # Clang additionally can use a linker specified as a path, which GCC
-        # (and other gcc-like compilers) cannot. This is becuse clang (being
-        # llvm based) is retargetable, while GCC is not.
-        #
-        if shutil.which(linker):
-            if not shutil.which(linker):
-                raise mesonlib.MesonException(
-                    'Cannot find linker {}.'.format(linker))
-            return ['-fuse-ld={}'.format(linker)]
-        return super().use_linker_args(linker)
-
-    def get_has_func_attribute_extra_args(self, name):
-        # Clang only warns about unknown or ignored attributes, so force an
-        # error.
-        return ['-Werror=attributes']
-
-    def get_coverage_link_args(self) -> T.List[str]:
-        return ['--coverage']
diff --git a/meson/mesonbuild/compilers/mixins/clike.py b/meson/mesonbuild/compilers/mixins/clike.py
deleted file mode 100644 (file)
index d5ea8d1..0000000
+++ /dev/null
@@ -1,1226 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-"""Mixin classes to be shared between C and C++ compilers.
-
-Without this we'll end up with awful diamond inherintance problems. The goal
-of this is to have mixin's, which are classes that are designed *not* to be
-standalone, they only work through inheritance.
-"""
-
-import functools
-import glob
-import itertools
-import os
-import re
-import subprocess
-import typing as T
-from pathlib import Path
-
-from ... import arglist
-from ... import mesonlib
-from ... import mlog
-from ...linkers import GnuLikeDynamicLinkerMixin, SolarisDynamicLinker
-from ...mesonlib import LibType
-from .. import compilers
-from .visualstudio import VisualStudioLikeCompiler
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-SOREGEX = re.compile(r'.*\.so(\.[0-9]+)?(\.[0-9]+)?(\.[0-9]+)?$')
-
-class CLikeCompilerArgs(arglist.CompilerArgs):
-    prepend_prefixes = ('-I', '-L')
-    dedup2_prefixes = ('-I', '-isystem', '-L', '-D', '-U')
-
-    # NOTE: not thorough. A list of potential corner cases can be found in
-    # https://github.com/mesonbuild/meson/pull/4593#pullrequestreview-182016038
-    dedup1_prefixes = ('-l', '-Wl,-l', '-Wl,--export-dynamic')
-    dedup1_suffixes = ('.lib', '.dll', '.so', '.dylib', '.a')
-    dedup1_args = ('-c', '-S', '-E', '-pipe', '-pthread')
-
-    def to_native(self, copy: bool = False) -> T.List[str]:
-        # Check if we need to add --start/end-group for circular dependencies
-        # between static libraries, and for recursively searching for symbols
-        # needed by static libraries that are provided by object files or
-        # shared libraries.
-        self.flush_pre_post()
-        if copy:
-            new = self.copy()
-        else:
-            new = self
-        # This covers all ld.bfd, ld.gold, ld.gold, and xild on Linux, which
-        # all act like (or are) gnu ld
-        # TODO: this could probably be added to the DynamicLinker instead
-        if isinstance(self.compiler.linker, (GnuLikeDynamicLinkerMixin, SolarisDynamicLinker)):
-            group_start = -1
-            group_end = -1
-            for i, each in enumerate(new):
-                if not each.startswith(('-Wl,-l', '-l')) and not each.endswith('.a') and \
-                   not SOREGEX.match(each):
-                    continue
-                group_end = i
-                if group_start < 0:
-                    # First occurrence of a library
-                    group_start = i
-            if group_start >= 0:
-                # Last occurrence of a library
-                new.insert(group_end + 1, '-Wl,--end-group')
-                new.insert(group_start, '-Wl,--start-group')
-        # Remove system/default include paths added with -isystem
-        if hasattr(self.compiler, 'get_default_include_dirs'):
-            default_dirs = self.compiler.get_default_include_dirs()
-            bad_idx_list = []  # type: T.List[int]
-            for i, each in enumerate(new):
-                # Remove the -isystem and the path if the path is a default path
-                if (each == '-isystem' and
-                        i < (len(new) - 1) and
-                        new[i + 1] in default_dirs):
-                    bad_idx_list += [i, i + 1]
-                elif each.startswith('-isystem=') and each[9:] in default_dirs:
-                    bad_idx_list += [i]
-                elif each.startswith('-isystem') and each[8:] in default_dirs:
-                    bad_idx_list += [i]
-            for i in reversed(bad_idx_list):
-                new.pop(i)
-        return self.compiler.unix_args_to_native(new._container)
-
-    def __repr__(self) -> str:
-        self.flush_pre_post()
-        return 'CLikeCompilerArgs({!r}, {!r})'.format(self.compiler, self._container)
-
-
-class CLikeCompiler:
-
-    """Shared bits for the C and CPP Compilers."""
-
-    # TODO: Replace this manual cache with functools.lru_cache
-    library_dirs_cache = {}
-    program_dirs_cache = {}
-    find_library_cache = {}
-    find_framework_cache = {}
-    internal_libs = arglist.UNIXY_COMPILER_INTERNAL_LIBS
-
-    def __init__(self, is_cross: bool, exe_wrapper: T.Optional[str] = None):
-        # If a child ObjC or CPP class has already set it, don't set it ourselves
-        self.is_cross = is_cross
-        self.can_compile_suffixes.add('h')
-        # If the exe wrapper was not found, pretend it wasn't set so that the
-        # sanity check is skipped and compiler checks use fallbacks.
-        if not exe_wrapper or not exe_wrapper.found() or not exe_wrapper.get_command():
-            self.exe_wrapper = None
-        else:
-            self.exe_wrapper = exe_wrapper.get_command()
-
-    def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> CLikeCompilerArgs:
-        return CLikeCompilerArgs(self, args)
-
-    def needs_static_linker(self):
-        return True # When compiling static libraries, so yes.
-
-    def get_always_args(self):
-        '''
-        Args that are always-on for all C compilers other than MSVC
-        '''
-        return ['-pipe'] + compilers.get_largefile_args(self)
-
-    def get_no_stdinc_args(self):
-        return ['-nostdinc']
-
-    def get_no_stdlib_link_args(self):
-        return ['-nostdlib']
-
-    def get_warn_args(self, level):
-        return self.warn_args[level]
-
-    def get_no_warn_args(self):
-        # Almost every compiler uses this for disabling warnings
-        return ['-w']
-
-    def split_shlib_to_parts(self, fname):
-        return None, fname
-
-    def depfile_for_object(self, objfile):
-        return objfile + '.' + self.get_depfile_suffix()
-
-    def get_depfile_suffix(self):
-        return 'd'
-
-    def get_exelist(self):
-        return self.exelist[:]
-
-    def get_preprocess_only_args(self):
-        return ['-E', '-P']
-
-    def get_compile_only_args(self):
-        return ['-c']
-
-    def get_no_optimization_args(self):
-        return ['-O0']
-
-    def get_compiler_check_args(self):
-        '''
-        Get arguments useful for compiler checks such as being permissive in
-        the code quality and not doing any optimization.
-        '''
-        return self.get_no_optimization_args()
-
-    def get_output_args(self, target):
-        return ['-o', target]
-
-    def get_werror_args(self):
-        return ['-Werror']
-
-    def get_std_exe_link_args(self):
-        # TODO: is this a linker property?
-        return []
-
-    def get_include_args(self, path, is_system):
-        if path == '':
-            path = '.'
-        if is_system:
-            return ['-isystem', path]
-        return ['-I' + path]
-
-    def get_compiler_dirs(self, env: 'Environment', name: str) -> T.List[str]:
-        '''
-        Get dirs from the compiler, either `libraries:` or `programs:`
-        '''
-        return []
-
-    @functools.lru_cache()
-    def get_library_dirs(self, env, elf_class = None):
-        dirs = self.get_compiler_dirs(env, 'libraries')
-        if elf_class is None or elf_class == 0:
-            return dirs
-
-        # if we do have an elf class for 32-bit or 64-bit, we want to check that
-        # the directory in question contains libraries of the appropriate class. Since
-        # system directories aren't mixed, we only need to check one file for each
-        # directory and go by that. If we can't check the file for some reason, assume
-        # the compiler knows what it's doing, and accept the directory anyway.
-        retval = []
-        for d in dirs:
-            files = [f for f in os.listdir(d) if f.endswith('.so') and os.path.isfile(os.path.join(d, f))]
-            # if no files, accept directory and move on
-            if not files:
-                retval.append(d)
-                continue
-
-            for f in files:
-                file_to_check = os.path.join(d, f)
-                try:
-                    with open(file_to_check, 'rb') as fd:
-                        header = fd.read(5)
-                        # if file is not an ELF file, it's weird, but accept dir
-                        # if it is elf, and the class matches, accept dir
-                        if header[1:4] != b'ELF' or int(header[4]) == elf_class:
-                            retval.append(d)
-                        # at this point, it's an ELF file which doesn't match the
-                        # appropriate elf_class, so skip this one
-                    # stop scanning after the first sucessful read
-                    break
-                except OSError:
-                    # Skip the file if we can't read it
-                    pass
-
-        return tuple(retval)
-
-    @functools.lru_cache()
-    def get_program_dirs(self, env):
-        '''
-        Programs used by the compiler. Also where toolchain DLLs such as
-        libstdc++-6.dll are found with MinGW.
-        '''
-        return self.get_compiler_dirs(env, 'programs')
-
-    def get_pic_args(self) -> T.List[str]:
-        return ['-fPIC']
-
-    def name_string(self) -> str:
-        return ' '.join(self.exelist)
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        return ['-include', os.path.basename(header)]
-
-    def get_pch_name(self, header_name: str) -> str:
-        return os.path.basename(header_name) + '.' + self.get_pch_suffix()
-
-    def get_linker_search_args(self, dirname: str) -> T.List[str]:
-        return self.linker.get_search_args(dirname)
-
-    def get_default_include_dirs(self):
-        return []
-
-    def gen_export_dynamic_link_args(self, env: 'Environment') -> T.List[str]:
-        return self.linker.export_dynamic_args(env)
-
-    def gen_import_library_args(self, implibname: str) -> T.List[str]:
-        return self.linker.import_library_args(implibname)
-
-    def sanity_check_impl(self, work_dir, environment, sname, code):
-        mlog.debug('Sanity testing ' + self.get_display_language() + ' compiler:', ' '.join(self.exelist))
-        mlog.debug('Is cross compiler: %s.' % str(self.is_cross))
-
-        source_name = os.path.join(work_dir, sname)
-        binname = sname.rsplit('.', 1)[0]
-        mode = 'link'
-        if self.is_cross:
-            binname += '_cross'
-            if self.exe_wrapper is None:
-                # Linking cross built apps is painful. You can't really
-                # tell if you should use -nostdlib or not and for example
-                # on OSX the compiler binary is the same but you need
-                # a ton of compiler flags to differentiate between
-                # arm and x86_64. So just compile.
-                mode = 'compile'
-        cargs, largs = self._get_basic_compiler_args(environment, mode)
-        extra_flags = cargs + self.linker_to_compiler_args(largs)
-
-        # Is a valid executable output for all toolchains and platforms
-        binname += '.exe'
-        # Write binary check source
-        binary_name = os.path.join(work_dir, binname)
-        with open(source_name, 'w') as ofile:
-            ofile.write(code)
-        # Compile sanity check
-        # NOTE: extra_flags must be added at the end. On MSVC, it might contain a '/link' argument
-        # after which all further arguments will be passed directly to the linker
-        cmdlist = self.exelist + [source_name] + self.get_output_args(binary_name) + extra_flags
-        pc, stdo, stde = mesonlib.Popen_safe(cmdlist, cwd=work_dir)
-        mlog.debug('Sanity check compiler command line:', ' '.join(cmdlist))
-        mlog.debug('Sanity check compile stdout:')
-        mlog.debug(stdo)
-        mlog.debug('-----\nSanity check compile stderr:')
-        mlog.debug(stde)
-        mlog.debug('-----')
-        if pc.returncode != 0:
-            raise mesonlib.EnvironmentException('Compiler {0} can not compile programs.'.format(self.name_string()))
-        # Run sanity check
-        if self.is_cross:
-            if self.exe_wrapper is None:
-                # Can't check if the binaries run so we have to assume they do
-                return
-            cmdlist = self.exe_wrapper + [binary_name]
-        else:
-            cmdlist = [binary_name]
-        mlog.debug('Running test binary command: ' + ' '.join(cmdlist))
-        try:
-            pe = subprocess.Popen(cmdlist)
-        except Exception as e:
-            raise mesonlib.EnvironmentException('Could not invoke sanity test executable: %s.' % str(e))
-        pe.wait()
-        if pe.returncode != 0:
-            raise mesonlib.EnvironmentException('Executables created by {0} compiler {1} are not runnable.'.format(self.language, self.name_string()))
-
-    def sanity_check(self, work_dir, environment):
-        code = 'int main(void) { int class=0; return class; }\n'
-        return self.sanity_check_impl(work_dir, environment, 'sanitycheckc.c', code)
-
-    def check_header(self, hname: str, prefix: str, env, *, extra_args=None, dependencies=None):
-        fargs = {'prefix': prefix, 'header': hname}
-        code = '''{prefix}
-        #include <{header}>'''
-        return self.compiles(code.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-    def has_header(self, hname: str, prefix: str, env, *, extra_args=None, dependencies=None, disable_cache: bool = False):
-        fargs = {'prefix': prefix, 'header': hname}
-        code = '''{prefix}
-        #ifdef __has_include
-         #if !__has_include("{header}")
-          #error "Header '{header}' could not be found"
-         #endif
-        #else
-         #include <{header}>
-        #endif'''
-        return self.compiles(code.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies, mode='preprocess', disable_cache=disable_cache)
-
-    def has_header_symbol(self, hname: str, symbol: str, prefix: str, env, *, extra_args=None, dependencies=None):
-        fargs = {'prefix': prefix, 'header': hname, 'symbol': symbol}
-        t = '''{prefix}
-        #include <{header}>
-        int main(void) {{
-            /* If it's not defined as a macro, try to use as a symbol */
-            #ifndef {symbol}
-                {symbol};
-            #endif
-            return 0;
-        }}'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-    def _get_basic_compiler_args(self, env, mode: str):
-        cargs, largs = [], []
-        if mode == 'link':
-            # Sometimes we need to manually select the CRT to use with MSVC.
-            # One example is when trying to do a compiler check that involves
-            # linking with static libraries since MSVC won't select a CRT for
-            # us in that case and will error out asking us to pick one.
-            try:
-                crt_val = env.coredata.base_options['b_vscrt'].value
-                buildtype = env.coredata.builtins['buildtype'].value
-                cargs += self.get_crt_compile_args(crt_val, buildtype)
-            except (KeyError, AttributeError):
-                pass
-
-        # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS and CPPFLAGS from the env
-        sys_args = env.coredata.get_external_args(self.for_machine, self.language)
-        # Apparently it is a thing to inject linker flags both
-        # via CFLAGS _and_ LDFLAGS, even though the former are
-        # also used during linking. These flags can break
-        # argument checks. Thanks, Autotools.
-        cleaned_sys_args = self.remove_linkerlike_args(sys_args)
-        cargs += cleaned_sys_args
-
-        if mode == 'link':
-            ld_value = env.lookup_binary_entry(self.for_machine, self.language + '_ld')
-            if ld_value is not None:
-                largs += self.use_linker_args(ld_value[0])
-
-            # Add LDFLAGS from the env
-            sys_ld_args = env.coredata.get_external_link_args(self.for_machine, self.language)
-            # CFLAGS and CXXFLAGS go to both linking and compiling, but we want them
-            # to only appear on the command line once. Remove dupes.
-            largs += [x for x in sys_ld_args if x not in sys_args]
-
-        cargs += self.get_compiler_args_for_mode(mode)
-        return cargs, largs
-
-    def _get_compiler_check_args(self, env, extra_args: list, dependencies, mode: str = 'compile') -> T.List[str]:
-        if extra_args is None:
-            extra_args = []
-        else:
-            extra_args = mesonlib.listify(extra_args)
-        extra_args = mesonlib.listify([e(mode) if callable(e) else e for e in extra_args])
-
-        if dependencies is None:
-            dependencies = []
-        elif not isinstance(dependencies, list):
-            dependencies = [dependencies]
-        # Collect compiler arguments
-        cargs = self.compiler_args()
-        largs = []
-        for d in dependencies:
-            # Add compile flags needed by dependencies
-            cargs += d.get_compile_args()
-            if mode == 'link':
-                # Add link flags needed to find dependencies
-                largs += d.get_link_args()
-
-        ca, la = self._get_basic_compiler_args(env, mode)
-        cargs += ca
-        largs += la
-
-        cargs += self.get_compiler_check_args()
-
-        # on MSVC compiler and linker flags must be separated by the "/link" argument
-        # at this point, the '/link' argument may already be part of extra_args, otherwise, it is added here
-        if self.linker_to_compiler_args([]) == ['/link'] and largs != [] and not ('/link' in extra_args):
-            extra_args += ['/link']
-
-        args = cargs + extra_args + largs
-        return args
-
-    def compiles(self, code: str, env, *,
-                 extra_args: T.Sequence[T.Union[T.Sequence[str], str]] = None,
-                 dependencies=None, mode: str = 'compile', disable_cache: bool = False) -> T.Tuple[bool, bool]:
-        with self._build_wrapper(code, env, extra_args, dependencies, mode, disable_cache=disable_cache) as p:
-            return p.returncode == 0, p.cached
-
-    def _build_wrapper(self, code: str, env, extra_args, dependencies=None, mode: str = 'compile', want_output: bool = False, disable_cache: bool = False, temp_dir: str = None) -> T.Tuple[bool, bool]:
-        args = self._get_compiler_check_args(env, extra_args, dependencies, mode)
-        if disable_cache or want_output:
-            return self.compile(code, extra_args=args, mode=mode, want_output=want_output, temp_dir=env.scratch_dir)
-        return self.cached_compile(code, env.coredata, extra_args=args, mode=mode, temp_dir=env.scratch_dir)
-
-    def links(self, code, env, *, extra_args=None, dependencies=None, disable_cache=False):
-        return self.compiles(code, env, extra_args=extra_args,
-                             dependencies=dependencies, mode='link', disable_cache=disable_cache)
-
-    def run(self, code: str, env, *, extra_args=None, dependencies=None):
-        need_exe_wrapper = env.need_exe_wrapper(self.for_machine)
-        if need_exe_wrapper and self.exe_wrapper is None:
-            raise compilers.CrossNoRunException('Can not run test applications in this cross environment.')
-        with self._build_wrapper(code, env, extra_args, dependencies, mode='link', want_output=True) as p:
-            if p.returncode != 0:
-                mlog.debug('Could not compile test file %s: %d\n' % (
-                    p.input_name,
-                    p.returncode))
-                return compilers.RunResult(False)
-            if need_exe_wrapper:
-                cmdlist = self.exe_wrapper + [p.output_name]
-            else:
-                cmdlist = p.output_name
-            try:
-                pe, so, se = mesonlib.Popen_safe(cmdlist)
-            except Exception as e:
-                mlog.debug('Could not run: %s (error: %s)\n' % (cmdlist, e))
-                return compilers.RunResult(False)
-
-        mlog.debug('Program stdout:\n')
-        mlog.debug(so)
-        mlog.debug('Program stderr:\n')
-        mlog.debug(se)
-        return compilers.RunResult(True, pe.returncode, so, se)
-
-    def _compile_int(self, expression, prefix, env, extra_args, dependencies):
-        fargs = {'prefix': prefix, 'expression': expression}
-        t = '''#include <stdio.h>
-        {prefix}
-        int main(void) {{ static int a[1-2*!({expression})]; a[0]=0; return 0; }}'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)[0]
-
-    def cross_compute_int(self, expression, low, high, guess, prefix, env, extra_args, dependencies):
-        # Try user's guess first
-        if isinstance(guess, int):
-            if self._compile_int('%s == %d' % (expression, guess), prefix, env, extra_args, dependencies):
-                return guess
-
-        # If no bounds are given, compute them in the limit of int32
-        maxint = 0x7fffffff
-        minint = -0x80000000
-        if not isinstance(low, int) or not isinstance(high, int):
-            if self._compile_int('%s >= 0' % (expression), prefix, env, extra_args, dependencies):
-                low = cur = 0
-                while self._compile_int('%s > %d' % (expression, cur), prefix, env, extra_args, dependencies):
-                    low = cur + 1
-                    if low > maxint:
-                        raise mesonlib.EnvironmentException('Cross-compile check overflowed')
-                    cur = cur * 2 + 1
-                    if cur > maxint:
-                        cur = maxint
-                high = cur
-            else:
-                high = cur = -1
-                while self._compile_int('%s < %d' % (expression, cur), prefix, env, extra_args, dependencies):
-                    high = cur - 1
-                    if high < minint:
-                        raise mesonlib.EnvironmentException('Cross-compile check overflowed')
-                    cur = cur * 2
-                    if cur < minint:
-                        cur = minint
-                low = cur
-        else:
-            # Sanity check limits given by user
-            if high < low:
-                raise mesonlib.EnvironmentException('high limit smaller than low limit')
-            condition = '%s <= %d && %s >= %d' % (expression, high, expression, low)
-            if not self._compile_int(condition, prefix, env, extra_args, dependencies):
-                raise mesonlib.EnvironmentException('Value out of given range')
-
-        # Binary search
-        while low != high:
-            cur = low + int((high - low) / 2)
-            if self._compile_int('%s <= %d' % (expression, cur), prefix, env, extra_args, dependencies):
-                high = cur
-            else:
-                low = cur + 1
-
-        return low
-
-    def compute_int(self, expression, low, high, guess, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        if self.is_cross:
-            return self.cross_compute_int(expression, low, high, guess, prefix, env, extra_args, dependencies)
-        fargs = {'prefix': prefix, 'expression': expression}
-        t = '''#include<stdio.h>
-        {prefix}
-        int main(void) {{
-            printf("%ld\\n", (long)({expression}));
-            return 0;
-        }};'''
-        res = self.run(t.format(**fargs), env, extra_args=extra_args,
-                       dependencies=dependencies)
-        if not res.compiled:
-            return -1
-        if res.returncode != 0:
-            raise mesonlib.EnvironmentException('Could not run compute_int test binary.')
-        return int(res.stdout)
-
-    def cross_sizeof(self, typename, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'type': typename}
-        t = '''#include <stdio.h>
-        {prefix}
-        int main(void) {{
-            {type} something;
-            return 0;
-        }}'''
-        if not self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)[0]:
-            return -1
-        return self.cross_compute_int('sizeof(%s)' % typename, None, None, None, prefix, env, extra_args, dependencies)
-
-    def sizeof(self, typename, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'type': typename}
-        if self.is_cross:
-            return self.cross_sizeof(typename, prefix, env, extra_args=extra_args,
-                                     dependencies=dependencies)
-        t = '''#include<stdio.h>
-        {prefix}
-        int main(void) {{
-            printf("%ld\\n", (long)(sizeof({type})));
-            return 0;
-        }};'''
-        res = self.run(t.format(**fargs), env, extra_args=extra_args,
-                       dependencies=dependencies)
-        if not res.compiled:
-            return -1
-        if res.returncode != 0:
-            raise mesonlib.EnvironmentException('Could not run sizeof test binary.')
-        return int(res.stdout)
-
-    def cross_alignment(self, typename, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'type': typename}
-        t = '''#include <stdio.h>
-        {prefix}
-        int main(void) {{
-            {type} something;
-            return 0;
-        }}'''
-        if not self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)[0]:
-            return -1
-        t = '''#include <stddef.h>
-        {prefix}
-        struct tmp {{
-            char c;
-            {type} target;
-        }};'''
-        return self.cross_compute_int('offsetof(struct tmp, target)', None, None, None, t.format(**fargs), env, extra_args, dependencies)
-
-    def alignment(self, typename, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        if self.is_cross:
-            return self.cross_alignment(typename, prefix, env, extra_args=extra_args,
-                                        dependencies=dependencies)
-        fargs = {'prefix': prefix, 'type': typename}
-        t = '''#include <stdio.h>
-        #include <stddef.h>
-        {prefix}
-        struct tmp {{
-            char c;
-            {type} target;
-        }};
-        int main(void) {{
-            printf("%d", (int)offsetof(struct tmp, target));
-            return 0;
-        }}'''
-        res = self.run(t.format(**fargs), env, extra_args=extra_args,
-                       dependencies=dependencies)
-        if not res.compiled:
-            raise mesonlib.EnvironmentException('Could not compile alignment test.')
-        if res.returncode != 0:
-            raise mesonlib.EnvironmentException('Could not run alignment test binary.')
-        align = int(res.stdout)
-        if align == 0:
-            raise mesonlib.EnvironmentException('Could not determine alignment of %s. Sorry. You might want to file a bug.' % typename)
-        return align
-
-    def get_define(self, dname, prefix, env, extra_args, dependencies, disable_cache=False):
-        delim = '"MESON_GET_DEFINE_DELIMITER"'
-        fargs = {'prefix': prefix, 'define': dname, 'delim': delim}
-        code = '''
-        {prefix}
-        #ifndef {define}
-        # define {define}
-        #endif
-        {delim}\n{define}'''
-        args = self._get_compiler_check_args(env, extra_args, dependencies,
-                                             mode='preprocess').to_native()
-        func = lambda: self.cached_compile(code.format(**fargs), env.coredata, extra_args=args, mode='preprocess')
-        if disable_cache:
-            func = lambda: self.compile(code.format(**fargs), extra_args=args, mode='preprocess', temp_dir=env.scratch_dir)
-        with func() as p:
-            cached = p.cached
-            if p.returncode != 0:
-                raise mesonlib.EnvironmentException('Could not get define {!r}'.format(dname))
-        # Get the preprocessed value after the delimiter,
-        # minus the extra newline at the end and
-        # merge string literals.
-        return self.concatenate_string_literals(p.stdo.split(delim + '\n')[-1][:-1]), cached
-
-    def get_return_value(self, fname, rtype, prefix, env, extra_args, dependencies):
-        if rtype == 'string':
-            fmt = '%s'
-            cast = '(char*)'
-        elif rtype == 'int':
-            fmt = '%lli'
-            cast = '(long long int)'
-        else:
-            raise AssertionError('BUG: Unknown return type {!r}'.format(rtype))
-        fargs = {'prefix': prefix, 'f': fname, 'cast': cast, 'fmt': fmt}
-        code = '''{prefix}
-        #include <stdio.h>
-        int main(void) {{
-            printf ("{fmt}", {cast} {f}());
-            return 0;
-        }}'''.format(**fargs)
-        res = self.run(code, env, extra_args=extra_args, dependencies=dependencies)
-        if not res.compiled:
-            m = 'Could not get return value of {}()'
-            raise mesonlib.EnvironmentException(m.format(fname))
-        if rtype == 'string':
-            return res.stdout
-        elif rtype == 'int':
-            try:
-                return int(res.stdout.strip())
-            except ValueError:
-                m = 'Return value of {}() is not an int'
-                raise mesonlib.EnvironmentException(m.format(fname))
-
-    @staticmethod
-    def _no_prototype_templ():
-        """
-        Try to find the function without a prototype from a header by defining
-        our own dummy prototype and trying to link with the C library (and
-        whatever else the compiler links in by default). This is very similar
-        to the check performed by Autoconf for AC_CHECK_FUNCS.
-        """
-        # Define the symbol to something else since it is defined by the
-        # includes or defines listed by the user or by the compiler. This may
-        # include, for instance _GNU_SOURCE which must be defined before
-        # limits.h, which includes features.h
-        # Then, undef the symbol to get rid of it completely.
-        head = '''
-        #define {func} meson_disable_define_of_{func}
-        {prefix}
-        #include <limits.h>
-        #undef {func}
-        '''
-        # Override any GCC internal prototype and declare our own definition for
-        # the symbol. Use char because that's unlikely to be an actual return
-        # value for a function which ensures that we override the definition.
-        head += '''
-        #ifdef __cplusplus
-        extern "C"
-        #endif
-        char {func} (void);
-        '''
-        # The actual function call
-        main = '''
-        int main(void) {{
-          return {func} ();
-        }}'''
-        return head, main
-
-    @staticmethod
-    def _have_prototype_templ():
-        """
-        Returns a head-er and main() call that uses the headers listed by the
-        user for the function prototype while checking if a function exists.
-        """
-        # Add the 'prefix', aka defines, includes, etc that the user provides
-        # This may include, for instance _GNU_SOURCE which must be defined
-        # before limits.h, which includes features.h
-        head = '{prefix}\n#include <limits.h>\n'
-        # We don't know what the function takes or returns, so return it as an int.
-        # Just taking the address or comparing it to void is not enough because
-        # compilers are smart enough to optimize it away. The resulting binary
-        # is not run so we don't care what the return value is.
-        main = '''\nint main(void) {{
-            void *a = (void*) &{func};
-            long long b = (long long) a;
-            return (int) b;
-        }}'''
-        return head, main
-
-    def has_function(self, funcname, prefix, env, *, extra_args=None, dependencies=None):
-        """
-        First, this function looks for the symbol in the default libraries
-        provided by the compiler (stdlib + a few others usually). If that
-        fails, it checks if any of the headers specified in the prefix provide
-        an implementation of the function, and if that fails, it checks if it's
-        implemented as a compiler-builtin.
-        """
-        if extra_args is None:
-            extra_args = []
-
-        # Short-circuit if the check is already provided by the cross-info file
-        varname = 'has function ' + funcname
-        varname = varname.replace(' ', '_')
-        if self.is_cross:
-            val = env.properties.host.get(varname, None)
-            if val is not None:
-                if isinstance(val, bool):
-                    return val, False
-                raise mesonlib.EnvironmentException('Cross variable {0} is not a boolean.'.format(varname))
-
-        fargs = {'prefix': prefix, 'func': funcname}
-
-        # glibc defines functions that are not available on Linux as stubs that
-        # fail with ENOSYS (such as e.g. lchmod). In this case we want to fail
-        # instead of detecting the stub as a valid symbol.
-        # We already included limits.h earlier to ensure that these are defined
-        # for stub functions.
-        stubs_fail = '''
-        #if defined __stub_{func} || defined __stub___{func}
-        fail fail fail this function is not going to work
-        #endif
-        '''
-
-        # If we have any includes in the prefix supplied by the user, assume
-        # that the user wants us to use the symbol prototype defined in those
-        # includes. If not, then try to do the Autoconf-style check with
-        # a dummy prototype definition of our own.
-        # This is needed when the linker determines symbol availability from an
-        # SDK based on the prototype in the header provided by the SDK.
-        # Ignoring this prototype would result in the symbol always being
-        # marked as available.
-        if '#include' in prefix:
-            head, main = self._have_prototype_templ()
-        else:
-            head, main = self._no_prototype_templ()
-        templ = head + stubs_fail + main
-
-        res, cached = self.links(templ.format(**fargs), env, extra_args=extra_args,
-                                 dependencies=dependencies)
-        if res:
-            return True, cached
-
-        # MSVC does not have compiler __builtin_-s.
-        if self.get_id() in {'msvc', 'intel-cl'}:
-            return False, False
-
-        # Detect function as a built-in
-        #
-        # Some functions like alloca() are defined as compiler built-ins which
-        # are inlined by the compiler and you can't take their address, so we
-        # need to look for them differently. On nice compilers like clang, we
-        # can just directly use the __has_builtin() macro.
-        fargs['no_includes'] = '#include' not in prefix
-        is_builtin = funcname.startswith('__builtin_')
-        fargs['is_builtin'] = is_builtin
-        fargs['__builtin_'] = '' if is_builtin else '__builtin_'
-        t = '''{prefix}
-        int main(void) {{
-
-        /* With some toolchains (MSYS2/mingw for example) the compiler
-         * provides various builtins which are not really implemented and
-         * fall back to the stdlib where they aren't provided and fail at
-         * build/link time. In case the user provides a header, including
-         * the header didn't lead to the function being defined, and the
-         * function we are checking isn't a builtin itself we assume the
-         * builtin is not functional and we just error out. */
-        #if !{no_includes:d} && !defined({func}) && !{is_builtin:d}
-            #error "No definition for {__builtin_}{func} found in the prefix"
-        #endif
-
-        #ifdef __has_builtin
-            #if !__has_builtin({__builtin_}{func})
-                #error "{__builtin_}{func} not found"
-            #endif
-        #elif ! defined({func})
-            {__builtin_}{func};
-        #endif
-        return 0;
-        }}'''
-        return self.links(t.format(**fargs), env, extra_args=extra_args,
-                          dependencies=dependencies)
-
-    def has_members(self, typename, membernames, prefix, env, *, extra_args=None, dependencies=None):
-        if extra_args is None:
-            extra_args = []
-        fargs = {'prefix': prefix, 'type': typename, 'name': 'foo'}
-        # Create code that accesses all members
-        members = ''
-        for member in membernames:
-            members += '{}.{};\n'.format(fargs['name'], member)
-        fargs['members'] = members
-        t = '''{prefix}
-        void bar(void) {{
-            {type} {name};
-            {members}
-        }};'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-    def has_type(self, typename, prefix, env, extra_args, dependencies=None):
-        fargs = {'prefix': prefix, 'type': typename}
-        t = '''{prefix}
-        void bar(void) {{
-            sizeof({type});
-        }};'''
-        return self.compiles(t.format(**fargs), env, extra_args=extra_args,
-                             dependencies=dependencies)
-
-    def symbols_have_underscore_prefix(self, env):
-        '''
-        Check if the compiler prefixes an underscore to global C symbols
-        '''
-        symbol_name = b'meson_uscore_prefix'
-        code = '''#ifdef __cplusplus
-        extern "C" {
-        #endif
-        void ''' + symbol_name.decode() + ''' (void) {}
-        #ifdef __cplusplus
-        }
-        #endif
-        '''
-        args = self.get_compiler_check_args()
-        n = 'symbols_have_underscore_prefix'
-        with self._build_wrapper(code, env, extra_args=args, mode='compile', want_output=True, temp_dir=env.scratch_dir) as p:
-            if p.returncode != 0:
-                m = 'BUG: Unable to compile {!r} check: {}'
-                raise RuntimeError(m.format(n, p.stdo))
-            if not os.path.isfile(p.output_name):
-                m = 'BUG: Can\'t find compiled test code for {!r} check'
-                raise RuntimeError(m.format(n))
-            with open(p.output_name, 'rb') as o:
-                for line in o:
-                    # Check if the underscore form of the symbol is somewhere
-                    # in the output file.
-                    if b'_' + symbol_name in line:
-                        mlog.debug("Symbols have underscore prefix: YES")
-                        return True
-                    # Else, check if the non-underscored form is present
-                    elif symbol_name in line:
-                        mlog.debug("Symbols have underscore prefix: NO")
-                        return False
-        raise RuntimeError('BUG: {!r} check failed unexpectedly'.format(n))
-
-    def _get_patterns(self, env, prefixes, suffixes, shared=False):
-        patterns = []
-        for p in prefixes:
-            for s in suffixes:
-                patterns.append(p + '{}.' + s)
-        if shared and env.machines[self.for_machine].is_openbsd():
-            # Shared libraries on OpenBSD can be named libfoo.so.X.Y:
-            # https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs
-            #
-            # This globbing is probably the best matching we can do since regex
-            # is expensive. It's wrong in many edge cases, but it will match
-            # correctly-named libraries and hopefully no one on OpenBSD names
-            # their files libfoo.so.9a.7b.1.0
-            for p in prefixes:
-                patterns.append(p + '{}.so.[0-9]*.[0-9]*')
-        return patterns
-
-    def get_library_naming(self, env, libtype: LibType, strict=False):
-        '''
-        Get library prefixes and suffixes for the target platform ordered by
-        priority
-        '''
-        stlibext = ['a']
-        # We've always allowed libname to be both `foo` and `libfoo`, and now
-        # people depend on it. Also, some people use prebuilt `foo.so` instead
-        # of `libfoo.so` for unknown reasons, and may also want to create
-        # `foo.so` by setting name_prefix to ''
-        if strict and not isinstance(self, VisualStudioLikeCompiler): # lib prefix is not usually used with msvc
-            prefixes = ['lib']
-        else:
-            prefixes = ['lib', '']
-        # Library suffixes and prefixes
-        if env.machines[self.for_machine].is_darwin():
-            shlibext = ['dylib', 'so']
-        elif env.machines[self.for_machine].is_windows():
-            # FIXME: .lib files can be import or static so we should read the
-            # file, figure out which one it is, and reject the wrong kind.
-            if isinstance(self, VisualStudioLikeCompiler):
-                shlibext = ['lib']
-            else:
-                shlibext = ['dll.a', 'lib', 'dll']
-            # Yep, static libraries can also be foo.lib
-            stlibext += ['lib']
-        elif env.machines[self.for_machine].is_cygwin():
-            shlibext = ['dll', 'dll.a']
-            prefixes = ['cyg'] + prefixes
-        else:
-            # Linux/BSDs
-            shlibext = ['so']
-        # Search priority
-        if libtype is LibType.PREFER_SHARED:
-            patterns = self._get_patterns(env, prefixes, shlibext, True)
-            patterns.extend([x for x in self._get_patterns(env, prefixes, stlibext, False) if x not in patterns])
-        elif libtype is LibType.PREFER_STATIC:
-            patterns = self._get_patterns(env, prefixes, stlibext, False)
-            patterns.extend([x for x in self._get_patterns(env, prefixes, shlibext, True) if x not in patterns])
-        elif libtype is LibType.SHARED:
-            patterns = self._get_patterns(env, prefixes, shlibext, True)
-        else:
-            assert libtype is LibType.STATIC
-            patterns = self._get_patterns(env, prefixes, stlibext, False)
-        return tuple(patterns)
-
-    @staticmethod
-    def _sort_shlibs_openbsd(libs):
-        filtered = []
-        for lib in libs:
-            # Validate file as a shared library of type libfoo.so.X.Y
-            ret = lib.rsplit('.so.', maxsplit=1)
-            if len(ret) != 2:
-                continue
-            try:
-                float(ret[1])
-            except ValueError:
-                continue
-            filtered.append(lib)
-        float_cmp = lambda x: float(x.rsplit('.so.', maxsplit=1)[1])
-        return sorted(filtered, key=float_cmp, reverse=True)
-
-    @classmethod
-    def _get_trials_from_pattern(cls, pattern, directory, libname):
-        f = Path(directory) / pattern.format(libname)
-        # Globbing for OpenBSD
-        if '*' in pattern:
-            # NOTE: globbing matches directories and broken symlinks
-            # so we have to do an isfile test on it later
-            return [Path(x) for x in cls._sort_shlibs_openbsd(glob.glob(str(f)))]
-        return [f]
-
-    @staticmethod
-    def _get_file_from_list(env, files: T.List[str]) -> Path:
-        '''
-        We just check whether the library exists. We can't do a link check
-        because the library might have unresolved symbols that require other
-        libraries. On macOS we check if the library matches our target
-        architecture.
-        '''
-        # If not building on macOS for Darwin, do a simple file check
-        paths = [Path(f) for f in files]
-        if not env.machines.host.is_darwin() or not env.machines.build.is_darwin():
-            for p in paths:
-                if p.is_file():
-                    return p
-        # Run `lipo` and check if the library supports the arch we want
-        for p in paths:
-            if not p.is_file():
-                continue
-            archs = mesonlib.darwin_get_object_archs(str(p))
-            if archs and env.machines.host.cpu_family in archs:
-                return p
-            else:
-                mlog.debug('Rejected {}, supports {} but need {}'
-                           .format(p, archs, env.machines.host.cpu_family))
-        return None
-
-    @functools.lru_cache()
-    def output_is_64bit(self, env):
-        '''
-        returns true if the output produced is 64-bit, false if 32-bit
-        '''
-        return self.sizeof('void *', '', env) == 8
-
-    def find_library_real(self, libname, env, extra_dirs, code, libtype: LibType):
-        # First try if we can just add the library as -l.
-        # Gcc + co seem to prefer builtin lib dirs to -L dirs.
-        # Only try to find std libs if no extra dirs specified.
-        # The built-in search procedure will always favour .so and then always
-        # search for .a. This is only allowed if libtype is LibType.PREFER_SHARED
-        if ((not extra_dirs and libtype is LibType.PREFER_SHARED) or
-                libname in self.internal_libs):
-            cargs = ['-l' + libname]
-            largs = self.get_allow_undefined_link_args()
-            extra_args = cargs + self.linker_to_compiler_args(largs)
-
-            if self.links(code, env, extra_args=extra_args, disable_cache=True)[0]:
-                return cargs
-            # Don't do a manual search for internal libs
-            if libname in self.internal_libs:
-                return None
-        # Not found or we want to use a specific libtype? Try to find the
-        # library file itself.
-        patterns = self.get_library_naming(env, libtype)
-        # try to detect if we are 64-bit or 32-bit. If we can't
-        # detect, we will just skip path validity checks done in
-        # get_library_dirs() call
-        try:
-            if self.output_is_64bit(env):
-                elf_class = 2
-            else:
-                elf_class = 1
-        except (mesonlib.MesonException, KeyError): # TODO evaluate if catching KeyError is wanted here
-            elf_class = 0
-        # Search in the specified dirs, and then in the system libraries
-        for d in itertools.chain(extra_dirs, self.get_library_dirs(env, elf_class)):
-            for p in patterns:
-                trial = self._get_trials_from_pattern(p, d, libname)
-                if not trial:
-                    continue
-                trial = self._get_file_from_list(env, trial)
-                if not trial:
-                    continue
-                return [trial.as_posix()]
-        return None
-
-    def find_library_impl(self, libname, env, extra_dirs, code, libtype: LibType):
-        # These libraries are either built-in or invalid
-        if libname in self.ignore_libs:
-            return []
-        if isinstance(extra_dirs, str):
-            extra_dirs = [extra_dirs]
-        key = (tuple(self.exelist), libname, tuple(extra_dirs), code, libtype)
-        if key not in self.find_library_cache:
-            value = self.find_library_real(libname, env, extra_dirs, code, libtype)
-            self.find_library_cache[key] = value
-        else:
-            value = self.find_library_cache[key]
-        if value is None:
-            return None
-        return value[:]
-
-    def find_library(self, libname, env, extra_dirs, libtype: LibType = LibType.PREFER_SHARED):
-        code = 'int main(void) { return 0; }\n'
-        return self.find_library_impl(libname, env, extra_dirs, code, libtype)
-
-    def find_framework_paths(self, env):
-        '''
-        These are usually /Library/Frameworks and /System/Library/Frameworks,
-        unless you select a particular macOS SDK with the -isysroot flag.
-        You can also add to this by setting -F in CFLAGS.
-        '''
-        if self.id != 'clang':
-            raise mesonlib.MesonException('Cannot find framework path with non-clang compiler')
-        # Construct the compiler command-line
-        commands = self.get_exelist() + ['-v', '-E', '-']
-        commands += self.get_always_args()
-        # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env
-        commands += env.coredata.get_external_args(self.for_machine, self.language)
-        mlog.debug('Finding framework path by running: ', ' '.join(commands), '\n')
-        os_env = os.environ.copy()
-        os_env['LC_ALL'] = 'C'
-        _, _, stde = mesonlib.Popen_safe(commands, env=os_env, stdin=subprocess.PIPE)
-        paths = []
-        for line in stde.split('\n'):
-            if '(framework directory)' not in line:
-                continue
-            # line is of the form:
-            # ` /path/to/framework (framework directory)`
-            paths.append(line[:-21].strip())
-        return paths
-
-    def find_framework_real(self, name, env, extra_dirs, allow_system):
-        code = 'int main(void) { return 0; }'
-        link_args = []
-        for d in extra_dirs:
-            link_args += ['-F' + d]
-        # We can pass -Z to disable searching in the system frameworks, but
-        # then we must also pass -L/usr/lib to pick up libSystem.dylib
-        extra_args = [] if allow_system else ['-Z', '-L/usr/lib']
-        link_args += ['-framework', name]
-        if self.links(code, env, extra_args=(extra_args + link_args), disable_cache=True)[0]:
-            return link_args
-
-    def find_framework_impl(self, name, env, extra_dirs, allow_system):
-        if isinstance(extra_dirs, str):
-            extra_dirs = [extra_dirs]
-        key = (tuple(self.exelist), name, tuple(extra_dirs), allow_system)
-        if key in self.find_framework_cache:
-            value = self.find_framework_cache[key]
-        else:
-            value = self.find_framework_real(name, env, extra_dirs, allow_system)
-            self.find_framework_cache[key] = value
-        if value is None:
-            return None
-        return value[:]
-
-    def find_framework(self, name, env, extra_dirs, allow_system=True):
-        '''
-        Finds the framework with the specified name, and returns link args for
-        the same or returns None when the framework is not found.
-        '''
-        if self.id != 'clang':
-            raise mesonlib.MesonException('Cannot find frameworks with non-clang compiler')
-        return self.find_framework_impl(name, env, extra_dirs, allow_system)
-
-    def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
-        return []
-
-    def get_crt_link_args(self, crt_val: str, buildtype: str) -> T.List[str]:
-        return []
-
-    def thread_flags(self, env):
-        host_m = env.machines[self.for_machine]
-        if host_m.is_haiku() or host_m.is_darwin():
-            return []
-        return ['-pthread']
-
-    def thread_link_flags(self, env: 'Environment') -> T.List[str]:
-        return self.linker.thread_flags(env)
-
-    def linker_to_compiler_args(self, args):
-        return args
-
-    def has_arguments(self, args: T.Sequence[str], env, code: str, mode: str) -> T.Tuple[bool, bool]:
-        return self.compiles(code, env, extra_args=args, mode=mode)
-
-    def has_multi_arguments(self, args, env):
-        for arg in args[:]:
-            # some compilers, e.g. GCC, don't warn for unsupported warning-disable
-            # flags, so when we are testing a flag like "-Wno-forgotten-towel", also
-            # check the equivalent enable flag too "-Wforgotten-towel"
-            if arg.startswith('-Wno-'):
-                args.append('-W' + arg[5:])
-            if arg.startswith('-Wl,'):
-                mlog.warning('{} looks like a linker argument, '
-                             'but has_argument and other similar methods only '
-                             'support checking compiler arguments. Using them '
-                             'to check linker arguments are never supported, '
-                             'and results are likely to be wrong regardless of '
-                             'the compiler you are using. has_link_argument or '
-                             'other similar method can be used instead.'
-                             .format(arg))
-        code = 'extern int i;\nint i;\n'
-        return self.has_arguments(args, env, code, mode='compile')
-
-    def has_multi_link_arguments(self, args, env):
-        # First time we check for link flags we need to first check if we have
-        # --fatal-warnings, otherwise some linker checks could give some
-        # false positive.
-        args = self.linker.fatal_warnings() + args
-        args = self.linker_to_compiler_args(args)
-        code = 'int main(void) { return 0; }\n'
-        return self.has_arguments(args, env, code, mode='link')
-
-    @staticmethod
-    def concatenate_string_literals(s):
-        pattern = re.compile(r'(?P<pre>.*([^\\]")|^")(?P<str1>([^\\"]|\\.)*)"\s+"(?P<str2>([^\\"]|\\.)*)(?P<post>".*)')
-        ret = s
-        m = pattern.match(ret)
-        while m:
-            ret = ''.join(m.group('pre', 'str1', 'str2', 'post'))
-            m = pattern.match(ret)
-        return ret
-
-    def get_has_func_attribute_extra_args(self, name):
-        # Most compilers (such as GCC and Clang) only warn about unknown or
-        # ignored attributes, so force an error. Overriden in GCC and Clang
-        # mixins.
-        return ['-Werror']
-
-    def has_func_attribute(self, name, env):
-        # Just assume that if we're not on windows that dllimport and dllexport
-        # don't work
-        m = env.machines[self.for_machine]
-        if not (m.is_windows() or m.is_cygwin()):
-            if name in ['dllimport', 'dllexport']:
-                return False, False
-
-        return self.compiles(self.attribute_check_func(name), env,
-                             extra_args=self.get_has_func_attribute_extra_args(name))
-
-    def get_disable_assert_args(self) -> T.List[str]:
-        return ['-DNDEBUG']
diff --git a/meson/mesonbuild/compilers/mixins/elbrus.py b/meson/mesonbuild/compilers/mixins/elbrus.py
deleted file mode 100644 (file)
index db743d8..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstractions for the Elbrus family of compilers."""
-
-import os
-import typing as T
-import subprocess
-import re
-
-from .gnu import GnuLikeCompiler
-from .gnu import gnu_optimization_args
-from ...mesonlib import Popen_safe
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-
-class ElbrusCompiler(GnuLikeCompiler):
-    # Elbrus compiler is nearly like GCC, but does not support
-    # PCH, LTO, sanitizers and color output as of version 1.21.x.
-    def __init__(self):
-        super().__init__()
-        self.id = 'lcc'
-        self.base_options = ['b_pgo', 'b_coverage',
-                             'b_ndebug', 'b_staticpic',
-                             'b_lundef', 'b_asneeded']
-
-    # FIXME: use _build_wrapper to call this so that linker flags from the env
-    # get applied
-    def get_library_dirs(self, env: 'Environment', elf_class: T.Optional[int] = None) -> T.List[str]:
-        os_env = os.environ.copy()
-        os_env['LC_ALL'] = 'C'
-        stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1]
-        for line in stdo.split('\n'):
-            if line.startswith('libraries:'):
-                # lcc does not include '=' in --print-search-dirs output. Also it could show nonexistent dirs.
-                libstr = line.split(' ', 1)[1]
-                return [os.path.realpath(p) for p in libstr.split(':') if os.path.exists(p)]
-        return []
-
-    def get_program_dirs(self, env: 'Environment') -> T.List[str]:
-        os_env = os.environ.copy()
-        os_env['LC_ALL'] = 'C'
-        stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1]
-        for line in stdo.split('\n'):
-            if line.startswith('programs:'):
-                # lcc does not include '=' in --print-search-dirs output.
-                libstr = line.split(' ', 1)[1]
-                return [os.path.realpath(p) for p in libstr.split(':')]
-        return []
-
-    def get_default_include_dirs(self) -> T.List[str]:
-        os_env = os.environ.copy()
-        os_env['LC_ALL'] = 'C'
-        p = subprocess.Popen(self.exelist + ['-xc', '-E', '-v', '-'], env=os_env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        stderr = p.stderr.read().decode('utf-8', errors='replace')
-        includes = []
-        for line in stderr.split('\n'):
-            if line.lstrip().startswith('--sys_include'):
-                includes.append(re.sub(r'\s*\\$', '', re.sub(r'^\s*--sys_include\s*', '', line)))
-        return includes
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return gnu_optimization_args[optimization_level]
-
-    def get_pch_suffix(self) -> str:
-        # Actually it's not supported for now, but probably will be supported in future
-        return 'pch'
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-fopenmp']
diff --git a/meson/mesonbuild/compilers/mixins/emscripten.py b/meson/mesonbuild/compilers/mixins/emscripten.py
deleted file mode 100644 (file)
index 10f4b25..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Provides a mixin for shared code between C and C++ Emscripten compilers."""
-
-import os.path
-import typing as T
-
-from ... import coredata
-
-if T.TYPE_CHECKING:
-    from ..environment import Environment
-
-
-class EmscriptenMixin:
-
-    def _get_compile_output(self, dirname, mode):
-        # In pre-processor mode, the output is sent to stdout and discarded
-        if mode == 'preprocess':
-            return None
-        # Unlike sane toolchains, emcc infers the kind of output from its name.
-        # This is the only reason why this method is overridden; compiler tests
-        # do not work well with the default exe/obj suffices.
-        if mode == 'link':
-            suffix = 'js'
-        else:
-            suffix = 'wasm'
-        return os.path.join(dirname, 'output.' + suffix)
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return ['-s', 'USE_PTHREADS=1']
-
-    def get_options(self):
-        opts = super().get_options()
-        opts.update({
-            '{}_thread_count'.format(self.language): coredata.UserIntegerOption(
-                'Number of threads to use in web assembly, set to 0 to disable',
-                (0, None, 4),  # Default was picked at random
-            ),
-        })
-
-        return opts
diff --git a/meson/mesonbuild/compilers/mixins/gnu.py b/meson/mesonbuild/compilers/mixins/gnu.py
deleted file mode 100644 (file)
index 83f7047..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Provides mixins for GNU compilers and GNU-like compilers."""
-
-import abc
-import functools
-import os
-import pathlib
-import re
-import subprocess
-import typing as T
-
-from ... import mesonlib
-from ... import mlog
-
-if T.TYPE_CHECKING:
-    from ...coredata import UserOption  # noqa: F401
-    from ...environment import Environment
-
-# XXX: prevent circular references.
-# FIXME: this really is a posix interface not a c-like interface
-clike_debug_args = {
-    False: [],
-    True: ['-g'],
-}  # type: T.Dict[bool, T.List[str]]
-
-gnulike_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-gnu_optimization_args = {
-    '0': [],
-    'g': ['-Og'],
-    '1': ['-O1'],
-    '2': ['-O2'],
-    '3': ['-O3'],
-    's': ['-Os'],
-}  # type: T.Dict[str, T.List[str]]
-
-gnulike_instruction_set_args = {
-    'mmx': ['-mmmx'],
-    'sse': ['-msse'],
-    'sse2': ['-msse2'],
-    'sse3': ['-msse3'],
-    'ssse3': ['-mssse3'],
-    'sse41': ['-msse4.1'],
-    'sse42': ['-msse4.2'],
-    'avx': ['-mavx'],
-    'avx2': ['-mavx2'],
-    'neon': ['-mfpu=neon'],
-}  # type: T.Dict[str, T.List[str]]
-
-gnu_symbol_visibility_args = {
-    '': [],
-    'default': ['-fvisibility=default'],
-    'internal': ['-fvisibility=internal'],
-    'hidden': ['-fvisibility=hidden'],
-    'protected': ['-fvisibility=protected'],
-    'inlineshidden': ['-fvisibility=hidden', '-fvisibility-inlines-hidden'],
-}  # type: T.Dict[str, T.List[str]]
-
-gnu_color_args = {
-    'auto': ['-fdiagnostics-color=auto'],
-    'always': ['-fdiagnostics-color=always'],
-    'never': ['-fdiagnostics-color=never'],
-}  # type: T.Dict[str, T.List[str]]
-
-
-@functools.lru_cache(maxsize=None)
-def gnulike_default_include_dirs(compiler: T.Tuple[str], lang: str) -> T.List[str]:
-    lang_map = {
-        'c': 'c',
-        'cpp': 'c++',
-        'objc': 'objective-c',
-        'objcpp': 'objective-c++'
-    }
-    if lang not in lang_map:
-        return []
-    lang = lang_map[lang]
-    env = os.environ.copy()
-    env["LC_ALL"] = 'C'
-    cmd = list(compiler) + ['-x{}'.format(lang), '-E', '-v', '-']
-    p = subprocess.Popen(
-        cmd,
-        stdin=subprocess.DEVNULL,
-        stderr=subprocess.STDOUT,
-        stdout=subprocess.PIPE,
-        env=env
-    )
-    stdout = p.stdout.read().decode('utf-8', errors='replace')
-    parse_state = 0
-    paths = []
-    for line in stdout.split('\n'):
-        line = line.strip(' \n\r\t')
-        if parse_state == 0:
-            if line == '#include "..." search starts here:':
-                parse_state = 1
-        elif parse_state == 1:
-            if line == '#include <...> search starts here:':
-                parse_state = 2
-            else:
-                paths.append(line)
-        elif parse_state == 2:
-            if line == 'End of search list.':
-                break
-            else:
-                paths.append(line)
-    if not paths:
-        mlog.warning('No include directory found parsing "{cmd}" output'.format(cmd=" ".join(cmd)))
-    # Append a normalized copy of paths to make path lookup easier
-    paths += [os.path.normpath(x) for x in paths]
-    return paths
-
-
-class GnuLikeCompiler(metaclass=abc.ABCMeta):
-    """
-    GnuLikeCompiler is a common interface to all compilers implementing
-    the GNU-style commandline interface. This includes GCC, Clang
-    and ICC. Certain functionality between them is different and requires
-    that the actual concrete subclass define their own implementation.
-    """
-
-    LINKER_PREFIX = '-Wl,'
-
-    def __init__(self):
-        self.base_options = ['b_pch', 'b_lto', 'b_pgo', 'b_coverage',
-                             'b_ndebug', 'b_staticpic', 'b_pie']
-        if not (self.info.is_windows() or self.info.is_cygwin() or self.info.is_openbsd()):
-            self.base_options.append('b_lundef')
-        if not self.info.is_windows() or self.info.is_cygwin():
-            self.base_options.append('b_asneeded')
-        if not self.info.is_hurd():
-            self.base_options.append('b_sanitize')
-        # All GCC-like backends can do assembly
-        self.can_compile_suffixes.add('s')
-
-    def get_pic_args(self) -> T.List[str]:
-        if self.info.is_windows() or self.info.is_cygwin() or self.info.is_darwin():
-            return [] # On Window and OS X, pic is always on.
-        return ['-fPIC']
-
-    def get_pie_args(self) -> T.List[str]:
-        return ['-fPIE']
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return gnulike_buildtype_args[buildtype]
-
-    @abc.abstractmethod
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        raise NotImplementedError("get_optimization_args not implemented")
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return clike_debug_args[is_debug]
-
-    @abc.abstractmethod
-    def get_pch_suffix(self) -> str:
-        raise NotImplementedError("get_pch_suffix not implemented")
-
-    def split_shlib_to_parts(self, fname: str) -> T.Tuple[str, str]:
-        return os.path.dirname(fname), fname
-
-    def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]:
-        return gnulike_instruction_set_args.get(instruction_set, None)
-
-    def get_default_include_dirs(self) -> T.List[str]:
-        return gnulike_default_include_dirs(tuple(self.exelist), self.language)
-
-    @abc.abstractmethod
-    def openmp_flags(self) -> T.List[str]:
-        raise NotImplementedError("openmp_flags not implemented")
-
-    def gnu_symbol_visibility_args(self, vistype: str) -> T.List[str]:
-        return gnu_symbol_visibility_args[vistype]
-
-    def gen_vs_module_defs_args(self, defsfile: str) -> T.List[str]:
-        if not isinstance(defsfile, str):
-            raise RuntimeError('Module definitions file should be str')
-        # On Windows targets, .def files may be specified on the linker command
-        # line like an object file.
-        if self.info.is_windows() or self.info.is_cygwin():
-            return [defsfile]
-        # For other targets, discard the .def file.
-        return []
-
-    def get_argument_syntax(self) -> str:
-        return 'gcc'
-
-    def get_profile_generate_args(self) -> T.List[str]:
-        return ['-fprofile-generate']
-
-    def get_profile_use_args(self) -> T.List[str]:
-        return ['-fprofile-use', '-fprofile-correction']
-
-    def get_gui_app_args(self, value: bool) -> T.List[str]:
-        if self.info.is_windows() or self.info.is_cygwin():
-            return ['-mwindows' if value else '-mconsole']
-        return []
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
-
-    @functools.lru_cache()
-    def _get_search_dirs(self, env: 'Environment') -> str:
-        extra_args = ['--print-search-dirs']
-        stdo = None
-        with self._build_wrapper('', env, extra_args=extra_args,
-                                 dependencies=None, mode='compile',
-                                 want_output=True) as p:
-            stdo = p.stdo
-        return stdo
-
-    def _split_fetch_real_dirs(self, pathstr: str) -> T.List[str]:
-        # We need to use the path separator used by the compiler for printing
-        # lists of paths ("gcc --print-search-dirs"). By default
-        # we assume it uses the platform native separator.
-        pathsep = os.pathsep
-
-        # clang uses ':' instead of ';' on Windows https://reviews.llvm.org/D61121
-        # so we need to repair things like 'C:\foo:C:\bar'
-        if pathsep == ';':
-            pathstr = re.sub(r':([^/\\])', r';\1', pathstr)
-
-        # pathlib treats empty paths as '.', so filter those out
-        paths = [p for p in pathstr.split(pathsep) if p]
-
-        result = []
-        for p in paths:
-            # GCC returns paths like this:
-            # /usr/lib/gcc/x86_64-linux-gnu/8/../../../../x86_64-linux-gnu/lib
-            # It would make sense to normalize them to get rid of the .. parts
-            # Sadly when you are on a merged /usr fs it also kills these:
-            # /lib/x86_64-linux-gnu
-            # since /lib is a symlink to /usr/lib. This would mean
-            # paths under /lib would be considered not a "system path",
-            # which is wrong and breaks things. Store everything, just to be sure.
-            pobj = pathlib.Path(p)
-            unresolved = pobj.as_posix()
-            if pobj.exists():
-                if unresolved not in result:
-                    result.append(unresolved)
-                try:
-                    resolved = pathlib.Path(p).resolve().as_posix()
-                    if resolved not in result:
-                        result.append(resolved)
-                except FileNotFoundError:
-                    pass
-        return result
-
-    def get_compiler_dirs(self, env: 'Environment', name: str) -> T.List[str]:
-        '''
-        Get dirs from the compiler, either `libraries:` or `programs:`
-        '''
-        stdo = self._get_search_dirs(env)
-        for line in stdo.split('\n'):
-            if line.startswith(name + ':'):
-                return self._split_fetch_real_dirs(line.split('=', 1)[1])
-        return []
-
-    def get_lto_compile_args(self) -> T.List[str]:
-        return ['-flto']
-
-    def sanitizer_compile_args(self, value: str) -> T.List[str]:
-        if value == 'none':
-            return []
-        args = ['-fsanitize=' + value]
-        if 'address' in value:  # for -fsanitize=address,undefined
-            args.append('-fno-omit-frame-pointer')
-        return args
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['-o', target]
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return ['-MD', '-MQ', outtarget, '-MF', outfile]
-
-    def get_compile_only_args(self) -> T.List[str]:
-        return ['-c']
-
-    def get_include_args(self, path: str, is_system: bool) -> T.List[str]:
-        if not path:
-            path = '.'
-        if is_system:
-            return ['-isystem' + path]
-        return ['-I' + path]
-
-    @classmethod
-    def use_linker_args(cls, linker: str) -> T.List[str]:
-        if linker not in {'gold', 'bfd', 'lld'}:
-            raise mesonlib.MesonException(
-                'Unsupported linker, only bfd, gold, and lld are supported, '
-                'not {}.'.format(linker))
-        return ['-fuse-ld={}'.format(linker)]
-
-    def get_coverage_args(self) -> T.List[str]:
-        return ['--coverage']
-
-
-class GnuCompiler(GnuLikeCompiler):
-    """
-    GnuCompiler represents an actual GCC in its many incarnations.
-    Compilers imitating GCC (Clang/Intel) should use the GnuLikeCompiler ABC.
-    """
-
-    def __init__(self, defines: T.Dict[str, str]):
-        super().__init__()
-        self.id = 'gcc'
-        self.defines = defines or {}
-        self.base_options.append('b_colorout')
-
-    def get_colorout_args(self, colortype: str) -> T.List[str]:
-        if mesonlib.version_compare(self.version, '>=4.9.0'):
-            return gnu_color_args[colortype][:]
-        return []
-
-    def get_warn_args(self, level: str) -> T.List[str]:
-        args = super().get_warn_args(level)
-        if mesonlib.version_compare(self.version, '<4.8.0') and '-Wpedantic' in args:
-            # -Wpedantic was added in 4.8.0
-            # https://gcc.gnu.org/gcc-4.8/changes.html
-            args[args.index('-Wpedantic')] = '-pedantic'
-        return args
-
-    def has_builtin_define(self, define: str) -> bool:
-        return define in self.defines
-
-    def get_builtin_define(self, define: str) -> T.Optional[str]:
-        if define in self.defines:
-            return self.defines[define]
-        return None
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return gnu_optimization_args[optimization_level]
-
-    def get_pch_suffix(self) -> str:
-        return 'gch'
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-fopenmp']
-
-    def has_arguments(self, args, env, code, mode):
-        # For some compiler command line arguments, the GNU compilers will
-        # emit a warning on stderr indicating that an option is valid for a
-        # another language, but still complete with exit_success
-        with self._build_wrapper(code, env, args, None, mode) as p:
-            result = p.returncode == 0
-            if self.language in {'cpp', 'objcpp'} and 'is valid for C/ObjC' in p.stde:
-                result = False
-            if self.language in {'c', 'objc'} and 'is valid for C++/ObjC++' in p.stde:
-                result = False
-        return result, p.cached
-
-    def get_has_func_attribute_extra_args(self, name):
-        # GCC only warns about unknown or ignored attributes, so force an
-        # error.
-        return ['-Werror=attributes']
diff --git a/meson/mesonbuild/compilers/mixins/intel.py b/meson/mesonbuild/compilers/mixins/intel.py
deleted file mode 100644 (file)
index fbbfdc5..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstractions for the Intel Compiler families.
-
-Intel provides both a posix/gcc-like compiler (ICC) for MacOS and Linux,
-with Meson mixin IntelGnuLikeCompiler.
-For Windows, the Intel msvc-like compiler (ICL) Meson mixin
-is IntelVisualStudioLikeCompiler.
-"""
-
-import os
-import typing as T
-
-from ... import mesonlib
-from .gnu import GnuLikeCompiler
-from .visualstudio import VisualStudioLikeCompiler
-
-if T.TYPE_CHECKING:
-    import subprocess  # noqa: F401
-
-# XXX: avoid circular dependencies
-# TODO: this belongs in a posix compiler class
-# NOTE: the default Intel optimization is -O2, unlike GNU which defaults to -O0.
-# this can be surprising, particularly for debug builds, so we specify the
-# default as -O0.
-# https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-o
-# https://software.intel.com/en-us/cpp-compiler-developer-guide-and-reference-g
-# https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-o
-# https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-g
-# https://software.intel.com/en-us/fortran-compiler-developer-guide-and-reference-traceback
-# https://gcc.gnu.org/onlinedocs/gcc/Optimize-Options.html
-
-
-class IntelGnuLikeCompiler(GnuLikeCompiler):
-    """
-    Tested on linux for ICC 14.0.3, 15.0.6, 16.0.4, 17.0.1, 19.0
-    debugoptimized: -g -O2
-    release: -O3
-    minsize: -O2
-    """
-
-    BUILD_ARGS = {
-        'plain': [],
-        'debug': ["-g", "-traceback"],
-        'debugoptimized': ["-g", "-traceback"],
-        'release': [],
-        'minsize': [],
-        'custom': [],
-    }  # type: T.Dict[str, T.List[str]]
-
-    OPTIM_ARGS = {
-        '0': ['-O0'],
-        'g': ['-O0'],
-        '1': ['-O1'],
-        '2': ['-O2'],
-        '3': ['-O3'],
-        's': ['-Os'],
-    }
-
-    def __init__(self):
-        super().__init__()
-        # As of 19.0.0 ICC doesn't have sanitizer, color, or lto support.
-        #
-        # It does have IPO, which serves much the same purpose as LOT, but
-        # there is an unfortunate rule for using IPO (you can't control the
-        # name of the output file) which break assumptions meson makes
-        self.base_options = ['b_pch', 'b_lundef', 'b_asneeded', 'b_pgo',
-                             'b_coverage', 'b_ndebug', 'b_staticpic', 'b_pie']
-        self.id = 'intel'
-        self.lang_header = 'none'
-
-    def get_pch_suffix(self) -> str:
-        return 'pchi'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        return ['-pch', '-pch_dir', os.path.join(pch_dir), '-x',
-                self.lang_header, '-include', header, '-x', 'none']
-
-    def get_pch_name(self, header_name: str) -> str:
-        return os.path.basename(header_name) + '.' + self.get_pch_suffix()
-
-    def openmp_flags(self) -> T.List[str]:
-        if mesonlib.version_compare(self.version, '>=15.0.0'):
-            return ['-qopenmp']
-        else:
-            return ['-openmp']
-
-    def compiles(self, *args, **kwargs) -> T.Tuple[bool, bool]:
-        # This covers a case that .get('foo', []) doesn't, that extra_args is
-        # defined and is None
-        extra_args = kwargs.get('extra_args') or []
-        kwargs['extra_args'] = [
-            extra_args,
-            '-diag-error', '10006',  # ignoring unknown option
-            '-diag-error', '10148',  # Option not supported
-            '-diag-error', '10155',  # ignoring argument required
-            '-diag-error', '10156',  # ignoring not argument allowed
-            '-diag-error', '10157',  # Ignoring argument of the wrong type
-            '-diag-error', '10158',  # Argument must be separate. Can be hit by trying an option like -foo-bar=foo when -foo=bar is a valid option but -foo-bar isn't
-            '-diag-error', '1292',   # unknown __attribute__
-        ]
-        return super().compiles(*args, **kwargs)
-
-    def get_profile_generate_args(self) -> T.List[str]:
-        return ['-prof-gen=threadsafe']
-
-    def get_profile_use_args(self) -> T.List[str]:
-        return ['-prof-use']
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return self.BUILD_ARGS[buildtype]
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return self.OPTIM_ARGS[optimization_level]
-
-
-class IntelVisualStudioLikeCompiler(VisualStudioLikeCompiler):
-
-    """Abstractions for ICL, the Intel compiler on Windows."""
-
-    BUILD_ARGS = {
-        'plain': [],
-        'debug': ["/Zi", "/traceback"],
-        'debugoptimized': ["/Zi", "/traceback"],
-        'release': [],
-        'minsize': [],
-        'custom': [],
-    }  # type: T.Dict[str, T.List[str]]
-
-    OPTIM_ARGS = {
-        '0': ['/O0'],
-        'g': ['/O0'],
-        '1': ['/O1'],
-        '2': ['/O2'],
-        '3': ['/O3'],
-        's': ['/Os'],
-    }
-
-    def __init__(self, target: str):
-        super().__init__(target)
-        self.id = 'intel-cl'
-
-    def compile(self, code, *, extra_args: T.Optional[T.List[str]] = None, **kwargs) -> T.Iterator['subprocess.Popen']:
-        # This covers a case that .get('foo', []) doesn't, that extra_args is
-        if kwargs.get('mode', 'compile') != 'link':
-            extra_args = extra_args.copy() if extra_args is not None else []
-            extra_args.extend([
-                '/Qdiag-error:10006',  # ignoring unknown option
-                '/Qdiag-error:10148',  # Option not supported
-                '/Qdiag-error:10155',  # ignoring argument required
-                '/Qdiag-error:10156',  # ignoring not argument allowed
-                '/Qdiag-error:10157',  # Ignoring argument of the wrong type
-                '/Qdiag-error:10158',  # Argument must be separate. Can be hit by trying an option like -foo-bar=foo when -foo=bar is a valid option but -foo-bar isn't
-            ])
-        return super().compile(code, extra_args, **kwargs)
-
-    def get_toolset_version(self) -> T.Optional[str]:
-        # Avoid circular dependencies....
-        from ...environment import search_version
-
-        # ICL provides a cl.exe that returns the version of MSVC it tries to
-        # emulate, so we'll get the version from that and pass it to the same
-        # function the real MSVC uses to calculate the toolset version.
-        _, _, err = mesonlib.Popen_safe(['cl.exe'])
-        v1, v2, *_ = search_version(err).split('.')
-        version = int(v1 + v2)
-        return self._calculate_toolset_version(version)
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['/Qopenmp']
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return self.BUILD_ARGS[buildtype]
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return self.OPTIM_ARGS[optimization_level]
diff --git a/meson/mesonbuild/compilers/mixins/islinker.py b/meson/mesonbuild/compilers/mixins/islinker.py
deleted file mode 100644 (file)
index a9967d6..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-# Copyright 2019 The Meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Mixins for compilers that *are* linkers.
-
-While many compilers (such as gcc and clang) are used by meson to dispatch
-linker commands and other (like MSVC) are not, a few (such as DMD) actually
-are both the linker and compiler in one binary. This module provides mixin
-classes for those cases.
-"""
-
-import typing as T
-
-from ... import mesonlib
-
-if T.TYPE_CHECKING:
-    from ...coredata import OptionDictType
-    from ...environment import Environment
-
-
-class BasicLinkerIsCompilerMixin:
-
-    """Provides a baseline of methods that a linker would implement.
-
-    In every case this provides a "no" or "empty" answer. If a compiler
-    implements any of these it needs a different mixin or to override that
-    functionality itself.
-    """
-
-    def sanitizer_link_args(self, value: str) -> T.List[str]:
-        return []
-
-    def get_lto_link_args(self) -> T.List[str]:
-        return []
-
-    def can_linker_accept_rsp(self) -> bool:
-        return mesonlib.is_windows()
-
-    def get_linker_exelist(self) -> T.List[str]:
-        return self.exelist.copy()
-
-    def get_linker_output_args(self, output: str) -> T.List[str]:
-        return []
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return []
-
-    def get_linker_lib_prefix(self) -> str:
-        return ''
-
-    def get_option_link_args(self, options: 'OptionDictType') -> T.List[str]:
-        return []
-
-    def has_multi_link_args(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]:
-        return False, False
-
-    def get_link_debugfile_args(self, targetfile: str) -> T.List[str]:
-        return []
-
-    def get_std_shared_lib_link_args(self) -> T.List[str]:
-        return []
-
-    def get_std_shared_module_args(self, options: 'OptionDictType') -> T.List[str]:
-        return self.get_std_shared_lib_link_args()
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        raise mesonlib.EnvironmentException(
-            'Linker {} does not support link_whole'.format(self.id))
-
-    def get_allow_undefined_link_args(self) -> T.List[str]:
-        raise mesonlib.EnvironmentException(
-            'Linker {} does not support allow undefined'.format(self.id))
-
-    def get_pie_link_args(self) -> T.List[str]:
-        m = 'Linker {} does not support position-independent executable'
-        raise mesonlib.EnvironmentException(m.format(self.id))
-
-    def get_undefined_link_args(self) -> T.List[str]:
-        return []
-
-    def get_coverage_link_args(self) -> T.List[str]:
-        m = "Linker {} doesn't implement coverage data generation.".format(self.id)
-        raise mesonlib.EnvironmentException(m)
-
-    def no_undefined_link_args(self) -> T.List[str]:
-        return []
-
-    def bitcode_args(self) -> T.List[str]:
-        raise mesonlib.MesonException("This linker doesn't support bitcode bundles")
-
-    def get_soname_args(self, for_machine: 'mesonlib.MachineChoice',
-                        prefix: str, shlib_name: str, suffix: str, soversion: str,
-                        darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        raise mesonlib.MesonException("This linker doesn't support soname args")
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return ([], set())
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return []
-
-    def get_buildtype_linker_args(self, buildtype: str) -> T.List[str]:
-        return []
-
-    def get_link_debugfile_name(self, target: str) -> str:
-        return ''
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def thread_link_flags(self, env: 'Environment') -> T.List[str]:
-        return []
diff --git a/meson/mesonbuild/compilers/mixins/pgi.py b/meson/mesonbuild/compilers/mixins/pgi.py
deleted file mode 100644 (file)
index 77a7a28..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstractions for the PGI family of compilers."""
-
-import typing as T
-import os
-from pathlib import Path
-
-from ..compilers import clike_debug_args, clike_optimization_args
-
-pgi_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-
-class PGICompiler:
-    def __init__(self):
-        self.base_options = ['b_pch']
-        self.id = 'pgi'
-
-        default_warn_args = ['-Minform=inform']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args,
-                          '3': default_warn_args}
-
-    def get_module_incdir_args(self) -> T.Tuple[str]:
-        return ('-module', )
-
-    def get_no_warn_args(self) -> T.List[str]:
-        return ['-silent']
-
-    def gen_import_library_args(self, implibname: str) -> T.List[str]:
-        return []
-
-    def get_pic_args(self) -> T.List[str]:
-        # PGI -fPIC is Linux only.
-        if self.info.is_linux():
-            return ['-fPIC']
-        return []
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['-mp']
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return pgi_buildtype_args[buildtype]
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return clike_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return clike_debug_args[is_debug]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-        return parameter_list
-
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return []
-
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-    def get_pch_suffix(self) -> str:
-        # PGI defaults to .pch suffix for PCH on Linux and Windows with --pch option
-        return 'pch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        # PGI supports PCH for C++ only.
-        hdr = Path(pch_dir).resolve().parent / header
-        if self.language == 'cpp':
-            return ['--pch',
-                    '--pch_dir', str(hdr.parent),
-                    '-I{}'.format(hdr.parent)]
-        else:
-            return []
-
-    def thread_flags(self, env):
-        # PGI cannot accept -pthread, it's already threaded
-        return []
diff --git a/meson/mesonbuild/compilers/mixins/visualstudio.py b/meson/mesonbuild/compilers/mixins/visualstudio.py
deleted file mode 100644 (file)
index 93101b5..0000000
+++ /dev/null
@@ -1,432 +0,0 @@
-# Copyright 2019 The meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Abstractions to simplify compilers that implement an MSVC compatible
-interface.
-"""
-
-import abc
-import os
-import typing as T
-
-from ... import mesonlib
-from ... import mlog
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-vs32_instruction_set_args = {
-    'mmx': ['/arch:SSE'], # There does not seem to be a flag just for MMX
-    'sse': ['/arch:SSE'],
-    'sse2': ['/arch:SSE2'],
-    'sse3': ['/arch:AVX'], # VS leaped from SSE2 directly to AVX.
-    'sse41': ['/arch:AVX'],
-    'sse42': ['/arch:AVX'],
-    'avx': ['/arch:AVX'],
-    'avx2': ['/arch:AVX2'],
-    'neon': None,
-}  # T.Dicst[str, T.Optional[T.List[str]]]
-
-# The 64 bit compiler defaults to /arch:avx.
-vs64_instruction_set_args = {
-    'mmx': ['/arch:AVX'],
-    'sse': ['/arch:AVX'],
-    'sse2': ['/arch:AVX'],
-    'sse3': ['/arch:AVX'],
-    'ssse3': ['/arch:AVX'],
-    'sse41': ['/arch:AVX'],
-    'sse42': ['/arch:AVX'],
-    'avx': ['/arch:AVX'],
-    'avx2': ['/arch:AVX2'],
-    'neon': None,
-}  # T.Dicst[str, T.Optional[T.List[str]]]
-
-msvc_buildtype_args = {
-    'plain': [],
-    'debug': ["/ZI", "/Ob0", "/Od", "/RTC1"],
-    'debugoptimized': ["/Zi", "/Ob1"],
-    'release': ["/Ob2", "/Gw"],
-    'minsize': ["/Zi", "/Gw"],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-# Clang-cl doesn't have /ZI, and /Zi and /Z7 do the same thing
-# quoting the docs (https://clang.llvm.org/docs/MSVCCompatibility.html):
-#
-# Clang emits relatively complete CodeView debug information if /Z7 or /Zi is
-# passed. Microsoft’s link.exe will transform the CodeView debug information
-# into a PDB
-clangcl_buildtype_args = msvc_buildtype_args.copy()
-clangcl_buildtype_args['debug'] = ['/Zi', '/Ob0', '/Od', '/RTC1']
-
-msvc_optimization_args = {
-    '0': [],
-    'g': ['/O0'],
-    '1': ['/O1'],
-    '2': ['/O2'],
-    '3': ['/O2'],
-    's': ['/O1'], # Implies /Os.
-}  # type: T.Dict[str, T.List[str]]
-
-msvc_debug_args = {
-    False: [],
-    True: []  # Fixme!
-}  # type: T.Dict[bool, T.List[str]]
-
-
-class VisualStudioLikeCompiler(metaclass=abc.ABCMeta):
-
-    """A common interface for all compilers implementing an MSVC-style
-    interface.
-
-    A number of compilers attempt to mimic MSVC, with varying levels of
-    success, such as Clang-CL and ICL (the Intel C/C++ Compiler for Windows).
-    This class implements as much common logic as possible.
-    """
-
-    std_warn_args = ['/W3']
-    std_opt_args = ['/O2']
-    # XXX: this is copied in this patch only to avoid circular dependencies
-    #ignore_libs = unixy_compiler_internal_libs
-    ignore_libs = ('m', 'c', 'pthread', 'dl', 'rt', 'execinfo')
-    internal_libs = ()
-
-    crt_args = {
-        'none': [],
-        'md': ['/MD'],
-        'mdd': ['/MDd'],
-        'mt': ['/MT'],
-        'mtd': ['/MTd'],
-    }  # type: T.Dict[str, T.List[str]]
-
-    # /showIncludes is needed for build dependency tracking in Ninja
-    # See: https://ninja-build.org/manual.html#_deps
-    always_args = ['/nologo', '/showIncludes']
-    warn_args = {
-        '0': [],
-        '1': ['/W2'],
-        '2': ['/W3'],
-        '3': ['/W4'],
-    }  # type: T.Dict[str, T.List[str]]
-
-    INVOKES_LINKER = False
-
-    def __init__(self, target: str):
-        self.base_options = ['b_pch', 'b_ndebug', 'b_vscrt'] # FIXME add lto, pgo and the like
-        self.target = target
-        self.is_64 = ('x64' in target) or ('x86_64' in target)
-        # do some canonicalization of target machine
-        if 'x86_64' in target:
-            self.machine = 'x64'
-        elif '86' in target:
-            self.machine = 'x86'
-        else:
-            self.machine = target
-        self.linker.machine = self.machine
-
-    # Override CCompiler.get_always_args
-    def get_always_args(self) -> T.List[str]:
-        return self.always_args
-
-    def get_pch_suffix(self) -> str:
-        return 'pch'
-
-    def get_pch_name(self, header: str) -> str:
-        chopped = os.path.basename(header).split('.')[:-1]
-        chopped.append(self.get_pch_suffix())
-        pchname = '.'.join(chopped)
-        return pchname
-
-    def get_pch_base_name(self, header: str) -> str:
-        # This needs to be implemented by inherting classes
-        raise NotImplementedError
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        base = self.get_pch_base_name(header)
-        pchname = self.get_pch_name(header)
-        return ['/FI' + base, '/Yu' + base, '/Fp' + os.path.join(pch_dir, pchname)]
-
-    def get_preprocess_only_args(self) -> T.List[str]:
-        return ['/EP']
-
-    def get_compile_only_args(self) -> T.List[str]:
-        return ['/c']
-
-    def get_no_optimization_args(self) -> T.List[str]:
-        return ['/Od']
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        if target.endswith('.exe'):
-            return ['/Fe' + target]
-        return ['/Fo' + target]
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return msvc_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return msvc_debug_args[is_debug]
-
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return []
-
-    def linker_to_compiler_args(self, args: T.List[str]) -> T.List[str]:
-        return ['/link'] + args
-
-    def get_gui_app_args(self, value: bool) -> T.List[str]:
-        # the default is for the linker to guess the subsystem based on presence
-        # of main or WinMain symbols, so always be explicit
-        if value:
-            return ['/SUBSYSTEM:WINDOWS']
-        else:
-            return ['/SUBSYSTEM:CONSOLE']
-
-    def get_pic_args(self) -> T.List[str]:
-        return [] # PIC is handled by the loader on Windows
-
-    def gen_vs_module_defs_args(self, defsfile: str) -> T.List[str]:
-        if not isinstance(defsfile, str):
-            raise RuntimeError('Module definitions file should be str')
-        # With MSVC, DLLs only export symbols that are explicitly exported,
-        # so if a module defs file is specified, we use that to export symbols
-        return ['/DEF:' + defsfile]
-
-    def gen_pch_args(self, header: str, source: str, pchname: str) -> T.Tuple[str, T.List[str]]:
-        objname = os.path.splitext(pchname)[0] + '.obj'
-        return objname, ['/Yc' + header, '/Fp' + pchname, '/Fo' + objname]
-
-    def openmp_flags(self) -> T.List[str]:
-        return ['/openmp']
-
-    def openmp_link_flags(self) -> T.List[str]:
-        return []
-
-    # FIXME, no idea what these should be.
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        result = []
-        for i in args:
-            # -mms-bitfields is specific to MinGW-GCC
-            # -pthread is only valid for GCC
-            if i in ('-mms-bitfields', '-pthread'):
-                continue
-            if i.startswith('-LIBPATH:'):
-                i = '/LIBPATH:' + i[9:]
-            elif i.startswith('-L'):
-                i = '/LIBPATH:' + i[2:]
-            # Translate GNU-style -lfoo library name to the import library
-            elif i.startswith('-l'):
-                name = i[2:]
-                if name in cls.ignore_libs:
-                    # With MSVC, these are provided by the C runtime which is
-                    # linked in by default
-                    continue
-                else:
-                    i = name + '.lib'
-            elif i.startswith('-isystem'):
-                # just use /I for -isystem system include path s
-                if i.startswith('-isystem='):
-                    i = '/I' + i[9:]
-                else:
-                    i = '/I' + i[8:]
-            elif i.startswith('-idirafter'):
-                # same as -isystem, but appends the path instead
-                if i.startswith('-idirafter='):
-                    i = '/I' + i[11:]
-                else:
-                    i = '/I' + i[10:]
-            # -pthread in link flags is only used on Linux
-            elif i == '-pthread':
-                continue
-            result.append(i)
-        return result
-
-    @classmethod
-    def native_args_to_unix(cls, args: T.List[str]) -> T.List[str]:
-        result = []
-        for arg in args:
-            if arg.startswith(('/LIBPATH:', '-LIBPATH:')):
-                result.append('-L' + arg[9:])
-            elif arg.endswith(('.a', '.lib')) and not os.path.isabs(arg):
-                result.append('-l' + arg)
-            else:
-                result.append(arg)
-        return result
-
-    def get_werror_args(self) -> T.List[str]:
-        return ['/WX']
-
-    def get_include_args(self, path: str, is_system: bool) -> T.List[str]:
-        if path == '':
-            path = '.'
-        # msvc does not have a concept of system header dirs.
-        return ['-I' + path]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '/I':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-            elif i[:9] == '/LIBPATH:':
-                parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:]))
-
-        return parameter_list
-
-    # Visual Studio is special. It ignores some arguments it does not
-    # understand and you can't tell it to error out on those.
-    # http://stackoverflow.com/questions/15259720/how-can-i-make-the-microsoft-c-compiler-treat-unknown-flags-as-errors-rather-t
-    def has_arguments(self, args: T.List[str], env: 'Environment', code, mode: str) -> T.Tuple[bool, bool]:
-        warning_text = '4044' if mode == 'link' else '9002'
-        with self._build_wrapper(code, env, extra_args=args, mode=mode) as p:
-            if p.returncode != 0:
-                return False, p.cached
-            return not(warning_text in p.stde or warning_text in p.stdo), p.cached
-
-    def get_compile_debugfile_args(self, rel_obj: str, pch: bool = False) -> T.List[str]:
-        pdbarr = rel_obj.split('.')[:-1]
-        pdbarr += ['pdb']
-        args = ['/Fd' + '.'.join(pdbarr)]
-        return args
-
-    def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]:
-        if self.is_64:
-            return vs64_instruction_set_args.get(instruction_set, None)
-        return vs32_instruction_set_args.get(instruction_set, None)
-
-    def _calculate_toolset_version(self, version: int) -> T.Optional[str]:
-        if version < 1310:
-            return '7.0'
-        elif version < 1400:
-            return '7.1' # (Visual Studio 2003)
-        elif version < 1500:
-            return '8.0' # (Visual Studio 2005)
-        elif version < 1600:
-            return '9.0' # (Visual Studio 2008)
-        elif version < 1700:
-            return '10.0' # (Visual Studio 2010)
-        elif version < 1800:
-            return '11.0' # (Visual Studio 2012)
-        elif version < 1900:
-            return '12.0' # (Visual Studio 2013)
-        elif version < 1910:
-            return '14.0' # (Visual Studio 2015)
-        elif version < 1920:
-            return '14.1' # (Visual Studio 2017)
-        elif version < 1930:
-            return '14.2' # (Visual Studio 2019)
-        mlog.warning('Could not find toolset for version {!r}'.format(self.version))
-        return None
-
-    def get_toolset_version(self) -> T.Optional[str]:
-        # See boost/config/compiler/visualc.cpp for up to date mapping
-        try:
-            version = int(''.join(self.version.split('.')[0:2]))
-        except ValueError:
-            return None
-        return self._calculate_toolset_version(version)
-
-    def get_default_include_dirs(self) -> T.List[str]:
-        if 'INCLUDE' not in os.environ:
-            return []
-        return os.environ['INCLUDE'].split(os.pathsep)
-
-    def get_crt_compile_args(self, crt_val: str, buildtype: str) -> T.List[str]:
-        if crt_val in self.crt_args:
-            return self.crt_args[crt_val]
-        assert(crt_val == 'from_buildtype')
-        # Match what build type flags used to do.
-        if buildtype == 'plain':
-            return []
-        elif buildtype == 'debug':
-            return self.crt_args['mdd']
-        elif buildtype == 'debugoptimized':
-            return self.crt_args['md']
-        elif buildtype == 'release':
-            return self.crt_args['md']
-        elif buildtype == 'minsize':
-            return self.crt_args['md']
-        else:
-            assert(buildtype == 'custom')
-            raise mesonlib.EnvironmentException('Requested C runtime based on buildtype, but buildtype is "custom".')
-
-    def has_func_attribute(self, name: str, env: 'Environment') -> T.Tuple[bool, bool]:
-        # MSVC doesn't have __attribute__ like Clang and GCC do, so just return
-        # false without compiling anything
-        return name in ['dllimport', 'dllexport'], False
-
-    def get_argument_syntax(self) -> str:
-        return 'msvc'
-
-
-class MSVCCompiler(VisualStudioLikeCompiler):
-
-    """Spcific to the Microsoft Compilers."""
-
-    def __init__(self, target: str):
-        super().__init__(target)
-        self.id = 'msvc'
-
-    def get_compile_debugfile_args(self, rel_obj: str, pch: bool = False) -> T.List[str]:
-        args = super().get_compile_debugfile_args(rel_obj, pch)
-        # When generating a PDB file with PCH, all compile commands write
-        # to the same PDB file. Hence, we need to serialize the PDB
-        # writes using /FS since we do parallel builds. This slows down the
-        # build obviously, which is why we only do this when PCH is on.
-        # This was added in Visual Studio 2013 (MSVC 18.0). Before that it was
-        # always on: https://msdn.microsoft.com/en-us/library/dn502518.aspx
-        if pch and mesonlib.version_compare(self.version, '>=18.0'):
-            args = ['/FS'] + args
-        return args
-
-    def get_instruction_set_args(self, instruction_set: str) -> T.Optional[T.List[str]]:
-        if self.version.split('.')[0] == '16' and instruction_set == 'avx':
-            # VS documentation says that this exists and should work, but
-            # it does not. The headers do not contain AVX intrinsics
-            # and they can not be called.
-            return None
-        return super().get_instruction_set_args(instruction_set)
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        args = msvc_buildtype_args[buildtype]
-        if mesonlib.version_compare(self.version, '<18.0'):
-            args = [arg for arg in args if arg != '/Gw']
-        return args
-
-    def get_pch_base_name(self, header: str) -> str:
-        return os.path.basename(header)
-
-
-class ClangClCompiler(VisualStudioLikeCompiler):
-
-    """Spcific to Clang-CL."""
-
-    def __init__(self, target: str):
-        super().__init__(target)
-        self.id = 'clang-cl'
-
-    def has_arguments(self, args: T.List[str], env: 'Environment', code, mode: str) -> T.Tuple[bool, bool]:
-        if mode != 'link':
-            args = args + ['-Werror=unknown-argument']
-        return super().has_arguments(args, env, code, mode)
-
-    def get_toolset_version(self) -> T.Optional[str]:
-        # XXX: what is the right thing to do here?
-        return '14.1'
-
-    def get_pch_base_name(self, header: str) -> str:
-        return header
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return clangcl_buildtype_args[buildtype]
diff --git a/meson/mesonbuild/compilers/mixins/xc16.py b/meson/mesonbuild/compilers/mixins/xc16.py
deleted file mode 100644 (file)
index f12cccc..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Representations specific to the Microchip XC16 C compiler family."""
-
-import os
-import typing as T
-
-from ...mesonlib import EnvironmentException
-
-if T.TYPE_CHECKING:
-    from ...environment import Environment
-
-xc16_buildtype_args = {
-    'plain': [],
-    'debug': [],
-    'debugoptimized': [],
-    'release': [],
-    'minsize': [],
-    'custom': [],
-}  # type: T.Dict[str, T.List[str]]
-
-xc16_optimization_args = {
-    '0': ['-O0'],
-    'g': ['-O0'],
-    '1': ['-O1'],
-    '2': ['-O2'],
-    '3': ['-O3'],
-    's': ['-Os']
-}  # type: T.Dict[str, T.List[str]]
-
-xc16_debug_args = {
-    False: [],
-    True: []
-}  # type: T.Dict[bool, T.List[str]]
-
-
-class Xc16Compiler:
-    def __init__(self):
-        if not self.is_cross:
-            raise EnvironmentException('xc16 supports only cross-compilation.')
-        self.id = 'xc16'
-        # Assembly
-        self.can_compile_suffixes.add('s')
-        default_warn_args = []  # type: T.List[str]
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + [],
-                          '3': default_warn_args + []}
-
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-    def get_pic_args(self) -> T.List[str]:
-        # PIC support is not enabled by default for xc16,
-        # if users want to use it, they need to add the required arguments explicitly
-        return []
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return xc16_buildtype_args[buildtype]
-
-    def get_pch_suffix(self) -> str:
-        return 'pch'
-
-    def get_pch_use_args(self, pch_dir: str, header: str) -> T.List[str]:
-        return []
-
-    # Override CCompiler.get_dependency_gen_args
-    def get_dependency_gen_args(self, outtarget: str, outfile: str) -> T.List[str]:
-        return []
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def get_coverage_args(self) -> T.List[str]:
-        return []
-    
-    def get_no_stdinc_args(self) -> T.List[str]:
-        return ['-nostdinc']
-
-    def get_no_stdlib_link_args(self) -> T.List[str]:
-        return ['--nostdlib']
-
-    def get_optimization_args(self, optimization_level: str) -> T.List[str]:
-        return xc16_optimization_args[optimization_level]
-
-    def get_debug_args(self, is_debug: bool) -> T.List[str]:
-        return xc16_debug_args[is_debug]
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        result = []
-        for i in args:
-            if i.startswith('-D'):
-                i = '-D' + i[2:]
-            if i.startswith('-I'):
-                i = '-I' + i[2:]
-            if i.startswith('-Wl,-rpath='):
-                continue
-            elif i == '--print-search-dirs':
-                continue
-            elif i.startswith('-L'):
-                continue
-            result.append(i)
-        return result
-
-    def compute_parameters_with_absolute_paths(self, parameter_list: T.List[str], build_dir: str) -> T.List[str]:
-        for idx, i in enumerate(parameter_list):
-            if i[:9] == '-I':
-                parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:]))
-
-        return parameter_list
diff --git a/meson/mesonbuild/compilers/objc.py b/meson/mesonbuild/compilers/objc.py
deleted file mode 100644 (file)
index 254a609..0000000
+++ /dev/null
@@ -1,99 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path, subprocess
-import typing as T
-
-from ..mesonlib import EnvironmentException, MachineChoice
-
-from .compilers import Compiler
-from .mixins.clike import CLikeCompiler
-from .mixins.gnu import GnuCompiler
-from .mixins.clang import ClangCompiler
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-
-class ObjCCompiler(CLikeCompiler, Compiler):
-
-    language = 'objc'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross: bool, info: 'MachineInfo',
-                 exe_wrap: T.Optional[str], **kwargs):
-        Compiler.__init__(self, exelist, version, for_machine, info, **kwargs)
-        CLikeCompiler.__init__(self, is_cross, exe_wrap)
-
-    @staticmethod
-    def get_display_language():
-        return 'Objective-C'
-
-    def sanity_check(self, work_dir, environment):
-        # TODO try to use sanity_check_impl instead of duplicated code
-        source_name = os.path.join(work_dir, 'sanitycheckobjc.m')
-        binary_name = os.path.join(work_dir, 'sanitycheckobjc')
-        extra_flags = []
-        extra_flags += environment.coredata.get_external_args(self.for_machine, self.language)
-        if self.is_cross:
-            extra_flags += self.get_compile_only_args()
-        else:
-            extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
-        with open(source_name, 'w') as ofile:
-            ofile.write('#import<stddef.h>\n'
-                        'int main(void) { return 0; }\n')
-        pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('ObjC compiler %s can not compile programs.' % self.name_string())
-        if self.is_cross:
-            # Can't check if the binaries run so we have to assume they do
-            return
-        pe = subprocess.Popen(binary_name)
-        pe.wait()
-        if pe.returncode != 0:
-            raise EnvironmentException('Executables created by ObjC compiler %s are not runnable.' % self.name_string())
-
-
-class GnuObjCCompiler(GnuCompiler, ObjCCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        ObjCCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                              info, exe_wrapper, **kwargs)
-        GnuCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-
-class ClangObjCCompiler(ClangCompiler, ObjCCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        ObjCCompiler.__init__(self, exelist, version, for_machine, is_cross,
-                              info, exe_wrapper, **kwargs)
-        ClangCompiler.__init__(self, [])
-        default_warn_args = ['-Wall', '-Winvalid-pch']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-
-class AppleClangObjCCompiler(ClangObjCCompiler):
-
-    """Handle the differences between Apple's clang and vanilla clang."""
diff --git a/meson/mesonbuild/compilers/objcpp.py b/meson/mesonbuild/compilers/objcpp.py
deleted file mode 100644 (file)
index 3197abc..0000000
+++ /dev/null
@@ -1,98 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path, subprocess
-import typing as T
-
-from ..mesonlib import EnvironmentException, MachineChoice
-
-from .mixins.clike import CLikeCompiler
-from .compilers import Compiler
-from .mixins.gnu import GnuCompiler
-from .mixins.clang import ClangCompiler
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-class ObjCPPCompiler(CLikeCompiler, Compiler):
-
-    language = 'objcpp'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross: bool, info: 'MachineInfo',
-                 exe_wrap: T.Optional[str], **kwargs):
-        Compiler.__init__(self, exelist, version, for_machine, info, **kwargs)
-        CLikeCompiler.__init__(self, is_cross, exe_wrap)
-
-    @staticmethod
-    def get_display_language():
-        return 'Objective-C++'
-
-    def sanity_check(self, work_dir, environment):
-        # TODO try to use sanity_check_impl instead of duplicated code
-        source_name = os.path.join(work_dir, 'sanitycheckobjcpp.mm')
-        binary_name = os.path.join(work_dir, 'sanitycheckobjcpp')
-        extra_flags = []
-        extra_flags += environment.coredata.get_external_args(self.for_machine, self.language)
-        if self.is_cross:
-            extra_flags += self.get_compile_only_args()
-        else:
-            extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
-        with open(source_name, 'w') as ofile:
-            ofile.write('#import<stdio.h>\n'
-                        'class MyClass;'
-                        'int main(void) { return 0; }\n')
-        pc = subprocess.Popen(self.exelist + extra_flags + [source_name, '-o', binary_name])
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('ObjC++ compiler %s can not compile programs.' % self.name_string())
-        if self.is_cross:
-            # Can't check if the binaries run so we have to assume they do
-            return
-        pe = subprocess.Popen(binary_name)
-        pe.wait()
-        if pe.returncode != 0:
-            raise EnvironmentException('Executables created by ObjC++ compiler %s are not runnable.' % self.name_string())
-
-
-class GnuObjCPPCompiler(GnuCompiler, ObjCPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 defines=None, **kwargs):
-        ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
-        GnuCompiler.__init__(self, defines)
-        default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-
-class ClangObjCPPCompiler(ClangCompiler, ObjCPPCompiler):
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None,
-                 **kwargs):
-        ObjCPPCompiler.__init__(self, exelist, version, for_machine, is_cross, info, exe_wrapper, **kwargs)
-        ClangCompiler.__init__(self, [])
-        default_warn_args = ['-Wall', '-Winvalid-pch', '-Wnon-virtual-dtor']
-        self.warn_args = {'0': [],
-                          '1': default_warn_args,
-                          '2': default_warn_args + ['-Wextra'],
-                          '3': default_warn_args + ['-Wextra', '-Wpedantic']}
-
-
-
-class AppleClangObjCPPCompiler(ClangObjCPPCompiler):
-
-    """Handle the differences between Apple's clang and vanilla clang."""
diff --git a/meson/mesonbuild/compilers/rust.py b/meson/mesonbuild/compilers/rust.py
deleted file mode 100644 (file)
index c2e21c4..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import subprocess, os.path
-import typing as T
-
-from ..mesonlib import EnvironmentException, MachineChoice, Popen_safe
-from .compilers import Compiler, rust_buildtype_args, clike_debug_args
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-    from ..environment import Environment  # noqa: F401
-
-rust_optimization_args = {'0': [],
-                          'g': ['-C', 'opt-level=0'],
-                          '1': ['-C', 'opt-level=1'],
-                          '2': ['-C', 'opt-level=2'],
-                          '3': ['-C', 'opt-level=3'],
-                          's': ['-C', 'opt-level=s'],
-                          }
-
-class RustCompiler(Compiler):
-
-    # rustc doesn't invoke the compiler itself, it doesn't need a LINKER_PREFIX
-    language = 'rust'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', exe_wrapper=None, **kwargs):
-        super().__init__(exelist, version, for_machine, info, **kwargs)
-        self.exe_wrapper = exe_wrapper
-        self.id = 'rustc'
-        self.is_cross = is_cross
-
-    def needs_static_linker(self):
-        return False
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def sanity_check(self, work_dir, environment):
-        source_name = os.path.join(work_dir, 'sanity.rs')
-        output_name = os.path.join(work_dir, 'rusttest')
-        with open(source_name, 'w') as ofile:
-            ofile.write('''fn main() {
-}
-''')
-        pc = subprocess.Popen(self.exelist + ['-o', output_name, source_name],
-                              stdout=subprocess.PIPE,
-                              stderr=subprocess.PIPE,
-                              cwd=work_dir)
-        stdo, stde = pc.communicate()
-        stdo = stdo.decode('utf-8', errors='replace')
-        stde = stde.decode('utf-8', errors='replace')
-        if pc.returncode != 0:
-            raise EnvironmentException('Rust compiler %s can not compile programs.\n%s\n%s' % (
-                self.name_string(),
-                stdo,
-                stde))
-        if self.is_cross:
-            if self.exe_wrapper is None:
-                # Can't check if the binaries run so we have to assume they do
-                return
-            cmdlist = self.exe_wrapper + [output_name]
-        else:
-            cmdlist = [output_name]
-        pe = subprocess.Popen(cmdlist, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-        pe.wait()
-        if pe.returncode != 0:
-            raise EnvironmentException('Executables created by Rust compiler %s are not runnable.' % self.name_string())
-
-    def get_dependency_gen_args(self, outfile):
-        return ['--dep-info', outfile]
-
-    def get_buildtype_args(self, buildtype):
-        return rust_buildtype_args[buildtype]
-
-    def get_sysroot(self):
-        cmd = self.exelist + ['--print', 'sysroot']
-        p, stdo, stde = Popen_safe(cmd)
-        return stdo.split('\n')[0]
-
-    def get_debug_args(self, is_debug):
-        return clike_debug_args[is_debug]
-
-    def get_optimization_args(self, optimization_level):
-        return rust_optimization_args[optimization_level]
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-L':
-                for j in ['dependency', 'crate', 'native', 'framework', 'all']:
-                    combined_len = len(j) + 3
-                    if i[:combined_len] == '-L{}='.format(j):
-                        parameter_list[idx] = i[:combined_len] + os.path.normpath(os.path.join(build_dir, i[combined_len:]))
-                        break
-
-        return parameter_list
-
-    def get_std_exe_link_args(self):
-        return []
-
-    # Rust does not have a use_linker_args because it dispatches to a gcc-like
-    # C compiler for dynamic linking, as such we invoke the C compiler's
-    # use_linker_args method instead.
diff --git a/meson/mesonbuild/compilers/swift.py b/meson/mesonbuild/compilers/swift.py
deleted file mode 100644 (file)
index 1942120..0000000
+++ /dev/null
@@ -1,124 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import subprocess, os.path
-import typing as T
-
-from ..mesonlib import EnvironmentException, MachineChoice
-
-from .compilers import Compiler, swift_buildtype_args, clike_debug_args
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-swift_optimization_args = {'0': [],
-                           'g': [],
-                           '1': ['-O'],
-                           '2': ['-O'],
-                           '3': ['-O'],
-                           's': ['-O'],
-                           }
-
-class SwiftCompiler(Compiler):
-
-    LINKER_PREFIX = ['-Xlinker']
-    language = 'swift'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo', **kwargs):
-        super().__init__(exelist, version, for_machine, info, **kwargs)
-        self.version = version
-        self.id = 'llvm'
-        self.is_cross = is_cross
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def needs_static_linker(self):
-        return True
-
-    def get_werror_args(self):
-        return ['--fatal-warnings']
-
-    def get_dependency_gen_args(self, outtarget, outfile):
-        return ['-emit-dependencies']
-
-    def depfile_for_object(self, objfile):
-        return os.path.splitext(objfile)[0] + '.' + self.get_depfile_suffix()
-
-    def get_depfile_suffix(self):
-        return 'd'
-
-    def get_output_args(self, target):
-        return ['-o', target]
-
-    def get_header_import_args(self, headername):
-        return ['-import-objc-header', headername]
-
-    def get_warn_args(self, level):
-        return []
-
-    def get_buildtype_args(self, buildtype):
-        return swift_buildtype_args[buildtype]
-
-    def get_std_exe_link_args(self):
-        return ['-emit-executable']
-
-    def get_module_args(self, modname):
-        return ['-module-name', modname]
-
-    def get_mod_gen_args(self):
-        return ['-emit-module']
-
-    def get_include_args(self, dirname):
-        return ['-I' + dirname]
-
-    def get_compile_only_args(self):
-        return ['-c']
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:2] == '-I' or i[:2] == '-L':
-                parameter_list[idx] = i[:2] + os.path.normpath(os.path.join(build_dir, i[2:]))
-
-        return parameter_list
-
-    def sanity_check(self, work_dir, environment):
-        src = 'swifttest.swift'
-        source_name = os.path.join(work_dir, src)
-        output_name = os.path.join(work_dir, 'swifttest')
-        extra_flags = []
-        extra_flags += environment.coredata.get_external_args(self.for_machine, self.language)
-        if self.is_cross:
-            extra_flags += self.get_compile_only_args()
-        else:
-            extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
-        with open(source_name, 'w') as ofile:
-            ofile.write('''print("Swift compilation is working.")
-''')
-        pc = subprocess.Popen(self.exelist + extra_flags + ['-emit-executable', '-o', output_name, src], cwd=work_dir)
-        pc.wait()
-        if pc.returncode != 0:
-            raise EnvironmentException('Swift compiler %s can not compile programs.' % self.name_string())
-        if self.is_cross:
-            # Can't check if the binaries run so we have to assume they do
-            return
-        if subprocess.call(output_name) != 0:
-            raise EnvironmentException('Executables created by Swift compiler %s are not runnable.' % self.name_string())
-
-    def get_debug_args(self, is_debug):
-        return clike_debug_args[is_debug]
-
-    def get_optimization_args(self, optimization_level):
-        return swift_optimization_args[optimization_level]
diff --git a/meson/mesonbuild/compilers/vala.py b/meson/mesonbuild/compilers/vala.py
deleted file mode 100644 (file)
index a5d49b6..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os.path
-import typing as T
-
-from .. import mlog
-from ..mesonlib import EnvironmentException, MachineChoice, version_compare
-
-from .compilers import Compiler
-
-if T.TYPE_CHECKING:
-    from ..envconfig import MachineInfo
-
-class ValaCompiler(Compiler):
-
-    language = 'vala'
-
-    def __init__(self, exelist, version, for_machine: MachineChoice,
-                 is_cross, info: 'MachineInfo'):
-        super().__init__(exelist, version, for_machine, info)
-        self.version = version
-        self.is_cross = is_cross
-        self.id = 'valac'
-        self.base_options = ['b_colorout']
-
-    def name_string(self):
-        return ' '.join(self.exelist)
-
-    def needs_static_linker(self):
-        return False # Because compiles into C.
-
-    def get_optimization_args(self, optimization_level):
-        return []
-
-    def get_debug_args(self, is_debug):
-        return ['--debug'] if is_debug else []
-
-    def get_output_args(self, target):
-        return [] # Because compiles into C.
-
-    def get_compile_only_args(self):
-        return [] # Because compiles into C.
-
-    def get_pic_args(self):
-        return []
-
-    def get_pie_args(self):
-        return []
-
-    def get_pie_link_args(self):
-        return []
-
-    def get_always_args(self):
-        return ['-C']
-
-    def get_warn_args(self, warning_level):
-        return []
-
-    def get_no_warn_args(self):
-        return ['--disable-warnings']
-
-    def get_werror_args(self):
-        return ['--fatal-warnings']
-
-    def get_colorout_args(self, colortype):
-        if version_compare(self.version, '>=0.37.1'):
-            return ['--color=' + colortype]
-        return []
-
-    def compute_parameters_with_absolute_paths(self, parameter_list, build_dir):
-        for idx, i in enumerate(parameter_list):
-            if i[:9] == '--girdir=':
-                parameter_list[idx] = i[:9] + os.path.normpath(os.path.join(build_dir, i[9:]))
-            if i[:10] == '--vapidir=':
-                parameter_list[idx] = i[:10] + os.path.normpath(os.path.join(build_dir, i[10:]))
-            if i[:13] == '--includedir=':
-                parameter_list[idx] = i[:13] + os.path.normpath(os.path.join(build_dir, i[13:]))
-            if i[:14] == '--metadatadir=':
-                parameter_list[idx] = i[:14] + os.path.normpath(os.path.join(build_dir, i[14:]))
-
-        return parameter_list
-
-    def sanity_check(self, work_dir, environment):
-        code = 'class MesonSanityCheck : Object { }'
-        extra_flags = []
-        extra_flags += environment.coredata.get_external_args(self.for_machine, self.language)
-        if self.is_cross:
-            extra_flags += self.get_compile_only_args()
-        else:
-            extra_flags += environment.coredata.get_external_link_args(self.for_machine, self.language)
-        with self.cached_compile(code, environment.coredata, extra_args=extra_flags, mode='compile') as p:
-            if p.returncode != 0:
-                msg = 'Vala compiler {!r} can not compile programs' \
-                      ''.format(self.name_string())
-                raise EnvironmentException(msg)
-
-    def get_buildtype_args(self, buildtype):
-        if buildtype == 'debug' or buildtype == 'debugoptimized' or buildtype == 'minsize':
-            return ['--debug']
-        return []
-
-    def find_library(self, libname, env, extra_dirs, *args):
-        if extra_dirs and isinstance(extra_dirs, str):
-            extra_dirs = [extra_dirs]
-        # Valac always looks in the default vapi dir, so only search there if
-        # no extra dirs are specified.
-        if not extra_dirs:
-            code = 'class MesonFindLibrary : Object { }'
-            args = []
-            args += env.coredata.get_external_args(self.for_machine, self.language)
-            vapi_args = ['--pkg', libname]
-            args += vapi_args
-            with self.cached_compile(code, env.coredata, extra_args=args, mode='compile') as p:
-                if p.returncode == 0:
-                    return vapi_args
-        # Not found? Try to find the vapi file itself.
-        for d in extra_dirs:
-            vapi = os.path.join(d, libname + '.vapi')
-            if os.path.isfile(vapi):
-                return [vapi]
-        mlog.debug('Searched {!r} and {!r} wasn\'t found'.format(extra_dirs, libname))
-        return None
-
-    def thread_flags(self, env):
-        return []
-
-    def thread_link_flags(self, env):
-        return []
diff --git a/meson/mesonbuild/coredata.py b/meson/mesonbuild/coredata.py
deleted file mode 100644 (file)
index d639188..0000000
+++ /dev/null
@@ -1,1231 +0,0 @@
-# Copyrighs 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from . import mlog, mparser
-import pickle, os, uuid
-import sys
-from itertools import chain
-from pathlib import PurePath
-from collections import OrderedDict, defaultdict
-from .mesonlib import (
-    MesonException, MachineChoice, PerMachine, OrderedSet,
-    default_libdir, default_libexecdir, default_prefix, split_args
-)
-from .envconfig import get_env_var_pair
-from .wrap import WrapMode
-import ast
-import argparse
-import configparser
-import enum
-import shlex
-import typing as T
-
-if T.TYPE_CHECKING:
-    from . import dependencies
-    from .compilers import Compiler  # noqa: F401
-    from .environment import Environment
-
-    OptionDictType = T.Dict[str, 'UserOption[T.Any]']
-
-version = '0.55.3'
-backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'vs2019', 'xcode']
-
-default_yielding = False
-
-# Can't bind this near the class method it seems, sadly.
-_T = T.TypeVar('_T')
-
-class MesonVersionMismatchException(MesonException):
-    '''Build directory generated with Meson version incompatible with current version'''
-    def __init__(self, old_version, current_version):
-        super().__init__('Build directory has been generated with Meson version {}, '
-                         'which is incompatible with current version {}.'
-                         .format(old_version, current_version))
-        self.old_version = old_version
-        self.current_version = current_version
-
-
-class UserOption(T.Generic[_T]):
-    def __init__(self, description, choices, yielding):
-        super().__init__()
-        self.choices = choices
-        self.description = description
-        if yielding is None:
-            yielding = default_yielding
-        if not isinstance(yielding, bool):
-            raise MesonException('Value of "yielding" must be a boolean.')
-        self.yielding = yielding
-
-    def printable_value(self):
-        return self.value
-
-    # Check that the input is a valid value and return the
-    # "cleaned" or "native" version. For example the Boolean
-    # option could take the string "true" and return True.
-    def validate_value(self, value: T.Any) -> _T:
-        raise RuntimeError('Derived option class did not override validate_value.')
-
-    def set_value(self, newvalue):
-        self.value = self.validate_value(newvalue)
-
-class UserStringOption(UserOption[str]):
-    def __init__(self, description, value, choices=None, yielding=None):
-        super().__init__(description, choices, yielding)
-        self.set_value(value)
-
-    def validate_value(self, value):
-        if not isinstance(value, str):
-            raise MesonException('Value "%s" for string option is not a string.' % str(value))
-        return value
-
-class UserBooleanOption(UserOption[bool]):
-    def __init__(self, description, value, yielding=None):
-        super().__init__(description, [True, False], yielding)
-        self.set_value(value)
-
-    def __bool__(self) -> bool:
-        return self.value
-
-    def validate_value(self, value) -> bool:
-        if isinstance(value, bool):
-            return value
-        if value.lower() == 'true':
-            return True
-        if value.lower() == 'false':
-            return False
-        raise MesonException('Value %s is not boolean (true or false).' % value)
-
-class UserIntegerOption(UserOption[int]):
-    def __init__(self, description, value, yielding=None):
-        min_value, max_value, default_value = value
-        self.min_value = min_value
-        self.max_value = max_value
-        c = []
-        if min_value is not None:
-            c.append('>=' + str(min_value))
-        if max_value is not None:
-            c.append('<=' + str(max_value))
-        choices = ', '.join(c)
-        super().__init__(description, choices, yielding)
-        self.set_value(default_value)
-
-    def validate_value(self, value) -> int:
-        if isinstance(value, str):
-            value = self.toint(value)
-        if not isinstance(value, int):
-            raise MesonException('New value for integer option is not an integer.')
-        if self.min_value is not None and value < self.min_value:
-            raise MesonException('New value %d is less than minimum value %d.' % (value, self.min_value))
-        if self.max_value is not None and value > self.max_value:
-            raise MesonException('New value %d is more than maximum value %d.' % (value, self.max_value))
-        return value
-
-    def toint(self, valuestring) -> int:
-        try:
-            return int(valuestring)
-        except ValueError:
-            raise MesonException('Value string "%s" is not convertible to an integer.' % valuestring)
-
-class UserUmaskOption(UserIntegerOption, UserOption[T.Union[str, int]]):
-    def __init__(self, description, value, yielding=None):
-        super().__init__(description, (0, 0o777, value), yielding)
-        self.choices = ['preserve', '0000-0777']
-
-    def printable_value(self):
-        if self.value == 'preserve':
-            return self.value
-        return format(self.value, '04o')
-
-    def validate_value(self, value):
-        if value is None or value == 'preserve':
-            return 'preserve'
-        return super().validate_value(value)
-
-    def toint(self, valuestring):
-        try:
-            return int(valuestring, 8)
-        except ValueError as e:
-            raise MesonException('Invalid mode: {}'.format(e))
-
-class UserComboOption(UserOption[str]):
-    def __init__(self, description, choices: T.List[str], value, yielding=None):
-        super().__init__(description, choices, yielding)
-        if not isinstance(self.choices, list):
-            raise MesonException('Combo choices must be an array.')
-        for i in self.choices:
-            if not isinstance(i, str):
-                raise MesonException('Combo choice elements must be strings.')
-        self.set_value(value)
-
-    def validate_value(self, value):
-        if value not in self.choices:
-            optionsstring = ', '.join(['"%s"' % (item,) for item in self.choices])
-            raise MesonException('Value "{}" for combo option "{}" is not one of the choices.'
-                                 ' Possible choices are: {}.'.format(
-                                     value, self.description, optionsstring))
-        return value
-
-class UserArrayOption(UserOption[T.List[str]]):
-    def __init__(self, description, value, split_args=False, user_input=False, allow_dups=False, **kwargs):
-        super().__init__(description, kwargs.get('choices', []), yielding=kwargs.get('yielding', None))
-        self.split_args = split_args
-        self.allow_dups = allow_dups
-        self.value = self.validate_value(value, user_input=user_input)
-
-    def validate_value(self, value, user_input: bool = True) -> T.List[str]:
-        # User input is for options defined on the command line (via -D
-        # options). Users can put their input in as a comma separated
-        # string, but for defining options in meson_options.txt the format
-        # should match that of a combo
-        if not user_input and isinstance(value, str) and not value.startswith('['):
-            raise MesonException('Value does not define an array: ' + value)
-
-        if isinstance(value, str):
-            if value.startswith('['):
-                try:
-                    newvalue = ast.literal_eval(value)
-                except ValueError:
-                    raise MesonException('malformed option {}'.format(value))
-            elif value == '':
-                newvalue = []
-            else:
-                if self.split_args:
-                    newvalue = split_args(value)
-                else:
-                    newvalue = [v.strip() for v in value.split(',')]
-        elif isinstance(value, list):
-            newvalue = value
-        else:
-            raise MesonException('"{}" should be a string array, but it is not'.format(newvalue))
-
-        if not self.allow_dups and len(set(newvalue)) != len(newvalue):
-            msg = 'Duplicated values in array option is deprecated. ' \
-                  'This will become a hard error in the future.'
-            mlog.deprecation(msg)
-        for i in newvalue:
-            if not isinstance(i, str):
-                raise MesonException('String array element "{0}" is not a string.'.format(str(newvalue)))
-        if self.choices:
-            bad = [x for x in newvalue if x not in self.choices]
-            if bad:
-                raise MesonException('Options "{}" are not in allowed choices: "{}"'.format(
-                    ', '.join(bad), ', '.join(self.choices)))
-        return newvalue
-
-
-class UserFeatureOption(UserComboOption):
-    static_choices = ['enabled', 'disabled', 'auto']
-
-    def __init__(self, description, value, yielding=None):
-        super().__init__(description, self.static_choices, value, yielding)
-
-    def is_enabled(self):
-        return self.value == 'enabled'
-
-    def is_disabled(self):
-        return self.value == 'disabled'
-
-    def is_auto(self):
-        return self.value == 'auto'
-
-if T.TYPE_CHECKING:
-    CacheKeyType = T.Tuple[T.Tuple[T.Any, ...], ...]
-    SubCacheKeyType = T.Tuple[T.Any, ...]
-
-
-class DependencyCacheType(enum.Enum):
-
-    OTHER = 0
-    PKG_CONFIG = 1
-    CMAKE = 2
-
-    @classmethod
-    def from_type(cls, dep: 'dependencies.Dependency') -> 'DependencyCacheType':
-        from . import dependencies
-        # As more types gain search overrides they'll need to be added here
-        if isinstance(dep, dependencies.PkgConfigDependency):
-            return cls.PKG_CONFIG
-        if isinstance(dep, dependencies.CMakeDependency):
-            return cls.CMAKE
-        return cls.OTHER
-
-
-class DependencySubCache:
-
-    def __init__(self, type_: DependencyCacheType):
-        self.types = [type_]
-        self.__cache = {}  # type: T.Dict[SubCacheKeyType, dependencies.Dependency]
-
-    def __getitem__(self, key: 'SubCacheKeyType') -> 'dependencies.Dependency':
-        return self.__cache[key]
-
-    def __setitem__(self, key: 'SubCacheKeyType', value: 'dependencies.Dependency') -> None:
-        self.__cache[key] = value
-
-    def __contains__(self, key: 'SubCacheKeyType') -> bool:
-        return key in self.__cache
-
-    def values(self) -> T.Iterable['dependencies.Dependency']:
-        return self.__cache.values()
-
-
-class DependencyCache:
-
-    """Class that stores a cache of dependencies.
-
-    This class is meant to encapsulate the fact that we need multiple keys to
-    successfully lookup by providing a simple get/put interface.
-    """
-
-    def __init__(self, builtins_per_machine: PerMachine[T.Dict[str, UserOption[T.Any]]], for_machine: MachineChoice):
-        self.__cache = OrderedDict()  # type: T.MutableMapping[CacheKeyType, DependencySubCache]
-        self.__builtins_per_machine = builtins_per_machine
-        self.__for_machine = for_machine
-
-    def __calculate_subkey(self, type_: DependencyCacheType) -> T.Tuple[T.Any, ...]:
-        if type_ is DependencyCacheType.PKG_CONFIG:
-            return tuple(self.__builtins_per_machine[self.__for_machine]['pkg_config_path'].value)
-        elif type_ is DependencyCacheType.CMAKE:
-            return tuple(self.__builtins_per_machine[self.__for_machine]['cmake_prefix_path'].value)
-        assert type_ is DependencyCacheType.OTHER, 'Someone forgot to update subkey calculations for a new type'
-        return tuple()
-
-    def __iter__(self) -> T.Iterator['CacheKeyType']:
-        return self.keys()
-
-    def put(self, key: 'CacheKeyType', dep: 'dependencies.Dependency') -> None:
-        t = DependencyCacheType.from_type(dep)
-        if key not in self.__cache:
-            self.__cache[key] = DependencySubCache(t)
-        subkey = self.__calculate_subkey(t)
-        self.__cache[key][subkey] = dep
-
-    def get(self, key: 'CacheKeyType') -> T.Optional['dependencies.Dependency']:
-        """Get a value from the cache.
-
-        If there is no cache entry then None will be returned.
-        """
-        try:
-            val = self.__cache[key]
-        except KeyError:
-            return None
-
-        for t in val.types:
-            subkey = self.__calculate_subkey(t)
-            try:
-                return val[subkey]
-            except KeyError:
-                pass
-        return None
-
-    def values(self) -> T.Iterator['dependencies.Dependency']:
-        for c in self.__cache.values():
-            yield from c.values()
-
-    def keys(self) -> T.Iterator['CacheKeyType']:
-        return iter(self.__cache.keys())
-
-    def items(self) -> T.Iterator[T.Tuple['CacheKeyType', T.List['dependencies.Dependency']]]:
-        for k, v in self.__cache.items():
-            vs = []
-            for t in v.types:
-                subkey = self.__calculate_subkey(t)
-                if subkey in v:
-                    vs.append(v[subkey])
-            yield k, vs
-
-    def clear(self) -> None:
-        self.__cache.clear()
-
-# Can't bind this near the class method it seems, sadly.
-_V = T.TypeVar('_V')
-
-# This class contains all data that must persist over multiple
-# invocations of Meson. It is roughly the same thing as
-# cmakecache.
-
-class CoreData:
-
-    def __init__(self, options: argparse.Namespace, scratch_dir: str):
-        self.lang_guids = {
-            'default': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
-            'c': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
-            'cpp': '8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942',
-            'test': '3AC096D0-A1C2-E12C-1390-A8335801FDAB',
-            'directory': '2150E333-8FDC-42A3-9474-1A3956D46DE8',
-        }
-        self.test_guid = str(uuid.uuid4()).upper()
-        self.regen_guid = str(uuid.uuid4()).upper()
-        self.install_guid = str(uuid.uuid4()).upper()
-        self.target_guids = {}
-        self.version = version
-        self.builtins = {} # : OptionDictType
-        self.builtins_per_machine = PerMachine({}, {})
-        self.backend_options = {} # : OptionDictType
-        self.user_options = {} # : OptionDictType
-        self.compiler_options = PerMachine(
-            defaultdict(dict),
-            defaultdict(dict),
-        ) # : PerMachine[T.defaultdict[str, OptionDictType]]
-        self.base_options = {} # : OptionDictType
-        self.cross_files = self.__load_config_files(options, scratch_dir, 'cross')
-        self.compilers = PerMachine(OrderedDict(), OrderedDict())
-
-        build_cache = DependencyCache(self.builtins_per_machine, MachineChoice.BUILD)
-        host_cache = DependencyCache(self.builtins_per_machine, MachineChoice.BUILD)
-        self.deps = PerMachine(build_cache, host_cache)  # type: PerMachine[DependencyCache]
-        self.compiler_check_cache = OrderedDict()
-        # Only to print a warning if it changes between Meson invocations.
-        self.config_files = self.__load_config_files(options, scratch_dir, 'native')
-        self.builtin_options_libdir_cross_fixup()
-        self.init_builtins('')
-
-    @staticmethod
-    def __load_config_files(options: argparse.Namespace, scratch_dir: str, ftype: str) -> T.List[str]:
-        # Need to try and make the passed filenames absolute because when the
-        # files are parsed later we'll have chdir()d.
-        if ftype == 'cross':
-            filenames = options.cross_file
-        else:
-            filenames = options.native_file
-
-        if not filenames:
-            return []
-
-        found_invalid = []  # type: T.List[str]
-        missing = []        # type: T.List[str]
-        real = []           # type: T.List[str]
-        for i, f in enumerate(filenames):
-            f = os.path.expanduser(os.path.expandvars(f))
-            if os.path.exists(f):
-                if os.path.isfile(f):
-                    real.append(os.path.abspath(f))
-                    continue
-                elif os.path.isdir(f):
-                    found_invalid.append(os.path.abspath(f))
-                else:
-                    # in this case we've been passed some kind of pipe, copy
-                    # the contents of that file into the meson private (scratch)
-                    # directory so that it can be re-read when wiping/reconfiguring
-                    copy = os.path.join(scratch_dir, '{}.{}.ini'.format(uuid.uuid4(), ftype))
-                    with open(f, 'r') as rf:
-                        with open(copy, 'w') as wf:
-                            wf.write(rf.read())
-                    real.append(copy)
-
-                    # Also replace the command line argument, as the pipe
-                    # probably won't exist on reconfigure
-                    filenames[i] = copy
-                    continue
-            if sys.platform != 'win32':
-                paths = [
-                    os.environ.get('XDG_DATA_HOME', os.path.expanduser('~/.local/share')),
-                ] + os.environ.get('XDG_DATA_DIRS', '/usr/local/share:/usr/share').split(':')
-                for path in paths:
-                    path_to_try = os.path.join(path, 'meson', ftype, f)
-                    if os.path.isfile(path_to_try):
-                        real.append(path_to_try)
-                        break
-                else:
-                    missing.append(f)
-            else:
-                missing.append(f)
-
-        if missing:
-            if found_invalid:
-                mlog.log('Found invalid candidates for', ftype, 'file:', *found_invalid)
-            mlog.log('Could not find any valid candidate for', ftype, 'files:', *missing)
-            raise MesonException('Cannot find specified {} file: {}'.format(ftype, f))
-        return real
-
-    def builtin_options_libdir_cross_fixup(self):
-        # By default set libdir to "lib" when cross compiling since
-        # getting the "system default" is always wrong on multiarch
-        # platforms as it gets a value like lib/x86_64-linux-gnu.
-        if self.cross_files:
-            builtin_options['libdir'].default = 'lib'
-
-    def sanitize_prefix(self, prefix):
-        prefix = os.path.expanduser(prefix)
-        if not os.path.isabs(prefix):
-            raise MesonException('prefix value {!r} must be an absolute path'
-                                 ''.format(prefix))
-        if prefix.endswith('/') or prefix.endswith('\\'):
-            # On Windows we need to preserve the trailing slash if the
-            # string is of type 'C:\' because 'C:' is not an absolute path.
-            if len(prefix) == 3 and prefix[1] == ':':
-                pass
-            # If prefix is a single character, preserve it since it is
-            # the root directory.
-            elif len(prefix) == 1:
-                pass
-            else:
-                prefix = prefix[:-1]
-        return prefix
-
-    def sanitize_dir_option_value(self, prefix: str, option: str, value: T.Any) -> T.Any:
-        '''
-        If the option is an installation directory option and the value is an
-        absolute path, check that it resides within prefix and return the value
-        as a path relative to the prefix.
-
-        This way everyone can do f.ex, get_option('libdir') and be sure to get
-        the library directory relative to prefix.
-
-        .as_posix() keeps the posix-like file seperators Meson uses.
-        '''
-        try:
-            value = PurePath(value)
-        except TypeError:
-            return value
-        if option.endswith('dir') and value.is_absolute() and \
-           option not in builtin_dir_noprefix_options:
-            # Value must be a subdir of the prefix
-            # commonpath will always return a path in the native format, so we
-            # must use pathlib.PurePath to do the same conversion before
-            # comparing.
-            msg = ('The value of the {!r} option is \'{!s}\' which must be a '
-                   'subdir of the prefix {!r}.\nNote that if you pass a '
-                   'relative path, it is assumed to be a subdir of prefix.')
-            # os.path.commonpath doesn't understand case-insensitive filesystems,
-            # but PurePath().relative_to() does.
-            try:
-                value = value.relative_to(prefix)
-            except ValueError:
-                raise MesonException(msg.format(option, value, prefix))
-            if '..' in str(value):
-                raise MesonException(msg.format(option, value, prefix))
-        return value.as_posix()
-
-    def init_builtins(self, subproject: str):
-        # Create builtin options with default values
-        for key, opt in builtin_options.items():
-            self.add_builtin_option(self.builtins, key, opt, subproject)
-        for for_machine in iter(MachineChoice):
-            for key, opt in builtin_options_per_machine.items():
-                self.add_builtin_option(self.builtins_per_machine[for_machine], key, opt, subproject)
-
-    def add_builtin_option(self, opts_map, key, opt, subproject):
-        if subproject:
-            if opt.yielding:
-                # This option is global and not per-subproject
-                return
-            optname = subproject + ':' + key
-            value = opts_map[key].value
-        else:
-            optname = key
-            value = None
-        opts_map[optname] = opt.init_option(key, value, default_prefix())
-
-    def init_backend_options(self, backend_name):
-        if backend_name == 'ninja':
-            self.backend_options['backend_max_links'] = \
-                UserIntegerOption(
-                    'Maximum number of linker processes to run or 0 for no '
-                    'limit',
-                    (0, None, 0))
-        elif backend_name.startswith('vs'):
-            self.backend_options['backend_startup_project'] = \
-                UserStringOption(
-                    'Default project to execute in Visual Studio',
-                    '')
-
-    def get_builtin_option(self, optname, subproject=''):
-        raw_optname = optname
-        if subproject:
-            optname = subproject + ':' + optname
-        for opts in self._get_all_builtin_options():
-            v = opts.get(optname)
-            if v is None or v.yielding:
-                v = opts.get(raw_optname)
-            if v is None:
-                continue
-            if raw_optname == 'wrap_mode':
-                return WrapMode.from_string(v.value)
-            return v.value
-        raise RuntimeError('Tried to get unknown builtin option %s.' % raw_optname)
-
-    def _try_set_builtin_option(self, optname, value):
-        for opts in self._get_all_builtin_options():
-            opt = opts.get(optname)
-            if opt is None:
-                continue
-            if optname == 'prefix':
-                value = self.sanitize_prefix(value)
-            else:
-                prefix = self.builtins['prefix'].value
-                value = self.sanitize_dir_option_value(prefix, optname, value)
-            break
-        else:
-            return False
-        opt.set_value(value)
-        # Make sure that buildtype matches other settings.
-        if optname == 'buildtype':
-            self.set_others_from_buildtype(value)
-        else:
-            self.set_buildtype_from_others()
-        return True
-
-    def set_builtin_option(self, optname, value):
-        res = self._try_set_builtin_option(optname, value)
-        if not res:
-            raise RuntimeError('Tried to set unknown builtin option %s.' % optname)
-
-    def set_others_from_buildtype(self, value):
-        if value == 'plain':
-            opt = '0'
-            debug = False
-        elif value == 'debug':
-            opt = '0'
-            debug = True
-        elif value == 'debugoptimized':
-            opt = '2'
-            debug = True
-        elif value == 'release':
-            opt = '3'
-            debug = False
-        elif value == 'minsize':
-            opt = 's'
-            debug = True
-        else:
-            assert(value == 'custom')
-            return
-        self.builtins['optimization'].set_value(opt)
-        self.builtins['debug'].set_value(debug)
-
-    def set_buildtype_from_others(self):
-        opt = self.builtins['optimization'].value
-        debug = self.builtins['debug'].value
-        if opt == '0' and not debug:
-            mode = 'plain'
-        elif opt == '0' and debug:
-            mode = 'debug'
-        elif opt == '2' and debug:
-            mode = 'debugoptimized'
-        elif opt == '3' and not debug:
-            mode = 'release'
-        elif opt == 's' and debug:
-            mode = 'minsize'
-        else:
-            mode = 'custom'
-        self.builtins['buildtype'].set_value(mode)
-
-    @classmethod
-    def get_prefixed_options_per_machine(
-        cls,
-        options_per_machine # : PerMachine[T.Dict[str, _V]]]
-    ) -> T.Iterable[T.Tuple[str, _V]]:
-        return cls._flatten_pair_iterator(
-            (for_machine.get_prefix(), options_per_machine[for_machine])
-            for for_machine in iter(MachineChoice)
-        )
-
-    @classmethod
-    def flatten_lang_iterator(
-        cls,
-        outer # : T.Iterable[T.Tuple[str, T.Dict[str, _V]]]
-    ) -> T.Iterable[T.Tuple[str, _V]]:
-        return cls._flatten_pair_iterator((lang + '_', opts) for lang, opts in outer)
-
-    @staticmethod
-    def _flatten_pair_iterator(
-        outer # : T.Iterable[T.Tuple[str, T.Dict[str, _V]]]
-    ) -> T.Iterable[T.Tuple[str, _V]]:
-        for k0, v0 in outer:
-            for k1, v1 in v0.items():
-                yield (k0 + k1, v1)
-
-    def _get_all_nonbuiltin_options(self) -> T.Iterable[T.Dict[str, UserOption]]:
-        yield self.backend_options
-        yield self.user_options
-        yield dict(self.flatten_lang_iterator(self.get_prefixed_options_per_machine(self.compiler_options)))
-        yield self.base_options
-
-    def _get_all_builtin_options(self) -> T.Iterable[T.Dict[str, UserOption]]:
-        yield dict(self.get_prefixed_options_per_machine(self.builtins_per_machine))
-        yield self.builtins
-
-    def get_all_options(self) -> T.Iterable[T.Dict[str, UserOption]]:
-        yield from self._get_all_nonbuiltin_options()
-        yield from self._get_all_builtin_options()
-
-    def validate_option_value(self, option_name, override_value):
-        for opts in self.get_all_options():
-            opt = opts.get(option_name)
-            if opt is not None:
-                try:
-                    return opt.validate_value(override_value)
-                except MesonException as e:
-                    raise type(e)(('Validation failed for option %s: ' % option_name) + str(e)) \
-                        .with_traceback(sys.exc_info()[2])
-        raise MesonException('Tried to validate unknown option %s.' % option_name)
-
-    def get_external_args(self, for_machine: MachineChoice, lang):
-        return self.compiler_options[for_machine][lang]['args'].value
-
-    def get_external_link_args(self, for_machine: MachineChoice, lang):
-        return self.compiler_options[for_machine][lang]['link_args'].value
-
-    def merge_user_options(self, options):
-        for (name, value) in options.items():
-            if name not in self.user_options:
-                self.user_options[name] = value
-            else:
-                oldval = self.user_options[name]
-                if type(oldval) != type(value):
-                    self.user_options[name] = value
-
-    def is_cross_build(self, when_building_for: MachineChoice = MachineChoice.HOST) -> bool:
-        if when_building_for == MachineChoice.BUILD:
-            return False
-        return len(self.cross_files) > 0
-
-    def strip_build_option_names(self, options):
-        res = OrderedDict()
-        for k, v in options.items():
-            if k.startswith('build.'):
-                k = k.split('.', 1)[1]
-            res[k] = v
-        return res
-
-    def copy_build_options_from_regular_ones(self):
-        assert(not self.is_cross_build())
-        for k, o in self.builtins_per_machine.host.items():
-            self.builtins_per_machine.build[k].set_value(o.value)
-        for lang, host_opts in self.compiler_options.host.items():
-            build_opts = self.compiler_options.build[lang]
-            for k, o in host_opts.items():
-                if k in build_opts:
-                    build_opts[k].set_value(o.value)
-
-    def set_options(self, options, *, subproject='', warn_unknown=True):
-        if not self.is_cross_build():
-            options = self.strip_build_option_names(options)
-        # Set prefix first because it's needed to sanitize other options
-        if 'prefix' in options:
-            prefix = self.sanitize_prefix(options['prefix'])
-            self.builtins['prefix'].set_value(prefix)
-            for key in builtin_dir_noprefix_options:
-                if key not in options:
-                    self.builtins[key].set_value(builtin_options[key].prefixed_default(key, prefix))
-
-        unknown_options = []
-        for k, v in options.items():
-            if k == 'prefix':
-                continue
-            if self._try_set_builtin_option(k, v):
-                continue
-            for opts in self._get_all_nonbuiltin_options():
-                tgt = opts.get(k)
-                if tgt is None:
-                    continue
-                tgt.set_value(v)
-                break
-            else:
-                unknown_options.append(k)
-        if unknown_options and warn_unknown:
-            unknown_options = ', '.join(sorted(unknown_options))
-            sub = 'In subproject {}: '.format(subproject) if subproject else ''
-            mlog.warning('{}Unknown options: "{}"'.format(sub, unknown_options))
-            mlog.log('The value of new options can be set with:')
-            mlog.log(mlog.bold('meson setup <builddir> --reconfigure -Dnew_option=new_value ...'))
-        if not self.is_cross_build():
-            self.copy_build_options_from_regular_ones()
-
-    def set_default_options(self, default_options, subproject, env):
-        # Warn if the user is using two different ways of setting build-type
-        # options that override each other
-        if 'buildtype' in env.cmd_line_options and \
-           ('optimization' in env.cmd_line_options or 'debug' in env.cmd_line_options):
-            mlog.warning('Recommend using either -Dbuildtype or -Doptimization + -Ddebug. '
-                         'Using both is redundant since they override each other. '
-                         'See: https://mesonbuild.com/Builtin-options.html#build-type-options')
-        cmd_line_options = OrderedDict()
-        # Set project default_options as if they were passed to the cmdline.
-        # Subprojects can only define default for user options and not yielding
-        # builtin option.
-        from . import optinterpreter
-        for k, v in default_options.items():
-            if subproject:
-                if (k not in builtin_options or builtin_options[k].yielding) \
-                        and optinterpreter.is_invalid_name(k, log=False):
-                    continue
-                k = subproject + ':' + k
-            cmd_line_options[k] = v
-
-        # Override project default_options using conf files (cross or native)
-        for k, v in env.paths.host:
-            if v is not None:
-                cmd_line_options[k] = v
-
-        # Override all the above defaults using the command-line arguments
-        # actually passed to us
-        cmd_line_options.update(env.cmd_line_options)
-        env.cmd_line_options = cmd_line_options
-
-        # Create a subset of cmd_line_options, keeping only options for this
-        # subproject. Also take builtin options if it's the main project.
-        # Language and backend specific options will be set later when adding
-        # languages and setting the backend (builtin options must be set first
-        # to know which backend we'll use).
-        options = OrderedDict()
-
-        # Some options default to environment variables if they are
-        # unset, set those now. These will either be overwritten
-        # below, or they won't. These should only be set on the first run.
-        for for_machine in MachineChoice:
-            p_env_pair = get_env_var_pair(for_machine, self.is_cross_build(), 'PKG_CONFIG_PATH')
-            if p_env_pair is not None:
-                p_env_var, p_env = p_env_pair
-
-                # PKG_CONFIG_PATH may contain duplicates, which must be
-                # removed, else a duplicates-in-array-option warning arises.
-                p_list = list(OrderedSet(p_env.split(':')))
-
-                key = 'pkg_config_path'
-                if for_machine == MachineChoice.BUILD:
-                    key = 'build.' + key
-
-                if env.first_invocation:
-                    options[key] = p_list
-                elif options.get(key, []) != p_list:
-                    mlog.warning(
-                        p_env_var +
-                        ' environment variable has changed '
-                        'between configurations, meson ignores this. '
-                        'Use -Dpkg_config_path to change pkg-config search '
-                        'path instead.'
-                    )
-
-        def remove_prefix(text, prefix):
-            if text.startswith(prefix):
-                return text[len(prefix):]
-            return text
-
-        for k, v in env.cmd_line_options.items():
-            if subproject:
-                if not k.startswith(subproject + ':'):
-                    continue
-            elif k not in builtin_options.keys() \
-                    and remove_prefix(k, 'build.') not in builtin_options_per_machine.keys():
-                if ':' in k:
-                    continue
-                if optinterpreter.is_invalid_name(k, log=False):
-                    continue
-            options[k] = v
-
-        self.set_options(options, subproject=subproject)
-
-    def add_lang_args(self, lang: str, comp: T.Type['Compiler'],
-                      for_machine: MachineChoice, env: 'Environment') -> None:
-        """Add global language arguments that are needed before compiler/linker detection."""
-        from .compilers import compilers
-
-        for k, o in compilers.get_global_options(
-                lang,
-                comp,
-                for_machine,
-                env.is_cross_build(),
-                env.properties[for_machine]).items():
-            # prefixed compiler options affect just this machine
-            opt_prefix = for_machine.get_prefix()
-            user_k = opt_prefix + lang + '_' + k
-            if user_k in env.cmd_line_options:
-                o.set_value(env.cmd_line_options[user_k])
-            self.compiler_options[for_machine][lang].setdefault(k, o)
-
-    def process_new_compiler(self, lang: str, comp: T.Type['Compiler'], env: 'Environment') -> None:
-        from . import compilers
-
-        self.compilers[comp.for_machine][lang] = comp
-        enabled_opts = []
-
-        for k, o in comp.get_options().items():
-            # prefixed compiler options affect just this machine
-            opt_prefix = comp.for_machine.get_prefix()
-            user_k = opt_prefix + lang + '_' + k
-            if user_k in env.cmd_line_options:
-                o.set_value(env.cmd_line_options[user_k])
-            self.compiler_options[comp.for_machine][lang].setdefault(k, o)
-
-        enabled_opts = []
-        for optname in comp.base_options:
-            if optname in self.base_options:
-                continue
-            oobj = compilers.base_options[optname]
-            if optname in env.cmd_line_options:
-                oobj.set_value(env.cmd_line_options[optname])
-                enabled_opts.append(optname)
-            self.base_options[optname] = oobj
-        self.emit_base_options_warnings(enabled_opts)
-
-    def emit_base_options_warnings(self, enabled_opts: list):
-        if 'b_bitcode' in enabled_opts:
-            mlog.warning('Base option \'b_bitcode\' is enabled, which is incompatible with many linker options. Incompatible options such as \'b_asneeded\' have been disabled.', fatal=False)
-            mlog.warning('Please see https://mesonbuild.com/Builtin-options.html#Notes_about_Apple_Bitcode_support for more details.', fatal=False)
-
-class CmdLineFileParser(configparser.ConfigParser):
-    def __init__(self):
-        # We don't want ':' as key delimiter, otherwise it would break when
-        # storing subproject options like "subproject:option=value"
-        super().__init__(delimiters=['='], interpolation=None)
-
-class MachineFileParser():
-    def __init__(self, filenames: T.List[str]):
-        self.parser = CmdLineFileParser()
-        self.constants = {'True': True, 'False': False}
-        self.sections = {}
-
-        self.parser.read(filenames)
-
-        # Parse [constants] first so they can be used in other sections
-        if self.parser.has_section('constants'):
-            self.constants.update(self._parse_section('constants'))
-
-        for s in self.parser.sections():
-            if s == 'constants':
-                continue
-            self.sections[s] = self._parse_section(s)
-
-    def _parse_section(self, s):
-        self.scope = self.constants.copy()
-        section = {}
-        for entry, value in self.parser.items(s):
-            if ' ' in entry or '\t' in entry or "'" in entry or '"' in entry:
-                raise EnvironmentException('Malformed variable name {!r} in machine file.'.format(entry))
-            # Windows paths...
-            value = value.replace('\\', '\\\\')
-            try:
-                ast = mparser.Parser(value, 'machinefile').parse()
-                res = self._evaluate_statement(ast.lines[0])
-            except MesonException:
-                raise EnvironmentException('Malformed value in machine file variable {!r}.'.format(entry))
-            except KeyError as e:
-                raise EnvironmentException('Undefined constant {!r} in machine file variable {!r}.'.format(e.args[0], entry))
-            section[entry] = res
-            self.scope[entry] = res
-        return section
-
-    def _evaluate_statement(self, node):
-        if isinstance(node, (mparser.StringNode)):
-            return node.value
-        elif isinstance(node, mparser.BooleanNode):
-            return node.value
-        elif isinstance(node, mparser.NumberNode):
-            return node.value
-        elif isinstance(node, mparser.ArrayNode):
-            return [self._evaluate_statement(arg) for arg in node.args.arguments]
-        elif isinstance(node, mparser.IdNode):
-            return self.scope[node.value]
-        elif isinstance(node, mparser.ArithmeticNode):
-            l = self._evaluate_statement(node.left)
-            r = self._evaluate_statement(node.right)
-            if node.operation == 'add':
-                if (isinstance(l, str) and isinstance(r, str)) or \
-                   (isinstance(l, list) and isinstance(r, list)):
-                    return l + r
-            elif node.operation == 'div':
-                if isinstance(l, str) and isinstance(r, str):
-                    return os.path.join(l, r)
-        raise EnvironmentException('Unsupported node type')
-
-def parse_machine_files(filenames):
-    parser = MachineFileParser(filenames)
-    return parser.sections
-
-def get_cmd_line_file(build_dir):
-    return os.path.join(build_dir, 'meson-private', 'cmd_line.txt')
-
-def read_cmd_line_file(build_dir, options):
-    filename = get_cmd_line_file(build_dir)
-    if not os.path.isfile(filename):
-        return
-
-    config = CmdLineFileParser()
-    config.read(filename)
-
-    # Do a copy because config is not really a dict. options.cmd_line_options
-    # overrides values from the file.
-    d = dict(config['options'])
-    d.update(options.cmd_line_options)
-    options.cmd_line_options = d
-
-    properties = config['properties']
-    if not options.cross_file:
-        options.cross_file = ast.literal_eval(properties.get('cross_file', '[]'))
-    if not options.native_file:
-        # This will be a string in the form: "['first', 'second', ...]", use
-        # literal_eval to get it into the list of strings.
-        options.native_file = ast.literal_eval(properties.get('native_file', '[]'))
-
-def cmd_line_options_to_string(options):
-    return {k: str(v) for k, v in options.cmd_line_options.items()}
-
-def write_cmd_line_file(build_dir, options):
-    filename = get_cmd_line_file(build_dir)
-    config = CmdLineFileParser()
-
-    properties = OrderedDict()
-    if options.cross_file:
-        properties['cross_file'] = options.cross_file
-    if options.native_file:
-        properties['native_file'] = options.native_file
-
-    config['options'] = cmd_line_options_to_string(options)
-    config['properties'] = properties
-    with open(filename, 'w') as f:
-        config.write(f)
-
-def update_cmd_line_file(build_dir, options):
-    filename = get_cmd_line_file(build_dir)
-    config = CmdLineFileParser()
-    config.read(filename)
-    config['options'].update(cmd_line_options_to_string(options))
-    with open(filename, 'w') as f:
-        config.write(f)
-
-def get_cmd_line_options(build_dir, options):
-    copy = argparse.Namespace(**vars(options))
-    read_cmd_line_file(build_dir, copy)
-    cmdline = ['-D{}={}'.format(k, v) for k, v in copy.cmd_line_options.items()]
-    if options.cross_file:
-        cmdline += ['--cross-file {}'.format(f) for f in options.cross_file]
-    if options.native_file:
-        cmdline += ['--native-file {}'.format(f) for f in options.native_file]
-    return ' '.join([shlex.quote(x) for x in cmdline])
-
-def major_versions_differ(v1, v2):
-    return v1.split('.')[0:2] != v2.split('.')[0:2]
-
-def load(build_dir):
-    filename = os.path.join(build_dir, 'meson-private', 'coredata.dat')
-    load_fail_msg = 'Coredata file {!r} is corrupted. Try with a fresh build tree.'.format(filename)
-    try:
-        with open(filename, 'rb') as f:
-            obj = pickle.load(f)
-    except (pickle.UnpicklingError, EOFError):
-        raise MesonException(load_fail_msg)
-    except AttributeError:
-        raise MesonException(
-            "Coredata file {!r} references functions or classes that don't "
-            "exist. This probably means that it was generated with an old "
-            "version of meson.".format(filename))
-    if not isinstance(obj, CoreData):
-        raise MesonException(load_fail_msg)
-    if major_versions_differ(obj.version, version):
-        raise MesonVersionMismatchException(obj.version, version)
-    return obj
-
-def save(obj, build_dir):
-    filename = os.path.join(build_dir, 'meson-private', 'coredata.dat')
-    prev_filename = filename + '.prev'
-    tempfilename = filename + '~'
-    if major_versions_differ(obj.version, version):
-        raise MesonException('Fatal version mismatch corruption.')
-    if os.path.exists(filename):
-        import shutil
-        shutil.copyfile(filename, prev_filename)
-    with open(tempfilename, 'wb') as f:
-        pickle.dump(obj, f)
-        f.flush()
-        os.fsync(f.fileno())
-    os.replace(tempfilename, filename)
-    return filename
-
-
-def register_builtin_arguments(parser):
-    for n, b in builtin_options.items():
-        b.add_to_argparse(n, parser, '', '')
-    for n, b in builtin_options_per_machine.items():
-        b.add_to_argparse(n, parser, '', ' (just for host machine)')
-        b.add_to_argparse(n, parser, 'build.', ' (just for build machine)')
-    parser.add_argument('-D', action='append', dest='projectoptions', default=[], metavar="option",
-                        help='Set the value of an option, can be used several times to set multiple options.')
-
-def create_options_dict(options):
-    result = OrderedDict()
-    for o in options:
-        try:
-            (key, value) = o.split('=', 1)
-        except ValueError:
-            raise MesonException('Option {!r} must have a value separated by equals sign.'.format(o))
-        result[key] = value
-    return result
-
-def parse_cmd_line_options(args):
-    args.cmd_line_options = create_options_dict(args.projectoptions)
-
-    # Merge builtin options set with --option into the dict.
-    for name in chain(
-            builtin_options.keys(),
-            ('build.' + k for k in builtin_options_per_machine.keys()),
-            builtin_options_per_machine.keys(),
-    ):
-        value = getattr(args, name, None)
-        if value is not None:
-            if name in args.cmd_line_options:
-                cmdline_name = BuiltinOption.argparse_name_to_arg(name)
-                raise MesonException(
-                    'Got argument {0} as both -D{0} and {1}. Pick one.'.format(name, cmdline_name))
-            args.cmd_line_options[name] = value
-            delattr(args, name)
-
-
-_U = T.TypeVar('_U', bound=UserOption[_T])
-
-class BuiltinOption(T.Generic[_T, _U]):
-
-    """Class for a builtin option type.
-
-    There are some cases that are not fully supported yet.
-    """
-
-    def __init__(self, opt_type: T.Type[_U], description: str, default: T.Any, yielding: bool = True, *,
-                 choices: T.Any = None):
-        self.opt_type = opt_type
-        self.description = description
-        self.default = default
-        self.choices = choices
-        self.yielding = yielding
-
-    def init_option(self, name: str, value: T.Optional[T.Any], prefix: str) -> _U:
-        """Create an instance of opt_type and return it."""
-        if value is None:
-            value = self.prefixed_default(name, prefix)
-        keywords = {'yielding': self.yielding, 'value': value}
-        if self.choices:
-            keywords['choices'] = self.choices
-        return self.opt_type(self.description, **keywords)
-
-    def _argparse_action(self) -> T.Optional[str]:
-        # If the type is a boolean, the presence of the argument in --foo form
-        # is to enable it. Disabling happens by using -Dfoo=false, which is
-        # parsed under `args.projectoptions` and does not hit this codepath.
-        if isinstance(self.default, bool):
-            return 'store_true'
-        return None
-
-    def _argparse_choices(self) -> T.Any:
-        if self.opt_type is UserBooleanOption:
-            return [True, False]
-        elif self.opt_type is UserFeatureOption:
-            return UserFeatureOption.static_choices
-        return self.choices
-
-    @staticmethod
-    def argparse_name_to_arg(name: str) -> str:
-        if name == 'warning_level':
-            return '--warnlevel'
-        else:
-            return '--' + name.replace('_', '-')
-
-    def prefixed_default(self, name: str, prefix: str = '') -> T.Any:
-        if self.opt_type in [UserComboOption, UserIntegerOption]:
-            return self.default
-        try:
-            return builtin_dir_noprefix_options[name][prefix]
-        except KeyError:
-            pass
-        return self.default
-
-    def add_to_argparse(self, name: str, parser: argparse.ArgumentParser, prefix: str, help_suffix: str) -> None:
-        kwargs = OrderedDict()
-
-        c = self._argparse_choices()
-        b = self._argparse_action()
-        h = self.description
-        if not b:
-            h = '{} (default: {}).'.format(h.rstrip('.'), self.prefixed_default(name))
-        else:
-            kwargs['action'] = b
-        if c and not b:
-            kwargs['choices'] = c
-        kwargs['default'] = argparse.SUPPRESS
-        kwargs['dest'] = prefix + name
-
-        cmdline_name = self.argparse_name_to_arg(prefix + name)
-        parser.add_argument(cmdline_name, help=h + help_suffix, **kwargs)
-
-# Update `docs/markdown/Builtin-options.md` after changing the options below
-builtin_options = OrderedDict([
-    # Directories
-    ('prefix',     BuiltinOption(UserStringOption, 'Installation prefix', default_prefix())),
-    ('bindir',     BuiltinOption(UserStringOption, 'Executable directory', 'bin')),
-    ('datadir',    BuiltinOption(UserStringOption, 'Data file directory', 'share')),
-    ('includedir', BuiltinOption(UserStringOption, 'Header file directory', 'include')),
-    ('infodir',    BuiltinOption(UserStringOption, 'Info page directory', 'share/info')),
-    ('libdir',     BuiltinOption(UserStringOption, 'Library directory', default_libdir())),
-    ('libexecdir', BuiltinOption(UserStringOption, 'Library executable directory', default_libexecdir())),
-    ('localedir',  BuiltinOption(UserStringOption, 'Locale data directory', 'share/locale')),
-    ('localstatedir',   BuiltinOption(UserStringOption, 'Localstate data directory', 'var')),
-    ('mandir',          BuiltinOption(UserStringOption, 'Manual page directory', 'share/man')),
-    ('sbindir',         BuiltinOption(UserStringOption, 'System executable directory', 'sbin')),
-    ('sharedstatedir',  BuiltinOption(UserStringOption, 'Architecture-independent data directory', 'com')),
-    ('sysconfdir',      BuiltinOption(UserStringOption, 'Sysconf data directory', 'etc')),
-    # Core options
-    ('auto_features',   BuiltinOption(UserFeatureOption, "Override value of all 'auto' features", 'auto')),
-    ('backend',         BuiltinOption(UserComboOption, 'Backend to use', 'ninja', choices=backendlist)),
-    ('buildtype',       BuiltinOption(UserComboOption, 'Build type to use', 'debug',
-                                      choices=['plain', 'debug', 'debugoptimized', 'release', 'minsize', 'custom'])),
-    ('debug',           BuiltinOption(UserBooleanOption, 'Debug', True)),
-    ('default_library', BuiltinOption(UserComboOption, 'Default library type', 'shared', choices=['shared', 'static', 'both'],
-                                      yielding=False)),
-    ('errorlogs',       BuiltinOption(UserBooleanOption, "Whether to print the logs from failing tests", True)),
-    ('install_umask',   BuiltinOption(UserUmaskOption, 'Default umask to apply on permissions of installed files', '022')),
-    ('layout',          BuiltinOption(UserComboOption, 'Build directory layout', 'mirror', choices=['mirror', 'flat'])),
-    ('optimization',    BuiltinOption(UserComboOption, 'Optimization level', '0', choices=['0', 'g', '1', '2', '3', 's'])),
-    ('stdsplit',        BuiltinOption(UserBooleanOption, 'Split stdout and stderr in test logs', True)),
-    ('strip',           BuiltinOption(UserBooleanOption, 'Strip targets on install', False)),
-    ('unity',           BuiltinOption(UserComboOption, 'Unity build', 'off', choices=['on', 'off', 'subprojects'])),
-    ('unity_size',      BuiltinOption(UserIntegerOption, 'Unity block size', (2, None, 4))),
-    ('warning_level',   BuiltinOption(UserComboOption, 'Compiler warning level to use', '1', choices=['0', '1', '2', '3'])),
-    ('werror',          BuiltinOption(UserBooleanOption, 'Treat warnings as errors', False, yielding=False)),
-    ('wrap_mode',       BuiltinOption(UserComboOption, 'Wrap mode', 'default', choices=['default', 'nofallback', 'nodownload', 'forcefallback'])),
-    ('force_fallback_for', BuiltinOption(UserArrayOption, 'Force fallback for those subprojects', [])),
-])
-
-builtin_options_per_machine = OrderedDict([
-    ('pkg_config_path', BuiltinOption(UserArrayOption, 'List of additional paths for pkg-config to search', [])),
-    ('cmake_prefix_path', BuiltinOption(UserArrayOption, 'List of additional prefixes for cmake to search', [])),
-])
-
-# Special prefix-dependent defaults for installation directories that reside in
-# a path outside of the prefix in FHS and common usage.
-builtin_dir_noprefix_options = {
-    'sysconfdir':     {'/usr': '/etc'},
-    'localstatedir':  {'/usr': '/var',     '/usr/local': '/var/local'},
-    'sharedstatedir': {'/usr': '/var/lib', '/usr/local': '/var/local/lib'},
-}
-
-forbidden_target_names = {'clean': None,
-                          'clean-ctlist': None,
-                          'clean-gcno': None,
-                          'clean-gcda': None,
-                          'coverage': None,
-                          'coverage-text': None,
-                          'coverage-xml': None,
-                          'coverage-html': None,
-                          'phony': None,
-                          'PHONY': None,
-                          'all': None,
-                          'test': None,
-                          'benchmark': None,
-                          'install': None,
-                          'uninstall': None,
-                          'build.ninja': None,
-                          'scan-build': None,
-                          'reconfigure': None,
-                          'dist': None,
-                          'distcheck': None,
-                          }
diff --git a/meson/mesonbuild/dependencies/__init__.py b/meson/mesonbuild/dependencies/__init__.py
deleted file mode 100644 (file)
index d75d226..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .boost import BoostDependency
-from .cuda import CudaDependency
-from .hdf5 import HDF5Dependency
-from .base import (  # noqa: F401
-    Dependency, DependencyException, DependencyMethods, ExternalProgram, EmptyExternalProgram, NonExistingExternalProgram,
-    ExternalDependency, NotFoundDependency, ExternalLibrary, ExtraFrameworkDependency, InternalDependency,
-    PkgConfigDependency, CMakeDependency, find_external_dependency, get_dep_identifier, packages, _packages_accept_language,
-    DependencyFactory)
-from .dev import ValgrindDependency, gmock_factory, gtest_factory, llvm_factory, zlib_factory
-from .coarrays import coarray_factory
-from .mpi import mpi_factory
-from .scalapack import scalapack_factory
-from .misc import (
-    BlocksDependency, OpenMPDependency, cups_factory, curses_factory, gpgme_factory,
-    libgcrypt_factory, libwmf_factory, netcdf_factory, pcap_factory, python3_factory,
-    shaderc_factory, threads_factory,
-)
-from .platform import AppleFrameworks
-from .ui import GnuStepDependency, Qt4Dependency, Qt5Dependency, WxDependency, gl_factory, sdl2_factory, vulkan_factory
-
-
-# This is a dict where the keys should be strings, and the values must be one
-# of:
-# - An ExternalDependency subclass
-# - A DependencyFactory object
-# - A callable with a signature of (Environment, MachineChoice, Dict[str, Any]) -> List[Callable[[], DependencyType]]
-packages.update({
-    # From dev:
-    'gtest': gtest_factory,
-    'gmock': gmock_factory,
-    'llvm': llvm_factory,
-    'valgrind': ValgrindDependency,
-    'zlib': zlib_factory,
-
-    'boost': BoostDependency,
-    'cuda': CudaDependency,
-
-    # per-file
-    'coarray': coarray_factory,
-    'hdf5': HDF5Dependency,
-    'mpi': mpi_factory,
-    'scalapack': scalapack_factory,
-
-    # From misc:
-    'blocks': BlocksDependency,
-    'curses': curses_factory,
-    'netcdf': netcdf_factory,
-    'openmp': OpenMPDependency,
-    'python3': python3_factory,
-    'threads': threads_factory,
-    'pcap': pcap_factory,
-    'cups': cups_factory,
-    'libwmf': libwmf_factory,
-    'libgcrypt': libgcrypt_factory,
-    'gpgme': gpgme_factory,
-    'shaderc': shaderc_factory,
-
-    # From platform:
-    'appleframeworks': AppleFrameworks,
-
-    # From ui:
-    'gl': gl_factory,
-    'gnustep': GnuStepDependency,
-    'qt4': Qt4Dependency,
-    'qt5': Qt5Dependency,
-    'sdl2': sdl2_factory,
-    'wxwidgets': WxDependency,
-    'vulkan': vulkan_factory,
-})
-_packages_accept_language.update({
-    'hdf5',
-    'mpi',
-    'netcdf',
-    'openmp',
-})
diff --git a/meson/mesonbuild/dependencies/base.py b/meson/mesonbuild/dependencies/base.py
deleted file mode 100644 (file)
index 7e2bd0f..0000000
+++ /dev/null
@@ -1,2589 +0,0 @@
-# Copyright 2013-2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies.
-# Custom logic for several other packages are in separate files.
-import copy
-import functools
-import os
-import re
-import json
-import shlex
-import shutil
-import stat
-import sys
-import textwrap
-import platform
-import typing as T
-from enum import Enum
-from pathlib import Path, PurePath
-
-from .. import mlog
-from .. import mesonlib
-from ..compilers import clib_langs
-from ..envconfig import get_env_var
-from ..environment import BinaryTable, Environment, MachineInfo
-from ..cmake import CMakeExecutor, CMakeTraceParser, CMakeException
-from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine
-from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify, stringlistify, extract_as_list, split_args
-from ..mesonlib import Version, LibType
-from ..mesondata import mesondata
-
-if T.TYPE_CHECKING:
-    from ..compilers.compilers import CompilerType  # noqa: F401
-    DependencyType = T.TypeVar('DependencyType', bound='Dependency')
-
-# These must be defined in this file to avoid cyclical references.
-packages = {}
-_packages_accept_language = set()
-
-
-class DependencyException(MesonException):
-    '''Exceptions raised while trying to find dependencies'''
-
-
-class DependencyMethods(Enum):
-    # Auto means to use whatever dependency checking mechanisms in whatever order meson thinks is best.
-    AUTO = 'auto'
-    PKGCONFIG = 'pkg-config'
-    QMAKE = 'qmake'
-    CMAKE = 'cmake'
-    # Just specify the standard link arguments, assuming the operating system provides the library.
-    SYSTEM = 'system'
-    # This is only supported on OSX - search the frameworks directory by name.
-    EXTRAFRAMEWORK = 'extraframework'
-    # Detect using the sysconfig module.
-    SYSCONFIG = 'sysconfig'
-    # Specify using a "program"-config style tool
-    CONFIG_TOOL = 'config-tool'
-    # For backwards compatibility
-    SDLCONFIG = 'sdlconfig'
-    CUPSCONFIG = 'cups-config'
-    PCAPCONFIG = 'pcap-config'
-    LIBWMFCONFIG = 'libwmf-config'
-    # Misc
-    DUB = 'dub'
-
-
-def find_external_program(env: Environment, for_machine: MachineChoice, name: str,
-                          display_name: str, default_names: T.List[str],
-                          allow_default_for_cross: bool = True) -> T.Generator['ExternalProgram', None, None]:
-    """Find an external program, chcking the cross file plus any default options."""
-    # Lookup in cross or machine file.
-    potential_path = env.lookup_binary_entry(for_machine, name)
-    if potential_path is not None:
-        mlog.debug('{} binary for {} specified from cross file, native file, '
-                    'or env var as {}'.format(display_name, for_machine, potential_path))
-        yield ExternalProgram.from_entry(name, potential_path)
-        # We never fallback if the user-specified option is no good, so
-        # stop returning options.
-        return
-    mlog.debug('{} binary missing from cross or native file, or env var undefined.'.format(display_name))
-    # Fallback on hard-coded defaults, if a default binary is allowed for use
-    # with cross targets, or if this is not a cross target
-    if allow_default_for_cross or not (for_machine is MachineChoice.HOST and env.is_cross_build(for_machine)):
-        for potential_path in default_names:
-            mlog.debug('Trying a default {} fallback at'.format(display_name), potential_path)
-            yield ExternalProgram(potential_path, silent=True)
-    else:
-        mlog.debug('Default target is not allowed for cross use')
-
-
-class Dependency:
-
-    @classmethod
-    def _process_include_type_kw(cls, kwargs) -> str:
-        if 'include_type' not in kwargs:
-            return 'preserve'
-        if not isinstance(kwargs['include_type'], str):
-            raise DependencyException('The include_type kwarg must be a string type')
-        if kwargs['include_type'] not in ['preserve', 'system', 'non-system']:
-            raise DependencyException("include_type may only be one of ['preserve', 'system', 'non-system']")
-        return kwargs['include_type']
-
-    def __init__(self, type_name, kwargs):
-        self.name = "null"
-        self.version = None
-        self.language = None # None means C-like
-        self.is_found = False
-        self.type_name = type_name
-        self.compile_args = []
-        self.link_args = []
-        # Raw -L and -l arguments without manual library searching
-        # If None, self.link_args will be used
-        self.raw_link_args = None
-        self.sources = []
-        self.methods = process_method_kw(self.get_methods(), kwargs)
-        self.include_type = self._process_include_type_kw(kwargs)
-        self.ext_deps = []  # type: T.List[Dependency]
-
-    def __repr__(self):
-        s = '<{0} {1}: {2}>'
-        return s.format(self.__class__.__name__, self.name, self.is_found)
-
-    def get_compile_args(self):
-        if self.include_type == 'system':
-            converted = []
-            for i in self.compile_args:
-                if i.startswith('-I') or i.startswith('/I'):
-                    converted += ['-isystem' + i[2:]]
-                else:
-                    converted += [i]
-            return converted
-        if self.include_type == 'non-system':
-            converted = []
-            for i in self.compile_args:
-                if i.startswith('-isystem'):
-                    converted += ['-I' + i[8:]]
-                else:
-                    converted += [i]
-            return converted
-        return self.compile_args
-
-    def get_link_args(self, raw: bool = False) -> T.List[str]:
-        if raw and self.raw_link_args is not None:
-            return self.raw_link_args
-        return self.link_args
-
-    def found(self):
-        return self.is_found
-
-    def get_sources(self):
-        """Source files that need to be added to the target.
-        As an example, gtest-all.cc when using GTest."""
-        return self.sources
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.AUTO]
-
-    def get_name(self):
-        return self.name
-
-    def get_version(self):
-        if self.version:
-            return self.version
-        else:
-            return 'unknown'
-
-    def get_include_type(self) -> str:
-        return self.include_type
-
-    def get_exe_args(self, compiler):
-        return []
-
-    def get_pkgconfig_variable(self, variable_name, kwargs):
-        raise DependencyException('{!r} is not a pkgconfig dependency'.format(self.name))
-
-    def get_configtool_variable(self, variable_name):
-        raise DependencyException('{!r} is not a config-tool dependency'.format(self.name))
-
-    def get_partial_dependency(self, *, compile_args: bool = False,
-                               link_args: bool = False, links: bool = False,
-                               includes: bool = False, sources: bool = False):
-        """Create a new dependency that contains part of the parent dependency.
-
-        The following options can be inherited:
-            links -- all link_with arguments
-            includes -- all include_directory and -I/-isystem calls
-            sources -- any source, header, or generated sources
-            compile_args -- any compile args
-            link_args -- any link args
-
-        Additionally the new dependency will have the version parameter of it's
-        parent (if any) and the requested values of any dependencies will be
-        added as well.
-        """
-        raise RuntimeError('Unreachable code in partial_dependency called')
-
-    def _add_sub_dependency(self, deplist: T.List['DependencyType']) -> bool:
-        """Add an internal depdency from a list of possible dependencies.
-
-        This method is intended to make it easier to add additional
-        dependencies to another dependency internally.
-
-        Returns true if the dependency was successfully added, false
-        otherwise.
-        """
-        for d in deplist:
-            dep = d()
-            if dep.is_found:
-                self.ext_deps.append(dep)
-                return True
-        return False
-
-    def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None,
-                     configtool: T.Optional[str] = None, internal: T.Optional[str] = None,
-                     default_value: T.Optional[str] = None,
-                     pkgconfig_define: T.Optional[T.List[str]] = None) -> T.Union[str, T.List[str]]:
-        if default_value is not None:
-            return default_value
-        raise DependencyException('No default provided for dependency {!r}, which is not pkg-config, cmake, or config-tool based.'.format(self))
-
-    def generate_system_dependency(self, include_type: str) -> T.Type['Dependency']:
-        new_dep = copy.deepcopy(self)
-        new_dep.include_type = self._process_include_type_kw({'include_type': include_type})
-        return new_dep
-
-class InternalDependency(Dependency):
-    def __init__(self, version, incdirs, compile_args, link_args, libraries,
-                 whole_libraries, sources, ext_deps, variables: T.Dict[str, T.Any]):
-        super().__init__('internal', {})
-        self.version = version
-        self.is_found = True
-        self.include_directories = incdirs
-        self.compile_args = compile_args
-        self.link_args = link_args
-        self.libraries = libraries
-        self.whole_libraries = whole_libraries
-        self.sources = sources
-        self.ext_deps = ext_deps
-        self.variables = variables
-
-    def __deepcopy__(self, memo: dict) -> 'InternalDependency':
-        result = self.__class__.__new__(self.__class__)
-        memo[id(self)] = result
-        for k, v in self.__dict__.items():
-            if k in ['libraries', 'whole_libraries']:
-                setattr(result, k, copy.copy(v))
-            else:
-                setattr(result, k, copy.deepcopy(v, memo))
-        return result
-
-    def get_pkgconfig_variable(self, variable_name, kwargs):
-        raise DependencyException('Method "get_pkgconfig_variable()" is '
-                                  'invalid for an internal dependency')
-
-    def get_configtool_variable(self, variable_name):
-        raise DependencyException('Method "get_configtool_variable()" is '
-                                  'invalid for an internal dependency')
-
-    def get_partial_dependency(self, *, compile_args: bool = False,
-                               link_args: bool = False, links: bool = False,
-                               includes: bool = False, sources: bool = False):
-        final_compile_args = self.compile_args.copy() if compile_args else []
-        final_link_args = self.link_args.copy() if link_args else []
-        final_libraries = self.libraries.copy() if links else []
-        final_whole_libraries = self.whole_libraries.copy() if links else []
-        final_sources = self.sources.copy() if sources else []
-        final_includes = self.include_directories.copy() if includes else []
-        final_deps = [d.get_partial_dependency(
-            compile_args=compile_args, link_args=link_args, links=links,
-            includes=includes, sources=sources) for d in self.ext_deps]
-        return InternalDependency(
-            self.version, final_includes, final_compile_args,
-            final_link_args, final_libraries, final_whole_libraries,
-            final_sources, final_deps, self.variables)
-
-    def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None,
-                     configtool: T.Optional[str] = None, internal: T.Optional[str] = None,
-                     default_value: T.Optional[str] = None,
-                     pkgconfig_define: T.Optional[T.List[str]] = None) -> T.Union[str, T.List[str]]:
-        val = self.variables.get(internal, default_value)
-        if val is not None:
-            return val
-        raise DependencyException('Could not get an internal variable and no default provided for {!r}'.format(self))
-
-
-class HasNativeKwarg:
-    def __init__(self, kwargs):
-        self.for_machine = self.get_for_machine_from_kwargs(kwargs)
-
-    def get_for_machine_from_kwargs(self, kwargs):
-        return MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST
-
-class ExternalDependency(Dependency, HasNativeKwarg):
-    def __init__(self, type_name, environment, kwargs, language: T.Optional[str] = None):
-        Dependency.__init__(self, type_name, kwargs)
-        self.env = environment
-        self.name = type_name # default
-        self.is_found = False
-        self.language = language
-        self.version_reqs = kwargs.get('version', None)
-        if isinstance(self.version_reqs, str):
-            self.version_reqs = [self.version_reqs]
-        self.required = kwargs.get('required', True)
-        self.silent = kwargs.get('silent', False)
-        self.static = kwargs.get('static', False)
-        if not isinstance(self.static, bool):
-            raise DependencyException('Static keyword must be boolean')
-        # Is this dependency to be run on the build platform?
-        HasNativeKwarg.__init__(self, kwargs)
-        self.clib_compiler = detect_compiler(self.name, environment, self.for_machine, self.language)
-
-    def get_compiler(self):
-        return self.clib_compiler
-
-    def get_partial_dependency(self, *, compile_args: bool = False,
-                               link_args: bool = False, links: bool = False,
-                               includes: bool = False, sources: bool = False):
-        new = copy.copy(self)
-        if not compile_args:
-            new.compile_args = []
-        if not link_args:
-            new.link_args = []
-        if not sources:
-            new.sources = []
-        if not includes:
-            new.include_directories = []
-        if not sources:
-            new.sources = []
-
-        return new
-
-    def log_details(self):
-        return ''
-
-    def log_info(self):
-        return ''
-
-    def log_tried(self):
-        return ''
-
-    # Check if dependency version meets the requirements
-    def _check_version(self):
-        if not self.is_found:
-            return
-
-        if self.version_reqs:
-            # an unknown version can never satisfy any requirement
-            if not self.version:
-                found_msg = ['Dependency', mlog.bold(self.name), 'found:']
-                found_msg += [mlog.red('NO'), 'unknown version, but need:',
-                              self.version_reqs]
-                mlog.log(*found_msg)
-
-                if self.required:
-                    m = 'Unknown version of dependency {!r}, but need {!r}.'
-                    raise DependencyException(m.format(self.name, self.version_reqs))
-
-            else:
-                (self.is_found, not_found, found) = \
-                    version_compare_many(self.version, self.version_reqs)
-                if not self.is_found:
-                    found_msg = ['Dependency', mlog.bold(self.name), 'found:']
-                    found_msg += [mlog.red('NO'),
-                                  'found', mlog.normal_cyan(self.version), 'but need:',
-                                  mlog.bold(', '.join(["'{}'".format(e) for e in not_found]))]
-                    if found:
-                        found_msg += ['; matched:',
-                                      ', '.join(["'{}'".format(e) for e in found])]
-                    mlog.log(*found_msg)
-
-                    if self.required:
-                        m = 'Invalid version of dependency, need {!r} {!r} found {!r}.'
-                        raise DependencyException(m.format(self.name, not_found, self.version))
-                    return
-
-
-class NotFoundDependency(Dependency):
-    def __init__(self, environment):
-        super().__init__('not-found', {})
-        self.env = environment
-        self.name = 'not-found'
-        self.is_found = False
-
-    def get_partial_dependency(self, *, compile_args: bool = False,
-                               link_args: bool = False, links: bool = False,
-                               includes: bool = False, sources: bool = False):
-        return copy.copy(self)
-
-
-class ConfigToolDependency(ExternalDependency):
-
-    """Class representing dependencies found using a config tool.
-
-    Takes the following extra keys in kwargs that it uses internally:
-    :tools List[str]: A list of tool names to use
-    :version_arg str: The argument to pass to the tool to get it's version
-    :returncode_value int: The value of the correct returncode
-        Because some tools are stupid and don't return 0
-    """
-
-    tools = None
-    tool_name = None
-    version_arg = '--version'
-    __strip_version = re.compile(r'^[0-9][0-9.]+')
-
-    def __init__(self, name, environment, kwargs, language: T.Optional[str] = None):
-        super().__init__('config-tool', environment, kwargs, language=language)
-        self.name = name
-        # You may want to overwrite the class version in some cases
-        self.tools = listify(kwargs.get('tools', self.tools))
-        if not self.tool_name:
-            self.tool_name = self.tools[0]
-        if 'version_arg' in kwargs:
-            self.version_arg = kwargs['version_arg']
-
-        req_version = kwargs.get('version', None)
-        tool, version = self.find_config(req_version, kwargs.get('returncode_value', 0))
-        self.config = tool
-        self.is_found = self.report_config(version, req_version)
-        if not self.is_found:
-            self.config = None
-            return
-        self.version = version
-
-    def _sanitize_version(self, version):
-        """Remove any non-numeric, non-point version suffixes."""
-        m = self.__strip_version.match(version)
-        if m:
-            # Ensure that there isn't a trailing '.', such as an input like
-            # `1.2.3.git-1234`
-            return m.group(0).rstrip('.')
-        return version
-
-    def find_config(self, versions: T.Optional[T.List[str]] = None, returncode: int = 0) \
-            -> T.Tuple[T.Optional[str], T.Optional[str]]:
-        """Helper method that searches for config tool binaries in PATH and
-        returns the one that best matches the given version requirements.
-        """
-        if not isinstance(versions, list) and versions is not None:
-            versions = listify(versions)
-        best_match = (None, None)  # type: T.Tuple[T.Optional[str], T.Optional[str]]
-        for potential_bin in find_external_program(
-                self.env, self.for_machine, self.tool_name,
-                self.tool_name, self.tools, allow_default_for_cross=False):
-            if not potential_bin.found():
-                continue
-            tool = potential_bin.get_command()
-            try:
-                p, out = Popen_safe(tool + [self.version_arg])[:2]
-            except (FileNotFoundError, PermissionError):
-                continue
-            if p.returncode != returncode:
-                continue
-
-            out = self._sanitize_version(out.strip())
-            # Some tools, like pcap-config don't supply a version, but also
-            # don't fail with --version, in that case just assume that there is
-            # only one version and return it.
-            if not out:
-                return (tool, None)
-            if versions:
-                is_found = version_compare_many(out, versions)[0]
-                # This allows returning a found version without a config tool,
-                # which is useful to inform the user that you found version x,
-                # but y was required.
-                if not is_found:
-                    tool = None
-            if best_match[1]:
-                if version_compare(out, '> {}'.format(best_match[1])):
-                    best_match = (tool, out)
-            else:
-                best_match = (tool, out)
-
-        return best_match
-
-    def report_config(self, version, req_version):
-        """Helper method to print messages about the tool."""
-
-        found_msg = [mlog.bold(self.tool_name), 'found:']
-
-        if self.config is None:
-            found_msg.append(mlog.red('NO'))
-            if version is not None and req_version is not None:
-                found_msg.append('found {!r} but need {!r}'.format(version, req_version))
-            elif req_version:
-                found_msg.append('need {!r}'.format(req_version))
-        else:
-            found_msg += [mlog.green('YES'), '({})'.format(' '.join(self.config)), version]
-
-        mlog.log(*found_msg)
-
-        return self.config is not None
-
-    def get_config_value(self, args, stage):
-        p, out, err = Popen_safe(self.config + args)
-        if p.returncode != 0:
-            if self.required:
-                raise DependencyException(
-                    'Could not generate {} for {}.\n{}'.format(
-                        stage, self.name, err))
-            return []
-        return split_args(out)
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.AUTO, DependencyMethods.CONFIG_TOOL]
-
-    def get_configtool_variable(self, variable_name):
-        p, out, _ = Popen_safe(self.config + ['--{}'.format(variable_name)])
-        if p.returncode != 0:
-            if self.required:
-                raise DependencyException(
-                    'Could not get variable "{}" for dependency {}'.format(
-                        variable_name, self.name))
-        variable = out.strip()
-        mlog.debug('Got config-tool variable {} : {}'.format(variable_name, variable))
-        return variable
-
-    def log_tried(self):
-        return self.type_name
-
-    def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None,
-                     configtool: T.Optional[str] = None, internal: T.Optional[str] = None,
-                     default_value: T.Optional[str] = None,
-                     pkgconfig_define: T.Optional[T.List[str]] = None) -> T.Union[str, T.List[str]]:
-        if configtool:
-            # In the not required case '' (empty string) will be returned if the
-            # variable is not found. Since '' is a valid value to return we
-            # set required to True here to force and error, and use the
-            # finally clause to ensure it's restored.
-            restore = self.required
-            self.required = True
-            try:
-                return self.get_configtool_variable(configtool)
-            except DependencyException:
-                pass
-            finally:
-                self.required = restore
-        if default_value is not None:
-            return default_value
-        raise DependencyException('Could not get config-tool variable and no default provided for {!r}'.format(self))
-
-
-class PkgConfigDependency(ExternalDependency):
-    # The class's copy of the pkg-config path. Avoids having to search for it
-    # multiple times in the same Meson invocation.
-    class_pkgbin = PerMachine(None, None)
-    # We cache all pkg-config subprocess invocations to avoid redundant calls
-    pkgbin_cache = {}
-
-    def __init__(self, name, environment, kwargs, language: T.Optional[str] = None):
-        super().__init__('pkgconfig', environment, kwargs, language=language)
-        self.name = name
-        self.is_libtool = False
-        # Store a copy of the pkg-config path on the object itself so it is
-        # stored in the pickled coredata and recovered.
-        self.pkgbin = None
-
-        # Only search for pkg-config for each machine the first time and store
-        # the result in the class definition
-        if PkgConfigDependency.class_pkgbin[self.for_machine] is False:
-            mlog.debug('Pkg-config binary for %s is cached as not found.' % self.for_machine)
-        elif PkgConfigDependency.class_pkgbin[self.for_machine] is not None:
-            mlog.debug('Pkg-config binary for %s is cached.' % self.for_machine)
-        else:
-            assert PkgConfigDependency.class_pkgbin[self.for_machine] is None
-            mlog.debug('Pkg-config binary for %s is not cached.' % self.for_machine)
-            for potential_pkgbin in find_external_program(
-                    self.env, self.for_machine, 'pkgconfig', 'Pkg-config',
-                    environment.default_pkgconfig, allow_default_for_cross=False):
-                version_if_ok = self.check_pkgconfig(potential_pkgbin)
-                if not version_if_ok:
-                    continue
-                if not self.silent:
-                    mlog.log('Found pkg-config:', mlog.bold(potential_pkgbin.get_path()),
-                             '(%s)' % version_if_ok)
-                PkgConfigDependency.class_pkgbin[self.for_machine] = potential_pkgbin
-                break
-            else:
-                if not self.silent:
-                    mlog.log('Found Pkg-config:', mlog.red('NO'))
-                # Set to False instead of None to signify that we've already
-                # searched for it and not found it
-                PkgConfigDependency.class_pkgbin[self.for_machine] = False
-
-        self.pkgbin = PkgConfigDependency.class_pkgbin[self.for_machine]
-        if self.pkgbin is False:
-            self.pkgbin = None
-            msg = 'Pkg-config binary for machine %s not found. Giving up.' % self.for_machine
-            if self.required:
-                raise DependencyException(msg)
-            else:
-                mlog.debug(msg)
-                return
-
-        mlog.debug('Determining dependency {!r} with pkg-config executable '
-                   '{!r}'.format(name, self.pkgbin.get_path()))
-        ret, self.version, _ = self._call_pkgbin(['--modversion', name])
-        if ret != 0:
-            return
-
-        self.is_found = True
-
-        try:
-            # Fetch cargs to be used while using this dependency
-            self._set_cargs()
-            # Fetch the libraries and library paths needed for using this
-            self._set_libs()
-        except DependencyException as e:
-            mlog.debug("pkg-config error with '%s': %s" % (name, e))
-            if self.required:
-                raise
-            else:
-                self.compile_args = []
-                self.link_args = []
-                self.is_found = False
-                self.reason = e
-
-    def __repr__(self):
-        s = '<{0} {1}: {2} {3}>'
-        return s.format(self.__class__.__name__, self.name, self.is_found,
-                        self.version_reqs)
-
-    def _call_pkgbin_real(self, args, env):
-        cmd = self.pkgbin.get_command() + args
-        p, out, err = Popen_safe(cmd, env=env)
-        rc, out, err = p.returncode, out.strip(), err.strip()
-        call = ' '.join(cmd)
-        mlog.debug("Called `{}` -> {}\n{}".format(call, rc, out))
-        return rc, out, err
-
-    def _call_pkgbin(self, args, env=None):
-        # Always copy the environment since we're going to modify it
-        # with pkg-config variables
-        if env is None:
-            env = os.environ.copy()
-        else:
-            env = env.copy()
-
-        extra_paths = self.env.coredata.builtins_per_machine[self.for_machine]['pkg_config_path'].value
-        sysroot = self.env.properties[self.for_machine].get_sys_root()
-        if sysroot:
-            env['PKG_CONFIG_SYSROOT_DIR'] = sysroot
-        new_pkg_config_path = ':'.join([p for p in extra_paths])
-        mlog.debug('PKG_CONFIG_PATH: ' + new_pkg_config_path)
-        env['PKG_CONFIG_PATH'] = new_pkg_config_path
-
-        pkg_config_libdir_prop = self.env.properties[self.for_machine].get_pkg_config_libdir()
-        if pkg_config_libdir_prop:
-            new_pkg_config_libdir = ':'.join([p for p in pkg_config_libdir_prop])
-            env['PKG_CONFIG_LIBDIR'] = new_pkg_config_libdir
-            mlog.debug('PKG_CONFIG_LIBDIR: ' + new_pkg_config_libdir)
-
-        fenv = frozenset(env.items())
-        targs = tuple(args)
-        cache = PkgConfigDependency.pkgbin_cache
-        if (self.pkgbin, targs, fenv) not in cache:
-            cache[(self.pkgbin, targs, fenv)] = self._call_pkgbin_real(args, env)
-        return cache[(self.pkgbin, targs, fenv)]
-
-    def _convert_mingw_paths(self, args: T.List[str]) -> T.List[str]:
-        '''
-        Both MSVC and native Python on Windows cannot handle MinGW-esque /c/foo
-        paths so convert them to C:/foo. We cannot resolve other paths starting
-        with / like /home/foo so leave them as-is so that the user gets an
-        error/warning from the compiler/linker.
-        '''
-        if not mesonlib.is_windows():
-            return args
-        converted = []
-        for arg in args:
-            pargs = []
-            # Library search path
-            if arg.startswith('-L/'):
-                pargs = PurePath(arg[2:]).parts
-                tmpl = '-L{}:/{}'
-            elif arg.startswith('-I/'):
-                pargs = PurePath(arg[2:]).parts
-                tmpl = '-I{}:/{}'
-            # Full path to library or .la file
-            elif arg.startswith('/'):
-                pargs = PurePath(arg).parts
-                tmpl = '{}:/{}'
-            elif arg.startswith(('-L', '-I')) or (len(arg) > 2 and arg[1] == ':'):
-                # clean out improper '\\ ' as comes from some Windows pkg-config files
-                arg = arg.replace('\\ ', ' ')
-            if len(pargs) > 1 and len(pargs[1]) == 1:
-                arg = tmpl.format(pargs[1], '/'.join(pargs[2:]))
-            converted.append(arg)
-        return converted
-
-    def _split_args(self, cmd):
-        # pkg-config paths follow Unix conventions, even on Windows; split the
-        # output using shlex.split rather than mesonlib.split_args
-        return shlex.split(cmd)
-
-    def _set_cargs(self):
-        env = None
-        if self.language == 'fortran':
-            # gfortran doesn't appear to look in system paths for INCLUDE files,
-            # so don't allow pkg-config to suppress -I flags for system paths
-            env = os.environ.copy()
-            env['PKG_CONFIG_ALLOW_SYSTEM_CFLAGS'] = '1'
-        ret, out, err = self._call_pkgbin(['--cflags', self.name], env=env)
-        if ret != 0:
-            raise DependencyException('Could not generate cargs for %s:\n%s\n' %
-                                      (self.name, err))
-        self.compile_args = self._convert_mingw_paths(self._split_args(out))
-
-    def _search_libs(self, out, out_raw):
-        '''
-        @out: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs
-        @out_raw: pkg-config --libs
-
-        We always look for the file ourselves instead of depending on the
-        compiler to find it with -lfoo or foo.lib (if possible) because:
-        1. We want to be able to select static or shared
-        2. We need the full path of the library to calculate RPATH values
-        3. De-dup of libraries is easier when we have absolute paths
-
-        Libraries that are provided by the toolchain or are not found by
-        find_library() will be added with -L -l pairs.
-        '''
-        # Library paths should be safe to de-dup
-        #
-        # First, figure out what library paths to use. Originally, we were
-        # doing this as part of the loop, but due to differences in the order
-        # of -L values between pkg-config and pkgconf, we need to do that as
-        # a separate step. See:
-        # https://github.com/mesonbuild/meson/issues/3951
-        # https://github.com/mesonbuild/meson/issues/4023
-        #
-        # Separate system and prefix paths, and ensure that prefix paths are
-        # always searched first.
-        prefix_libpaths = OrderedSet()
-        # We also store this raw_link_args on the object later
-        raw_link_args = self._convert_mingw_paths(self._split_args(out_raw))
-        for arg in raw_link_args:
-            if arg.startswith('-L') and not arg.startswith(('-L-l', '-L-L')):
-                path = arg[2:]
-                if not os.path.isabs(path):
-                    # Resolve the path as a compiler in the build directory would
-                    path = os.path.join(self.env.get_build_dir(), path)
-                prefix_libpaths.add(path)
-        # Library paths are not always ordered in a meaningful way
-        #
-        # Instead of relying on pkg-config or pkgconf to provide -L flags in a
-        # specific order, we reorder library paths ourselves, according to th
-        # order specified in PKG_CONFIG_PATH. See:
-        # https://github.com/mesonbuild/meson/issues/4271
-        #
-        # Only prefix_libpaths are reordered here because there should not be
-        # too many system_libpaths to cause library version issues.
-        pkg_config_path = get_env_var(
-            self.for_machine,
-            self.env.is_cross_build(),
-            'PKG_CONFIG_PATH')
-        if pkg_config_path:
-            pkg_config_path = pkg_config_path.split(os.pathsep)
-        else:
-            pkg_config_path = []
-        pkg_config_path = self._convert_mingw_paths(pkg_config_path)
-        prefix_libpaths = sort_libpaths(prefix_libpaths, pkg_config_path)
-        system_libpaths = OrderedSet()
-        full_args = self._convert_mingw_paths(self._split_args(out))
-        for arg in full_args:
-            if arg.startswith(('-L-l', '-L-L')):
-                # These are D language arguments, not library paths
-                continue
-            if arg.startswith('-L') and arg[2:] not in prefix_libpaths:
-                system_libpaths.add(arg[2:])
-        # Use this re-ordered path list for library resolution
-        libpaths = list(prefix_libpaths) + list(system_libpaths)
-        # Track -lfoo libraries to avoid duplicate work
-        libs_found = OrderedSet()
-        # Track not-found libraries to know whether to add library paths
-        libs_notfound = []
-        libtype = LibType.STATIC if self.static else LibType.PREFER_SHARED
-        # Generate link arguments for this library
-        link_args = []
-        for lib in full_args:
-            if lib.startswith(('-L-l', '-L-L')):
-                # These are D language arguments, add them as-is
-                pass
-            elif lib.startswith('-L'):
-                # We already handled library paths above
-                continue
-            elif lib.startswith('-l'):
-                # Don't resolve the same -lfoo argument again
-                if lib in libs_found:
-                    continue
-                if self.clib_compiler:
-                    args = self.clib_compiler.find_library(lib[2:], self.env,
-                                                           libpaths, libtype)
-                # If the project only uses a non-clib language such as D, Rust,
-                # C#, Python, etc, all we can do is limp along by adding the
-                # arguments as-is and then adding the libpaths at the end.
-                else:
-                    args = None
-                if args is not None:
-                    libs_found.add(lib)
-                    # Replace -l arg with full path to library if available
-                    # else, library is either to be ignored, or is provided by
-                    # the compiler, can't be resolved, and should be used as-is
-                    if args:
-                        if not args[0].startswith('-l'):
-                            lib = args[0]
-                    else:
-                        continue
-                else:
-                    # Library wasn't found, maybe we're looking in the wrong
-                    # places or the library will be provided with LDFLAGS or
-                    # LIBRARY_PATH from the environment (on macOS), and many
-                    # other edge cases that we can't account for.
-                    #
-                    # Add all -L paths and use it as -lfoo
-                    if lib in libs_notfound:
-                        continue
-                    if self.static:
-                        mlog.warning('Static library {!r} not found for dependency {!r}, may '
-                                     'not be statically linked'.format(lib[2:], self.name))
-                    libs_notfound.append(lib)
-            elif lib.endswith(".la"):
-                shared_libname = self.extract_libtool_shlib(lib)
-                shared_lib = os.path.join(os.path.dirname(lib), shared_libname)
-                if not os.path.exists(shared_lib):
-                    shared_lib = os.path.join(os.path.dirname(lib), ".libs", shared_libname)
-
-                if not os.path.exists(shared_lib):
-                    raise DependencyException('Got a libtools specific "%s" dependencies'
-                                              'but we could not compute the actual shared'
-                                              'library path' % lib)
-                self.is_libtool = True
-                lib = shared_lib
-                if lib in link_args:
-                    continue
-            link_args.append(lib)
-        # Add all -Lbar args if we have -lfoo args in link_args
-        if libs_notfound:
-            # Order of -L flags doesn't matter with ld, but it might with other
-            # linkers such as MSVC, so prepend them.
-            link_args = ['-L' + lp for lp in prefix_libpaths] + link_args
-        return link_args, raw_link_args
-
-    def _set_libs(self):
-        env = None
-        libcmd = [self.name, '--libs']
-        if self.static:
-            libcmd.append('--static')
-        # Force pkg-config to output -L fields even if they are system
-        # paths so we can do manual searching with cc.find_library() later.
-        env = os.environ.copy()
-        env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1'
-        ret, out, err = self._call_pkgbin(libcmd, env=env)
-        if ret != 0:
-            raise DependencyException('Could not generate libs for %s:\n%s\n' %
-                                      (self.name, err))
-        # Also get the 'raw' output without -Lfoo system paths for adding -L
-        # args with -lfoo when a library can't be found, and also in
-        # gnome.generate_gir + gnome.gtkdoc which need -L -l arguments.
-        ret, out_raw, err_raw = self._call_pkgbin(libcmd)
-        if ret != 0:
-            raise DependencyException('Could not generate libs for %s:\n\n%s' %
-                                      (self.name, out_raw))
-        self.link_args, self.raw_link_args = self._search_libs(out, out_raw)
-
-    def get_pkgconfig_variable(self, variable_name, kwargs):
-        options = ['--variable=' + variable_name, self.name]
-
-        if 'define_variable' in kwargs:
-            definition = kwargs.get('define_variable', [])
-            if not isinstance(definition, list):
-                raise DependencyException('define_variable takes a list')
-
-            if len(definition) != 2 or not all(isinstance(i, str) for i in definition):
-                raise DependencyException('define_variable must be made up of 2 strings for VARIABLENAME and VARIABLEVALUE')
-
-            options = ['--define-variable=' + '='.join(definition)] + options
-
-        ret, out, err = self._call_pkgbin(options)
-        variable = ''
-        if ret != 0:
-            if self.required:
-                raise DependencyException('dependency %s not found:\n%s\n' %
-                                          (self.name, err))
-        else:
-            variable = out.strip()
-
-            # pkg-config doesn't distinguish between empty and non-existent variables
-            # use the variable list to check for variable existence
-            if not variable:
-                ret, out, _ = self._call_pkgbin(['--print-variables', self.name])
-                if not re.search(r'^' + variable_name + r'$', out, re.MULTILINE):
-                    if 'default' in kwargs:
-                        variable = kwargs['default']
-                    else:
-                        mlog.warning("pkgconfig variable '%s' not defined for dependency %s." % (variable_name, self.name))
-
-        mlog.debug('Got pkgconfig variable %s : %s' % (variable_name, variable))
-        return variable
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG]
-
-    def check_pkgconfig(self, pkgbin):
-        if not pkgbin.found():
-            mlog.log('Did not find pkg-config by name {!r}'.format(pkgbin.name))
-            return None
-        try:
-            p, out = Popen_safe(pkgbin.get_command() + ['--version'])[0:2]
-            if p.returncode != 0:
-                mlog.warning('Found pkg-config {!r} but it failed when run'
-                             ''.format(' '.join(pkgbin.get_command())))
-                return None
-        except FileNotFoundError:
-            mlog.warning('We thought we found pkg-config {!r} but now it\'s not there. How odd!'
-                         ''.format(' '.join(pkgbin.get_command())))
-            return None
-        except PermissionError:
-            msg = 'Found pkg-config {!r} but didn\'t have permissions to run it.'.format(' '.join(pkgbin.get_command()))
-            if not mesonlib.is_windows():
-                msg += '\n\nOn Unix-like systems this is often caused by scripts that are not executable.'
-            mlog.warning(msg)
-            return None
-        return out.strip()
-
-    def extract_field(self, la_file, fieldname):
-        with open(la_file) as f:
-            for line in f:
-                arr = line.strip().split('=')
-                if arr[0] == fieldname:
-                    return arr[1][1:-1]
-        return None
-
-    def extract_dlname_field(self, la_file):
-        return self.extract_field(la_file, 'dlname')
-
-    def extract_libdir_field(self, la_file):
-        return self.extract_field(la_file, 'libdir')
-
-    def extract_libtool_shlib(self, la_file):
-        '''
-        Returns the path to the shared library
-        corresponding to this .la file
-        '''
-        dlname = self.extract_dlname_field(la_file)
-        if dlname is None:
-            return None
-
-        # Darwin uses absolute paths where possible; since the libtool files never
-        # contain absolute paths, use the libdir field
-        if mesonlib.is_osx():
-            dlbasename = os.path.basename(dlname)
-            libdir = self.extract_libdir_field(la_file)
-            if libdir is None:
-                return dlbasename
-            return os.path.join(libdir, dlbasename)
-        # From the comments in extract_libtool(), older libtools had
-        # a path rather than the raw dlname
-        return os.path.basename(dlname)
-
-    def log_tried(self):
-        return self.type_name
-
-    def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None,
-                     configtool: T.Optional[str] = None, internal: T.Optional[str] = None,
-                     default_value: T.Optional[str] = None,
-                     pkgconfig_define: T.Optional[T.List[str]] = None) -> T.Union[str, T.List[str]]:
-        if pkgconfig:
-            kwargs = {}
-            if default_value is not None:
-                kwargs['default'] = default_value
-            if pkgconfig_define is not None:
-                kwargs['define_variable'] = pkgconfig_define
-            try:
-                return self.get_pkgconfig_variable(pkgconfig, kwargs)
-            except DependencyException:
-                pass
-        if default_value is not None:
-            return default_value
-        raise DependencyException('Could not get pkg-config variable and no default provided for {!r}'.format(self))
-
-class CMakeDependency(ExternalDependency):
-    # The class's copy of the CMake path. Avoids having to search for it
-    # multiple times in the same Meson invocation.
-    class_cmakeinfo = PerMachine(None, None)
-    # Version string for the minimum CMake version
-    class_cmake_version = '>=3.4'
-    # CMake generators to try (empty for no generator)
-    class_cmake_generators = ['', 'Ninja', 'Unix Makefiles', 'Visual Studio 10 2010']
-    class_working_generator = None
-
-    def _gen_exception(self, msg):
-        return DependencyException('Dependency {} not found: {}'.format(self.name, msg))
-
-    def _main_cmake_file(self) -> str:
-        return 'CMakeLists.txt'
-
-    def _extra_cmake_opts(self) -> T.List[str]:
-        return []
-
-    def _map_module_list(self, modules: T.List[T.Tuple[str, bool]], components: T.List[T.Tuple[str, bool]]) -> T.List[T.Tuple[str, bool]]:
-        # Map the input module list to something else
-        # This function will only be executed AFTER the initial CMake
-        # interpreter pass has completed. Thus variables defined in the
-        # CMakeLists.txt can be accessed here.
-        #
-        # Both the modules and components inputs contain the original lists.
-        return modules
-
-    def _map_component_list(self, modules: T.List[T.Tuple[str, bool]], components: T.List[T.Tuple[str, bool]]) -> T.List[T.Tuple[str, bool]]:
-        # Map the input components list to something else. This
-        # function will be executed BEFORE the initial CMake interpreter
-        # pass. Thus variables from the CMakeLists.txt can NOT be accessed.
-        #
-        # Both the modules and components inputs contain the original lists.
-        return components
-
-    def _original_module_name(self, module: str) -> str:
-        # Reverse the module mapping done by _map_module_list for
-        # one module
-        return module
-
-    def __init__(self, name: str, environment: Environment, kwargs, language: T.Optional[str] = None):
-        # Gather a list of all languages to support
-        self.language_list = []  # type: T.List[str]
-        if language is None:
-            compilers = None
-            if kwargs.get('native', False):
-                compilers = environment.coredata.compilers.build
-            else:
-                compilers = environment.coredata.compilers.host
-
-            candidates = ['c', 'cpp', 'fortran', 'objc', 'objcxx']
-            self.language_list += [x for x in candidates if x in compilers]
-        else:
-            self.language_list += [language]
-
-        # Add additional languages if required
-        if 'fortran' in self.language_list:
-            self.language_list += ['c']
-
-        # Ensure that the list is unique
-        self.language_list = list(set(self.language_list))
-
-        super().__init__('cmake', environment, kwargs, language=language)
-        self.name = name
-        self.is_libtool = False
-        # Store a copy of the CMake path on the object itself so it is
-        # stored in the pickled coredata and recovered.
-        self.cmakebin = None
-        self.cmakeinfo = None
-
-        # Where all CMake "build dirs" are located
-        self.cmake_root_dir = environment.scratch_dir
-
-        # T.List of successfully found modules
-        self.found_modules = []
-
-        # Initialize with None before the first return to avoid
-        # AttributeError exceptions in derived classes
-        self.traceparser = None  # type: CMakeTraceParser
-
-        self.cmakebin = CMakeExecutor(environment, CMakeDependency.class_cmake_version, self.for_machine, silent=self.silent)
-        if not self.cmakebin.found():
-            self.cmakebin = None
-            msg = 'No CMake binary for machine %s not found. Giving up.' % self.for_machine
-            if self.required:
-                raise DependencyException(msg)
-            mlog.debug(msg)
-            return
-
-        # Setup the trace parser
-        self.traceparser = CMakeTraceParser(self.cmakebin.version(), self._get_build_dir())
-
-        cm_args = stringlistify(extract_as_list(kwargs, 'cmake_args'))
-        if CMakeDependency.class_cmakeinfo[self.for_machine] is None:
-            CMakeDependency.class_cmakeinfo[self.for_machine] = self._get_cmake_info(cm_args)
-        self.cmakeinfo = CMakeDependency.class_cmakeinfo[self.for_machine]
-        if self.cmakeinfo is None:
-            raise self._gen_exception('Unable to obtain CMake system information')
-
-        components = [(x, True) for x in stringlistify(extract_as_list(kwargs, 'components'))]
-        modules = [(x, True) for x in stringlistify(extract_as_list(kwargs, 'modules'))]
-        modules += [(x, False) for x in stringlistify(extract_as_list(kwargs, 'optional_modules'))]
-        cm_path = stringlistify(extract_as_list(kwargs, 'cmake_module_path'))
-        cm_path = [x if os.path.isabs(x) else os.path.join(environment.get_source_dir(), x) for x in cm_path]
-        if cm_path:
-            cm_args.append('-DCMAKE_MODULE_PATH=' + ';'.join(cm_path))
-        if not self._preliminary_find_check(name, cm_path, self.cmakebin.get_cmake_prefix_paths(), environment.machines[self.for_machine]):
-            mlog.debug('Preliminary CMake check failed. Aborting.')
-            return
-        self._detect_dep(name, modules, components, cm_args)
-
-    def __repr__(self):
-        s = '<{0} {1}: {2} {3}>'
-        return s.format(self.__class__.__name__, self.name, self.is_found,
-                        self.version_reqs)
-
-    def _get_cmake_info(self, cm_args):
-        mlog.debug("Extracting basic cmake information")
-        res = {}
-
-        # Try different CMake generators since specifying no generator may fail
-        # in cygwin for some reason
-        gen_list = []
-        # First try the last working generator
-        if CMakeDependency.class_working_generator is not None:
-            gen_list += [CMakeDependency.class_working_generator]
-        gen_list += CMakeDependency.class_cmake_generators
-
-        temp_parser = CMakeTraceParser(self.cmakebin.version(), self._get_build_dir())
-
-        for i in gen_list:
-            mlog.debug('Try CMake generator: {}'.format(i if len(i) > 0 else 'auto'))
-
-            # Prepare options
-            cmake_opts = temp_parser.trace_args() + ['.']
-            cmake_opts += cm_args
-            if len(i) > 0:
-                cmake_opts = ['-G', i] + cmake_opts
-
-            # Run CMake
-            ret1, out1, err1 = self._call_cmake(cmake_opts, 'CMakePathInfo.txt')
-
-            # Current generator was successful
-            if ret1 == 0:
-                CMakeDependency.class_working_generator = i
-                break
-
-            mlog.debug('CMake failed to gather system information for generator {} with error code {}'.format(i, ret1))
-            mlog.debug('OUT:\n{}\n\n\nERR:\n{}\n\n'.format(out1, err1))
-
-        # Check if any generator succeeded
-        if ret1 != 0:
-            return None
-
-        try:
-            temp_parser.parse(err1)
-        except MesonException:
-            return None
-
-        def process_paths(l: T.List[str]) -> T.Set[str]:
-            l = [x.split(':') for x in l]
-            l = [x for sublist in l for x in sublist]
-            return set(l)
-
-        # Extract the variables and sanity check them
-        root_paths = process_paths(temp_parser.get_cmake_var('MESON_FIND_ROOT_PATH'))
-        root_paths.update(process_paths(temp_parser.get_cmake_var('MESON_CMAKE_SYSROOT')))
-        root_paths = sorted(root_paths)
-        root_paths = list(filter(lambda x: os.path.isdir(x), root_paths))
-        module_paths = process_paths(temp_parser.get_cmake_var('MESON_PATHS_LIST'))
-        rooted_paths = []
-        for j in [Path(x) for x in root_paths]:
-            for i in [Path(x) for x in module_paths]:
-                rooted_paths.append(str(j / i.relative_to(i.anchor)))
-        module_paths = sorted(module_paths.union(rooted_paths))
-        module_paths = list(filter(lambda x: os.path.isdir(x), module_paths))
-        archs = temp_parser.get_cmake_var('MESON_ARCH_LIST')
-
-        common_paths = ['lib', 'lib32', 'lib64', 'libx32', 'share']
-        for i in archs:
-            common_paths += [os.path.join('lib', i)]
-
-        res = {
-            'module_paths': module_paths,
-            'cmake_root': temp_parser.get_cmake_var('MESON_CMAKE_ROOT')[0],
-            'archs': archs,
-            'common_paths': common_paths
-        }
-
-        mlog.debug('  -- Module search paths:    {}'.format(res['module_paths']))
-        mlog.debug('  -- CMake root:             {}'.format(res['cmake_root']))
-        mlog.debug('  -- CMake architectures:    {}'.format(res['archs']))
-        mlog.debug('  -- CMake lib search paths: {}'.format(res['common_paths']))
-
-        return res
-
-    @staticmethod
-    @functools.lru_cache(maxsize=None)
-    def _cached_listdir(path: str) -> T.Tuple[T.Tuple[str, str]]:
-        try:
-            return tuple((x, str(x).lower()) for x in os.listdir(path))
-        except OSError:
-            return ()
-
-    @staticmethod
-    @functools.lru_cache(maxsize=None)
-    def _cached_isdir(path: str) -> bool:
-        try:
-            return os.path.isdir(path)
-        except OSError:
-            return False
-
-    def _preliminary_find_check(self, name: str, module_path: T.List[str], prefix_path: T.List[str], machine: MachineInfo) -> bool:
-        lname = str(name).lower()
-
-        # Checks <path>, <path>/cmake, <path>/CMake
-        def find_module(path: str) -> bool:
-            for i in [path, os.path.join(path, 'cmake'), os.path.join(path, 'CMake')]:
-                if not self._cached_isdir(i):
-                    continue
-
-                # Check the directory case insensitve
-                content = self._cached_listdir(i)
-                candidates = ['Find{}.cmake', '{}Config.cmake', '{}-config.cmake']
-                candidates = [x.format(name).lower() for x in candidates]
-                if any([x[1] in candidates for x in content]):
-                    return True
-            return False
-
-        # Search in <path>/(lib/<arch>|lib*|share) for cmake files
-        def search_lib_dirs(path: str) -> bool:
-            for i in [os.path.join(path, x) for x in self.cmakeinfo['common_paths']]:
-                if not self._cached_isdir(i):
-                    continue
-
-                # Check <path>/(lib/<arch>|lib*|share)/cmake/<name>*/
-                cm_dir = os.path.join(i, 'cmake')
-                if self._cached_isdir(cm_dir):
-                    content = self._cached_listdir(cm_dir)
-                    content = list(filter(lambda x: x[1].startswith(lname), content))
-                    for k in content:
-                        if find_module(os.path.join(cm_dir, k[0])):
-                            return True
-
-                # <path>/(lib/<arch>|lib*|share)/<name>*/
-                # <path>/(lib/<arch>|lib*|share)/<name>*/(cmake|CMake)/
-                content = self._cached_listdir(i)
-                content = list(filter(lambda x: x[1].startswith(lname), content))
-                for k in content:
-                    if find_module(os.path.join(i, k[0])):
-                        return True
-
-            return False
-
-        # Check the user provided and system module paths
-        for i in module_path + [os.path.join(self.cmakeinfo['cmake_root'], 'Modules')]:
-            if find_module(i):
-                return True
-
-        # Check the user provided prefix paths
-        for i in prefix_path:
-            if search_lib_dirs(i):
-                return True
-
-        # Check the system paths
-        for i in self.cmakeinfo['module_paths']:
-            if find_module(i):
-                return True
-
-            if search_lib_dirs(i):
-                return True
-
-            content = self._cached_listdir(i)
-            content = list(filter(lambda x: x[1].startswith(lname), content))
-            for k in content:
-                if search_lib_dirs(os.path.join(i, k[0])):
-                    return True
-
-            # Mac framework support
-            if machine.is_darwin():
-                for j in ['{}.framework', '{}.app']:
-                    j = j.format(lname)
-                    if j in content:
-                        if find_module(os.path.join(i, j[0], 'Resources')) or find_module(os.path.join(i, j[0], 'Version')):
-                            return True
-
-        # Check the environment path
-        env_path = os.environ.get('{}_DIR'.format(name))
-        if env_path and find_module(env_path):
-            return True
-
-        return False
-
-    def _detect_dep(self, name: str, modules: T.List[T.Tuple[str, bool]], components: T.List[T.Tuple[str, bool]], args: T.List[str]):
-        # Detect a dependency with CMake using the '--find-package' mode
-        # and the trace output (stderr)
-        #
-        # When the trace output is enabled CMake prints all functions with
-        # parameters to stderr as they are executed. Since CMake 3.4.0
-        # variables ("${VAR}") are also replaced in the trace output.
-        mlog.debug('\nDetermining dependency {!r} with CMake executable '
-                   '{!r}'.format(name, self.cmakebin.executable_path()))
-
-        # Try different CMake generators since specifying no generator may fail
-        # in cygwin for some reason
-        gen_list = []
-        # First try the last working generator
-        if CMakeDependency.class_working_generator is not None:
-            gen_list += [CMakeDependency.class_working_generator]
-        gen_list += CMakeDependency.class_cmake_generators
-
-        # Map the components
-        comp_mapped = self._map_component_list(modules, components)
-
-        for i in gen_list:
-            mlog.debug('Try CMake generator: {}'.format(i if len(i) > 0 else 'auto'))
-
-            # Prepare options
-            cmake_opts = []
-            cmake_opts += ['-DNAME={}'.format(name)]
-            cmake_opts += ['-DARCHS={}'.format(';'.join(self.cmakeinfo['archs']))]
-            cmake_opts += ['-DCOMPS={}'.format(';'.join([x[0] for x in comp_mapped]))]
-            cmake_opts += args
-            cmake_opts += self.traceparser.trace_args()
-            cmake_opts += self._extra_cmake_opts()
-            cmake_opts += ['.']
-            if len(i) > 0:
-                cmake_opts = ['-G', i] + cmake_opts
-
-            # Run CMake
-            ret1, out1, err1 = self._call_cmake(cmake_opts, self._main_cmake_file())
-
-            # Current generator was successful
-            if ret1 == 0:
-                CMakeDependency.class_working_generator = i
-                break
-
-            mlog.debug('CMake failed for generator {} and package {} with error code {}'.format(i, name, ret1))
-            mlog.debug('OUT:\n{}\n\n\nERR:\n{}\n\n'.format(out1, err1))
-
-        # Check if any generator succeeded
-        if ret1 != 0:
-            return
-
-        try:
-            self.traceparser.parse(err1)
-        except CMakeException as e:
-            e = self._gen_exception(str(e))
-            if self.required:
-                raise
-            else:
-                self.compile_args = []
-                self.link_args = []
-                self.is_found = False
-                self.reason = e
-                return
-
-        # Whether the package is found or not is always stored in PACKAGE_FOUND
-        self.is_found = self.traceparser.var_to_bool('PACKAGE_FOUND')
-        if not self.is_found:
-            return
-
-        # Try to detect the version
-        vers_raw = self.traceparser.get_cmake_var('PACKAGE_VERSION')
-
-        if len(vers_raw) > 0:
-            self.version = vers_raw[0]
-            self.version.strip('"\' ')
-
-        # Post-process module list. Used in derived classes to modify the
-        # module list (append prepend a string, etc.).
-        modules = self._map_module_list(modules, components)
-        autodetected_module_list = False
-
-        # Try guessing a CMake target if none is provided
-        if len(modules) == 0:
-            for i in self.traceparser.targets:
-                tg = i.lower()
-                lname = name.lower()
-                if '{}::{}'.format(lname, lname) == tg or lname == tg.replace('::', ''):
-                    mlog.debug('Guessed CMake target \'{}\''.format(i))
-                    modules = [(i, True)]
-                    autodetected_module_list = True
-                    break
-
-        # Failed to guess a target --> try the old-style method
-        if len(modules) == 0:
-            incDirs = [x for x in self.traceparser.get_cmake_var('PACKAGE_INCLUDE_DIRS') if x]
-            defs = [x for x in self.traceparser.get_cmake_var('PACKAGE_DEFINITIONS') if x]
-            libs = [x for x in self.traceparser.get_cmake_var('PACKAGE_LIBRARIES') if x]
-
-            # Try to use old style variables if no module is specified
-            if len(libs) > 0:
-                self.compile_args = list(map(lambda x: '-I{}'.format(x), incDirs)) + defs
-                self.link_args = libs
-                mlog.debug('using old-style CMake variables for dependency {}'.format(name))
-                mlog.debug('Include Dirs:         {}'.format(incDirs))
-                mlog.debug('Compiler Definitions: {}'.format(defs))
-                mlog.debug('Libraries:            {}'.format(libs))
-                return
-
-            # Even the old-style approach failed. Nothing else we can do here
-            self.is_found = False
-            raise self._gen_exception('CMake: failed to guess a CMake target for {}.\n'
-                                      'Try to explicitly specify one or more targets with the "modules" property.\n'
-                                      'Valid targets are:\n{}'.format(name, list(self.traceparser.targets.keys())))
-
-        # Set dependencies with CMake targets
-        # recognise arguments we should pass directly to the linker
-        reg_is_lib = re.compile(r'^(-l[a-zA-Z0-9_]+|-pthread|-delayload:[a-zA-Z0-9_\.]+|[a-zA-Z0-9_]+\.lib)$')
-        reg_is_maybe_bare_lib = re.compile(r'^[a-zA-Z0-9_]+$')
-        processed_targets = []
-        incDirs = []
-        compileDefinitions = []
-        compileOptions = []
-        libraries = []
-        for i, required in modules:
-            if i not in self.traceparser.targets:
-                if not required:
-                    mlog.warning('CMake: T.Optional module', mlog.bold(self._original_module_name(i)), 'for', mlog.bold(name), 'was not found')
-                    continue
-                raise self._gen_exception('CMake: invalid module {} for {}.\n'
-                                          'Try to explicitly specify one or more targets with the "modules" property.\n'
-                                          'Valid targets are:\n{}'.format(self._original_module_name(i), name, list(self.traceparser.targets.keys())))
-
-            targets = [i]
-            if not autodetected_module_list:
-                self.found_modules += [i]
-
-            while len(targets) > 0:
-                curr = targets.pop(0)
-
-                # Skip already processed targets
-                if curr in processed_targets:
-                    continue
-
-                tgt = self.traceparser.targets[curr]
-                cfgs = []
-                cfg = ''
-                otherDeps = []
-                mlog.debug(tgt)
-
-                if 'INTERFACE_INCLUDE_DIRECTORIES' in tgt.properties:
-                    incDirs += [x for x in tgt.properties['INTERFACE_INCLUDE_DIRECTORIES'] if x]
-
-                if 'INTERFACE_COMPILE_DEFINITIONS' in tgt.properties:
-                    compileDefinitions += ['-D' + re.sub('^-D', '', x) for x in tgt.properties['INTERFACE_COMPILE_DEFINITIONS'] if x]
-
-                if 'INTERFACE_COMPILE_OPTIONS' in tgt.properties:
-                    compileOptions += [x for x in tgt.properties['INTERFACE_COMPILE_OPTIONS'] if x]
-
-                if 'IMPORTED_CONFIGURATIONS' in tgt.properties:
-                    cfgs = [x for x in tgt.properties['IMPORTED_CONFIGURATIONS'] if x]
-                    cfg = cfgs[0]
-
-                if 'b_vscrt' in self.env.coredata.base_options:
-                    is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
-                    if self.env.coredata.base_options['b_vscrt'].value in ('mdd', 'mtd'):
-                        is_debug = True
-                else:
-                    is_debug = self.env.coredata.get_builtin_option('debug')
-                if is_debug:
-                    if 'DEBUG' in cfgs:
-                        cfg = 'DEBUG'
-                    elif 'RELEASE' in cfgs:
-                        cfg = 'RELEASE'
-                else:
-                    if 'RELEASE' in cfgs:
-                        cfg = 'RELEASE'
-
-                if 'IMPORTED_IMPLIB_{}'.format(cfg) in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_IMPLIB_{}'.format(cfg)] if x]
-                elif 'IMPORTED_IMPLIB' in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_IMPLIB'] if x]
-                elif 'IMPORTED_LOCATION_{}'.format(cfg) in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_LOCATION_{}'.format(cfg)] if x]
-                elif 'IMPORTED_LOCATION' in tgt.properties:
-                    libraries += [x for x in tgt.properties['IMPORTED_LOCATION'] if x]
-
-                if 'INTERFACE_LINK_LIBRARIES' in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['INTERFACE_LINK_LIBRARIES'] if x]
-
-                if 'IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg) in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['IMPORTED_LINK_DEPENDENT_LIBRARIES_{}'.format(cfg)] if x]
-                elif 'IMPORTED_LINK_DEPENDENT_LIBRARIES' in tgt.properties:
-                    otherDeps += [x for x in tgt.properties['IMPORTED_LINK_DEPENDENT_LIBRARIES'] if x]
-
-                for j in otherDeps:
-                    if j in self.traceparser.targets:
-                        targets += [j]
-                    elif reg_is_lib.match(j):
-                        libraries += [j]
-                    elif os.path.isabs(j) and os.path.exists(j):
-                        libraries += [j]
-                    elif mesonlib.is_windows() and reg_is_maybe_bare_lib.match(j):
-                        # On Windows, CMake library dependencies can be passed as bare library names,
-                        # e.g. 'version' should translate into 'version.lib'. CMake brute-forces a
-                        # combination of prefix/suffix combinations to find the right library, however
-                        # as we do not have a compiler environment available to us, we cannot do the
-                        # same, but must assume any bare argument passed which is not also a CMake
-                        # target must be a system library we should try to link against
-                        libraries += ["{}.lib".format(j)]
-                    else:
-                        mlog.warning('CMake: Dependency', mlog.bold(j), 'for', mlog.bold(name), 'target', mlog.bold(self._original_module_name(curr)), 'was not found')
-
-                processed_targets += [curr]
-
-        # Make sure all elements in the lists are unique and sorted
-        incDirs = sorted(set(incDirs))
-        compileDefinitions = sorted(set(compileDefinitions))
-        compileOptions = sorted(set(compileOptions))
-        libraries = sorted(set(libraries))
-
-        mlog.debug('Include Dirs:         {}'.format(incDirs))
-        mlog.debug('Compiler Definitions: {}'.format(compileDefinitions))
-        mlog.debug('Compiler Options:     {}'.format(compileOptions))
-        mlog.debug('Libraries:            {}'.format(libraries))
-
-        self.compile_args = compileOptions + compileDefinitions + ['-I{}'.format(x) for x in incDirs]
-        self.link_args = libraries
-
-    def _get_build_dir(self) -> str:
-        build_dir = Path(self.cmake_root_dir) / 'cmake_{}'.format(self.name)
-        build_dir.mkdir(parents=True, exist_ok=True)
-        return str(build_dir)
-
-    def _setup_cmake_dir(self, cmake_file: str) -> str:
-        # Setup the CMake build environment and return the "build" directory
-        build_dir = self._get_build_dir()
-
-        # Insert language parameters into the CMakeLists.txt and write new CMakeLists.txt
-        cmake_txt = mesondata['dependencies/data/' + cmake_file].data
-
-        # In general, some Fortran CMake find_package() also require C language enabled,
-        # even if nothing from C is directly used. An easy Fortran example that fails
-        # without C language is
-        #   find_package(Threads)
-        # To make this general to
-        # any other language that might need this, we use a list for all
-        # languages and expand in the cmake Project(... LANGUAGES ...) statement.
-        from ..cmake import language_map
-        cmake_language = [language_map[x] for x in self.language_list if x in language_map]
-        if not cmake_language:
-            cmake_language += ['NONE']
-
-        cmake_txt = """
-cmake_minimum_required(VERSION ${{CMAKE_VERSION}})
-project(MesonTemp LANGUAGES {})
-""".format(' '.join(cmake_language)) + cmake_txt
-
-        cm_file = Path(build_dir) / 'CMakeLists.txt'
-        cm_file.write_text(cmake_txt)
-        mlog.cmd_ci_include(cm_file.absolute().as_posix())
-
-        return build_dir
-
-    def _call_cmake(self, args, cmake_file: str, env=None):
-        build_dir = self._setup_cmake_dir(cmake_file)
-        return self.cmakebin.call_with_fake_build(args, build_dir, env=env)
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.CMAKE]
-
-    def log_tried(self):
-        return self.type_name
-
-    def log_details(self) -> str:
-        modules = [self._original_module_name(x) for x in self.found_modules]
-        modules = sorted(set(modules))
-        if modules:
-            return 'modules: ' + ', '.join(modules)
-        return ''
-
-    def get_variable(self, *, cmake: T.Optional[str] = None, pkgconfig: T.Optional[str] = None,
-                     configtool: T.Optional[str] = None, internal: T.Optional[str] = None,
-                     default_value: T.Optional[str] = None,
-                     pkgconfig_define: T.Optional[T.List[str]] = None) -> T.Union[str, T.List[str]]:
-        if cmake and self.traceparser is not None:
-            try:
-                v = self.traceparser.vars[cmake]
-            except KeyError:
-                pass
-            else:
-                if len(v) == 1:
-                    return v[0]
-                elif v:
-                    return v
-        if default_value is not None:
-            return default_value
-        raise DependencyException('Could not get cmake variable and no default provided for {!r}'.format(self))
-
-class DubDependency(ExternalDependency):
-    class_dubbin = None
-
-    def __init__(self, name, environment, kwargs):
-        super().__init__('dub', environment, kwargs, language='d')
-        self.name = name
-        self.compiler = super().get_compiler()
-        self.module_path = None
-
-        if 'required' in kwargs:
-            self.required = kwargs.get('required')
-
-        if DubDependency.class_dubbin is None:
-            self.dubbin = self._check_dub()
-            DubDependency.class_dubbin = self.dubbin
-        else:
-            self.dubbin = DubDependency.class_dubbin
-
-        if not self.dubbin:
-            if self.required:
-                raise DependencyException('DUB not found.')
-            self.is_found = False
-            return
-
-        mlog.debug('Determining dependency {!r} with DUB executable '
-                   '{!r}'.format(name, self.dubbin.get_path()))
-
-        # we need to know the target architecture
-        arch = self.compiler.arch
-
-        # Ask dub for the package
-        ret, res = self._call_dubbin(['describe', name, '--arch=' + arch])
-
-        if ret != 0:
-            self.is_found = False
-            return
-
-        comp = self.compiler.get_id().replace('llvm', 'ldc').replace('gcc', 'gdc')
-        packages = []
-        description = json.loads(res)
-        for package in description['packages']:
-            packages.append(package['name'])
-            if package['name'] == name:
-                self.is_found = True
-
-                not_lib = True
-                if 'targetType' in package:
-                    if package['targetType'] in ['library', 'sourceLibrary', 'staticLibrary', 'dynamicLibrary']:
-                        not_lib = False
-
-                if not_lib:
-                    mlog.error(mlog.bold(name), "found but it isn't a library")
-                    self.is_found = False
-                    return
-
-                self.module_path = self._find_right_lib_path(package['path'], comp, description, True, package['targetFileName'])
-                if not os.path.exists(self.module_path):
-                    # check if the dependency was built for other archs
-                    archs = [['x86_64'], ['x86'], ['x86', 'x86_mscoff']]
-                    for a in archs:
-                        description_a = copy.deepcopy(description)
-                        description_a['architecture'] = a
-                        arch_module_path = self._find_right_lib_path(package['path'], comp, description_a, True, package['targetFileName'])
-                        if arch_module_path:
-                            mlog.error(mlog.bold(name), "found but it wasn't compiled for", mlog.bold(arch))
-                            self.is_found = False
-                            return
-
-                    mlog.error(mlog.bold(name), "found but it wasn't compiled with", mlog.bold(comp))
-                    self.is_found = False
-                    return
-
-                self.version = package['version']
-                self.pkg = package
-
-        if self.pkg['targetFileName'].endswith('.a'):
-            self.static = True
-
-        self.compile_args = []
-        for flag in self.pkg['dflags']:
-            self.link_args.append(flag)
-        for path in self.pkg['importPaths']:
-            self.compile_args.append('-I' + os.path.join(self.pkg['path'], path))
-
-        self.link_args = self.raw_link_args = []
-        for flag in self.pkg['lflags']:
-            self.link_args.append(flag)
-
-        self.link_args.append(os.path.join(self.module_path, self.pkg['targetFileName']))
-
-        # Handle dependencies
-        libs = []
-
-        def add_lib_args(field_name, target):
-            if field_name in target['buildSettings']:
-                for lib in target['buildSettings'][field_name]:
-                    if lib not in libs:
-                        libs.append(lib)
-                        if os.name != 'nt':
-                            pkgdep = PkgConfigDependency(lib, environment, {'required': 'true', 'silent': 'true'})
-                            for arg in pkgdep.get_compile_args():
-                                self.compile_args.append(arg)
-                            for arg in pkgdep.get_link_args():
-                                self.link_args.append(arg)
-                            for arg in pkgdep.get_link_args(raw=True):
-                                self.raw_link_args.append(arg)
-
-        for target in description['targets']:
-            if target['rootPackage'] in packages:
-                add_lib_args('libs', target)
-                add_lib_args('libs-{}'.format(platform.machine()), target)
-                for file in target['buildSettings']['linkerFiles']:
-                    lib_path = self._find_right_lib_path(file, comp, description)
-                    if lib_path:
-                        self.link_args.append(lib_path)
-                    else:
-                        self.is_found = False
-
-    def get_compiler(self):
-        return self.compiler
-
-    def _find_right_lib_path(self, default_path, comp, description, folder_only=False, file_name=''):
-        module_path = lib_file_name = ''
-        if folder_only:
-            module_path = default_path
-            lib_file_name = file_name
-        else:
-            module_path = os.path.dirname(default_path)
-            lib_file_name = os.path.basename(default_path)
-        module_build_path = os.path.join(module_path, '.dub', 'build')
-
-        # If default_path is a path to lib file and
-        # directory of lib don't have subdir '.dub/build'
-        if not os.path.isdir(module_build_path) and os.path.isfile(default_path):
-            if folder_only:
-                return module_path
-            else:
-                return default_path
-
-        # Get D version implemented in the compiler
-        # gdc doesn't support this
-        ret, res = self._call_dubbin(['--version'])
-
-        if ret != 0:
-            mlog.error('Failed to run {!r}', mlog.bold(comp))
-            return
-
-        d_ver = re.search('v[0-9].[0-9][0-9][0-9].[0-9]', res) # Ex.: v2.081.2
-        if d_ver is not None:
-            d_ver = d_ver.group().rsplit('.', 1)[0].replace('v', '').replace('.', '') # Fix structure. Ex.: 2081
-        else:
-            d_ver = '' # gdc
-
-        if not os.path.isdir(module_build_path):
-            return ''
-
-        # Ex.: library-debug-linux.posix-x86_64-ldc_2081-EF934983A3319F8F8FF2F0E107A363BA
-        build_name = '-{}-{}-{}-{}_{}'.format(description['buildType'], '.'.join(description['platform']), '.'.join(description['architecture']), comp, d_ver)
-        for entry in os.listdir(module_build_path):
-            if build_name in entry:
-                for file in os.listdir(os.path.join(module_build_path, entry)):
-                    if file == lib_file_name:
-                        if folder_only:
-                            return os.path.join(module_build_path, entry)
-                        else:
-                            return os.path.join(module_build_path, entry, lib_file_name)
-
-        return ''
-
-    def _call_dubbin(self, args, env=None):
-        p, out = Popen_safe(self.dubbin.get_command() + args, env=env)[0:2]
-        return p.returncode, out.strip()
-
-    def _call_copmbin(self, args, env=None):
-        p, out = Popen_safe(self.compiler.get_exelist() + args, env=env)[0:2]
-        return p.returncode, out.strip()
-
-    def _check_dub(self):
-        dubbin = ExternalProgram('dub', silent=True)
-        if dubbin.found():
-            try:
-                p, out = Popen_safe(dubbin.get_command() + ['--version'])[0:2]
-                if p.returncode != 0:
-                    mlog.warning('Found dub {!r} but couldn\'t run it'
-                                 ''.format(' '.join(dubbin.get_command())))
-                    # Set to False instead of None to signify that we've already
-                    # searched for it and not found it
-                    dubbin = False
-            except (FileNotFoundError, PermissionError):
-                dubbin = False
-        else:
-            dubbin = False
-        if dubbin:
-            mlog.log('Found DUB:', mlog.bold(dubbin.get_path()),
-                     '(%s)' % out.strip())
-        else:
-            mlog.log('Found DUB:', mlog.red('NO'))
-        return dubbin
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.DUB]
-
-class ExternalProgram:
-    windows_exts = ('exe', 'msc', 'com', 'bat', 'cmd')
-    # An 'ExternalProgram' always runs on the build machine
-    for_machine = MachineChoice.BUILD
-
-    def __init__(self, name: str, command: T.Optional[T.List[str]] = None,
-                 silent: bool = False, search_dir: T.Optional[str] = None,
-                 extra_search_dirs: T.Optional[T.List[str]] = None):
-        self.name = name
-        if command is not None:
-            self.command = listify(command)
-            if mesonlib.is_windows():
-                cmd = self.command[0]
-                args = self.command[1:]
-                # Check whether the specified cmd is a path to a script, in
-                # which case we need to insert the interpreter. If not, try to
-                # use it as-is.
-                ret = self._shebang_to_cmd(cmd)
-                if ret:
-                    self.command = ret + args
-                else:
-                    self.command = [cmd] + args
-        else:
-            all_search_dirs = [search_dir]
-            if extra_search_dirs:
-                all_search_dirs += extra_search_dirs
-            for d in all_search_dirs:
-                self.command = self._search(name, d)
-                if self.found():
-                    break
-
-        # Set path to be the last item that is actually a file (in order to
-        # skip options in something like ['python', '-u', 'file.py']. If we
-        # can't find any components, default to the last component of the path.
-        self.path = self.command[-1]
-        for i in range(len(self.command) - 1, -1, -1):
-            arg = self.command[i]
-            if arg is not None and os.path.isfile(arg):
-                self.path = arg
-                break
-
-        if not silent:
-            # ignore the warning because derived classes never call this __init__
-            # method, and thus only the found() method of this class is ever executed
-            if self.found():  # lgtm [py/init-calls-subclass]
-                mlog.log('Program', mlog.bold(name), 'found:', mlog.green('YES'),
-                         '(%s)' % ' '.join(self.command))
-            else:
-                mlog.log('Program', mlog.bold(name), 'found:', mlog.red('NO'))
-
-    def __repr__(self) -> str:
-        r = '<{} {!r} -> {!r}>'
-        return r.format(self.__class__.__name__, self.name, self.command)
-
-    def description(self) -> str:
-        '''Human friendly description of the command'''
-        return ' '.join(self.command)
-
-    @classmethod
-    def from_bin_list(cls, env: Environment, for_machine: MachineChoice, name):
-        # There is a static `for_machine` for this class because the binary
-        # aways runs on the build platform. (It's host platform is our build
-        # platform.) But some external programs have a target platform, so this
-        # is what we are specifying here.
-        command = env.lookup_binary_entry(for_machine, name)
-        if command is None:
-            return NonExistingExternalProgram()
-        return cls.from_entry(name, command)
-
-    @staticmethod
-    @functools.lru_cache(maxsize=None)
-    def _windows_sanitize_path(path: str) -> str:
-        # Ensure that we use USERPROFILE even when inside MSYS, MSYS2, Cygwin, etc.
-        if 'USERPROFILE' not in os.environ:
-            return path
-        # The WindowsApps directory is a bit of a problem. It contains
-        # some zero-sized .exe files which have "reparse points", that
-        # might either launch an installed application, or might open
-        # a page in the Windows Store to download the application.
-        #
-        # To handle the case where the python interpreter we're
-        # running on came from the Windows Store, if we see the
-        # WindowsApps path in the search path, replace it with
-        # dirname(sys.executable).
-        appstore_dir = Path(os.environ['USERPROFILE']) / 'AppData' / 'Local' / 'Microsoft' / 'WindowsApps'
-        paths = []
-        for each in path.split(os.pathsep):
-            if Path(each) != appstore_dir:
-                paths.append(each)
-            elif 'WindowsApps' in sys.executable:
-                paths.append(os.path.dirname(sys.executable))
-        return os.pathsep.join(paths)
-
-    @staticmethod
-    def from_entry(name, command):
-        if isinstance(command, list):
-            if len(command) == 1:
-                command = command[0]
-        # We cannot do any searching if the command is a list, and we don't
-        # need to search if the path is an absolute path.
-        if isinstance(command, list) or os.path.isabs(command):
-            return ExternalProgram(name, command=command, silent=True)
-        assert isinstance(command, str)
-        # Search for the command using the specified string!
-        return ExternalProgram(command, silent=True)
-
-    @staticmethod
-    def _shebang_to_cmd(script: str) -> T.Optional[list]:
-        """
-        Check if the file has a shebang and manually parse it to figure out
-        the interpreter to use. This is useful if the script is not executable
-        or if we're on Windows (which does not understand shebangs).
-        """
-        try:
-            with open(script) as f:
-                first_line = f.readline().strip()
-            if first_line.startswith('#!'):
-                # In a shebang, everything before the first space is assumed to
-                # be the command to run and everything after the first space is
-                # the single argument to pass to that command. So we must split
-                # exactly once.
-                commands = first_line[2:].split('#')[0].strip().split(maxsplit=1)
-                if mesonlib.is_windows():
-                    # Windows does not have UNIX paths so remove them,
-                    # but don't remove Windows paths
-                    if commands[0].startswith('/'):
-                        commands[0] = commands[0].split('/')[-1]
-                    if len(commands) > 0 and commands[0] == 'env':
-                        commands = commands[1:]
-                    # Windows does not ship python3.exe, but we know the path to it
-                    if len(commands) > 0 and commands[0] == 'python3':
-                        commands = mesonlib.python_command + commands[1:]
-                elif mesonlib.is_haiku():
-                    # Haiku does not have /usr, but a lot of scripts assume that
-                    # /usr/bin/env always exists. Detect that case and run the
-                    # script with the interpreter after it.
-                    if commands[0] == '/usr/bin/env':
-                        commands = commands[1:]
-                    # We know what python3 is, we're running on it
-                    if len(commands) > 0 and commands[0] == 'python3':
-                        commands = mesonlib.python_command + commands[1:]
-                else:
-                    # Replace python3 with the actual python3 that we are using
-                    if commands[0] == '/usr/bin/env' and commands[1] == 'python3':
-                        commands = mesonlib.python_command + commands[2:]
-                    elif commands[0].split('/')[-1] == 'python3':
-                        commands = mesonlib.python_command + commands[1:]
-                return commands + [script]
-        except Exception as e:
-            mlog.debug(e)
-        mlog.debug('Unusable script {!r}'.format(script))
-        return None
-
-    def _is_executable(self, path):
-        suffix = os.path.splitext(path)[-1].lower()[1:]
-        execmask = stat.S_IXUSR | stat.S_IXGRP | stat.S_IXOTH
-        if mesonlib.is_windows():
-            if suffix in self.windows_exts:
-                return True
-        elif os.stat(path).st_mode & execmask:
-            return not os.path.isdir(path)
-        return False
-
-    def _search_dir(self, name: str, search_dir: T.Optional[str]) -> T.Optional[list]:
-        if search_dir is None:
-            return None
-        trial = os.path.join(search_dir, name)
-        if os.path.exists(trial):
-            if self._is_executable(trial):
-                return [trial]
-            # Now getting desperate. Maybe it is a script file that is
-            # a) not chmodded executable, or
-            # b) we are on windows so they can't be directly executed.
-            return self._shebang_to_cmd(trial)
-        else:
-            if mesonlib.is_windows():
-                for ext in self.windows_exts:
-                    trial_ext = '{}.{}'.format(trial, ext)
-                    if os.path.exists(trial_ext):
-                        return [trial_ext]
-        return None
-
-    def _search_windows_special_cases(self, name: str, command: str) -> list:
-        '''
-        Lots of weird Windows quirks:
-        1. PATH search for @name returns files with extensions from PATHEXT,
-           but only self.windows_exts are executable without an interpreter.
-        2. @name might be an absolute path to an executable, but without the
-           extension. This works inside MinGW so people use it a lot.
-        3. The script is specified without an extension, in which case we have
-           to manually search in PATH.
-        4. More special-casing for the shebang inside the script.
-        '''
-        if command:
-            # On Windows, even if the PATH search returned a full path, we can't be
-            # sure that it can be run directly if it's not a native executable.
-            # For instance, interpreted scripts sometimes need to be run explicitly
-            # with an interpreter if the file association is not done properly.
-            name_ext = os.path.splitext(command)[1]
-            if name_ext[1:].lower() in self.windows_exts:
-                # Good, it can be directly executed
-                return [command]
-            # Try to extract the interpreter from the shebang
-            commands = self._shebang_to_cmd(command)
-            if commands:
-                return commands
-            return [None]
-        # Maybe the name is an absolute path to a native Windows
-        # executable, but without the extension. This is technically wrong,
-        # but many people do it because it works in the MinGW shell.
-        if os.path.isabs(name):
-            for ext in self.windows_exts:
-                command = '{}.{}'.format(name, ext)
-                if os.path.exists(command):
-                    return [command]
-        # On Windows, interpreted scripts must have an extension otherwise they
-        # cannot be found by a standard PATH search. So we do a custom search
-        # where we manually search for a script with a shebang in PATH.
-        search_dirs = self._windows_sanitize_path(os.environ.get('PATH', '')).split(';')
-        for search_dir in search_dirs:
-            commands = self._search_dir(name, search_dir)
-            if commands:
-                return commands
-        return [None]
-
-    def _search(self, name: str, search_dir: T.Optional[str]) -> list:
-        '''
-        Search in the specified dir for the specified executable by name
-        and if not found search in PATH
-        '''
-        commands = self._search_dir(name, search_dir)
-        if commands:
-            return commands
-        # Do a standard search in PATH
-        path = os.environ.get('PATH', None)
-        if mesonlib.is_windows() and path:
-            path = self._windows_sanitize_path(path)
-        command = shutil.which(name, path=path)
-        if mesonlib.is_windows():
-            return self._search_windows_special_cases(name, command)
-        # On UNIX-like platforms, shutil.which() is enough to find
-        # all executables whether in PATH or with an absolute path
-        return [command]
-
-    def found(self) -> bool:
-        return self.command[0] is not None
-
-    def get_command(self):
-        return self.command[:]
-
-    def get_path(self):
-        return self.path
-
-    def get_name(self):
-        return self.name
-
-
-class NonExistingExternalProgram(ExternalProgram):  # lgtm [py/missing-call-to-init]
-    "A program that will never exist"
-
-    def __init__(self, name='nonexistingprogram'):
-        self.name = name
-        self.command = [None]
-        self.path = None
-
-    def __repr__(self):
-        r = '<{} {!r} -> {!r}>'
-        return r.format(self.__class__.__name__, self.name, self.command)
-
-    def found(self):
-        return False
-
-
-class EmptyExternalProgram(ExternalProgram):  # lgtm [py/missing-call-to-init]
-    '''
-    A program object that returns an empty list of commands. Used for cases
-    such as a cross file exe_wrapper to represent that it's not required.
-    '''
-
-    def __init__(self):
-        self.name = None
-        self.command = []
-        self.path = None
-
-    def __repr__(self):
-        r = '<{} {!r} -> {!r}>'
-        return r.format(self.__class__.__name__, self.name, self.command)
-
-    def found(self):
-        return True
-
-
-class ExternalLibrary(ExternalDependency):
-    def __init__(self, name, link_args, environment, language, silent=False):
-        super().__init__('library', environment, {}, language=language)
-        self.name = name
-        self.language = language
-        self.is_found = False
-        if link_args:
-            self.is_found = True
-            self.link_args = link_args
-        if not silent:
-            if self.is_found:
-                mlog.log('Library', mlog.bold(name), 'found:', mlog.green('YES'))
-            else:
-                mlog.log('Library', mlog.bold(name), 'found:', mlog.red('NO'))
-
-    def get_link_args(self, language=None, **kwargs):
-        '''
-        External libraries detected using a compiler must only be used with
-        compatible code. For instance, Vala libraries (.vapi files) cannot be
-        used with C code, and not all Rust library types can be linked with
-        C-like code. Note that C++ libraries *can* be linked with C code with
-        a C++ linker (and vice-versa).
-        '''
-        # Using a vala library in a non-vala target, or a non-vala library in a vala target
-        # XXX: This should be extended to other non-C linkers such as Rust
-        if (self.language == 'vala' and language != 'vala') or \
-           (language == 'vala' and self.language != 'vala'):
-            return []
-        return super().get_link_args(**kwargs)
-
-    def get_partial_dependency(self, *, compile_args: bool = False,
-                               link_args: bool = False, links: bool = False,
-                               includes: bool = False, sources: bool = False):
-        # External library only has link_args, so ignore the rest of the
-        # interface.
-        new = copy.copy(self)
-        if not link_args:
-            new.link_args = []
-        return new
-
-
-class ExtraFrameworkDependency(ExternalDependency):
-    system_framework_paths = None
-
-    def __init__(self, name, env, kwargs, language: T.Optional[str] = None):
-        paths = kwargs.get('paths', [])
-        super().__init__('extraframeworks', env, kwargs, language=language)
-        self.name = name
-        # Full path to framework directory
-        self.framework_path = None
-        if not self.clib_compiler:
-            raise DependencyException('No C-like compilers are available')
-        if self.system_framework_paths is None:
-            try:
-                self.system_framework_paths = self.clib_compiler.find_framework_paths(self.env)
-            except MesonException as e:
-                if 'non-clang' in str(e):
-                    # Apple frameworks can only be found (and used) with the
-                    # system compiler. It is not available so bail immediately.
-                    self.is_found = False
-                    return
-                raise
-        self.detect(name, paths)
-
-    def detect(self, name, paths):
-        if not paths:
-            paths = self.system_framework_paths
-        for p in paths:
-            mlog.debug('Looking for framework {} in {}'.format(name, p))
-            # We need to know the exact framework path because it's used by the
-            # Qt5 dependency class, and for setting the include path. We also
-            # want to avoid searching in an invalid framework path which wastes
-            # time and can cause a false positive.
-            framework_path = self._get_framework_path(p, name)
-            if framework_path is None:
-                continue
-            # We want to prefer the specified paths (in order) over the system
-            # paths since these are "extra" frameworks.
-            # For example, Python2's framework is in /System/Library/Frameworks and
-            # Python3's framework is in /Library/Frameworks, but both are called
-            # Python.framework. We need to know for sure that the framework was
-            # found in the path we expect.
-            allow_system = p in self.system_framework_paths
-            args = self.clib_compiler.find_framework(name, self.env, [p], allow_system)
-            if args is None:
-                continue
-            self.link_args = args
-            self.framework_path = framework_path.as_posix()
-            self.compile_args = ['-F' + self.framework_path]
-            # We need to also add -I includes to the framework because all
-            # cross-platform projects such as OpenGL, Python, Qt, GStreamer,
-            # etc do not use "framework includes":
-            # https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPFrameworks/Tasks/IncludingFrameworks.html
-            incdir = self._get_framework_include_path(framework_path)
-            if incdir:
-                self.compile_args += ['-I' + incdir]
-            self.is_found = True
-            return
-
-    def _get_framework_path(self, path, name):
-        p = Path(path)
-        lname = name.lower()
-        for d in p.glob('*.framework/'):
-            if lname == d.name.rsplit('.', 1)[0].lower():
-                return d
-        return None
-
-    def _get_framework_latest_version(self, path):
-        versions = []
-        for each in path.glob('Versions/*'):
-            # macOS filesystems are usually case-insensitive
-            if each.name.lower() == 'current':
-                continue
-            versions.append(Version(each.name))
-        if len(versions) == 0:
-            # most system frameworks do not have a 'Versions' directory
-            return 'Headers'
-        return 'Versions/{}/Headers'.format(sorted(versions)[-1]._s)
-
-    def _get_framework_include_path(self, path):
-        # According to the spec, 'Headers' must always be a symlink to the
-        # Headers directory inside the currently-selected version of the
-        # framework, but sometimes frameworks are broken. Look in 'Versions'
-        # for the currently-selected version or pick the latest one.
-        trials = ('Headers', 'Versions/Current/Headers',
-                  self._get_framework_latest_version(path))
-        for each in trials:
-            trial = path / each
-            if trial.is_dir():
-                return trial.as_posix()
-        return None
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.EXTRAFRAMEWORK]
-
-    def log_info(self):
-        return self.framework_path
-
-    def log_tried(self):
-        return 'framework'
-
-
-class DependencyFactory:
-
-    """Factory to get dependencies from multiple sources.
-
-    This class provides an initializer that takes a set of names and classes
-    for various kinds of dependencies. When the initialized object is called
-    it returns a list of callables return Dependency objects to try in order.
-
-    :name: The name of the dependency. This will be passed as the name
-        parameter of the each dependency unless it is overridden on a per
-        type basis.
-    :methods: An ordered list of DependencyMethods. This is the order
-        dependencies will be returned in unless they are removed by the
-        _process_method function
-    :*_name: This will overwrite the name passed to the coresponding class.
-        For example, if the name is 'zlib', but cmake calls the dependency
-        'Z', then using `cmake_name='Z'` will pass the name as 'Z' to cmake.
-    :*_class: A *type* or callable that creates a class, and has the
-        signature of an ExternalDependency
-    :system_class: If you pass DependencyMethods.SYSTEM in methods, you must
-        set this argument.
-    """
-
-    def __init__(self, name: str, methods: T.List[DependencyMethods], *,
-                 extra_kwargs: T.Optional[T.Dict[str, T.Any]] = None,
-                 pkgconfig_name: T.Optional[str] = None,
-                 pkgconfig_class: 'T.Type[PkgConfigDependency]' = PkgConfigDependency,
-                 cmake_name: T.Optional[str] = None,
-                 cmake_class: 'T.Type[CMakeDependency]' = CMakeDependency,
-                 configtool_class: 'T.Optional[T.Type[ConfigToolDependency]]' = None,
-                 framework_name: T.Optional[str] = None,
-                 framework_class: 'T.Type[ExtraFrameworkDependency]' = ExtraFrameworkDependency,
-                 system_class: 'T.Type[ExternalDependency]' = ExternalDependency):
-
-        if DependencyMethods.CONFIG_TOOL in methods and not configtool_class:
-            raise DependencyException('A configtool must have a custom class')
-
-        self.extra_kwargs = extra_kwargs or {}
-        self.methods = methods
-        self.classes = {
-            # Just attach the correct name right now, either the generic name
-            # or the method specific name.
-            DependencyMethods.EXTRAFRAMEWORK: functools.partial(framework_class, framework_name or name),
-            DependencyMethods.PKGCONFIG: functools.partial(pkgconfig_class, pkgconfig_name or name),
-            DependencyMethods.CMAKE: functools.partial(cmake_class, cmake_name or name),
-            DependencyMethods.SYSTEM: functools.partial(system_class, name),
-            DependencyMethods.CONFIG_TOOL: None,
-        }
-        if configtool_class is not None:
-            self.classes[DependencyMethods.CONFIG_TOOL] = functools.partial(configtool_class, name)
-
-    @staticmethod
-    def _process_method(method: DependencyMethods, env: Environment, for_machine: MachineChoice) -> bool:
-        """Report whether a method is valid or not.
-
-        If the method is valid, return true, otherwise return false. This is
-        used in a list comprehension to filter methods that are not possible.
-
-        By default this only remove EXTRAFRAMEWORK dependencies for non-mac platforms.
-        """
-        # Extra frameworks are only valid for macOS and other apple products
-        if (method is DependencyMethods.EXTRAFRAMEWORK and
-                not env.machines[for_machine].is_darwin()):
-            return False
-        return True
-
-    def __call__(self, env: Environment, for_machine: MachineChoice,
-                 kwargs: T.Dict[str, T.Any]) -> T.List['DependencyType']:
-        """Return a list of Dependencies with the arguments already attached."""
-        methods = process_method_kw(self.methods, kwargs)
-        nwargs = self.extra_kwargs.copy()
-        nwargs.update(kwargs)
-
-        return [functools.partial(self.classes[m], env, nwargs) for m in methods
-                if self._process_method(m, env, for_machine)]
-
-
-def get_dep_identifier(name, kwargs) -> T.Tuple:
-    identifier = (name, )
-    for key, value in kwargs.items():
-        # 'version' is irrelevant for caching; the caller must check version matches
-        # 'native' is handled above with `for_machine`
-        # 'required' is irrelevant for caching; the caller handles it separately
-        # 'fallback' subprojects cannot be cached -- they must be initialized
-        # 'default_options' is only used in fallback case
-        if key in ('version', 'native', 'required', 'fallback', 'default_options'):
-            continue
-        # All keyword arguments are strings, ints, or lists (or lists of lists)
-        if isinstance(value, list):
-            value = frozenset(listify(value))
-        identifier += (key, value)
-    return identifier
-
-display_name_map = {
-    'boost': 'Boost',
-    'cuda': 'CUDA',
-    'dub': 'DUB',
-    'gmock': 'GMock',
-    'gtest': 'GTest',
-    'hdf5': 'HDF5',
-    'llvm': 'LLVM',
-    'mpi': 'MPI',
-    'netcdf': 'NetCDF',
-    'openmp': 'OpenMP',
-    'wxwidgets': 'WxWidgets',
-}
-
-def find_external_dependency(name, env, kwargs):
-    assert(name)
-    required = kwargs.get('required', True)
-    if not isinstance(required, bool):
-        raise DependencyException('Keyword "required" must be a boolean.')
-    if not isinstance(kwargs.get('method', ''), str):
-        raise DependencyException('Keyword "method" must be a string.')
-    lname = name.lower()
-    if lname not in _packages_accept_language and 'language' in kwargs:
-        raise DependencyException('%s dependency does not accept "language" keyword argument' % (name, ))
-    if not isinstance(kwargs.get('version', ''), (str, list)):
-        raise DependencyException('Keyword "Version" must be string or list.')
-
-    # display the dependency name with correct casing
-    display_name = display_name_map.get(lname, lname)
-
-    for_machine = MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST
-
-    type_text = PerMachine('Build-time', 'Run-time')[for_machine] + ' dependency'
-
-    # build a list of dependency methods to try
-    candidates = _build_external_dependency_list(name, env, for_machine, kwargs)
-
-    pkg_exc = []
-    pkgdep = []
-    details = ''
-
-    for c in candidates:
-        # try this dependency method
-        try:
-            d = c()
-            d._check_version()
-            pkgdep.append(d)
-        except DependencyException as e:
-            pkg_exc.append(e)
-            mlog.debug(str(e))
-        else:
-            pkg_exc.append(None)
-            details = d.log_details()
-            if details:
-                details = '(' + details + ') '
-            if 'language' in kwargs:
-                details += 'for ' + d.language + ' '
-
-            # if the dependency was found
-            if d.found():
-
-                info = []
-                if d.version:
-                    info.append(mlog.normal_cyan(d.version))
-
-                log_info = d.log_info()
-                if log_info:
-                    info.append('(' + log_info + ')')
-
-                mlog.log(type_text, mlog.bold(display_name), details + 'found:', mlog.green('YES'), *info)
-
-                return d
-
-    # otherwise, the dependency could not be found
-    tried_methods = [d.log_tried() for d in pkgdep if d.log_tried()]
-    if tried_methods:
-        tried = '{}'.format(mlog.format_list(tried_methods))
-    else:
-        tried = ''
-
-    mlog.log(type_text, mlog.bold(display_name), details + 'found:', mlog.red('NO'),
-             '(tried {})'.format(tried) if tried else '')
-
-    if required:
-        # if an exception occurred with the first detection method, re-raise it
-        # (on the grounds that it came from the preferred dependency detection
-        # method)
-        if pkg_exc and pkg_exc[0]:
-            raise pkg_exc[0]
-
-        # we have a list of failed ExternalDependency objects, so we can report
-        # the methods we tried to find the dependency
-        raise DependencyException('Dependency "%s" not found' % (name) +
-                                  (', tried %s' % (tried) if tried else ''))
-
-    return NotFoundDependency(env)
-
-
-def _build_external_dependency_list(name: str, env: Environment, for_machine: MachineChoice,
-                                    kwargs: T.Dict[str, T.Any]) -> T.List['DependencyType']:
-    # First check if the method is valid
-    if 'method' in kwargs and kwargs['method'] not in [e.value for e in DependencyMethods]:
-        raise DependencyException('method {!r} is invalid'.format(kwargs['method']))
-
-    # Is there a specific dependency detector for this dependency?
-    lname = name.lower()
-    if lname in packages:
-        # Create the list of dependency object constructors using a factory
-        # class method, if one exists, otherwise the list just consists of the
-        # constructor
-        if isinstance(packages[lname], type) and issubclass(packages[lname], Dependency):
-            dep = [functools.partial(packages[lname], env, kwargs)]
-        else:
-            dep = packages[lname](env, for_machine, kwargs)
-        return dep
-
-    candidates = []
-
-    # If it's explicitly requested, use the dub detection method (only)
-    if 'dub' == kwargs.get('method', ''):
-        candidates.append(functools.partial(DubDependency, name, env, kwargs))
-        return candidates
-
-    # If it's explicitly requested, use the pkgconfig detection method (only)
-    if 'pkg-config' == kwargs.get('method', ''):
-        candidates.append(functools.partial(PkgConfigDependency, name, env, kwargs))
-        return candidates
-
-    # If it's explicitly requested, use the CMake detection method (only)
-    if 'cmake' == kwargs.get('method', ''):
-        candidates.append(functools.partial(CMakeDependency, name, env, kwargs))
-        return candidates
-
-    # If it's explicitly requested, use the Extraframework detection method (only)
-    if 'extraframework' == kwargs.get('method', ''):
-        # On OSX, also try framework dependency detector
-        if mesonlib.is_osx():
-            candidates.append(functools.partial(ExtraFrameworkDependency, name, env, kwargs))
-        return candidates
-
-    # Otherwise, just use the pkgconfig and cmake dependency detector
-    if 'auto' == kwargs.get('method', 'auto'):
-        candidates.append(functools.partial(PkgConfigDependency, name, env, kwargs))
-
-        # On OSX, also try framework dependency detector
-        if mesonlib.is_osx():
-            candidates.append(functools.partial(ExtraFrameworkDependency, name, env, kwargs))
-
-        # Only use CMake as a last resort, since it might not work 100% (see #6113)
-        candidates.append(functools.partial(CMakeDependency, name, env, kwargs))
-
-    return candidates
-
-
-def sort_libpaths(libpaths: T.List[str], refpaths: T.List[str]) -> T.List[str]:
-    """Sort <libpaths> according to <refpaths>
-
-    It is intended to be used to sort -L flags returned by pkg-config.
-    Pkg-config returns flags in random order which cannot be relied on.
-    """
-    if len(refpaths) == 0:
-        return list(libpaths)
-
-    def key_func(libpath):
-        common_lengths = []
-        for refpath in refpaths:
-            try:
-                common_path = os.path.commonpath([libpath, refpath])
-            except ValueError:
-                common_path = ''
-            common_lengths.append(len(common_path))
-        max_length = max(common_lengths)
-        max_index = common_lengths.index(max_length)
-        reversed_max_length = len(refpaths[max_index]) - max_length
-        return (max_index, reversed_max_length)
-    return sorted(libpaths, key=key_func)
-
-
-def strip_system_libdirs(environment, for_machine: MachineChoice, link_args):
-    """Remove -L<system path> arguments.
-
-    leaving these in will break builds where a user has a version of a library
-    in the system path, and a different version not in the system path if they
-    want to link against the non-system path version.
-    """
-    exclude = {'-L{}'.format(p) for p in environment.get_compiler_system_dirs(for_machine)}
-    return [l for l in link_args if l not in exclude]
-
-
-def process_method_kw(possible: T.List[DependencyMethods], kwargs) -> T.List[DependencyMethods]:
-    method = kwargs.get('method', 'auto')
-    if isinstance(method, DependencyMethods):
-        return method
-    if method not in [e.value for e in DependencyMethods]:
-        raise DependencyException('method {!r} is invalid'.format(method))
-    method = DependencyMethods(method)
-
-    # This sets per-tool config methods which are deprecated to to the new
-    # generic CONFIG_TOOL value.
-    if method in [DependencyMethods.SDLCONFIG, DependencyMethods.CUPSCONFIG,
-                  DependencyMethods.PCAPCONFIG, DependencyMethods.LIBWMFCONFIG]:
-        mlog.warning(textwrap.dedent("""\
-            Configuration method {} has been deprecated in favor of
-            'config-tool'. This will be removed in a future version of
-            meson.""".format(method)))
-        method = DependencyMethods.CONFIG_TOOL
-
-    # Set the detection method. If the method is set to auto, use any available method.
-    # If method is set to a specific string, allow only that detection method.
-    if method == DependencyMethods.AUTO:
-        methods = possible
-    elif method in possible:
-        methods = [method]
-    else:
-        raise DependencyException(
-            'Unsupported detection method: {}, allowed methods are {}'.format(
-                method.value,
-                mlog.format_list([x.value for x in [DependencyMethods.AUTO] + possible])))
-
-    return methods
-
-
-if T.TYPE_CHECKING:
-    FactoryType = T.Callable[[Environment, MachineChoice, T.Dict[str, T.Any]],
-                             T.List['DependencyType']]
-    FullFactoryType = T.Callable[[Environment, MachineChoice, T.Dict[str, T.Any], T.Set[DependencyMethods]],
-                                 T.List['DependencyType']]
-
-
-def factory_methods(methods: T.Set[DependencyMethods]) -> 'FactoryType':
-    """Decorator for handling methods for dependency factory functions.
-
-    This helps to make factory functions self documenting
-    >>> @factory_methods([DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE])
-    >>> def factory(env: Environment, for_machine: MachineChoice, kwargs: T.Dict[str, T.Any], methods: T.Set[DependencyMethods]) -> T.List[DependencyType]:
-    >>>     pass
-    """
-
-    def inner(func: 'FullFactoryType') -> 'FactoryType':
-
-        @functools.wraps(func)
-        def wrapped(env: Environment, for_machine: MachineChoice, kwargs: T.Dict[str, T.Any]) -> T.List['DependencyType']:
-            return func(env, for_machine, kwargs, process_method_kw(methods, kwargs))
-
-        return wrapped
-
-    return inner
-
-
-def detect_compiler(name: str, env: Environment, for_machine: MachineChoice,
-                    language: T.Optional[str]) -> T.Optional['CompilerType']:
-    """Given a language and environment find the compiler used."""
-    compilers = env.coredata.compilers[for_machine]
-
-    # Set the compiler for this dependency if a language is specified,
-    # else try to pick something that looks usable.
-    if language:
-        if language not in compilers:
-            m = name.capitalize() + ' requires a {0} compiler, but ' \
-                '{0} is not in the list of project languages'
-            raise DependencyException(m.format(language.capitalize()))
-        return compilers[language]
-    else:
-        for lang in clib_langs:
-            try:
-                return compilers[lang]
-            except KeyError:
-                continue
-    return None
diff --git a/meson/mesonbuild/dependencies/boost.py b/meson/mesonbuild/dependencies/boost.py
deleted file mode 100644 (file)
index 907c0c2..0000000
+++ /dev/null
@@ -1,1045 +0,0 @@
-# Copyright 2013-2020 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import re
-import functools
-import typing as T
-from pathlib import Path
-
-from .. import mlog
-from .. import mesonlib
-from ..environment import Environment
-
-from .base import DependencyException, ExternalDependency, PkgConfigDependency
-from .misc import threads_factory
-
-# On windows 3 directory layouts are supported:
-# * The default layout (versioned) installed:
-#   - $BOOST_ROOT/include/boost-x_x/boost/*.hpp
-#   - $BOOST_ROOT/lib/*.lib
-# * The non-default layout (system) installed:
-#   - $BOOST_ROOT/include/boost/*.hpp
-#   - $BOOST_ROOT/lib/*.lib
-# * The pre-built binaries from sf.net:
-#   - $BOOST_ROOT/boost/*.hpp
-#   - $BOOST_ROOT/lib<arch>-<compiler>/*.lib where arch=32/64 and compiler=msvc-14.1
-#
-# Note that we should also try to support:
-# mingw-w64 / Windows : libboost_<module>-mt.a            (location = <prefix>/mingw64/lib/)
-#                       libboost_<module>-mt.dll.a
-#
-# The `modules` argument accept library names. This is because every module that
-# has libraries to link against also has multiple options regarding how to
-# link. See for example:
-# * http://www.boost.org/doc/libs/1_65_1/libs/test/doc/html/boost_test/usage_variants.html
-# * http://www.boost.org/doc/libs/1_65_1/doc/html/stacktrace/configuration_and_build.html
-# * http://www.boost.org/doc/libs/1_65_1/libs/math/doc/html/math_toolkit/main_tr1.html
-
-# **On Unix**, official packaged versions of boost libraries follow the following schemes:
-#
-# Linux / Debian:   libboost_<module>.so -> libboost_<module>.so.1.66.0
-# Linux / Red Hat:  libboost_<module>.so -> libboost_<module>.so.1.66.0
-# Linux / OpenSuse: libboost_<module>.so -> libboost_<module>.so.1.66.0
-# Win   / Cygwin:   libboost_<module>.dll.a                                 (location = /usr/lib)
-#                   libboost_<module>.a
-#                   cygboost_<module>_1_64.dll                              (location = /usr/bin)
-# Win   / VS:       boost_<module>-vc<ver>-mt[-gd]-<arch>-1_67.dll          (location = C:/local/boost_1_67_0)
-# Mac   / homebrew: libboost_<module>.dylib + libboost_<module>-mt.dylib    (location = /usr/local/lib)
-# Mac   / macports: libboost_<module>.dylib + libboost_<module>-mt.dylib    (location = /opt/local/lib)
-#
-# Its not clear that any other abi tags (e.g. -gd) are used in official packages.
-#
-# On Linux systems, boost libs have multithreading support enabled, but without the -mt tag.
-#
-# Boost documentation recommends using complex abi tags like "-lboost_regex-gcc34-mt-d-1_36".
-# (See http://www.boost.org/doc/libs/1_66_0/more/getting_started/unix-variants.html#library-naming)
-# However, its not clear that any Unix distribution follows this scheme.
-# Furthermore, the boost documentation for unix above uses examples from windows like
-#   "libboost_regex-vc71-mt-d-x86-1_34.lib", so apparently the abi tags may be more aimed at windows.
-#
-# We follow the following strategy for finding modules:
-# A) Detect potential boost root directories (uses also BOOST_ROOT env var)
-# B) Foreach candidate
-#   1. Look for the boost headers (boost/version.pp)
-#   2. Find all boost libraries
-#     2.1 Add all libraries in lib*
-#     2.2 Filter out non boost libraries
-#     2.3 Filter the renaining libraries based on the meson requirements (static/shared, etc.)
-#     2.4 Ensure that all libraries have the same boost tag (and are thus compatible)
-#   3. Select the libraries matching the requested modules
-
-@functools.total_ordering
-class BoostIncludeDir():
-    def __init__(self, path: Path, version_int: int):
-        self.path = path
-        self.version_int = version_int
-        major = int(self.version_int / 100000)
-        minor = int((self.version_int / 100) % 1000)
-        patch = int(self.version_int % 100)
-        self.version = '{}.{}.{}'.format(major, minor, patch)
-        self.version_lib = '{}_{}'.format(major, minor)
-
-    def __repr__(self) -> str:
-        return '<BoostIncludeDir: {} -- {}>'.format(self.version, self.path)
-
-    def __lt__(self, other: T.Any) -> bool:
-        if isinstance(other, BoostIncludeDir):
-            return (self.version_int, self.path) < (other.version_int, other.path)
-        return NotImplemented
-
-@functools.total_ordering
-class BoostLibraryFile():
-    # Python libraries are special because of the included
-    # minor version in the module name.
-    boost_python_libs = ['boost_python', 'boost_numpy']
-    reg_python_mod_split = re.compile(r'(boost_[a-zA-Z]+)([0-9]*)')
-
-    reg_abi_tag = re.compile(r'^s?g?y?d?p?n?$')
-    reg_ver_tag = re.compile(r'^[0-9_]+$')
-
-    def __init__(self, path: Path):
-        self.path = path
-        self.name = self.path.name
-
-        # Initialize default properties
-        self.static = False
-        self.toolset = ''
-        self.arch = ''
-        self.version_lib = ''
-        self.mt = True
-
-        self.runtime_static = False
-        self.runtime_debug = False
-        self.python_debug = False
-        self.debug = False
-        self.stlport = False
-        self.deprecated_iostreams = False
-
-        # Post process the library name
-        name_parts = self.name.split('.')
-        self.basename = name_parts[0]
-        self.suffixes = name_parts[1:]
-        self.vers_raw = [x for x in self.suffixes if x.isdigit()]
-        self.suffixes = [x for x in self.suffixes if not x.isdigit()]
-        self.nvsuffix = '.'.join(self.suffixes)  # Used for detecting the library type
-        self.nametags = self.basename.split('-')
-        self.mod_name = self.nametags[0]
-        if self.mod_name.startswith('lib'):
-            self.mod_name = self.mod_name[3:]
-
-        # Set library version if possible
-        if len(self.vers_raw) >= 2:
-            self.version_lib = '{}_{}'.format(self.vers_raw[0], self.vers_raw[1])
-
-        # Detecting library type
-        if self.nvsuffix in ['so', 'dll', 'dll.a', 'dll.lib', 'dylib']:
-            self.static = False
-        elif self.nvsuffix in ['a', 'lib']:
-            self.static = True
-        else:
-            raise DependencyException('Unable to process library extension "{}" ({})'.format(self.nvsuffix, self.path))
-
-        # boost_.lib is the dll import library
-        if self.basename.startswith('boost_') and self.nvsuffix == 'lib':
-            self.static = False
-
-        # Process tags
-        tags = self.nametags[1:]
-        # Filter out the python version tag and fix modname
-        if self.is_python_lib():
-            tags = self.fix_python_name(tags)
-        if not tags:
-            return
-
-        # Without any tags mt is assumed, however, an absents of mt in the name
-        # with tags present indicates that the lib was build without mt support
-        self.mt = False
-        for i in tags:
-            if i == 'mt':
-                self.mt = True
-            elif len(i) == 3 and i[1:] in ['32', '64']:
-                self.arch = i
-            elif BoostLibraryFile.reg_abi_tag.match(i):
-                self.runtime_static = 's' in i
-                self.runtime_debug = 'g' in i
-                self.python_debug = 'y' in i
-                self.debug = 'd' in i
-                self.stlport = 'p' in i
-                self.deprecated_iostreams = 'n' in i
-            elif BoostLibraryFile.reg_ver_tag.match(i):
-                self.version_lib = i
-            else:
-                self.toolset = i
-
-    def __repr__(self) -> str:
-        return '<LIB: {} {:<32} {}>'.format(self.abitag, self.mod_name, self.path)
-
-    def __lt__(self, other: T.Any) -> bool:
-        if isinstance(other, BoostLibraryFile):
-            return (
-                self.mod_name, self.static, self.version_lib, self.arch,
-                not self.mt, not self.runtime_static,
-                not self.debug, self.runtime_debug, self.python_debug,
-                self.stlport, self.deprecated_iostreams,
-                self.name,
-            ) < (
-                other.mod_name, other.static, other.version_lib, other.arch,
-                not other.mt, not other.runtime_static,
-                not other.debug, other.runtime_debug, other.python_debug,
-                other.stlport, other.deprecated_iostreams,
-                other.name,
-            )
-        return NotImplemented
-
-    def __eq__(self, other: T.Any) -> bool:
-        if isinstance(other, BoostLibraryFile):
-            return self.name == other.name
-        return NotImplemented
-
-    def __hash__(self) -> int:
-        return hash(self.name)
-
-    @property
-    def abitag(self) -> str:
-        abitag = ''
-        abitag += 'S' if self.static else '-'
-        abitag += 'M' if self.mt else '-'
-        abitag += ' '
-        abitag += 's' if self.runtime_static else '-'
-        abitag += 'g' if self.runtime_debug else '-'
-        abitag += 'y' if self.python_debug else '-'
-        abitag += 'd' if self.debug else '-'
-        abitag += 'p' if self.stlport else '-'
-        abitag += 'n' if self.deprecated_iostreams else '-'
-        abitag += ' ' + (self.arch or '???')
-        abitag += ' ' + (self.toolset or '?')
-        abitag += ' ' + (self.version_lib or 'x_xx')
-        return abitag
-
-    def is_boost(self) -> bool:
-        return any([self.name.startswith(x) for x in ['libboost_', 'boost_']])
-
-    def is_python_lib(self) -> bool:
-        return any([self.mod_name.startswith(x) for x in BoostLibraryFile.boost_python_libs])
-
-    def fix_python_name(self, tags: T.List[str]) -> T.List[str]:
-        # Handle the boost_python naming madeness.
-        # See https://github.com/mesonbuild/meson/issues/4788 for some distro
-        # specific naming variantions.
-        other_tags = []  # type: T.List[str]
-
-        # Split the current modname into the base name and the version
-        m_cur = BoostLibraryFile.reg_python_mod_split.match(self.mod_name)
-        cur_name = m_cur.group(1)
-        cur_vers = m_cur.group(2)
-
-        # Update the current version string if the new version string is longer
-        def update_vers(new_vers: str) -> None:
-            nonlocal cur_vers
-            new_vers = new_vers.replace('_', '')
-            new_vers = new_vers.replace('.', '')
-            if not new_vers.isdigit():
-                return
-            if len(new_vers) > len(cur_vers):
-                cur_vers = new_vers
-
-        for i in tags:
-            if i.startswith('py'):
-                update_vers(i[2:])
-            elif i.isdigit():
-                update_vers(i)
-            elif len(i) >= 3 and i[0].isdigit and i[2].isdigit() and i[1] == '.':
-                update_vers(i)
-            else:
-                other_tags += [i]
-
-        self.mod_name = cur_name + cur_vers
-        return other_tags
-
-    def mod_name_matches(self, mod_name: str) -> bool:
-        if self.mod_name == mod_name:
-            return True
-        if not self.is_python_lib():
-            return False
-
-        m_cur = BoostLibraryFile.reg_python_mod_split.match(self.mod_name)
-        m_arg = BoostLibraryFile.reg_python_mod_split.match(mod_name)
-
-        if not m_cur or not m_arg:
-            return False
-
-        if m_cur.group(1) != m_arg.group(1):
-            return False
-
-        cur_vers = m_cur.group(2)
-        arg_vers = m_arg.group(2)
-
-        # Always assume python 2 if nothing is specified
-        if not arg_vers:
-            arg_vers = '2'
-
-        return cur_vers.startswith(arg_vers)
-
-    def version_matches(self, version_lib: str) -> bool:
-        # If no version tag is present, assume that it fits
-        if not self.version_lib or not version_lib:
-            return True
-        return self.version_lib == version_lib
-
-    def arch_matches(self, arch: str) -> bool:
-        # If no version tag is present, assume that it fits
-        if not self.arch or not arch:
-            return True
-        return self.arch == arch
-
-    def vscrt_matches(self, vscrt: str) -> bool:
-        # If no vscrt tag present, assume that it fits  ['/MD', '/MDd', '/MT', '/MTd']
-        if not vscrt:
-            return True
-        if vscrt in ['/MD', '-MD']:
-            return not self.runtime_static and not self.runtime_debug
-        elif vscrt in ['/MDd', '-MDd']:
-            return not self.runtime_static and self.runtime_debug
-        elif vscrt in ['/MT', '-MT']:
-            return (self.runtime_static or not self.static) and not self.runtime_debug
-        elif vscrt in ['/MTd', '-MTd']:
-            return (self.runtime_static or not self.static) and self.runtime_debug
-
-        mlog.warning('Boost: unknow vscrt tag {}. This may cause the compilation to fail. Please consider reporting this as a bug.'.format(vscrt), once=True)
-        return True
-
-    def get_compiler_args(self) -> T.List[str]:
-        args = []  # type: T.List[str]
-        if self.mod_name in boost_libraries:
-            libdef = boost_libraries[self.mod_name]  # type: BoostLibrary
-            if self.static:
-                args += libdef.static
-            else:
-                args += libdef.shared
-            if self.mt:
-                args += libdef.multi
-            else:
-                args += libdef.single
-        return args
-
-    def get_link_args(self) -> T.List[str]:
-        return [self.path.as_posix()]
-
-class BoostDependency(ExternalDependency):
-    def __init__(self, environment: Environment, kwargs):
-        super().__init__('boost', environment, kwargs, language='cpp')
-        self.debug = environment.coredata.get_builtin_option('buildtype').startswith('debug')
-        self.multithreading = kwargs.get('threading', 'multi') == 'multi'
-
-        self.boost_root = None
-        self.explicit_static = 'static' in kwargs
-
-        # Extract and validate modules
-        self.modules = mesonlib.extract_as_list(kwargs, 'modules')  # type: T.List[str]
-        for i in self.modules:
-            if not isinstance(i, str):
-                raise DependencyException('Boost module argument is not a string.')
-            if i.startswith('boost_'):
-                raise DependencyException('Boost modules must be passed without the boost_ prefix')
-
-        self.modules_found = []    # type: T.List[str]
-        self.modules_missing = []  # type: T.List[str]
-
-        # Do we need threads?
-        if 'thread' in self.modules:
-            if not self._add_sub_dependency(threads_factory(environment, self.for_machine, {})):
-                self.is_found = False
-                return
-
-        # Try figuring out the architecture tag
-        self.arch = environment.machines[self.for_machine].cpu_family
-        self.arch = boost_arch_map.get(self.arch, None)
-
-        # Prefere BOOST_INCLUDEDIR and BOOST_LIBRARYDIR if preset
-        boost_manual_env = [x in os.environ for x in ['BOOST_INCLUDEDIR', 'BOOST_LIBRARYDIR']]
-        if all(boost_manual_env):
-            inc_dir = Path(os.environ['BOOST_INCLUDEDIR'])
-            lib_dir = Path(os.environ['BOOST_LIBRARYDIR'])
-            mlog.debug('Trying to find boost with:')
-            mlog.debug('  - BOOST_INCLUDEDIR = {}'.format(inc_dir))
-            mlog.debug('  - BOOST_LIBRARYDIR = {}'.format(lib_dir))
-
-            boost_inc_dir = None
-            for j in [inc_dir / 'version.hpp', inc_dir / 'boost' / 'version.hpp']:
-                if j.is_file():
-                    boost_inc_dir = self._include_dir_from_version_header(j)
-                    break
-            if not boost_inc_dir:
-                self.is_found = False
-                return
-
-            self.is_found = self.run_check([boost_inc_dir], [lib_dir])
-            return
-        elif any(boost_manual_env):
-            mlog.warning('Both BOOST_INCLUDEDIR *and* BOOST_LIBRARYDIR have to be set (one is not enough). Ignoring.')
-
-        # A) Detect potential boost root directories (uses also BOOST_ROOT env var)
-        roots = self.detect_roots()
-        roots = list(mesonlib.OrderedSet(roots))
-
-        # B) Foreach candidate
-        for j in roots:
-            #   1. Look for the boost headers (boost/version.pp)
-            mlog.debug('Checking potential boost root {}'.format(j.as_posix()))
-            inc_dirs = self.detect_inc_dirs(j)
-            inc_dirs = sorted(inc_dirs, reverse=True)  # Prefer the newer versions
-
-            # Early abort when boost is not found
-            if not inc_dirs:
-                continue
-
-            lib_dirs = self.detect_lib_dirs(j)
-            self.is_found = self.run_check(inc_dirs, lib_dirs)
-            if self.is_found:
-                self.boost_root = j
-                break
-
-    def run_check(self, inc_dirs: T.List[BoostIncludeDir], lib_dirs: T.List[Path]) -> bool:
-        mlog.debug('  - potential library dirs: {}'.format([x.as_posix() for x in lib_dirs]))
-        mlog.debug('  - potential include dirs: {}'.format([x.path.as_posix() for x in inc_dirs]))
-
-        #   2. Find all boost libraries
-        libs = []  # type: T.List[BoostLibraryFile]
-        for i in lib_dirs:
-            libs = self.detect_libraries(i)
-            if libs:
-                mlog.debug('  - found boost library dir: {}'.format(i))
-                # mlog.debug('  - raw library list:')
-                # for j in libs:
-                #     mlog.debug('    - {}'.format(j))
-                break
-        libs = sorted(set(libs))
-
-        modules = ['boost_' + x for x in self.modules]
-        for inc in inc_dirs:
-            mlog.debug('  - found boost {} include dir: {}'.format(inc.version, inc.path))
-            f_libs = self.filter_libraries(libs, inc.version_lib)
-
-            mlog.debug('  - filtered library list:')
-            for j in f_libs:
-                mlog.debug('    - {}'.format(j))
-
-            #   3. Select the libraries matching the requested modules
-            not_found = []  # type: T.List[str]
-            selected_modules = []  # type: T.List[BoostLibraryFile]
-            for mod in modules:
-                found = False
-                for l in f_libs:
-                    if l.mod_name_matches(mod):
-                        selected_modules += [l]
-                        found = True
-                        break
-                if not found:
-                    not_found += [mod]
-
-            # log the result
-            mlog.debug('  - found:')
-            comp_args = []  # type: T.List[str]
-            link_args = []  # type: T.List[str]
-            for j in selected_modules:
-                c_args = j.get_compiler_args()
-                l_args = j.get_link_args()
-                mlog.debug('    - {:<24} link={} comp={}'.format(j.mod_name, str(l_args), str(c_args)))
-                comp_args += c_args
-                link_args += l_args
-
-            comp_args = list(set(comp_args))
-            link_args = list(set(link_args))
-
-            self.modules_found = [x.mod_name for x in selected_modules]
-            self.modules_found = [x[6:] for x in self.modules_found]
-            self.modules_found = sorted(set(self.modules_found))
-            self.modules_missing = not_found
-            self.modules_missing = [x[6:] for x in self.modules_missing]
-            self.modules_missing = sorted(set(self.modules_missing))
-
-            # if we found all modules we are done
-            if not not_found:
-                self.version = inc.version
-                self.compile_args = ['-I' + inc.path.as_posix()]
-                self.compile_args += comp_args
-                self.compile_args += self._extra_compile_args()
-                self.compile_args = list(mesonlib.OrderedSet(self.compile_args))
-                self.link_args = link_args
-                mlog.debug('  - final compile args: {}'.format(self.compile_args))
-                mlog.debug('  - final link args:    {}'.format(self.link_args))
-                return True
-
-            # in case we missed something log it and try again
-            mlog.debug('  - NOT found:')
-            for mod in not_found:
-                mlog.debug('    - {}'.format(mod))
-
-        return False
-
-    def detect_inc_dirs(self, root: Path) -> T.List[BoostIncludeDir]:
-        candidates = []  # type: T.List[Path]
-        inc_root = root / 'include'
-
-        candidates += [root / 'boost']
-        candidates += [inc_root / 'boost']
-        if inc_root.is_dir():
-            for i in inc_root.iterdir():
-                if not i.is_dir() or not i.name.startswith('boost-'):
-                    continue
-                candidates += [i / 'boost']
-        candidates = [x for x in candidates if x.is_dir()]
-        candidates = [x / 'version.hpp' for x in candidates]
-        candidates = [x for x in candidates if x.exists()]
-        return [self._include_dir_from_version_header(x) for x in candidates]
-
-    def detect_lib_dirs(self, root: Path) -> T.List[Path]:
-        # First check the system include paths. Only consider those within the
-        # given root path
-        system_dirs_t = self.clib_compiler.get_library_dirs(self.env)
-        system_dirs = [Path(x) for x in system_dirs_t]
-        system_dirs = [x.resolve() for x in system_dirs if x.exists()]
-        system_dirs = [x for x in system_dirs if mesonlib.path_is_in_root(x, root)]
-        system_dirs = list(mesonlib.OrderedSet(system_dirs))
-
-        if system_dirs:
-            return system_dirs
-
-        # No system include paths were found --> fall back to manually looking
-        # for library dirs in root
-        dirs = []     # type: T.List[Path]
-        subdirs = []  # type: T.List[Path]
-        for i in root.iterdir():
-            if i.is_dir() and i.name.startswith('lib'):
-                dirs += [i]
-
-        # Some distros put libraries not directly inside /usr/lib but in /usr/lib/x86_64-linux-gnu
-        for i in dirs:
-            for j in i.iterdir():
-                if j.is_dir() and j.name.endswith('-linux-gnu'):
-                    subdirs += [j]
-
-        # Filter out paths that don't match the target arch to avoid finding
-        # the wrong libraries. See https://github.com/mesonbuild/meson/issues/7110
-        if not self.arch:
-            return dirs + subdirs
-
-        arch_list_32 = ['32', 'i386']
-        arch_list_64 = ['64']
-
-        raw_list = dirs + subdirs
-        no_arch = [x for x in raw_list if not any([y in x.name for y in arch_list_32 + arch_list_64])]
-
-        matching_arch = []  # type: T.List[Path]
-        if '32' in self.arch:
-            matching_arch = [x for x in raw_list if any([y in x.name for y in arch_list_32])]
-        elif '64' in self.arch:
-            matching_arch = [x for x in raw_list if any([y in x.name for y in arch_list_64])]
-
-        return sorted(matching_arch) + sorted(no_arch)
-
-    def filter_libraries(self, libs: T.List[BoostLibraryFile], lib_vers: str) -> T.List[BoostLibraryFile]:
-        # MSVC is very picky with the library tags
-        vscrt = ''
-        try:
-            crt_val = self.env.coredata.base_options['b_vscrt'].value
-            buildtype = self.env.coredata.builtins['buildtype'].value
-            vscrt = self.clib_compiler.get_crt_compile_args(crt_val, buildtype)[0]
-        except (KeyError, IndexError, AttributeError):
-            pass
-
-        libs = [x for x in libs if x.static == self.static or not self.explicit_static]
-        libs = [x for x in libs if x.mt == self.multithreading]
-        libs = [x for x in libs if x.version_matches(lib_vers)]
-        libs = [x for x in libs if x.arch_matches(self.arch)]
-        libs = [x for x in libs if x.vscrt_matches(vscrt)]
-        libs = [x for x in libs if x.nvsuffix != 'dll']  # Only link to import libraries
-
-        # Only filter by debug when we are building in release mode. Debug
-        # libraries are automatically prefered through sorting otherwise.
-        if not self.debug:
-            libs = [x for x in libs if not x.debug]
-
-        # Take the abitag from the first library and filter by it. This
-        # ensures that we have a set of libraries that are always compatible.
-        if not libs:
-            return []
-        abitag = libs[0].abitag
-        libs = [x for x in libs if x.abitag == abitag]
-
-        return libs
-
-    def detect_libraries(self, libdir: Path) -> T.List[BoostLibraryFile]:
-        libs = []  # type: T.List[BoostLibraryFile]
-        for i in libdir.iterdir():
-            if not i.is_file() or i.is_symlink():
-                continue
-            if not any([i.name.startswith(x) for x in ['libboost_', 'boost_']]):
-                continue
-
-            libs += [BoostLibraryFile(i)]
-        return [x for x in libs if x.is_boost()]  # Filter out no boost libraries
-
-    def detect_roots(self) -> T.List[Path]:
-        roots = []  # type: T.List[Path]
-
-        # Add roots from the environment
-        for i in ['BOOST_ROOT', 'BOOSTROOT']:
-            if i in os.environ:
-                raw_paths = os.environ[i].split(os.pathsep)
-                paths = [Path(x) for x in raw_paths]
-                if paths and any([not x.is_absolute() for x in paths]):
-                    raise DependencyException('Paths in {} must be absolute'.format(i))
-                roots += paths
-                return roots  # Do not add system paths if BOOST_ROOT is present
-
-        # Try getting the BOOST_ROOT from a boost.pc if it exists. This primarely
-        # allows BoostDependency to find boost from Conan. See #5438
-        try:
-            boost_pc = PkgConfigDependency('boost', self.env, {'required': False})
-            if boost_pc.found():
-                boost_root = boost_pc.get_pkgconfig_variable('prefix', {'default': None})
-                if boost_root:
-                    roots += [Path(boost_root)]
-        except DependencyException:
-            pass
-
-        # Add roots from system paths
-        inc_paths = [Path(x) for x in self.clib_compiler.get_default_include_dirs()]
-        inc_paths = [x.parent for x in inc_paths if x.exists()]
-        inc_paths = [x.resolve() for x in inc_paths]
-        roots += inc_paths
-
-        # Add system paths
-        if self.env.machines[self.for_machine].is_windows():
-            # Where boost built from source actually installs it
-            c_root = Path('C:/Boost')
-            if c_root.is_dir():
-                roots += [c_root]
-
-            # Where boost documentation says it should be
-            prog_files = Path('C:/Program Files/boost')
-            # Where boost prebuilt binaries are
-            local_boost = Path('C:/local')
-
-            candidates = []  # type: T.List[Path]
-            if prog_files.is_dir():
-                candidates += [*prog_files.iterdir()]
-            if local_boost.is_dir():
-                candidates += [*local_boost.iterdir()]
-
-            roots += [x for x in candidates if x.name.lower().startswith('boost') and x.is_dir()]
-        else:
-            tmp = []  # type: T.List[Path]
-
-            # Homebrew
-            brew_boost = Path('/usr/local/Cellar/boost')
-            if brew_boost.is_dir():
-                tmp += [x for x in brew_boost.iterdir()]
-
-            # Add some default system paths
-            tmp += [Path('/opt/local')]
-            tmp += [Path('/usr/local/opt/boost')]
-            tmp += [Path('/usr/local')]
-            tmp += [Path('/usr')]
-
-            # Cleanup paths
-            tmp = [x for x in tmp if x.is_dir()]
-            tmp = [x.resolve() for x in tmp]
-            roots += tmp
-
-        return roots
-
-    def log_details(self) -> str:
-        res = ''
-        if self.modules_found:
-            res += 'found: ' + ', '.join(self.modules_found)
-        if self.modules_missing:
-            if res:
-                res += ' | '
-            res += 'missing: ' + ', '.join(self.modules_missing)
-        return res
-
-    def log_info(self) -> str:
-        if self.boost_root:
-            return self.boost_root.as_posix()
-        return ''
-
-    def _include_dir_from_version_header(self, hfile: Path) -> BoostIncludeDir:
-        # Extract the version with a regex. Using clib_compiler.get_define would
-        # also work, however, this is slower (since it the compiler has to be
-        # invoked) and overkill since the layout of the header is always the same.
-        assert hfile.exists()
-        raw = hfile.read_text()
-        m = re.search(r'#define\s+BOOST_VERSION\s+([0-9]+)', raw)
-        if not m:
-            mlog.debug('Failed to extract version information from {}'.format(hfile))
-            return BoostIncludeDir(hfile.parents[1], 0)
-        return BoostIncludeDir(hfile.parents[1], int(m.group(1)))
-
-    def _extra_compile_args(self) -> T.List[str]:
-        # BOOST_ALL_DYN_LINK should not be required with the known defines below
-        return ['-DBOOST_ALL_NO_LIB']  # Disable automatic linking
-
-
-# See https://www.boost.org/doc/libs/1_72_0/more/getting_started/unix-variants.html#library-naming
-# See https://mesonbuild.com/Reference-tables.html#cpu-families
-boost_arch_map = {
-    'aarch64': 'a64',
-    'arc': 'a32',
-    'arm': 'a32',
-    'ia64': 'i64',
-    'mips': 'm32',
-    'mips64': 'm64',
-    'ppc': 'p32',
-    'ppc64': 'p64',
-    'sparc': 's32',
-    'sparc64': 's64',
-    'x86': 'x32',
-    'x86_64': 'x64',
-}
-
-
-####      ---- BEGIN GENERATED ----      ####
-#                                           #
-# Generated with tools/boost_names.py:
-#  - boost version:   1.73.0
-#  - modules found:   159
-#  - libraries found: 43
-#
-
-class BoostLibrary():
-    def __init__(self, name: str, shared: T.List[str], static: T.List[str], single: T.List[str], multi: T.List[str]):
-        self.name = name
-        self.shared = shared
-        self.static = static
-        self.single = single
-        self.multi = multi
-
-class BoostModule():
-    def __init__(self, name: str, key: str, desc: str, libs: T.List[str]):
-        self.name = name
-        self.key = key
-        self.desc = desc
-        self.libs = libs
-
-
-# dict of all know libraries with additional compile options
-boost_libraries = {
-    'boost_atomic': BoostLibrary(
-        name='boost_atomic',
-        shared=['-DBOOST_ATOMIC_DYN_LINK=1'],
-        static=['-DBOOST_ATOMIC_STATIC_LINK=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_chrono': BoostLibrary(
-        name='boost_chrono',
-        shared=['-DBOOST_CHRONO_DYN_LINK=1'],
-        static=['-DBOOST_CHRONO_STATIC_LINK=1'],
-        single=['-DBOOST_CHRONO_THREAD_DISABLED'],
-        multi=[],
-    ),
-    'boost_container': BoostLibrary(
-        name='boost_container',
-        shared=['-DBOOST_CONTAINER_DYN_LINK=1'],
-        static=['-DBOOST_CONTAINER_STATIC_LINK=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_context': BoostLibrary(
-        name='boost_context',
-        shared=['-DBOOST_CONTEXT_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_contract': BoostLibrary(
-        name='boost_contract',
-        shared=['-DBOOST_CONTRACT_DYN_LINK'],
-        static=['-DBOOST_CONTRACT_STATIC_LINK'],
-        single=['-DBOOST_CONTRACT_DISABLE_THREADS'],
-        multi=[],
-    ),
-    'boost_coroutine': BoostLibrary(
-        name='boost_coroutine',
-        shared=['-DBOOST_COROUTINES_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_date_time': BoostLibrary(
-        name='boost_date_time',
-        shared=['-DBOOST_DATE_TIME_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_exception': BoostLibrary(
-        name='boost_exception',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_fiber': BoostLibrary(
-        name='boost_fiber',
-        shared=['-DBOOST_FIBERS_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_fiber_numa': BoostLibrary(
-        name='boost_fiber_numa',
-        shared=['-DBOOST_FIBERS_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_filesystem': BoostLibrary(
-        name='boost_filesystem',
-        shared=['-DBOOST_FILESYSTEM_DYN_LINK=1'],
-        static=['-DBOOST_FILESYSTEM_STATIC_LINK=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_graph': BoostLibrary(
-        name='boost_graph',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_iostreams': BoostLibrary(
-        name='boost_iostreams',
-        shared=['-DBOOST_IOSTREAMS_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_locale': BoostLibrary(
-        name='boost_locale',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_log': BoostLibrary(
-        name='boost_log',
-        shared=['-DBOOST_LOG_DYN_LINK=1'],
-        static=[],
-        single=['-DBOOST_LOG_NO_THREADS'],
-        multi=[],
-    ),
-    'boost_log_setup': BoostLibrary(
-        name='boost_log_setup',
-        shared=['-DBOOST_LOG_SETUP_DYN_LINK=1'],
-        static=[],
-        single=['-DBOOST_LOG_NO_THREADS'],
-        multi=[],
-    ),
-    'boost_math_c99': BoostLibrary(
-        name='boost_math_c99',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_math_c99f': BoostLibrary(
-        name='boost_math_c99f',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_math_c99l': BoostLibrary(
-        name='boost_math_c99l',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_math_tr1': BoostLibrary(
-        name='boost_math_tr1',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_math_tr1f': BoostLibrary(
-        name='boost_math_tr1f',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_math_tr1l': BoostLibrary(
-        name='boost_math_tr1l',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_mpi': BoostLibrary(
-        name='boost_mpi',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_nowide': BoostLibrary(
-        name='boost_nowide',
-        shared=['-DBOOST_NOWIDE_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_prg_exec_monitor': BoostLibrary(
-        name='boost_prg_exec_monitor',
-        shared=['-DBOOST_TEST_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_program_options': BoostLibrary(
-        name='boost_program_options',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_random': BoostLibrary(
-        name='boost_random',
-        shared=['-DBOOST_RANDOM_DYN_LINK'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_regex': BoostLibrary(
-        name='boost_regex',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_serialization': BoostLibrary(
-        name='boost_serialization',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_addr2line': BoostLibrary(
-        name='boost_stacktrace_addr2line',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_backtrace': BoostLibrary(
-        name='boost_stacktrace_backtrace',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_basic': BoostLibrary(
-        name='boost_stacktrace_basic',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_noop': BoostLibrary(
-        name='boost_stacktrace_noop',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_windbg': BoostLibrary(
-        name='boost_stacktrace_windbg',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_stacktrace_windbg_cached': BoostLibrary(
-        name='boost_stacktrace_windbg_cached',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_system': BoostLibrary(
-        name='boost_system',
-        shared=['-DBOOST_SYSTEM_DYN_LINK=1'],
-        static=['-DBOOST_SYSTEM_STATIC_LINK=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_test_exec_monitor': BoostLibrary(
-        name='boost_test_exec_monitor',
-        shared=['-DBOOST_TEST_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_thread': BoostLibrary(
-        name='boost_thread',
-        shared=['-DBOOST_THREAD_BUILD_DLL=1', '-DBOOST_THREAD_USE_DLL=1'],
-        static=['-DBOOST_THREAD_BUILD_LIB=1', '-DBOOST_THREAD_USE_LIB=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_timer': BoostLibrary(
-        name='boost_timer',
-        shared=['-DBOOST_TIMER_DYN_LINK=1'],
-        static=['-DBOOST_TIMER_STATIC_LINK=1'],
-        single=[],
-        multi=[],
-    ),
-    'boost_type_erasure': BoostLibrary(
-        name='boost_type_erasure',
-        shared=['-DBOOST_TYPE_ERASURE_DYN_LINK'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_unit_test_framework': BoostLibrary(
-        name='boost_unit_test_framework',
-        shared=['-DBOOST_TEST_DYN_LINK=1'],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_wave': BoostLibrary(
-        name='boost_wave',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-    'boost_wserialization': BoostLibrary(
-        name='boost_wserialization',
-        shared=[],
-        static=[],
-        single=[],
-        multi=[],
-    ),
-}
-
-#                                           #
-####       ---- END GENERATED ----       ####
diff --git a/meson/mesonbuild/dependencies/coarrays.py b/meson/mesonbuild/dependencies/coarrays.py
deleted file mode 100644 (file)
index 84c3412..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import functools
-import typing as T
-
-from .base import CMakeDependency, DependencyMethods, ExternalDependency, PkgConfigDependency, detect_compiler, factory_methods
-
-if T.TYPE_CHECKING:
-    from . base import DependencyType
-    from ..environment import Environment, MachineChoice
-
-
-@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE, DependencyMethods.SYSTEM})
-def coarray_factory(env: 'Environment', for_machine: 'MachineChoice',
-                    kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    fcid = detect_compiler('coarray', env, for_machine, 'fortran').get_id()
-    candidates = []  # type: T.List[DependencyType]
-
-    if fcid == 'gcc':
-        # OpenCoarrays is the most commonly used method for Fortran Coarray with GCC
-        if DependencyMethods.PKGCONFIG in methods:
-            for pkg in ['caf-openmpi', 'caf']:
-                candidates.append(functools.partial(
-                    PkgConfigDependency, pkg, env, kwargs, language='fortran'))
-
-        if DependencyMethods.CMAKE in methods:
-            if 'modules' not in kwargs:
-                kwargs['modules'] = 'OpenCoarrays::caf_mpi'
-            candidates.append(functools.partial(
-                CMakeDependency, 'OpenCoarrays', env, kwargs, language='fortran'))
-
-    if DependencyMethods.SYSTEM in methods:
-        candidates.append(functools.partial(CoarrayDependency, env, kwargs))
-
-    return candidates
-
-
-class CoarrayDependency(ExternalDependency):
-    """
-    Coarrays are a Fortran 2008 feature.
-
-    Coarrays are sometimes implemented via external library (GCC+OpenCoarrays),
-    while other compilers just build in support (Cray, IBM, Intel, NAG).
-    Coarrays may be thought of as a high-level language abstraction of
-    low-level MPI calls.
-    """
-    def __init__(self, environment, kwargs: dict):
-        super().__init__('coarray', environment, kwargs, language='fortran')
-        kwargs['required'] = False
-        kwargs['silent'] = True
-
-        cid = self.get_compiler().get_id()
-        if cid == 'gcc':
-            # Fallback to single image
-            self.compile_args = ['-fcoarray=single']
-            self.version = 'single image (fallback)'
-            self.is_found = True
-        elif cid == 'intel':
-            # Coarrays are built into Intel compilers, no external library needed
-            self.is_found = True
-            self.link_args = ['-coarray=shared']
-            self.compile_args = self.link_args
-        elif cid == 'intel-cl':
-            # Coarrays are built into Intel compilers, no external library needed
-            self.is_found = True
-            self.compile_args = ['/Qcoarray:shared']
-        elif cid == 'nagfor':
-            # NAG doesn't require any special arguments for Coarray
-            self.is_found = True
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.AUTO, DependencyMethods.CMAKE, DependencyMethods.PKGCONFIG]
diff --git a/meson/mesonbuild/dependencies/cuda.py b/meson/mesonbuild/dependencies/cuda.py
deleted file mode 100644 (file)
index c962cae..0000000
+++ /dev/null
@@ -1,256 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import glob
-import re
-import os
-
-from .. import mlog
-from .. import mesonlib
-from ..environment import detect_cpu_family
-
-from .base import (DependencyException, ExternalDependency)
-
-
-class CudaDependency(ExternalDependency):
-
-    supported_languages = ['cuda', 'cpp', 'c'] # see also _default_language
-
-    def __init__(self, environment, kwargs):
-        compilers = environment.coredata.compilers[self.get_for_machine_from_kwargs(kwargs)]
-        language = self._detect_language(compilers)
-        if language not in self.supported_languages:
-            raise DependencyException('Language \'{}\' is not supported by the CUDA Toolkit. Supported languages are {}.'.format(language, self.supported_languages))
-
-        super().__init__('cuda', environment, kwargs, language=language)
-        self.requested_modules = self.get_requested(kwargs)
-        if 'cudart' not in self.requested_modules:
-            self.requested_modules = ['cudart'] + self.requested_modules
-
-        (self.cuda_path, self.version, self.is_found) = self._detect_cuda_path_and_version()
-        if not self.is_found:
-            return
-
-        if not os.path.isabs(self.cuda_path):
-            raise DependencyException('CUDA Toolkit path must be absolute, got \'{}\'.'.format(self.cuda_path))
-
-        # nvcc already knows where to find the CUDA Toolkit, but if we're compiling
-        # a mixed C/C++/CUDA project, we still need to make the include dir searchable
-        if self.language != 'cuda' or len(compilers) > 1:
-            self.incdir = os.path.join(self.cuda_path, 'include')
-            self.compile_args += ['-I{}'.format(self.incdir)]
-
-        if self.language != 'cuda':
-            arch_libdir = self._detect_arch_libdir()
-            self.libdir = os.path.join(self.cuda_path, arch_libdir)
-            mlog.debug('CUDA library directory is', mlog.bold(self.libdir))
-        else:
-            self.libdir = None
-
-        self.is_found = self._find_requested_libraries()
-
-    @classmethod
-    def _detect_language(cls, compilers):
-        for lang in cls.supported_languages:
-            if lang in compilers:
-                return lang
-        return list(compilers.keys())[0]
-
-    def _detect_cuda_path_and_version(self):
-        self.env_var = self._default_path_env_var()
-        mlog.debug('Default path env var:', mlog.bold(self.env_var))
-
-        version_reqs = self.version_reqs
-        if self.language == 'cuda':
-            nvcc_version = self._strip_patch_version(self.get_compiler().version)
-            mlog.debug('nvcc version:', mlog.bold(nvcc_version))
-            if version_reqs:
-                # make sure nvcc version satisfies specified version requirements
-                (found_some, not_found, found) = mesonlib.version_compare_many(nvcc_version, version_reqs)
-                if not_found:
-                    msg = 'The current nvcc version {} does not satisfy the specified CUDA Toolkit version requirements {}.'.format(nvcc_version, version_reqs)
-                    return self._report_dependency_error(msg, (None, None, False))
-
-            # use nvcc version to find a matching CUDA Toolkit
-            version_reqs = ['={}'.format(nvcc_version)]
-        else:
-            nvcc_version = None
-
-        paths = [(path, self._cuda_toolkit_version(path), default) for (path, default) in self._cuda_paths()]
-        if version_reqs:
-            return self._find_matching_toolkit(paths, version_reqs, nvcc_version)
-
-        defaults = [(path, version) for (path, version, default) in paths if default]
-        if defaults:
-            return (defaults[0][0], defaults[0][1], True)
-
-        platform_msg = 'set the CUDA_PATH environment variable' if self._is_windows() \
-            else 'set the CUDA_PATH environment variable/create the \'/usr/local/cuda\' symbolic link'
-        msg = 'Please specify the desired CUDA Toolkit version (e.g. dependency(\'cuda\', version : \'>=10.1\')) or {} to point to the location of your desired version.'.format(platform_msg)
-        return self._report_dependency_error(msg, (None, None, False))
-
-    def _find_matching_toolkit(self, paths, version_reqs, nvcc_version):
-        # keep the default paths order intact, sort the rest in the descending order
-        # according to the toolkit version
-        defaults, rest = mesonlib.partition(lambda t: not t[2], paths)
-        defaults = list(defaults)
-        paths = defaults + sorted(rest, key=lambda t: mesonlib.Version(t[1]), reverse=True)
-        mlog.debug('Search paths: {}'.format(paths))
-
-        if nvcc_version and defaults:
-            default_src = "the {} environment variable".format(self.env_var) if self.env_var else "the \'/usr/local/cuda\' symbolic link"
-            nvcc_warning = 'The default CUDA Toolkit as designated by {} ({}) doesn\'t match the current nvcc version {} and will be ignored.'.format(default_src, os.path.realpath(defaults[0][0]), nvcc_version)
-        else:
-            nvcc_warning = None
-
-        for (path, version, default) in paths:
-            (found_some, not_found, found) = mesonlib.version_compare_many(version, version_reqs)
-            if not not_found:
-                if not default and nvcc_warning:
-                    mlog.warning(nvcc_warning)
-                return (path, version, True)
-
-        if nvcc_warning:
-            mlog.warning(nvcc_warning)
-        return (None, None, False)
-
-    def _default_path_env_var(self):
-        env_vars = ['CUDA_PATH'] if self._is_windows() else ['CUDA_PATH', 'CUDA_HOME', 'CUDA_ROOT']
-        env_vars = [var for var in env_vars if var in os.environ]
-        user_defaults = set([os.environ[var] for var in env_vars])
-        if len(user_defaults) > 1:
-            mlog.warning('Environment variables {} point to conflicting toolkit locations ({}). Toolkit selection might produce unexpected results.'.format(', '.join(env_vars), ', '.join(user_defaults)))
-        return env_vars[0] if env_vars else None
-
-    def _cuda_paths(self):
-        return ([(os.environ[self.env_var], True)] if self.env_var else []) \
-            + (self._cuda_paths_win() if self._is_windows() else self._cuda_paths_nix())
-
-    def _cuda_paths_win(self):
-        env_vars = os.environ.keys()
-        return [(os.environ[var], False) for var in env_vars if var.startswith('CUDA_PATH_')]
-
-    def _cuda_paths_nix(self):
-        # include /usr/local/cuda default only if no env_var was found
-        pattern = '/usr/local/cuda-*' if self.env_var else '/usr/local/cuda*'
-        return [(path, os.path.basename(path) == 'cuda') for path in glob.iglob(pattern)]
-
-    toolkit_version_regex = re.compile(r'^CUDA Version\s+(.*)$')
-    path_version_win_regex = re.compile(r'^v(.*)$')
-    path_version_nix_regex = re.compile(r'^cuda-(.*)$')
-
-    def _cuda_toolkit_version(self, path):
-        version = self._read_toolkit_version_txt(path)
-        if version:
-            return version
-
-        mlog.debug('Falling back to extracting version from path')
-        path_version_regex = self.path_version_win_regex if self._is_windows() else self.path_version_nix_regex
-        try:
-            m = path_version_regex.match(os.path.basename(path))
-            if m:
-                return m.group(1)
-            else:
-                mlog.warning('Could not detect CUDA Toolkit version for {}'.format(path))
-        except Exception as e:
-            mlog.warning('Could not detect CUDA Toolkit version for {}: {}'.format(path, str(e)))
-
-        return '0.0'
-
-    def _read_toolkit_version_txt(self, path):
-        # Read 'version.txt' at the root of the CUDA Toolkit directory to determine the tookit version
-        version_file_path = os.path.join(path, 'version.txt')
-        try:
-            with open(version_file_path) as version_file:
-                version_str = version_file.readline() # e.g. 'CUDA Version 10.1.168'
-                m = self.toolkit_version_regex.match(version_str)
-                if m:
-                    return self._strip_patch_version(m.group(1))
-        except Exception as e:
-            mlog.debug('Could not read CUDA Toolkit\'s version file {}: {}'.format(version_file_path, str(e)))
-
-        return None
-
-    @classmethod
-    def _strip_patch_version(cls, version):
-        return '.'.join(version.split('.')[:2])
-
-    def _detect_arch_libdir(self):
-        arch = detect_cpu_family(self.env.coredata.compilers.host)
-        machine = self.env.machines[self.for_machine]
-        msg = '{} architecture is not supported in {} version of the CUDA Toolkit.'
-        if machine.is_windows():
-            libdirs = {'x86': 'Win32', 'x86_64': 'x64'}
-            if arch not in libdirs:
-                raise DependencyException(msg.format(arch, 'Windows'))
-            return os.path.join('lib', libdirs[arch])
-        elif machine.is_linux():
-            libdirs = {'x86_64': 'lib64', 'ppc64': 'lib', 'aarch64': 'lib64'}
-            if arch not in libdirs:
-                raise DependencyException(msg.format(arch, 'Linux'))
-            return libdirs[arch]
-        elif machine.is_osx():
-            libdirs = {'x86_64': 'lib64'}
-            if arch not in libdirs:
-                raise DependencyException(msg.format(arch, 'macOS'))
-            return libdirs[arch]
-        else:
-            raise DependencyException('CUDA Toolkit: unsupported platform.')
-
-    def _find_requested_libraries(self):
-        self.lib_modules = {}
-        all_found = True
-
-        for module in self.requested_modules:
-            args = self.clib_compiler.find_library(module, self.env, [self.libdir] if self.libdir else [])
-            if args is None:
-                self._report_dependency_error('Couldn\'t find requested CUDA module \'{}\''.format(module))
-                all_found = False
-            else:
-                mlog.debug('Link args for CUDA module \'{}\' are {}'.format(module, args))
-                self.lib_modules[module] = args
-
-        return all_found
-
-    def _is_windows(self):
-        return self.env.machines[self.for_machine].is_windows()
-
-    def _report_dependency_error(self, msg, ret_val=None):
-        if self.required:
-            raise DependencyException(msg)
-
-        mlog.debug(msg)
-        return ret_val
-
-    def log_details(self):
-        module_str = ', '.join(self.requested_modules)
-        return 'modules: ' + module_str
-
-    def log_info(self):
-        return self.cuda_path if self.cuda_path else ''
-
-    def get_requested(self, kwargs):
-        candidates = mesonlib.extract_as_list(kwargs, 'modules')
-        for c in candidates:
-            if not isinstance(c, str):
-                raise DependencyException('CUDA module argument is not a string.')
-        return candidates
-
-    def get_link_args(self, **kwargs):
-        args = []
-        if self.libdir:
-            args += self.clib_compiler.get_linker_search_args(self.libdir)
-        for lib in self.requested_modules:
-            args += self.lib_modules[lib]
-        return args
diff --git a/meson/mesonbuild/dependencies/data/CMakeLists.txt b/meson/mesonbuild/dependencies/data/CMakeLists.txt
deleted file mode 100644 (file)
index 26c067d..0000000
+++ /dev/null
@@ -1,94 +0,0 @@
-# fail noisily if attempt to use this file without setting:
-# cmake_minimum_required(VERSION ${CMAKE_VERSION})
-# project(... LANGUAGES ...)
-
-cmake_policy(SET CMP0000 NEW)
-
-set(PACKAGE_FOUND FALSE)
-set(_packageName "${NAME}")
-string(TOUPPER "${_packageName}" PACKAGE_NAME)
-
-while(TRUE)
-  find_package("${NAME}" QUIET COMPONENTS ${COMPS})
-
-  # ARCHS has to be set via the CMD interface
-  if(${_packageName}_FOUND OR ${PACKAGE_NAME}_FOUND OR "${ARCHS}" STREQUAL "")
-    break()
-  endif()
-
-  list(GET       ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
-  list(REMOVE_AT ARCHS 0)
-endwhile()
-
-if(${_packageName}_FOUND  OR  ${PACKAGE_NAME}_FOUND)
-  set(PACKAGE_FOUND TRUE)
-
-  # Check the following variables:
-  # FOO_VERSION
-  # Foo_VERSION
-  # FOO_VERSION_STRING
-  # Foo_VERSION_STRING
-  if(NOT DEFINED PACKAGE_VERSION)
-    if(DEFINED ${_packageName}_VERSION)
-      set(PACKAGE_VERSION "${${_packageName}_VERSION}")
-    elseif(DEFINED ${PACKAGE_NAME}_VERSION)
-      set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION}")
-    elseif(DEFINED ${_packageName}_VERSION_STRING)
-      set(PACKAGE_VERSION "${${_packageName}_VERSION_STRING}")
-    elseif(DEFINED ${PACKAGE_NAME}_VERSION_STRING)
-      set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION_STRING}")
-    endif()
-  endif()
-
-  # Check the following variables:
-  # FOO_LIBRARIES
-  # Foo_LIBRARIES
-  # FOO_LIBS
-  # Foo_LIBS
-  set(libs)
-  if(DEFINED ${_packageName}_LIBRARIES)
-    set(libs ${_packageName}_LIBRARIES)
-  elseif(DEFINED ${PACKAGE_NAME}_LIBRARIES)
-    set(libs ${PACKAGE_NAME}_LIBRARIES)
-  elseif(DEFINED ${_packageName}_LIBS)
-    set(libs ${_packageName}_LIBS)
-  elseif(DEFINED ${PACKAGE_NAME}_LIBS)
-    set(libs ${PACKAGE_NAME}_LIBS)
-  endif()
-
-  # Check the following variables:
-  # FOO_INCLUDE_DIRS
-  # Foo_INCLUDE_DIRS
-  # FOO_INCLUDES
-  # Foo_INCLUDES
-  # FOO_INCLUDE_DIR
-  # Foo_INCLUDE_DIR
-  set(includes)
-  if(DEFINED ${_packageName}_INCLUDE_DIRS)
-    set(includes ${_packageName}_INCLUDE_DIRS)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIRS)
-    set(includes ${PACKAGE_NAME}_INCLUDE_DIRS)
-  elseif(DEFINED ${_packageName}_INCLUDES)
-    set(includes ${_packageName}_INCLUDES)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDES)
-    set(includes ${PACKAGE_NAME}_INCLUDES)
-  elseif(DEFINED ${_packageName}_INCLUDE_DIR)
-    set(includes ${_packageName}_INCLUDE_DIR)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIR)
-    set(includes ${PACKAGE_NAME}_INCLUDE_DIR)
-  endif()
-
-  # Check the following variables:
-  # FOO_DEFINITIONS
-  # Foo_DEFINITIONS
-  set(definitions)
-  if(DEFINED ${_packageName}_DEFINITIONS)
-    set(definitions ${_packageName}_DEFINITIONS)
-  elseif(DEFINED ${PACKAGE_NAME}_DEFINITIONS)
-    set(definitions ${PACKAGE_NAME}_DEFINITIONS)
-  endif()
-
-  set(PACKAGE_INCLUDE_DIRS "${${includes}}")
-  set(PACKAGE_DEFINITIONS  "${${definitions}}")
-  set(PACKAGE_LIBRARIES    "${${libs}}")
-endif()
diff --git a/meson/mesonbuild/dependencies/data/CMakeListsLLVM.txt b/meson/mesonbuild/dependencies/data/CMakeListsLLVM.txt
deleted file mode 100644 (file)
index 9d3e412..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
-
-set(PACKAGE_FOUND FALSE)
-
-while(TRUE)
-  find_package(LLVM REQUIRED CONFIG QUIET)
-
-  # ARCHS has to be set via the CMD interface
-  if(LLVM_FOUND OR "${ARCHS}" STREQUAL "")
-    break()
-  endif()
-
-  list(GET       ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
-  list(REMOVE_AT ARCHS 0)
-endwhile()
-
-if(LLVM_FOUND)
-  set(PACKAGE_FOUND TRUE)
-
-  foreach(mod IN LISTS LLVM_MESON_MODULES)
-    # Reset variables
-    set(out_mods)
-    set(real_mods)
-
-    # Generate a lower and upper case version
-    string(TOLOWER "${mod}" mod_L)
-    string(TOUPPER "${mod}" mod_U)
-
-    # Get the mapped components
-    llvm_map_components_to_libnames(out_mods ${mod} ${mod_L} ${mod_U})
-    list(SORT              out_mods)
-    list(REMOVE_DUPLICATES out_mods)
-
-    # Make sure that the modules exist
-    foreach(i IN LISTS out_mods)
-      if(TARGET ${i})
-        list(APPEND real_mods ${i})
-      endif()
-    endforeach()
-
-    # Set the output variables
-    set(MESON_LLVM_TARGETS_${mod} ${real_mods})
-    foreach(i IN LISTS real_mods)
-      set(MESON_TARGET_TO_LLVM_${i} ${mod})
-    endforeach()
-  endforeach()
-
-  # Check the following variables:
-  # LLVM_PACKAGE_VERSION
-  # LLVM_VERSION
-  # LLVM_VERSION_STRING
-  if(NOT DEFINED PACKAGE_VERSION)
-    if(DEFINED LLVM_PACKAGE_VERSION)
-      set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-    elseif(DEFINED LLVM_VERSION)
-      set(PACKAGE_VERSION "${LLVM_VERSION}")
-    elseif(DEFINED LLVM_VERSION_STRING)
-      set(PACKAGE_VERSION "${LLVM_VERSION_STRING}")
-    endif()
-  endif()
-
-  # Check the following variables:
-  # LLVM_LIBRARIES
-  # LLVM_LIBS
-  set(libs)
-  if(DEFINED LLVM_LIBRARIES)
-    set(libs LLVM_LIBRARIES)
-  elseif(DEFINED LLVM_LIBS)
-    set(libs LLVM_LIBS)
-  endif()
-
-  # Check the following variables:
-  # LLVM_INCLUDE_DIRS
-  # LLVM_INCLUDES
-  # LLVM_INCLUDE_DIR
-  set(includes)
-  if(DEFINED LLVM_INCLUDE_DIRS)
-    set(includes LLVM_INCLUDE_DIRS)
-  elseif(DEFINED LLVM_INCLUDES)
-    set(includes LLVM_INCLUDES)
-  elseif(DEFINED LLVM_INCLUDE_DIR)
-    set(includes LLVM_INCLUDE_DIR)
-  endif()
-
-  # Check the following variables:
-  # LLVM_DEFINITIONS
-  set(definitions)
-  if(DEFINED LLVM_DEFINITIONS)
-    set(definitions LLVM_DEFINITIONS)
-  endif()
-
-  set(PACKAGE_INCLUDE_DIRS "${${includes}}")
-  set(PACKAGE_DEFINITIONS  "${${definitions}}")
-  set(PACKAGE_LIBRARIES    "${${libs}}")
-endif()
diff --git a/meson/mesonbuild/dependencies/data/CMakePathInfo.txt b/meson/mesonbuild/dependencies/data/CMakePathInfo.txt
deleted file mode 100644 (file)
index 662ec58..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
-
-set(TMP_PATHS_LIST)
-list(APPEND TMP_PATHS_LIST ${CMAKE_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_APPBUNDLE_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_APPBUNDLE_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_APPBUNDLE_PATH})
-
-set(LIB_ARCH_LIST)
-if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-  file(GLOB implicit_dirs RELATIVE /lib /lib/*-linux-gnu* )
-  foreach(dir ${implicit_dirs})
-    if("${dir}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
-      list(APPEND LIB_ARCH_LIST "${dir}")
-    endif()
-  endforeach()
-endif()
-
-# "Export" these variables:
-set(MESON_ARCH_LIST ${LIB_ARCH_LIST})
-set(MESON_PATHS_LIST ${TMP_PATHS_LIST})
-set(MESON_CMAKE_ROOT ${CMAKE_ROOT})
-set(MESON_CMAKE_SYSROOT ${CMAKE_SYSROOT})
-set(MESON_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
-
-message(STATUS ${TMP_PATHS_LIST})
diff --git a/meson/mesonbuild/dependencies/dev.py b/meson/mesonbuild/dependencies/dev.py
deleted file mode 100644 (file)
index 67d7e65..0000000
+++ /dev/null
@@ -1,528 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies useful for
-# development purposes, such as testing, debugging, etc..
-
-import glob
-import os
-import re
-import typing as T
-
-from .. import mesonlib, mlog
-from ..mesonlib import version_compare, stringlistify, extract_as_list, MachineChoice
-from ..environment import get_llvm_tool_names
-from .base import (
-    DependencyException, DependencyMethods, ExternalDependency, PkgConfigDependency,
-    strip_system_libdirs, ConfigToolDependency, CMakeDependency, DependencyFactory,
-)
-from .misc import threads_factory
-from ..compilers.c import AppleClangCCompiler
-from ..compilers.cpp import AppleClangCPPCompiler
-
-if T.TYPE_CHECKING:
-    from .. environment import Environment
-
-
-def get_shared_library_suffix(environment, for_machine: MachineChoice):
-    """This is only guaranteed to work for languages that compile to machine
-    code, not for languages like C# that use a bytecode and always end in .dll
-    """
-    m = environment.machines[for_machine]
-    if m.is_windows():
-        return '.dll'
-    elif m.is_darwin():
-        return '.dylib'
-    return '.so'
-
-
-class GTestDependencySystem(ExternalDependency):
-    def __init__(self, name: str, environment, kwargs):
-        super().__init__(name, environment, kwargs, language='cpp')
-        self.main = kwargs.get('main', False)
-        self.src_dirs = ['/usr/src/gtest/src', '/usr/src/googletest/googletest/src']
-        if not self._add_sub_dependency(threads_factory(environment, self.for_machine, {})):
-            self.is_found = False
-            return
-        self.detect()
-
-    def detect(self):
-        gtest_detect = self.clib_compiler.find_library("gtest", self.env, [])
-        gtest_main_detect = self.clib_compiler.find_library("gtest_main", self.env, [])
-        if gtest_detect and (not self.main or gtest_main_detect):
-            self.is_found = True
-            self.compile_args = []
-            self.link_args = gtest_detect
-            if self.main:
-                self.link_args += gtest_main_detect
-            self.sources = []
-            self.prebuilt = True
-        elif self.detect_srcdir():
-            self.is_found = True
-            self.compile_args = ['-I' + d for d in self.src_include_dirs]
-            self.link_args = []
-            if self.main:
-                self.sources = [self.all_src, self.main_src]
-            else:
-                self.sources = [self.all_src]
-            self.prebuilt = False
-        else:
-            self.is_found = False
-
-    def detect_srcdir(self):
-        for s in self.src_dirs:
-            if os.path.exists(s):
-                self.src_dir = s
-                self.all_src = mesonlib.File.from_absolute_file(
-                    os.path.join(self.src_dir, 'gtest-all.cc'))
-                self.main_src = mesonlib.File.from_absolute_file(
-                    os.path.join(self.src_dir, 'gtest_main.cc'))
-                self.src_include_dirs = [os.path.normpath(os.path.join(self.src_dir, '..')),
-                                         os.path.normpath(os.path.join(self.src_dir, '../include')),
-                                         ]
-                return True
-        return False
-
-    def log_info(self):
-        if self.prebuilt:
-            return 'prebuilt'
-        else:
-            return 'building self'
-
-    def log_tried(self):
-        return 'system'
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
-
-
-class GTestDependencyPC(PkgConfigDependency):
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        assert name == 'gtest'
-        if kwargs.get('main'):
-            name = 'gtest_main'
-        super().__init__(name, environment, kwargs)
-
-
-class GMockDependencySystem(ExternalDependency):
-    def __init__(self, name: str, environment, kwargs):
-        super().__init__(name, environment, kwargs, language='cpp')
-        self.main = kwargs.get('main', False)
-        if not self._add_sub_dependency(threads_factory(environment, self.for_machine, {})):
-            self.is_found = False
-            return
-
-        # If we are getting main() from GMock, we definitely
-        # want to avoid linking in main() from GTest
-        gtest_kwargs = kwargs.copy()
-        if self.main:
-            gtest_kwargs['main'] = False
-
-        # GMock without GTest is pretty much useless
-        # this also mimics the structure given in WrapDB,
-        # where GMock always pulls in GTest
-        found = self._add_sub_dependency(gtest_factory(environment, self.for_machine, gtest_kwargs))
-        if not found:
-            self.is_found = False
-            return
-
-        # GMock may be a library or just source.
-        # Work with both.
-        gmock_detect = self.clib_compiler.find_library("gmock", self.env, [])
-        gmock_main_detect = self.clib_compiler.find_library("gmock_main", self.env, [])
-        if gmock_detect and (not self.main or gmock_main_detect):
-            self.is_found = True
-            self.link_args += gmock_detect
-            if self.main:
-                self.link_args += gmock_main_detect
-            self.prebuilt = True
-            return
-
-        for d in ['/usr/src/googletest/googlemock/src', '/usr/src/gmock/src', '/usr/src/gmock']:
-            if os.path.exists(d):
-                self.is_found = True
-                # Yes, we need both because there are multiple
-                # versions of gmock that do different things.
-                d2 = os.path.normpath(os.path.join(d, '..'))
-                self.compile_args += ['-I' + d, '-I' + d2, '-I' + os.path.join(d2, 'include')]
-                all_src = mesonlib.File.from_absolute_file(os.path.join(d, 'gmock-all.cc'))
-                main_src = mesonlib.File.from_absolute_file(os.path.join(d, 'gmock_main.cc'))
-                if self.main:
-                    self.sources += [all_src, main_src]
-                else:
-                    self.sources += [all_src]
-                self.prebuilt = False
-                return
-
-        self.is_found = False
-
-    def log_info(self):
-        if self.prebuilt:
-            return 'prebuilt'
-        else:
-            return 'building self'
-
-    def log_tried(self):
-        return 'system'
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
-
-
-class GMockDependencyPC(PkgConfigDependency):
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        assert name == 'gmock'
-        if kwargs.get('main'):
-            name = 'gmock_main'
-        super().__init__(name, environment, kwargs)
-
-
-class LLVMDependencyConfigTool(ConfigToolDependency):
-    """
-    LLVM uses a special tool, llvm-config, which has arguments for getting
-    c args, cxx args, and ldargs as well as version.
-    """
-    tool_name = 'llvm-config'
-    __cpp_blacklist = {'-DNDEBUG'}
-
-    def __init__(self, name: str, environment, kwargs):
-        self.tools = get_llvm_tool_names('llvm-config')
-
-        # Fedora starting with Fedora 30 adds a suffix of the number
-        # of bits in the isa that llvm targets, for example, on x86_64
-        # and aarch64 the name will be llvm-config-64, on x86 and arm
-        # it will be llvm-config-32.
-        if environment.machines[self.get_for_machine_from_kwargs(kwargs)].is_64_bit:
-            self.tools.append('llvm-config-64')
-        else:
-            self.tools.append('llvm-config-32')
-
-        # It's necessary for LLVM <= 3.8 to use the C++ linker. For 3.9 and 4.0
-        # the C linker works fine if only using the C API.
-        super().__init__(name, environment, kwargs, language='cpp')
-        self.provided_modules = []
-        self.required_modules = set()
-        self.module_details = []
-        if not self.is_found:
-            return
-
-        self.provided_modules = self.get_config_value(['--components'], 'modules')
-        modules = stringlistify(extract_as_list(kwargs, 'modules'))
-        self.check_components(modules)
-        opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules'))
-        self.check_components(opt_modules, required=False)
-
-        cargs = set(self.get_config_value(['--cppflags'], 'compile_args'))
-        self.compile_args = list(cargs.difference(self.__cpp_blacklist))
-
-        if version_compare(self.version, '>= 3.9'):
-            self._set_new_link_args(environment)
-        else:
-            self._set_old_link_args()
-        self.link_args = strip_system_libdirs(environment, self.for_machine, self.link_args)
-        self.link_args = self.__fix_bogus_link_args(self.link_args)
-        if not self._add_sub_dependency(threads_factory(environment, self.for_machine, {})):
-            self.is_found = False
-            return
-
-    def __fix_bogus_link_args(self, args):
-        """This function attempts to fix bogus link arguments that llvm-config
-        generates.
-
-        Currently it works around the following:
-            - FreeBSD: when statically linking -l/usr/lib/libexecinfo.so will
-              be generated, strip the -l in cases like this.
-            - Windows: We may get -LIBPATH:... which is later interpreted as
-              "-L IBPATH:...", if we're using an msvc like compilers convert
-              that to "/LIBPATH", otherwise to "-L ..."
-        """
-        cpp = self.env.coredata.compilers[self.for_machine]['cpp']
-
-        new_args = []
-        for arg in args:
-            if arg.startswith('-l') and arg.endswith('.so'):
-                new_args.append(arg.lstrip('-l'))
-            elif arg.startswith('-LIBPATH:'):
-                new_args.extend(cpp.get_linker_search_args(arg.lstrip('-LIBPATH:')))
-            else:
-                new_args.append(arg)
-        return new_args
-
-    def __check_libfiles(self, shared):
-        """Use llvm-config's --libfiles to check if libraries exist."""
-        mode = '--link-shared' if shared else '--link-static'
-
-        # Set self.required to true to force an exception in get_config_value
-        # if the returncode != 0
-        restore = self.required
-        self.required = True
-
-        try:
-            # It doesn't matter what the stage is, the caller needs to catch
-            # the exception anyway.
-            self.link_args = self.get_config_value(['--libfiles', mode], '')
-        finally:
-            self.required = restore
-
-    def _set_new_link_args(self, environment):
-        """How to set linker args for LLVM versions >= 3.9"""
-        mode = self.get_config_value(['--shared-mode'], 'link_args')[0]
-        if not self.static and mode == 'static':
-            # If llvm is configured with LLVM_BUILD_LLVM_DYLIB but not with
-            # LLVM_LINK_LLVM_DYLIB and not LLVM_BUILD_SHARED_LIBS (which
-            # upstream doesn't recommend using), then llvm-config will lie to
-            # you about how to do shared-linking. It wants to link to a a bunch
-            # of individual shared libs (which don't exist because llvm wasn't
-            # built with LLVM_BUILD_SHARED_LIBS.
-            #
-            # Therefore, we'll try to get the libfiles, if the return code is 0
-            # or we get an empty list, then we'll try to build a working
-            # configuration by hand.
-            try:
-                self.__check_libfiles(True)
-            except DependencyException:
-                lib_ext = get_shared_library_suffix(environment, self.for_machine)
-                libdir = self.get_config_value(['--libdir'], 'link_args')[0]
-                # Sort for reproducibility
-                matches = sorted(glob.iglob(os.path.join(libdir, 'libLLVM*{}'.format(lib_ext))))
-                if not matches:
-                    if self.required:
-                        raise
-                    self.is_found = False
-                    return
-
-                self.link_args = self.get_config_value(['--ldflags'], 'link_args')
-                libname = os.path.basename(matches[0]).rstrip(lib_ext).lstrip('lib')
-                self.link_args.append('-l{}'.format(libname))
-                return
-        elif self.static and mode == 'shared':
-            # If, however LLVM_BUILD_SHARED_LIBS is true # (*cough* gentoo *cough*)
-            # then this is correct. Building with LLVM_BUILD_SHARED_LIBS has a side
-            # effect, it stops the generation of static archives. Therefore we need
-            # to check for that and error out on static if this is the case
-            try:
-                self.__check_libfiles(False)
-            except DependencyException:
-                if self.required:
-                    raise
-                self.is_found = False
-                return
-
-        link_args = ['--link-static', '--system-libs'] if self.static else ['--link-shared']
-        self.link_args = self.get_config_value(
-            ['--libs', '--ldflags'] + link_args + list(self.required_modules),
-            'link_args')
-
-    def _set_old_link_args(self):
-        """Setting linker args for older versions of llvm.
-
-        Old versions of LLVM bring an extra level of insanity with them.
-        llvm-config will provide the correct arguments for static linking, but
-        not for shared-linnking, we have to figure those out ourselves, because
-        of course we do.
-        """
-        if self.static:
-            self.link_args = self.get_config_value(
-                ['--libs', '--ldflags', '--system-libs'] + list(self.required_modules),
-                'link_args')
-        else:
-            # llvm-config will provide arguments for static linking, so we get
-            # to figure out for ourselves what to link with. We'll do that by
-            # checking in the directory provided by --libdir for a library
-            # called libLLVM-<ver>.(so|dylib|dll)
-            libdir = self.get_config_value(['--libdir'], 'link_args')[0]
-
-            expected_name = 'libLLVM-{}'.format(self.version)
-            re_name = re.compile(r'{}.(so|dll|dylib)$'.format(expected_name))
-
-            for file_ in os.listdir(libdir):
-                if re_name.match(file_):
-                    self.link_args = ['-L{}'.format(libdir),
-                                      '-l{}'.format(os.path.splitext(file_.lstrip('lib'))[0])]
-                    break
-            else:
-                raise DependencyException(
-                    'Could not find a dynamically linkable library for LLVM.')
-
-    def check_components(self, modules, required=True):
-        """Check for llvm components (modules in meson terms).
-
-        The required option is whether the module is required, not whether LLVM
-        is required.
-        """
-        for mod in sorted(set(modules)):
-            status = ''
-
-            if mod not in self.provided_modules:
-                if required:
-                    self.is_found = False
-                    if self.required:
-                        raise DependencyException(
-                            'Could not find required LLVM Component: {}'.format(mod))
-                    status = '(missing)'
-                else:
-                    status = '(missing but optional)'
-            else:
-                self.required_modules.add(mod)
-
-            self.module_details.append(mod + status)
-
-    def log_details(self):
-        if self.module_details:
-            return 'modules: ' + ', '.join(self.module_details)
-        return ''
-
-class LLVMDependencyCMake(CMakeDependency):
-    def __init__(self, name: str, env, kwargs):
-        self.llvm_modules = stringlistify(extract_as_list(kwargs, 'modules'))
-        self.llvm_opt_modules = stringlistify(extract_as_list(kwargs, 'optional_modules'))
-        super().__init__(name, env, kwargs, language='cpp')
-
-        # Cmake will always create a statically linked binary, so don't use
-        # cmake if dynamic is required
-        if not self.static:
-            self.is_found = False
-            mlog.warning('Ignoring LLVM CMake dependency because dynamic was requested')
-            return
-
-        if self.traceparser is None:
-            return
-
-        # Extract extra include directories and definitions
-        inc_dirs = self.traceparser.get_cmake_var('PACKAGE_INCLUDE_DIRS')
-        defs = self.traceparser.get_cmake_var('PACKAGE_DEFINITIONS')
-        # LLVM explicitly uses space-separated variables rather than semicolon lists
-        if len(defs) == 1:
-            defs = defs[0].split(' ')
-        temp = ['-I' + x for x in inc_dirs] + defs
-        self.compile_args += [x for x in temp if x not in self.compile_args]
-        if not self._add_sub_dependency(threads_factory(env, self.for_machine, {})):
-            self.is_found = False
-            return
-
-    def _main_cmake_file(self) -> str:
-        # Use a custom CMakeLists.txt for LLVM
-        return 'CMakeListsLLVM.txt'
-
-    def _extra_cmake_opts(self) -> T.List[str]:
-        return ['-DLLVM_MESON_MODULES={}'.format(';'.join(self.llvm_modules + self.llvm_opt_modules))]
-
-    def _map_module_list(self, modules: T.List[T.Tuple[str, bool]], components: T.List[T.Tuple[str, bool]]) -> T.List[T.Tuple[str, bool]]:
-        res = []
-        for mod, required in modules:
-            cm_targets = self.traceparser.get_cmake_var('MESON_LLVM_TARGETS_{}'.format(mod))
-            if not cm_targets:
-                if required:
-                    raise self._gen_exception('LLVM module {} was not found'.format(mod))
-                else:
-                    mlog.warning('Optional LLVM module', mlog.bold(mod), 'was not found')
-                    continue
-            for i in cm_targets:
-                res += [(i, required)]
-        return res
-
-    def _original_module_name(self, module: str) -> str:
-        orig_name = self.traceparser.get_cmake_var('MESON_TARGET_TO_LLVM_{}'.format(module))
-        if orig_name:
-            return orig_name[0]
-        return module
-
-
-class ValgrindDependency(PkgConfigDependency):
-    '''
-    Consumers of Valgrind usually only need the compile args and do not want to
-    link to its (static) libraries.
-    '''
-    def __init__(self, env, kwargs):
-        super().__init__('valgrind', env, kwargs)
-
-    def get_link_args(self, **kwargs):
-        return []
-
-
-class ZlibSystemDependency(ExternalDependency):
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-
-        m = self.env.machines[self.for_machine]
-
-        # I'm not sure this is entirely correct. What if we're cross compiling
-        # from something to macOS?
-        if ((m.is_darwin() and isinstance(self.clib_compiler, (AppleClangCCompiler, AppleClangCPPCompiler))) or
-                m.is_freebsd() or m.is_dragonflybsd()):
-            self.is_found = True
-            self.link_args = ['-lz']
-
-            # No need to set includes,
-            # on macos xcode/clang will do that for us.
-            # on freebsd zlib.h is in /usr/include
-        elif m.is_windows():
-            if self.clib_compiler.get_argument_syntax() == 'msvc':
-                libs = ['zlib1' 'zlib']
-            else:
-                libs = ['z']
-            for lib in libs:
-                l = self.clib_compiler.find_library(lib, environment, [])
-                h = self.clib_compiler.has_header('zlib.h', '', environment, dependencies=[self])
-                if l and h:
-                    self.is_found = True
-                    self.link_args = l
-                    break
-            else:
-                return
-        else:
-            mlog.debug('Unsupported OS {}'.format(m.system))
-            return
-
-        v, _ = self.clib_compiler.get_define('ZLIB_VERSION', '#include <zlib.h>', self.env, [], [self])
-        self.version = v.strip('"')
-
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.SYSTEM]
-
-
-llvm_factory = DependencyFactory(
-    'LLVM',
-    [DependencyMethods.CMAKE, DependencyMethods.CONFIG_TOOL],
-    cmake_class=LLVMDependencyCMake,
-    configtool_class=LLVMDependencyConfigTool,
-)
-
-gtest_factory = DependencyFactory(
-    'gtest',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
-    pkgconfig_class=GTestDependencyPC,
-    system_class=GTestDependencySystem,
-)
-
-gmock_factory = DependencyFactory(
-    'gmock',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
-    pkgconfig_class=GMockDependencyPC,
-    system_class=GMockDependencySystem,
-)
-
-zlib_factory = DependencyFactory(
-    'zlib',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE, DependencyMethods.SYSTEM],
-    cmake_name='ZLIB',
-    system_class=ZlibSystemDependency,
-)
diff --git a/meson/mesonbuild/dependencies/hdf5.py b/meson/mesonbuild/dependencies/hdf5.py
deleted file mode 100644 (file)
index fadd109..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for miscellaneous external dependencies.
-
-import subprocess
-import shutil
-from pathlib import Path
-
-from .. import mlog
-from ..mesonlib import split_args, listify
-from .base import (DependencyException, DependencyMethods, ExternalDependency, ExternalProgram,
-                   PkgConfigDependency)
-
-class HDF5Dependency(ExternalDependency):
-
-    def __init__(self, environment, kwargs):
-        language = kwargs.get('language', 'c')
-        super().__init__('hdf5', environment, kwargs, language=language)
-        kwargs['required'] = False
-        kwargs['silent'] = True
-        self.is_found = False
-        methods = listify(self.methods)
-
-        if language not in ('c', 'cpp', 'fortran'):
-            raise DependencyException('Language {} is not supported with HDF5.'.format(language))
-
-        if set([DependencyMethods.AUTO, DependencyMethods.PKGCONFIG]).intersection(methods):
-            pkgconfig_files = ['hdf5', 'hdf5-serial']
-            PCEXE = shutil.which('pkg-config')
-            if PCEXE:
-                # some distros put hdf5-1.2.3.pc with version number in .pc filename.
-                ret = subprocess.run([PCEXE, '--list-all'], stdout=subprocess.PIPE, stderr=subprocess.DEVNULL,
-                                     universal_newlines=True)
-                if ret.returncode == 0:
-                    for pkg in ret.stdout.split('\n'):
-                        if pkg.startswith(('hdf5')):
-                            pkgconfig_files.append(pkg.split(' ', 1)[0])
-                    pkgconfig_files = list(set(pkgconfig_files))  # dedupe
-
-            for pkg in pkgconfig_files:
-                pkgdep = PkgConfigDependency(pkg, environment, kwargs, language=self.language)
-                if not pkgdep.found():
-                    continue
-
-                self.compile_args = pkgdep.get_compile_args()
-                # some broken pkgconfig don't actually list the full path to the needed includes
-                newinc = []
-                for arg in self.compile_args:
-                    if arg.startswith('-I'):
-                        stem = 'static' if kwargs.get('static', False) else 'shared'
-                        if (Path(arg[2:]) / stem).is_dir():
-                            newinc.append('-I' + str(Path(arg[2:]) / stem))
-                self.compile_args += newinc
-
-                # derive needed libraries by language
-                pd_link_args = pkgdep.get_link_args()
-                link_args = []
-                for larg in pd_link_args:
-                    lpath = Path(larg)
-                    # some pkg-config hdf5.pc (e.g. Ubuntu) don't include the commonly-used HL HDF5 libraries,
-                    # so let's add them if they exist
-                    # additionally, some pkgconfig HDF5 HL files are malformed so let's be sure to find HL anyway
-                    if lpath.is_file():
-                        hl = []
-                        if language == 'cpp':
-                            hl += ['_hl_cpp', '_cpp']
-                        elif language == 'fortran':
-                            hl += ['_hl_fortran', 'hl_fortran', '_fortran']
-                        hl += ['_hl']  # C HL library, always needed
-
-                        suffix = '.' + lpath.name.split('.', 1)[1]  # in case of .dll.a
-                        for h in hl:
-                            hlfn = lpath.parent / (lpath.name.split('.', 1)[0] + h + suffix)
-                            if hlfn.is_file():
-                                link_args.append(str(hlfn))
-                        # HDF5 C libs are required by other HDF5 languages
-                        link_args.append(larg)
-                    else:
-                        link_args.append(larg)
-
-                self.link_args = link_args
-                self.version = pkgdep.get_version()
-                self.is_found = True
-                self.pcdep = pkgdep
-                return
-
-        if DependencyMethods.AUTO in methods:
-            wrappers = {'c': 'h5cc', 'cpp': 'h5c++', 'fortran': 'h5fc'}
-            comp_args = []
-            link_args = []
-            # have to always do C as well as desired language
-            for lang in set([language, 'c']):
-                prog = ExternalProgram(wrappers[lang], silent=True)
-                if not prog.found():
-                    return
-                cmd = prog.get_command() + ['-show']
-                p = subprocess.run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, timeout=15)
-                if p.returncode != 0:
-                    mlog.debug('Command', mlog.bold(cmd), 'failed to run:')
-                    mlog.debug(mlog.bold('Standard output\n'), p.stdout)
-                    mlog.debug(mlog.bold('Standard error\n'), p.stderr)
-                    return
-                args = split_args(p.stdout)
-                for arg in args[1:]:
-                    if arg.startswith(('-I', '-f', '-D')) or arg == '-pthread':
-                        comp_args.append(arg)
-                    elif arg.startswith(('-L', '-l', '-Wl')):
-                        link_args.append(arg)
-                    elif Path(arg).is_file():
-                        link_args.append(arg)
-            self.compile_args = comp_args
-            self.link_args = link_args
-            self.is_found = True
-            return
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.AUTO, DependencyMethods.PKGCONFIG]
diff --git a/meson/mesonbuild/dependencies/misc.py b/meson/mesonbuild/dependencies/misc.py
deleted file mode 100644 (file)
index 47694af..0000000
+++ /dev/null
@@ -1,501 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for miscellaneous external dependencies.
-
-from pathlib import Path
-import functools
-import re
-import sysconfig
-import typing as T
-
-from .. import mlog
-from .. import mesonlib
-from ..environment import detect_cpu_family
-
-from .base import (
-    DependencyException, DependencyMethods, ExternalDependency,
-    PkgConfigDependency, CMakeDependency, ConfigToolDependency,
-    factory_methods, DependencyFactory,
-)
-
-if T.TYPE_CHECKING:
-    from ..environment import Environment, MachineChoice
-    from .base import DependencyType  # noqa: F401
-
-
-@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE})
-def netcdf_factory(env: 'Environment', for_machine: 'MachineChoice',
-                   kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    language = kwargs.get('language', 'c')
-    if language not in ('c', 'cpp', 'fortran'):
-        raise DependencyException('Language {} is not supported with NetCDF.'.format(language))
-
-    candidates = []  # type: T.List['DependencyType']
-
-    if DependencyMethods.PKGCONFIG in methods:
-        if language == 'fortran':
-            pkg = 'netcdf-fortran'
-        else:
-            pkg = 'netcdf'
-
-        candidates.append(functools.partial(PkgConfigDependency, pkg, env, kwargs, language=language))
-
-    if DependencyMethods.CMAKE in methods:
-        candidates.append(functools.partial(CMakeDependency, 'NetCDF', env, kwargs, language=language))
-
-    return candidates
-
-
-class OpenMPDependency(ExternalDependency):
-    # Map date of specification release (which is the macro value) to a version.
-    VERSIONS = {
-        '201811': '5.0',
-        '201611': '5.0-revision1',  # This is supported by ICC 19.x
-        '201511': '4.5',
-        '201307': '4.0',
-        '201107': '3.1',
-        '200805': '3.0',
-        '200505': '2.5',
-        '200203': '2.0',
-        '199810': '1.0',
-    }
-
-    def __init__(self, environment, kwargs):
-        language = kwargs.get('language')
-        super().__init__('openmp', environment, kwargs, language=language)
-        self.is_found = False
-        if self.clib_compiler.get_id() == 'pgi':
-            # through at least PGI 19.4, there is no macro defined for OpenMP, but OpenMP 3.1 is supported.
-            self.version = '3.1'
-            self.is_found = True
-            self.compile_args = self.link_args = self.clib_compiler.openmp_flags()
-            return
-        try:
-            openmp_date = self.clib_compiler.get_define(
-                '_OPENMP', '', self.env, self.clib_compiler.openmp_flags(), [self], disable_cache=True)[0]
-        except mesonlib.EnvironmentException as e:
-            mlog.debug('OpenMP support not available in the compiler')
-            mlog.debug(e)
-            openmp_date = None
-
-        if openmp_date:
-            self.version = self.VERSIONS[openmp_date]
-            # Flang has omp_lib.h
-            header_names = ('omp.h', 'omp_lib.h')
-            for name in header_names:
-                if self.clib_compiler.has_header(name, '', self.env, dependencies=[self], disable_cache=True)[0]:
-                    self.is_found = True
-                    self.compile_args = self.clib_compiler.openmp_flags()
-                    self.link_args = self.clib_compiler.openmp_link_flags()
-                    break
-            if not self.is_found:
-                mlog.log(mlog.yellow('WARNING:'), 'OpenMP found but omp.h missing.')
-
-
-class ThreadDependency(ExternalDependency):
-    def __init__(self, name: str, environment, kwargs):
-        super().__init__(name, environment, kwargs)
-        self.is_found = True
-        # Happens if you are using a language with threads
-        # concept without C, such as plain Cuda.
-        if self.clib_compiler is None:
-            self.compile_args = []
-            self.link_args = []
-        else:
-            self.compile_args = self.clib_compiler.thread_flags(environment)
-            self.link_args = self.clib_compiler.thread_link_flags(environment)
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.AUTO, DependencyMethods.CMAKE]
-
-
-class BlocksDependency(ExternalDependency):
-    def __init__(self, environment, kwargs):
-        super().__init__('blocks', environment, kwargs)
-        self.name = 'blocks'
-        self.is_found = False
-
-        if self.env.machines[self.for_machine].is_darwin():
-            self.compile_args = []
-            self.link_args = []
-        else:
-            self.compile_args = ['-fblocks']
-            self.link_args = ['-lBlocksRuntime']
-
-            if not self.clib_compiler.has_header('Block.h', '', environment, disable_cache=True) or \
-               not self.clib_compiler.find_library('BlocksRuntime', environment, []):
-                mlog.log(mlog.red('ERROR:'), 'BlocksRuntime not found.')
-                return
-
-        source = '''
-            int main(int argc, char **argv)
-            {
-                int (^callback)(void) = ^ int (void) { return 0; };
-                return callback();
-            }'''
-
-        with self.clib_compiler.compile(source, extra_args=self.compile_args + self.link_args) as p:
-            if p.returncode != 0:
-                mlog.log(mlog.red('ERROR:'), 'Compiler does not support blocks extension.')
-                return
-
-            self.is_found = True
-
-
-class Python3DependencySystem(ExternalDependency):
-    def __init__(self, name, environment, kwargs):
-        super().__init__(name, environment, kwargs)
-
-        if not environment.machines.matches_build_machine(self.for_machine):
-            return
-        if not environment.machines[self.for_machine].is_windows():
-            return
-
-        self.name = 'python3'
-        self.static = kwargs.get('static', False)
-        # We can only be sure that it is Python 3 at this point
-        self.version = '3'
-        self._find_libpy3_windows(environment)
-
-    @staticmethod
-    def get_windows_python_arch():
-        pyplat = sysconfig.get_platform()
-        if pyplat == 'mingw':
-            pycc = sysconfig.get_config_var('CC')
-            if pycc.startswith('x86_64'):
-                return '64'
-            elif pycc.startswith(('i686', 'i386')):
-                return '32'
-            else:
-                mlog.log('MinGW Python built with unknown CC {!r}, please file'
-                         'a bug'.format(pycc))
-                return None
-        elif pyplat == 'win32':
-            return '32'
-        elif pyplat in ('win64', 'win-amd64'):
-            return '64'
-        mlog.log('Unknown Windows Python platform {!r}'.format(pyplat))
-        return None
-
-    def get_windows_link_args(self):
-        pyplat = sysconfig.get_platform()
-        if pyplat.startswith('win'):
-            vernum = sysconfig.get_config_var('py_version_nodot')
-            if self.static:
-                libpath = Path('libs') / 'libpython{}.a'.format(vernum)
-            else:
-                comp = self.get_compiler()
-                if comp.id == "gcc":
-                    libpath = 'python{}.dll'.format(vernum)
-                else:
-                    libpath = Path('libs') / 'python{}.lib'.format(vernum)
-            lib = Path(sysconfig.get_config_var('base')) / libpath
-        elif pyplat == 'mingw':
-            if self.static:
-                libname = sysconfig.get_config_var('LIBRARY')
-            else:
-                libname = sysconfig.get_config_var('LDLIBRARY')
-            lib = Path(sysconfig.get_config_var('LIBDIR')) / libname
-        if not lib.exists():
-            mlog.log('Could not find Python3 library {!r}'.format(str(lib)))
-            return None
-        return [str(lib)]
-
-    def _find_libpy3_windows(self, env):
-        '''
-        Find python3 libraries on Windows and also verify that the arch matches
-        what we are building for.
-        '''
-        pyarch = self.get_windows_python_arch()
-        if pyarch is None:
-            self.is_found = False
-            return
-        arch = detect_cpu_family(env.coredata.compilers.host)
-        if arch == 'x86':
-            arch = '32'
-        elif arch == 'x86_64':
-            arch = '64'
-        else:
-            # We can't cross-compile Python 3 dependencies on Windows yet
-            mlog.log('Unknown architecture {!r} for'.format(arch),
-                     mlog.bold(self.name))
-            self.is_found = False
-            return
-        # Pyarch ends in '32' or '64'
-        if arch != pyarch:
-            mlog.log('Need', mlog.bold(self.name), 'for {}-bit, but '
-                     'found {}-bit'.format(arch, pyarch))
-            self.is_found = False
-            return
-        # This can fail if the library is not found
-        largs = self.get_windows_link_args()
-        if largs is None:
-            self.is_found = False
-            return
-        self.link_args = largs
-        # Compile args
-        inc = sysconfig.get_path('include')
-        platinc = sysconfig.get_path('platinclude')
-        self.compile_args = ['-I' + inc]
-        if inc != platinc:
-            self.compile_args.append('-I' + platinc)
-        self.version = sysconfig.get_config_var('py_version')
-        self.is_found = True
-
-    @staticmethod
-    def get_methods():
-        if mesonlib.is_windows():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG]
-        elif mesonlib.is_osx():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.EXTRAFRAMEWORK]
-        else:
-            return [DependencyMethods.PKGCONFIG]
-
-    def log_tried(self):
-        return 'sysconfig'
-
-class PcapDependencyConfigTool(ConfigToolDependency):
-
-    tools = ['pcap-config']
-    tool_name = 'pcap-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--libs'], 'link_args')
-        self.version = self.get_pcap_lib_version()
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
-
-    def get_pcap_lib_version(self):
-        # Since we seem to need to run a program to discover the pcap version,
-        # we can't do that when cross-compiling
-        # FIXME: this should be handled if we have an exe_wrapper
-        if not self.env.machines.matches_build_machine(self.for_machine):
-            return None
-
-        v = self.clib_compiler.get_return_value('pcap_lib_version', 'string',
-                                                '#include <pcap.h>', self.env, [], [self])
-        v = re.sub(r'libpcap version ', '', v)
-        v = re.sub(r' -- Apple version.*$', '', v)
-        return v
-
-
-class CupsDependencyConfigTool(ConfigToolDependency):
-
-    tools = ['cups-config']
-    tool_name = 'cups-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--ldflags', '--libs'], 'link_args')
-
-    @staticmethod
-    def get_methods():
-        if mesonlib.is_osx():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE]
-        else:
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.CMAKE]
-
-
-class LibWmfDependencyConfigTool(ConfigToolDependency):
-
-    tools = ['libwmf-config']
-    tool_name = 'libwmf-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--libs'], 'link_args')
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
-
-
-class LibGCryptDependencyConfigTool(ConfigToolDependency):
-
-    tools = ['libgcrypt-config']
-    tool_name = 'libgcrypt-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--libs'], 'link_args')
-        self.version = self.get_config_value(['--version'], 'version')[0]
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
-
-
-class GpgmeDependencyConfigTool(ConfigToolDependency):
-
-    tools = ['gpgme-config']
-    tool_name = 'gpg-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--libs'], 'link_args')
-        self.version = self.get_config_value(['--version'], 'version')[0]
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
-
-
-class ShadercDependency(ExternalDependency):
-
-    def __init__(self, environment, kwargs):
-        super().__init__('shaderc', environment, kwargs)
-
-        static_lib = 'shaderc_combined'
-        shared_lib = 'shaderc_shared'
-
-        libs = [shared_lib, static_lib]
-        if self.static:
-            libs.reverse()
-
-        cc = self.get_compiler()
-
-        for lib in libs:
-            self.link_args = cc.find_library(lib, environment, [])
-            if self.link_args is not None:
-                self.is_found = True
-
-                if self.static and lib != static_lib:
-                    mlog.warning('Static library {!r} not found for dependency {!r}, may '
-                                 'not be statically linked'.format(static_lib, self.name))
-
-                break
-
-    def log_tried(self):
-        return 'system'
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.SYSTEM, DependencyMethods.PKGCONFIG]
-
-
-@factory_methods({DependencyMethods.PKGCONFIG})
-def curses_factory(env: 'Environment', for_machine: 'MachineChoice',
-                   kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    candidates = []  # type: T.List['DependencyType']
-
-    if DependencyMethods.PKGCONFIG in methods:
-        pkgconfig_files = ['ncurses', 'ncursesw']
-        for pkg in pkgconfig_files:
-            candidates.append(functools.partial(PkgConfigDependency, pkg, env, kwargs))
-
-    return candidates
-
-
-@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM})
-def shaderc_factory(env: 'Environment', for_machine: 'MachineChoice',
-                    kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    """Custom DependencyFactory for ShaderC.
-
-    ShaderC's odd you get three different libraries from the same build
-    thing are just easier to represent as a separate function than
-    twisting DependencyFactory even more.
-    """
-    candidates = []  # type: T.List['DependencyType']
-
-    if DependencyMethods.PKGCONFIG in methods:
-        # ShaderC packages their shared and static libs together
-        # and provides different pkg-config files for each one. We
-        # smooth over this difference by handling the static
-        # keyword before handing off to the pkg-config handler.
-        shared_libs = ['shaderc']
-        static_libs = ['shaderc_combined', 'shaderc_static']
-
-        if kwargs.get('static', False):
-            c = [functools.partial(PkgConfigDependency, name, env, kwargs)
-                 for name in static_libs + shared_libs]
-        else:
-            c = [functools.partial(PkgConfigDependency, name, env, kwargs)
-                 for name in shared_libs + static_libs]
-        candidates.extend(c)
-
-    if DependencyMethods.SYSTEM in methods:
-        candidates.append(functools.partial(ShadercDependency, env, kwargs))
-
-    return candidates
-
-
-cups_factory = DependencyFactory(
-    'cups',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK, DependencyMethods.CMAKE],
-    configtool_class=CupsDependencyConfigTool,
-    cmake_name='Cups',
-)
-
-gpgme_factory = DependencyFactory(
-    'gpgme',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
-    configtool_class=GpgmeDependencyConfigTool,
-)
-
-libgcrypt_factory = DependencyFactory(
-    'libgcrypt',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
-    configtool_class=LibGCryptDependencyConfigTool,
-)
-
-libwmf_factory = DependencyFactory(
-    'libwmf',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
-    configtool_class=LibWmfDependencyConfigTool,
-)
-
-pcap_factory = DependencyFactory(
-    'pcap',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL],
-    configtool_class=PcapDependencyConfigTool,
-    pkgconfig_name='libpcap',
-)
-
-python3_factory = DependencyFactory(
-    'python3',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM, DependencyMethods.EXTRAFRAMEWORK],
-    system_class=Python3DependencySystem,
-    # There is no version number in the macOS version number
-    framework_name='Python',
-    # There is a python in /System/Library/Frameworks, but thats python 2.x,
-    # Python 3 will always be in /Library
-    extra_kwargs={'paths': ['/Library/Frameworks']},
-)
-
-threads_factory = DependencyFactory(
-    'threads',
-    [DependencyMethods.SYSTEM, DependencyMethods.CMAKE],
-    cmake_name='Threads',
-    system_class=ThreadDependency,
-)
diff --git a/meson/mesonbuild/dependencies/mpi.py b/meson/mesonbuild/dependencies/mpi.py
deleted file mode 100644 (file)
index a20fb9c..0000000
+++ /dev/null
@@ -1,231 +0,0 @@
-# Copyright 2013-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import functools
-import typing as T
-import os
-import re
-
-from .base import (DependencyMethods, PkgConfigDependency, factory_methods,
-                   ConfigToolDependency, detect_compiler, ExternalDependency)
-from ..environment import detect_cpu_family
-
-if T.TYPE_CHECKING:
-    from .base import DependencyType
-    from ..compilers import Compiler
-    from ..environment import Environment, MachineChoice
-
-
-@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.SYSTEM})
-def mpi_factory(env: 'Environment', for_machine: 'MachineChoice',
-                kwargs: T.Dict[str, T.Any], methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    language = kwargs.get('language', 'c')
-    if language not in {'c', 'cpp', 'fortran'}:
-        # OpenMPI doesn't work without any other languages
-        return []
-
-    candidates = []
-    compiler = detect_compiler('mpi', env, for_machine, language)
-    compiler_is_intel = compiler.get_id() in {'intel', 'intel-cl'}
-
-    # Only OpenMPI has pkg-config, and it doesn't work with the intel compilers
-    if DependencyMethods.PKGCONFIG in methods and not compiler_is_intel:
-        pkg_name = None
-        if language == 'c':
-            pkg_name = 'ompi-c'
-        elif language == 'cpp':
-            pkg_name = 'ompi-cxx'
-        elif language == 'fortran':
-            pkg_name = 'ompi-fort'
-        candidates.append(functools.partial(
-            PkgConfigDependency, pkg_name, env, kwargs, language=language))
-
-    if DependencyMethods.CONFIG_TOOL in methods:
-        nwargs = kwargs.copy()
-
-        if compiler_is_intel:
-            if env.machines[for_machine].is_windows():
-                nwargs['version_arg'] = '-v'
-                nwargs['returncode_value'] = 3
-
-            if language == 'c':
-                tool_names = [os.environ.get('I_MPI_CC'), 'mpiicc']
-            elif language == 'cpp':
-                tool_names = [os.environ.get('I_MPI_CXX'), 'mpiicpc']
-            elif language == 'fortran':
-                tool_names = [os.environ.get('I_MPI_F90'), 'mpiifort']
-
-            cls = IntelMPIConfigToolDependency  # type: T.Type[ConfigToolDependency]
-        else: # OpenMPI, which doesn't work with intel
-            #
-            # We try the environment variables for the tools first, but then
-            # fall back to the hardcoded names
-            if language == 'c':
-                tool_names = [os.environ.get('MPICC'), 'mpicc']
-            elif language == 'cpp':
-                tool_names = [os.environ.get('MPICXX'), 'mpic++', 'mpicxx', 'mpiCC']
-            elif language == 'fortran':
-                tool_names = [os.environ.get(e) for e in ['MPIFC', 'MPIF90', 'MPIF77']]
-                tool_names.extend(['mpifort', 'mpif90', 'mpif77'])
-
-            cls = OpenMPIConfigToolDependency
-
-        tool_names = [t for t in tool_names if t]  # remove empty environment variables
-        assert tool_names
-
-        nwargs['tools'] = tool_names
-        candidates.append(functools.partial(
-            cls, tool_names[0], env, nwargs, language=language))
-
-    if DependencyMethods.SYSTEM in methods:
-        candidates.append(functools.partial(
-            MSMPIDependency, 'msmpi', env, kwargs, language=language))
-
-    return candidates
-
-
-class _MPIConfigToolDependency(ConfigToolDependency):
-
-    def _filter_compile_args(self, args: T.Sequence[str]) -> T.List[str]:
-        """
-        MPI wrappers return a bunch of garbage args.
-        Drop -O2 and everything that is not needed.
-        """
-        result = []
-        multi_args = ('-I', )
-        if self.language == 'fortran':
-            fc = self.env.coredata.compilers[self.for_machine]['fortran']
-            multi_args += fc.get_module_incdir_args()
-
-        include_next = False
-        for f in args:
-            if f.startswith(('-D', '-f') + multi_args) or f == '-pthread' \
-                    or (f.startswith('-W') and f != '-Wall' and not f.startswith('-Werror')):
-                result.append(f)
-                if f in multi_args:
-                    # Path is a separate argument.
-                    include_next = True
-            elif include_next:
-                include_next = False
-                result.append(f)
-        return result
-
-    def _filter_link_args(self, args: T.Sequence[str]) -> T.List[str]:
-        """
-        MPI wrappers return a bunch of garbage args.
-        Drop -O2 and everything that is not needed.
-        """
-        result = []
-        include_next = False
-        for f in args:
-            if self._is_link_arg(f):
-                result.append(f)
-                if f in ('-L', '-Xlinker'):
-                    include_next = True
-            elif include_next:
-                include_next = False
-                result.append(f)
-        return result
-
-    def _is_link_arg(self, f: str) -> bool:
-        if self.clib_compiler.id == 'intel-cl':
-            return f == '/link' or f.startswith('/LIBPATH') or f.endswith('.lib')   # always .lib whether static or dynamic
-        else:
-            return (f.startswith(('-L', '-l', '-Xlinker')) or
-                    f == '-pthread' or
-                    (f.startswith('-W') and f != '-Wall' and not f.startswith('-Werror')))
-
-
-class IntelMPIConfigToolDependency(_MPIConfigToolDependency):
-
-    """Wrapper around Intel's mpiicc and friends."""
-
-    version_arg = '-v'  # --version is not the same as -v
-
-    def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any],
-                 language: T.Optional[str] = None):
-        super().__init__(name, env, kwargs, language=language)
-        if not self.is_found:
-            return
-
-        args = self.get_config_value(['-show'], 'link and compile args')
-        self.compile_args = self._filter_compile_args(args)
-        self.link_args = self._filter_link_args(args)
-
-    def _sanitize_version(self, out: str) -> str:
-        v = re.search(r'(\d{4}) Update (\d)', out)
-        if v:
-            return '{}.{}'.format(v.group(1), v.group(2))
-        return out
-
-
-class OpenMPIConfigToolDependency(_MPIConfigToolDependency):
-
-    """Wrapper around OpenMPI mpicc and friends."""
-
-    version_arg = '--showme:version'
-
-    def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any],
-                 language: T.Optional[str] = None):
-        super().__init__(name, env, kwargs, language=language)
-        if not self.is_found:
-            return
-
-        c_args = self.get_config_value(['--showme:compile'], 'compile_args')
-        self.compile_args = self._filter_compile_args(c_args)
-
-        l_args = self.get_config_value(['--showme:link'], 'link_args')
-        self.link_args = self._filter_link_args(l_args)
-
-    def _sanitize_version(self, out: str) -> str:
-        v = re.search(r'\d+.\d+.\d+', out)
-        if v:
-            return v.group(0)
-        return out
-
-
-class MSMPIDependency(ExternalDependency):
-
-    """The Microsoft MPI."""
-
-    def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any],
-                 language: T.Optional[str] = None):
-        super().__init__(name, env, kwargs, language=language)
-        # MSMPI only supports the C API
-        if language not in {'c', 'fortran', None}:
-            self.is_found = False
-            return
-        # MSMPI is only for windows, obviously
-        if not self.env.machines[self.for_machine].is_windows():
-            return
-
-        incdir = os.environ.get('MSMPI_INC')
-        arch = detect_cpu_family(self.env.coredata.compilers.host)
-        libdir = None
-        if arch == 'x86':
-            libdir = os.environ.get('MSMPI_LIB32')
-            post = 'x86'
-        elif arch == 'x86_64':
-            libdir = os.environ.get('MSMPI_LIB64')
-            post = 'x64'
-
-        if libdir is None or incdir is None:
-            self.is_found = False
-            return
-
-        self.is_found = True
-        self.link_args = ['-l' + os.path.join(libdir, 'msmpi')]
-        self.compile_args = ['-I' + incdir, '-I' + os.path.join(incdir, post)]
-        if self.language == 'fortran':
-            self.link_args.append('-l' + os.path.join(libdir, 'msmpifec'))
diff --git a/meson/mesonbuild/dependencies/platform.py b/meson/mesonbuild/dependencies/platform.py
deleted file mode 100644 (file)
index 6a32e36..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-# Copyright 2013-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies that are
-# platform-specific (generally speaking).
-
-from .base import ExternalDependency, DependencyException
-from ..mesonlib import MesonException
-
-class AppleFrameworks(ExternalDependency):
-    def __init__(self, env, kwargs):
-        super().__init__('appleframeworks', env, kwargs)
-        modules = kwargs.get('modules', [])
-        if isinstance(modules, str):
-            modules = [modules]
-        if not modules:
-            raise DependencyException("AppleFrameworks dependency requires at least one module.")
-        self.frameworks = modules
-        if not self.clib_compiler:
-            raise DependencyException('No C-like compilers are available, cannot find the framework')
-        self.is_found = True
-        for f in self.frameworks:
-            try:
-                args = self.clib_compiler.find_framework(f, env, [])
-            except MesonException as e:
-                if 'non-clang' in str(e):
-                    self.is_found = False
-                    self.link_args = []
-                    self.compile_args = []
-                    return
-                raise
-
-            if args is not None:
-                # No compile args are needed for system frameworks
-                self.link_args += args
-            else:
-                self.is_found = False
-
-    def log_info(self):
-        return ', '.join(self.frameworks)
-
-    def log_tried(self):
-        return 'framework'
diff --git a/meson/mesonbuild/dependencies/scalapack.py b/meson/mesonbuild/dependencies/scalapack.py
deleted file mode 100644 (file)
index 8774746..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-# Copyright 2013-2020 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from pathlib import Path
-import functools
-import os
-import typing as T
-
-from .base import CMakeDependency, DependencyMethods, PkgConfigDependency
-from .base import factory_methods, DependencyException
-
-if T.TYPE_CHECKING:
-    from ..environment import Environment, MachineChoice
-    from .base import DependencyType
-
-
-@factory_methods({DependencyMethods.PKGCONFIG, DependencyMethods.CMAKE})
-def scalapack_factory(env: 'Environment', for_machine: 'MachineChoice',
-                      kwargs: T.Dict[str, T.Any],
-                      methods: T.List[DependencyMethods]) -> T.List['DependencyType']:
-    candidates = []
-
-    if DependencyMethods.PKGCONFIG in methods:
-        mkl = 'mkl-static-lp64-iomp' if kwargs.get('static', False) else 'mkl-dynamic-lp64-iomp'
-        candidates.append(functools.partial(
-            MKLPkgConfigDependency, mkl, env, kwargs))
-
-        for pkg in ['scalapack-openmpi', 'scalapack']:
-            candidates.append(functools.partial(
-                PkgConfigDependency, pkg, env, kwargs))
-
-    if DependencyMethods.CMAKE in methods:
-        candidates.append(functools.partial(
-            CMakeDependency, 'Scalapack', env, kwargs))
-
-    return candidates
-
-
-class MKLPkgConfigDependency(PkgConfigDependency):
-
-    """PkgConfigDependency for Intel MKL.
-
-    MKL's pkg-config is pretty much borked in every way. We need to apply a
-    bunch of fixups to make it work correctly.
-    """
-
-    def __init__(self, name: str, env: 'Environment', kwargs: T.Dict[str, T.Any],
-                 language: T.Optional[str] = None):
-        _m = os.environ.get('MKLROOT')
-        self.__mklroot = Path(_m).resolve() if _m else None
-
-        # We need to call down into the normal super() method even if we don't
-        # find mklroot, otherwise we won't have all of the instance variables
-        # initialized that meson expects.
-        super().__init__(name, env, kwargs, language=language)
-
-        # Doesn't work with gcc on windows, but does on Linux
-        if (not self.__mklroot or (env.machines[self.for_machine].is_windows()
-                                   and self.clib_compiler.id == 'gcc')):
-            self.is_found = False
-
-        # This can happen either because we're using GCC, we couldn't find the
-        # mklroot, or the pkg-config couldn't find it.
-        if not self.is_found:
-            return
-
-        assert self.version != '', 'This should not happen if we didn\'t return above'
-
-        if self.version == 'unknown':
-            # At least by 2020 the version is in the pkg-config, just not with
-            # the correct name
-            v = self.get_variable(pkgconfig='Version', default_value='')
-
-            if not v and self.__mklroot:
-                try:
-                    v = (
-                        self.__mklroot.as_posix()
-                        .split('compilers_and_libraries_')[1]
-                        .split('/', 1)[0]
-                    )
-                except IndexError:
-                    pass
-
-            if v:
-                self.version = v
-
-    def _set_libs(self):
-        super()._set_libs()
-
-        if self.env.machines[self.for_machine].is_windows():
-            suffix = '.lib'
-        elif self.static:
-            suffix = '.a'
-        else:
-            suffix = ''
-        libdir = self.__mklroot / 'lib/intel64'
-
-        if self.clib_compiler.id == 'gcc':
-            for i, a in enumerate(self.link_args):
-                # only replace in filename, not in directory names
-                parts = list(os.path.split(a))
-                if 'mkl_intel_lp64' in parts[-1]:
-                    parts[-1] = parts[-1].replace('intel', 'gf')
-                    self.link_args[i] = '/' + os.path.join(*parts)
-        # MKL pkg-config omits scalapack
-        # be sure "-L" and "-Wl" are first if present
-        i = 0
-        for j, a in enumerate(self.link_args):
-            if a.startswith(('-L', '-Wl')):
-                i = j + 1
-            elif j > 3:
-                break
-        if self.env.machines[self.for_machine].is_windows() or self.static:
-            self.link_args.insert(
-                i, str(libdir / ('mkl_scalapack_lp64' + suffix))
-            )
-            self.link_args.insert(
-                i + 1, str(libdir / ('mkl_blacs_intelmpi_lp64' + suffix))
-            )
-        else:
-            self.link_args.insert(i, '-lmkl_scalapack_lp64')
-            self.link_args.insert(i + 1, '-lmkl_blacs_intelmpi_lp64')
-
-    def _set_cargs(self):
-        env = None
-        if self.language == 'fortran':
-            # gfortran doesn't appear to look in system paths for INCLUDE files,
-            # so don't allow pkg-config to suppress -I flags for system paths
-            env = os.environ.copy()
-            env['PKG_CONFIG_ALLOW_SYSTEM_CFLAGS'] = '1'
-        ret, out, err = self._call_pkgbin([
-            '--cflags', self.name,
-            '--define-variable=prefix=' + self.__mklroot.as_posix()],
-            env=env)
-        if ret != 0:
-            raise DependencyException('Could not generate cargs for %s:\n%s\n' %
-                                      (self.name, err))
-        self.compile_args = self._convert_mingw_paths(self._split_args(out))
diff --git a/meson/mesonbuild/dependencies/ui.py b/meson/mesonbuild/dependencies/ui.py
deleted file mode 100644 (file)
index 95dfe2b..0000000
+++ /dev/null
@@ -1,684 +0,0 @@
-# Copyright 2013-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies that
-# are UI-related.
-import os
-import re
-import subprocess
-import typing as T
-from collections import OrderedDict
-
-from .. import mlog
-from .. import mesonlib
-from ..mesonlib import (
-    MesonException, Popen_safe, extract_as_list, version_compare_many
-)
-from ..environment import detect_cpu_family
-
-from .base import DependencyException, DependencyMethods
-from .base import ExternalDependency, NonExistingExternalProgram
-from .base import ExtraFrameworkDependency, PkgConfigDependency
-from .base import ConfigToolDependency, DependencyFactory
-from .base import find_external_program
-
-if T.TYPE_CHECKING:
-    from ..environment import Environment
-    from .base import ExternalProgram
-
-
-class GLDependencySystem(ExternalDependency):
-    def __init__(self, name: str, environment, kwargs):
-        super().__init__(name, environment, kwargs)
-
-        if self.env.machines[self.for_machine].is_darwin():
-            self.is_found = True
-            # FIXME: Use AppleFrameworks dependency
-            self.link_args = ['-framework', 'OpenGL']
-            # FIXME: Detect version using self.clib_compiler
-            return
-        if self.env.machines[self.for_machine].is_windows():
-            self.is_found = True
-            # FIXME: Use self.clib_compiler.find_library()
-            self.link_args = ['-lopengl32']
-            # FIXME: Detect version using self.clib_compiler
-            return
-
-    @staticmethod
-    def get_methods():
-        if mesonlib.is_osx() or mesonlib.is_windows():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM]
-        else:
-            return [DependencyMethods.PKGCONFIG]
-
-    def log_tried(self):
-        return 'system'
-
-class GnuStepDependency(ConfigToolDependency):
-
-    tools = ['gnustep-config']
-    tool_name = 'gnustep-config'
-
-    def __init__(self, environment, kwargs):
-        super().__init__('gnustep', environment, kwargs, language='objc')
-        if not self.is_found:
-            return
-        self.modules = kwargs.get('modules', [])
-        self.compile_args = self.filter_args(
-            self.get_config_value(['--objc-flags'], 'compile_args'))
-        self.link_args = self.weird_filter(self.get_config_value(
-            ['--gui-libs' if 'gui' in self.modules else '--base-libs'],
-            'link_args'))
-
-    def find_config(self, versions=None, returncode: int = 0):
-        tool = [self.tools[0]]
-        try:
-            p, out = Popen_safe(tool + ['--help'])[:2]
-        except (FileNotFoundError, PermissionError):
-            return (None, None)
-        if p.returncode != returncode:
-            return (None, None)
-        self.config = tool
-        found_version = self.detect_version()
-        if versions and not version_compare_many(found_version, versions)[0]:
-            return (None, found_version)
-
-        return (tool, found_version)
-
-    def weird_filter(self, elems):
-        """When building packages, the output of the enclosing Make is
-        sometimes mixed among the subprocess output. I have no idea why. As a
-        hack filter out everything that is not a flag.
-        """
-        return [e for e in elems if e.startswith('-')]
-
-    def filter_args(self, args):
-        """gnustep-config returns a bunch of garbage args such as -O2 and so
-        on. Drop everything that is not needed.
-        """
-        result = []
-        for f in args:
-            if f.startswith('-D') \
-                    or f.startswith('-f') \
-                    or f.startswith('-I') \
-                    or f == '-pthread' \
-                    or (f.startswith('-W') and not f == '-Wall'):
-                result.append(f)
-        return result
-
-    def detect_version(self):
-        gmake = self.get_config_value(['--variable=GNUMAKE'], 'variable')[0]
-        makefile_dir = self.get_config_value(['--variable=GNUSTEP_MAKEFILES'], 'variable')[0]
-        # This Makefile has the GNUStep version set
-        base_make = os.path.join(makefile_dir, 'Additional', 'base.make')
-        # Print the Makefile variable passed as the argument. For instance, if
-        # you run the make target `print-SOME_VARIABLE`, this will print the
-        # value of the variable `SOME_VARIABLE`.
-        printver = "print-%:\n\t@echo '$($*)'"
-        env = os.environ.copy()
-        # See base.make to understand why this is set
-        env['FOUNDATION_LIB'] = 'gnu'
-        p, o, e = Popen_safe([gmake, '-f', '-', '-f', base_make,
-                              'print-GNUSTEP_BASE_VERSION'],
-                             env=env, write=printver, stdin=subprocess.PIPE)
-        version = o.strip()
-        if not version:
-            mlog.debug("Couldn't detect GNUStep version, falling back to '1'")
-            # Fallback to setting some 1.x version
-            version = '1'
-        return version
-
-
-def _qt_get_private_includes(mod_inc_dir, module, mod_version):
-    # usually Qt5 puts private headers in /QT_INSTALL_HEADERS/module/VERSION/module/private
-    # except for at least QtWebkit and Enginio where the module version doesn't match Qt version
-    # as an example with Qt 5.10.1 on linux you would get:
-    # /usr/include/qt5/QtCore/5.10.1/QtCore/private/
-    # /usr/include/qt5/QtWidgets/5.10.1/QtWidgets/private/
-    # /usr/include/qt5/QtWebKit/5.212.0/QtWebKit/private/
-
-    # on Qt4 when available private folder is directly in module folder
-    # like /usr/include/QtCore/private/
-    if int(mod_version.split('.')[0]) < 5:
-        return tuple()
-
-    private_dir = os.path.join(mod_inc_dir, mod_version)
-    # fallback, let's try to find a directory with the latest version
-    if not os.path.exists(private_dir):
-        dirs = [filename for filename in os.listdir(mod_inc_dir)
-                if os.path.isdir(os.path.join(mod_inc_dir, filename))]
-        dirs.sort(reverse=True)
-
-        for dirname in dirs:
-            if len(dirname.split('.')) == 3:
-                private_dir = dirname
-                break
-    return (private_dir,
-            os.path.join(private_dir, 'Qt' + module))
-
-class QtExtraFrameworkDependency(ExtraFrameworkDependency):
-    def __init__(self, name, env, kwargs, language: T.Optional[str] = None):
-        super().__init__(name, env, kwargs, language=language)
-        self.mod_name = name[2:]
-
-    def get_compile_args(self, with_private_headers=False, qt_version="0"):
-        if self.found():
-            mod_inc_dir = os.path.join(self.framework_path, 'Headers')
-            args = ['-I' + mod_inc_dir]
-            if with_private_headers:
-                args += ['-I' + dirname for dirname in _qt_get_private_includes(mod_inc_dir, self.mod_name, qt_version)]
-            return args
-        return []
-
-class QtBaseDependency(ExternalDependency):
-    def __init__(self, name, env, kwargs):
-        super().__init__(name, env, kwargs, language='cpp')
-        self.qtname = name.capitalize()
-        self.qtver = name[-1]
-        if self.qtver == "4":
-            self.qtpkgname = 'Qt'
-        else:
-            self.qtpkgname = self.qtname
-        self.root = '/usr'
-        self.bindir = None
-        self.private_headers = kwargs.get('private_headers', False)
-        mods = extract_as_list(kwargs, 'modules')
-        self.requested_modules = mods
-        if not mods:
-            raise DependencyException('No ' + self.qtname + '  modules specified.')
-        self.from_text = 'pkg-config'
-
-        self.qtmain = kwargs.get('main', False)
-        if not isinstance(self.qtmain, bool):
-            raise DependencyException('"main" argument must be a boolean')
-
-        # Keep track of the detection methods used, for logging purposes.
-        methods = []
-        # Prefer pkg-config, then fallback to `qmake -query`
-        if DependencyMethods.PKGCONFIG in self.methods:
-            mlog.debug('Trying to find qt with pkg-config')
-            self._pkgconfig_detect(mods, kwargs)
-            methods.append('pkgconfig')
-        if not self.is_found and DependencyMethods.QMAKE in self.methods:
-            mlog.debug('Trying to find qt with qmake')
-            self.from_text = self._qmake_detect(mods, kwargs)
-            methods.append('qmake-' + self.name)
-            methods.append('qmake')
-        if not self.is_found:
-            # Reset compile args and link args
-            self.compile_args = []
-            self.link_args = []
-            self.from_text = mlog.format_list(methods)
-            self.version = None
-
-    def compilers_detect(self, interp_obj):
-        "Detect Qt (4 or 5) moc, uic, rcc in the specified bindir or in PATH"
-        # It is important that this list does not change order as the order of
-        # the returned ExternalPrograms will change as well
-        bins = ['moc', 'uic', 'rcc', 'lrelease']
-        found = {b: NonExistingExternalProgram(name='{}-{}'.format(b, self.name))
-                 for b in bins}
-        wanted = '== {}'.format(self.version)
-
-        def gen_bins():
-            for b in bins:
-                if self.bindir:
-                    yield os.path.join(self.bindir, b), b, False
-                # prefer the <tool>-qt<version> of the tool to the plain one, as we
-                # don't know what the unsuffixed one points to without calling it.
-                yield '{}-{}'.format(b, self.name), b, False
-                yield b, b, self.required if b != 'lrelease' else False
-
-        for b, name, required in gen_bins():
-            if found[name].found():
-                continue
-
-            if name == 'lrelease':
-                arg = ['-version']
-            elif mesonlib.version_compare(self.version, '>= 5'):
-                arg = ['--version']
-            else:
-                arg = ['-v']
-
-            # Ensure that the version of qt and each tool are the same
-            def get_version(p):
-                _, out, err = mesonlib.Popen_safe(p.get_command() + arg)
-                if b.startswith('lrelease') or not self.version.startswith('4'):
-                    care = out
-                else:
-                    care = err
-                return care.split(' ')[-1].replace(')', '')
-
-            p = interp_obj.find_program_impl([b], required=required,
-                                             version_func=get_version,
-                                             wanted=wanted).held_object
-            if p.found():
-                found[name] = p
-
-        return tuple([found[b] for b in bins])
-
-    def _pkgconfig_detect(self, mods, kwargs):
-        # We set the value of required to False so that we can try the
-        # qmake-based fallback if pkg-config fails.
-        kwargs['required'] = False
-        modules = OrderedDict()
-        for module in mods:
-            modules[module] = PkgConfigDependency(self.qtpkgname + module, self.env,
-                                                  kwargs, language=self.language)
-        for m_name, m in modules.items():
-            if not m.found():
-                self.is_found = False
-                return
-            self.compile_args += m.get_compile_args()
-            if self.private_headers:
-                qt_inc_dir = m.get_pkgconfig_variable('includedir', dict())
-                mod_private_dir = os.path.join(qt_inc_dir, 'Qt' + m_name)
-                if not os.path.isdir(mod_private_dir):
-                    # At least some versions of homebrew don't seem to set this
-                    # up correctly. /usr/local/opt/qt/include/Qt + m_name is a
-                    # symlink to /usr/local/opt/qt/include, but the pkg-config
-                    # file points to /usr/local/Cellar/qt/x.y.z/Headers/, and
-                    # the Qt + m_name there is not a symlink, it's a file
-                    mod_private_dir = qt_inc_dir
-                mod_private_inc = _qt_get_private_includes(mod_private_dir, m_name, m.version)
-                for directory in mod_private_inc:
-                    self.compile_args.append('-I' + directory)
-            self.link_args += m.get_link_args()
-
-        if 'Core' in modules:
-            core = modules['Core']
-        else:
-            corekwargs = {'required': 'false', 'silent': 'true'}
-            core = PkgConfigDependency(self.qtpkgname + 'Core', self.env, corekwargs,
-                                       language=self.language)
-            modules['Core'] = core
-
-        if self.env.machines[self.for_machine].is_windows() and self.qtmain:
-            # Check if we link with debug binaries
-            debug_lib_name = self.qtpkgname + 'Core' + self._get_modules_lib_suffix(True)
-            is_debug = False
-            for arg in core.get_link_args():
-                if arg == '-l%s' % debug_lib_name or arg.endswith('%s.lib' % debug_lib_name) or arg.endswith('%s.a' % debug_lib_name):
-                    is_debug = True
-                    break
-            libdir = core.get_pkgconfig_variable('libdir', {})
-            if not self._link_with_qtmain(is_debug, libdir):
-                self.is_found = False
-                return
-
-        self.is_found = True
-        self.version = m.version
-        self.pcdep = list(modules.values())
-        # Try to detect moc, uic, rcc
-        # Used by self.compilers_detect()
-        self.bindir = self.get_pkgconfig_host_bins(core)
-        if not self.bindir:
-            # If exec_prefix is not defined, the pkg-config file is broken
-            prefix = core.get_pkgconfig_variable('exec_prefix', {})
-            if prefix:
-                self.bindir = os.path.join(prefix, 'bin')
-
-    def search_qmake(self) -> T.Generator['ExternalProgram', None, None]:
-        for qmake in ('qmake-' + self.name, 'qmake'):
-            yield from find_external_program(self.env, self.for_machine, qmake, 'QMake', [qmake])
-
-    def _qmake_detect(self, mods, kwargs):
-        for qmake in self.search_qmake():
-            if not qmake.found():
-                continue
-            # Check that the qmake is for qt5
-            pc, stdo = Popen_safe(qmake.get_command() + ['-v'])[0:2]
-            if pc.returncode != 0:
-                continue
-            if not 'Qt version ' + self.qtver in stdo:
-                mlog.log('QMake is not for ' + self.qtname)
-                continue
-            # Found qmake for Qt5!
-            self.qmake = qmake
-            break
-        else:
-            # Didn't find qmake :(
-            self.is_found = False
-            return
-        self.version = re.search(self.qtver + r'(\.\d+)+', stdo).group(0)
-        # Query library path, header path, and binary path
-        mlog.log("Found qmake:", mlog.bold(self.qmake.get_path()), '(%s)' % self.version)
-        stdo = Popen_safe(self.qmake.get_command() + ['-query'])[1]
-        qvars = {}
-        for line in stdo.split('\n'):
-            line = line.strip()
-            if line == '':
-                continue
-            (k, v) = tuple(line.split(':', 1))
-            qvars[k] = v
-        # Qt on macOS uses a framework, but Qt for iOS/tvOS does not
-        xspec = qvars.get('QMAKE_XSPEC', '')
-        if self.env.machines.host.is_darwin() and not any(s in xspec for s in ['ios', 'tvos']):
-            mlog.debug("Building for macOS, looking for framework")
-            self._framework_detect(qvars, mods, kwargs)
-            # Sometimes Qt is built not as a framework (for instance, when using conan pkg manager)
-            # skip and fall back to normal procedure then
-            if self.is_found:
-                return self.qmake.name
-            else:
-                mlog.debug("Building for macOS, couldn't find framework, falling back to library search")
-        incdir = qvars['QT_INSTALL_HEADERS']
-        self.compile_args.append('-I' + incdir)
-        libdir = qvars['QT_INSTALL_LIBS']
-        # Used by self.compilers_detect()
-        self.bindir = self.get_qmake_host_bins(qvars)
-        self.is_found = True
-
-        # Use the buildtype by default, but look at the b_vscrt option if the
-        # compiler supports it.
-        is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
-        if 'b_vscrt' in self.env.coredata.base_options:
-            if self.env.coredata.base_options['b_vscrt'].value in ('mdd', 'mtd'):
-                is_debug = True
-        modules_lib_suffix = self._get_modules_lib_suffix(is_debug)
-
-        for module in mods:
-            mincdir = os.path.join(incdir, 'Qt' + module)
-            self.compile_args.append('-I' + mincdir)
-
-            if module == 'QuickTest':
-                define_base = 'QMLTEST'
-            elif module == 'Test':
-                define_base = 'TESTLIB'
-            else:
-                define_base = module.upper()
-            self.compile_args.append('-DQT_%s_LIB' % define_base)
-
-            if self.private_headers:
-                priv_inc = self.get_private_includes(mincdir, module)
-                for directory in priv_inc:
-                    self.compile_args.append('-I' + directory)
-            libfile = self.clib_compiler.find_library(self.qtpkgname + module + modules_lib_suffix,
-                                                      self.env,
-                                                      libdir)
-            if libfile:
-                libfile = libfile[0]
-            else:
-                mlog.log("Could not find:", module,
-                         self.qtpkgname + module + modules_lib_suffix,
-                         'in', libdir)
-                self.is_found = False
-                break
-            self.link_args.append(libfile)
-
-        if self.env.machines[self.for_machine].is_windows() and self.qtmain:
-            if not self._link_with_qtmain(is_debug, libdir):
-                self.is_found = False
-
-        return self.qmake.name
-
-    def _get_modules_lib_suffix(self, is_debug):
-        suffix = ''
-        if self.env.machines[self.for_machine].is_windows():
-            if is_debug:
-                suffix += 'd'
-            if self.qtver == '4':
-                suffix += '4'
-        if self.env.machines[self.for_machine].is_darwin():
-            if is_debug:
-                suffix += '_debug'
-        if mesonlib.version_compare(self.version, '>= 5.14.0'):
-            if self.env.machines[self.for_machine].is_android():
-                cpu_family = self.env.machines[self.for_machine].cpu_family
-                if cpu_family == 'x86':
-                    suffix += '_x86'
-                elif cpu_family == 'x86_64':
-                    suffix += '_x86_64'
-                elif cpu_family == 'arm':
-                    suffix += '_armeabi-v7a'
-                elif cpu_family == 'aarch64':
-                    suffix += '_arm64-v8a'
-                else:
-                    mlog.warning('Android target arch {!r} for Qt5 is unknown, '
-                                 'module detection may not work'.format(cpu_family))
-        return suffix
-
-    def _link_with_qtmain(self, is_debug, libdir):
-        base_name = 'qtmaind' if is_debug else 'qtmain'
-        qtmain = self.clib_compiler.find_library(base_name, self.env, libdir)
-        if qtmain:
-            self.link_args.append(qtmain[0])
-            return True
-        return False
-
-    def _framework_detect(self, qvars, modules, kwargs):
-        libdir = qvars['QT_INSTALL_LIBS']
-
-        # ExtraFrameworkDependency doesn't support any methods
-        fw_kwargs = kwargs.copy()
-        fw_kwargs.pop('method', None)
-        fw_kwargs['paths'] = [libdir]
-
-        for m in modules:
-            fname = 'Qt' + m
-            mlog.debug('Looking for qt framework ' + fname)
-            fwdep = QtExtraFrameworkDependency(fname, self.env, fw_kwargs, language=self.language)
-            if fwdep.found():
-                self.compile_args.append('-F' + libdir)
-                self.compile_args += fwdep.get_compile_args(with_private_headers=self.private_headers,
-                                                            qt_version=self.version)
-                self.link_args += fwdep.get_link_args()
-            else:
-                break
-        else:
-            self.is_found = True
-            # Used by self.compilers_detect()
-            self.bindir = self.get_qmake_host_bins(qvars)
-
-    def get_qmake_host_bins(self, qvars):
-        # Prefer QT_HOST_BINS (qt5, correct for cross and native compiling)
-        # but fall back to QT_INSTALL_BINS (qt4)
-        if 'QT_HOST_BINS' in qvars:
-            return qvars['QT_HOST_BINS']
-        else:
-            return qvars['QT_INSTALL_BINS']
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.PKGCONFIG, DependencyMethods.QMAKE]
-
-    def get_exe_args(self, compiler):
-        # Originally this was -fPIE but nowadays the default
-        # for upstream and distros seems to be -reduce-relocations
-        # which requires -fPIC. This may cause a performance
-        # penalty when using self-built Qt or on platforms
-        # where -fPIC is not required. If this is an issue
-        # for you, patches are welcome.
-        return compiler.get_pic_args()
-
-    def get_private_includes(self, mod_inc_dir, module):
-        return tuple()
-
-    def log_details(self):
-        module_str = ', '.join(self.requested_modules)
-        return 'modules: ' + module_str
-
-    def log_info(self):
-        return '{}'.format(self.from_text)
-
-    def log_tried(self):
-        return self.from_text
-
-
-class Qt4Dependency(QtBaseDependency):
-    def __init__(self, env, kwargs):
-        QtBaseDependency.__init__(self, 'qt4', env, kwargs)
-
-    def get_pkgconfig_host_bins(self, core):
-        # Only return one bins dir, because the tools are generally all in one
-        # directory for Qt4, in Qt5, they must all be in one directory. Return
-        # the first one found among the bin variables, in case one tool is not
-        # configured to be built.
-        applications = ['moc', 'uic', 'rcc', 'lupdate', 'lrelease']
-        for application in applications:
-            try:
-                return os.path.dirname(core.get_pkgconfig_variable('%s_location' % application, {}))
-            except MesonException:
-                pass
-
-
-class Qt5Dependency(QtBaseDependency):
-    def __init__(self, env, kwargs):
-        QtBaseDependency.__init__(self, 'qt5', env, kwargs)
-
-    def get_pkgconfig_host_bins(self, core):
-        return core.get_pkgconfig_variable('host_bins', {})
-
-    def get_private_includes(self, mod_inc_dir, module):
-        return _qt_get_private_includes(mod_inc_dir, module, self.version)
-
-
-class SDL2DependencyConfigTool(ConfigToolDependency):
-
-    tools = ['sdl2-config']
-    tool_name = 'sdl2-config'
-
-    def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__(name, environment, kwargs)
-        if not self.is_found:
-            return
-        self.compile_args = self.get_config_value(['--cflags'], 'compile_args')
-        self.link_args = self.get_config_value(['--libs'], 'link_args')
-
-    @staticmethod
-    def get_methods():
-        if mesonlib.is_osx():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK]
-        else:
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL]
-
-
-class WxDependency(ConfigToolDependency):
-
-    tools = ['wx-config-3.0', 'wx-config', 'wx-config-gtk3']
-    tool_name = 'wx-config'
-
-    def __init__(self, environment: 'Environment', kwargs: T.Dict[str, T.Any]):
-        super().__init__('WxWidgets', environment, kwargs, language='cpp')
-        if not self.is_found:
-            return
-        self.requested_modules = self.get_requested(kwargs)
-
-        extra_args = []
-        if self.static:
-            extra_args.append('--static=yes')
-
-            # Check to make sure static is going to work
-            err = Popen_safe(self.config + extra_args)[2]
-            if 'No config found to match' in err:
-                mlog.debug('WxWidgets is missing static libraries.')
-                self.is_found = False
-                return
-
-        # wx-config seems to have a cflags as well but since it requires C++,
-        # this should be good, at least for now.
-        self.compile_args = self.get_config_value(['--cxxflags'] + extra_args + self.requested_modules, 'compile_args')
-        self.link_args = self.get_config_value(['--libs'] + extra_args + self.requested_modules, 'link_args')
-
-    @staticmethod
-    def get_requested(kwargs: T.Dict[str, T.Any]) -> T.List[str]:
-        if 'modules' not in kwargs:
-            return []
-        candidates = extract_as_list(kwargs, 'modules')
-        for c in candidates:
-            if not isinstance(c, str):
-                raise DependencyException('wxwidgets module argument is not a string')
-        return candidates
-
-
-class VulkanDependencySystem(ExternalDependency):
-
-    def __init__(self, name: str, environment, kwargs, language: T.Optional[str] = None):
-        super().__init__(name, environment, kwargs, language=language)
-
-        try:
-            self.vulkan_sdk = os.environ['VULKAN_SDK']
-            if not os.path.isabs(self.vulkan_sdk):
-                raise DependencyException('VULKAN_SDK must be an absolute path.')
-        except KeyError:
-            self.vulkan_sdk = None
-
-        if self.vulkan_sdk:
-            # TODO: this config might not work on some platforms, fix bugs as reported
-            # we should at least detect other 64-bit platforms (e.g. armv8)
-            lib_name = 'vulkan'
-            lib_dir = 'lib'
-            inc_dir = 'include'
-            if mesonlib.is_windows():
-                lib_name = 'vulkan-1'
-                lib_dir = 'Lib32'
-                inc_dir = 'Include'
-                if detect_cpu_family(self.env.coredata.compilers.host) == 'x86_64':
-                    lib_dir = 'Lib'
-
-            # make sure header and lib are valid
-            inc_path = os.path.join(self.vulkan_sdk, inc_dir)
-            header = os.path.join(inc_path, 'vulkan', 'vulkan.h')
-            lib_path = os.path.join(self.vulkan_sdk, lib_dir)
-            find_lib = self.clib_compiler.find_library(lib_name, environment, lib_path)
-
-            if not find_lib:
-                raise DependencyException('VULKAN_SDK point to invalid directory (no lib)')
-
-            if not os.path.isfile(header):
-                raise DependencyException('VULKAN_SDK point to invalid directory (no include)')
-
-            self.type_name = 'vulkan_sdk'
-            self.is_found = True
-            self.compile_args.append('-I' + inc_path)
-            self.link_args.append('-L' + lib_path)
-            self.link_args.append('-l' + lib_name)
-
-            # TODO: find a way to retrieve the version from the sdk?
-            # Usually it is a part of the path to it (but does not have to be)
-            return
-        else:
-            # simply try to guess it, usually works on linux
-            libs = self.clib_compiler.find_library('vulkan', environment, [])
-            if libs is not None and self.clib_compiler.has_header('vulkan/vulkan.h', '', environment, disable_cache=True)[0]:
-                self.type_name = 'system'
-                self.is_found = True
-                for lib in libs:
-                    self.link_args.append(lib)
-                return
-
-    @staticmethod
-    def get_methods():
-        return [DependencyMethods.SYSTEM]
-
-    def log_tried(self):
-        return 'system'
-
-gl_factory = DependencyFactory(
-    'gl',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
-    system_class=GLDependencySystem,
-)
-
-sdl2_factory = DependencyFactory(
-    'sdl2',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.CONFIG_TOOL, DependencyMethods.EXTRAFRAMEWORK],
-    configtool_class=SDL2DependencyConfigTool,
-)
-
-vulkan_factory = DependencyFactory(
-    'vulkan',
-    [DependencyMethods.PKGCONFIG, DependencyMethods.SYSTEM],
-    system_class=VulkanDependencySystem,
-)
diff --git a/meson/mesonbuild/depfile.py b/meson/mesonbuild/depfile.py
deleted file mode 100644 (file)
index 7a896cd..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-# Copyright 2019 Red Hat, Inc.
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import collections
-
-def parse(lines):
-    rules = []
-    targets = []
-    deps = []
-    in_deps = False
-    out = ''
-    for line in lines:
-        if not line.endswith('\n'):
-            line += '\n'
-        escape = None
-        for c in line:
-            if escape:
-                if escape == '$' and c != '$':
-                    out += '$'
-                if escape == '\\' and c == '\n':
-                    continue
-                out += c
-                escape = None
-                continue
-            if c == '\\' or c == '$':
-                escape = c
-                continue
-            elif c in (' ', '\n'):
-                if out != '':
-                    if in_deps:
-                        deps.append(out)
-                    else:
-                        targets.append(out)
-                out = ''
-                if c == '\n':
-                    rules.append((targets, deps))
-                    targets = []
-                    deps = []
-                    in_deps = False
-                continue
-            elif c == ':':
-                targets.append(out)
-                out = ''
-                in_deps = True
-                continue
-            out += c
-    return rules
-
-Target = collections.namedtuple('Target', ['deps'])
-
-class DepFile:
-    def __init__(self, lines):
-        rules = parse(lines)
-        depfile = {}
-        for (targets, deps) in rules:
-            for target in targets:
-                t = depfile.setdefault(target, Target(deps=set()))
-                for dep in deps:
-                    t.deps.add(dep)
-        self.depfile = depfile
-
-    def get_all_dependencies(self, target, visited=None):
-        deps = set()
-        if not visited:
-            visited = set()
-        if target in visited:
-            return set()
-        visited.add(target)
-        target = self.depfile.get(target)
-        if not target:
-            return set()
-        deps.update(target.deps)
-        for dep in target.deps:
-            deps.update(self.get_all_dependencies(dep, visited))
-        return deps
diff --git a/meson/mesonbuild/envconfig.py b/meson/mesonbuild/envconfig.py
deleted file mode 100644 (file)
index 219b62e..0000000
+++ /dev/null
@@ -1,449 +0,0 @@
-# Copyright 2012-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os, subprocess
-import typing as T
-
-from . import mesonlib
-from .mesonlib import EnvironmentException, MachineChoice, PerMachine, split_args
-from . import mlog
-
-_T = T.TypeVar('_T')
-
-
-# These classes contains all the data pulled from configuration files (native
-# and cross file currently), and also assists with the reading environment
-# variables.
-#
-# At this time there isn't an ironclad difference between this an other sources
-# of state like `coredata`. But one rough guide is much what is in `coredata` is
-# the *output* of the configuration process: the final decisions after tests.
-# This, on the other hand has *inputs*. The config files are parsed, but
-# otherwise minimally transformed. When more complex fallbacks (environment
-# detection) exist, they are defined elsewhere as functions that construct
-# instances of these classes.
-
-
-known_cpu_families = (
-    'aarch64',
-    'alpha',
-    'arc',
-    'arm',
-    'avr',
-    'c2000',
-    'dspic',
-    'e2k',
-    'ia64',
-    'm68k',
-    'microblaze',
-    'mips',
-    'mips64',
-    'parisc',
-    'pic24',
-    'ppc',
-    'ppc64',
-    'riscv32',
-    'riscv64',
-    'rl78',
-    'rx',
-    's390',
-    's390x',
-    'sh4',
-    'sparc',
-    'sparc64',
-    'wasm32',
-    'wasm64',
-    'x86',
-    'x86_64',
-)
-
-# It would feel more natural to call this "64_BIT_CPU_FAMILES", but
-# python identifiers cannot start with numbers
-CPU_FAMILES_64_BIT = [
-    'aarch64',
-    'alpha',
-    'ia64',
-    'mips64',
-    'ppc64',
-    'riscv64',
-    's390x',
-    'sparc64',
-    'wasm64',
-    'x86_64',
-]
-
-def get_env_var_pair(for_machine: MachineChoice,
-                     is_cross: bool,
-                     var_name: str) -> T.Tuple[T.Optional[str], T.Optional[str]]:
-    """
-    Returns the exact env var and the value.
-    """
-    candidates = PerMachine(
-        # The prefixed build version takes priority, but if we are native
-        # compiling we fall back on the unprefixed host version. This
-        # allows native builds to never need to worry about the 'BUILD_*'
-        # ones.
-        ([var_name + '_FOR_BUILD'] if is_cross else [var_name]),
-        # Always just the unprefixed host verions
-        [var_name]
-    )[for_machine]
-    for var in candidates:
-        value = os.environ.get(var)
-        if value is not None:
-            break
-    else:
-        formatted = ', '.join(['{!r}'.format(var) for var in candidates])
-        mlog.debug('None of {} are defined in the environment, not changing global flags.'.format(formatted))
-        return None
-    mlog.log('Using {!r} from environment with value: {!r}'.format(var, value))
-    return var, value
-
-def get_env_var(for_machine: MachineChoice,
-                is_cross: bool,
-                var_name: str) -> T.Tuple[T.Optional[str], T.Optional[str]]:
-    ret = get_env_var_pair(for_machine, is_cross, var_name)
-    if ret is None:
-        return None
-    else:
-        var, value = ret
-        return value
-
-class Properties:
-    def __init__(
-            self,
-            properties: T.Optional[T.Dict[str, T.Union[str, T.List[str]]]] = None,
-    ):
-        self.properties = properties or {}  # type: T.Dict[str, T.Union[str, T.List[str]]]
-
-    def has_stdlib(self, language: str) -> bool:
-        return language + '_stdlib' in self.properties
-
-    # Some of get_stdlib, get_root, get_sys_root are wider than is actually
-    # true, but without heterogenious dict annotations it's not practical to
-    # narrow them
-    def get_stdlib(self, language: str) -> T.Union[str, T.List[str]]:
-        return self.properties[language + '_stdlib']
-
-    def get_root(self) -> T.Optional[T.Union[str, T.List[str]]]:
-        return self.properties.get('root', None)
-
-    def get_sys_root(self) -> T.Optional[T.Union[str, T.List[str]]]:
-        return self.properties.get('sys_root', None)
-
-    def get_pkg_config_libdir(self) -> T.Optional[T.List[str]]:
-        p = self.properties.get('pkg_config_libdir', None)
-        if p is None:
-            return p
-        return mesonlib.listify(p)
-
-    def __eq__(self, other: T.Any) -> 'T.Union[bool, NotImplemented]':
-        if isinstance(other, type(self)):
-            return self.properties == other.properties
-        return NotImplemented
-
-    # TODO consider removing so Properties is less freeform
-    def __getitem__(self, key: str) -> T.Any:
-        return self.properties[key]
-
-    # TODO consider removing so Properties is less freeform
-    def __contains__(self, item: T.Any) -> bool:
-        return item in self.properties
-
-    # TODO consider removing, for same reasons as above
-    def get(self, key: str, default: T.Any = None) -> T.Any:
-        return self.properties.get(key, default)
-
-class MachineInfo:
-    def __init__(self, system: str, cpu_family: str, cpu: str, endian: str):
-        self.system = system
-        self.cpu_family = cpu_family
-        self.cpu = cpu
-        self.endian = endian
-        self.is_64_bit = cpu_family in CPU_FAMILES_64_BIT  # type: bool
-
-    def __eq__(self, other: T.Any) -> 'T.Union[bool, NotImplemented]':
-        if self.__class__ is not other.__class__:
-            return NotImplemented
-        return \
-            self.system == other.system and \
-            self.cpu_family == other.cpu_family and \
-            self.cpu == other.cpu and \
-            self.endian == other.endian
-
-    def __ne__(self, other: T.Any) -> 'T.Union[bool, NotImplemented]':
-        if self.__class__ is not other.__class__:
-            return NotImplemented
-        return not self.__eq__(other)
-
-    def __repr__(self) -> str:
-        return '<MachineInfo: {} {} ({})>'.format(self.system, self.cpu_family, self.cpu)
-
-    @classmethod
-    def from_literal(cls, literal: T.Dict[str, str]) -> 'MachineInfo':
-        minimum_literal = {'cpu', 'cpu_family', 'endian', 'system'}
-        if set(literal) < minimum_literal:
-            raise EnvironmentException(
-                'Machine info is currently {}\n'.format(literal) +
-                'but is missing {}.'.format(minimum_literal - set(literal)))
-
-        cpu_family = literal['cpu_family']
-        if cpu_family not in known_cpu_families:
-            mlog.warning('Unknown CPU family {}, please report this at https://github.com/mesonbuild/meson/issues/new'.format(cpu_family))
-
-        endian = literal['endian']
-        if endian not in ('little', 'big'):
-            mlog.warning('Unknown endian {}'.format(endian))
-
-        return cls(literal['system'], cpu_family, literal['cpu'], endian)
-
-    def is_windows(self) -> bool:
-        """
-        Machine is windows?
-        """
-        return self.system == 'windows' or 'mingw' in self.system
-
-    def is_cygwin(self) -> bool:
-        """
-        Machine is cygwin?
-        """
-        return self.system.startswith('cygwin')
-
-    def is_linux(self) -> bool:
-        """
-        Machine is linux?
-        """
-        return self.system == 'linux'
-
-    def is_darwin(self) -> bool:
-        """
-        Machine is Darwin (iOS/tvOS/OS X)?
-        """
-        return self.system in {'darwin', 'ios', 'tvos'}
-
-    def is_android(self) -> bool:
-        """
-        Machine is Android?
-        """
-        return self.system == 'android'
-
-    def is_haiku(self) -> bool:
-        """
-        Machine is Haiku?
-        """
-        return self.system == 'haiku'
-
-    def is_netbsd(self) -> bool:
-        """
-        Machine is NetBSD?
-        """
-        return self.system == 'netbsd'
-
-    def is_openbsd(self) -> bool:
-        """
-        Machine is OpenBSD?
-        """
-        return self.system == 'openbsd'
-
-    def is_dragonflybsd(self) -> bool:
-        """Machine is DragonflyBSD?"""
-        return self.system == 'dragonfly'
-
-    def is_freebsd(self) -> bool:
-        """Machine is FreeBSD?"""
-        return self.system == 'freebsd'
-
-    def is_sunos(self) -> bool:
-        """Machine is illumos or Solaris?"""
-        return self.system == 'sunos'
-
-    def is_hurd(self) -> bool:
-        """
-        Machine is GNU/Hurd?
-        """
-        return self.system == 'gnu'
-
-    def is_irix(self) -> bool:
-        """Machine is IRIX?"""
-        return self.system.startswith('irix')
-
-    # Various prefixes and suffixes for import libraries, shared libraries,
-    # static libraries, and executables.
-    # Versioning is added to these names in the backends as-needed.
-    def get_exe_suffix(self) -> str:
-        if self.is_windows() or self.is_cygwin():
-            return 'exe'
-        else:
-            return ''
-
-    def get_object_suffix(self) -> str:
-        if self.is_windows():
-            return 'obj'
-        else:
-            return 'o'
-
-    def libdir_layout_is_win(self) -> bool:
-        return self.is_windows() or self.is_cygwin()
-
-class BinaryTable:
-    def __init__(
-            self,
-            binaries: T.Optional[T.Dict[str, T.Union[str, T.List[str]]]] = None,
-    ):
-        self.binaries = binaries or {}  # type: T.Dict[str, T.Union[str, T.List[str]]]
-        for name, command in self.binaries.items():
-            if not isinstance(command, (list, str)):
-                # TODO generalize message
-                raise mesonlib.MesonException(
-                    'Invalid type {!r} for binary {!r} in cross file'
-                    ''.format(command, name))
-
-    # Map from language identifiers to environment variables.
-    evarMap = {
-        # Compilers
-        'c': 'CC',
-        'cpp': 'CXX',
-        'cs': 'CSC',
-        'd': 'DC',
-        'fortran': 'FC',
-        'objc': 'OBJC',
-        'objcpp': 'OBJCXX',
-        'rust': 'RUSTC',
-        'vala': 'VALAC',
-
-        # Linkers
-        'c_ld': 'CC_LD',
-        'cpp_ld': 'CXX_LD',
-        'd_ld': 'DC_LD',
-        'fortran_ld': 'FC_LD',
-        'objc_ld': 'OBJC_LD',
-        'objcpp_ld': 'OBJCXX_LD',
-        'rust_ld': 'RUSTC_LD',
-
-        # Binutils
-        'strip': 'STRIP',
-        'ar': 'AR',
-        'windres': 'WINDRES',
-
-        # Other tools
-        'cmake': 'CMAKE',
-        'qmake': 'QMAKE',
-        'pkgconfig': 'PKG_CONFIG',
-    }  # type: T.Dict[str, str]
-
-    # Deprecated environment variables mapped from the new variable to the old one
-    # Deprecated in 0.54.0
-    DEPRECATION_MAP = {
-        'DC_LD': 'D_LD',
-        'FC_LD': 'F_LD',
-        'RUSTC_LD': 'RUST_LD',
-        'OBJCXX_LD': 'OBJCPP_LD',
-    }  # type: T.Dict[str, str]
-
-    @staticmethod
-    def detect_ccache() -> T.List[str]:
-        try:
-            subprocess.check_call(['ccache', '--version'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-        except (OSError, subprocess.CalledProcessError):
-            return []
-        return ['ccache']
-
-    @classmethod
-    def parse_entry(cls, entry: T.Union[str, T.List[str]]) -> T.Tuple[T.List[str], T.List[str]]:
-        compiler = mesonlib.stringlistify(entry)
-        # Ensure ccache exists and remove it if it doesn't
-        if compiler[0] == 'ccache':
-            compiler = compiler[1:]
-            ccache = cls.detect_ccache()
-        else:
-            ccache = []
-        # Return value has to be a list of compiler 'choices'
-        return compiler, ccache
-
-    def lookup_entry(self,
-                     for_machine: MachineChoice,
-                     is_cross: bool,
-                     name: str) -> T.Optional[T.List[str]]:
-        """Lookup binary in cross/native file and fallback to environment.
-
-        Returns command with args as list if found, Returns `None` if nothing is
-        found.
-        """
-        # Try explicit map, don't fall back on env var
-        # Try explict map, then env vars
-        for _ in [()]: # a trick to get `break`
-            raw_command = self.binaries.get(name)
-            if raw_command is not None:
-                command = mesonlib.stringlistify(raw_command)
-                break # found
-            evar = self.evarMap.get(name)
-            if evar is not None:
-                raw_command = get_env_var(for_machine, is_cross, evar)
-                if raw_command is None:
-                    deprecated = self.DEPRECATION_MAP.get(evar)
-                    if deprecated is not None:
-                        raw_command = get_env_var(for_machine, is_cross, deprecated)
-                        if raw_command is not None:
-                            mlog.deprecation(
-                                'The', deprecated, 'environment variable is deprecated in favor of',
-                                evar, once=True)
-                if raw_command is not None:
-                    command = split_args(raw_command)
-                    break # found
-            command = None
-
-
-        # Do not return empty or blank string entries
-        if command is not None and (len(command) == 0 or len(command[0].strip()) == 0):
-            command = None
-        return command
-
-class Directories:
-
-    """Data class that holds information about directories for native and cross
-    builds.
-    """
-
-    def __init__(self, bindir: T.Optional[str] = None, datadir: T.Optional[str] = None,
-                 includedir: T.Optional[str] = None, infodir: T.Optional[str] = None,
-                 libdir: T.Optional[str] = None, libexecdir: T.Optional[str] = None,
-                 localedir: T.Optional[str] = None, localstatedir: T.Optional[str] = None,
-                 mandir: T.Optional[str] = None, prefix: T.Optional[str] = None,
-                 sbindir: T.Optional[str] = None, sharedstatedir: T.Optional[str] = None,
-                 sysconfdir: T.Optional[str] = None):
-        self.bindir = bindir
-        self.datadir = datadir
-        self.includedir = includedir
-        self.infodir = infodir
-        self.libdir = libdir
-        self.libexecdir = libexecdir
-        self.localedir = localedir
-        self.localstatedir = localstatedir
-        self.mandir = mandir
-        self.prefix = prefix
-        self.sbindir = sbindir
-        self.sharedstatedir = sharedstatedir
-        self.sysconfdir = sysconfdir
-
-    def __contains__(self, key: str) -> bool:
-        return hasattr(self, key)
-
-    def __getitem__(self, key: str) -> T.Optional[str]:
-        # Mypy can't figure out what to do with getattr here, so we'll case for it
-        return T.cast(T.Optional[str], getattr(self, key))
-
-    def __setitem__(self, key: str, value: T.Optional[str]) -> None:
-        setattr(self, key, value)
-
-    def __iter__(self) -> T.Iterator[T.Tuple[str, str]]:
-        return iter(self.__dict__.items())
diff --git a/meson/mesonbuild/environment.py b/meson/mesonbuild/environment.py
deleted file mode 100644 (file)
index c825bd8..0000000
+++ /dev/null
@@ -1,1869 +0,0 @@
-# Copyright 2012-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os, platform, re, sys, shutil, subprocess
-import tempfile
-import shlex
-import typing as T
-
-from . import coredata
-from .linkers import ArLinker, ArmarLinker, VisualStudioLinker, DLinker, CcrxLinker, Xc16Linker, C2000Linker, IntelVisualStudioLinker
-from . import mesonlib
-from .mesonlib import (
-    MesonException, EnvironmentException, MachineChoice, Popen_safe,
-    PerMachineDefaultable, PerThreeMachineDefaultable, split_args, quote_arg
-)
-from . import mlog
-
-from .envconfig import (
-    BinaryTable, Directories, MachineInfo,
-    Properties, known_cpu_families,
-)
-from . import compilers
-from .compilers import (
-    Compiler,
-    is_assembly,
-    is_header,
-    is_library,
-    is_llvm_ir,
-    is_object,
-    is_source,
-)
-from .linkers import (
-    AppleDynamicLinker,
-    ArmClangDynamicLinker,
-    ArmDynamicLinker,
-    CcrxDynamicLinker,
-    Xc16DynamicLinker,
-    C2000DynamicLinker,
-    ClangClDynamicLinker,
-    DynamicLinker,
-    GnuBFDDynamicLinker,
-    GnuGoldDynamicLinker,
-    LLVMDynamicLinker,
-    MSVCDynamicLinker,
-    OptlinkDynamicLinker,
-    PGIDynamicLinker,
-    PGIStaticLinker,
-    SolarisDynamicLinker,
-    XilinkDynamicLinker,
-    CudaLinker,
-    VisualStudioLikeLinkerMixin,
-    WASMDynamicLinker,
-)
-from functools import lru_cache
-from .compilers import (
-    ArmCCompiler,
-    ArmCPPCompiler,
-    ArmclangCCompiler,
-    ArmclangCPPCompiler,
-    AppleClangCCompiler,
-    AppleClangCPPCompiler,
-    AppleClangObjCCompiler,
-    AppleClangObjCPPCompiler,
-    ClangCCompiler,
-    ClangCPPCompiler,
-    ClangObjCCompiler,
-    ClangObjCPPCompiler,
-    ClangClCCompiler,
-    ClangClCPPCompiler,
-    FlangFortranCompiler,
-    G95FortranCompiler,
-    GnuCCompiler,
-    GnuCPPCompiler,
-    GnuFortranCompiler,
-    GnuObjCCompiler,
-    GnuObjCPPCompiler,
-    ElbrusCCompiler,
-    ElbrusCPPCompiler,
-    ElbrusFortranCompiler,
-    EmscriptenCCompiler,
-    EmscriptenCPPCompiler,
-    IntelCCompiler,
-    IntelClCCompiler,
-    IntelCPPCompiler,
-    IntelClCPPCompiler,
-    IntelFortranCompiler,
-    IntelClFortranCompiler,
-    JavaCompiler,
-    MonoCompiler,
-    CudaCompiler,
-    VisualStudioCsCompiler,
-    NAGFortranCompiler,
-    Open64FortranCompiler,
-    PathScaleFortranCompiler,
-    PGICCompiler,
-    PGICPPCompiler,
-    PGIFortranCompiler,
-    RustCompiler,
-    CcrxCCompiler,
-    CcrxCPPCompiler,
-    Xc16CCompiler,
-    C2000CCompiler,
-    C2000CPPCompiler,
-    SunFortranCompiler,
-    ValaCompiler,
-    VisualStudioCCompiler,
-    VisualStudioCPPCompiler,
-)
-
-build_filename = 'meson.build'
-
-CompilersDict = T.Dict[str, Compiler]
-
-def detect_gcovr(min_version='3.3', new_rootdir_version='4.2', log=False):
-    gcovr_exe = 'gcovr'
-    try:
-        p, found = Popen_safe([gcovr_exe, '--version'])[0:2]
-    except (FileNotFoundError, PermissionError):
-        # Doesn't exist in PATH or isn't executable
-        return None, None
-    found = search_version(found)
-    if p.returncode == 0 and mesonlib.version_compare(found, '>=' + min_version):
-        if log:
-            mlog.log('Found gcovr-{} at {}'.format(found, quote_arg(shutil.which(gcovr_exe))))
-        return gcovr_exe, mesonlib.version_compare(found, '>=' + new_rootdir_version)
-    return None, None
-
-def detect_llvm_cov():
-    tools = get_llvm_tool_names('llvm-cov')
-    for tool in tools:
-        if mesonlib.exe_exists([tool, '--version']):
-            return tool
-    return None
-
-def find_coverage_tools():
-    gcovr_exe, gcovr_new_rootdir = detect_gcovr()
-
-    llvm_cov_exe = detect_llvm_cov()
-
-    lcov_exe = 'lcov'
-    genhtml_exe = 'genhtml'
-
-    if not mesonlib.exe_exists([lcov_exe, '--version']):
-        lcov_exe = None
-    if not mesonlib.exe_exists([genhtml_exe, '--version']):
-        genhtml_exe = None
-
-    return gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe, llvm_cov_exe
-
-def detect_ninja(version: str = '1.7', log: bool = False) -> T.List[str]:
-    r = detect_ninja_command_and_version(version, log)
-    return r[0] if r else None
-
-def detect_ninja_command_and_version(version: str = '1.7', log: bool = False) -> (T.List[str], str):
-    from .dependencies.base import ExternalProgram
-    env_ninja = os.environ.get('NINJA', None)
-    for n in [env_ninja] if env_ninja else ['ninja', 'ninja-build', 'samu']:
-        prog = ExternalProgram(n, silent=True)
-        if not prog.found():
-            continue
-        try:
-            p, found = Popen_safe(prog.command + ['--version'])[0:2]
-        except (FileNotFoundError, PermissionError):
-            # Doesn't exist in PATH or isn't executable
-            continue
-        found = found.strip()
-        # Perhaps we should add a way for the caller to know the failure mode
-        # (not found or too old)
-        if p.returncode == 0 and mesonlib.version_compare(found, '>=' + version):
-            if log:
-                name = os.path.basename(n)
-                if name.endswith('-' + found):
-                    name = name[0:-1 - len(found)]
-                if name == 'ninja-build':
-                    name = 'ninja'
-                if name == 'samu':
-                    name = 'samurai'
-                mlog.log('Found {}-{} at {}'.format(name, found,
-                         ' '.join([quote_arg(x) for x in prog.command])))
-            return (prog.command, found)
-
-def get_llvm_tool_names(tool: str) -> T.List[str]:
-    # Ordered list of possible suffixes of LLVM executables to try. Start with
-    # base, then try newest back to oldest (3.5 is arbitrary), and finally the
-    # devel version. Please note that the development snapshot in Debian does
-    # not have a distinct name. Do not move it to the beginning of the list
-    # unless it becomes a stable release.
-    suffixes = [
-        '', # base (no suffix)
-        '-9',   '90',
-        '-8',   '80',
-        '-7',   '70',
-        '-6.0', '60',
-        '-5.0', '50',
-        '-4.0', '40',
-        '-3.9', '39',
-        '-3.8', '38',
-        '-3.7', '37',
-        '-3.6', '36',
-        '-3.5', '35',
-        '-10',    # Debian development snapshot
-        '-devel', # FreeBSD development snapshot
-    ]
-    names = []
-    for suffix in suffixes:
-        names.append(tool + suffix)
-    return names
-
-def detect_scanbuild() -> T.List[str]:
-    """ Look for scan-build binary on build platform
-
-    First, if a SCANBUILD env variable has been provided, give it precedence
-    on all platforms.
-
-    For most platforms, scan-build is found is the PATH contains a binary
-    named "scan-build". However, some distribution's package manager (FreeBSD)
-    don't. For those, loop through a list of candidates to see if one is
-    available.
-
-    Return: a single-element list of the found scan-build binary ready to be
-        passed to Popen()
-    """
-    exelist = []
-    if 'SCANBUILD' in os.environ:
-        exelist = split_args(os.environ['SCANBUILD'])
-
-    else:
-        tools = get_llvm_tool_names('scan-build')
-        for tool in tools:
-            if shutil.which(tool) is not None:
-                exelist = [shutil.which(tool)]
-                break
-
-    if exelist:
-        tool = exelist[0]
-        if os.path.isfile(tool) and os.access(tool, os.X_OK):
-            return [tool]
-    return []
-
-def detect_clangformat() -> T.List[str]:
-    """ Look for clang-format binary on build platform
-
-    Do the same thing as detect_scanbuild to find clang-format except it
-    currently does not check the environment variable.
-
-    Return: a single-element list of the found clang-format binary ready to be
-        passed to Popen()
-    """
-    tools = get_llvm_tool_names('clang-format')
-    for tool in tools:
-        path = shutil.which(tool)
-        if path is not None:
-            return [path]
-    return []
-
-def detect_native_windows_arch():
-    """
-    The architecture of Windows itself: x86, amd64 or arm64
-    """
-    # These env variables are always available. See:
-    # https://msdn.microsoft.com/en-us/library/aa384274(VS.85).aspx
-    # https://blogs.msdn.microsoft.com/david.wang/2006/03/27/howto-detect-process-bitness/
-    arch = os.environ.get('PROCESSOR_ARCHITEW6432', '').lower()
-    if not arch:
-        try:
-            # If this doesn't exist, something is messing with the environment
-            arch = os.environ['PROCESSOR_ARCHITECTURE'].lower()
-        except KeyError:
-            raise EnvironmentException('Unable to detect native OS architecture')
-    return arch
-
-def detect_windows_arch(compilers: CompilersDict) -> str:
-    """
-    Detecting the 'native' architecture of Windows is not a trivial task. We
-    cannot trust that the architecture that Python is built for is the 'native'
-    one because you can run 32-bit apps on 64-bit Windows using WOW64 and
-    people sometimes install 32-bit Python on 64-bit Windows.
-
-    We also can't rely on the architecture of the OS itself, since it's
-    perfectly normal to compile and run 32-bit applications on Windows as if
-    they were native applications. It's a terrible experience to require the
-    user to supply a cross-info file to compile 32-bit applications on 64-bit
-    Windows. Thankfully, the only way to compile things with Visual Studio on
-    Windows is by entering the 'msvc toolchain' environment, which can be
-    easily detected.
-
-    In the end, the sanest method is as follows:
-    1. Check environment variables that are set by Windows and WOW64 to find out
-       if this is x86 (possibly in WOW64), if so use that as our 'native'
-       architecture.
-    2. If the compiler toolchain target architecture is x86, use that as our
-      'native' architecture.
-    3. Otherwise, use the actual Windows architecture
-
-    """
-    os_arch = detect_native_windows_arch()
-    if os_arch == 'x86':
-        return os_arch
-    # If we're on 64-bit Windows, 32-bit apps can be compiled without
-    # cross-compilation. So if we're doing that, just set the native arch as
-    # 32-bit and pretend like we're running under WOW64. Else, return the
-    # actual Windows architecture that we deduced above.
-    for compiler in compilers.values():
-        if compiler.id == 'msvc' and (compiler.target == 'x86' or compiler.target == '80x86'):
-            return 'x86'
-        if compiler.id == 'clang-cl' and compiler.target == 'x86':
-            return 'x86'
-        if compiler.id == 'gcc' and compiler.has_builtin_define('__i386__'):
-            return 'x86'
-    return os_arch
-
-def any_compiler_has_define(compilers: CompilersDict, define):
-    for c in compilers.values():
-        try:
-            if c.has_builtin_define(define):
-                return True
-        except mesonlib.MesonException:
-            # Ignore compilers that do not support has_builtin_define.
-            pass
-    return False
-
-def detect_cpu_family(compilers: CompilersDict) -> str:
-    """
-    Python is inconsistent in its platform module.
-    It returns different values for the same cpu.
-    For x86 it might return 'x86', 'i686' or somesuch.
-    Do some canonicalization.
-    """
-    if mesonlib.is_windows():
-        trial = detect_windows_arch(compilers)
-    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd() or mesonlib.is_qnx():
-        trial = platform.processor().lower()
-    else:
-        trial = platform.machine().lower()
-    if trial.startswith('i') and trial.endswith('86'):
-        trial = 'x86'
-    elif trial == 'bepc':
-        trial = 'x86'
-    elif trial == 'arm64':
-        trial = 'aarch64'
-    elif trial.startswith('arm') or trial.startswith('earm'):
-        trial = 'arm'
-    elif trial.startswith(('powerpc64', 'ppc64')):
-        trial = 'ppc64'
-    elif trial.startswith(('powerpc', 'ppc')) or trial in {'macppc', 'power machintosh'}:
-        trial = 'ppc'
-    elif trial in ('amd64', 'x64', 'i86pc'):
-        trial = 'x86_64'
-    elif trial in {'sun4u', 'sun4v'}:
-        trial = 'sparc64'
-    elif trial in {'mipsel', 'mips64el'}:
-        trial = trial.rstrip('el')
-    elif trial in {'ip30', 'ip35'}:
-        trial = 'mips64'
-
-    # On Linux (and maybe others) there can be any mixture of 32/64 bit code in
-    # the kernel, Python, system, 32-bit chroot on 64-bit host, etc. The only
-    # reliable way to know is to check the compiler defines.
-    if trial == 'x86_64':
-        if any_compiler_has_define(compilers, '__i386__'):
-            trial = 'x86'
-    elif trial == 'aarch64':
-        if any_compiler_has_define(compilers, '__arm__'):
-            trial = 'arm'
-    # Add more quirks here as bugs are reported. Keep in sync with detect_cpu()
-    # below.
-    elif trial == 'parisc64':
-        # ATM there is no 64 bit userland for PA-RISC. Thus always
-        # report it as 32 bit for simplicity.
-        trial = 'parisc'
-
-    if trial not in known_cpu_families:
-        mlog.warning('Unknown CPU family {!r}, please report this at '
-                     'https://github.com/mesonbuild/meson/issues/new with the '
-                     'output of `uname -a` and `cat /proc/cpuinfo`'.format(trial))
-
-    return trial
-
-def detect_cpu(compilers: CompilersDict):
-    if mesonlib.is_windows():
-        trial = detect_windows_arch(compilers)
-    elif mesonlib.is_freebsd() or mesonlib.is_netbsd() or mesonlib.is_openbsd():
-        trial = platform.processor().lower()
-    else:
-        trial = platform.machine().lower()
-
-    if trial in ('amd64', 'x64', 'i86pc'):
-        trial = 'x86_64'
-    if trial == 'x86_64':
-        # Same check as above for cpu_family
-        if any_compiler_has_define(compilers, '__i386__'):
-            trial = 'i686' # All 64 bit cpus have at least this level of x86 support.
-    elif trial == 'aarch64':
-        # Same check as above for cpu_family
-        if any_compiler_has_define(compilers, '__arm__'):
-            trial = 'arm'
-    elif trial.startswith('earm'):
-        trial = 'arm'
-    elif trial == 'e2k':
-        # Make more precise CPU detection for Elbrus platform.
-        trial = platform.processor().lower()
-    elif trial.startswith('mips'):
-        trial = trial.rstrip('el')
-
-    # Add more quirks here as bugs are reported. Keep in sync with
-    # detect_cpu_family() above.
-    return trial
-
-def detect_system():
-    system = platform.system().lower()
-    if system.startswith('cygwin'):
-        return 'cygwin'
-    return system
-
-def detect_msys2_arch():
-    if 'MSYSTEM_CARCH' in os.environ:
-        return os.environ['MSYSTEM_CARCH']
-    return None
-
-def detect_machine_info(compilers: T.Optional[CompilersDict] = None) -> MachineInfo:
-    """Detect the machine we're running on
-
-    If compilers are not provided, we cannot know as much. None out those
-    fields to avoid accidentally depending on partial knowledge. The
-    underlying ''detect_*'' method can be called to explicitly use the
-    partial information.
-    """
-    return MachineInfo(
-        detect_system(),
-        detect_cpu_family(compilers) if compilers is not None else None,
-        detect_cpu(compilers) if compilers is not None else None,
-        sys.byteorder)
-
-# TODO make this compare two `MachineInfo`s purely. How important is the
-# `detect_cpu_family({})` distinction? It is the one impediment to that.
-def machine_info_can_run(machine_info: MachineInfo):
-    """Whether we can run binaries for this machine on the current machine.
-
-    Can almost always run 32-bit binaries on 64-bit natively if the host
-    and build systems are the same. We don't pass any compilers to
-    detect_cpu_family() here because we always want to know the OS
-    architecture, not what the compiler environment tells us.
-    """
-    if machine_info.system != detect_system():
-        return False
-    true_build_cpu_family = detect_cpu_family({})
-    return \
-        (machine_info.cpu_family == true_build_cpu_family) or \
-        ((true_build_cpu_family == 'x86_64') and (machine_info.cpu_family == 'x86'))
-
-def search_version(text: str) -> str:
-    # Usually of the type 4.1.4 but compiler output may contain
-    # stuff like this:
-    # (Sourcery CodeBench Lite 2014.05-29) 4.8.3 20140320 (prerelease)
-    # Limiting major version number to two digits seems to work
-    # thus far. When we get to GCC 100, this will break, but
-    # if we are still relevant when that happens, it can be
-    # considered an achievement in itself.
-    #
-    # This regex is reaching magic levels. If it ever needs
-    # to be updated, do not complexify but convert to something
-    # saner instead.
-    # We'll demystify it a bit with a verbose definition.
-    version_regex = re.compile(r"""
-    (?<!                # Zero-width negative lookbehind assertion
-        (
-            \d          # One digit
-            | \.        # Or one period
-        )               # One occurrence
-    )
-    # Following pattern must not follow a digit or period
-    (
-        \d{1,2}         # One or two digits
-        (
-            \.\d+       # Period and one or more digits
-        )+              # One or more occurrences
-        (
-            -[a-zA-Z0-9]+   # Hyphen and one or more alphanumeric
-        )?              # Zero or one occurrence
-    )                   # One occurrence
-    """, re.VERBOSE)
-    match = version_regex.search(text)
-    if match:
-        return match.group(0)
-
-    # try a simpler regex that has like "blah 2020.01.100 foo" or "blah 2020.01 foo"
-    version_regex = re.compile(r"(\d{1,4}\.\d{1,4}\.?\d{0,4})")
-    match = version_regex.search(text)
-    if match:
-        return match.group(0)
-
-    return 'unknown version'
-
-class Environment:
-    private_dir = 'meson-private'
-    log_dir = 'meson-logs'
-    info_dir = 'meson-info'
-
-    def __init__(self, source_dir, build_dir, options):
-        self.source_dir = source_dir
-        self.build_dir = build_dir
-        # Do not try to create build directories when build_dir is none.
-        # This reduced mode is used by the --buildoptions introspector
-        if build_dir is not None:
-            self.scratch_dir = os.path.join(build_dir, Environment.private_dir)
-            self.log_dir = os.path.join(build_dir, Environment.log_dir)
-            self.info_dir = os.path.join(build_dir, Environment.info_dir)
-            os.makedirs(self.scratch_dir, exist_ok=True)
-            os.makedirs(self.log_dir, exist_ok=True)
-            os.makedirs(self.info_dir, exist_ok=True)
-            try:
-                self.coredata = coredata.load(self.get_build_dir())
-                self.first_invocation = False
-            except FileNotFoundError:
-                self.create_new_coredata(options)
-            except coredata.MesonVersionMismatchException as e:
-                # This is routine, but tell the user the update happened
-                mlog.log('Regenerating configuration from scratch:', str(e))
-                coredata.read_cmd_line_file(self.build_dir, options)
-                self.create_new_coredata(options)
-            except MesonException as e:
-                # If we stored previous command line options, we can recover from
-                # a broken/outdated coredata.
-                if os.path.isfile(coredata.get_cmd_line_file(self.build_dir)):
-                    mlog.warning('Regenerating configuration from scratch.')
-                    mlog.log('Reason:', mlog.red(str(e)))
-                    coredata.read_cmd_line_file(self.build_dir, options)
-                    self.create_new_coredata(options)
-                else:
-                    raise e
-        else:
-            # Just create a fresh coredata in this case
-            self.scratch_dir = ''
-            self.create_new_coredata(options)
-
-        ## locally bind some unfrozen configuration
-
-        # Stores machine infos, the only *three* machine one because we have a
-        # target machine info on for the user (Meson never cares about the
-        # target machine.)
-        machines = PerThreeMachineDefaultable()
-
-        # Similar to coredata.compilers, but lower level in that there is no
-        # meta data, only names/paths.
-        binaries = PerMachineDefaultable()
-
-        # Misc other properties about each machine.
-        properties = PerMachineDefaultable()
-
-        # Store paths for native and cross build files. There is no target
-        # machine information here because nothing is installed for the target
-        # architecture, just the build and host architectures
-        paths = PerMachineDefaultable()
-
-        ## Setup build machine defaults
-
-        # Will be fully initialized later using compilers later.
-        machines.build = detect_machine_info()
-
-        # Just uses hard-coded defaults and environment variables. Might be
-        # overwritten by a native file.
-        binaries.build = BinaryTable()
-        properties.build = Properties()
-
-        ## Read in native file(s) to override build machine configuration
-
-        if self.coredata.config_files is not None:
-            config = coredata.parse_machine_files(self.coredata.config_files)
-            binaries.build = BinaryTable(config.get('binaries', {}))
-            paths.build = Directories(**config.get('paths', {}))
-            properties.build = Properties(config.get('properties', {}))
-
-        ## Read in cross file(s) to override host machine configuration
-
-        if self.coredata.cross_files:
-            config = coredata.parse_machine_files(self.coredata.cross_files)
-            properties.host = Properties(config.get('properties', {}))
-            binaries.host = BinaryTable(config.get('binaries', {}))
-            if 'host_machine' in config:
-                machines.host = MachineInfo.from_literal(config['host_machine'])
-            if 'target_machine' in config:
-                machines.target = MachineInfo.from_literal(config['target_machine'])
-            paths.host = Directories(**config.get('paths', {}))
-
-        ## "freeze" now initialized configuration, and "save" to the class.
-
-        self.machines = machines.default_missing()
-        self.binaries = binaries.default_missing()
-        self.properties = properties.default_missing()
-        self.paths = paths.default_missing()
-
-        exe_wrapper = self.lookup_binary_entry(MachineChoice.HOST, 'exe_wrapper')
-        if exe_wrapper is not None:
-            from .dependencies import ExternalProgram
-            self.exe_wrapper = ExternalProgram.from_bin_list(self, MachineChoice.HOST, 'exe_wrapper')
-        else:
-            self.exe_wrapper = None
-
-        self.cmd_line_options = options.cmd_line_options.copy()
-
-        # List of potential compilers.
-        if mesonlib.is_windows():
-            # Intel C and C++ compiler is icl on Windows, but icc and icpc elsewhere.
-            # Search for icl before cl, since Intel "helpfully" provides a
-            # cl.exe that returns *exactly the same thing* that microsofts
-            # cl.exe does, and if icl is present, it's almost certainly what
-            # you want.
-            self.default_c = ['icl', 'cl', 'cc', 'gcc', 'clang', 'clang-cl', 'pgcc']
-            # There is currently no pgc++ for Windows, only for  Mac and Linux.
-            self.default_cpp = ['icl', 'cl', 'c++', 'g++', 'clang++', 'clang-cl']
-            self.default_fortran = ['ifort', 'gfortran', 'flang', 'pgfortran', 'g95']
-            # Clang and clang++ are valid, but currently unsupported.
-            self.default_objc = ['cc', 'gcc']
-            self.default_objcpp = ['c++', 'g++']
-            self.default_cs = ['csc', 'mcs']
-        else:
-            if platform.machine().lower() == 'e2k':
-                # There are no objc or objc++ compilers for Elbrus,
-                # and there's no clang which can build binaries for host.
-                self.default_c = ['cc', 'gcc', 'lcc']
-                self.default_cpp = ['c++', 'g++', 'l++']
-                self.default_objc = []
-                self.default_objcpp = []
-            else:
-                self.default_c = ['cc', 'gcc', 'clang', 'pgcc', 'icc']
-                self.default_cpp = ['c++', 'g++', 'clang++', 'pgc++', 'icpc']
-                self.default_objc = ['cc', 'gcc', 'clang']
-                self.default_objcpp = ['c++', 'g++', 'clang++']
-            self.default_fortran = ['gfortran', 'flang', 'pgfortran', 'ifort', 'g95']
-            self.default_cs = ['mcs', 'csc']
-        self.default_d = ['ldc2', 'ldc', 'gdc', 'dmd']
-        self.default_java = ['javac']
-        self.default_cuda = ['nvcc']
-        self.default_rust = ['rustc']
-        self.default_swift = ['swiftc']
-        self.default_vala = ['valac']
-        self.default_static_linker = ['ar', 'gar']
-        self.default_strip = ['strip']
-        self.vs_static_linker = ['lib']
-        self.clang_cl_static_linker = ['llvm-lib']
-        self.cuda_static_linker = ['nvlink']
-        self.gcc_static_linker = ['gcc-ar']
-        self.clang_static_linker = ['llvm-ar']
-        self.default_cmake = ['cmake']
-        self.default_pkgconfig = ['pkg-config']
-        self.wrap_resolver = None
-
-    def create_new_coredata(self, options):
-        # WARNING: Don't use any values from coredata in __init__. It gets
-        # re-initialized with project options by the interpreter during
-        # build file parsing.
-        self.coredata = coredata.CoreData(options, self.scratch_dir)
-        # Used by the regenchecker script, which runs meson
-        self.coredata.meson_command = mesonlib.meson_command
-        self.first_invocation = True
-
-    def is_cross_build(self, when_building_for: MachineChoice = MachineChoice.HOST) -> bool:
-        return self.coredata.is_cross_build(when_building_for)
-
-    def dump_coredata(self):
-        return coredata.save(self.coredata, self.get_build_dir())
-
-    def get_script_dir(self):
-        import mesonbuild.scripts
-        return os.path.dirname(mesonbuild.scripts.__file__)
-
-    def get_log_dir(self):
-        return self.log_dir
-
-    def get_coredata(self):
-        return self.coredata
-
-    def get_build_command(self, unbuffered=False):
-        cmd = mesonlib.meson_command[:]
-        if unbuffered and 'python' in os.path.basename(cmd[0]):
-            cmd.insert(1, '-u')
-        return cmd
-
-    def is_header(self, fname):
-        return is_header(fname)
-
-    def is_source(self, fname):
-        return is_source(fname)
-
-    def is_assembly(self, fname):
-        return is_assembly(fname)
-
-    def is_llvm_ir(self, fname):
-        return is_llvm_ir(fname)
-
-    def is_object(self, fname):
-        return is_object(fname)
-
-    @lru_cache(maxsize=None)
-    def is_library(self, fname):
-        return is_library(fname)
-
-    def lookup_binary_entry(self, for_machine: MachineChoice, name: str):
-        return self.binaries[for_machine].lookup_entry(
-            for_machine,
-            self.is_cross_build(),
-            name)
-
-    @staticmethod
-    def get_gnu_compiler_defines(compiler):
-        """
-        Detect GNU compiler platform type (Apple, MinGW, Unix)
-        """
-        # Arguments to output compiler pre-processor defines to stdout
-        # gcc, g++, and gfortran all support these arguments
-        args = compiler + ['-E', '-dM', '-']
-        p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE)
-        if p.returncode != 0:
-            raise EnvironmentException('Unable to detect GNU compiler type:\n' + output + error)
-        # Parse several lines of the type:
-        # `#define ___SOME_DEF some_value`
-        # and extract `___SOME_DEF`
-        defines = {}
-        for line in output.split('\n'):
-            if not line:
-                continue
-            d, *rest = line.split(' ', 2)
-            if d != '#define':
-                continue
-            if len(rest) == 1:
-                defines[rest] = True
-            if len(rest) == 2:
-                defines[rest[0]] = rest[1]
-        return defines
-
-    @staticmethod
-    def get_gnu_version_from_defines(defines):
-        dot = '.'
-        major = defines.get('__GNUC__', '0')
-        minor = defines.get('__GNUC_MINOR__', '0')
-        patch = defines.get('__GNUC_PATCHLEVEL__', '0')
-        return dot.join((major, minor, patch))
-
-    @staticmethod
-    def get_lcc_version_from_defines(defines):
-        dot = '.'
-        generation_and_major = defines.get('__LCC__', '100')
-        generation = generation_and_major[:1]
-        major = generation_and_major[1:]
-        minor = defines.get('__LCC_MINOR__', '0')
-        return dot.join((generation, major, minor))
-
-    @staticmethod
-    def get_clang_compiler_defines(compiler):
-        """
-        Get the list of Clang pre-processor defines
-        """
-        args = compiler + ['-E', '-dM', '-']
-        p, output, error = Popen_safe(args, write='', stdin=subprocess.PIPE)
-        if p.returncode != 0:
-            raise EnvironmentException('Unable to get clang pre-processor defines:\n' + output + error)
-        defines = {}
-        for line in output.split('\n'):
-            if not line:
-                continue
-            d, *rest = line.split(' ', 2)
-            if d != '#define':
-                continue
-            if len(rest) == 1:
-                defines[rest] = True
-            if len(rest) == 2:
-                defines[rest[0]] = rest[1]
-        return defines
-
-    def _get_compilers(self, lang, for_machine):
-        '''
-        The list of compilers is detected in the exact same way for
-        C, C++, ObjC, ObjC++, Fortran, CS so consolidate it here.
-        '''
-        value = self.lookup_binary_entry(for_machine, lang)
-        if value is not None:
-            compilers, ccache = BinaryTable.parse_entry(value)
-            # Return value has to be a list of compiler 'choices'
-            compilers = [compilers]
-        else:
-            if not self.machines.matches_build_machine(for_machine):
-                raise EnvironmentException('{!r} compiler binary not defined in cross or native file'.format(lang))
-            compilers = getattr(self, 'default_' + lang)
-            ccache = BinaryTable.detect_ccache()
-
-        if self.machines.matches_build_machine(for_machine):
-            exe_wrap = None
-        else:
-            exe_wrap = self.get_exe_wrapper()
-
-        return compilers, ccache, exe_wrap
-
-    def _handle_exceptions(self, exceptions, binaries, bintype='compiler'):
-        errmsg = 'Unknown {}(s): {}'.format(bintype, binaries)
-        if exceptions:
-            errmsg += '\nThe follow exceptions were encountered:'
-            for (c, e) in exceptions.items():
-                errmsg += '\nRunning "{0}" gave "{1}"'.format(c, e)
-        raise EnvironmentException(errmsg)
-
-    def _guess_win_linker(self, compiler: T.List[str], comp_class: Compiler,
-                          for_machine: MachineChoice, *,
-                          use_linker_prefix: bool = True, invoked_directly: bool = True,
-                          extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker':
-        self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
-
-        # Explicitly pass logo here so that we can get the version of link.exe
-        if not use_linker_prefix or comp_class.LINKER_PREFIX is None:
-            check_args = ['/logo', '--version']
-        elif isinstance(comp_class.LINKER_PREFIX, str):
-            check_args = [comp_class.LINKER_PREFIX + '/logo', comp_class.LINKER_PREFIX + '--version']
-        elif isinstance(comp_class.LINKER_PREFIX, list):
-            check_args = comp_class.LINKER_PREFIX + ['/logo'] + comp_class.LINKER_PREFIX + ['--version']
-
-        check_args += self.coredata.compiler_options[for_machine][comp_class.language]['args'].value
-
-        override = []  # type: T.List[str]
-        value = self.lookup_binary_entry(for_machine, comp_class.language + '_ld')
-        if value is not None:
-            override = comp_class.use_linker_args(value[0])
-            check_args += override
-
-        if extra_args is not None:
-            check_args.extend(extra_args)
-
-        p, o, _ = Popen_safe(compiler + check_args)
-        if o.startswith('LLD'):
-            if '(compatible with GNU linkers)' in o:
-                return LLVMDynamicLinker(
-                    compiler, for_machine, comp_class.LINKER_PREFIX,
-                    override, version=search_version(o))
-
-        if value is not None and invoked_directly:
-            compiler = value
-            # We've already hanedled the non-direct case above
-
-        p, o, e = Popen_safe(compiler + check_args)
-        if o.startswith('LLD'):
-            return ClangClDynamicLinker(
-                for_machine, [],
-                prefix=comp_class.LINKER_PREFIX if use_linker_prefix else [],
-                exelist=compiler, version=search_version(o), direct=invoked_directly)
-        elif 'OPTLINK' in o:
-            # Opltink's stdout *may* beging with a \r character.
-            return OptlinkDynamicLinker(compiler, for_machine, version=search_version(o))
-        elif o.startswith('Microsoft') or e.startswith('Microsoft'):
-            out = o or e
-            match = re.search(r'.*(X86|X64|ARM|ARM64).*', out)
-            if match:
-                target = str(match.group(1))
-            else:
-                target = 'x86'
-
-            return MSVCDynamicLinker(
-                for_machine, [], machine=target, exelist=compiler,
-                prefix=comp_class.LINKER_PREFIX if use_linker_prefix else [],
-                version=search_version(out), direct=invoked_directly)
-        elif 'GNU coreutils' in o:
-            raise EnvironmentException(
-                "Found GNU link.exe instead of MSVC link.exe. This link.exe "
-                "is not a linker. You may need to reorder entries to your "
-                "%PATH% variable to resolve this.")
-        raise EnvironmentException('Unable to determine dynamic linker')
-
-    def _guess_nix_linker(self, compiler: T.List[str], comp_class: T.Type[Compiler],
-                          for_machine: MachineChoice, *,
-                          extra_args: T.Optional[T.List[str]] = None) -> 'DynamicLinker':
-        """Helper for guessing what linker to use on Unix-Like OSes.
-
-        :compiler: Invocation to use to get linker
-        :comp_class: The Compiler Type (uninstantiated)
-        :for_machine: which machine this linker targets
-        :extra_args: Any additional arguments required (such as a source file)
-        """
-        self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
-        extra_args = T.cast(T.List[str], extra_args or [])
-        extra_args += self.coredata.compiler_options[for_machine][comp_class.language]['args'].value
-
-        if isinstance(comp_class.LINKER_PREFIX, str):
-            check_args = [comp_class.LINKER_PREFIX + '--version'] + extra_args
-        else:
-            check_args = comp_class.LINKER_PREFIX + ['--version'] + extra_args
-
-        override = []  # type: T.List[str]
-        value = self.lookup_binary_entry(for_machine, comp_class.language + '_ld')
-        if value is not None:
-            override = comp_class.use_linker_args(value[0])
-            check_args += override
-
-        _, o, e = Popen_safe(compiler + check_args)
-        v = search_version(o)
-        if o.startswith('LLD'):
-            linker = LLVMDynamicLinker(
-                compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)  # type: DynamicLinker
-        elif e.startswith('lld-link: '):
-            # The LLD MinGW frontend didn't respond to --version before version 9.0.0,
-            # and produced an error message about failing to link (when no object
-            # files were specified), instead of printing the version number.
-            # Let's try to extract the linker invocation command to grab the version.
-
-            _, o, e = Popen_safe(compiler + check_args + ['-v'])
-
-            try:
-                linker_cmd = re.match(r'.*\n(.*?)\nlld-link: ', e, re.DOTALL).group(1)
-                linker_cmd = shlex.split(linker_cmd)[0]
-            except (AttributeError, IndexError, ValueError):
-                pass
-            else:
-                _, o, e = Popen_safe([linker_cmd, '--version'])
-                v = search_version(o)
-
-            linker = LLVMDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
-        # first is for apple clang, second is for real gcc, the third is icc
-        elif e.endswith('(use -v to see invocation)\n') or 'macosx_version' in e or 'ld: unknown option:' in e:
-            if isinstance(comp_class.LINKER_PREFIX, str):
-                _, _, e = Popen_safe(compiler + [comp_class.LINKER_PREFIX + '-v'] + extra_args)
-            else:
-                _, _, e = Popen_safe(compiler + comp_class.LINKER_PREFIX + ['-v'] + extra_args)
-            for line in e.split('\n'):
-                if 'PROJECT:ld' in line:
-                    v = line.split('-')[1]
-                    break
-            else:
-                v = 'unknown version'
-            linker = AppleDynamicLinker(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
-        elif 'GNU' in o:
-            if 'gold' in o:
-                cls = GnuGoldDynamicLinker
-            else:
-                cls = GnuBFDDynamicLinker
-            linker = cls(compiler, for_machine, comp_class.LINKER_PREFIX, override, version=v)
-        elif 'Solaris' in e or 'Solaris' in o:
-            linker = SolarisDynamicLinker(
-                compiler, for_machine, comp_class.LINKER_PREFIX, override,
-                version=search_version(e))
-        else:
-            raise EnvironmentException('Unable to determine dynamic linker')
-        return linker
-
-    def _detect_c_or_cpp_compiler(self, lang: str, for_machine: MachineChoice) -> Compiler:
-        popen_exceptions = {}
-        compilers, ccache, exe_wrap = self._get_compilers(lang, for_machine)
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-
-        for compiler in compilers:
-            if isinstance(compiler, str):
-                compiler = [compiler]
-            compiler_name = os.path.basename(compiler[0])
-
-            if not set(['cl', 'cl.exe', 'clang-cl', 'clang-cl.exe']).isdisjoint(compiler):
-                # Watcom C provides it's own cl.exe clone that mimics an older
-                # version of Microsoft's compiler. Since Watcom's cl.exe is
-                # just a wrapper, we skip using it if we detect its presence
-                # so as not to confuse Meson when configuring for MSVC.
-                #
-                # Additionally the help text of Watcom's cl.exe is paged, and
-                # the binary will not exit without human intervention. In
-                # practice, Meson will block waiting for Watcom's cl.exe to
-                # exit, which requires user input and thus will never exit.
-                if 'WATCOM' in os.environ:
-                    def sanitize(p):
-                        return os.path.normcase(os.path.abspath(p))
-
-                    watcom_cls = [sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl')),
-                                  sanitize(os.path.join(os.environ['WATCOM'], 'BINNT', 'cl.exe'))]
-                    found_cl = sanitize(shutil.which('cl'))
-                    if found_cl in watcom_cls:
-                        continue
-                arg = '/?'
-            elif 'armcc' in compiler_name:
-                arg = '--vsn'
-            elif 'ccrx' in compiler_name:
-                arg = '-v'
-            elif 'xc16' in compiler_name:
-                arg = '--version'
-            elif 'cl2000' in compiler_name:
-                arg = '-version'
-            elif compiler_name in {'icl', 'icl.exe'}:
-                # if you pass anything to icl you get stuck in a pager
-                arg = ''
-            else:
-                arg = '--version'
-
-            try:
-                p, out, err = Popen_safe(compiler + [arg])
-            except OSError as e:
-                popen_exceptions[' '.join(compiler + [arg])] = e
-                continue
-
-            if 'ccrx' in compiler_name:
-                out = err
-
-            full_version = out.split('\n', 1)[0]
-            version = search_version(out)
-
-            guess_gcc_or_lcc = False
-            if 'Free Software Foundation' in out or 'xt-' in out:
-                guess_gcc_or_lcc = 'gcc'
-            if 'e2k' in out and 'lcc' in out:
-                guess_gcc_or_lcc = 'lcc'
-            if 'Microchip Technology' in out:
-                # this output has "Free Software Foundation" in its version
-                guess_gcc_or_lcc = False
-
-            if guess_gcc_or_lcc:
-                defines = self.get_gnu_compiler_defines(compiler)
-                if not defines:
-                    popen_exceptions[' '.join(compiler)] = 'no pre-processor defines'
-                    continue
-
-                if guess_gcc_or_lcc == 'lcc':
-                    version = self.get_lcc_version_from_defines(defines)
-                    cls = ElbrusCCompiler if lang == 'c' else ElbrusCPPCompiler
-                else:
-                    version = self.get_gnu_version_from_defines(defines)
-                    cls = GnuCCompiler if lang == 'c' else GnuCPPCompiler
-
-                linker = self._guess_nix_linker(compiler, cls, for_machine)
-
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross,
-                    info, exe_wrap, defines, full_version=full_version,
-                    linker=linker)
-
-            if 'Emscripten' in out:
-                cls = EmscriptenCCompiler if lang == 'c' else EmscriptenCPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-
-                # emcc requires a file input in order to pass arguments to the
-                # linker. It'll exit with an error code, but still print the
-                # linker version. Old emcc versions ignore -Wl,--version completely,
-                # however. We'll report "unknown version" in that case.
-                with tempfile.NamedTemporaryFile(suffix='.c') as f:
-                    cmd = compiler + [cls.LINKER_PREFIX + "--version", f.name]
-                    _, o, _ = Popen_safe(cmd)
-
-                linker = WASMDynamicLinker(
-                    compiler, for_machine, cls.LINKER_PREFIX,
-                    [], version=search_version(o))
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, linker=linker, full_version=full_version)
-
-            if 'armclang' in out:
-                # The compiler version is not present in the first line of output,
-                # instead it is present in second line, startswith 'Component:'.
-                # So, searching for the 'Component' in out although we know it is
-                # present in second line, as we are not sure about the
-                # output format in future versions
-                arm_ver_str = re.search('.*Component.*', out)
-                if arm_ver_str is None:
-                    popen_exceptions[' '.join(compiler)] = 'version string not found'
-                    continue
-                arm_ver_str = arm_ver_str.group(0)
-                # Override previous values
-                version = search_version(arm_ver_str)
-                full_version = arm_ver_str
-                cls = ArmclangCCompiler if lang == 'c' else ArmclangCPPCompiler
-                linker = ArmClangDynamicLinker(for_machine, version=version)
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, full_version=full_version, linker=linker)
-            if 'CL.EXE COMPATIBILITY' in out:
-                # if this is clang-cl masquerading as cl, detect it as cl, not
-                # clang
-                arg = '--version'
-                try:
-                    p, out, err = Popen_safe(compiler + [arg])
-                except OSError as e:
-                    popen_exceptions[' '.join(compiler + [arg])] = e
-                version = search_version(out)
-                match = re.search('^Target: (.*?)-', out, re.MULTILINE)
-                if match:
-                    target = match.group(1)
-                else:
-                    target = 'unknown target'
-                cls = ClangClCCompiler if lang == 'c' else ClangClCPPCompiler
-                linker = self._guess_win_linker(['lld-link'], cls, for_machine)
-                return cls(
-                    compiler, version, for_machine, is_cross, info, exe_wrap,
-                    target, linker=linker)
-            if 'clang' in out:
-                linker = None
-
-                defines = self.get_clang_compiler_defines(compiler)
-
-                # Even if the for_machine is darwin, we could be using vanilla
-                # clang.
-                if 'Apple' in out:
-                    cls = AppleClangCCompiler if lang == 'c' else AppleClangCPPCompiler
-                else:
-                    cls = ClangCCompiler if lang == 'c' else ClangCPPCompiler
-
-                if 'windows' in out or self.machines[for_machine].is_windows():
-                    # If we're in a MINGW context this actually will use a gnu
-                    # style ld, but for clang on "real" windows we'll use
-                    # either link.exe or lld-link.exe
-                    try:
-                        linker = self._guess_win_linker(compiler, cls, for_machine)
-                    except MesonException:
-                        pass
-                if linker is None:
-                    linker = self._guess_nix_linker(compiler, cls, for_machine)
-
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, defines, full_version=full_version, linker=linker)
-
-            if 'Intel(R) C++ Intel(R)' in err:
-                version = search_version(err)
-                target = 'x86' if 'IA-32' in err else 'x86_64'
-                cls = IntelClCCompiler if lang == 'c' else IntelClCPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = XilinkDynamicLinker(for_machine, [], version=version)
-                return cls(
-                    compiler, version, for_machine, is_cross, info=info,
-                    exe_wrap=exe_wrap, target=target, linker=linker)
-            if 'Microsoft' in out or 'Microsoft' in err:
-                # Latest versions of Visual Studio print version
-                # number to stderr but earlier ones print version
-                # on stdout.  Why? Lord only knows.
-                # Check both outputs to figure out version.
-                for lookat in [err, out]:
-                    version = search_version(lookat)
-                    if version != 'unknown version':
-                        break
-                else:
-                    m = 'Failed to detect MSVC compiler version: stderr was\n{!r}'
-                    raise EnvironmentException(m.format(err))
-                cl_signature = lookat.split('\n')[0]
-                match = re.search('.*(x86|x64|ARM|ARM64)( |$)', cl_signature)
-                if match:
-                    target = match.group(1)
-                else:
-                    m = 'Failed to detect MSVC compiler target architecture: \'cl /?\' output is\n{}'
-                    raise EnvironmentException(m.format(cl_signature))
-                cls = VisualStudioCCompiler if lang == 'c' else VisualStudioCPPCompiler
-                linker = self._guess_win_linker(['link'], cls, for_machine)
-                return cls(
-                    compiler, version, for_machine, is_cross, info, exe_wrap,
-                    target, linker=linker)
-            if 'PGI Compilers' in out:
-                cls = PGICCompiler if lang == 'c' else PGICPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = PGIDynamicLinker(compiler, for_machine, cls.LINKER_PREFIX, [], version=version)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross,
-                    info, exe_wrap, linker=linker)
-            if '(ICC)' in out:
-                cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler
-                l = self._guess_nix_linker(compiler, cls, for_machine)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, full_version=full_version, linker=l)
-            if 'ARM' in out:
-                cls = ArmCCompiler if lang == 'c' else ArmCPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = ArmDynamicLinker(for_machine, version=version)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross,
-                    info, exe_wrap, full_version=full_version, linker=linker)
-            if 'RX Family' in out:
-                cls = CcrxCCompiler if lang == 'c' else CcrxCPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = CcrxDynamicLinker(for_machine, version=version)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, full_version=full_version, linker=linker)
-
-            if 'Microchip Technology' in out:
-                cls = Xc16CCompiler if lang == 'c' else Xc16CCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = Xc16DynamicLinker(for_machine, version=version)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, full_version=full_version, linker=linker)
-
-            if 'TMS320C2000 C/C++' in out:
-                cls = C2000CCompiler if lang == 'c' else C2000CPPCompiler
-                self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                linker = C2000DynamicLinker(for_machine, version=version)
-                return cls(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, full_version=full_version, linker=linker)
-
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def detect_c_compiler(self, for_machine):
-        return self._detect_c_or_cpp_compiler('c', for_machine)
-
-    def detect_cpp_compiler(self, for_machine):
-        return self._detect_c_or_cpp_compiler('cpp', for_machine)
-
-    def detect_cuda_compiler(self, for_machine):
-        popen_exceptions = {}
-        is_cross = self.is_cross_build(for_machine)
-        compilers, ccache, exe_wrap = self._get_compilers('cuda', for_machine)
-        info = self.machines[for_machine]
-        for compiler in compilers:
-            if isinstance(compiler, str):
-                compiler = [compiler]
-            arg = '--version'
-            try:
-                p, out, err = Popen_safe(compiler + [arg])
-            except OSError as e:
-                popen_exceptions[' '.join(compiler + [arg])] = e
-                continue
-            # Example nvcc printout:
-            #
-            #     nvcc: NVIDIA (R) Cuda compiler driver
-            #     Copyright (c) 2005-2018 NVIDIA Corporation
-            #     Built on Sat_Aug_25_21:08:01_CDT_2018
-            #     Cuda compilation tools, release 10.0, V10.0.130
-            #
-            # search_version() first finds the "10.0" after "release",
-            # rather than the more precise "10.0.130" after "V".
-            # The patch version number is occasionally important; For
-            # instance, on Linux,
-            #    - CUDA Toolkit 8.0.44 requires NVIDIA Driver 367.48
-            #    - CUDA Toolkit 8.0.61 requires NVIDIA Driver 375.26
-            # Luckily, the "V" also makes it very simple to extract
-            # the full version:
-            version = out.strip().split('V')[-1]
-            cpp_compiler = self.detect_cpp_compiler(for_machine)
-            cls = CudaCompiler
-            self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-            linker = CudaLinker(compiler, for_machine, CudaCompiler.LINKER_PREFIX, [], version=CudaLinker.parse_version())
-            return cls(ccache + compiler, version, for_machine, is_cross, exe_wrap, host_compiler=cpp_compiler, info=info, linker=linker)
-        raise EnvironmentException('Could not find suitable CUDA compiler: "' + ' '.join(compilers) + '"')
-
-    def detect_fortran_compiler(self, for_machine: MachineChoice):
-        popen_exceptions = {}
-        compilers, ccache, exe_wrap = self._get_compilers('fortran', for_machine)
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-        for compiler in compilers:
-            if isinstance(compiler, str):
-                compiler = [compiler]
-            for arg in ['--version', '-V']:
-                try:
-                    p, out, err = Popen_safe(compiler + [arg])
-                except OSError as e:
-                    popen_exceptions[' '.join(compiler + [arg])] = e
-                    continue
-
-                version = search_version(out)
-                full_version = out.split('\n', 1)[0]
-
-                guess_gcc_or_lcc = False
-                if 'GNU Fortran' in out:
-                    guess_gcc_or_lcc = 'gcc'
-                if 'e2k' in out and 'lcc' in out:
-                    guess_gcc_or_lcc = 'lcc'
-
-                if guess_gcc_or_lcc:
-                    defines = self.get_gnu_compiler_defines(compiler)
-                    if not defines:
-                        popen_exceptions[' '.join(compiler)] = 'no pre-processor defines'
-                        continue
-                    if guess_gcc_or_lcc == 'lcc':
-                        version = self.get_lcc_version_from_defines(defines)
-                        cls = ElbrusFortranCompiler
-                    else:
-                        version = self.get_gnu_version_from_defines(defines)
-                        cls = GnuFortranCompiler
-                    linker = self._guess_nix_linker(
-                        compiler, cls, for_machine)
-                    return cls(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, defines, full_version=full_version,
-                        linker=linker)
-
-                if 'G95' in out:
-                    linker = self._guess_nix_linker(
-                        compiler, cls, for_machine)
-                    return G95FortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-                if 'Sun Fortran' in err:
-                    version = search_version(err)
-                    linker = self._guess_nix_linker(
-                        compiler, cls, for_machine)
-                    return SunFortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-                if 'Intel(R) Visual Fortran' in err:
-                    version = search_version(err)
-                    target = 'x86' if 'IA-32' in err else 'x86_64'
-                    cls = IntelClFortranCompiler
-                    self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                    linker = XilinkDynamicLinker(for_machine, [], version=version)
-                    return cls(
-                        compiler, version, for_machine, is_cross, target,
-                        info, exe_wrap, linker=linker)
-
-                if 'ifort (IFORT)' in out:
-                    linker = self._guess_nix_linker(compiler, IntelFortranCompiler, for_machine)
-                    return IntelFortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-                if 'PathScale EKOPath(tm)' in err:
-                    return PathScaleFortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version)
-
-                if 'PGI Compilers' in out:
-                    cls = PGIFortranCompiler
-                    self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-                    linker = PGIDynamicLinker(compiler, for_machine,
-                                              cls.LINKER_PREFIX, [], version=version)
-                    return cls(
-                        compiler, version, for_machine, is_cross, info, exe_wrap,
-                        full_version=full_version, linker=linker)
-
-                if 'flang' in out or 'clang' in out:
-                    linker = self._guess_nix_linker(
-                        compiler, FlangFortranCompiler, for_machine)
-                    return FlangFortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-                if 'Open64 Compiler Suite' in err:
-                    linker = self._guess_nix_linker(
-                        compiler, Open64FortranCompiler, for_machine)
-                    return Open64FortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-                if 'NAG Fortran' in err:
-                    linker = self._guess_nix_linker(
-                        compiler, NAGFortranCompiler, for_machine)
-                    return NAGFortranCompiler(
-                        compiler, version, for_machine, is_cross, info,
-                        exe_wrap, full_version=full_version, linker=linker)
-
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def get_scratch_dir(self):
-        return self.scratch_dir
-
-    def detect_objc_compiler(self, for_machine: MachineInfo) -> 'Compiler':
-        return self._detect_objc_or_objcpp_compiler(for_machine, True)
-
-    def detect_objcpp_compiler(self, for_machine: MachineInfo) -> 'Compiler':
-        return self._detect_objc_or_objcpp_compiler(for_machine, False)
-
-    def _detect_objc_or_objcpp_compiler(self, for_machine: MachineChoice, objc: bool) -> 'Compiler':
-        popen_exceptions = {}
-        compilers, ccache, exe_wrap = self._get_compilers('objc' if objc else 'objcpp', for_machine)
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-
-        for compiler in compilers:
-            if isinstance(compiler, str):
-                compiler = [compiler]
-            arg = ['--version']
-            try:
-                p, out, err = Popen_safe(compiler + arg)
-            except OSError as e:
-                popen_exceptions[' '.join(compiler + arg)] = e
-                continue
-            version = search_version(out)
-            if 'Free Software Foundation' in out:
-                defines = self.get_gnu_compiler_defines(compiler)
-                if not defines:
-                    popen_exceptions[' '.join(compiler)] = 'no pre-processor defines'
-                    continue
-                version = self.get_gnu_version_from_defines(defines)
-                comp = GnuObjCCompiler if objc else GnuObjCPPCompiler
-                linker = self._guess_nix_linker(compiler, comp, for_machine)
-                return comp(
-                    ccache + compiler, version, for_machine, is_cross, info,
-                    exe_wrap, defines, linker=linker)
-            if 'clang' in out:
-                linker = None
-                if 'Apple' in out:
-                    comp = AppleClangObjCCompiler if objc else AppleClangObjCPPCompiler
-                else:
-                    comp = ClangObjCCompiler if objc else ClangObjCPPCompiler
-                if 'windows' in out or self.machines[for_machine].is_windows():
-                    # If we're in a MINGW context this actually will use a gnu style ld
-                    try:
-                        linker = self._guess_win_linker(compiler, comp, for_machine)
-                    except MesonException:
-                        pass
-
-                if not linker:
-                    linker = self._guess_nix_linker(
-                        compiler, comp, for_machine)
-                return comp(
-                    ccache + compiler, version, for_machine,
-                    is_cross, info, exe_wrap, linker=linker)
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def detect_java_compiler(self, for_machine):
-        exelist = self.lookup_binary_entry(for_machine, 'java')
-        info = self.machines[for_machine]
-        if exelist is None:
-            # TODO support fallback
-            exelist = [self.default_java[0]]
-
-        try:
-            p, out, err = Popen_safe(exelist + ['-version'])
-        except OSError:
-            raise EnvironmentException('Could not execute Java compiler "{}"'.format(' '.join(exelist)))
-        if 'javac' in out or 'javac' in err:
-            version = search_version(err if 'javac' in err else out)
-            if not version or version == 'unknown version':
-                parts = (err if 'javac' in err else out).split()
-                if len(parts) > 1:
-                    version = parts[1]
-            comp_class = JavaCompiler
-            self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
-            return comp_class(exelist, version, for_machine, info)
-        raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
-
-    def detect_cs_compiler(self, for_machine):
-        compilers, ccache, exe_wrap = self._get_compilers('cs', for_machine)
-        popen_exceptions = {}
-        info = self.machines[for_machine]
-        for comp in compilers:
-            if not isinstance(comp, list):
-                comp = [comp]
-            try:
-                p, out, err = Popen_safe(comp + ['--version'])
-            except OSError as e:
-                popen_exceptions[' '.join(comp + ['--version'])] = e
-                continue
-
-            version = search_version(out)
-            if 'Mono' in out:
-                cls = MonoCompiler
-            elif "Visual C#" in out:
-                cls = VisualStudioCsCompiler
-            else:
-                continue
-            self.coredata.add_lang_args(cls.language, cls, for_machine, self)
-            return cls(comp, version, for_machine, info)
-
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def detect_vala_compiler(self, for_machine):
-        exelist = self.lookup_binary_entry(for_machine, 'vala')
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-        if exelist is None:
-            # TODO support fallback
-            exelist = [self.default_vala[0]]
-
-        try:
-            p, out = Popen_safe(exelist + ['--version'])[0:2]
-        except OSError:
-            raise EnvironmentException('Could not execute Vala compiler "{}"'.format(' '.join(exelist)))
-        version = search_version(out)
-        if 'Vala' in out:
-            comp_class = ValaCompiler
-            self.coredata.add_lang_args(comp_class.language, comp_class, for_machine, self)
-            return comp_class(exelist, version, for_machine, info, is_cross)
-        raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
-
-    def detect_rust_compiler(self, for_machine):
-        popen_exceptions = {}
-        compilers, ccache, exe_wrap = self._get_compilers('rust', for_machine)
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-
-        cc = self.detect_c_compiler(for_machine)
-        is_link_exe = isinstance(cc.linker, VisualStudioLikeLinkerMixin)
-        override = self.lookup_binary_entry(for_machine, 'rust_ld')
-
-        for compiler in compilers:
-            if isinstance(compiler, str):
-                compiler = [compiler]
-            arg = ['--version']
-            try:
-                p, out = Popen_safe(compiler + arg)[0:2]
-            except OSError as e:
-                popen_exceptions[' '.join(compiler + arg)] = e
-                continue
-
-            version = search_version(out)
-
-            if 'rustc' in out:
-                # On Linux and mac rustc will invoke gcc (clang for mac
-                # presumably) and it can do this windows, for dynamic linking.
-                # this means the easiest way to C compiler for dynamic linking.
-                # figure out what linker to use is to just get the value of the
-                # C compiler and use that as the basis of the rust linker.
-                # However, there are two things we need to change, if CC is not
-                # the default use that, and second add the necessary arguments
-                # to rust to use -fuse-ld
-
-                if override is None:
-                    extra_args = {}
-                    always_args = []
-                    if is_link_exe:
-                        compiler.extend(['-C', 'linker={}'.format(cc.linker.exelist[0])])
-                        extra_args['direct'] = True
-                        extra_args['machine'] = cc.linker.machine
-                    elif not ((info.is_darwin() and isinstance(cc, AppleClangCCompiler)) or
-                              isinstance(cc, GnuCCompiler)):
-                        c = cc.exelist[1] if cc.exelist[0].endswith('ccache') else cc.exelist[0]
-                        compiler.extend(['-C', 'linker={}'.format(c)])
-
-                    # This trickery with type() gets us the class of the linker
-                    # so we can initialize a new copy for the Rust Compiler
-                    if is_link_exe:
-                        linker = type(cc.linker)(for_machine, always_args, exelist=cc.linker.exelist,
-                                                 version=cc.linker.version, **extra_args)
-                    else:
-                        linker = type(cc.linker)(compiler, for_machine, cc.LINKER_PREFIX,
-                                                 always_args=always_args, version=cc.linker.version,
-                                                 **extra_args)
-                elif 'link' in override[0]:
-                    linker = self._guess_win_linker(
-                        override, RustCompiler, for_machine, use_linker_prefix=False)
-                    linker.direct = True
-                else:
-                    # We're creating a new type of "C" compiler, that has rust
-                    # as it's language. This is gross, but I can't figure out
-                    # another way to handle this, because rustc is actually
-                    # invoking the c compiler as it's linker.
-                    b = type('b', (type(cc), ), {})
-                    b.language = RustCompiler.language
-                    linker = self._guess_nix_linker(cc.exelist, b, for_machine)
-
-                    # Of course, we're not going to use any of that, we just
-                    # need it to get the proper arguments to pass to rustc
-                    c = cc.exelist[1] if cc.exelist[0].endswith('ccache') else cc.exelist[0]
-                    compiler.extend(['-C', 'linker={}'.format(c)])
-                    compiler.extend(['-C', 'link-args={}'.format(' '.join(cc.use_linker_args(override[0])))])
-
-                self.coredata.add_lang_args(RustCompiler.language, RustCompiler, for_machine, self)
-                return RustCompiler(
-                    compiler, version, for_machine, is_cross, info, exe_wrap,
-                    linker=linker)
-
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def detect_d_compiler(self, for_machine: MachineChoice):
-        info = self.machines[for_machine]
-
-        # Detect the target architecture, required for proper architecture handling on Windows.
-        # MSVC compiler is required for correct platform detection.
-        c_compiler = {'c': self.detect_c_compiler(for_machine)}
-        is_msvc = isinstance(c_compiler['c'], VisualStudioCCompiler)
-        if not is_msvc:
-            c_compiler = {}
-
-        arch = detect_cpu_family(c_compiler)
-        if is_msvc and arch == 'x86':
-            arch = 'x86_mscoff'
-
-        popen_exceptions = {}
-        is_cross = self.is_cross_build(for_machine)
-        results, ccache, exe_wrap = self._get_compilers('d', for_machine)
-        for exelist in results:
-            # Search for a D compiler.
-            # We prefer LDC over GDC unless overridden with the DC
-            # environment variable because LDC has a much more
-            # up to date language version at time (2016).
-            if not isinstance(exelist, list):
-                exelist = [exelist]
-            if os.path.basename(exelist[-1]).startswith(('ldmd', 'gdmd')):
-                raise EnvironmentException(
-                    'Meson does not support {} as it is only a DMD frontend for another compiler.'
-                    'Please provide a valid value for DC or unset it so that Meson can resolve the compiler by itself.'.format(exelist[-1]))
-            try:
-                p, out = Popen_safe(exelist + ['--version'])[0:2]
-            except OSError as e:
-                popen_exceptions[' '.join(exelist + ['--version'])] = e
-                continue
-            version = search_version(out)
-            full_version = out.split('\n', 1)[0]
-
-            if 'LLVM D compiler' in out:
-                # LDC seems to require a file
-                # We cannot use NamedTemproraryFile on windows, its documented
-                # to not work for our uses. So, just use mkstemp and only have
-                # one path for simplicity.
-                o, f = tempfile.mkstemp('.d')
-                os.close(o)
-
-                try:
-                    if info.is_windows() or info.is_cygwin():
-                        objfile = os.path.basename(f)[:-1] + 'obj'
-                        linker = self._guess_win_linker(
-                            exelist,
-                            compilers.LLVMDCompiler, for_machine,
-                            use_linker_prefix=True, invoked_directly=False,
-                            extra_args=[f])
-                    else:
-                        # LDC writes an object file to the current working directory.
-                        # Clean it up.
-                        objfile = os.path.basename(f)[:-1] + 'o'
-                        linker = self._guess_nix_linker(
-                            exelist, compilers.LLVMDCompiler, for_machine,
-                            extra_args=[f])
-                finally:
-                    mesonlib.windows_proof_rm(f)
-                    mesonlib.windows_proof_rm(objfile)
-
-                return compilers.LLVMDCompiler(
-                    exelist, version, for_machine, info, arch,
-                    full_version=full_version, linker=linker)
-            elif 'gdc' in out:
-                linker = self._guess_nix_linker(exelist, compilers.GnuDCompiler, for_machine)
-                return compilers.GnuDCompiler(
-                    exelist, version, for_machine, info, arch, is_cross, exe_wrap,
-                    full_version=full_version, linker=linker)
-            elif 'The D Language Foundation' in out or 'Digital Mars' in out:
-                # DMD seems to require a file
-                # We cannot use NamedTemproraryFile on windows, its documented
-                # to not work for our uses. So, just use mkstemp and only have
-                # one path for simplicity.
-                o, f = tempfile.mkstemp('.d')
-                os.close(o)
-
-                # DMD as different detection logic for x86 and x86_64
-                arch_arg = '-m64' if arch == 'x86_64' else '-m32'
-
-                try:
-                    if info.is_windows() or info.is_cygwin():
-                        objfile = os.path.basename(f)[:-1] + 'obj'
-                        linker = self._guess_win_linker(
-                            exelist, compilers.DmdDCompiler, for_machine,
-                            invoked_directly=False, extra_args=[f, arch_arg])
-                    else:
-                        objfile = os.path.basename(f)[:-1] + 'o'
-                        linker = self._guess_nix_linker(
-                            exelist, compilers.DmdDCompiler, for_machine,
-                            extra_args=[f, arch_arg])
-                finally:
-                    mesonlib.windows_proof_rm(f)
-                    mesonlib.windows_proof_rm(objfile)
-
-                return compilers.DmdDCompiler(
-                    exelist, version, for_machine, info, arch,
-                    full_version=full_version, linker=linker)
-            raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
-
-        self._handle_exceptions(popen_exceptions, compilers)
-
-    def detect_swift_compiler(self, for_machine):
-        exelist = self.lookup_binary_entry(for_machine, 'swift')
-        is_cross = self.is_cross_build(for_machine)
-        info = self.machines[for_machine]
-        if exelist is None:
-            # TODO support fallback
-            exelist = [self.default_swift[0]]
-
-        try:
-            p, _, err = Popen_safe(exelist + ['-v'])
-        except OSError:
-            raise EnvironmentException('Could not execute Swift compiler "{}"'.format(' '.join(exelist)))
-        version = search_version(err)
-        if 'Swift' in err:
-            # As for 5.0.1 swiftc *requires* a file to check the linker:
-            with tempfile.NamedTemporaryFile(suffix='.swift') as f:
-                linker = self._guess_nix_linker(
-                    exelist, compilers.SwiftCompiler, for_machine,
-                    extra_args=[f.name])
-            return compilers.SwiftCompiler(
-                exelist, version, for_machine, info, is_cross, linker=linker)
-
-        raise EnvironmentException('Unknown compiler "' + ' '.join(exelist) + '"')
-
-    def compiler_from_language(self, lang: str, for_machine: MachineChoice):
-        if lang == 'c':
-            comp = self.detect_c_compiler(for_machine)
-        elif lang == 'cpp':
-            comp = self.detect_cpp_compiler(for_machine)
-        elif lang == 'objc':
-            comp = self.detect_objc_compiler(for_machine)
-        elif lang == 'cuda':
-            comp = self.detect_cuda_compiler(for_machine)
-        elif lang == 'objcpp':
-            comp = self.detect_objcpp_compiler(for_machine)
-        elif lang == 'java':
-            comp = self.detect_java_compiler(for_machine)
-        elif lang == 'cs':
-            comp = self.detect_cs_compiler(for_machine)
-        elif lang == 'vala':
-            comp = self.detect_vala_compiler(for_machine)
-        elif lang == 'd':
-            comp = self.detect_d_compiler(for_machine)
-        elif lang == 'rust':
-            comp = self.detect_rust_compiler(for_machine)
-        elif lang == 'fortran':
-            comp = self.detect_fortran_compiler(for_machine)
-        elif lang == 'swift':
-            comp = self.detect_swift_compiler(for_machine)
-        else:
-            comp = None
-        return comp
-
-    def detect_compiler_for(self, lang: str, for_machine: MachineChoice):
-        comp = self.compiler_from_language(lang, for_machine)
-        if comp is not None:
-            assert comp.for_machine == for_machine
-            self.coredata.process_new_compiler(lang, comp, self)
-        return comp
-
-    def detect_static_linker(self, compiler):
-        linker = self.lookup_binary_entry(compiler.for_machine, 'ar')
-        if linker is not None:
-            linkers = [linker]
-        else:
-            defaults = [[l] for l in self.default_static_linker]
-            if isinstance(compiler, compilers.CudaCompiler):
-                linkers = [self.cuda_static_linker] + defaults
-            elif isinstance(compiler, compilers.VisualStudioLikeCompiler):
-                linkers = [self.vs_static_linker, self.clang_cl_static_linker]
-            elif isinstance(compiler, compilers.GnuCompiler):
-                # Use gcc-ar if available; needed for LTO
-                linkers = [self.gcc_static_linker] + defaults
-            elif isinstance(compiler, compilers.ClangCompiler):
-                # Use llvm-ar if available; needed for LTO
-                linkers = [self.clang_static_linker] + defaults
-            elif isinstance(compiler, compilers.DCompiler):
-                # Prefer static linkers over linkers used by D compilers
-                if mesonlib.is_windows():
-                    linkers = [self.vs_static_linker, self.clang_cl_static_linker, compiler.get_linker_exelist()]
-                else:
-                    linkers = defaults
-            elif isinstance(compiler, IntelClCCompiler):
-                # Intel has it's own linker that acts like microsoft's lib
-                linkers = ['xilib']
-            elif isinstance(compiler, (PGICCompiler, PGIFortranCompiler)) and mesonlib.is_windows():
-                linkers = [['ar']]  # For PGI on Windows, "ar" is just a wrapper calling link/lib.
-            else:
-                linkers = defaults
-        popen_exceptions = {}
-        for linker in linkers:
-            if not {'lib', 'lib.exe', 'llvm-lib', 'llvm-lib.exe', 'xilib', 'xilib.exe'}.isdisjoint(linker):
-                arg = '/?'
-            elif not {'ar2000', 'ar2000.exe'}.isdisjoint(linker):
-                arg = '?'
-            else:
-                arg = '--version'
-            try:
-                p, out, err = Popen_safe(linker + [arg])
-            except OSError as e:
-                popen_exceptions[' '.join(linker + [arg])] = e
-                continue
-            if "xilib: executing 'lib'" in err:
-                return IntelVisualStudioLinker(linker, getattr(compiler, 'machine', None))
-            if '/OUT:' in out.upper() or '/OUT:' in err.upper():
-                return VisualStudioLinker(linker, getattr(compiler, 'machine', None))
-            if 'ar-Error-Unknown switch: --version' in err:
-                return PGIStaticLinker(linker)
-            if p.returncode == 0 and ('armar' in linker or 'armar.exe' in linker):
-                return ArmarLinker(linker)
-            if 'DMD32 D Compiler' in out or 'DMD64 D Compiler' in out:
-                return DLinker(linker, compiler.arch)
-            if 'LDC - the LLVM D compiler' in out:
-                return DLinker(linker, compiler.arch)
-            if 'GDC' in out and ' based on D ' in out:
-                return DLinker(linker, compiler.arch)
-            if err.startswith('Renesas') and ('rlink' in linker or 'rlink.exe' in linker):
-                return CcrxLinker(linker)
-            if out.startswith('GNU ar') and ('xc16-ar' in linker or 'xc16-ar.exe' in linker):
-                return Xc16Linker(linker)
-            if out.startswith('TMS320C2000') and ('ar2000' in linker or 'ar2000.exe' in linker):
-                return C2000Linker(linker)
-            if p.returncode == 0:
-                return ArLinker(linker)
-            if p.returncode == 1 and err.startswith('usage'): # OSX
-                return ArLinker(linker)
-            if p.returncode == 1 and err.startswith('Usage'): # AIX
-                return ArLinker(linker)
-            if p.returncode == 1 and err.startswith('ar: bad option: --'): # Solaris
-                return ArLinker(linker)
-        self._handle_exceptions(popen_exceptions, linkers, 'linker')
-        raise EnvironmentException('Unknown static linker "{}"'.format(' '.join(linkers)))
-
-    def get_source_dir(self):
-        return self.source_dir
-
-    def get_build_dir(self):
-        return self.build_dir
-
-    def get_import_lib_dir(self) -> str:
-        "Install dir for the import library (library used for linking)"
-        return self.get_libdir()
-
-    def get_shared_module_dir(self) -> str:
-        "Install dir for shared modules that are loaded at runtime"
-        return self.get_libdir()
-
-    def get_shared_lib_dir(self) -> str:
-        "Install dir for the shared library"
-        m = self.machines.host
-        # Windows has no RPATH or similar, so DLLs must be next to EXEs.
-        if m.is_windows() or m.is_cygwin():
-            return self.get_bindir()
-        return self.get_libdir()
-
-    def get_static_lib_dir(self) -> str:
-        "Install dir for the static library"
-        return self.get_libdir()
-
-    def get_prefix(self) -> str:
-        return self.coredata.get_builtin_option('prefix')
-
-    def get_libdir(self) -> str:
-        return self.coredata.get_builtin_option('libdir')
-
-    def get_libexecdir(self) -> str:
-        return self.coredata.get_builtin_option('libexecdir')
-
-    def get_bindir(self) -> str:
-        return self.coredata.get_builtin_option('bindir')
-
-    def get_includedir(self) -> str:
-        return self.coredata.get_builtin_option('includedir')
-
-    def get_mandir(self) -> str:
-        return self.coredata.get_builtin_option('mandir')
-
-    def get_datadir(self) -> str:
-        return self.coredata.get_builtin_option('datadir')
-
-    def get_compiler_system_dirs(self, for_machine: MachineChoice):
-        for comp in self.coredata.compilers[for_machine].values():
-            if isinstance(comp, compilers.ClangCompiler):
-                index = 1
-                break
-            elif isinstance(comp, compilers.GnuCompiler):
-                index = 2
-                break
-        else:
-            # This option is only supported by gcc and clang. If we don't get a
-            # GCC or Clang compiler return and empty list.
-            return []
-
-        p, out, _ = Popen_safe(comp.get_exelist() + ['-print-search-dirs'])
-        if p.returncode != 0:
-            raise mesonlib.MesonException('Could not calculate system search dirs')
-        out = out.split('\n')[index].lstrip('libraries: =').split(':')
-        return [os.path.normpath(p) for p in out]
-
-    def need_exe_wrapper(self, for_machine: MachineChoice = MachineChoice.HOST):
-        value = self.properties[for_machine].get('needs_exe_wrapper', None)
-        if value is not None:
-            return value
-        return not machine_info_can_run(self.machines[for_machine])
-
-    def get_exe_wrapper(self):
-        if not self.need_exe_wrapper():
-            from .dependencies import EmptyExternalProgram
-            return EmptyExternalProgram()
-        return self.exe_wrapper
diff --git a/meson/mesonbuild/interpreter.py b/meson/mesonbuild/interpreter.py
deleted file mode 100644 (file)
index b2b43f3..0000000
+++ /dev/null
@@ -1,4869 +0,0 @@
-# Copyright 2012-2019 The Meson development team
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from . import mparser
-from . import environment
-from . import coredata
-from . import dependencies
-from . import mlog
-from . import build
-from . import optinterpreter
-from . import compilers
-from .wrap import wrap, WrapMode
-from . import mesonlib
-from .mesonlib import FileMode, MachineChoice, Popen_safe, listify, extract_as_list, has_path_sep, unholder
-from .dependencies import ExternalProgram
-from .dependencies import InternalDependency, Dependency, NotFoundDependency, DependencyException
-from .depfile import DepFile
-from .interpreterbase import InterpreterBase
-from .interpreterbase import check_stringlist, flatten, noPosargs, noKwargs, stringArgs, permittedKwargs, noArgsFlattening
-from .interpreterbase import InterpreterException, InvalidArguments, InvalidCode, SubdirDoneRequest
-from .interpreterbase import InterpreterObject, MutableInterpreterObject, Disabler, disablerIfNotFound
-from .interpreterbase import FeatureNew, FeatureDeprecated, FeatureNewKwargs, FeatureDeprecatedKwargs
-from .interpreterbase import ObjectHolder
-from .modules import ModuleReturnValue
-from .cmake import CMakeInterpreter
-from .backend.backends import TestProtocol
-
-from pathlib import Path, PurePath
-import os
-import shutil
-import uuid
-import re
-import shlex
-import stat
-import subprocess
-import collections
-import functools
-import typing as T
-
-import importlib
-
-permitted_method_kwargs = {
-    'partial_dependency': {'compile_args', 'link_args', 'links', 'includes',
-                           'sources'},
-}
-
-def stringifyUserArguments(args):
-    if isinstance(args, list):
-        return '[%s]' % ', '.join([stringifyUserArguments(x) for x in args])
-    elif isinstance(args, dict):
-        return '{%s}' % ', '.join(['%s : %s' % (stringifyUserArguments(k), stringifyUserArguments(v)) for k, v in args.items()])
-    elif isinstance(args, int):
-        return str(args)
-    elif isinstance(args, str):
-        return "'%s'" % args
-    raise InvalidArguments('Function accepts only strings, integers, lists and lists thereof.')
-
-
-class OverrideProgram(dependencies.ExternalProgram):
-    pass
-
-
-class FeatureOptionHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, env, name, option):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, option)
-        if option.is_auto():
-            self.held_object = env.coredata.builtins['auto_features']
-        self.name = name
-        self.methods.update({'enabled': self.enabled_method,
-                             'disabled': self.disabled_method,
-                             'auto': self.auto_method,
-                             })
-
-    @noPosargs
-    @permittedKwargs({})
-    def enabled_method(self, args, kwargs):
-        return self.held_object.is_enabled()
-
-    @noPosargs
-    @permittedKwargs({})
-    def disabled_method(self, args, kwargs):
-        return self.held_object.is_disabled()
-
-    @noPosargs
-    @permittedKwargs({})
-    def auto_method(self, args, kwargs):
-        return self.held_object.is_auto()
-
-def extract_required_kwarg(kwargs, subproject, feature_check=None, default=True):
-    val = kwargs.get('required', default)
-    disabled = False
-    required = False
-    feature = None
-    if isinstance(val, FeatureOptionHolder):
-        if not feature_check:
-            feature_check = FeatureNew('User option "feature"', '0.47.0')
-        feature_check.use(subproject)
-        option = val.held_object
-        feature = val.name
-        if option.is_disabled():
-            disabled = True
-        elif option.is_enabled():
-            required = True
-    elif isinstance(val, bool):
-        required = val
-    else:
-        raise InterpreterException('required keyword argument must be boolean or a feature option')
-
-    # Keep boolean value in kwargs to simplify other places where this kwarg is
-    # checked.
-    kwargs['required'] = required
-
-    return disabled, required, feature
-
-def extract_search_dirs(kwargs):
-    search_dirs = mesonlib.stringlistify(kwargs.get('dirs', []))
-    search_dirs = [Path(d).expanduser() for d in search_dirs]
-    for d in search_dirs:
-        if mesonlib.is_windows() and d.root.startswith('\\'):
-            # a Unix-path starting with `/` that is not absolute on Windows.
-            # discard without failing for end-user ease of cross-platform directory arrays
-            continue
-        if not d.is_absolute():
-            raise InvalidCode('Search directory {} is not an absolute path.'.format(d))
-    return list(map(str, search_dirs))
-
-class TryRunResultHolder(InterpreterObject):
-    def __init__(self, res):
-        super().__init__()
-        self.res = res
-        self.methods.update({'returncode': self.returncode_method,
-                             'compiled': self.compiled_method,
-                             'stdout': self.stdout_method,
-                             'stderr': self.stderr_method,
-                             })
-
-    @noPosargs
-    @permittedKwargs({})
-    def returncode_method(self, args, kwargs):
-        return self.res.returncode
-
-    @noPosargs
-    @permittedKwargs({})
-    def compiled_method(self, args, kwargs):
-        return self.res.compiled
-
-    @noPosargs
-    @permittedKwargs({})
-    def stdout_method(self, args, kwargs):
-        return self.res.stdout
-
-    @noPosargs
-    @permittedKwargs({})
-    def stderr_method(self, args, kwargs):
-        return self.res.stderr
-
-class RunProcess(InterpreterObject):
-
-    def __init__(self, cmd, args, env, source_dir, build_dir, subdir, mesonintrospect, in_builddir=False, check=False, capture=True):
-        super().__init__()
-        if not isinstance(cmd, ExternalProgram):
-            raise AssertionError('BUG: RunProcess must be passed an ExternalProgram')
-        self.capture = capture
-        pc, self.stdout, self.stderr = self.run_command(cmd, args, env, source_dir, build_dir, subdir, mesonintrospect, in_builddir, check)
-        self.returncode = pc.returncode
-        self.methods.update({'returncode': self.returncode_method,
-                             'stdout': self.stdout_method,
-                             'stderr': self.stderr_method,
-                             })
-
-    def run_command(self, cmd, args, env, source_dir, build_dir, subdir, mesonintrospect, in_builddir, check=False):
-        command_array = cmd.get_command() + args
-        menv = {'MESON_SOURCE_ROOT': source_dir,
-                'MESON_BUILD_ROOT': build_dir,
-                'MESON_SUBDIR': subdir,
-                'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in mesonintrospect]),
-                }
-        if in_builddir:
-            cwd = os.path.join(build_dir, subdir)
-        else:
-            cwd = os.path.join(source_dir, subdir)
-        child_env = os.environ.copy()
-        child_env.update(menv)
-        child_env = env.get_env(child_env)
-        stdout = subprocess.PIPE if self.capture else subprocess.DEVNULL
-        mlog.debug('Running command:', ' '.join(command_array))
-        try:
-            p, o, e = Popen_safe(command_array, stdout=stdout, env=child_env, cwd=cwd)
-            if self.capture:
-                mlog.debug('--- stdout ---')
-                mlog.debug(o)
-            else:
-                o = ''
-                mlog.debug('--- stdout disabled ---')
-            mlog.debug('--- stderr ---')
-            mlog.debug(e)
-            mlog.debug('')
-
-            if check and p.returncode != 0:
-                raise InterpreterException('Command "{}" failed with status {}.'.format(' '.join(command_array), p.returncode))
-
-            return p, o, e
-        except FileNotFoundError:
-            raise InterpreterException('Could not execute command "%s".' % ' '.join(command_array))
-
-    @noPosargs
-    @permittedKwargs({})
-    def returncode_method(self, args, kwargs):
-        return self.returncode
-
-    @noPosargs
-    @permittedKwargs({})
-    def stdout_method(self, args, kwargs):
-        return self.stdout
-
-    @noPosargs
-    @permittedKwargs({})
-    def stderr_method(self, args, kwargs):
-        return self.stderr
-
-class ConfigureFileHolder(InterpreterObject, ObjectHolder):
-
-    def __init__(self, subdir, sourcename, targetname, configuration_data):
-        InterpreterObject.__init__(self)
-        obj = build.ConfigureFile(subdir, sourcename, targetname, configuration_data)
-        ObjectHolder.__init__(self, obj)
-
-
-class EnvironmentVariablesHolder(MutableInterpreterObject, ObjectHolder):
-    def __init__(self, initial_values=None):
-        MutableInterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, build.EnvironmentVariables())
-        self.methods.update({'set': self.set_method,
-                             'append': self.append_method,
-                             'prepend': self.prepend_method,
-                             })
-        if isinstance(initial_values, dict):
-            for k, v in initial_values.items():
-                self.set_method([k, v], {})
-        elif isinstance(initial_values, list):
-            for e in initial_values:
-                if '=' not in e:
-                    raise InterpreterException('Env var definition must be of type key=val.')
-                (k, val) = e.split('=', 1)
-                k = k.strip()
-                val = val.strip()
-                if ' ' in k:
-                    raise InterpreterException('Env var key must not have spaces in it.')
-                self.set_method([k, val], {})
-        elif initial_values:
-            raise AssertionError('Unsupported EnvironmentVariablesHolder initial_values')
-
-    def __repr__(self):
-        repr_str = "<{0}: {1}>"
-        return repr_str.format(self.__class__.__name__, self.held_object.envvars)
-
-    def add_var(self, method, args, kwargs):
-        if not isinstance(kwargs.get("separator", ""), str):
-            raise InterpreterException("EnvironmentVariablesHolder methods 'separator'"
-                                       " argument needs to be a string.")
-        if len(args) < 2:
-            raise InterpreterException("EnvironmentVariablesHolder methods require at least"
-                                       "2 arguments, first is the name of the variable and"
-                                       " following one are values")
-        # Warn when someone tries to use append() or prepend() on an env var
-        # which already has an operation set on it. People seem to think that
-        # multiple append/prepend operations stack, but they don't.
-        if method != self.held_object.set and self.held_object.has_name(args[0]):
-            mlog.warning('Overriding previous value of environment variable {!r} with a new one'
-                         .format(args[0]), location=self.current_node)
-        self.held_object.add_var(method, args[0], args[1:], kwargs)
-
-    @stringArgs
-    @permittedKwargs({'separator'})
-    def set_method(self, args, kwargs):
-        self.add_var(self.held_object.set, args, kwargs)
-
-    @stringArgs
-    @permittedKwargs({'separator'})
-    def append_method(self, args, kwargs):
-        self.add_var(self.held_object.append, args, kwargs)
-
-    @stringArgs
-    @permittedKwargs({'separator'})
-    def prepend_method(self, args, kwargs):
-        self.add_var(self.held_object.prepend, args, kwargs)
-
-
-class ConfigurationDataHolder(MutableInterpreterObject, ObjectHolder):
-    def __init__(self, pv, initial_values=None):
-        MutableInterpreterObject.__init__(self)
-        self.used = False # These objects become immutable after use in configure_file.
-        ObjectHolder.__init__(self, build.ConfigurationData(), pv)
-        self.methods.update({'set': self.set_method,
-                             'set10': self.set10_method,
-                             'set_quoted': self.set_quoted_method,
-                             'has': self.has_method,
-                             'get': self.get_method,
-                             'get_unquoted': self.get_unquoted_method,
-                             'merge_from': self.merge_from_method,
-                             })
-        if isinstance(initial_values, dict):
-            for k, v in initial_values.items():
-                self.set_method([k, v], {})
-        elif initial_values:
-            raise AssertionError('Unsupported ConfigurationDataHolder initial_values')
-
-    def is_used(self):
-        return self.used
-
-    def mark_used(self):
-        self.used = True
-
-    def validate_args(self, args, kwargs):
-        if len(args) == 1 and isinstance(args[0], list) and len(args[0]) == 2:
-            mlog.deprecation('Passing a list as the single argument to '
-                             'configuration_data.set is deprecated. This will '
-                             'become a hard error in the future.',
-                             location=self.current_node)
-            args = args[0]
-
-        if len(args) != 2:
-            raise InterpreterException("Configuration set requires 2 arguments.")
-        if self.used:
-            raise InterpreterException("Can not set values on configuration object that has been used.")
-        name, val = args
-        if not isinstance(val, (int, str)):
-            msg = 'Setting a configuration data value to {!r} is invalid, ' \
-                  'and will fail at configure_file(). If you are using it ' \
-                  'just to store some values, please use a dict instead.'
-            mlog.deprecation(msg.format(val), location=self.current_node)
-        desc = kwargs.get('description', None)
-        if not isinstance(name, str):
-            raise InterpreterException("First argument to set must be a string.")
-        if desc is not None and not isinstance(desc, str):
-            raise InterpreterException('Description must be a string.')
-
-        return name, val, desc
-
-    @noArgsFlattening
-    def set_method(self, args, kwargs):
-        (name, val, desc) = self.validate_args(args, kwargs)
-        self.held_object.values[name] = (val, desc)
-
-    def set_quoted_method(self, args, kwargs):
-        (name, val, desc) = self.validate_args(args, kwargs)
-        if not isinstance(val, str):
-            raise InterpreterException("Second argument to set_quoted must be a string.")
-        escaped_val = '\\"'.join(val.split('"'))
-        self.held_object.values[name] = ('"' + escaped_val + '"', desc)
-
-    def set10_method(self, args, kwargs):
-        (name, val, desc) = self.validate_args(args, kwargs)
-        if val:
-            self.held_object.values[name] = (1, desc)
-        else:
-            self.held_object.values[name] = (0, desc)
-
-    def has_method(self, args, kwargs):
-        return args[0] in self.held_object.values
-
-    @FeatureNew('configuration_data.get()', '0.38.0')
-    @noArgsFlattening
-    def get_method(self, args, kwargs):
-        if len(args) < 1 or len(args) > 2:
-            raise InterpreterException('Get method takes one or two arguments.')
-        name = args[0]
-        if name in self.held_object:
-            return self.held_object.get(name)[0]
-        if len(args) > 1:
-            return args[1]
-        raise InterpreterException('Entry %s not in configuration data.' % name)
-
-    @FeatureNew('configuration_data.get_unquoted()', '0.44.0')
-    def get_unquoted_method(self, args, kwargs):
-        if len(args) < 1 or len(args) > 2:
-            raise InterpreterException('Get method takes one or two arguments.')
-        name = args[0]
-        if name in self.held_object:
-            val = self.held_object.get(name)[0]
-        elif len(args) > 1:
-            val = args[1]
-        else:
-            raise InterpreterException('Entry %s not in configuration data.' % name)
-        if val[0] == '"' and val[-1] == '"':
-            return val[1:-1]
-        return val
-
-    def get(self, name):
-        return self.held_object.values[name] # (val, desc)
-
-    def keys(self):
-        return self.held_object.values.keys()
-
-    def merge_from_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Merge_from takes one positional argument.')
-        from_object = args[0]
-        if not isinstance(from_object, ConfigurationDataHolder):
-            raise InterpreterException('Merge_from argument must be a configuration data object.')
-        from_object = from_object.held_object
-        for k, v in from_object.values.items():
-            self.held_object.values[k] = v
-
-# Interpreter objects can not be pickled so we must have
-# these wrappers.
-
-class DependencyHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, dep, pv):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, dep, pv)
-        self.methods.update({'found': self.found_method,
-                             'type_name': self.type_name_method,
-                             'version': self.version_method,
-                             'name': self.name_method,
-                             'get_pkgconfig_variable': self.pkgconfig_method,
-                             'get_configtool_variable': self.configtool_method,
-                             'get_variable': self.variable_method,
-                             'partial_dependency': self.partial_dependency_method,
-                             'include_type': self.include_type_method,
-                             'as_system': self.as_system_method,
-                             })
-
-    def found(self):
-        return self.found_method([], {})
-
-    @noPosargs
-    @permittedKwargs({})
-    def type_name_method(self, args, kwargs):
-        return self.held_object.type_name
-
-    @noPosargs
-    @permittedKwargs({})
-    def found_method(self, args, kwargs):
-        if self.held_object.type_name == 'internal':
-            return True
-        return self.held_object.found()
-
-    @noPosargs
-    @permittedKwargs({})
-    def version_method(self, args, kwargs):
-        return self.held_object.get_version()
-
-    @noPosargs
-    @permittedKwargs({})
-    def name_method(self, args, kwargs):
-        return self.held_object.get_name()
-
-    @permittedKwargs({'define_variable', 'default'})
-    def pkgconfig_method(self, args, kwargs):
-        args = listify(args)
-        if len(args) != 1:
-            raise InterpreterException('get_pkgconfig_variable takes exactly one argument.')
-        varname = args[0]
-        if not isinstance(varname, str):
-            raise InterpreterException('Variable name must be a string.')
-        return self.held_object.get_pkgconfig_variable(varname, kwargs)
-
-    @FeatureNew('dep.get_configtool_variable', '0.44.0')
-    @permittedKwargs({})
-    def configtool_method(self, args, kwargs):
-        args = listify(args)
-        if len(args) != 1:
-            raise InterpreterException('get_configtool_variable takes exactly one argument.')
-        varname = args[0]
-        if not isinstance(varname, str):
-            raise InterpreterException('Variable name must be a string.')
-        return self.held_object.get_configtool_variable(varname)
-
-    @FeatureNew('dep.partial_dependency', '0.46.0')
-    @noPosargs
-    @permittedKwargs(permitted_method_kwargs['partial_dependency'])
-    def partial_dependency_method(self, args, kwargs):
-        pdep = self.held_object.get_partial_dependency(**kwargs)
-        return DependencyHolder(pdep, self.subproject)
-
-    @FeatureNew('dep.get_variable', '0.51.0')
-    @noPosargs
-    @permittedKwargs({'cmake', 'pkgconfig', 'configtool', 'internal', 'default_value', 'pkgconfig_define'})
-    @FeatureNewKwargs('dep.get_variable', '0.54.0', ['internal'])
-    def variable_method(self, args, kwargs):
-        return self.held_object.get_variable(**kwargs)
-
-    @FeatureNew('dep.include_type', '0.52.0')
-    @noPosargs
-    @permittedKwargs({})
-    def include_type_method(self, args, kwargs):
-        return self.held_object.get_include_type()
-
-    @FeatureNew('dep.as_system', '0.52.0')
-    @permittedKwargs({})
-    def as_system_method(self, args, kwargs):
-        args = listify(args)
-        new_is_system = 'system'
-        if len(args) > 1:
-            raise InterpreterException('as_system takes only one optional value')
-        if len(args) == 1:
-            new_is_system = args[0]
-        new_dep = self.held_object.generate_system_dependency(new_is_system)
-        return DependencyHolder(new_dep, self.subproject)
-
-class ExternalProgramHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, ep, subproject, backend=None):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, ep)
-        self.subproject = subproject
-        self.backend = backend
-        self.methods.update({'found': self.found_method,
-                             'path': self.path_method,
-                             'full_path': self.full_path_method})
-        self.cached_version = None
-
-    @noPosargs
-    @permittedKwargs({})
-    def found_method(self, args, kwargs):
-        return self.found()
-
-    @noPosargs
-    @permittedKwargs({})
-    @FeatureDeprecated('ExternalProgram.path', '0.55.0',
-                       'use ExternalProgram.full_path() instead')
-    def path_method(self, args, kwargs):
-        return self._full_path()
-
-    @noPosargs
-    @permittedKwargs({})
-    @FeatureNew('ExternalProgram.full_path', '0.55.0')
-    def full_path_method(self, args, kwargs):
-        return self._full_path()
-
-    def _full_path(self):
-        exe = self.held_object
-        if isinstance(exe, build.Executable):
-            return self.backend.get_target_filename_abs(exe)
-        return exe.get_path()
-
-    def found(self):
-        return isinstance(self.held_object, build.Executable) or self.held_object.found()
-
-    def get_command(self):
-        return self.held_object.get_command()
-
-    def get_name(self):
-        exe = self.held_object
-        if isinstance(exe, build.Executable):
-            return exe.name
-        return exe.get_name()
-
-    def get_version(self, interpreter):
-        if isinstance(self.held_object, build.Executable):
-            return self.held_object.project_version
-        if not self.cached_version:
-            raw_cmd = self.get_command() + ['--version']
-            cmd = [self, '--version']
-            res = interpreter.run_command_impl(interpreter.current_node, cmd, {}, True)
-            if res.returncode != 0:
-                m = 'Running {!r} failed'
-                raise InterpreterException(m.format(raw_cmd))
-            output = res.stdout.strip()
-            if not output:
-                output = res.stderr.strip()
-            match = re.search(r'([0-9][0-9\.]+)', output)
-            if not match:
-                m = 'Could not find a version number in output of {!r}'
-                raise InterpreterException(m.format(raw_cmd))
-            self.cached_version = match.group(1)
-        return self.cached_version
-
-class ExternalLibraryHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, el, pv):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, el, pv)
-        self.methods.update({'found': self.found_method,
-                             'type_name': self.type_name_method,
-                             'partial_dependency': self.partial_dependency_method,
-                             })
-
-    def found(self):
-        return self.held_object.found()
-
-    @noPosargs
-    @permittedKwargs({})
-    def type_name_method(self, args, kwargs):
-        return self.held_object.type_name
-
-    @noPosargs
-    @permittedKwargs({})
-    def found_method(self, args, kwargs):
-        return self.found()
-
-    def get_name(self):
-        return self.held_object.name
-
-    def get_compile_args(self):
-        return self.held_object.get_compile_args()
-
-    def get_link_args(self):
-        return self.held_object.get_link_args()
-
-    def get_exe_args(self):
-        return self.held_object.get_exe_args()
-
-    @FeatureNew('dep.partial_dependency', '0.46.0')
-    @noPosargs
-    @permittedKwargs(permitted_method_kwargs['partial_dependency'])
-    def partial_dependency_method(self, args, kwargs):
-        pdep = self.held_object.get_partial_dependency(**kwargs)
-        return DependencyHolder(pdep, self.subproject)
-
-class GeneratorHolder(InterpreterObject, ObjectHolder):
-    @FeatureNewKwargs('generator', '0.43.0', ['capture'])
-    def __init__(self, interp, args, kwargs):
-        self.interpreter = interp
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, build.Generator(args, kwargs), interp.subproject)
-        self.methods.update({'process': self.process_method})
-
-    @FeatureNewKwargs('generator.process', '0.45.0', ['preserve_path_from'])
-    @permittedKwargs({'extra_args', 'preserve_path_from'})
-    def process_method(self, args, kwargs):
-        extras = mesonlib.stringlistify(kwargs.get('extra_args', []))
-        if 'preserve_path_from' in kwargs:
-            preserve_path_from = kwargs['preserve_path_from']
-            if not isinstance(preserve_path_from, str):
-                raise InvalidArguments('Preserve_path_from must be a string.')
-            preserve_path_from = os.path.normpath(preserve_path_from)
-            if not os.path.isabs(preserve_path_from):
-                # This is a bit of a hack. Fix properly before merging.
-                raise InvalidArguments('Preserve_path_from must be an absolute path for now. Sorry.')
-        else:
-            preserve_path_from = None
-        gl = self.held_object.process_files('Generator', args, self.interpreter,
-                                            preserve_path_from, extra_args=extras)
-        return GeneratedListHolder(gl)
-
-
-class GeneratedListHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, arg1, extra_args=None):
-        InterpreterObject.__init__(self)
-        if isinstance(arg1, GeneratorHolder):
-            ObjectHolder.__init__(self, build.GeneratedList(arg1.held_object, extra_args if extra_args is not None else []))
-        else:
-            ObjectHolder.__init__(self, arg1)
-
-    def __repr__(self):
-        r = '<{}: {!r}>'
-        return r.format(self.__class__.__name__, self.held_object.get_outputs())
-
-    def add_file(self, a):
-        self.held_object.add_file(a)
-
-# A machine that's statically known from the cross file
-class MachineHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, machine_info):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, machine_info)
-        self.methods.update({'system': self.system_method,
-                             'cpu': self.cpu_method,
-                             'cpu_family': self.cpu_family_method,
-                             'endian': self.endian_method,
-                             })
-
-    @noPosargs
-    @permittedKwargs({})
-    def cpu_family_method(self, args, kwargs):
-        return self.held_object.cpu_family
-
-    @noPosargs
-    @permittedKwargs({})
-    def cpu_method(self, args, kwargs):
-        return self.held_object.cpu
-
-    @noPosargs
-    @permittedKwargs({})
-    def system_method(self, args, kwargs):
-        return self.held_object.system
-
-    @noPosargs
-    @permittedKwargs({})
-    def endian_method(self, args, kwargs):
-        return self.held_object.endian
-
-class IncludeDirsHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, idobj):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, idobj)
-
-class Headers(InterpreterObject):
-
-    def __init__(self, sources, kwargs):
-        InterpreterObject.__init__(self)
-        self.sources = sources
-        self.install_subdir = kwargs.get('subdir', '')
-        if os.path.isabs(self.install_subdir):
-            mlog.deprecation('Subdir keyword must not be an absolute path. This will be a hard error in the next release.')
-        self.custom_install_dir = kwargs.get('install_dir', None)
-        self.custom_install_mode = kwargs.get('install_mode', None)
-        if self.custom_install_dir is not None:
-            if not isinstance(self.custom_install_dir, str):
-                raise InterpreterException('Custom_install_dir must be a string.')
-
-    def set_install_subdir(self, subdir):
-        self.install_subdir = subdir
-
-    def get_install_subdir(self):
-        return self.install_subdir
-
-    def get_sources(self):
-        return self.sources
-
-    def get_custom_install_dir(self):
-        return self.custom_install_dir
-
-    def get_custom_install_mode(self):
-        return self.custom_install_mode
-
-class DataHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, data):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, data)
-
-    def get_source_subdir(self):
-        return self.held_object.source_subdir
-
-    def get_sources(self):
-        return self.held_object.sources
-
-    def get_install_dir(self):
-        return self.held_object.install_dir
-
-class InstallDir(InterpreterObject):
-    def __init__(self, src_subdir, inst_subdir, install_dir, install_mode, exclude, strip_directory):
-        InterpreterObject.__init__(self)
-        self.source_subdir = src_subdir
-        self.installable_subdir = inst_subdir
-        self.install_dir = install_dir
-        self.install_mode = install_mode
-        self.exclude = exclude
-        self.strip_directory = strip_directory
-
-class Man(InterpreterObject):
-
-    def __init__(self, sources, kwargs):
-        InterpreterObject.__init__(self)
-        self.sources = sources
-        self.validate_sources()
-        self.custom_install_dir = kwargs.get('install_dir', None)
-        self.custom_install_mode = kwargs.get('install_mode', None)
-        if self.custom_install_dir is not None and not isinstance(self.custom_install_dir, str):
-            raise InterpreterException('Custom_install_dir must be a string.')
-
-    def validate_sources(self):
-        for s in self.sources:
-            try:
-                num = int(s.split('.')[-1])
-            except (IndexError, ValueError):
-                num = 0
-            if num < 1 or num > 8:
-                raise InvalidArguments('Man file must have a file extension of a number between 1 and 8')
-
-    def get_custom_install_dir(self):
-        return self.custom_install_dir
-
-    def get_custom_install_mode(self):
-        return self.custom_install_mode
-
-    def get_sources(self):
-        return self.sources
-
-class GeneratedObjectsHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, held_object):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, held_object)
-
-class TargetHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, target, interp):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, target, interp.subproject)
-        self.interpreter = interp
-
-class BuildTargetHolder(TargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-        self.methods.update({'extract_objects': self.extract_objects_method,
-                             'extract_all_objects': self.extract_all_objects_method,
-                             'name': self.name_method,
-                             'get_id': self.get_id_method,
-                             'outdir': self.outdir_method,
-                             'full_path': self.full_path_method,
-                             'private_dir_include': self.private_dir_include_method,
-                             })
-
-    def __repr__(self):
-        r = '<{} {}: {}>'
-        h = self.held_object
-        return r.format(self.__class__.__name__, h.get_id(), h.filename)
-
-    def is_cross(self):
-        return not self.held_object.environment.machines.matches_build_machine(self.held_object.for_machine)
-
-    @noPosargs
-    @permittedKwargs({})
-    def private_dir_include_method(self, args, kwargs):
-        return IncludeDirsHolder(build.IncludeDirs('', [], False,
-                                                   [self.interpreter.backend.get_target_private_dir(self.held_object)]))
-
-    @noPosargs
-    @permittedKwargs({})
-    def full_path_method(self, args, kwargs):
-        return self.interpreter.backend.get_target_filename_abs(self.held_object)
-
-    @noPosargs
-    @permittedKwargs({})
-    def outdir_method(self, args, kwargs):
-        return self.interpreter.backend.get_target_dir(self.held_object)
-
-    @permittedKwargs({})
-    def extract_objects_method(self, args, kwargs):
-        gobjs = self.held_object.extract_objects(args)
-        return GeneratedObjectsHolder(gobjs)
-
-    @FeatureNewKwargs('extract_all_objects', '0.46.0', ['recursive'])
-    @noPosargs
-    @permittedKwargs({'recursive'})
-    def extract_all_objects_method(self, args, kwargs):
-        recursive = kwargs.get('recursive', False)
-        gobjs = self.held_object.extract_all_objects(recursive)
-        if gobjs.objlist and 'recursive' not in kwargs:
-            mlog.warning('extract_all_objects called without setting recursive '
-                         'keyword argument. Meson currently defaults to '
-                         'non-recursive to maintain backward compatibility but '
-                         'the default will be changed in the future.',
-                         location=self.current_node)
-        return GeneratedObjectsHolder(gobjs)
-
-    @noPosargs
-    @permittedKwargs({})
-    def get_id_method(self, args, kwargs):
-        return self.held_object.get_id()
-
-    @FeatureNew('name', '0.54.0')
-    @noPosargs
-    @permittedKwargs({})
-    def name_method(self, args, kwargs):
-        return self.held_object.name
-
-class ExecutableHolder(BuildTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-
-class StaticLibraryHolder(BuildTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-
-class SharedLibraryHolder(BuildTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-        # Set to True only when called from self.func_shared_lib().
-        target.shared_library_only = False
-
-class BothLibrariesHolder(BuildTargetHolder):
-    def __init__(self, shared_holder, static_holder, interp):
-        # FIXME: This build target always represents the shared library, but
-        # that should be configurable.
-        super().__init__(shared_holder.held_object, interp)
-        self.shared_holder = shared_holder
-        self.static_holder = static_holder
-        self.methods.update({'get_shared_lib': self.get_shared_lib_method,
-                             'get_static_lib': self.get_static_lib_method,
-                             })
-
-    def __repr__(self):
-        r = '<{} {}: {}, {}: {}>'
-        h1 = self.shared_holder.held_object
-        h2 = self.static_holder.held_object
-        return r.format(self.__class__.__name__, h1.get_id(), h1.filename, h2.get_id(), h2.filename)
-
-    @noPosargs
-    @permittedKwargs({})
-    def get_shared_lib_method(self, args, kwargs):
-        return self.shared_holder
-
-    @noPosargs
-    @permittedKwargs({})
-    def get_static_lib_method(self, args, kwargs):
-        return self.static_holder
-
-class SharedModuleHolder(BuildTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-
-class JarHolder(BuildTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-
-class CustomTargetIndexHolder(TargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-        self.methods.update({'full_path': self.full_path_method,
-                             })
-
-    @FeatureNew('custom_target[i].full_path', '0.54.0')
-    @noPosargs
-    @permittedKwargs({})
-    def full_path_method(self, args, kwargs):
-        return self.interpreter.backend.get_target_filename_abs(self.held_object)
-
-class CustomTargetHolder(TargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-        self.methods.update({'full_path': self.full_path_method,
-                             'to_list': self.to_list_method,
-                             })
-
-    def __repr__(self):
-        r = '<{} {}: {}>'
-        h = self.held_object
-        return r.format(self.__class__.__name__, h.get_id(), h.command)
-
-    @noPosargs
-    @permittedKwargs({})
-    def full_path_method(self, args, kwargs):
-        return self.interpreter.backend.get_target_filename_abs(self.held_object)
-
-    @FeatureNew('custom_target.to_list', '0.54.0')
-    @noPosargs
-    @permittedKwargs({})
-    def to_list_method(self, args, kwargs):
-        result = []
-        for i in self.held_object:
-            result.append(CustomTargetIndexHolder(i, self.interpreter))
-        return result
-
-    def __getitem__(self, index):
-        return CustomTargetIndexHolder(self.held_object[index], self.interpreter)
-
-    def __setitem__(self, index, value):  # lgtm[py/unexpected-raise-in-special-method]
-        raise InterpreterException('Cannot set a member of a CustomTarget')
-
-    def __delitem__(self, index):  # lgtm[py/unexpected-raise-in-special-method]
-        raise InterpreterException('Cannot delete a member of a CustomTarget')
-
-    def outdir_include(self):
-        return IncludeDirsHolder(build.IncludeDirs('', [], False,
-                                                   [os.path.join('@BUILD_ROOT@', self.interpreter.backend.get_target_dir(self.held_object))]))
-
-class RunTargetHolder(TargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-
-    def __repr__(self):
-        r = '<{} {}: {}>'
-        h = self.held_object
-        return r.format(self.__class__.__name__, h.get_id(), h.command)
-
-class Test(InterpreterObject):
-    def __init__(self, name: str, project: str, suite: T.List[str], exe: build.Executable,
-                 depends: T.List[T.Union[build.CustomTarget, build.BuildTarget]],
-                 is_parallel: bool, cmd_args: T.List[str], env: build.EnvironmentVariables,
-                 should_fail: bool, timeout: int, workdir: T.Optional[str], protocol: str,
-                 priority: int):
-        InterpreterObject.__init__(self)
-        self.name = name
-        self.suite = suite
-        self.project_name = project
-        self.exe = exe
-        self.depends = depends
-        self.is_parallel = is_parallel
-        self.cmd_args = cmd_args
-        self.env = env
-        self.should_fail = should_fail
-        self.timeout = timeout
-        self.workdir = workdir
-        self.protocol = TestProtocol.from_str(protocol)
-        self.priority = priority
-
-    def get_exe(self):
-        return self.exe
-
-    def get_name(self):
-        return self.name
-
-class SubprojectHolder(InterpreterObject, ObjectHolder):
-
-    def __init__(self, subinterpreter, subproject_dir, name, warnings=0, disabled_feature=None,
-                 exception=None):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, subinterpreter)
-        self.name = name
-        self.warnings = warnings
-        self.disabled_feature = disabled_feature
-        self.exception = exception
-        self.subproject_dir = subproject_dir
-        self.methods.update({'get_variable': self.get_variable_method,
-                             'found': self.found_method,
-                             })
-
-    @noPosargs
-    @permittedKwargs({})
-    def found_method(self, args, kwargs):
-        return self.found()
-
-    def found(self):
-        return self.held_object is not None
-
-    @permittedKwargs({})
-    @noArgsFlattening
-    def get_variable_method(self, args, kwargs):
-        if len(args) < 1 or len(args) > 2:
-            raise InterpreterException('Get_variable takes one or two arguments.')
-        if not self.found():
-            raise InterpreterException('Subproject "%s/%s" disabled can\'t get_variable on it.' % (
-                self.subproject_dir, self.name))
-        varname = args[0]
-        if not isinstance(varname, str):
-            raise InterpreterException('Get_variable first argument must be a string.')
-        try:
-            return self.held_object.variables[varname]
-        except KeyError:
-            pass
-
-        if len(args) == 2:
-            return args[1]
-
-        raise InvalidArguments('Requested variable "{0}" not found.'.format(varname))
-
-header_permitted_kwargs = set([
-    'required',
-    'prefix',
-    'no_builtin_args',
-    'include_directories',
-    'args',
-    'dependencies',
-])
-
-find_library_permitted_kwargs = set([
-    'has_headers',
-    'required',
-    'dirs',
-    'static',
-])
-
-find_library_permitted_kwargs |= set(['header_' + k for k in header_permitted_kwargs])
-
-class CompilerHolder(InterpreterObject):
-    def __init__(self, compiler, env, subproject):
-        InterpreterObject.__init__(self)
-        self.compiler = compiler
-        self.environment = env
-        self.subproject = subproject
-        self.methods.update({'compiles': self.compiles_method,
-                             'links': self.links_method,
-                             'get_id': self.get_id_method,
-                             'get_linker_id': self.get_linker_id_method,
-                             'compute_int': self.compute_int_method,
-                             'sizeof': self.sizeof_method,
-                             'get_define': self.get_define_method,
-                             'check_header': self.check_header_method,
-                             'has_header': self.has_header_method,
-                             'has_header_symbol': self.has_header_symbol_method,
-                             'run': self.run_method,
-                             'has_function': self.has_function_method,
-                             'has_member': self.has_member_method,
-                             'has_members': self.has_members_method,
-                             'has_type': self.has_type_method,
-                             'alignment': self.alignment_method,
-                             'version': self.version_method,
-                             'cmd_array': self.cmd_array_method,
-                             'find_library': self.find_library_method,
-                             'has_argument': self.has_argument_method,
-                             'has_function_attribute': self.has_func_attribute_method,
-                             'get_supported_function_attributes': self.get_supported_function_attributes_method,
-                             'has_multi_arguments': self.has_multi_arguments_method,
-                             'get_supported_arguments': self.get_supported_arguments_method,
-                             'first_supported_argument': self.first_supported_argument_method,
-                             'has_link_argument': self.has_link_argument_method,
-                             'has_multi_link_arguments': self.has_multi_link_arguments_method,
-                             'get_supported_link_arguments': self.get_supported_link_arguments_method,
-                             'first_supported_link_argument': self.first_supported_link_argument_method,
-                             'unittest_args': self.unittest_args_method,
-                             'symbols_have_underscore_prefix': self.symbols_have_underscore_prefix_method,
-                             'get_argument_syntax': self.get_argument_syntax_method,
-                             })
-
-    def _dep_msg(self, deps, endl):
-        msg_single = 'with dependency {}'
-        msg_many = 'with dependencies {}'
-        if not deps:
-            return endl
-        if endl is None:
-            endl = ''
-        tpl = msg_many if len(deps) > 1 else msg_single
-        names = []
-        for d in deps:
-            if isinstance(d, dependencies.ExternalLibrary):
-                name = '-l' + d.name
-            else:
-                name = d.name
-            names.append(name)
-        return tpl.format(', '.join(names)) + endl
-
-    @noPosargs
-    @permittedKwargs({})
-    def version_method(self, args, kwargs):
-        return self.compiler.version
-
-    @noPosargs
-    @permittedKwargs({})
-    def cmd_array_method(self, args, kwargs):
-        return self.compiler.exelist
-
-    def determine_args(self, kwargs, mode='link'):
-        nobuiltins = kwargs.get('no_builtin_args', False)
-        if not isinstance(nobuiltins, bool):
-            raise InterpreterException('Type of no_builtin_args not a boolean.')
-        args = []
-        incdirs = extract_as_list(kwargs, 'include_directories')
-        for i in incdirs:
-            if not isinstance(i, IncludeDirsHolder):
-                raise InterpreterException('Include directories argument must be an include_directories object.')
-            for idir in i.held_object.get_incdirs():
-                idir = os.path.join(self.environment.get_source_dir(),
-                                    i.held_object.get_curdir(), idir)
-                args += self.compiler.get_include_args(idir, False)
-        if not nobuiltins:
-            for_machine = Interpreter.machine_from_native_kwarg(kwargs)
-            opts = self.environment.coredata.compiler_options[for_machine][self.compiler.language]
-            args += self.compiler.get_option_compile_args(opts)
-            if mode == 'link':
-                args += self.compiler.get_option_link_args(opts)
-        args += mesonlib.stringlistify(kwargs.get('args', []))
-        return args
-
-    def determine_dependencies(self, kwargs, endl=':'):
-        deps = kwargs.get('dependencies', None)
-        if deps is not None:
-            deps = listify(deps)
-            final_deps = []
-            for d in deps:
-                try:
-                    d = d.held_object
-                except Exception:
-                    pass
-                if isinstance(d, InternalDependency) or not isinstance(d, Dependency):
-                    raise InterpreterException('Dependencies must be external dependencies')
-                final_deps.append(d)
-            deps = final_deps
-        return deps, self._dep_msg(deps, endl)
-
-    @permittedKwargs({
-        'prefix',
-        'args',
-        'dependencies',
-    })
-    def alignment_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Alignment method takes exactly one positional argument.')
-        check_stringlist(args)
-        typename = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of alignment must be a string.')
-        extra_args = mesonlib.stringlistify(kwargs.get('args', []))
-        deps, msg = self.determine_dependencies(kwargs)
-        result = self.compiler.alignment(typename, prefix, self.environment,
-                                         extra_args=extra_args,
-                                         dependencies=deps)
-        mlog.log('Checking for alignment of', mlog.bold(typename, True), msg, result)
-        return result
-
-    @permittedKwargs({
-        'name',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def run_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Run method takes exactly one positional argument.')
-        code = args[0]
-        if isinstance(code, mesonlib.File):
-            code = mesonlib.File.from_absolute_file(
-                code.rel_to_builddir(self.environment.source_dir))
-        elif not isinstance(code, str):
-            raise InvalidArguments('Argument must be string or file.')
-        testname = kwargs.get('name', '')
-        if not isinstance(testname, str):
-            raise InterpreterException('Testname argument must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs, endl=None)
-        result = self.compiler.run(code, self.environment, extra_args=extra_args,
-                                   dependencies=deps)
-        if len(testname) > 0:
-            if not result.compiled:
-                h = mlog.red('DID NOT COMPILE')
-            elif result.returncode == 0:
-                h = mlog.green('YES')
-            else:
-                h = mlog.red('NO (%d)' % result.returncode)
-            mlog.log('Checking if', mlog.bold(testname, True), msg, 'runs:', h)
-        return TryRunResultHolder(result)
-
-    @noPosargs
-    @permittedKwargs({})
-    def get_id_method(self, args, kwargs):
-        return self.compiler.get_id()
-
-    @noPosargs
-    @permittedKwargs({})
-    @FeatureNew('compiler.get_linker_id', '0.53.0')
-    def get_linker_id_method(self, args, kwargs):
-        return self.compiler.get_linker_id()
-
-    @noPosargs
-    @permittedKwargs({})
-    def symbols_have_underscore_prefix_method(self, args, kwargs):
-        '''
-        Check if the compiler prefixes _ (underscore) to global C symbols
-        See: https://en.wikipedia.org/wiki/Name_mangling#C
-        '''
-        return self.compiler.symbols_have_underscore_prefix(self.environment)
-
-    @noPosargs
-    @permittedKwargs({})
-    def unittest_args_method(self, args, kwargs):
-        '''
-        This function is deprecated and should not be used.
-        It can be removed in a future version of Meson.
-        '''
-        if not hasattr(self.compiler, 'get_feature_args'):
-            raise InterpreterException('This {} compiler has no feature arguments.'.format(self.compiler.get_display_language()))
-        build_to_src = os.path.relpath(self.environment.get_source_dir(), self.environment.get_build_dir())
-        return self.compiler.get_feature_args({'unittest': 'true'}, build_to_src)
-
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def has_member_method(self, args, kwargs):
-        if len(args) != 2:
-            raise InterpreterException('Has_member takes exactly two arguments.')
-        check_stringlist(args)
-        typename, membername = args
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_member must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        had, cached = self.compiler.has_members(typename, [membername], prefix,
-                                                self.environment,
-                                                extra_args=extra_args,
-                                                dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if had:
-            hadtxt = mlog.green('YES')
-        else:
-            hadtxt = mlog.red('NO')
-        mlog.log('Checking whether type', mlog.bold(typename, True),
-                 'has member', mlog.bold(membername, True), msg, hadtxt, cached)
-        return had
-
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def has_members_method(self, args, kwargs):
-        if len(args) < 2:
-            raise InterpreterException('Has_members needs at least two arguments.')
-        check_stringlist(args)
-        typename, *membernames = args
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_members must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        had, cached = self.compiler.has_members(typename, membernames, prefix,
-                                                self.environment,
-                                                extra_args=extra_args,
-                                                dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if had:
-            hadtxt = mlog.green('YES')
-        else:
-            hadtxt = mlog.red('NO')
-        members = mlog.bold(', '.join(['"{}"'.format(m) for m in membernames]))
-        mlog.log('Checking whether type', mlog.bold(typename, True),
-                 'has members', members, msg, hadtxt, cached)
-        return had
-
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def has_function_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Has_function takes exactly one argument.')
-        check_stringlist(args)
-        funcname = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_function must be a string.')
-        extra_args = self.determine_args(kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        had, cached = self.compiler.has_function(funcname, prefix, self.environment,
-                                                 extra_args=extra_args,
-                                                 dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if had:
-            hadtxt = mlog.green('YES')
-        else:
-            hadtxt = mlog.red('NO')
-        mlog.log('Checking for function', mlog.bold(funcname, True), msg, hadtxt, cached)
-        return had
-
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def has_type_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Has_type takes exactly one argument.')
-        check_stringlist(args)
-        typename = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_type must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        had, cached = self.compiler.has_type(typename, prefix, self.environment,
-                                             extra_args=extra_args, dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if had:
-            hadtxt = mlog.green('YES')
-        else:
-            hadtxt = mlog.red('NO')
-        mlog.log('Checking for type', mlog.bold(typename, True), msg, hadtxt, cached)
-        return had
-
-    @FeatureNew('compiler.compute_int', '0.40.0')
-    @permittedKwargs({
-        'prefix',
-        'low',
-        'high',
-        'guess',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def compute_int_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Compute_int takes exactly one argument.')
-        check_stringlist(args)
-        expression = args[0]
-        prefix = kwargs.get('prefix', '')
-        low = kwargs.get('low', None)
-        high = kwargs.get('high', None)
-        guess = kwargs.get('guess', None)
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of compute_int must be a string.')
-        if low is not None and not isinstance(low, int):
-            raise InterpreterException('Low argument of compute_int must be an int.')
-        if high is not None and not isinstance(high, int):
-            raise InterpreterException('High argument of compute_int must be an int.')
-        if guess is not None and not isinstance(guess, int):
-            raise InterpreterException('Guess argument of compute_int must be an int.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        res = self.compiler.compute_int(expression, low, high, guess, prefix,
-                                        self.environment, extra_args=extra_args,
-                                        dependencies=deps)
-        mlog.log('Computing int of', mlog.bold(expression, True), msg, res)
-        return res
-
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def sizeof_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Sizeof takes exactly one argument.')
-        check_stringlist(args)
-        element = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of sizeof must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        esize = self.compiler.sizeof(element, prefix, self.environment,
-                                     extra_args=extra_args, dependencies=deps)
-        mlog.log('Checking for size of', mlog.bold(element, True), msg, esize)
-        return esize
-
-    @FeatureNew('compiler.get_define', '0.40.0')
-    @permittedKwargs({
-        'prefix',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def get_define_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('get_define() takes exactly one argument.')
-        check_stringlist(args)
-        element = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of get_define() must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        value, cached = self.compiler.get_define(element, prefix, self.environment,
-                                                 extra_args=extra_args,
-                                                 dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        mlog.log('Fetching value of define', mlog.bold(element, True), msg, value, cached)
-        return value
-
-    @permittedKwargs({
-        'name',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def compiles_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('compiles method takes exactly one argument.')
-        code = args[0]
-        if isinstance(code, mesonlib.File):
-            code = mesonlib.File.from_absolute_file(
-                code.rel_to_builddir(self.environment.source_dir))
-        elif not isinstance(code, str):
-            raise InvalidArguments('Argument must be string or file.')
-        testname = kwargs.get('name', '')
-        if not isinstance(testname, str):
-            raise InterpreterException('Testname argument must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs, endl=None)
-        result, cached = self.compiler.compiles(code, self.environment,
-                                                extra_args=extra_args,
-                                                dependencies=deps)
-        if len(testname) > 0:
-            if result:
-                h = mlog.green('YES')
-            else:
-                h = mlog.red('NO')
-            cached = mlog.blue('(cached)') if cached else ''
-            mlog.log('Checking if', mlog.bold(testname, True), msg, 'compiles:', h, cached)
-        return result
-
-    @permittedKwargs({
-        'name',
-        'no_builtin_args',
-        'include_directories',
-        'args',
-        'dependencies',
-    })
-    def links_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('links method takes exactly one argument.')
-        code = args[0]
-        if isinstance(code, mesonlib.File):
-            code = mesonlib.File.from_absolute_file(
-                code.rel_to_builddir(self.environment.source_dir))
-        elif not isinstance(code, str):
-            raise InvalidArguments('Argument must be string or file.')
-        testname = kwargs.get('name', '')
-        if not isinstance(testname, str):
-            raise InterpreterException('Testname argument must be a string.')
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs, endl=None)
-        result, cached = self.compiler.links(code, self.environment,
-                                             extra_args=extra_args,
-                                             dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if len(testname) > 0:
-            if result:
-                h = mlog.green('YES')
-            else:
-                h = mlog.red('NO')
-            mlog.log('Checking if', mlog.bold(testname, True), msg, 'links:', h, cached)
-        return result
-
-    @FeatureNew('compiler.check_header', '0.47.0')
-    @FeatureNewKwargs('compiler.check_header', '0.50.0', ['required'])
-    @permittedKwargs(header_permitted_kwargs)
-    def check_header_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('check_header method takes exactly one argument.')
-        check_stringlist(args)
-        hname = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_header must be a string.')
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject, default=False)
-        if disabled:
-            mlog.log('Check usable header', mlog.bold(hname, True), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return False
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        haz, cached = self.compiler.check_header(hname, prefix, self.environment,
-                                                 extra_args=extra_args,
-                                                 dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if required and not haz:
-            raise InterpreterException('{} header {!r} not usable'.format(self.compiler.get_display_language(), hname))
-        elif haz:
-            h = mlog.green('YES')
-        else:
-            h = mlog.red('NO')
-        mlog.log('Check usable header', mlog.bold(hname, True), msg, h, cached)
-        return haz
-
-    @FeatureNewKwargs('compiler.has_header', '0.50.0', ['required'])
-    @permittedKwargs(header_permitted_kwargs)
-    def has_header_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('has_header method takes exactly one argument.')
-        check_stringlist(args)
-        hname = args[0]
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_header must be a string.')
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject, default=False)
-        if disabled:
-            mlog.log('Has header', mlog.bold(hname, True), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return False
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        haz, cached = self.compiler.has_header(hname, prefix, self.environment,
-                                               extra_args=extra_args, dependencies=deps)
-        cached = mlog.blue('(cached)') if cached else ''
-        if required and not haz:
-            raise InterpreterException('{} header {!r} not found'.format(self.compiler.get_display_language(), hname))
-        elif haz:
-            h = mlog.green('YES')
-        else:
-            h = mlog.red('NO')
-        mlog.log('Has header', mlog.bold(hname, True), msg, h, cached)
-        return haz
-
-    @FeatureNewKwargs('compiler.has_header_symbol', '0.50.0', ['required'])
-    @permittedKwargs(header_permitted_kwargs)
-    def has_header_symbol_method(self, args, kwargs):
-        if len(args) != 2:
-            raise InterpreterException('has_header_symbol method takes exactly two arguments.')
-        check_stringlist(args)
-        hname, symbol = args
-        prefix = kwargs.get('prefix', '')
-        if not isinstance(prefix, str):
-            raise InterpreterException('Prefix argument of has_header_symbol must be a string.')
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject, default=False)
-        if disabled:
-            mlog.log('Header <{0}> has symbol'.format(hname), mlog.bold(symbol, True), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return False
-        extra_args = functools.partial(self.determine_args, kwargs)
-        deps, msg = self.determine_dependencies(kwargs)
-        haz, cached = self.compiler.has_header_symbol(hname, symbol, prefix, self.environment,
-                                                      extra_args=extra_args,
-                                                      dependencies=deps)
-        if required and not haz:
-            raise InterpreterException('{} symbol {} not found in header {}'.format(self.compiler.get_display_language(), symbol, hname))
-        elif haz:
-            h = mlog.green('YES')
-        else:
-            h = mlog.red('NO')
-        cached = mlog.blue('(cached)') if cached else ''
-        mlog.log('Header <{0}> has symbol'.format(hname), mlog.bold(symbol, True), msg, h, cached)
-        return haz
-
-    def notfound_library(self, libname):
-        lib = dependencies.ExternalLibrary(libname, None,
-                                           self.environment,
-                                           self.compiler.language,
-                                           silent=True)
-        return ExternalLibraryHolder(lib, self.subproject)
-
-    @FeatureNewKwargs('compiler.find_library', '0.51.0', ['static'])
-    @FeatureNewKwargs('compiler.find_library', '0.50.0', ['has_headers'])
-    @FeatureNewKwargs('compiler.find_library', '0.49.0', ['disabler'])
-    @disablerIfNotFound
-    @permittedKwargs(find_library_permitted_kwargs)
-    def find_library_method(self, args, kwargs):
-        # TODO add dependencies support?
-        if len(args) != 1:
-            raise InterpreterException('find_library method takes one argument.')
-        libname = args[0]
-        if not isinstance(libname, str):
-            raise InterpreterException('Library name not a string.')
-
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject)
-        if disabled:
-            mlog.log('Library', mlog.bold(libname), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return self.notfound_library(libname)
-
-        has_header_kwargs = {k[7:]: v for k, v in kwargs.items() if k.startswith('header_')}
-        has_header_kwargs['required'] = required
-        headers = mesonlib.stringlistify(kwargs.get('has_headers', []))
-        for h in headers:
-            if not self.has_header_method([h], has_header_kwargs):
-                return self.notfound_library(libname)
-
-        search_dirs = extract_search_dirs(kwargs)
-
-        libtype = mesonlib.LibType.PREFER_SHARED
-        if 'static' in kwargs:
-            if not isinstance(kwargs['static'], bool):
-                raise InterpreterException('static must be a boolean')
-            libtype = mesonlib.LibType.STATIC if kwargs['static'] else mesonlib.LibType.SHARED
-        linkargs = self.compiler.find_library(libname, self.environment, search_dirs, libtype)
-        if required and not linkargs:
-            if libtype == mesonlib.LibType.PREFER_SHARED:
-                libtype = 'shared or static'
-            else:
-                libtype = libtype.name.lower()
-            raise InterpreterException('{} {} library {!r} not found'
-                                       .format(self.compiler.get_display_language(),
-                                               libtype, libname))
-        lib = dependencies.ExternalLibrary(libname, linkargs, self.environment,
-                                           self.compiler.language)
-        return ExternalLibraryHolder(lib, self.subproject)
-
-    @permittedKwargs({})
-    def has_argument_method(self, args: T.Sequence[str], kwargs) -> bool:
-        args = mesonlib.stringlistify(args)
-        if len(args) != 1:
-            raise InterpreterException('has_argument takes exactly one argument.')
-        return self.has_multi_arguments_method(args, kwargs)
-
-    @permittedKwargs({})
-    def has_multi_arguments_method(self, args: T.Sequence[str], kwargs: dict):
-        args = mesonlib.stringlistify(args)
-        result, cached = self.compiler.has_multi_arguments(args, self.environment)
-        if result:
-            h = mlog.green('YES')
-        else:
-            h = mlog.red('NO')
-        cached = mlog.blue('(cached)') if cached else ''
-        mlog.log(
-            'Compiler for {} supports arguments {}:'.format(
-                self.compiler.get_display_language(), ' '.join(args)),
-            h, cached)
-        return result
-
-    @FeatureNew('compiler.get_supported_arguments', '0.43.0')
-    @permittedKwargs({})
-    def get_supported_arguments_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        supported_args = []
-        for arg in args:
-            if self.has_argument_method(arg, kwargs):
-                supported_args.append(arg)
-        return supported_args
-
-    @permittedKwargs({})
-    def first_supported_argument_method(self, args: T.Sequence[str], kwargs: dict) -> T.List[str]:
-        for arg in mesonlib.stringlistify(args):
-            if self.has_argument_method(arg, kwargs):
-                mlog.log('First supported argument:', mlog.bold(arg))
-                return [arg]
-        mlog.log('First supported argument:', mlog.red('None'))
-        return []
-
-    @FeatureNew('compiler.has_link_argument', '0.46.0')
-    @permittedKwargs({})
-    def has_link_argument_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        if len(args) != 1:
-            raise InterpreterException('has_link_argument takes exactly one argument.')
-        return self.has_multi_link_arguments_method(args, kwargs)
-
-    @FeatureNew('compiler.has_multi_link_argument', '0.46.0')
-    @permittedKwargs({})
-    def has_multi_link_arguments_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        result, cached = self.compiler.has_multi_link_arguments(args, self.environment)
-        cached = mlog.blue('(cached)') if cached else ''
-        if result:
-            h = mlog.green('YES')
-        else:
-            h = mlog.red('NO')
-        mlog.log(
-            'Compiler for {} supports link arguments {}:'.format(
-                self.compiler.get_display_language(), ' '.join(args)),
-            h, cached)
-        return result
-
-    @FeatureNew('compiler.get_supported_link_arguments_method', '0.46.0')
-    @permittedKwargs({})
-    def get_supported_link_arguments_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        supported_args = []
-        for arg in args:
-            if self.has_link_argument_method(arg, kwargs):
-                supported_args.append(arg)
-        return supported_args
-
-    @FeatureNew('compiler.first_supported_link_argument_method', '0.46.0')
-    @permittedKwargs({})
-    def first_supported_link_argument_method(self, args, kwargs):
-        for i in mesonlib.stringlistify(args):
-            if self.has_link_argument_method(i, kwargs):
-                mlog.log('First supported link argument:', mlog.bold(i))
-                return [i]
-        mlog.log('First supported link argument:', mlog.red('None'))
-        return []
-
-    @FeatureNew('compiler.has_function_attribute', '0.48.0')
-    @permittedKwargs({})
-    def has_func_attribute_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        if len(args) != 1:
-            raise InterpreterException('has_func_attribute takes exactly one argument.')
-        result, cached = self.compiler.has_func_attribute(args[0], self.environment)
-        cached = mlog.blue('(cached)') if cached else ''
-        h = mlog.green('YES') if result else mlog.red('NO')
-        mlog.log('Compiler for {} supports function attribute {}:'.format(self.compiler.get_display_language(), args[0]), h, cached)
-        return result
-
-    @FeatureNew('compiler.get_supported_function_attributes', '0.48.0')
-    @permittedKwargs({})
-    def get_supported_function_attributes_method(self, args, kwargs):
-        args = mesonlib.stringlistify(args)
-        return [a for a in args if self.has_func_attribute_method(a, kwargs)]
-
-    @FeatureNew('compiler.get_argument_syntax_method', '0.49.0')
-    @noPosargs
-    @noKwargs
-    def get_argument_syntax_method(self, args, kwargs):
-        return self.compiler.get_argument_syntax()
-
-
-ModuleState = collections.namedtuple('ModuleState', [
-    'source_root', 'build_to_src', 'subproject', 'subdir', 'current_lineno', 'environment',
-    'project_name', 'project_version', 'backend', 'targets',
-    'data', 'headers', 'man', 'global_args', 'project_args', 'build_machine',
-    'host_machine', 'target_machine', 'current_node'])
-
-class ModuleHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, modname, module, interpreter):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, module)
-        self.modname = modname
-        self.interpreter = interpreter
-
-    def method_call(self, method_name, args, kwargs):
-        try:
-            fn = getattr(self.held_object, method_name)
-        except AttributeError:
-            raise InvalidArguments('Module %s does not have method %s.' % (self.modname, method_name))
-        if method_name.startswith('_'):
-            raise InvalidArguments('Function {!r} in module {!r} is private.'.format(method_name, self.modname))
-        if not getattr(fn, 'no-args-flattening', False):
-            args = flatten(args)
-        # This is not 100% reliable but we can't use hash()
-        # because the Build object contains dicts and lists.
-        num_targets = len(self.interpreter.build.targets)
-        state = ModuleState(
-            source_root = self.interpreter.environment.get_source_dir(),
-            build_to_src=mesonlib.relpath(self.interpreter.environment.get_source_dir(),
-                                          self.interpreter.environment.get_build_dir()),
-            subproject=self.interpreter.subproject,
-            subdir=self.interpreter.subdir,
-            current_lineno=self.interpreter.current_lineno,
-            environment=self.interpreter.environment,
-            project_name=self.interpreter.build.project_name,
-            project_version=self.interpreter.build.dep_manifest[self.interpreter.active_projectname],
-            # The backend object is under-used right now, but we will need it:
-            # https://github.com/mesonbuild/meson/issues/1419
-            backend=self.interpreter.backend,
-            targets=self.interpreter.build.targets,
-            data=self.interpreter.build.data,
-            headers=self.interpreter.build.get_headers(),
-            man=self.interpreter.build.get_man(),
-            #global_args_for_build = self.interpreter.build.global_args.build,
-            global_args = self.interpreter.build.global_args.host,
-            #project_args_for_build = self.interpreter.build.projects_args.build.get(self.interpreter.subproject, {}),
-            project_args = self.interpreter.build.projects_args.host.get(self.interpreter.subproject, {}),
-            build_machine=self.interpreter.builtin['build_machine'].held_object,
-            host_machine=self.interpreter.builtin['host_machine'].held_object,
-            target_machine=self.interpreter.builtin['target_machine'].held_object,
-            current_node=self.current_node
-        )
-        # Many modules do for example self.interpreter.find_program_impl(),
-        # so we have to ensure they use the current interpreter and not the one
-        # that first imported that module, otherwise it will use outdated
-        # overrides.
-        self.held_object.interpreter = self.interpreter
-        if self.held_object.is_snippet(method_name):
-            value = fn(self.interpreter, state, args, kwargs)
-            return self.interpreter.holderify(value)
-        else:
-            value = fn(state, args, kwargs)
-            if num_targets != len(self.interpreter.build.targets):
-                raise InterpreterException('Extension module altered internal state illegally.')
-            return self.interpreter.module_method_callback(value)
-
-
-class Summary:
-    def __init__(self, project_name, project_version):
-        self.project_name = project_name
-        self.project_version = project_version
-        self.sections = collections.defaultdict(dict)
-        self.max_key_len = 0
-
-    def add_section(self, section, values, kwargs):
-        bool_yn = kwargs.get('bool_yn', False)
-        if not isinstance(bool_yn, bool):
-            raise InterpreterException('bool_yn keyword argument must be boolean')
-        list_sep = kwargs.get('list_sep')
-        if list_sep is not None and not isinstance(list_sep, str):
-            raise InterpreterException('list_sep keyword argument must be string')
-        for k, v in values.items():
-            if k in self.sections[section]:
-                raise InterpreterException('Summary section {!r} already have key {!r}'.format(section, k))
-            formatted_values = []
-            for i in listify(v):
-                if not isinstance(i, (str, int)):
-                    m = 'Summary value in section {!r}, key {!r}, must be string, integer or boolean'
-                    raise InterpreterException(m.format(section, k))
-                if bool_yn and isinstance(i, bool):
-                    formatted_values.append(mlog.green('YES') if i else mlog.red('NO'))
-                else:
-                    formatted_values.append(i)
-            self.sections[section][k] = (formatted_values, list_sep)
-            self.max_key_len = max(self.max_key_len, len(k))
-
-    def dump(self):
-        mlog.log(self.project_name, mlog.normal_cyan(self.project_version))
-        for section, values in self.sections.items():
-            mlog.log('')  # newline
-            if section:
-                mlog.log(' ', mlog.bold(section))
-            for k, v in values.items():
-                v, list_sep = v
-                indent = self.max_key_len - len(k) + 3
-                end = ' ' if v else ''
-                mlog.log(' ' * indent, k + ':', end=end)
-                if list_sep is None:
-                    indent = self.max_key_len + 6
-                    list_sep = '\n' + ' ' * indent
-                mlog.log(*v, sep=list_sep)
-        mlog.log('')  # newline
-
-
-class MesonMain(InterpreterObject):
-    def __init__(self, build, interpreter):
-        InterpreterObject.__init__(self)
-        self.build = build
-        self.interpreter = interpreter
-        self._found_source_scripts = {}
-        self.methods.update({'get_compiler': self.get_compiler_method,
-                             'is_cross_build': self.is_cross_build_method,
-                             'has_exe_wrapper': self.has_exe_wrapper_method,
-                             'can_run_host_binaries': self.can_run_host_binaries_method,
-                             'is_unity': self.is_unity_method,
-                             'is_subproject': self.is_subproject_method,
-                             'current_source_dir': self.current_source_dir_method,
-                             'current_build_dir': self.current_build_dir_method,
-                             'source_root': self.source_root_method,
-                             'build_root': self.build_root_method,
-                             'add_install_script': self.add_install_script_method,
-                             'add_postconf_script': self.add_postconf_script_method,
-                             'add_dist_script': self.add_dist_script_method,
-                             'install_dependency_manifest': self.install_dependency_manifest_method,
-                             'override_dependency': self.override_dependency_method,
-                             'override_find_program': self.override_find_program_method,
-                             'project_version': self.project_version_method,
-                             'project_license': self.project_license_method,
-                             'version': self.version_method,
-                             'project_name': self.project_name_method,
-                             'get_cross_property': self.get_cross_property_method,
-                             'get_external_property': self.get_external_property_method,
-                             'backend': self.backend_method,
-                             })
-
-    def _find_source_script(self, prog: T.Union[str, ExecutableHolder], args):
-        if isinstance(prog, ExecutableHolder):
-            prog_path = self.interpreter.backend.get_target_filename(prog.held_object)
-            return build.RunScript([prog_path], args)
-        elif isinstance(prog, ExternalProgramHolder):
-            return build.RunScript(prog.get_command(), args)
-
-        # Prefer scripts in the current source directory
-        search_dir = os.path.join(self.interpreter.environment.source_dir,
-                                  self.interpreter.subdir)
-        key = (prog, search_dir)
-        if key in self._found_source_scripts:
-            found = self._found_source_scripts[key]
-        else:
-            found = dependencies.ExternalProgram(prog, search_dir=search_dir)
-            if found.found():
-                self._found_source_scripts[key] = found
-            else:
-                m = 'Script or command {!r} not found or not executable'
-                raise InterpreterException(m.format(prog))
-        return build.RunScript(found.get_command(), args)
-
-    def _process_script_args(
-            self, name: str, args: T.List[T.Union[
-                str, mesonlib.File, CustomTargetHolder,
-                CustomTargetIndexHolder, ConfigureFileHolder,
-                ExternalProgramHolder, ExecutableHolder,
-            ]], allow_built: bool = False) -> T.List[str]:
-        script_args = []  # T.List[str]
-        new = False
-        for a in args:
-            a = unholder(a)
-            if isinstance(a, str):
-                script_args.append(a)
-            elif isinstance(a, mesonlib.File):
-                new = True
-                script_args.append(a.rel_to_builddir(self.interpreter.environment.source_dir))
-            elif isinstance(a, (build.BuildTarget, build.CustomTarget, build.CustomTargetIndex)):
-                if not allow_built:
-                    raise InterpreterException('Arguments to {} cannot be built'.format(name))
-                new = True
-                script_args.extend([os.path.join(a.get_subdir(), o) for o in a.get_outputs()])
-
-                # This feels really hacky, but I'm not sure how else to fix
-                # this without completely rewriting install script handling.
-                # This is complicated by the fact that the install target
-                # depends on all.
-                if isinstance(a, build.CustomTargetIndex):
-                    a.target.build_by_default = True
-                else:
-                    a.build_by_default = True
-            elif isinstance(a, build.ConfigureFile):
-                new = True
-                script_args.append(os.path.join(a.subdir, a.targetname))
-            elif isinstance(a, dependencies.ExternalProgram):
-                script_args.extend(a.command)
-                new = True
-            else:
-                raise InterpreterException(
-                    'Arguments to {} must be strings, Files, CustomTargets, '
-                    'Indexes of CustomTargets, or ConfigureFiles'.format(name))
-        if new:
-            FeatureNew.single_use(
-                'Calling "{}" with File, CustomTaget, Index of CustomTarget, '
-                'ConfigureFile, Executable, or ExternalProgram'.format(name),
-                '0.55.0', self.interpreter.subproject)
-        return script_args
-
-    @permittedKwargs(set())
-    def add_install_script_method(self, args: 'T.Tuple[T.Union[str, ExecutableHolder], T.Union[str, mesonlib.File, CustomTargetHolder, CustomTargetIndexHolder, ConfigureFileHolder], ...]', kwargs):
-        if len(args) < 1:
-            raise InterpreterException('add_install_script takes one or more arguments')
-        script_args = self._process_script_args('add_install_script', args[1:], allow_built=True)
-        script = self._find_source_script(args[0], script_args)
-        self.build.install_scripts.append(script)
-
-    @permittedKwargs(set())
-    def add_postconf_script_method(self, args, kwargs):
-        if len(args) < 1:
-            raise InterpreterException('add_postconf_script takes one or more arguments')
-        script_args = self._process_script_args('add_postconf_script', args[1:], allow_built=True)
-        script = self._find_source_script(args[0], script_args)
-        self.build.postconf_scripts.append(script)
-
-    @permittedKwargs(set())
-    def add_dist_script_method(self, args, kwargs):
-        if len(args) < 1:
-            raise InterpreterException('add_dist_script takes one or more arguments')
-        if len(args) > 1:
-            FeatureNew.single_use('Calling "add_dist_script" with multiple arguments',
-                                  '0.49.0', self.interpreter.subproject)
-        if self.interpreter.subproject != '':
-            raise InterpreterException('add_dist_script may not be used in a subproject.')
-        script_args = self._process_script_args('add_dist_script', args[1:], allow_built=True)
-        script = self._find_source_script(args[0], script_args)
-        self.build.dist_scripts.append(script)
-
-    @noPosargs
-    @permittedKwargs({})
-    def current_source_dir_method(self, args, kwargs):
-        src = self.interpreter.environment.source_dir
-        sub = self.interpreter.subdir
-        if sub == '':
-            return src
-        return os.path.join(src, sub)
-
-    @noPosargs
-    @permittedKwargs({})
-    def current_build_dir_method(self, args, kwargs):
-        src = self.interpreter.environment.build_dir
-        sub = self.interpreter.subdir
-        if sub == '':
-            return src
-        return os.path.join(src, sub)
-
-    @noPosargs
-    @permittedKwargs({})
-    def backend_method(self, args, kwargs):
-        return self.interpreter.backend.name
-
-    @noPosargs
-    @permittedKwargs({})
-    def source_root_method(self, args, kwargs):
-        return self.interpreter.environment.source_dir
-
-    @noPosargs
-    @permittedKwargs({})
-    def build_root_method(self, args, kwargs):
-        return self.interpreter.environment.build_dir
-
-    @noPosargs
-    @permittedKwargs({})
-    @FeatureDeprecated('meson.has_exe_wrapper', '0.55.0', 'use meson.can_run_host_binaries instead.')
-    def has_exe_wrapper_method(self, args: T.Tuple[object, ...], kwargs: T.Dict[str, object]) -> bool:
-        return self.can_run_host_binaries_impl(args, kwargs)
-
-    @noPosargs
-    @permittedKwargs({})
-    @FeatureNew('meson.can_run_host_binaries', '0.55.0')
-    def can_run_host_binaries_method(self, args: T.Tuple[object, ...], kwargs: T.Dict[str, object]) -> bool:
-        return self.can_run_host_binaries_impl(args, kwargs)
-
-    def can_run_host_binaries_impl(self, args, kwargs):
-        if (self.is_cross_build_method(None, None) and
-                self.build.environment.need_exe_wrapper()):
-            if self.build.environment.exe_wrapper is None:
-                return False
-        # We return True when exe_wrap is defined, when it's not needed, and
-        # when we're compiling natively. The last two are semantically confusing.
-        # Need to revisit this.
-        return True
-
-    @noPosargs
-    @permittedKwargs({})
-    def is_cross_build_method(self, args, kwargs):
-        return self.build.environment.is_cross_build()
-
-    @permittedKwargs({'native'})
-    def get_compiler_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('get_compiler_method must have one and only one argument.')
-        cname = args[0]
-        for_machine = Interpreter.machine_from_native_kwarg(kwargs)
-        clist = self.interpreter.coredata.compilers[for_machine]
-        if cname in clist:
-            return CompilerHolder(clist[cname], self.build.environment, self.interpreter.subproject)
-        raise InterpreterException('Tried to access compiler for unspecified language "%s".' % cname)
-
-    @noPosargs
-    @permittedKwargs({})
-    def is_unity_method(self, args, kwargs):
-        optval = self.interpreter.environment.coredata.get_builtin_option('unity')
-        if optval == 'on' or (optval == 'subprojects' and self.interpreter.is_subproject()):
-            return True
-        return False
-
-    @noPosargs
-    @permittedKwargs({})
-    def is_subproject_method(self, args, kwargs):
-        return self.interpreter.is_subproject()
-
-    @permittedKwargs({})
-    def install_dependency_manifest_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Must specify manifest install file name')
-        if not isinstance(args[0], str):
-            raise InterpreterException('Argument must be a string.')
-        self.build.dep_manifest_name = args[0]
-
-    @FeatureNew('meson.override_find_program', '0.46.0')
-    @permittedKwargs({})
-    def override_find_program_method(self, args, kwargs):
-        if len(args) != 2:
-            raise InterpreterException('Override needs two arguments')
-        name, exe = args
-        if not isinstance(name, str):
-            raise InterpreterException('First argument must be a string')
-        if hasattr(exe, 'held_object'):
-            exe = exe.held_object
-        if isinstance(exe, mesonlib.File):
-            abspath = exe.absolute_path(self.interpreter.environment.source_dir,
-                                        self.interpreter.environment.build_dir)
-            if not os.path.exists(abspath):
-                raise InterpreterException('Tried to override %s with a file that does not exist.' % name)
-            exe = OverrideProgram(abspath)
-        if not isinstance(exe, (dependencies.ExternalProgram, build.Executable)):
-            raise InterpreterException('Second argument must be an external program or executable.')
-        self.interpreter.add_find_program_override(name, exe)
-
-    @FeatureNew('meson.override_dependency', '0.54.0')
-    @permittedKwargs({'native'})
-    def override_dependency_method(self, args, kwargs):
-        if len(args) != 2:
-            raise InterpreterException('Override needs two arguments')
-        name = args[0]
-        dep = args[1]
-        if not isinstance(name, str) or not name:
-            raise InterpreterException('First argument must be a string and cannot be empty')
-        if hasattr(dep, 'held_object'):
-            dep = dep.held_object
-        if not isinstance(dep, dependencies.Dependency):
-            raise InterpreterException('Second argument must be a dependency object')
-        identifier = dependencies.get_dep_identifier(name, kwargs)
-        for_machine = self.interpreter.machine_from_native_kwarg(kwargs)
-        override = self.build.dependency_overrides[for_machine].get(identifier)
-        if override:
-            m = 'Tried to override dependency {!r} which has already been resolved or overridden at {}'
-            location = mlog.get_error_location_string(override.node.filename, override.node.lineno)
-            raise InterpreterException(m.format(name, location))
-        self.build.dependency_overrides[for_machine][identifier] = \
-            build.DependencyOverride(dep, self.interpreter.current_node)
-
-    @noPosargs
-    @permittedKwargs({})
-    def project_version_method(self, args, kwargs):
-        return self.build.dep_manifest[self.interpreter.active_projectname]['version']
-
-    @FeatureNew('meson.project_license()', '0.45.0')
-    @noPosargs
-    @permittedKwargs({})
-    def project_license_method(self, args, kwargs):
-        return self.build.dep_manifest[self.interpreter.active_projectname]['license']
-
-    @noPosargs
-    @permittedKwargs({})
-    def version_method(self, args, kwargs):
-        return coredata.version
-
-    @noPosargs
-    @permittedKwargs({})
-    def project_name_method(self, args, kwargs):
-        return self.interpreter.active_projectname
-
-    @noArgsFlattening
-    @permittedKwargs({})
-    def get_cross_property_method(self, args, kwargs) -> str:
-        if len(args) < 1 or len(args) > 2:
-            raise InterpreterException('Must have one or two arguments.')
-        propname = args[0]
-        if not isinstance(propname, str):
-            raise InterpreterException('Property name must be string.')
-        try:
-            props = self.interpreter.environment.properties.host
-            return props[propname]
-        except Exception:
-            if len(args) == 2:
-                return args[1]
-            raise InterpreterException('Unknown cross property: %s.' % propname)
-
-    @noArgsFlattening
-    @permittedKwargs({'native'})
-    @FeatureNew('meson.get_external_property', '0.54.0')
-    def get_external_property_method(self, args: T.Sequence[str], kwargs: dict) -> str:
-        if len(args) < 1 or len(args) > 2:
-            raise InterpreterException('Must have one or two positional arguments.')
-        propname = args[0]
-        if not isinstance(propname, str):
-            raise InterpreterException('Property name must be string.')
-
-        def _get_native() -> str:
-            try:
-                props = self.interpreter.environment.properties.build
-                return props[propname]
-            except Exception:
-                if len(args) == 2:
-                    return args[1]
-                raise InterpreterException('Unknown native property: %s.' % propname)
-        if 'native' in kwargs:
-            if kwargs['native']:
-                return _get_native()
-            else:
-                return self.get_cross_property_method(args, {})
-        else:  # native: not specified
-            if self.build.environment.is_cross_build():
-                return self.get_cross_property_method(args, kwargs)
-            else:
-                return _get_native()
-
-known_library_kwargs = (
-    build.known_shlib_kwargs |
-    build.known_stlib_kwargs
-)
-
-known_build_target_kwargs = (
-    known_library_kwargs |
-    build.known_exe_kwargs |
-    build.known_jar_kwargs |
-    {'target_type'}
-)
-
-_base_test_args = {'args', 'depends', 'env', 'should_fail', 'timeout', 'workdir', 'suite', 'priority', 'protocol'}
-
-permitted_kwargs = {'add_global_arguments': {'language', 'native'},
-                    'add_global_link_arguments': {'language', 'native'},
-                    'add_languages': {'required', 'native'},
-                    'add_project_link_arguments': {'language', 'native'},
-                    'add_project_arguments': {'language', 'native'},
-                    'add_test_setup': {'exe_wrapper', 'gdb', 'timeout_multiplier', 'env', 'is_default'},
-                    'benchmark': _base_test_args,
-                    'build_target': known_build_target_kwargs,
-                    'configure_file': {'input',
-                                       'output',
-                                       'configuration',
-                                       'command',
-                                       'copy',
-                                       'depfile',
-                                       'install_dir',
-                                       'install_mode',
-                                       'capture',
-                                       'install',
-                                       'format',
-                                       'output_format',
-                                       'encoding'},
-                    'custom_target': {'input',
-                                      'output',
-                                      'command',
-                                      'install',
-                                      'install_dir',
-                                      'install_mode',
-                                      'build_always',
-                                      'capture',
-                                      'depends',
-                                      'depend_files',
-                                      'depfile',
-                                      'build_by_default',
-                                      'build_always_stale',
-                                      'console'},
-                    'dependency': {'default_options',
-                                   'embed',
-                                   'fallback',
-                                   'language',
-                                   'main',
-                                   'method',
-                                   'modules',
-                                   'components',
-                                   'cmake_module_path',
-                                   'optional_modules',
-                                   'native',
-                                   'not_found_message',
-                                   'required',
-                                   'static',
-                                   'version',
-                                   'private_headers',
-                                   'cmake_args',
-                                   'include_type',
-                                   },
-                    'declare_dependency': {'include_directories',
-                                           'link_with',
-                                           'sources',
-                                           'dependencies',
-                                           'compile_args',
-                                           'link_args',
-                                           'link_whole',
-                                           'version',
-                                           'variables',
-                                           },
-                    'executable': build.known_exe_kwargs,
-                    'find_program': {'required', 'native', 'version', 'dirs'},
-                    'generator': {'arguments',
-                                  'output',
-                                  'depends',
-                                  'depfile',
-                                  'capture',
-                                  'preserve_path_from'},
-                    'include_directories': {'is_system'},
-                    'install_data': {'install_dir', 'install_mode', 'rename', 'sources'},
-                    'install_headers': {'install_dir', 'install_mode', 'subdir'},
-                    'install_man': {'install_dir', 'install_mode'},
-                    'install_subdir': {'exclude_files', 'exclude_directories', 'install_dir', 'install_mode', 'strip_directory'},
-                    'jar': build.known_jar_kwargs,
-                    'project': {'version', 'meson_version', 'default_options', 'license', 'subproject_dir'},
-                    'run_command': {'check', 'capture', 'env'},
-                    'run_target': {'command', 'depends'},
-                    'shared_library': build.known_shlib_kwargs,
-                    'shared_module': build.known_shmod_kwargs,
-                    'static_library': build.known_stlib_kwargs,
-                    'both_libraries': known_library_kwargs,
-                    'library': known_library_kwargs,
-                    'subdir': {'if_found'},
-                    'subproject': {'version', 'default_options', 'required'},
-                    'test': set.union(_base_test_args, {'is_parallel'}),
-                    'vcs_tag': {'input', 'output', 'fallback', 'command', 'replace_string'},
-                    }
-
-
-class Interpreter(InterpreterBase):
-
-    def __init__(self, build, backend=None, subproject='', subdir='', subproject_dir='subprojects',
-                 modules = None, default_project_options=None, mock=False, ast=None):
-        super().__init__(build.environment.get_source_dir(), subdir, subproject)
-        self.an_unpicklable_object = mesonlib.an_unpicklable_object
-        self.build = build
-        self.environment = build.environment
-        self.coredata = self.environment.get_coredata()
-        self.backend = backend
-        self.summary = {}
-        if modules is None:
-            self.modules = {}
-        else:
-            self.modules = modules
-        # Subproject directory is usually the name of the subproject, but can
-        # be different for dependencies provided by wrap files.
-        self.subproject_directory_name = subdir.split(os.path.sep)[-1]
-        self.subproject_dir = subproject_dir
-        self.option_file = os.path.join(self.source_root, self.subdir, 'meson_options.txt')
-        if not mock and ast is None:
-            self.load_root_meson_file()
-            self.sanity_check_ast()
-        elif ast is not None:
-            self.ast = ast
-            self.sanity_check_ast()
-        self.builtin.update({'meson': MesonMain(build, self)})
-        self.generators = []
-        self.visited_subdirs = {}
-        self.project_args_frozen = False
-        self.global_args_frozen = False  # implies self.project_args_frozen
-        self.subprojects = {}
-        self.subproject_stack = []
-        self.configure_file_outputs = {}
-        # Passed from the outside, only used in subprojects.
-        if default_project_options:
-            self.default_project_options = default_project_options.copy()
-        else:
-            self.default_project_options = {}
-        self.project_default_options = {}
-        self.build_func_dict()
-        # build_def_files needs to be defined before parse_project is called
-        self.build_def_files = [os.path.join(self.subdir, environment.build_filename)]
-        if not mock:
-            self.parse_project()
-        self._redetect_machines()
-
-    def _redetect_machines(self):
-        # Re-initialize machine descriptions. We can do a better job now because we
-        # have the compilers needed to gain more knowledge, so wipe out old
-        # inference and start over.
-        machines = self.build.environment.machines.miss_defaulting()
-        machines.build = environment.detect_machine_info(self.coredata.compilers.build)
-        self.build.environment.machines = machines.default_missing()
-        assert self.build.environment.machines.build.cpu is not None
-        assert self.build.environment.machines.host.cpu is not None
-        assert self.build.environment.machines.target.cpu is not None
-
-        self.builtin['build_machine'] = \
-            MachineHolder(self.build.environment.machines.build)
-        self.builtin['host_machine'] = \
-            MachineHolder(self.build.environment.machines.host)
-        self.builtin['target_machine'] = \
-            MachineHolder(self.build.environment.machines.target)
-
-    def get_non_matching_default_options(self):
-        env = self.environment
-        for def_opt_name, def_opt_value in self.project_default_options.items():
-            for opts in env.coredata.get_all_options():
-                cur_opt_value = opts.get(def_opt_name)
-                if cur_opt_value is not None:
-                    def_opt_value = env.coredata.validate_option_value(def_opt_name, def_opt_value)
-                    if def_opt_value != cur_opt_value.value:
-                        yield (def_opt_name, def_opt_value, cur_opt_value)
-
-    def build_func_dict(self):
-        self.funcs.update({'add_global_arguments': self.func_add_global_arguments,
-                           'add_project_arguments': self.func_add_project_arguments,
-                           'add_global_link_arguments': self.func_add_global_link_arguments,
-                           'add_project_link_arguments': self.func_add_project_link_arguments,
-                           'add_test_setup': self.func_add_test_setup,
-                           'add_languages': self.func_add_languages,
-                           'alias_target': self.func_alias_target,
-                           'assert': self.func_assert,
-                           'benchmark': self.func_benchmark,
-                           'build_target': self.func_build_target,
-                           'configuration_data': self.func_configuration_data,
-                           'configure_file': self.func_configure_file,
-                           'custom_target': self.func_custom_target,
-                           'declare_dependency': self.func_declare_dependency,
-                           'dependency': self.func_dependency,
-                           'disabler': self.func_disabler,
-                           'environment': self.func_environment,
-                           'error': self.func_error,
-                           'executable': self.func_executable,
-                           'generator': self.func_generator,
-                           'gettext': self.func_gettext,
-                           'get_option': self.func_get_option,
-                           'get_variable': self.func_get_variable,
-                           'files': self.func_files,
-                           'find_library': self.func_find_library,
-                           'find_program': self.func_find_program,
-                           'include_directories': self.func_include_directories,
-                           'import': self.func_import,
-                           'install_data': self.func_install_data,
-                           'install_headers': self.func_install_headers,
-                           'install_man': self.func_install_man,
-                           'install_subdir': self.func_install_subdir,
-                           'is_disabler': self.func_is_disabler,
-                           'is_variable': self.func_is_variable,
-                           'jar': self.func_jar,
-                           'join_paths': self.func_join_paths,
-                           'library': self.func_library,
-                           'message': self.func_message,
-                           'warning': self.func_warning,
-                           'option': self.func_option,
-                           'project': self.func_project,
-                           'run_target': self.func_run_target,
-                           'run_command': self.func_run_command,
-                           'set_variable': self.func_set_variable,
-                           'subdir': self.func_subdir,
-                           'subdir_done': self.func_subdir_done,
-                           'subproject': self.func_subproject,
-                           'summary': self.func_summary,
-                           'shared_library': self.func_shared_lib,
-                           'shared_module': self.func_shared_module,
-                           'static_library': self.func_static_lib,
-                           'both_libraries': self.func_both_lib,
-                           'test': self.func_test,
-                           'vcs_tag': self.func_vcs_tag
-                           })
-        if 'MESON_UNIT_TEST' in os.environ:
-            self.funcs.update({'exception': self.func_exception})
-
-    def holderify(self, item):
-        if isinstance(item, list):
-            return [self.holderify(x) for x in item]
-        if isinstance(item, dict):
-            return {k: self.holderify(v) for k, v in item.items()}
-
-        if isinstance(item, build.CustomTarget):
-            return CustomTargetHolder(item, self)
-        elif isinstance(item, (int, str, bool, Disabler, InterpreterObject)) or item is None:
-            return item
-        elif isinstance(item, build.Executable):
-            return ExecutableHolder(item, self)
-        elif isinstance(item, build.GeneratedList):
-            return GeneratedListHolder(item)
-        elif isinstance(item, build.RunTarget):
-            raise RuntimeError('This is not a pipe.')
-        elif isinstance(item, build.RunScript):
-            raise RuntimeError('Do not do this.')
-        elif isinstance(item, build.Data):
-            return DataHolder(item)
-        elif isinstance(item, dependencies.Dependency):
-            return DependencyHolder(item, self.subproject)
-        elif isinstance(item, dependencies.ExternalProgram):
-            return ExternalProgramHolder(item, self.subproject)
-        elif hasattr(item, 'held_object'):
-            return item
-        else:
-            raise InterpreterException('Module returned a value of unknown type.')
-
-    def process_new_values(self, invalues):
-        invalues = listify(invalues)
-        for v in invalues:
-            if isinstance(v, (RunTargetHolder, CustomTargetHolder, BuildTargetHolder)):
-                v = v.held_object
-
-            if isinstance(v, (build.BuildTarget, build.CustomTarget, build.RunTarget)):
-                self.add_target(v.name, v)
-            elif isinstance(v, list):
-                self.module_method_callback(v)
-            elif isinstance(v, build.GeneratedList):
-                pass
-            elif isinstance(v, build.RunScript):
-                self.build.install_scripts.append(v)
-            elif isinstance(v, build.Data):
-                self.build.data.append(v)
-            elif isinstance(v, dependencies.ExternalProgram):
-                return ExternalProgramHolder(v, self.subproject)
-            elif isinstance(v, dependencies.InternalDependency):
-                # FIXME: This is special cased and not ideal:
-                # The first source is our new VapiTarget, the rest are deps
-                self.process_new_values(v.sources[0])
-            elif hasattr(v, 'held_object'):
-                pass
-            elif isinstance(v, (int, str, bool, Disabler)):
-                pass
-            else:
-                raise InterpreterException('Module returned a value of unknown type.')
-
-    def module_method_callback(self, return_object):
-        if not isinstance(return_object, ModuleReturnValue):
-            raise InterpreterException('Bug in module, it returned an invalid object')
-        invalues = return_object.new_objects
-        self.process_new_values(invalues)
-        return self.holderify(return_object.return_value)
-
-    def get_build_def_files(self):
-        return self.build_def_files
-
-    def add_build_def_file(self, f):
-        # Use relative path for files within source directory, and absolute path
-        # for system files. Skip files within build directory. Also skip not regular
-        # files (e.g. /dev/stdout) Normalize the path to avoid duplicates, this
-        # is especially important to convert '/' to '\' on Windows.
-        if isinstance(f, mesonlib.File):
-            if f.is_built:
-                return
-            f = os.path.normpath(f.relative_name())
-        elif os.path.isfile(f) and not f.startswith('/dev'):
-            srcdir = Path(self.environment.get_source_dir())
-            builddir = Path(self.environment.get_build_dir())
-            try:
-                f = Path(f).resolve()
-            except OSError:
-                f = Path(f)
-                s = f.stat()
-                if (hasattr(s, 'st_file_attributes') and
-                        s.st_file_attributes & stat.FILE_ATTRIBUTE_REPARSE_POINT != 0 and
-                        s.st_reparse_tag == stat.IO_REPARSE_TAG_APPEXECLINK):
-                    # This is a Windows Store link which we can't
-                    # resolve, so just do our best otherwise.
-                    f = f.parent.resolve() / f.name
-                else:
-                    raise
-            if builddir in f.parents:
-                return
-            if srcdir in f.parents:
-                f = f.relative_to(srcdir)
-            f = str(f)
-        else:
-            return
-        if f not in self.build_def_files:
-            self.build_def_files.append(f)
-
-    def get_variables(self):
-        return self.variables
-
-    def check_stdlibs(self):
-        for for_machine in MachineChoice:
-            props = self.build.environment.properties[for_machine]
-            for l in self.coredata.compilers[for_machine].keys():
-                try:
-                    di = mesonlib.stringlistify(props.get_stdlib(l))
-                    if len(di) != 2:
-                        raise InterpreterException('Stdlib definition for %s should have exactly two elements.'
-                                                   % l)
-                    projname, depname = di
-                    subproj = self.do_subproject(projname, 'meson', {})
-                    self.build.stdlibs.host[l] = subproj.get_variable_method([depname], {})
-                except KeyError:
-                    pass
-                except InvalidArguments:
-                    pass
-
-    @stringArgs
-    @noKwargs
-    def func_import(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InvalidCode('Import takes one argument.')
-        modname = args[0]
-        if modname.startswith('unstable-'):
-            plainname = modname.split('-', 1)[1]
-            mlog.warning('Module %s has no backwards or forwards compatibility and might not exist in future releases.' % modname, location=node)
-            modname = 'unstable_' + plainname
-        if modname not in self.modules:
-            try:
-                module = importlib.import_module('mesonbuild.modules.' + modname)
-            except ImportError:
-                raise InvalidArguments('Module "%s" does not exist' % (modname, ))
-            self.modules[modname] = module.initialize(self)
-        return ModuleHolder(modname, self.modules[modname], self)
-
-    @stringArgs
-    @noKwargs
-    def func_files(self, node, args, kwargs):
-        return [mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, fname) for fname in args]
-
-    @FeatureNewKwargs('declare_dependency', '0.46.0', ['link_whole'])
-    @FeatureNewKwargs('declare_dependency', '0.54.0', ['variables'])
-    @permittedKwargs(permitted_kwargs['declare_dependency'])
-    @noPosargs
-    def func_declare_dependency(self, node, args, kwargs):
-        version = kwargs.get('version', self.project_version)
-        if not isinstance(version, str):
-            raise InterpreterException('Version must be a string.')
-        incs = self.extract_incdirs(kwargs)
-        libs = unholder(extract_as_list(kwargs, 'link_with'))
-        libs_whole = unholder(extract_as_list(kwargs, 'link_whole'))
-        sources = extract_as_list(kwargs, 'sources')
-        sources = unholder(listify(self.source_strings_to_files(sources)))
-        deps = unholder(extract_as_list(kwargs, 'dependencies'))
-        compile_args = mesonlib.stringlistify(kwargs.get('compile_args', []))
-        link_args = mesonlib.stringlistify(kwargs.get('link_args', []))
-        variables = kwargs.get('variables', {})
-        if not isinstance(variables, dict):
-            raise InterpreterException('variables must be a dict.')
-        if not all(isinstance(v, str) for v in variables.values()):
-            # Because that is how they will come from pkg-config and cmake
-            raise InterpreterException('variables values be strings.')
-        final_deps = []
-        for d in deps:
-            try:
-                d = d.held_object
-            except Exception:
-                pass
-            if not isinstance(d, (dependencies.Dependency, dependencies.ExternalLibrary, dependencies.InternalDependency)):
-                raise InterpreterException('Dependencies must be external deps')
-            final_deps.append(d)
-        for l in libs:
-            if isinstance(l, dependencies.Dependency):
-                raise InterpreterException('''Entries in "link_with" may only be self-built targets,
-external dependencies (including libraries) must go to "dependencies".''')
-        dep = dependencies.InternalDependency(version, incs, compile_args,
-                                              link_args, libs, libs_whole, sources, final_deps,
-                                              variables)
-        return DependencyHolder(dep, self.subproject)
-
-    @noKwargs
-    def func_assert(self, node, args, kwargs):
-        if len(args) == 1:
-            FeatureNew.single_use('assert function without message argument', '0.53.0', self.subproject)
-            value = args[0]
-            message = None
-        elif len(args) == 2:
-            value, message = args
-            if not isinstance(message, str):
-                raise InterpreterException('Assert message not a string.')
-        else:
-            raise InterpreterException('Assert takes between one and two arguments')
-        if not isinstance(value, bool):
-            raise InterpreterException('Assert value not bool.')
-        if not value:
-            if message is None:
-                from .ast import AstPrinter
-                printer = AstPrinter()
-                node.args.arguments[0].accept(printer)
-                message = printer.result
-            raise InterpreterException('Assert failed: ' + message)
-
-    def validate_arguments(self, args, argcount, arg_types):
-        if argcount is not None:
-            if argcount != len(args):
-                raise InvalidArguments('Expected %d arguments, got %d.' %
-                                       (argcount, len(args)))
-        for actual, wanted in zip(args, arg_types):
-            if wanted is not None:
-                if not isinstance(actual, wanted):
-                    raise InvalidArguments('Incorrect argument type.')
-
-    @FeatureNewKwargs('run_command', '0.50.0', ['env'])
-    @FeatureNewKwargs('run_command', '0.47.0', ['check', 'capture'])
-    @permittedKwargs(permitted_kwargs['run_command'])
-    def func_run_command(self, node, args, kwargs):
-        return self.run_command_impl(node, args, kwargs)
-
-    def run_command_impl(self, node, args, kwargs, in_builddir=False):
-        if len(args) < 1:
-            raise InterpreterException('Not enough arguments')
-        cmd, *cargs = args
-        capture = kwargs.get('capture', True)
-        srcdir = self.environment.get_source_dir()
-        builddir = self.environment.get_build_dir()
-
-        check = kwargs.get('check', False)
-        if not isinstance(check, bool):
-            raise InterpreterException('Check must be boolean.')
-
-        env = self.unpack_env_kwarg(kwargs)
-
-        m = 'must be a string, or the output of find_program(), files() '\
-            'or configure_file(), or a compiler object; not {!r}'
-        expanded_args = []
-        if isinstance(cmd, ExternalProgramHolder):
-            cmd = cmd.held_object
-            if isinstance(cmd, build.Executable):
-                progname = node.args.arguments[0].value
-                msg = 'Program {!r} was overridden with the compiled executable {!r}'\
-                      ' and therefore cannot be used during configuration'
-                raise InterpreterException(msg.format(progname, cmd.description()))
-            if not cmd.found():
-                raise InterpreterException('command {!r} not found or not executable'.format(cmd.get_name()))
-        elif isinstance(cmd, CompilerHolder):
-            exelist = cmd.compiler.get_exelist()
-            cmd = exelist[0]
-            prog = ExternalProgram(cmd, silent=True)
-            if not prog.found():
-                raise InterpreterException('Program {!r} not found '
-                                           'or not executable'.format(cmd))
-            cmd = prog
-            expanded_args = exelist[1:]
-        else:
-            if isinstance(cmd, mesonlib.File):
-                cmd = cmd.absolute_path(srcdir, builddir)
-            elif not isinstance(cmd, str):
-                raise InterpreterException('First argument ' + m.format(cmd))
-            # Prefer scripts in the current source directory
-            search_dir = os.path.join(srcdir, self.subdir)
-            prog = ExternalProgram(cmd, silent=True, search_dir=search_dir)
-            if not prog.found():
-                raise InterpreterException('Program or command {!r} not found '
-                                           'or not executable'.format(cmd))
-            cmd = prog
-        for a in listify(cargs):
-            if isinstance(a, str):
-                expanded_args.append(a)
-            elif isinstance(a, mesonlib.File):
-                expanded_args.append(a.absolute_path(srcdir, builddir))
-            elif isinstance(a, ExternalProgramHolder):
-                expanded_args.append(a.held_object.get_path())
-            else:
-                raise InterpreterException('Arguments ' + m.format(a))
-        # If any file that was used as an argument to the command
-        # changes, we must re-run the configuration step.
-        self.add_build_def_file(cmd.get_path())
-        for a in expanded_args:
-            if not os.path.isabs(a):
-                a = os.path.join(builddir if in_builddir else srcdir, self.subdir, a)
-            self.add_build_def_file(a)
-        return RunProcess(cmd, expanded_args, env, srcdir, builddir, self.subdir,
-                          self.environment.get_build_command() + ['introspect'],
-                          in_builddir=in_builddir, check=check, capture=capture)
-
-    @stringArgs
-    def func_gettext(self, nodes, args, kwargs):
-        raise InterpreterException('Gettext() function has been moved to module i18n. Import it and use i18n.gettext() instead')
-
-    def func_option(self, nodes, args, kwargs):
-        raise InterpreterException('Tried to call option() in build description file. All options must be in the option file.')
-
-    @FeatureNewKwargs('subproject', '0.38.0', ['default_options'])
-    @permittedKwargs(permitted_kwargs['subproject'])
-    @stringArgs
-    def func_subproject(self, nodes, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Subproject takes exactly one argument')
-        dirname = args[0]
-        return self.do_subproject(dirname, 'meson', kwargs)
-
-    def disabled_subproject(self, dirname, disabled_feature=None, exception=None):
-        sub = SubprojectHolder(None, self.subproject_dir, dirname,
-                               disabled_feature=disabled_feature, exception=exception)
-        self.subprojects[dirname] = sub
-        return sub
-
-    def get_subproject(self, dirname):
-        sub = self.subprojects.get(dirname)
-        if sub and sub.found():
-            return sub
-        return None
-
-    def do_subproject(self, dirname: str, method: str, kwargs):
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject)
-        if disabled:
-            mlog.log('Subproject', mlog.bold(dirname), ':', 'skipped: feature', mlog.bold(feature), 'disabled')
-            return self.disabled_subproject(dirname, disabled_feature=feature)
-
-        default_options = mesonlib.stringlistify(kwargs.get('default_options', []))
-        default_options = coredata.create_options_dict(default_options)
-        if dirname == '':
-            raise InterpreterException('Subproject dir name must not be empty.')
-        if dirname[0] == '.':
-            raise InterpreterException('Subproject dir name must not start with a period.')
-        if '..' in dirname:
-            raise InterpreterException('Subproject name must not contain a ".." path segment.')
-        if os.path.isabs(dirname):
-            raise InterpreterException('Subproject name must not be an absolute path.')
-        if has_path_sep(dirname):
-            mlog.warning('Subproject name has a path separator. This may cause unexpected behaviour.',
-                         location=self.current_node)
-        if dirname in self.subproject_stack:
-            fullstack = self.subproject_stack + [dirname]
-            incpath = ' => '.join(fullstack)
-            raise InvalidCode('Recursive include of subprojects: %s.' % incpath)
-        if dirname in self.subprojects:
-            subproject = self.subprojects[dirname]
-            if required and not subproject.found():
-                raise InterpreterException('Subproject "%s/%s" required but not found.' % (
-                                           self.subproject_dir, dirname))
-            return subproject
-
-        r = self.environment.wrap_resolver
-        try:
-            resolved = r.resolve(dirname, method, self.subproject)
-        except wrap.WrapException as e:
-            subprojdir = os.path.join(self.subproject_dir, r.directory)
-            if isinstance(e, wrap.WrapNotFoundException):
-                # if the reason subproject execution failed was because
-                # the directory doesn't exist, try to give some helpful
-                # advice if it's a nested subproject that needs
-                # promotion...
-                self.print_nested_info(dirname)
-            if not required:
-                mlog.log(e)
-                mlog.log('Subproject ', mlog.bold(subprojdir), 'is buildable:', mlog.red('NO'), '(disabling)')
-                return self.disabled_subproject(dirname, exception=e)
-            raise e
-
-        subdir = os.path.join(self.subproject_dir, resolved)
-        subdir_abs = os.path.join(self.environment.get_source_dir(), subdir)
-        os.makedirs(os.path.join(self.build.environment.get_build_dir(), subdir), exist_ok=True)
-        self.global_args_frozen = True
-
-        mlog.log()
-        with mlog.nested():
-            mlog.log('Executing subproject', mlog.bold(dirname), 'method', mlog.bold(method), '\n')
-        try:
-            if method == 'meson':
-                return self._do_subproject_meson(dirname, subdir, default_options, kwargs)
-            elif method == 'cmake':
-                return self._do_subproject_cmake(dirname, subdir, subdir_abs, default_options, kwargs)
-            else:
-                raise InterpreterException('The method {} is invalid for the subproject {}'.format(method, dirname))
-        # Invalid code is always an error
-        except InvalidCode:
-            raise
-        except Exception as e:
-            if not required:
-                with mlog.nested():
-                    # Suppress the 'ERROR:' prefix because this exception is not
-                    # fatal and VS CI treat any logs with "ERROR:" as fatal.
-                    mlog.exception(e, prefix=mlog.yellow('Exception:'))
-                mlog.log('\nSubproject', mlog.bold(dirname), 'is buildable:', mlog.red('NO'), '(disabling)')
-                return self.disabled_subproject(dirname, exception=e)
-            raise e
-
-    def _do_subproject_meson(self, dirname, subdir, default_options, kwargs, ast=None, build_def_files=None):
-        with mlog.nested():
-            new_build = self.build.copy()
-            subi = Interpreter(new_build, self.backend, dirname, subdir, self.subproject_dir,
-                               self.modules, default_options, ast=ast)
-            subi.subprojects = self.subprojects
-
-            subi.subproject_stack = self.subproject_stack + [dirname]
-            current_active = self.active_projectname
-            current_warnings_counter = mlog.log_warnings_counter
-            mlog.log_warnings_counter = 0
-            subi.run()
-            subi_warnings = mlog.log_warnings_counter
-            mlog.log_warnings_counter = current_warnings_counter
-
-            mlog.log('Subproject', mlog.bold(dirname), 'finished.')
-
-        mlog.log()
-
-        if 'version' in kwargs:
-            pv = subi.project_version
-            wanted = kwargs['version']
-            if pv == 'undefined' or not mesonlib.version_compare_many(pv, wanted)[0]:
-                raise InterpreterException('Subproject %s version is %s but %s required.' % (dirname, pv, wanted))
-        self.active_projectname = current_active
-        self.subprojects.update(subi.subprojects)
-        self.subprojects[dirname] = SubprojectHolder(subi, self.subproject_dir, dirname,
-                                                     warnings=subi_warnings)
-        # Duplicates are possible when subproject uses files from project root
-        if build_def_files:
-            self.build_def_files = list(set(self.build_def_files + build_def_files))
-        else:
-            self.build_def_files = list(set(self.build_def_files + subi.build_def_files))
-        self.build.merge(subi.build)
-        self.build.subprojects[dirname] = subi.project_version
-        self.summary.update(subi.summary)
-        return self.subprojects[dirname]
-
-    def _do_subproject_cmake(self, dirname, subdir, subdir_abs, default_options, kwargs):
-        with mlog.nested():
-            new_build = self.build.copy()
-            prefix = self.coredata.builtins['prefix'].value
-
-            from .modules.cmake import CMakeSubprojectOptions
-            options = kwargs.get('options', CMakeSubprojectOptions())
-            if not isinstance(options, CMakeSubprojectOptions):
-                raise InterpreterException('"options" kwarg must be CMakeSubprojectOptions'
-                                           ' object (created by cmake.subproject_options())')
-
-            cmake_options = mesonlib.stringlistify(kwargs.get('cmake_options', []))
-            cmake_options += options.cmake_options
-            cm_int = CMakeInterpreter(new_build, subdir, subdir_abs, prefix, new_build.environment, self.backend)
-            cm_int.initialise(cmake_options)
-            cm_int.analyse()
-
-            # Generate a meson ast and execute it with the normal do_subproject_meson
-            ast = cm_int.pretend_to_be_meson(options.target_options)
-
-            mlog.log()
-            with mlog.nested():
-                mlog.log('Processing generated meson AST')
-
-                # Debug print the generated meson file
-                from .ast import AstIndentationGenerator, AstPrinter
-                printer = AstPrinter()
-                ast.accept(AstIndentationGenerator())
-                ast.accept(printer)
-                printer.post_process()
-                meson_filename = os.path.join(self.build.environment.get_build_dir(), subdir, 'meson.build')
-                with open(meson_filename, "w") as f:
-                    f.write(printer.result)
-
-                mlog.log('Build file:', meson_filename)
-                mlog.cmd_ci_include(meson_filename)
-                mlog.log()
-
-            result = self._do_subproject_meson(dirname, subdir, default_options, kwargs, ast, cm_int.bs_files)
-            result.cm_interpreter = cm_int
-
-        mlog.log()
-        return result
-
-    def get_option_internal(self, optname):
-        raw_optname = optname
-        if self.is_subproject():
-            optname = self.subproject + ':' + optname
-
-        for opts in [
-                self.coredata.base_options, compilers.base_options, self.coredata.builtins,
-                dict(self.coredata.get_prefixed_options_per_machine(self.coredata.builtins_per_machine)),
-                dict(self.coredata.flatten_lang_iterator(
-                    self.coredata.get_prefixed_options_per_machine(self.coredata.compiler_options))),
-        ]:
-            v = opts.get(optname)
-            if v is None or v.yielding:
-                v = opts.get(raw_optname)
-            if v is not None:
-                return v
-
-        try:
-            opt = self.coredata.user_options[optname]
-            if opt.yielding and ':' in optname and raw_optname in self.coredata.user_options:
-                popt = self.coredata.user_options[raw_optname]
-                if type(opt) is type(popt):
-                    opt = popt
-                else:
-                    # Get class name, then option type as a string
-                    opt_type = opt.__class__.__name__[4:][:-6].lower()
-                    popt_type = popt.__class__.__name__[4:][:-6].lower()
-                    # This is not a hard error to avoid dependency hell, the workaround
-                    # when this happens is to simply set the subproject's option directly.
-                    mlog.warning('Option {0!r} of type {1!r} in subproject {2!r} cannot yield '
-                                 'to parent option of type {3!r}, ignoring parent value. '
-                                 'Use -D{2}:{0}=value to set the value for this option manually'
-                                 '.'.format(raw_optname, opt_type, self.subproject, popt_type),
-                                 location=self.current_node)
-            return opt
-        except KeyError:
-            pass
-
-        raise InterpreterException('Tried to access unknown option "%s".' % optname)
-
-    @stringArgs
-    @noKwargs
-    def func_get_option(self, nodes, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Argument required for get_option.')
-        optname = args[0]
-        if ':' in optname:
-            raise InterpreterException('Having a colon in option name is forbidden, '
-                                       'projects are not allowed to directly access '
-                                       'options of other subprojects.')
-        opt = self.get_option_internal(optname)
-        if isinstance(opt, coredata.UserFeatureOption):
-            return FeatureOptionHolder(self.environment, optname, opt)
-        elif isinstance(opt, coredata.UserOption):
-            return opt.value
-        return opt
-
-    @noKwargs
-    def func_configuration_data(self, node, args, kwargs):
-        if len(args) > 1:
-            raise InterpreterException('configuration_data takes only one optional positional arguments')
-        elif len(args) == 1:
-            FeatureNew.single_use('configuration_data dictionary', '0.49.0', self.subproject)
-            initial_values = args[0]
-            if not isinstance(initial_values, dict):
-                raise InterpreterException('configuration_data first argument must be a dictionary')
-        else:
-            initial_values = {}
-        return ConfigurationDataHolder(self.subproject, initial_values)
-
-    def set_backend(self):
-        # The backend is already set when parsing subprojects
-        if self.backend is not None:
-            return
-        backend = self.coredata.get_builtin_option('backend')
-        from .backend import backends
-        self.backend = backends.get_backend_from_name(backend, self.build, self)
-
-        if self.backend is None:
-            raise InterpreterException('Unknown backend "%s".' % backend)
-        if backend != self.backend.name:
-            if self.backend.name.startswith('vs'):
-                mlog.log('Auto detected Visual Studio backend:', mlog.bold(self.backend.name))
-            self.coredata.set_builtin_option('backend', self.backend.name)
-
-        # Only init backend options on first invocation otherwise it would
-        # override values previously set from command line.
-        if self.environment.first_invocation:
-            self.coredata.init_backend_options(backend)
-
-        options = {k: v for k, v in self.environment.cmd_line_options.items() if k.startswith('backend_')}
-        self.coredata.set_options(options)
-
-    @stringArgs
-    @permittedKwargs(permitted_kwargs['project'])
-    def func_project(self, node, args, kwargs):
-        if len(args) < 1:
-            raise InvalidArguments('Not enough arguments to project(). Needs at least the project name.')
-        proj_name, *proj_langs = args
-        if ':' in proj_name:
-            raise InvalidArguments("Project name {!r} must not contain ':'".format(proj_name))
-
-        # This needs to be evaluated as early as possible, as meson uses this
-        # for things like deprecation testing.
-        if 'meson_version' in kwargs:
-            cv = coredata.version
-            pv = kwargs['meson_version']
-            if not mesonlib.version_compare(cv, pv):
-                raise InterpreterException('Meson version is %s but project requires %s' % (cv, pv))
-            mesonlib.project_meson_versions[self.subproject] = kwargs['meson_version']
-
-        if os.path.exists(self.option_file):
-            oi = optinterpreter.OptionInterpreter(self.subproject)
-            oi.process(self.option_file)
-            self.coredata.merge_user_options(oi.options)
-            self.add_build_def_file(self.option_file)
-
-        # Do not set default_options on reconfigure otherwise it would override
-        # values previously set from command line. That means that changing
-        # default_options in a project will trigger a reconfigure but won't
-        # have any effect.
-        self.project_default_options = mesonlib.stringlistify(kwargs.get('default_options', []))
-        self.project_default_options = coredata.create_options_dict(self.project_default_options)
-        if self.environment.first_invocation:
-            default_options = self.project_default_options
-            default_options.update(self.default_project_options)
-            self.coredata.init_builtins(self.subproject)
-        else:
-            default_options = {}
-        self.coredata.set_default_options(default_options, self.subproject, self.environment)
-
-        if not self.is_subproject():
-            self.build.project_name = proj_name
-        self.active_projectname = proj_name
-        self.project_version = kwargs.get('version', 'undefined')
-        if self.build.project_version is None:
-            self.build.project_version = self.project_version
-        proj_license = mesonlib.stringlistify(kwargs.get('license', 'unknown'))
-        self.build.dep_manifest[proj_name] = {'version': self.project_version,
-                                              'license': proj_license}
-        if self.subproject in self.build.projects:
-            raise InvalidCode('Second call to project().')
-        if not self.is_subproject() and 'subproject_dir' in kwargs:
-            spdirname = kwargs['subproject_dir']
-            if not isinstance(spdirname, str):
-                raise InterpreterException('Subproject_dir must be a string')
-            if os.path.isabs(spdirname):
-                raise InterpreterException('Subproject_dir must not be an absolute path.')
-            if spdirname.startswith('.'):
-                raise InterpreterException('Subproject_dir must not begin with a period.')
-            if '..' in spdirname:
-                raise InterpreterException('Subproject_dir must not contain a ".." segment.')
-            self.subproject_dir = spdirname
-
-        self.build.subproject_dir = self.subproject_dir
-        if not self.is_subproject():
-            wrap_mode = self.coredata.get_builtin_option('wrap_mode')
-            subproject_dir_abs = os.path.join(self.environment.get_source_dir(), self.subproject_dir)
-            self.environment.wrap_resolver = wrap.Resolver(subproject_dir_abs, wrap_mode)
-
-        self.build.projects[self.subproject] = proj_name
-        mlog.log('Project name:', mlog.bold(proj_name))
-        mlog.log('Project version:', mlog.bold(self.project_version))
-        self.add_languages(proj_langs, True, MachineChoice.BUILD)
-        self.add_languages(proj_langs, True, MachineChoice.HOST)
-        self.set_backend()
-        if not self.is_subproject():
-            self.check_stdlibs()
-
-    @FeatureNewKwargs('add_languages', '0.54.0', ['native'])
-    @permittedKwargs(permitted_kwargs['add_languages'])
-    @stringArgs
-    def func_add_languages(self, node, args, kwargs):
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject)
-        if disabled:
-            for lang in sorted(args, key=compilers.sort_clink):
-                mlog.log('Compiler for language', mlog.bold(lang), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return False
-        if 'native' in kwargs:
-            return self.add_languages(args, required, self.machine_from_native_kwarg(kwargs))
-        else:
-            # absent 'native' means 'both' for backwards compatibility
-            tv = FeatureNew.get_target_version(self.subproject)
-            if FeatureNew.check_version(tv, '0.54.0'):
-                mlog.warning('add_languages is missing native:, assuming languages are wanted for both host and build.',
-                             location=self.current_node)
-
-            success = self.add_languages(args, False, MachineChoice.BUILD)
-            success &= self.add_languages(args, required, MachineChoice.HOST)
-            return success
-
-    def get_message_string_arg(self, arg):
-        if isinstance(arg, list):
-            argstr = stringifyUserArguments(arg)
-        elif isinstance(arg, dict):
-            argstr = stringifyUserArguments(arg)
-        elif isinstance(arg, str):
-            argstr = arg
-        elif isinstance(arg, int):
-            argstr = str(arg)
-        else:
-            raise InvalidArguments('Function accepts only strings, integers, lists and lists thereof.')
-
-        return argstr
-
-    @noArgsFlattening
-    @noKwargs
-    def func_message(self, node, args, kwargs):
-        if len(args) > 1:
-            FeatureNew.single_use('message with more than one argument', '0.54.0', self.subproject)
-        args_str = [self.get_message_string_arg(i) for i in args]
-        self.message_impl(args_str)
-
-    def message_impl(self, args):
-        mlog.log(mlog.bold('Message:'), *args)
-
-    @noArgsFlattening
-    @FeatureNewKwargs('summary', '0.54.0', ['list_sep'])
-    @permittedKwargs({'section', 'bool_yn', 'list_sep'})
-    @FeatureNew('summary', '0.53.0')
-    def func_summary(self, node, args, kwargs):
-        if len(args) == 1:
-            if not isinstance(args[0], dict):
-                raise InterpreterException('Summary first argument must be dictionary.')
-            values = args[0]
-        elif len(args) == 2:
-            if not isinstance(args[0], str):
-                raise InterpreterException('Summary first argument must be string.')
-            values = {args[0]: args[1]}
-        else:
-            raise InterpreterException('Summary accepts at most 2 arguments.')
-        section = kwargs.get('section', '')
-        if not isinstance(section, str):
-            raise InterpreterException('Summary\'s section keyword argument must be string.')
-        self.summary_impl(section, values, kwargs)
-
-    def summary_impl(self, section, values, kwargs):
-        if self.subproject not in self.summary:
-            self.summary[self.subproject] = Summary(self.active_projectname, self.project_version)
-        self.summary[self.subproject].add_section(section, values, kwargs)
-
-    def _print_summary(self):
-        # Add automatic 'Supbrojects' section in main project.
-        all_subprojects = collections.OrderedDict()
-        for name, subp in sorted(self.subprojects.items()):
-            value = subp.found()
-            if subp.disabled_feature:
-                value = [value, 'Feature {!r} disabled'.format(subp.disabled_feature)]
-            elif subp.exception:
-                value = [value, str(subp.exception)]
-            elif subp.warnings > 0:
-                value = [value, '{} warnings'.format(subp.warnings)]
-            all_subprojects[name] = value
-        if all_subprojects:
-            self.summary_impl('Subprojects', all_subprojects,
-                              {'bool_yn': True,
-                               'list_sep': ' ',
-                              })
-        # Print all summaries, main project last.
-        mlog.log('')  # newline
-        main_summary = self.summary.pop('', None)
-        for _, summary in sorted(self.summary.items()):
-            summary.dump()
-        if main_summary:
-            main_summary.dump()
-
-    @noArgsFlattening
-    @FeatureNew('warning', '0.44.0')
-    @noKwargs
-    def func_warning(self, node, args, kwargs):
-        if len(args) > 1:
-            FeatureNew.single_use('warning with more than one argument', '0.54.0', self.subproject)
-        args_str = [self.get_message_string_arg(i) for i in args]
-        mlog.warning(*args_str, location=node)
-
-    @noKwargs
-    def func_error(self, node, args, kwargs):
-        self.validate_arguments(args, 1, [str])
-        raise InterpreterException('Problem encountered: ' + args[0])
-
-    @noKwargs
-    def func_exception(self, node, args, kwargs):
-        self.validate_arguments(args, 0, [])
-        raise Exception()
-
-    def add_languages(self, args: T.Sequence[str], required: bool, for_machine: MachineChoice) -> bool:
-        success = self.add_languages_for(args, required, for_machine)
-        if not self.coredata.is_cross_build():
-            self.coredata.copy_build_options_from_regular_ones()
-        self._redetect_machines()
-        return success
-
-    def should_skip_sanity_check(self, for_machine: MachineChoice) -> bool:
-        should = self.environment.properties.host.get('skip_sanity_check', False)
-        if not isinstance(should, bool):
-            raise InterpreterException('Option skip_sanity_check must be a boolean.')
-        if for_machine != MachineChoice.HOST and not should:
-            return False
-        if not self.environment.is_cross_build() and not should:
-            return False
-        return should
-
-    def add_languages_for(self, args, required, for_machine: MachineChoice):
-        args = [a.lower() for a in args]
-        langs = set(self.coredata.compilers[for_machine].keys())
-        langs.update(args)
-        if 'vala' in langs:
-            if 'c' not in langs:
-                raise InterpreterException('Compiling Vala requires C. Add C to your project languages and rerun Meson.')
-
-        success = True
-        for lang in sorted(args, key=compilers.sort_clink):
-            clist = self.coredata.compilers[for_machine]
-            machine_name = for_machine.get_lower_case_name()
-            if lang in clist:
-                comp = clist[lang]
-            else:
-                try:
-                    comp = self.environment.detect_compiler_for(lang, for_machine)
-                    if comp is None:
-                        raise InvalidArguments('Tried to use unknown language "%s".' % lang)
-                    if self.should_skip_sanity_check(for_machine):
-                        mlog.log_once('Cross compiler sanity tests disabled via the cross file.')
-                    else:
-                        comp.sanity_check(self.environment.get_scratch_dir(), self.environment)
-                except Exception:
-                    if not required:
-                        mlog.log('Compiler for language',
-                                 mlog.bold(lang), 'for the', machine_name,
-                                 'machine not found.')
-                        success = False
-                        continue
-                    else:
-                        raise
-
-            if for_machine == MachineChoice.HOST or self.environment.is_cross_build():
-                logger_fun = mlog.log
-            else:
-                logger_fun = mlog.debug
-            logger_fun(comp.get_display_language(), 'compiler for the', machine_name, 'machine:',
-                       mlog.bold(' '.join(comp.get_exelist())), comp.get_version_string())
-            if comp.linker is not None:
-                logger_fun(comp.get_display_language(), 'linker for the', machine_name, 'machine:',
-                           mlog.bold(' '.join(comp.linker.get_exelist())), comp.linker.id, comp.linker.version)
-            self.build.ensure_static_linker(comp)
-
-        return success
-
-    def program_from_file_for(self, for_machine, prognames):
-        for p in unholder(prognames):
-            if isinstance(p, mesonlib.File):
-                continue # Always points to a local (i.e. self generated) file.
-            if not isinstance(p, str):
-                raise InterpreterException('Executable name must be a string')
-            prog = ExternalProgram.from_bin_list(self.environment, for_machine, p)
-            if prog.found():
-                return ExternalProgramHolder(prog, self.subproject)
-        return None
-
-    def program_from_system(self, args, search_dirs, silent=False):
-        # Search for scripts relative to current subdir.
-        # Do not cache found programs because find_program('foobar')
-        # might give different results when run from different source dirs.
-        source_dir = os.path.join(self.environment.get_source_dir(), self.subdir)
-        for exename in args:
-            if isinstance(exename, mesonlib.File):
-                if exename.is_built:
-                    search_dir = os.path.join(self.environment.get_build_dir(),
-                                              exename.subdir)
-                else:
-                    search_dir = os.path.join(self.environment.get_source_dir(),
-                                              exename.subdir)
-                exename = exename.fname
-                extra_search_dirs = []
-            elif isinstance(exename, str):
-                search_dir = source_dir
-                extra_search_dirs = search_dirs
-            else:
-                raise InvalidArguments('find_program only accepts strings and '
-                                       'files, not {!r}'.format(exename))
-            extprog = dependencies.ExternalProgram(exename, search_dir=search_dir,
-                                                   extra_search_dirs=extra_search_dirs,
-                                                   silent=silent)
-            progobj = ExternalProgramHolder(extprog, self.subproject)
-            if progobj.found():
-                return progobj
-
-    def program_from_overrides(self, command_names, extra_info):
-        for name in command_names:
-            if not isinstance(name, str):
-                continue
-            if name in self.build.find_overrides:
-                exe = self.build.find_overrides[name]
-                extra_info.append(mlog.blue('(overriden)'))
-                return ExternalProgramHolder(exe, self.subproject, self.backend)
-        return None
-
-    def store_name_lookups(self, command_names):
-        for name in command_names:
-            if isinstance(name, str):
-                self.build.searched_programs.add(name)
-
-    def add_find_program_override(self, name, exe):
-        if name in self.build.searched_programs:
-            raise InterpreterException('Tried to override finding of executable "%s" which has already been found.'
-                                       % name)
-        if name in self.build.find_overrides:
-            raise InterpreterException('Tried to override executable "%s" which has already been overridden.'
-                                       % name)
-        self.build.find_overrides[name] = exe
-
-    def notfound_program(self, args):
-        return ExternalProgramHolder(dependencies.NonExistingExternalProgram(' '.join(args)), self.subproject)
-
-    # TODO update modules to always pass `for_machine`. It is bad-form to assume
-    # the host machine.
-    def find_program_impl(self, args, for_machine: MachineChoice = MachineChoice.HOST,
-                          required=True, silent=True, wanted='', search_dirs=None,
-                          version_func=None):
-        args = mesonlib.listify(args)
-
-        extra_info = []
-        progobj = self.program_lookup(args, for_machine, required, search_dirs, extra_info)
-        if progobj is None:
-            progobj = self.notfound_program(args)
-
-        if not progobj.found():
-            mlog.log('Program', mlog.bold(progobj.get_name()), 'found:', mlog.red('NO'))
-            if required:
-                m = 'Program {!r} not found'
-                raise InterpreterException(m.format(progobj.get_name()))
-            return progobj
-
-        if wanted:
-            if version_func:
-                version = version_func(progobj)
-            else:
-                version = progobj.get_version(self)
-            is_found, not_found, found = mesonlib.version_compare_many(version, wanted)
-            if not is_found:
-                mlog.log('Program', mlog.bold(progobj.get_name()), 'found:', mlog.red('NO'),
-                         'found', mlog.normal_cyan(version), 'but need:',
-                         mlog.bold(', '.join(["'{}'".format(e) for e in not_found])))
-                if required:
-                    m = 'Invalid version of program, need {!r} {!r} found {!r}.'
-                    raise InterpreterException(m.format(progobj.get_name(), not_found, version))
-                return self.notfound_program(args)
-            extra_info.insert(0, mlog.normal_cyan(version))
-
-        # Only store successful lookups
-        self.store_name_lookups(args)
-        mlog.log('Program', mlog.bold(progobj.get_name()), 'found:', mlog.green('YES'), *extra_info)
-        return progobj
-
-    def program_lookup(self, args, for_machine, required, search_dirs, extra_info):
-        progobj = self.program_from_overrides(args, extra_info)
-        if progobj:
-            return progobj
-
-        fallback = None
-        wrap_mode = self.coredata.get_builtin_option('wrap_mode')
-        if wrap_mode != WrapMode.nofallback and self.environment.wrap_resolver:
-            fallback = self.environment.wrap_resolver.find_program_provider(args)
-        if fallback and wrap_mode == WrapMode.forcefallback:
-            return self.find_program_fallback(fallback, args, required, extra_info)
-
-        progobj = self.program_from_file_for(for_machine, args)
-        if progobj is None:
-            progobj = self.program_from_system(args, search_dirs, silent=True)
-        if progobj is None and args[0].endswith('python3'):
-            prog = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
-            progobj = ExternalProgramHolder(prog, self.subproject) if prog.found() else None
-        if progobj is None and fallback and required:
-            progobj = self.find_program_fallback(fallback, args, required, extra_info)
-
-        return progobj
-
-    def find_program_fallback(self, fallback, args, required, extra_info):
-        mlog.log('Fallback to subproject', mlog.bold(fallback), 'which provides program',
-                 mlog.bold(' '.join(args)))
-        sp_kwargs = { 'required': required }
-        self.do_subproject(fallback, 'meson', sp_kwargs)
-        return self.program_from_overrides(args, extra_info)
-
-    @FeatureNewKwargs('find_program', '0.53.0', ['dirs'])
-    @FeatureNewKwargs('find_program', '0.52.0', ['version'])
-    @FeatureNewKwargs('find_program', '0.49.0', ['disabler'])
-    @disablerIfNotFound
-    @permittedKwargs(permitted_kwargs['find_program'])
-    def func_find_program(self, node, args, kwargs):
-        if not args:
-            raise InterpreterException('No program name specified.')
-
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject)
-        if disabled:
-            mlog.log('Program', mlog.bold(' '.join(args)), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return self.notfound_program(args)
-
-        search_dirs = extract_search_dirs(kwargs)
-        wanted = mesonlib.stringlistify(kwargs.get('version', []))
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        return self.find_program_impl(args, for_machine, required=required,
-                                      silent=False, wanted=wanted,
-                                      search_dirs=search_dirs)
-
-    def func_find_library(self, node, args, kwargs):
-        raise InvalidCode('find_library() is removed, use meson.get_compiler(\'name\').find_library() instead.\n'
-                          'Look here for documentation: http://mesonbuild.com/Reference-manual.html#compiler-object\n'
-                          'Look here for example: http://mesonbuild.com/howtox.html#add-math-library-lm-portably\n'
-                          )
-
-    def _find_cached_dep(self, name, display_name, kwargs):
-        # Check if we want this as a build-time / build machine or runt-time /
-        # host machine dep.
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        identifier = dependencies.get_dep_identifier(name, kwargs)
-        wanted_vers = mesonlib.stringlistify(kwargs.get('version', []))
-
-        override = self.build.dependency_overrides[for_machine].get(identifier)
-        if override:
-            info = [mlog.blue('(overridden)' if override.explicit else '(cached)')]
-            cached_dep = override.dep
-            # We don't implicitly override not-found dependencies, but user could
-            # have explicitly called meson.override_dependency() with a not-found
-            # dep.
-            if not cached_dep.found():
-                mlog.log('Dependency', mlog.bold(display_name),
-                         'found:', mlog.red('NO'), *info)
-                return identifier, cached_dep
-            found_vers = cached_dep.get_version()
-            if not self.check_version(wanted_vers, found_vers):
-                mlog.log('Dependency', mlog.bold(name),
-                         'found:', mlog.red('NO'),
-                         'found', mlog.normal_cyan(found_vers), 'but need:',
-                         mlog.bold(', '.join(["'{}'".format(e) for e in wanted_vers])),
-                         *info)
-                return identifier, NotFoundDependency(self.environment)
-        else:
-            info = [mlog.blue('(cached)')]
-            cached_dep = self.coredata.deps[for_machine].get(identifier)
-            if cached_dep:
-                found_vers = cached_dep.get_version()
-                if not self.check_version(wanted_vers, found_vers):
-                    return identifier, None
-
-        if cached_dep:
-            if found_vers:
-                info = [mlog.normal_cyan(found_vers), *info]
-            mlog.log('Dependency', mlog.bold(display_name),
-                     'found:', mlog.green('YES'), *info)
-            return identifier, cached_dep
-
-        return identifier, None
-
-    @staticmethod
-    def check_version(wanted, found):
-        if not wanted:
-            return True
-        if found == 'undefined' or not mesonlib.version_compare_many(found, wanted)[0]:
-            return False
-        return True
-
-    def notfound_dependency(self):
-        return DependencyHolder(NotFoundDependency(self.environment), self.subproject)
-
-    def verify_fallback_consistency(self, dirname, varname, cached_dep):
-        subi = self.get_subproject(dirname)
-        if not cached_dep or not varname or not subi or not cached_dep.found():
-            return
-        dep = subi.get_variable_method([varname], {})
-        if dep.held_object != cached_dep:
-            m = 'Inconsistency: Subproject has overridden the dependency with another variable than {!r}'
-            raise DependencyException(m.format(varname))
-
-    def get_subproject_dep(self, name, display_name, dirname, varname, kwargs):
-        required = kwargs.get('required', True)
-        wanted = mesonlib.stringlistify(kwargs.get('version', []))
-        subproj_path = os.path.join(self.subproject_dir, dirname)
-        dep = self.notfound_dependency()
-        try:
-            subproject = self.subprojects[dirname]
-            _, cached_dep = self._find_cached_dep(name, display_name, kwargs)
-            if varname is None:
-                # Assuming the subproject overridden the dependency we want
-                if cached_dep:
-                    if required and not cached_dep.found():
-                        m = 'Dependency {!r} is not satisfied'
-                        raise DependencyException(m.format(display_name))
-                    return DependencyHolder(cached_dep, self.subproject)
-                else:
-                    if required:
-                        m = 'Subproject {} did not override dependency {}'
-                        raise DependencyException(m.format(subproj_path, display_name))
-                    mlog.log('Dependency', mlog.bold(display_name), 'from subproject',
-                             mlog.bold(subproj_path), 'found:', mlog.red('NO'))
-                    return self.notfound_dependency()
-            if subproject.found():
-                self.verify_fallback_consistency(dirname, varname, cached_dep)
-                dep = self.subprojects[dirname].get_variable_method([varname], {})
-        except InvalidArguments:
-            pass
-
-        if not isinstance(dep, DependencyHolder):
-            raise InvalidCode('Fetched variable {!r} in the subproject {!r} is '
-                              'not a dependency object.'.format(varname, dirname))
-
-        if not dep.found():
-            if required:
-                raise DependencyException('Could not find dependency {} in subproject {}'
-                                          ''.format(varname, dirname))
-            # If the dependency is not required, don't raise an exception
-            mlog.log('Dependency', mlog.bold(display_name), 'from subproject',
-                     mlog.bold(subproj_path), 'found:', mlog.red('NO'))
-            return dep
-
-        found = dep.held_object.get_version()
-        if not self.check_version(wanted, found):
-            if required:
-                raise DependencyException('Version {} of subproject dependency {} already '
-                                          'cached, requested incompatible version {} for '
-                                          'dep {}'.format(found, dirname, wanted, display_name))
-
-            mlog.log('Dependency', mlog.bold(display_name), 'from subproject',
-                     mlog.bold(subproj_path), 'found:', mlog.red('NO'),
-                     'found', mlog.normal_cyan(found), 'but need:',
-                     mlog.bold(', '.join(["'{}'".format(e) for e in wanted])))
-            return self.notfound_dependency()
-
-        found = mlog.normal_cyan(found) if found else None
-        mlog.log('Dependency', mlog.bold(display_name), 'from subproject',
-                 mlog.bold(subproj_path), 'found:', mlog.green('YES'), found)
-        return dep
-
-    def _handle_featurenew_dependencies(self, name):
-        'Do a feature check on dependencies used by this subproject'
-        if name == 'mpi':
-            FeatureNew.single_use('MPI Dependency', '0.42.0', self.subproject)
-        elif name == 'pcap':
-            FeatureNew.single_use('Pcap Dependency', '0.42.0', self.subproject)
-        elif name == 'vulkan':
-            FeatureNew.single_use('Vulkan Dependency', '0.42.0', self.subproject)
-        elif name == 'libwmf':
-            FeatureNew.single_use('LibWMF Dependency', '0.44.0', self.subproject)
-        elif name == 'openmp':
-            FeatureNew.single_use('OpenMP Dependency', '0.46.0', self.subproject)
-
-    @FeatureNewKwargs('dependency', '0.54.0', ['components'])
-    @FeatureNewKwargs('dependency', '0.52.0', ['include_type'])
-    @FeatureNewKwargs('dependency', '0.50.0', ['not_found_message', 'cmake_module_path', 'cmake_args'])
-    @FeatureNewKwargs('dependency', '0.49.0', ['disabler'])
-    @FeatureNewKwargs('dependency', '0.40.0', ['method'])
-    @FeatureNewKwargs('dependency', '0.38.0', ['default_options'])
-    @disablerIfNotFound
-    @permittedKwargs(permitted_kwargs['dependency'])
-    def func_dependency(self, node, args, kwargs):
-        self.validate_arguments(args, 1, [str])
-        name = args[0]
-        display_name = name if name else '(anonymous)'
-        mods = extract_as_list(kwargs, 'modules')
-        if mods:
-            display_name += ' (modules: {})'.format(', '.join(str(i) for i in mods))
-        not_found_message = kwargs.get('not_found_message', '')
-        if not isinstance(not_found_message, str):
-            raise InvalidArguments('The not_found_message must be a string.')
-        try:
-            d = self.dependency_impl(name, display_name, kwargs)
-        except Exception:
-            if not_found_message:
-                self.message_impl([not_found_message])
-            raise
-        if not d.found() and not_found_message:
-            self.message_impl([not_found_message])
-            self.message_impl([not_found_message])
-        # Override this dependency to have consistent results in subsequent
-        # dependency lookups.
-        if name and d.found():
-            for_machine = self.machine_from_native_kwarg(kwargs)
-            identifier = dependencies.get_dep_identifier(name, kwargs)
-            if identifier not in self.build.dependency_overrides[for_machine]:
-                self.build.dependency_overrides[for_machine][identifier] = \
-                    build.DependencyOverride(d.held_object, node, explicit=False)
-        return d
-
-    def dependency_impl(self, name, display_name, kwargs):
-        disabled, required, feature = extract_required_kwarg(kwargs, self.subproject)
-        if disabled:
-            mlog.log('Dependency', mlog.bold(display_name), 'skipped: feature', mlog.bold(feature), 'disabled')
-            return self.notfound_dependency()
-
-        has_fallback = 'fallback' in kwargs
-        if not has_fallback and name:
-            # Add an implicit fallback if we have a wrap file or a directory with the same name,
-            # but only if this dependency is required. It is common to first check for a pkg-config,
-            # then fallback to use find_library() and only afterward check again the dependency
-            # with a fallback. If the fallback has already been configured then we have to use it
-            # even if the dependency is not required.
-            provider = self.environment.wrap_resolver.find_dep_provider(name)
-            dirname = mesonlib.listify(provider)[0]
-            if provider and (required or self.get_subproject(dirname)):
-                kwargs['fallback'] = provider
-                has_fallback = True
-
-        if 'default_options' in kwargs and not has_fallback:
-            mlog.warning('The "default_options" keyworg argument does nothing without a "fallback" keyword argument.',
-                         location=self.current_node)
-
-        # writing just "dependency('')" is an error, because it can only fail
-        if name == '' and required and not has_fallback:
-            raise InvalidArguments('Dependency is both required and not-found')
-
-        if '<' in name or '>' in name or '=' in name:
-            raise InvalidArguments('Characters <, > and = are forbidden in dependency names. To specify'
-                                   'version\n requirements use the \'version\' keyword argument instead.')
-
-        identifier, cached_dep = self._find_cached_dep(name, display_name, kwargs)
-        if cached_dep:
-            if has_fallback:
-                dirname, varname = self.get_subproject_infos(kwargs)
-                self.verify_fallback_consistency(dirname, varname, cached_dep)
-            if required and not cached_dep.found():
-                m = 'Dependency {!r} was already checked and was not found'
-                raise DependencyException(m.format(display_name))
-            return DependencyHolder(cached_dep, self.subproject)
-
-        # If the dependency has already been configured, possibly by
-        # a higher level project, try to use it first.
-        if has_fallback:
-            dirname, varname = self.get_subproject_infos(kwargs)
-            if self.get_subproject(dirname):
-                return self.get_subproject_dep(name, display_name, dirname, varname, kwargs)
-
-        wrap_mode = self.coredata.get_builtin_option('wrap_mode')
-        force_fallback_for = self.coredata.get_builtin_option('force_fallback_for')
-        forcefallback = has_fallback and (wrap_mode == WrapMode.forcefallback or \
-                                          name in force_fallback_for or \
-                                          dirname in force_fallback_for)
-        if name != '' and not forcefallback:
-            self._handle_featurenew_dependencies(name)
-            kwargs['required'] = required and not has_fallback
-            dep = dependencies.find_external_dependency(name, self.environment, kwargs)
-            kwargs['required'] = required
-            # Only store found-deps in the cache
-            # Never add fallback deps to self.coredata.deps since we
-            # cannot cache them. They must always be evaluated else
-            # we won't actually read all the build files.
-            if dep.found():
-                for_machine = self.machine_from_native_kwarg(kwargs)
-                self.coredata.deps[for_machine].put(identifier, dep)
-                return DependencyHolder(dep, self.subproject)
-
-        if has_fallback:
-            return self.dependency_fallback(name, display_name, kwargs)
-
-        return self.notfound_dependency()
-
-    @FeatureNew('disabler', '0.44.0')
-    @noKwargs
-    @noPosargs
-    def func_disabler(self, node, args, kwargs):
-        return Disabler()
-
-    def print_nested_info(self, dependency_name):
-        message = ['Dependency', mlog.bold(dependency_name), 'not found but it is available in a sub-subproject.\n' +
-                   'To use it in the current project, promote it by going in the project source\n'
-                   'root and issuing']
-        sprojs = mesonlib.detect_subprojects('subprojects', self.source_root)
-        if dependency_name not in sprojs:
-            return
-        found = sprojs[dependency_name]
-        if len(found) > 1:
-            message.append('one of the following commands:')
-        else:
-            message.append('the following command:')
-        command_templ = '\nmeson wrap promote {}'
-        for l in found:
-            message.append(mlog.bold(command_templ.format(l[len(self.source_root) + 1:])))
-        mlog.warning(*message, location=self.current_node)
-
-    def get_subproject_infos(self, kwargs):
-        fbinfo = mesonlib.stringlistify(kwargs['fallback'])
-        if len(fbinfo) == 1:
-            FeatureNew.single_use('Fallback without variable name', '0.53.0', self.subproject)
-            return fbinfo[0], None
-        elif len(fbinfo) != 2:
-            raise InterpreterException('Fallback info must have one or two items.')
-        return fbinfo
-
-    def dependency_fallback(self, name, display_name, kwargs):
-        dirname, varname = self.get_subproject_infos(kwargs)
-        required = kwargs.get('required', True)
-
-        # Explicitly listed fallback preferences for specific subprojects
-        # take precedence over wrap-mode
-        force_fallback_for = self.coredata.get_builtin_option('force_fallback_for')
-        if name in force_fallback_for or dirname in force_fallback_for:
-            mlog.log('Looking for a fallback subproject for the dependency',
-                     mlog.bold(display_name), 'because:\nUse of fallback was forced for that specific subproject')
-        elif self.coredata.get_builtin_option('wrap_mode') == WrapMode.nofallback:
-            mlog.log('Not looking for a fallback subproject for the dependency',
-                     mlog.bold(display_name), 'because:\nUse of fallback '
-                     'dependencies is disabled.')
-            if required:
-                m = 'Dependency {!r} not found and fallback is disabled'
-                raise DependencyException(m.format(display_name))
-            return self.notfound_dependency()
-        elif self.coredata.get_builtin_option('wrap_mode') == WrapMode.forcefallback:
-            mlog.log('Looking for a fallback subproject for the dependency',
-                     mlog.bold(display_name), 'because:\nUse of fallback dependencies is forced.')
-        else:
-            mlog.log('Looking for a fallback subproject for the dependency',
-                     mlog.bold(display_name))
-        sp_kwargs = {
-            'default_options': kwargs.get('default_options', []),
-            'required': required,
-        }
-        self.do_subproject(dirname, 'meson', sp_kwargs)
-        return self.get_subproject_dep(name, display_name, dirname, varname, kwargs)
-
-    @FeatureNewKwargs('executable', '0.42.0', ['implib'])
-    @permittedKwargs(permitted_kwargs['executable'])
-    def func_executable(self, node, args, kwargs):
-        return self.build_target(node, args, kwargs, ExecutableHolder)
-
-    @permittedKwargs(permitted_kwargs['static_library'])
-    def func_static_lib(self, node, args, kwargs):
-        return self.build_target(node, args, kwargs, StaticLibraryHolder)
-
-    @permittedKwargs(permitted_kwargs['shared_library'])
-    def func_shared_lib(self, node, args, kwargs):
-        holder = self.build_target(node, args, kwargs, SharedLibraryHolder)
-        holder.held_object.shared_library_only = True
-        return holder
-
-    @permittedKwargs(permitted_kwargs['both_libraries'])
-    def func_both_lib(self, node, args, kwargs):
-        return self.build_both_libraries(node, args, kwargs)
-
-    @FeatureNew('shared_module', '0.37.0')
-    @permittedKwargs(permitted_kwargs['shared_module'])
-    def func_shared_module(self, node, args, kwargs):
-        return self.build_target(node, args, kwargs, SharedModuleHolder)
-
-    @permittedKwargs(permitted_kwargs['library'])
-    def func_library(self, node, args, kwargs):
-        return self.build_library(node, args, kwargs)
-
-    @permittedKwargs(permitted_kwargs['jar'])
-    def func_jar(self, node, args, kwargs):
-        return self.build_target(node, args, kwargs, JarHolder)
-
-    @FeatureNewKwargs('build_target', '0.40.0', ['link_whole', 'override_options'])
-    @permittedKwargs(permitted_kwargs['build_target'])
-    def func_build_target(self, node, args, kwargs):
-        if 'target_type' not in kwargs:
-            raise InterpreterException('Missing target_type keyword argument')
-        target_type = kwargs.pop('target_type')
-        if target_type == 'executable':
-            return self.build_target(node, args, kwargs, ExecutableHolder)
-        elif target_type == 'shared_library':
-            return self.build_target(node, args, kwargs, SharedLibraryHolder)
-        elif target_type == 'shared_module':
-            FeatureNew('build_target(target_type: \'shared_module\')',
-                       '0.51.0').use(self.subproject)
-            return self.build_target(node, args, kwargs, SharedModuleHolder)
-        elif target_type == 'static_library':
-            return self.build_target(node, args, kwargs, StaticLibraryHolder)
-        elif target_type == 'both_libraries':
-            return self.build_both_libraries(node, args, kwargs)
-        elif target_type == 'library':
-            return self.build_library(node, args, kwargs)
-        elif target_type == 'jar':
-            return self.build_target(node, args, kwargs, JarHolder)
-        else:
-            raise InterpreterException('Unknown target_type.')
-
-    @permittedKwargs(permitted_kwargs['vcs_tag'])
-    @FeatureDeprecatedKwargs('custom_target', '0.47.0', ['build_always'],
-                             'combine build_by_default and build_always_stale instead.')
-    def func_vcs_tag(self, node, args, kwargs):
-        if 'input' not in kwargs or 'output' not in kwargs:
-            raise InterpreterException('Keyword arguments input and output must exist')
-        if 'fallback' not in kwargs:
-            FeatureNew.single_use('Optional fallback in vcs_tag', '0.41.0', self.subproject)
-        fallback = kwargs.pop('fallback', self.project_version)
-        if not isinstance(fallback, str):
-            raise InterpreterException('Keyword argument fallback must be a string.')
-        replace_string = kwargs.pop('replace_string', '@VCS_TAG@')
-        regex_selector = '(.*)' # default regex selector for custom command: use complete output
-        vcs_cmd = kwargs.get('command', None)
-        if vcs_cmd and not isinstance(vcs_cmd, list):
-            vcs_cmd = [vcs_cmd]
-        source_dir = os.path.normpath(os.path.join(self.environment.get_source_dir(), self.subdir))
-        if vcs_cmd:
-            # Is the command an executable in path or maybe a script in the source tree?
-            vcs_cmd[0] = shutil.which(vcs_cmd[0]) or os.path.join(source_dir, vcs_cmd[0])
-        else:
-            vcs = mesonlib.detect_vcs(source_dir)
-            if vcs:
-                mlog.log('Found %s repository at %s' % (vcs['name'], vcs['wc_dir']))
-                vcs_cmd = vcs['get_rev'].split()
-                regex_selector = vcs['rev_regex']
-            else:
-                vcs_cmd = [' '] # executing this cmd will fail in vcstagger.py and force to use the fallback string
-        # vcstagger.py parameters: infile, outfile, fallback, source_dir, replace_string, regex_selector, command...
-        kwargs['command'] = self.environment.get_build_command() + \
-            ['--internal',
-             'vcstagger',
-             '@INPUT0@',
-             '@OUTPUT0@',
-             fallback,
-             source_dir,
-             replace_string,
-             regex_selector] + vcs_cmd
-        kwargs.setdefault('build_by_default', True)
-        kwargs.setdefault('build_always_stale', True)
-        return self._func_custom_target_impl(node, [kwargs['output']], kwargs)
-
-    @FeatureNew('subdir_done', '0.46.0')
-    @stringArgs
-    def func_subdir_done(self, node, args, kwargs):
-        if len(kwargs) > 0:
-            raise InterpreterException('exit does not take named arguments')
-        if len(args) > 0:
-            raise InterpreterException('exit does not take any arguments')
-        raise SubdirDoneRequest()
-
-    @stringArgs
-    @FeatureNewKwargs('custom_target', '0.48.0', ['console'])
-    @FeatureNewKwargs('custom_target', '0.47.0', ['install_mode', 'build_always_stale'])
-    @FeatureNewKwargs('custom_target', '0.40.0', ['build_by_default'])
-    @permittedKwargs(permitted_kwargs['custom_target'])
-    def func_custom_target(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('custom_target: Only one positional argument is allowed, and it must be a string name')
-        if 'depfile' in kwargs and ('@BASENAME@' in kwargs['depfile'] or '@PLAINNAME@' in kwargs['depfile']):
-            FeatureNew.single_use('substitutions in custom_target depfile', '0.47.0', self.subproject)
-        return self._func_custom_target_impl(node, args, kwargs)
-
-    def _func_custom_target_impl(self, node, args, kwargs):
-        'Implementation-only, without FeatureNew checks, for internal use'
-        name = args[0]
-        kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
-        if 'input' in kwargs:
-            try:
-                kwargs['input'] = self.source_strings_to_files(extract_as_list(kwargs, 'input'))
-            except mesonlib.MesonException:
-                mlog.warning('''Custom target input \'%s\' can\'t be converted to File object(s).
-This will become a hard error in the future.''' % kwargs['input'], location=self.current_node)
-        tg = CustomTargetHolder(build.CustomTarget(name, self.subdir, self.subproject, kwargs, backend=self.backend), self)
-        self.add_target(name, tg.held_object)
-        return tg
-
-    @permittedKwargs(permitted_kwargs['run_target'])
-    def func_run_target(self, node, args, kwargs):
-        if len(args) > 1:
-            raise InvalidCode('Run_target takes only one positional argument: the target name.')
-        elif len(args) == 1:
-            if 'command' not in kwargs:
-                raise InterpreterException('Missing "command" keyword argument')
-            all_args = extract_as_list(kwargs, 'command')
-            deps = unholder(extract_as_list(kwargs, 'depends'))
-        else:
-            raise InterpreterException('Run_target needs at least one positional argument.')
-
-        cleaned_args = []
-        for i in unholder(listify(all_args)):
-            if not isinstance(i, (str, build.BuildTarget, build.CustomTarget, dependencies.ExternalProgram, mesonlib.File)):
-                mlog.debug('Wrong type:', str(i))
-                raise InterpreterException('Invalid argument to run_target.')
-            if isinstance(i, dependencies.ExternalProgram) and not i.found():
-                raise InterpreterException('Tried to use non-existing executable {!r}'.format(i.name))
-            cleaned_args.append(i)
-        name = args[0]
-        if not isinstance(name, str):
-            raise InterpreterException('First argument must be a string.')
-        cleaned_deps = []
-        for d in deps:
-            if not isinstance(d, (build.BuildTarget, build.CustomTarget)):
-                raise InterpreterException('Depends items must be build targets.')
-            cleaned_deps.append(d)
-        command, *cmd_args = cleaned_args
-        tg = RunTargetHolder(build.RunTarget(name, command, cmd_args, cleaned_deps, self.subdir, self.subproject), self)
-        self.add_target(name, tg.held_object)
-        full_name = (self.subproject, name)
-        assert(full_name not in self.build.run_target_names)
-        self.build.run_target_names.add(full_name)
-        return tg
-
-    @FeatureNew('alias_target', '0.52.0')
-    @noKwargs
-    def func_alias_target(self, node, args, kwargs):
-        if len(args) < 2:
-            raise InvalidCode('alias_target takes at least 2 arguments.')
-        name = args[0]
-        if not isinstance(name, str):
-            raise InterpreterException('First argument must be a string.')
-        deps = unholder(listify(args[1:]))
-        for d in deps:
-            if not isinstance(d, (build.BuildTarget, build.CustomTarget)):
-                raise InterpreterException('Depends items must be build targets.')
-        tg = RunTargetHolder(build.AliasTarget(name, deps, self.subdir, self.subproject), self)
-        self.add_target(name, tg.held_object)
-        return tg
-
-    @permittedKwargs(permitted_kwargs['generator'])
-    def func_generator(self, node, args, kwargs):
-        gen = GeneratorHolder(self, args, kwargs)
-        self.generators.append(gen)
-        return gen
-
-    @FeatureNewKwargs('benchmark', '0.46.0', ['depends'])
-    @FeatureNewKwargs('benchmark', '0.52.0', ['priority'])
-    @permittedKwargs(permitted_kwargs['benchmark'])
-    def func_benchmark(self, node, args, kwargs):
-        # is_parallel isn't valid here, so make sure it isn't passed
-        if 'is_parallel' in kwargs:
-            del kwargs['is_parallel']
-        self.add_test(node, args, kwargs, False)
-
-    @FeatureNewKwargs('test', '0.46.0', ['depends'])
-    @FeatureNewKwargs('test', '0.52.0', ['priority'])
-    @permittedKwargs(permitted_kwargs['test'])
-    def func_test(self, node, args, kwargs):
-        if kwargs.get('protocol') == 'gtest':
-            FeatureNew.single_use('"gtest" protocol for tests', '0.55.0', self.subproject)
-        self.add_test(node, args, kwargs, True)
-
-    def unpack_env_kwarg(self, kwargs) -> build.EnvironmentVariables:
-        envlist = kwargs.get('env', EnvironmentVariablesHolder())
-        if isinstance(envlist, EnvironmentVariablesHolder):
-            env = envlist.held_object
-        elif isinstance(envlist, dict):
-            FeatureNew.single_use('environment dictionary', '0.52.0', self.subproject)
-            env = EnvironmentVariablesHolder(envlist)
-            env = env.held_object
-        else:
-            envlist = listify(envlist)
-            # Convert from array to environment object
-            env = EnvironmentVariablesHolder(envlist)
-            env = env.held_object
-        return env
-
-    def add_test(self, node, args, kwargs, is_base_test):
-        if len(args) != 2:
-            raise InterpreterException('test expects 2 arguments, {} given'.format(len(args)))
-        if not isinstance(args[0], str):
-            raise InterpreterException('First argument of test must be a string.')
-        exe = args[1]
-        if not isinstance(exe, (ExecutableHolder, JarHolder, ExternalProgramHolder)):
-            if isinstance(exe, mesonlib.File):
-                exe = self.func_find_program(node, args[1], {})
-            else:
-                raise InterpreterException('Second argument must be executable.')
-        par = kwargs.get('is_parallel', True)
-        if not isinstance(par, bool):
-            raise InterpreterException('Keyword argument is_parallel must be a boolean.')
-        cmd_args = unholder(extract_as_list(kwargs, 'args'))
-        for i in cmd_args:
-            if not isinstance(i, (str, mesonlib.File, build.Target)):
-                raise InterpreterException('Command line arguments must be strings, files or targets.')
-        env = self.unpack_env_kwarg(kwargs)
-        should_fail = kwargs.get('should_fail', False)
-        if not isinstance(should_fail, bool):
-            raise InterpreterException('Keyword argument should_fail must be a boolean.')
-        timeout = kwargs.get('timeout', 30)
-        if 'workdir' in kwargs:
-            workdir = kwargs['workdir']
-            if not isinstance(workdir, str):
-                raise InterpreterException('Workdir keyword argument must be a string.')
-            if not os.path.isabs(workdir):
-                raise InterpreterException('Workdir keyword argument must be an absolute path.')
-        else:
-            workdir = None
-        if not isinstance(timeout, int):
-            raise InterpreterException('Timeout must be an integer.')
-        protocol = kwargs.get('protocol', 'exitcode')
-        if protocol not in {'exitcode', 'tap', 'gtest'}:
-            raise InterpreterException('Protocol must be "exitcode", "tap", or "gtest".')
-        suite = []
-        prj = self.subproject if self.is_subproject() else self.build.project_name
-        for s in mesonlib.stringlistify(kwargs.get('suite', '')):
-            if len(s) > 0:
-                s = ':' + s
-            suite.append(prj.replace(' ', '_').replace(':', '_') + s)
-        depends = unholder(extract_as_list(kwargs, 'depends'))
-        for dep in depends:
-            if not isinstance(dep, (build.CustomTarget, build.BuildTarget)):
-                raise InterpreterException('Depends items must be build targets.')
-        priority = kwargs.get('priority', 0)
-        if not isinstance(priority, int):
-            raise InterpreterException('Keyword argument priority must be an integer.')
-        t = Test(args[0], prj, suite, exe.held_object, depends, par, cmd_args,
-                 env, should_fail, timeout, workdir, protocol, priority)
-        if is_base_test:
-            self.build.tests.append(t)
-            mlog.debug('Adding test', mlog.bold(args[0], True))
-        else:
-            self.build.benchmarks.append(t)
-            mlog.debug('Adding benchmark', mlog.bold(args[0], True))
-
-    @FeatureNewKwargs('install_headers', '0.47.0', ['install_mode'])
-    @permittedKwargs(permitted_kwargs['install_headers'])
-    def func_install_headers(self, node, args, kwargs):
-        source_files = self.source_strings_to_files(args)
-        kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
-        h = Headers(source_files, kwargs)
-        self.build.headers.append(h)
-        return h
-
-    @FeatureNewKwargs('install_man', '0.47.0', ['install_mode'])
-    @permittedKwargs(permitted_kwargs['install_man'])
-    def func_install_man(self, node, args, kwargs):
-        fargs = self.source_strings_to_files(args)
-        kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
-        m = Man(fargs, kwargs)
-        self.build.man.append(m)
-        return m
-
-    @FeatureNewKwargs('subdir', '0.44.0', ['if_found'])
-    @permittedKwargs(permitted_kwargs['subdir'])
-    def func_subdir(self, node, args, kwargs):
-        self.validate_arguments(args, 1, [str])
-        mesonlib.check_direntry_issues(args)
-        if '..' in args[0]:
-            raise InvalidArguments('Subdir contains ..')
-        if self.subdir == '' and args[0] == self.subproject_dir:
-            raise InvalidArguments('Must not go into subprojects dir with subdir(), use subproject() instead.')
-        if self.subdir == '' and args[0].startswith('meson-'):
-            raise InvalidArguments('The "meson-" prefix is reserved and cannot be used for top-level subdir().')
-        for i in mesonlib.extract_as_list(kwargs, 'if_found'):
-            if not hasattr(i, 'found_method'):
-                raise InterpreterException('Object used in if_found does not have a found method.')
-            if not i.found_method([], {}):
-                return
-        prev_subdir = self.subdir
-        subdir = os.path.join(prev_subdir, args[0])
-        if os.path.isabs(subdir):
-            raise InvalidArguments('Subdir argument must be a relative path.')
-        absdir = os.path.join(self.environment.get_source_dir(), subdir)
-        symlinkless_dir = os.path.realpath(absdir)
-        if symlinkless_dir in self.visited_subdirs:
-            raise InvalidArguments('Tried to enter directory "%s", which has already been visited.'
-                                   % subdir)
-        self.visited_subdirs[symlinkless_dir] = True
-        self.subdir = subdir
-        os.makedirs(os.path.join(self.environment.build_dir, subdir), exist_ok=True)
-        buildfilename = os.path.join(self.subdir, environment.build_filename)
-        self.build_def_files.append(buildfilename)
-        absname = os.path.join(self.environment.get_source_dir(), buildfilename)
-        if not os.path.isfile(absname):
-            self.subdir = prev_subdir
-            raise InterpreterException("Non-existent build file '{!s}'".format(buildfilename))
-        with open(absname, encoding='utf8') as f:
-            code = f.read()
-        assert(isinstance(code, str))
-        try:
-            codeblock = mparser.Parser(code, absname).parse()
-        except mesonlib.MesonException as me:
-            me.file = absname
-            raise me
-        try:
-            self.evaluate_codeblock(codeblock)
-        except SubdirDoneRequest:
-            pass
-        self.subdir = prev_subdir
-
-    def _get_kwarg_install_mode(self, kwargs):
-        if kwargs.get('install_mode', None) is None:
-            return None
-        install_mode = []
-        mode = mesonlib.typeslistify(kwargs.get('install_mode', []), (str, int))
-        for m in mode:
-            # We skip any arguments that are set to `false`
-            if m is False:
-                m = None
-            install_mode.append(m)
-        if len(install_mode) > 3:
-            raise InvalidArguments('Keyword argument install_mode takes at '
-                                   'most 3 arguments.')
-        if len(install_mode) > 0 and install_mode[0] is not None and \
-           not isinstance(install_mode[0], str):
-            raise InvalidArguments('Keyword argument install_mode requires the '
-                                   'permissions arg to be a string or false')
-        return FileMode(*install_mode)
-
-    @FeatureNewKwargs('install_data', '0.46.0', ['rename'])
-    @FeatureNewKwargs('install_data', '0.38.0', ['install_mode'])
-    @permittedKwargs(permitted_kwargs['install_data'])
-    def func_install_data(self, node, args, kwargs):
-        kwsource = mesonlib.stringlistify(kwargs.get('sources', []))
-        raw_sources = args + kwsource
-        sources = []
-        source_strings = []
-        for s in raw_sources:
-            if isinstance(s, mesonlib.File):
-                sources.append(s)
-            elif isinstance(s, str):
-                source_strings.append(s)
-            else:
-                raise InvalidArguments('Argument must be string or file.')
-        sources += self.source_strings_to_files(source_strings)
-        install_dir = kwargs.get('install_dir', None)
-        if not isinstance(install_dir, (str, type(None))):
-            raise InvalidArguments('Keyword argument install_dir not a string.')
-        install_mode = self._get_kwarg_install_mode(kwargs)
-        rename = kwargs.get('rename', None)
-        data = DataHolder(build.Data(sources, install_dir, install_mode, rename))
-        self.build.data.append(data.held_object)
-        return data
-
-    @FeatureNewKwargs('install_subdir', '0.42.0', ['exclude_files', 'exclude_directories'])
-    @FeatureNewKwargs('install_subdir', '0.38.0', ['install_mode'])
-    @permittedKwargs(permitted_kwargs['install_subdir'])
-    @stringArgs
-    def func_install_subdir(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InvalidArguments('Install_subdir requires exactly one argument.')
-        subdir = args[0]
-        if 'install_dir' not in kwargs:
-            raise InvalidArguments('Missing keyword argument install_dir')
-        install_dir = kwargs['install_dir']
-        if not isinstance(install_dir, str):
-            raise InvalidArguments('Keyword argument install_dir not a string.')
-        if 'strip_directory' in kwargs:
-            if not isinstance(kwargs['strip_directory'], bool):
-                raise InterpreterException('"strip_directory" keyword must be a boolean.')
-            strip_directory = kwargs['strip_directory']
-        else:
-            strip_directory = False
-        if 'exclude_files' in kwargs:
-            exclude = extract_as_list(kwargs, 'exclude_files')
-            for f in exclude:
-                if not isinstance(f, str):
-                    raise InvalidArguments('Exclude argument not a string.')
-                elif os.path.isabs(f):
-                    raise InvalidArguments('Exclude argument cannot be absolute.')
-            exclude_files = set(exclude)
-        else:
-            exclude_files = set()
-        if 'exclude_directories' in kwargs:
-            exclude = extract_as_list(kwargs, 'exclude_directories')
-            for d in exclude:
-                if not isinstance(d, str):
-                    raise InvalidArguments('Exclude argument not a string.')
-                elif os.path.isabs(d):
-                    raise InvalidArguments('Exclude argument cannot be absolute.')
-            exclude_directories = set(exclude)
-        else:
-            exclude_directories = set()
-        exclude = (exclude_files, exclude_directories)
-        install_mode = self._get_kwarg_install_mode(kwargs)
-        idir = InstallDir(self.subdir, subdir, install_dir, install_mode, exclude, strip_directory)
-        self.build.install_dirs.append(idir)
-        return idir
-
-    @FeatureNewKwargs('configure_file', '0.47.0', ['copy', 'output_format', 'install_mode', 'encoding'])
-    @FeatureNewKwargs('configure_file', '0.46.0', ['format'])
-    @FeatureNewKwargs('configure_file', '0.41.0', ['capture'])
-    @FeatureNewKwargs('configure_file', '0.50.0', ['install'])
-    @FeatureNewKwargs('configure_file', '0.52.0', ['depfile'])
-    @permittedKwargs(permitted_kwargs['configure_file'])
-    def func_configure_file(self, node, args, kwargs):
-        if len(args) > 0:
-            raise InterpreterException("configure_file takes only keyword arguments.")
-        if 'output' not in kwargs:
-            raise InterpreterException('Required keyword argument "output" not defined.')
-        actions = set(['configuration', 'command', 'copy']).intersection(kwargs.keys())
-        if len(actions) == 0:
-            raise InterpreterException('Must specify an action with one of these '
-                                       'keyword arguments: \'configuration\', '
-                                       '\'command\', or \'copy\'.')
-        elif len(actions) == 2:
-            raise InterpreterException('Must not specify both {!r} and {!r} '
-                                       'keyword arguments since they are '
-                                       'mutually exclusive.'.format(*actions))
-        elif len(actions) == 3:
-            raise InterpreterException('Must specify one of {!r}, {!r}, and '
-                                       '{!r} keyword arguments since they are '
-                                       'mutually exclusive.'.format(*actions))
-        if 'capture' in kwargs:
-            if not isinstance(kwargs['capture'], bool):
-                raise InterpreterException('"capture" keyword must be a boolean.')
-            if 'command' not in kwargs:
-                raise InterpreterException('"capture" keyword requires "command" keyword.')
-
-        if 'format' in kwargs:
-            fmt = kwargs['format']
-            if not isinstance(fmt, str):
-                raise InterpreterException('"format" keyword must be a string.')
-        else:
-            fmt = 'meson'
-
-        if fmt not in ('meson', 'cmake', 'cmake@'):
-            raise InterpreterException('"format" possible values are "meson", "cmake" or "cmake@".')
-
-        if 'output_format' in kwargs:
-            output_format = kwargs['output_format']
-            if not isinstance(output_format, str):
-                raise InterpreterException('"output_format" keyword must be a string.')
-        else:
-            output_format = 'c'
-
-        if output_format not in ('c', 'nasm'):
-            raise InterpreterException('"format" possible values are "c" or "nasm".')
-
-        if 'depfile' in kwargs:
-            depfile = kwargs['depfile']
-            if not isinstance(depfile, str):
-                raise InterpreterException('depfile file name must be a string')
-        else:
-            depfile = None
-
-        # Validate input
-        inputs = self.source_strings_to_files(extract_as_list(kwargs, 'input'))
-        inputs_abs = []
-        for f in inputs:
-            if isinstance(f, mesonlib.File):
-                inputs_abs.append(f.absolute_path(self.environment.source_dir,
-                                                  self.environment.build_dir))
-                self.add_build_def_file(f)
-            else:
-                raise InterpreterException('Inputs can only be strings or file objects')
-        # Validate output
-        output = kwargs['output']
-        if not isinstance(output, str):
-            raise InterpreterException('Output file name must be a string')
-        if inputs_abs:
-            values = mesonlib.get_filenames_templates_dict(inputs_abs, None)
-            outputs = mesonlib.substitute_values([output], values)
-            output = outputs[0]
-            if depfile:
-                depfile = mesonlib.substitute_values([depfile], values)[0]
-        ofile_rpath = os.path.join(self.subdir, output)
-        if ofile_rpath in self.configure_file_outputs:
-            mesonbuildfile = os.path.join(self.subdir, 'meson.build')
-            current_call = "{}:{}".format(mesonbuildfile, self.current_lineno)
-            first_call = "{}:{}".format(mesonbuildfile, self.configure_file_outputs[ofile_rpath])
-            mlog.warning('Output file', mlog.bold(ofile_rpath, True), 'for configure_file() at', current_call, 'overwrites configure_file() output at', first_call)
-        else:
-            self.configure_file_outputs[ofile_rpath] = self.current_lineno
-        if os.path.dirname(output) != '':
-            raise InterpreterException('Output file name must not contain a subdirectory.')
-        (ofile_path, ofile_fname) = os.path.split(os.path.join(self.subdir, output))
-        ofile_abs = os.path.join(self.environment.build_dir, ofile_path, ofile_fname)
-        # Perform the appropriate action
-        if 'configuration' in kwargs:
-            conf = kwargs['configuration']
-            if isinstance(conf, dict):
-                FeatureNew.single_use('configure_file.configuration dictionary', '0.49.0', self.subproject)
-                conf = ConfigurationDataHolder(self.subproject, conf)
-            elif not isinstance(conf, ConfigurationDataHolder):
-                raise InterpreterException('Argument "configuration" is not of type configuration_data')
-            mlog.log('Configuring', mlog.bold(output), 'using configuration')
-            if len(inputs) > 1:
-                raise InterpreterException('At most one input file can given in configuration mode')
-            if inputs:
-                os.makedirs(os.path.join(self.environment.build_dir, self.subdir), exist_ok=True)
-                file_encoding = kwargs.setdefault('encoding', 'utf-8')
-                missing_variables, confdata_useless = \
-                    mesonlib.do_conf_file(inputs_abs[0], ofile_abs, conf.held_object,
-                                          fmt, file_encoding)
-                if missing_variables:
-                    var_list = ", ".join(map(repr, sorted(missing_variables)))
-                    mlog.warning(
-                        "The variable(s) %s in the input file '%s' are not "
-                        "present in the given configuration data." % (
-                            var_list, inputs[0]), location=node)
-                if confdata_useless:
-                    ifbase = os.path.basename(inputs_abs[0])
-                    mlog.warning('Got an empty configuration_data() object and found no '
-                                 'substitutions in the input file {!r}. If you want to '
-                                 'copy a file to the build dir, use the \'copy:\' keyword '
-                                 'argument added in 0.47.0'.format(ifbase), location=node)
-            else:
-                mesonlib.dump_conf_header(ofile_abs, conf.held_object, output_format)
-            conf.mark_used()
-        elif 'command' in kwargs:
-            if len(inputs) > 1:
-                FeatureNew.single_use('multiple inputs in configure_file()', '0.52.0', self.subproject)
-            # We use absolute paths for input and output here because the cwd
-            # that the command is run from is 'unspecified', so it could change.
-            # Currently it's builddir/subdir for in_builddir else srcdir/subdir.
-            values = mesonlib.get_filenames_templates_dict(inputs_abs, [ofile_abs])
-            if depfile:
-                depfile = os.path.join(self.environment.get_scratch_dir(), depfile)
-                values['@DEPFILE@'] = depfile
-            # Substitute @INPUT@, @OUTPUT@, etc here.
-            cmd = mesonlib.substitute_values(kwargs['command'], values)
-            mlog.log('Configuring', mlog.bold(output), 'with command')
-            res = self.run_command_impl(node, cmd,  {}, True)
-            if res.returncode != 0:
-                raise InterpreterException('Running configure command failed.\n%s\n%s' %
-                                           (res.stdout, res.stderr))
-            if 'capture' in kwargs and kwargs['capture']:
-                dst_tmp = ofile_abs + '~'
-                file_encoding = kwargs.setdefault('encoding', 'utf-8')
-                with open(dst_tmp, 'w', encoding=file_encoding) as f:
-                    f.writelines(res.stdout)
-                if inputs_abs:
-                    shutil.copymode(inputs_abs[0], dst_tmp)
-                mesonlib.replace_if_different(ofile_abs, dst_tmp)
-            if depfile:
-                mlog.log('Reading depfile:', mlog.bold(depfile))
-                with open(depfile, 'r') as f:
-                    df = DepFile(f.readlines())
-                    deps = df.get_all_dependencies(ofile_fname)
-                    for dep in deps:
-                        self.add_build_def_file(dep)
-
-        elif 'copy' in kwargs:
-            if len(inputs_abs) != 1:
-                raise InterpreterException('Exactly one input file must be given in copy mode')
-            os.makedirs(os.path.join(self.environment.build_dir, self.subdir), exist_ok=True)
-            shutil.copyfile(inputs_abs[0], ofile_abs)
-            shutil.copystat(inputs_abs[0], ofile_abs)
-        else:
-            # Not reachable
-            raise AssertionError
-        # Install file if requested, we check for the empty string
-        # for backwards compatibility. That was the behaviour before
-        # 0.45.0 so preserve it.
-        idir = kwargs.get('install_dir', '')
-        if idir is False:
-            idir = ''
-            mlog.deprecation('Please use the new `install:` kwarg instead of passing '
-                             '`false` to `install_dir:`', location=node)
-        if not isinstance(idir, str):
-            if isinstance(idir, list) and len(idir) == 0:
-                mlog.deprecation('install_dir: kwarg must be a string and not an empty array. '
-                                 'Please use the install: kwarg to enable or disable installation. '
-                                 'This will be a hard error in the next release.')
-            else:
-                raise InterpreterException('"install_dir" must be a string')
-        install = kwargs.get('install', idir != '')
-        if not isinstance(install, bool):
-            raise InterpreterException('"install" must be a boolean')
-        if install:
-            if not idir:
-                raise InterpreterException('"install_dir" must be specified '
-                                           'when "install" in a configure_file '
-                                           'is true')
-            cfile = mesonlib.File.from_built_file(ofile_path, ofile_fname)
-            install_mode = self._get_kwarg_install_mode(kwargs)
-            self.build.data.append(build.Data([cfile], idir, install_mode))
-        return mesonlib.File.from_built_file(self.subdir, output)
-
-    def extract_incdirs(self, kwargs):
-        prospectives = unholder(extract_as_list(kwargs, 'include_directories'))
-        result = []
-        for p in prospectives:
-            if isinstance(p, build.IncludeDirs):
-                result.append(p)
-            elif isinstance(p, str):
-                result.append(self.build_incdir_object([p]).held_object)
-            else:
-                raise InterpreterException('Include directory objects can only be created from strings or include directories.')
-        return result
-
-    @permittedKwargs(permitted_kwargs['include_directories'])
-    @stringArgs
-    def func_include_directories(self, node, args, kwargs):
-        return self.build_incdir_object(args, kwargs.get('is_system', False))
-
-    def build_incdir_object(self, incdir_strings, is_system=False):
-        if not isinstance(is_system, bool):
-            raise InvalidArguments('Is_system must be boolean.')
-        src_root = self.environment.get_source_dir()
-        build_root = self.environment.get_build_dir()
-        absbase_src = os.path.join(src_root, self.subdir)
-        absbase_build = os.path.join(build_root, self.subdir)
-
-        for a in incdir_strings:
-            if a.startswith(src_root):
-                raise InvalidArguments('Tried to form an absolute path to a source dir. '
-                                       'You should not do that but use relative paths instead.'
-                                       '''
-
-To get include path to any directory relative to the current dir do
-
-incdir = include_directories(dirname)
-
-After this incdir will contain both the current source dir as well as the
-corresponding build dir. It can then be used in any subdirectory and
-Meson will take care of all the busywork to make paths work.
-
-Dirname can even be '.' to mark the current directory. Though you should
-remember that the current source and build directories are always
-put in the include directories by default so you only need to do
-include_directories('.') if you intend to use the result in a
-different subdirectory.
-''')
-            absdir_src = os.path.join(absbase_src, a)
-            absdir_build = os.path.join(absbase_build, a)
-            if not os.path.isdir(absdir_src) and not os.path.isdir(absdir_build):
-                raise InvalidArguments('Include dir %s does not exist.' % a)
-        i = IncludeDirsHolder(build.IncludeDirs(self.subdir, incdir_strings, is_system))
-        return i
-
-    @permittedKwargs(permitted_kwargs['add_test_setup'])
-    @stringArgs
-    def func_add_test_setup(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Add_test_setup needs one argument for the setup name.')
-        setup_name = args[0]
-        if re.fullmatch('([_a-zA-Z][_0-9a-zA-Z]*:)?[_a-zA-Z][_0-9a-zA-Z]*', setup_name) is None:
-            raise InterpreterException('Setup name may only contain alphanumeric characters.')
-        if ":" not in setup_name:
-            setup_name = (self.subproject if self.subproject else self.build.project_name) + ":" + setup_name
-        try:
-            inp = unholder(extract_as_list(kwargs, 'exe_wrapper'))
-            exe_wrapper = []
-            for i in inp:
-                if isinstance(i, str):
-                    exe_wrapper.append(i)
-                elif isinstance(i, dependencies.ExternalProgram):
-                    if not i.found():
-                        raise InterpreterException('Tried to use non-found executable.')
-                    exe_wrapper += i.get_command()
-                else:
-                    raise InterpreterException('Exe wrapper can only contain strings or external binaries.')
-        except KeyError:
-            exe_wrapper = None
-        gdb = kwargs.get('gdb', False)
-        if not isinstance(gdb, bool):
-            raise InterpreterException('Gdb option must be a boolean')
-        timeout_multiplier = kwargs.get('timeout_multiplier', 1)
-        if not isinstance(timeout_multiplier, int):
-            raise InterpreterException('Timeout multiplier must be a number.')
-        is_default = kwargs.get('is_default', False)
-        if not isinstance(is_default, bool):
-            raise InterpreterException('is_default option must be a boolean')
-        if is_default:
-            if self.build.test_setup_default_name is not None:
-                raise InterpreterException('\'%s\' is already set as default. '
-                                           'is_default can be set to true only once' % self.build.test_setup_default_name)
-            self.build.test_setup_default_name = setup_name
-        env = self.unpack_env_kwarg(kwargs)
-        self.build.test_setups[setup_name] = build.TestSetup(exe_wrapper, gdb, timeout_multiplier, env)
-
-    @permittedKwargs(permitted_kwargs['add_global_arguments'])
-    @stringArgs
-    def func_add_global_arguments(self, node, args, kwargs):
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        self.add_global_arguments(node, self.build.global_args[for_machine], args, kwargs)
-
-    @permittedKwargs(permitted_kwargs['add_global_link_arguments'])
-    @stringArgs
-    def func_add_global_link_arguments(self, node, args, kwargs):
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        self.add_global_arguments(node, self.build.global_link_args[for_machine], args, kwargs)
-
-    @permittedKwargs(permitted_kwargs['add_project_arguments'])
-    @stringArgs
-    def func_add_project_arguments(self, node, args, kwargs):
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        self.add_project_arguments(node, self.build.projects_args[for_machine], args, kwargs)
-
-    @permittedKwargs(permitted_kwargs['add_project_link_arguments'])
-    @stringArgs
-    def func_add_project_link_arguments(self, node, args, kwargs):
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        self.add_project_arguments(node, self.build.projects_link_args[for_machine], args, kwargs)
-
-    def warn_about_builtin_args(self, args):
-        warnargs = ('/W1', '/W2', '/W3', '/W4', '/Wall', '-Wall', '-Wextra', '-Wpedantic')
-        optargs = ('-O0', '-O2', '-O3', '-Os', '/O1', '/O2', '/Os')
-        for arg in args:
-            if arg in warnargs:
-                mlog.warning('Consider using the built-in warning_level option instead of using "{}".'.format(arg),
-                             location=self.current_node)
-            elif arg in optargs:
-                mlog.warning('Consider using the built-in optimization level instead of using "{}".'.format(arg),
-                             location=self.current_node)
-            elif arg == '-g':
-                mlog.warning('Consider using the built-in debug option instead of using "{}".'.format(arg),
-                             location=self.current_node)
-            elif arg == '-pipe':
-                mlog.warning("You don't need to add -pipe, Meson will use it automatically when it is available.",
-                             location=self.current_node)
-            elif arg.startswith('-fsanitize'):
-                mlog.warning('Consider using the built-in option for sanitizers instead of using "{}".'.format(arg),
-                             location=self.current_node)
-            elif arg.startswith('-std=') or arg.startswith('/std:'):
-                mlog.warning('Consider using the built-in option for language standard version instead of using "{}".'.format(arg),
-                             location=self.current_node)
-
-    def add_global_arguments(self, node, argsdict, args, kwargs):
-        if self.is_subproject():
-            msg = 'Function \'{}\' cannot be used in subprojects because ' \
-                  'there is no way to make that reliable.\nPlease only call ' \
-                  'this if is_subproject() returns false. Alternatively, ' \
-                  'define a variable that\ncontains your language-specific ' \
-                  'arguments and add it to the appropriate *_args kwarg ' \
-                  'in each target.'.format(node.func_name)
-            raise InvalidCode(msg)
-        frozen = self.project_args_frozen or self.global_args_frozen
-        self.add_arguments(node, argsdict, frozen, args, kwargs)
-
-    def add_project_arguments(self, node, argsdict, args, kwargs):
-        if self.subproject not in argsdict:
-            argsdict[self.subproject] = {}
-        self.add_arguments(node, argsdict[self.subproject],
-                           self.project_args_frozen, args, kwargs)
-
-    def add_arguments(self, node, argsdict, args_frozen, args, kwargs):
-        if args_frozen:
-            msg = 'Tried to use \'{}\' after a build target has been declared.\n' \
-                  'This is not permitted. Please declare all ' \
-                  'arguments before your targets.'.format(node.func_name)
-            raise InvalidCode(msg)
-
-        if 'language' not in kwargs:
-            raise InvalidCode('Missing language definition in {}'.format(node.func_name))
-
-        self.warn_about_builtin_args(args)
-
-        for lang in mesonlib.stringlistify(kwargs['language']):
-            lang = lang.lower()
-            argsdict[lang] = argsdict.get(lang, []) + args
-
-    @noKwargs
-    @noArgsFlattening
-    def func_environment(self, node, args, kwargs):
-        if len(args) > 1:
-            raise InterpreterException('environment takes only one optional positional arguments')
-        elif len(args) == 1:
-            FeatureNew.single_use('environment positional arguments', '0.52.0', self.subproject)
-            initial_values = args[0]
-            if not isinstance(initial_values, dict) and not isinstance(initial_values, list):
-                raise InterpreterException('environment first argument must be a dictionary or a list')
-        else:
-            initial_values = {}
-        return EnvironmentVariablesHolder(initial_values)
-
-    @stringArgs
-    @noKwargs
-    def func_join_paths(self, node, args, kwargs):
-        return self.join_path_strings(args)
-
-    def run(self):
-        super().run()
-        mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets))))
-        FeatureNew.report(self.subproject)
-        FeatureDeprecated.report(self.subproject)
-        if not self.is_subproject():
-            self.print_extra_warnings()
-        if self.subproject == '':
-            self._print_summary()
-
-    def print_extra_warnings(self):
-        # TODO cross compilation
-        for c in self.coredata.compilers.host.values():
-            if c.get_id() == 'clang':
-                self.check_clang_asan_lundef()
-                break
-
-    def check_clang_asan_lundef(self):
-        if 'b_lundef' not in self.coredata.base_options:
-            return
-        if 'b_sanitize' not in self.coredata.base_options:
-            return
-        if (self.coredata.base_options['b_lundef'].value and
-                self.coredata.base_options['b_sanitize'].value != 'none'):
-            mlog.warning('''Trying to use {} sanitizer on Clang with b_lundef.
-This will probably not work.
-Try setting b_lundef to false instead.'''.format(self.coredata.base_options['b_sanitize'].value),
-                         location=self.current_node)
-
-    def evaluate_subproject_info(self, path_from_source_root, subproject_dirname):
-        depth = 0
-        subproj_name = ''
-        segs = PurePath(path_from_source_root).parts
-        segs_spd = PurePath(subproject_dirname).parts
-        while segs and segs[0] == segs_spd[0]:
-            if len(segs_spd) == 1:
-                subproj_name = segs[1]
-                segs = segs[2:]
-                depth += 1
-            else:
-                segs_spd = segs_spd[1:]
-                segs = segs[1:]
-        return (depth, subproj_name)
-
-    # Check that the indicated file is within the same subproject
-    # as we currently are. This is to stop people doing
-    # nasty things like:
-    #
-    # f = files('../../master_src/file.c')
-    #
-    # Note that this is validated only when the file
-    # object is generated. The result can be used in a different
-    # subproject than it is defined in (due to e.g. a
-    # declare_dependency).
-    def validate_within_subproject(self, subdir, fname):
-        norm = os.path.normpath(os.path.join(subdir, fname))
-        if os.path.isabs(norm):
-            if not norm.startswith(self.environment.source_dir):
-                # Grabbing files outside the source tree is ok.
-                # This is for vendor stuff like:
-                #
-                # /opt/vendorsdk/src/file_with_license_restrictions.c
-                return
-            norm = os.path.relpath(norm, self.environment.source_dir)
-            assert(not os.path.isabs(norm))
-        (num_sps, sproj_name) = self.evaluate_subproject_info(norm, self.subproject_dir)
-        plain_filename = os.path.basename(norm)
-        if num_sps == 0:
-            if not self.is_subproject():
-                return
-            raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % plain_filename)
-        if num_sps > 1:
-            raise InterpreterException('Sandbox violation: Tried to grab file %s from a nested subproject.' % plain_filename)
-        if sproj_name != self.subproject_directory_name:
-            raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % plain_filename)
-
-    def source_strings_to_files(self, sources):
-        results = []
-        mesonlib.check_direntry_issues(sources)
-        if not isinstance(sources, list):
-            sources = [sources]
-        for s in sources:
-            if isinstance(s, (mesonlib.File, GeneratedListHolder,
-                              TargetHolder, CustomTargetIndexHolder,
-                              GeneratedObjectsHolder)):
-                pass
-            elif isinstance(s, str):
-                self.validate_within_subproject(self.subdir, s)
-                s = mesonlib.File.from_source_file(self.environment.source_dir, self.subdir, s)
-            else:
-                raise InterpreterException('Source item is {!r} instead of '
-                                           'string or File-type object'.format(s))
-            results.append(s)
-        return results
-
-    def add_target(self, name, tobj):
-        if name == '':
-            raise InterpreterException('Target name must not be empty.')
-        if name.strip() == '':
-            raise InterpreterException('Target name must not consist only of whitespace.')
-        if name.startswith('meson-'):
-            raise InvalidArguments("Target names starting with 'meson-' are reserved "
-                                   "for Meson's internal use. Please rename.")
-        if name in coredata.forbidden_target_names:
-            raise InvalidArguments("Target name '%s' is reserved for Meson's "
-                                   "internal use. Please rename." % name)
-        # To permit an executable and a shared library to have the
-        # same name, such as "foo.exe" and "libfoo.a".
-        idname = tobj.get_id()
-        if idname in self.build.targets:
-            raise InvalidCode('Tried to create target "%s", but a target of that name already exists.' % name)
-        self.build.targets[idname] = tobj
-        if idname not in self.coredata.target_guids:
-            self.coredata.target_guids[idname] = str(uuid.uuid4()).upper()
-
-    @FeatureNew('both_libraries', '0.46.0')
-    def build_both_libraries(self, node, args, kwargs):
-        shared_holder = self.build_target(node, args, kwargs, SharedLibraryHolder)
-
-        # Check if user forces non-PIC static library.
-        pic = True
-        if 'pic' in kwargs:
-            pic = kwargs['pic']
-        elif 'b_staticpic' in self.environment.coredata.base_options:
-            pic = self.environment.coredata.base_options['b_staticpic'].value
-
-        if pic:
-            # Exclude sources from args and kwargs to avoid building them twice
-            static_args = [args[0]]
-            static_kwargs = kwargs.copy()
-            static_kwargs['sources'] = []
-            static_kwargs['objects'] = shared_holder.held_object.extract_all_objects()
-        else:
-            static_args = args
-            static_kwargs = kwargs
-
-        static_holder = self.build_target(node, static_args, static_kwargs, StaticLibraryHolder)
-
-        return BothLibrariesHolder(shared_holder, static_holder, self)
-
-    def build_library(self, node, args, kwargs):
-        default_library = self.coredata.get_builtin_option('default_library', self.subproject)
-        if default_library == 'shared':
-            return self.build_target(node, args, kwargs, SharedLibraryHolder)
-        elif default_library == 'static':
-            return self.build_target(node, args, kwargs, StaticLibraryHolder)
-        elif default_library == 'both':
-            return self.build_both_libraries(node, args, kwargs)
-        else:
-            raise InterpreterException('Unknown default_library value: %s.', default_library)
-
-    def build_target(self, node, args, kwargs, targetholder):
-        @FeatureNewKwargs('build target', '0.42.0', ['rust_crate_type', 'build_rpath', 'implicit_include_directories'])
-        @FeatureNewKwargs('build target', '0.41.0', ['rust_args'])
-        @FeatureNewKwargs('build target', '0.40.0', ['build_by_default'])
-        @FeatureNewKwargs('build target', '0.48.0', ['gnu_symbol_visibility'])
-        def build_target_decorator_caller(self, node, args, kwargs):
-            return True
-
-        build_target_decorator_caller(self, node, args, kwargs)
-
-        if not args:
-            raise InterpreterException('Target does not have a name.')
-        name, *sources = args
-        for_machine = self.machine_from_native_kwarg(kwargs)
-        if 'sources' in kwargs:
-            sources += listify(kwargs['sources'])
-        sources = self.source_strings_to_files(sources)
-        objs = extract_as_list(kwargs, 'objects')
-        kwargs['dependencies'] = extract_as_list(kwargs, 'dependencies')
-        kwargs['install_mode'] = self._get_kwarg_install_mode(kwargs)
-        if 'extra_files' in kwargs:
-            ef = extract_as_list(kwargs, 'extra_files')
-            kwargs['extra_files'] = self.source_strings_to_files(ef)
-        self.check_sources_exist(os.path.join(self.source_root, self.subdir), sources)
-        if targetholder == ExecutableHolder:
-            targetclass = build.Executable
-        elif targetholder == SharedLibraryHolder:
-            targetclass = build.SharedLibrary
-        elif targetholder == SharedModuleHolder:
-            targetclass = build.SharedModule
-        elif targetholder == StaticLibraryHolder:
-            targetclass = build.StaticLibrary
-        elif targetholder == JarHolder:
-            targetclass = build.Jar
-        else:
-            mlog.debug('Unknown target type:', str(targetholder))
-            raise RuntimeError('Unreachable code')
-        self.kwarg_strings_to_includedirs(kwargs)
-
-        # Filter out kwargs from other target types. For example 'soversion'
-        # passed to library() when default_library == 'static'.
-        kwargs = {k: v for k, v in kwargs.items() if k in targetclass.known_kwargs}
-
-        kwargs['include_directories'] = self.extract_incdirs(kwargs)
-        target = targetclass(name, self.subdir, self.subproject, for_machine, sources, objs, self.environment, kwargs)
-        target.project_version = self.project_version
-
-        if not self.environment.machines.matches_build_machine(for_machine):
-            self.add_cross_stdlib_info(target)
-        l = targetholder(target, self)
-        self.add_target(name, l.held_object)
-        self.project_args_frozen = True
-        return l
-
-    def kwarg_strings_to_includedirs(self, kwargs):
-        if 'd_import_dirs' in kwargs:
-            items = mesonlib.extract_as_list(kwargs, 'd_import_dirs')
-            cleaned_items = []
-            for i in items:
-                if isinstance(i, str):
-                    # BW compatibility. This was permitted so we must support it
-                    # for a few releases so people can transition to "correct"
-                    # path declarations.
-                    if os.path.normpath(i).startswith(self.environment.get_source_dir()):
-                        mlog.warning('''Building a path to the source dir is not supported. Use a relative path instead.
-This will become a hard error in the future.''', location=self.current_node)
-                        i = os.path.relpath(i, os.path.join(self.environment.get_source_dir(), self.subdir))
-                        i = self.build_incdir_object([i])
-                cleaned_items.append(i)
-            kwargs['d_import_dirs'] = cleaned_items
-
-    def get_used_languages(self, target):
-        result = {}
-        for i in target.sources:
-            # TODO other platforms
-            for lang, c in self.coredata.compilers.host.items():
-                if c.can_compile(i):
-                    result[lang] = True
-                    break
-        return result
-
-    def add_cross_stdlib_info(self, target):
-        if target.for_machine != MachineChoice.HOST:
-            return
-        for l in self.get_used_languages(target):
-            props = self.environment.properties.host
-            if props.has_stdlib(l) \
-                    and self.subproject != props.get_stdlib(l)[0]:
-                target.add_deps(self.build.stdlibs.host[l])
-
-    def check_sources_exist(self, subdir, sources):
-        for s in sources:
-            if not isinstance(s, str):
-                continue # This means a generated source and they always exist.
-            fname = os.path.join(subdir, s)
-            if not os.path.isfile(fname):
-                raise InterpreterException('Tried to add non-existing source file %s.' % s)
-
-    # Only permit object extraction from the same subproject
-    def validate_extraction(self, buildtarget: InterpreterObject) -> None:
-        if not self.subdir.startswith(self.subproject_dir):
-            if buildtarget.subdir.startswith(self.subproject_dir):
-                raise InterpreterException('Tried to extract objects from a subproject target.')
-        else:
-            if not buildtarget.subdir.startswith(self.subproject_dir):
-                raise InterpreterException('Tried to extract objects from the main project from a subproject.')
-            if self.subdir.split('/')[1] != buildtarget.subdir.split('/')[1]:
-                raise InterpreterException('Tried to extract objects from a different subproject.')
-
-    def is_subproject(self):
-        return self.subproject != ''
-
-    @noKwargs
-    @noArgsFlattening
-    def func_set_variable(self, node, args, kwargs):
-        if len(args) != 2:
-            raise InvalidCode('Set_variable takes two arguments.')
-        varname, value = args
-        self.set_variable(varname, value)
-
-    @noKwargs
-    @noArgsFlattening
-    def func_get_variable(self, node, args, kwargs):
-        if len(args) < 1 or len(args) > 2:
-            raise InvalidCode('Get_variable takes one or two arguments.')
-        varname = args[0]
-        if isinstance(varname, Disabler):
-            return varname
-        if not isinstance(varname, str):
-            raise InterpreterException('First argument must be a string.')
-        try:
-            return self.variables[varname]
-        except KeyError:
-            pass
-        if len(args) == 2:
-            return args[1]
-        raise InterpreterException('Tried to get unknown variable "%s".' % varname)
-
-    @stringArgs
-    @noKwargs
-    def func_is_variable(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InvalidCode('Is_variable takes two arguments.')
-        varname = args[0]
-        return varname in self.variables
-
-    @staticmethod
-    def machine_from_native_kwarg(kwargs: T.Dict[str, T.Any]) -> MachineChoice:
-        native = kwargs.get('native', False)
-        if not isinstance(native, bool):
-            raise InvalidArguments('Argument to "native" must be a boolean.')
-        return MachineChoice.BUILD if native else MachineChoice.HOST
-
-    @FeatureNew('is_disabler', '0.52.0')
-    @noKwargs
-    def func_is_disabler(self, node, args, kwargs):
-        if len(args) != 1:
-            raise InvalidCode('Is_disabler takes one argument.')
-        varname = args[0]
-        return isinstance(varname, Disabler)
diff --git a/meson/mesonbuild/interpreterbase.py b/meson/mesonbuild/interpreterbase.py
deleted file mode 100644 (file)
index 39531c1..0000000
+++ /dev/null
@@ -1,1211 +0,0 @@
-# Copyright 2016-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-from . import mparser, mesonlib, mlog
-from . import environment, dependencies
-
-import abc
-import os, copy, re
-import collections.abc
-from functools import wraps
-import typing as T
-
-class InterpreterObject:
-    def __init__(self):
-        self.methods = {}  # type: T.Dict[str, T.Callable]
-        # Current node set during a method call. This can be used as location
-        # when printing a warning message during a method call.
-        self.current_node = None  # type: mparser.BaseNode
-
-    def method_call(self, method_name: str, args: T.List[T.Union[mparser.BaseNode, str, int, float, bool, list, dict, 'InterpreterObject', 'ObjectHolder']], kwargs: T.Dict[str, T.Union[mparser.BaseNode, str, int, float, bool, list, dict, 'InterpreterObject', 'ObjectHolder']]):
-        if method_name in self.methods:
-            method = self.methods[method_name]
-            if not getattr(method, 'no-args-flattening', False):
-                args = flatten(args)
-            return method(args, kwargs)
-        raise InvalidCode('Unknown method "%s" in object.' % method_name)
-
-TV_InterpreterObject = T.TypeVar('TV_InterpreterObject')
-
-class ObjectHolder(T.Generic[TV_InterpreterObject]):
-    def __init__(self, obj: InterpreterObject, subproject: T.Optional[str] = None):
-        self.held_object = obj        # type: InterpreterObject
-        self.subproject = subproject  # type: str
-
-    def __repr__(self):
-        return '<Holder: {!r}>'.format(self.held_object)
-
-TYPE_elementary = T.Union[str, int, float, bool]
-TYPE_var = T.Union[TYPE_elementary, list, dict, InterpreterObject, ObjectHolder]
-TYPE_nvar = T.Union[TYPE_var, mparser.BaseNode]
-TYPE_nkwargs = T.Dict[T.Union[mparser.BaseNode, str], TYPE_nvar]
-
-# Decorators for method calls.
-
-def check_stringlist(a: T.Any, msg: str = 'Arguments must be strings.') -> None:
-    if not isinstance(a, list):
-        mlog.debug('Not a list:', str(a))
-        raise InvalidArguments('Argument not a list.')
-    if not all(isinstance(s, str) for s in a):
-        mlog.debug('Element not a string:', str(a))
-        raise InvalidArguments(msg)
-
-def _get_callee_args(wrapped_args, want_subproject: bool = False):
-    s = wrapped_args[0]
-    n = len(wrapped_args)
-    # Raise an error if the codepaths are not there
-    subproject = None
-    if want_subproject and n == 2:
-        if hasattr(s, 'subproject'):
-            # Interpreter base types have 2 args: self, node
-            node = wrapped_args[1]
-            # args and kwargs are inside the node
-            args = None
-            kwargs = None
-            subproject = s.subproject
-        elif hasattr(wrapped_args[1], 'subproject'):
-            # Module objects have 2 args: self, interpreter
-            node = wrapped_args[1].current_node
-            # args and kwargs are inside the node
-            args = None
-            kwargs = None
-            subproject = wrapped_args[1].subproject
-        else:
-            raise AssertionError('Unknown args: {!r}'.format(wrapped_args))
-    elif n == 3:
-        # Methods on objects (*Holder, MesonMain, etc) have 3 args: self, args, kwargs
-        node = s.current_node
-        args = wrapped_args[1]
-        kwargs = wrapped_args[2]
-        if want_subproject:
-            if hasattr(s, 'subproject'):
-                subproject = s.subproject
-            elif hasattr(s, 'interpreter'):
-                subproject = s.interpreter.subproject
-    elif n == 4:
-        # Meson functions have 4 args: self, node, args, kwargs
-        # Module functions have 4 args: self, state, args, kwargs
-        if isinstance(s, InterpreterBase):
-            node = wrapped_args[1]
-        else:
-            node = wrapped_args[1].current_node
-        args = wrapped_args[2]
-        kwargs = wrapped_args[3]
-        if want_subproject:
-            if isinstance(s, InterpreterBase):
-                subproject = s.subproject
-            else:
-                subproject = wrapped_args[1].subproject
-    elif n == 5:
-        # Module snippets have 5 args: self, interpreter, state, args, kwargs
-        node = wrapped_args[2].current_node
-        args = wrapped_args[3]
-        kwargs = wrapped_args[4]
-        if want_subproject:
-            subproject = wrapped_args[2].subproject
-    else:
-        raise AssertionError('Unknown args: {!r}'.format(wrapped_args))
-    # Sometimes interpreter methods are called internally with None instead of
-    # empty list/dict
-    args = args if args is not None else []
-    kwargs = kwargs if kwargs is not None else {}
-    return s, node, args, kwargs, subproject
-
-def flatten(args: T.Union[TYPE_nvar, T.List[TYPE_nvar]]) -> T.List[TYPE_nvar]:
-    if isinstance(args, mparser.StringNode):
-        assert isinstance(args.value, str)
-        return [args.value]
-    if not isinstance(args, collections.abc.Sequence):
-        return [args]
-    result = []  # type: T.List[TYPE_nvar]
-    for a in args:
-        if isinstance(a, list):
-            rest = flatten(a)
-            result = result + rest
-        elif isinstance(a, mparser.StringNode):
-            result.append(a.value)
-        else:
-            result.append(a)
-    return result
-
-def noPosargs(f):
-    @wraps(f)
-    def wrapped(*wrapped_args, **wrapped_kwargs):
-        args = _get_callee_args(wrapped_args)[2]
-        if args:
-            raise InvalidArguments('Function does not take positional arguments.')
-        return f(*wrapped_args, **wrapped_kwargs)
-    return wrapped
-
-def builtinMethodNoKwargs(f):
-    @wraps(f)
-    def wrapped(*wrapped_args, **wrapped_kwargs):
-        node = wrapped_args[0].current_node
-        method_name = wrapped_args[2]
-        kwargs = wrapped_args[4]
-        if kwargs:
-            mlog.warning('Method {!r} does not take keyword arguments.'.format(method_name),
-                         'This will become a hard error in the future',
-                         location=node)
-        return f(*wrapped_args, **wrapped_kwargs)
-    return wrapped
-
-def noKwargs(f):
-    @wraps(f)
-    def wrapped(*wrapped_args, **wrapped_kwargs):
-        kwargs = _get_callee_args(wrapped_args)[3]
-        if kwargs:
-            raise InvalidArguments('Function does not take keyword arguments.')
-        return f(*wrapped_args, **wrapped_kwargs)
-    return wrapped
-
-def stringArgs(f):
-    @wraps(f)
-    def wrapped(*wrapped_args, **wrapped_kwargs):
-        args = _get_callee_args(wrapped_args)[2]
-        assert(isinstance(args, list))
-        check_stringlist(args)
-        return f(*wrapped_args, **wrapped_kwargs)
-    return wrapped
-
-def noArgsFlattening(f):
-    setattr(f, 'no-args-flattening', True)  # noqa: B010
-    return f
-
-def disablerIfNotFound(f):
-    @wraps(f)
-    def wrapped(*wrapped_args, **wrapped_kwargs):
-        kwargs = _get_callee_args(wrapped_args)[3]
-        disabler = kwargs.pop('disabler', False)
-        ret = f(*wrapped_args, **wrapped_kwargs)
-        if disabler and not ret.held_object.found():
-            return Disabler()
-        return ret
-    return wrapped
-
-class permittedKwargs:
-
-    def __init__(self, permitted: T.Set[str]):
-        self.permitted = permitted  # type: T.Set[str]
-
-    def __call__(self, f):
-        @wraps(f)
-        def wrapped(*wrapped_args, **wrapped_kwargs):
-            s, node, args, kwargs, _ = _get_callee_args(wrapped_args)
-            for k in kwargs:
-                if k not in self.permitted:
-                    mlog.warning('''Passed invalid keyword argument "{}".'''.format(k), location=node)
-                    mlog.warning('This will become a hard error in the future.')
-            return f(*wrapped_args, **wrapped_kwargs)
-        return wrapped
-
-class FeatureCheckBase(metaclass=abc.ABCMeta):
-    "Base class for feature version checks"
-
-    # In python 3.6 we can just forward declare this, but in 3.5 we can't
-    # This will be overwritten by the subclasses by necessity
-    feature_registry = {}  # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
-
-    def __init__(self, feature_name: str, version: str, extra_message: T.Optional[str] = None):
-        self.feature_name = feature_name  # type: str
-        self.feature_version = version    # type: str
-        self.extra_message = extra_message or ''  # type: str
-
-    @staticmethod
-    def get_target_version(subproject: str) -> str:
-        # Don't do any checks if project() has not been parsed yet
-        if subproject not in mesonlib.project_meson_versions:
-            return ''
-        return mesonlib.project_meson_versions[subproject]
-
-    @staticmethod
-    @abc.abstractmethod
-    def check_version(target_version: str, feature_Version: str) -> bool:
-        pass
-
-    def use(self, subproject: str) -> None:
-        tv = self.get_target_version(subproject)
-        # No target version
-        if tv == '':
-            return
-        # Target version is new enough
-        if self.check_version(tv, self.feature_version):
-            return
-        # Feature is too new for target version, register it
-        if subproject not in self.feature_registry:
-            self.feature_registry[subproject] = {self.feature_version: set()}
-        register = self.feature_registry[subproject]
-        if self.feature_version not in register:
-            register[self.feature_version] = set()
-        if self.feature_name in register[self.feature_version]:
-            # Don't warn about the same feature multiple times
-            # FIXME: This is needed to prevent duplicate warnings, but also
-            # means we won't warn about a feature used in multiple places.
-            return
-        register[self.feature_version].add(self.feature_name)
-        self.log_usage_warning(tv)
-
-    @classmethod
-    def report(cls, subproject: str) -> None:
-        if subproject not in cls.feature_registry:
-            return
-        warning_str = cls.get_warning_str_prefix(cls.get_target_version(subproject))
-        fv = cls.feature_registry[subproject]
-        for version in sorted(fv.keys()):
-            warning_str += '\n * {}: {}'.format(version, fv[version])
-        mlog.warning(warning_str)
-
-    def log_usage_warning(self, tv: str) -> None:
-        raise InterpreterException('log_usage_warning not implemented')
-
-    @staticmethod
-    def get_warning_str_prefix(tv: str) -> str:
-        raise InterpreterException('get_warning_str_prefix not implemented')
-
-    def __call__(self, f):
-        @wraps(f)
-        def wrapped(*wrapped_args, **wrapped_kwargs):
-            subproject = _get_callee_args(wrapped_args, want_subproject=True)[4]
-            if subproject is None:
-                raise AssertionError('{!r}'.format(wrapped_args))
-            self.use(subproject)
-            return f(*wrapped_args, **wrapped_kwargs)
-        return wrapped
-
-    @classmethod
-    def single_use(cls, feature_name: str, version: str, subproject: str,
-                   extra_message: T.Optional[str] = None) -> None:
-        """Oneline version that instantiates and calls use()."""
-        cls(feature_name, version, extra_message).use(subproject)
-
-
-class FeatureNew(FeatureCheckBase):
-    """Checks for new features"""
-
-    # Class variable, shared across all instances
-    #
-    # Format: {subproject: {feature_version: set(feature_names)}}
-    feature_registry = {}  # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
-
-    @staticmethod
-    def check_version(target_version: str, feature_version: str) -> bool:
-        return mesonlib.version_compare_condition_with_min(target_version, feature_version)
-
-    @staticmethod
-    def get_warning_str_prefix(tv: str) -> str:
-        return 'Project specifies a minimum meson_version \'{}\' but uses features which were added in newer versions:'.format(tv)
-
-    def log_usage_warning(self, tv: str) -> None:
-        args = [
-            'Project targeting', "'{}'".format(tv),
-            'but tried to use feature introduced in',
-            "'{}':".format(self.feature_version),
-            '{}.'.format(self.feature_name),
-        ]
-        if self.extra_message:
-            args.append(self.extra_message)
-        mlog.warning(*args)
-
-class FeatureDeprecated(FeatureCheckBase):
-    """Checks for deprecated features"""
-
-    # Class variable, shared across all instances
-    #
-    # Format: {subproject: {feature_version: set(feature_names)}}
-    feature_registry = {}  # type: T.ClassVar[T.Dict[str, T.Dict[str, T.Set[str]]]]
-
-    @staticmethod
-    def check_version(target_version: str, feature_version: str) -> bool:
-        # For deprecation checks we need to return the inverse of FeatureNew checks
-        return not mesonlib.version_compare_condition_with_min(target_version, feature_version)
-
-    @staticmethod
-    def get_warning_str_prefix(tv: str) -> str:
-        return 'Deprecated features used:'
-
-    def log_usage_warning(self, tv: str) -> None:
-        args = [
-            'Project targeting', "'{}'".format(tv),
-            'but tried to use feature deprecated since',
-            "'{}':".format(self.feature_version),
-            '{}.'.format(self.feature_name),
-        ]
-        if self.extra_message:
-            args.append(self.extra_message)
-        mlog.warning(*args)
-
-
-class FeatureCheckKwargsBase(metaclass=abc.ABCMeta):
-
-    @property
-    @abc.abstractmethod
-    def feature_check_class(self) -> T.Type[FeatureCheckBase]:
-        pass
-
-    def __init__(self, feature_name: str, feature_version: str,
-                 kwargs: T.List[str], extra_message: T.Optional[str] = None):
-        self.feature_name = feature_name
-        self.feature_version = feature_version
-        self.kwargs = kwargs
-        self.extra_message = extra_message
-
-    def __call__(self, f):
-        @wraps(f)
-        def wrapped(*wrapped_args, **wrapped_kwargs):
-            kwargs, subproject = _get_callee_args(wrapped_args, want_subproject=True)[3:5]
-            if subproject is None:
-                raise AssertionError('{!r}'.format(wrapped_args))
-            for arg in self.kwargs:
-                if arg not in kwargs:
-                    continue
-                name = arg + ' arg in ' + self.feature_name
-                self.feature_check_class.single_use(
-                        name, self.feature_version, subproject, self.extra_message)
-            return f(*wrapped_args, **wrapped_kwargs)
-        return wrapped
-
-class FeatureNewKwargs(FeatureCheckKwargsBase):
-    feature_check_class = FeatureNew
-
-class FeatureDeprecatedKwargs(FeatureCheckKwargsBase):
-    feature_check_class = FeatureDeprecated
-
-
-class InterpreterException(mesonlib.MesonException):
-    pass
-
-class InvalidCode(InterpreterException):
-    pass
-
-class InvalidArguments(InterpreterException):
-    pass
-
-class SubdirDoneRequest(BaseException):
-    pass
-
-class ContinueRequest(BaseException):
-    pass
-
-class BreakRequest(BaseException):
-    pass
-
-class MutableInterpreterObject(InterpreterObject):
-    def __init__(self):
-        super().__init__()
-
-class Disabler(InterpreterObject):
-    def __init__(self):
-        super().__init__()
-        self.methods.update({'found': self.found_method})
-
-    def found_method(self, args, kwargs):
-        return False
-
-def is_disabler(i) -> bool:
-    return isinstance(i, Disabler)
-
-def is_arg_disabled(arg) -> bool:
-    if is_disabler(arg):
-        return True
-    if isinstance(arg, list):
-        for i in arg:
-            if is_arg_disabled(i):
-                return True
-    return False
-
-def is_disabled(args, kwargs) -> bool:
-    for i in args:
-        if is_arg_disabled(i):
-            return True
-    for i in kwargs.values():
-        if is_arg_disabled(i):
-            return True
-    return False
-
-class InterpreterBase:
-    elementary_types = (int, float, str, bool, list)
-
-    def __init__(self, source_root: str, subdir: str, subproject: str):
-        self.source_root = source_root
-        self.funcs = {}    # type: T.Dict[str, T.Callable[[mparser.BaseNode, T.List[TYPE_nvar], T.Dict[str, TYPE_nvar]], TYPE_var]]
-        self.builtin = {}  # type: T.Dict[str, InterpreterObject]
-        self.subdir = subdir
-        self.subproject = subproject
-        self.variables = {}  # type: T.Dict[str, TYPE_var]
-        self.argument_depth = 0
-        self.current_lineno = -1
-        # Current node set during a function call. This can be used as location
-        # when printing a warning message during a method call.
-        self.current_node = None  # type: mparser.BaseNode
-
-    def load_root_meson_file(self) -> None:
-        mesonfile = os.path.join(self.source_root, self.subdir, environment.build_filename)
-        if not os.path.isfile(mesonfile):
-            raise InvalidArguments('Missing Meson file in %s' % mesonfile)
-        with open(mesonfile, encoding='utf8') as mf:
-            code = mf.read()
-        if code.isspace():
-            raise InvalidCode('Builder file is empty.')
-        assert(isinstance(code, str))
-        try:
-            self.ast = mparser.Parser(code, mesonfile).parse()
-        except mesonlib.MesonException as me:
-            me.file = mesonfile
-            raise me
-
-    def join_path_strings(self, args: T.Sequence[str]) -> str:
-        return os.path.join(*args).replace('\\', '/')
-
-    def parse_project(self) -> None:
-        """
-        Parses project() and initializes languages, compilers etc. Do this
-        early because we need this before we parse the rest of the AST.
-        """
-        self.evaluate_codeblock(self.ast, end=1)
-
-    def sanity_check_ast(self) -> None:
-        if not isinstance(self.ast, mparser.CodeBlockNode):
-            raise InvalidCode('AST is of invalid type. Possibly a bug in the parser.')
-        if not self.ast.lines:
-            raise InvalidCode('No statements in code.')
-        first = self.ast.lines[0]
-        if not isinstance(first, mparser.FunctionNode) or first.func_name != 'project':
-            raise InvalidCode('First statement must be a call to project')
-
-    def run(self) -> None:
-        # Evaluate everything after the first line, which is project() because
-        # we already parsed that in self.parse_project()
-        try:
-            self.evaluate_codeblock(self.ast, start=1)
-        except SubdirDoneRequest:
-            pass
-
-    def evaluate_codeblock(self, node: mparser.CodeBlockNode, start: int = 0, end: T.Optional[int] = None) -> None:
-        if node is None:
-            return
-        if not isinstance(node, mparser.CodeBlockNode):
-            e = InvalidCode('Tried to execute a non-codeblock. Possibly a bug in the parser.')
-            e.lineno = node.lineno
-            e.colno = node.colno
-            raise e
-        statements = node.lines[start:end]
-        i = 0
-        while i < len(statements):
-            cur = statements[i]
-            try:
-                self.current_lineno = cur.lineno
-                self.evaluate_statement(cur)
-            except Exception as e:
-                if getattr(e, 'lineno', None) is None:
-                    # We are doing the equivalent to setattr here and mypy does not like it
-                    e.lineno = cur.lineno                                                             # type: ignore
-                    e.colno = cur.colno                                                               # type: ignore
-                    e.file = os.path.join(self.source_root, self.subdir, environment.build_filename)  # type: ignore
-                raise e
-            i += 1 # In THE FUTURE jump over blocks and stuff.
-
-    def evaluate_statement(self, cur: mparser.BaseNode) -> T.Optional[TYPE_var]:
-        self.current_node = cur
-        if isinstance(cur, mparser.FunctionNode):
-            return self.function_call(cur)
-        elif isinstance(cur, mparser.AssignmentNode):
-            self.assignment(cur)
-        elif isinstance(cur, mparser.MethodNode):
-            return self.method_call(cur)
-        elif isinstance(cur, mparser.StringNode):
-            return cur.value
-        elif isinstance(cur, mparser.BooleanNode):
-            return cur.value
-        elif isinstance(cur, mparser.IfClauseNode):
-            return self.evaluate_if(cur)
-        elif isinstance(cur, mparser.IdNode):
-            return self.get_variable(cur.value)
-        elif isinstance(cur, mparser.ComparisonNode):
-            return self.evaluate_comparison(cur)
-        elif isinstance(cur, mparser.ArrayNode):
-            return self.evaluate_arraystatement(cur)
-        elif isinstance(cur, mparser.DictNode):
-            return self.evaluate_dictstatement(cur)
-        elif isinstance(cur, mparser.NumberNode):
-            return cur.value
-        elif isinstance(cur, mparser.AndNode):
-            return self.evaluate_andstatement(cur)
-        elif isinstance(cur, mparser.OrNode):
-            return self.evaluate_orstatement(cur)
-        elif isinstance(cur, mparser.NotNode):
-            return self.evaluate_notstatement(cur)
-        elif isinstance(cur, mparser.UMinusNode):
-            return self.evaluate_uminusstatement(cur)
-        elif isinstance(cur, mparser.ArithmeticNode):
-            return self.evaluate_arithmeticstatement(cur)
-        elif isinstance(cur, mparser.ForeachClauseNode):
-            self.evaluate_foreach(cur)
-        elif isinstance(cur, mparser.PlusAssignmentNode):
-            self.evaluate_plusassign(cur)
-        elif isinstance(cur, mparser.IndexNode):
-            return self.evaluate_indexing(cur)
-        elif isinstance(cur, mparser.TernaryNode):
-            return self.evaluate_ternary(cur)
-        elif isinstance(cur, mparser.ContinueNode):
-            raise ContinueRequest()
-        elif isinstance(cur, mparser.BreakNode):
-            raise BreakRequest()
-        elif isinstance(cur, self.elementary_types):
-            return cur
-        else:
-            raise InvalidCode("Unknown statement.")
-        return None
-
-    def evaluate_arraystatement(self, cur: mparser.ArrayNode) -> list:
-        (arguments, kwargs) = self.reduce_arguments(cur.args)
-        if len(kwargs) > 0:
-            raise InvalidCode('Keyword arguments are invalid in array construction.')
-        return arguments
-
-    @FeatureNew('dict', '0.47.0')
-    def evaluate_dictstatement(self, cur: mparser.DictNode) -> T.Dict[str, T.Any]:
-        (arguments, kwargs) = self.reduce_arguments(cur.args, resolve_key_nodes=False)
-        assert (not arguments)
-        result = {}  # type: T.Dict[str, T.Any]
-        self.argument_depth += 1
-        for key, value in kwargs.items():
-            if not isinstance(key, mparser.StringNode):
-                FeatureNew.single_use('Dictionary entry using non literal key', '0.53.0', self.subproject)
-            assert isinstance(key, mparser.BaseNode)  # All keys must be nodes due to resolve_key_nodes=False
-            str_key = self.evaluate_statement(key)
-            if not isinstance(str_key, str):
-                raise InvalidArguments('Key must be a string')
-            if str_key in result:
-                raise InvalidArguments('Duplicate dictionary key: {}'.format(str_key))
-            result[str_key] = value
-        self.argument_depth -= 1
-        return result
-
-    def evaluate_notstatement(self, cur: mparser.NotNode) -> T.Union[bool, Disabler]:
-        v = self.evaluate_statement(cur.value)
-        if isinstance(v, Disabler):
-            return v
-        if not isinstance(v, bool):
-            raise InterpreterException('Argument to "not" is not a boolean.')
-        return not v
-
-    def evaluate_if(self, node: mparser.IfClauseNode) -> T.Optional[Disabler]:
-        assert(isinstance(node, mparser.IfClauseNode))
-        for i in node.ifs:
-            result = self.evaluate_statement(i.condition)
-            if isinstance(result, Disabler):
-                return result
-            if not(isinstance(result, bool)):
-                raise InvalidCode('If clause {!r} does not evaluate to true or false.'.format(result))
-            if result:
-                self.evaluate_codeblock(i.block)
-                return None
-        if not isinstance(node.elseblock, mparser.EmptyNode):
-            self.evaluate_codeblock(node.elseblock)
-        return None
-
-    def validate_comparison_types(self, val1: T.Any, val2: T.Any) -> bool:
-        if type(val1) != type(val2):
-            return False
-        return True
-
-    def evaluate_in(self, val1: T.Any, val2: T.Any) -> bool:
-        if not isinstance(val1, (str, int, float, ObjectHolder)):
-            raise InvalidArguments('lvalue of "in" operator must be a string, integer, float, or object')
-        if not isinstance(val2, (list, dict)):
-            raise InvalidArguments('rvalue of "in" operator must be an array or a dict')
-        return val1 in val2
-
-    def evaluate_comparison(self, node: mparser.ComparisonNode) -> T.Union[bool, Disabler]:
-        val1 = self.evaluate_statement(node.left)
-        if isinstance(val1, Disabler):
-            return val1
-        val2 = self.evaluate_statement(node.right)
-        if isinstance(val2, Disabler):
-            return val2
-        if node.ctype == 'in':
-            return self.evaluate_in(val1, val2)
-        elif node.ctype == 'notin':
-            return not self.evaluate_in(val1, val2)
-        valid = self.validate_comparison_types(val1, val2)
-        # Ordering comparisons of different types isn't allowed since PR #1810
-        # (0.41.0).  Since PR #2884 we also warn about equality comparisons of
-        # different types, which will one day become an error.
-        if not valid and (node.ctype == '==' or node.ctype == '!='):
-            mlog.warning('''Trying to compare values of different types ({}, {}) using {}.
-The result of this is undefined and will become a hard error in a future Meson release.'''
-                         .format(type(val1).__name__, type(val2).__name__, node.ctype), location=node)
-        if node.ctype == '==':
-            return val1 == val2
-        elif node.ctype == '!=':
-            return val1 != val2
-        elif not valid:
-            raise InterpreterException(
-                'Values of different types ({}, {}) cannot be compared using {}.'.format(type(val1).__name__,
-                                                                                         type(val2).__name__,
-                                                                                         node.ctype))
-        elif not isinstance(val1, self.elementary_types):
-            raise InterpreterException('{} can only be compared for equality.'.format(getattr(node.left, 'value', '<ERROR>')))
-        elif not isinstance(val2, self.elementary_types):
-            raise InterpreterException('{} can only be compared for equality.'.format(getattr(node.right, 'value', '<ERROR>')))
-        # Use type: ignore because mypy will complain that we are comparing two Unions,
-        # but we actually guarantee earlier that both types are the same
-        elif node.ctype == '<':
-            return val1 < val2   # type: ignore
-        elif node.ctype == '<=':
-            return val1 <= val2  # type: ignore
-        elif node.ctype == '>':
-            return val1 > val2   # type: ignore
-        elif node.ctype == '>=':
-            return val1 >= val2  # type: ignore
-        else:
-            raise InvalidCode('You broke my compare eval.')
-
-    def evaluate_andstatement(self, cur: mparser.AndNode) -> T.Union[bool, Disabler]:
-        l = self.evaluate_statement(cur.left)
-        if isinstance(l, Disabler):
-            return l
-        if not isinstance(l, bool):
-            raise InterpreterException('First argument to "and" is not a boolean.')
-        if not l:
-            return False
-        r = self.evaluate_statement(cur.right)
-        if isinstance(r, Disabler):
-            return r
-        if not isinstance(r, bool):
-            raise InterpreterException('Second argument to "and" is not a boolean.')
-        return r
-
-    def evaluate_orstatement(self, cur: mparser.OrNode) -> T.Union[bool, Disabler]:
-        l = self.evaluate_statement(cur.left)
-        if isinstance(l, Disabler):
-            return l
-        if not isinstance(l, bool):
-            raise InterpreterException('First argument to "or" is not a boolean.')
-        if l:
-            return True
-        r = self.evaluate_statement(cur.right)
-        if isinstance(r, Disabler):
-            return r
-        if not isinstance(r, bool):
-            raise InterpreterException('Second argument to "or" is not a boolean.')
-        return r
-
-    def evaluate_uminusstatement(self, cur) -> T.Union[int, Disabler]:
-        v = self.evaluate_statement(cur.value)
-        if isinstance(v, Disabler):
-            return v
-        if not isinstance(v, int):
-            raise InterpreterException('Argument to negation is not an integer.')
-        return -v
-
-    @FeatureNew('/ with string arguments', '0.49.0')
-    def evaluate_path_join(self, l: str, r: str) -> str:
-        if not isinstance(l, str):
-            raise InvalidCode('The division operator can only append to a string.')
-        if not isinstance(r, str):
-            raise InvalidCode('The division operator can only append a string.')
-        return self.join_path_strings((l, r))
-
-    def evaluate_division(self, l: T.Any, r: T.Any) -> T.Union[int, str]:
-        if isinstance(l, str) or isinstance(r, str):
-            return self.evaluate_path_join(l, r)
-        if isinstance(l, int) and isinstance(r, int):
-            if r == 0:
-                raise InvalidCode('Division by zero.')
-            return l // r
-        raise InvalidCode('Division works only with strings or integers.')
-
-    def evaluate_arithmeticstatement(self, cur: mparser.ArithmeticNode) -> T.Union[int, str, dict, list, Disabler]:
-        l = self.evaluate_statement(cur.left)
-        if isinstance(l, Disabler):
-            return l
-        r = self.evaluate_statement(cur.right)
-        if isinstance(r, Disabler):
-            return r
-
-        if cur.operation == 'add':
-            if isinstance(l, dict) and isinstance(r, dict):
-                return {**l, **r}
-            try:
-                # MyPy error due to handling two Unions (we are catching all exceptions anyway)
-                return l + r  # type: ignore
-            except Exception as e:
-                raise InvalidCode('Invalid use of addition: ' + str(e))
-        elif cur.operation == 'sub':
-            if not isinstance(l, int) or not isinstance(r, int):
-                raise InvalidCode('Subtraction works only with integers.')
-            return l - r
-        elif cur.operation == 'mul':
-            if not isinstance(l, int) or not isinstance(r, int):
-                raise InvalidCode('Multiplication works only with integers.')
-            return l * r
-        elif cur.operation == 'div':
-            return self.evaluate_division(l, r)
-        elif cur.operation == 'mod':
-            if not isinstance(l, int) or not isinstance(r, int):
-                raise InvalidCode('Modulo works only with integers.')
-            return l % r
-        else:
-            raise InvalidCode('You broke me.')
-
-    def evaluate_ternary(self, node: mparser.TernaryNode) -> TYPE_var:
-        assert(isinstance(node, mparser.TernaryNode))
-        result = self.evaluate_statement(node.condition)
-        if isinstance(result, Disabler):
-            return result
-        if not isinstance(result, bool):
-            raise InterpreterException('Ternary condition is not boolean.')
-        if result:
-            return self.evaluate_statement(node.trueblock)
-        else:
-            return self.evaluate_statement(node.falseblock)
-
-    def evaluate_foreach(self, node: mparser.ForeachClauseNode) -> None:
-        assert(isinstance(node, mparser.ForeachClauseNode))
-        items = self.evaluate_statement(node.items)
-
-        if isinstance(items, list):
-            if len(node.varnames) != 1:
-                raise InvalidArguments('Foreach on array does not unpack')
-            varname = node.varnames[0]
-            for item in items:
-                self.set_variable(varname, item)
-                try:
-                    self.evaluate_codeblock(node.block)
-                except ContinueRequest:
-                    continue
-                except BreakRequest:
-                    break
-        elif isinstance(items, dict):
-            if len(node.varnames) != 2:
-                raise InvalidArguments('Foreach on dict unpacks key and value')
-            for key, value in items.items():
-                self.set_variable(node.varnames[0], key)
-                self.set_variable(node.varnames[1], value)
-                try:
-                    self.evaluate_codeblock(node.block)
-                except ContinueRequest:
-                    continue
-                except BreakRequest:
-                    break
-        else:
-            raise InvalidArguments('Items of foreach loop must be an array or a dict')
-
-    def evaluate_plusassign(self, node: mparser.PlusAssignmentNode) -> None:
-        assert(isinstance(node, mparser.PlusAssignmentNode))
-        varname = node.var_name
-        addition = self.evaluate_statement(node.value)
-
-        # Remember that all variables are immutable. We must always create a
-        # full new variable and then assign it.
-        old_variable = self.get_variable(varname)
-        new_value = None  # type: T.Union[str, int, float, bool, dict, list]
-        if isinstance(old_variable, str):
-            if not isinstance(addition, str):
-                raise InvalidArguments('The += operator requires a string on the right hand side if the variable on the left is a string')
-            new_value = old_variable + addition
-        elif isinstance(old_variable, int):
-            if not isinstance(addition, int):
-                raise InvalidArguments('The += operator requires an int on the right hand side if the variable on the left is an int')
-            new_value = old_variable + addition
-        elif isinstance(old_variable, list):
-            if isinstance(addition, list):
-                new_value = old_variable + addition
-            else:
-                new_value = old_variable + [addition]
-        elif isinstance(old_variable, dict):
-            if not isinstance(addition, dict):
-                raise InvalidArguments('The += operator requires a dict on the right hand side if the variable on the left is a dict')
-            new_value = {**old_variable, **addition}
-        # Add other data types here.
-        else:
-            raise InvalidArguments('The += operator currently only works with arrays, dicts, strings or ints')
-        self.set_variable(varname, new_value)
-
-    def evaluate_indexing(self, node: mparser.IndexNode) -> TYPE_var:
-        assert(isinstance(node, mparser.IndexNode))
-        iobject = self.evaluate_statement(node.iobject)
-        if isinstance(iobject, Disabler):
-            return iobject
-        if not hasattr(iobject, '__getitem__'):
-            raise InterpreterException(
-                'Tried to index an object that doesn\'t support indexing.')
-        index = self.evaluate_statement(node.index)
-
-        if isinstance(iobject, dict):
-            if not isinstance(index, str):
-                raise InterpreterException('Key is not a string')
-            try:
-                return iobject[index]
-            except KeyError:
-                raise InterpreterException('Key %s is not in dict' % index)
-        else:
-            if not isinstance(index, int):
-                raise InterpreterException('Index value is not an integer.')
-            try:
-                # Ignore the MyPy error, since we don't know all indexable types here
-                # and we handle non indexable types with an exception
-                # TODO maybe find a better solution
-                return iobject[index]  # type: ignore
-            except IndexError:
-                # We are already checking for the existance of __getitem__, so this should be save
-                raise InterpreterException('Index %d out of bounds of array of size %d.' % (index, len(iobject)))  # type: ignore
-
-    def function_call(self, node: mparser.FunctionNode) -> T.Optional[TYPE_var]:
-        func_name = node.func_name
-        (posargs, kwargs) = self.reduce_arguments(node.args)
-        if is_disabled(posargs, kwargs) and func_name not in {'get_variable', 'set_variable', 'is_disabler'}:
-            return Disabler()
-        if func_name in self.funcs:
-            func = self.funcs[func_name]
-            func_args = posargs  # type: T.Any
-            if not getattr(func, 'no-args-flattening', False):
-                func_args = flatten(posargs)
-            return func(node, func_args, self.kwargs_string_keys(kwargs))
-        else:
-            self.unknown_function_called(func_name)
-            return None
-
-    def method_call(self, node: mparser.MethodNode) -> TYPE_var:
-        invokable = node.source_object
-        if isinstance(invokable, mparser.IdNode):
-            object_name = invokable.value
-            obj = self.get_variable(object_name)
-        else:
-            obj = self.evaluate_statement(invokable)
-        method_name = node.name
-        (args, kwargs) = self.reduce_arguments(node.args)
-        if is_disabled(args, kwargs):
-            return Disabler()
-        if isinstance(obj, str):
-            return self.string_method_call(obj, method_name, args, kwargs)
-        if isinstance(obj, bool):
-            return self.bool_method_call(obj, method_name, args, kwargs)
-        if isinstance(obj, int):
-            return self.int_method_call(obj, method_name, args, kwargs)
-        if isinstance(obj, list):
-            return self.array_method_call(obj, method_name, args, kwargs)
-        if isinstance(obj, dict):
-            return self.dict_method_call(obj, method_name, args, kwargs)
-        if isinstance(obj, mesonlib.File):
-            raise InvalidArguments('File object "%s" is not callable.' % obj)
-        if not isinstance(obj, InterpreterObject):
-            raise InvalidArguments('Variable "%s" is not callable.' % object_name)
-        # Special case. This is the only thing you can do with a disabler
-        # object. Every other use immediately returns the disabler object.
-        if isinstance(obj, Disabler):
-            if method_name == 'found':
-                return False
-            else:
-                return Disabler()
-        if method_name == 'extract_objects':
-            if not isinstance(obj, ObjectHolder):
-                raise InvalidArguments('Invalid operation "extract_objects" on variable "{}"'.format(object_name))
-            self.validate_extraction(obj.held_object)
-        obj.current_node = node
-        return obj.method_call(method_name, args, self.kwargs_string_keys(kwargs))
-
-    @builtinMethodNoKwargs
-    def bool_method_call(self, obj: bool, method_name: str, posargs: T.List[TYPE_nvar], kwargs: T.Dict[str, T.Any]) -> T.Union[str, int]:
-        if method_name == 'to_string':
-            if not posargs:
-                if obj:
-                    return 'true'
-                else:
-                    return 'false'
-            elif len(posargs) == 2 and isinstance(posargs[0], str) and isinstance(posargs[1], str):
-                if obj:
-                    return posargs[0]
-                else:
-                    return posargs[1]
-            else:
-                raise InterpreterException('bool.to_string() must have either no arguments or exactly two string arguments that signify what values to return for true and false.')
-        elif method_name == 'to_int':
-            if obj:
-                return 1
-            else:
-                return 0
-        else:
-            raise InterpreterException('Unknown method "%s" for a boolean.' % method_name)
-
-    @builtinMethodNoKwargs
-    def int_method_call(self, obj: int, method_name: str, posargs: T.List[TYPE_nvar], kwargs: T.Dict[str, T.Any]) -> T.Union[str, bool]:
-        if method_name == 'is_even':
-            if not posargs:
-                return obj % 2 == 0
-            else:
-                raise InterpreterException('int.is_even() must have no arguments.')
-        elif method_name == 'is_odd':
-            if not posargs:
-                return obj % 2 != 0
-            else:
-                raise InterpreterException('int.is_odd() must have no arguments.')
-        elif method_name == 'to_string':
-            if not posargs:
-                return str(obj)
-            else:
-                raise InterpreterException('int.to_string() must have no arguments.')
-        else:
-            raise InterpreterException('Unknown method "%s" for an integer.' % method_name)
-
-    @staticmethod
-    def _get_one_string_posarg(posargs: T.List[TYPE_nvar], method_name: str) -> str:
-        if len(posargs) > 1:
-            m = '{}() must have zero or one arguments'
-            raise InterpreterException(m.format(method_name))
-        elif len(posargs) == 1:
-            s = posargs[0]
-            if not isinstance(s, str):
-                m = '{}() argument must be a string'
-                raise InterpreterException(m.format(method_name))
-            return s
-        return None
-
-    @builtinMethodNoKwargs
-    def string_method_call(self, obj: str, method_name: str, posargs: T.List[TYPE_nvar], kwargs: T.Dict[str, T.Any]) -> T.Union[str, int, bool, T.List[str]]:
-        if method_name == 'strip':
-            s1 = self._get_one_string_posarg(posargs, 'strip')
-            if s1 is not None:
-                return obj.strip(s1)
-            return obj.strip()
-        elif method_name == 'format':
-            return self.format_string(obj, posargs)
-        elif method_name == 'to_upper':
-            return obj.upper()
-        elif method_name == 'to_lower':
-            return obj.lower()
-        elif method_name == 'underscorify':
-            return re.sub(r'[^a-zA-Z0-9]', '_', obj)
-        elif method_name == 'split':
-            s2 = self._get_one_string_posarg(posargs, 'split')
-            if s2 is not None:
-                return obj.split(s2)
-            return obj.split()
-        elif method_name == 'startswith' or method_name == 'contains' or method_name == 'endswith':
-            s3 = posargs[0]
-            if not isinstance(s3, str):
-                raise InterpreterException('Argument must be a string.')
-            if method_name == 'startswith':
-                return obj.startswith(s3)
-            elif method_name == 'contains':
-                return obj.find(s3) >= 0
-            return obj.endswith(s3)
-        elif method_name == 'to_int':
-            try:
-                return int(obj)
-            except Exception:
-                raise InterpreterException('String {!r} cannot be converted to int'.format(obj))
-        elif method_name == 'join':
-            if len(posargs) != 1:
-                raise InterpreterException('Join() takes exactly one argument.')
-            strlist = posargs[0]
-            check_stringlist(strlist)
-            assert isinstance(strlist, list)  # Required for mypy
-            return obj.join(strlist)
-        elif method_name == 'version_compare':
-            if len(posargs) != 1:
-                raise InterpreterException('Version_compare() takes exactly one argument.')
-            cmpr = posargs[0]
-            if not isinstance(cmpr, str):
-                raise InterpreterException('Version_compare() argument must be a string.')
-            return mesonlib.version_compare(obj, cmpr)
-        raise InterpreterException('Unknown method "%s" for a string.' % method_name)
-
-    def format_string(self, templ: str, args: T.List[TYPE_nvar]) -> str:
-        arg_strings = []
-        for arg in args:
-            if isinstance(arg, mparser.BaseNode):
-                arg = self.evaluate_statement(arg)
-            if isinstance(arg, bool): # Python boolean is upper case.
-                arg = str(arg).lower()
-            arg_strings.append(str(arg))
-
-        def arg_replace(match):
-            idx = int(match.group(1))
-            if idx >= len(arg_strings):
-                raise InterpreterException('Format placeholder @{}@ out of range.'.format(idx))
-            return arg_strings[idx]
-
-        return re.sub(r'@(\d+)@', arg_replace, templ)
-
-    def unknown_function_called(self, func_name: str) -> None:
-        raise InvalidCode('Unknown function "%s".' % func_name)
-
-    @builtinMethodNoKwargs
-    def array_method_call(self, obj: list, method_name: str, posargs: T.List[TYPE_nvar], kwargs: T.Dict[str, T.Any]) -> TYPE_var:
-        if method_name == 'contains':
-            def check_contains(el: list) -> bool:
-                if len(posargs) != 1:
-                    raise InterpreterException('Contains method takes exactly one argument.')
-                item = posargs[0]
-                for element in el:
-                    if isinstance(element, list):
-                        found = check_contains(element)
-                        if found:
-                            return True
-                    if element == item:
-                        return True
-                return False
-            return check_contains(obj)
-        elif method_name == 'length':
-            return len(obj)
-        elif method_name == 'get':
-            index = posargs[0]
-            fallback = None
-            if len(posargs) == 2:
-                fallback = posargs[1]
-            elif len(posargs) > 2:
-                m = 'Array method \'get()\' only takes two arguments: the ' \
-                    'index and an optional fallback value if the index is ' \
-                    'out of range.'
-                raise InvalidArguments(m)
-            if not isinstance(index, int):
-                raise InvalidArguments('Array index must be a number.')
-            if index < -len(obj) or index >= len(obj):
-                if fallback is None:
-                    m = 'Array index {!r} is out of bounds for array of size {!r}.'
-                    raise InvalidArguments(m.format(index, len(obj)))
-                if isinstance(fallback, mparser.BaseNode):
-                    return self.evaluate_statement(fallback)
-                return fallback
-            return obj[index]
-        m = 'Arrays do not have a method called {!r}.'
-        raise InterpreterException(m.format(method_name))
-
-    @builtinMethodNoKwargs
-    def dict_method_call(self, obj: dict, method_name: str, posargs: T.List[TYPE_nvar], kwargs: T.Dict[str, T.Any]) -> TYPE_var:
-        if method_name in ('has_key', 'get'):
-            if method_name == 'has_key':
-                if len(posargs) != 1:
-                    raise InterpreterException('has_key() takes exactly one argument.')
-            else:
-                if len(posargs) not in (1, 2):
-                    raise InterpreterException('get() takes one or two arguments.')
-
-            key = posargs[0]
-            if not isinstance(key, (str)):
-                raise InvalidArguments('Dictionary key must be a string.')
-
-            has_key = key in obj
-
-            if method_name == 'has_key':
-                return has_key
-
-            if has_key:
-                return obj[key]
-
-            if len(posargs) == 2:
-                fallback = posargs[1]
-                if isinstance(fallback, mparser.BaseNode):
-                    return self.evaluate_statement(fallback)
-                return fallback
-
-            raise InterpreterException('Key {!r} is not in the dictionary.'.format(key))
-
-        if method_name == 'keys':
-            if len(posargs) != 0:
-                raise InterpreterException('keys() takes no arguments.')
-            return list(obj.keys())
-
-        raise InterpreterException('Dictionaries do not have a method called "%s".' % method_name)
-
-    def reduce_arguments(self, args: mparser.ArgumentNode, resolve_key_nodes: bool = True) -> T.Tuple[T.List[TYPE_nvar], TYPE_nkwargs]:
-        assert(isinstance(args, mparser.ArgumentNode))
-        if args.incorrect_order():
-            raise InvalidArguments('All keyword arguments must be after positional arguments.')
-        self.argument_depth += 1
-        reduced_pos = [self.evaluate_statement(arg) for arg in args.arguments]  # type: T.List[TYPE_nvar]
-        reduced_kw = {}  # type: TYPE_nkwargs
-        for key, val in args.kwargs.items():
-            reduced_key = key  # type: T.Union[str, mparser.BaseNode]
-            reduced_val = val  # type: TYPE_nvar
-            if resolve_key_nodes and isinstance(key, mparser.IdNode):
-                assert isinstance(key.value, str)
-                reduced_key = key.value
-            if isinstance(reduced_val, mparser.BaseNode):
-                reduced_val = self.evaluate_statement(reduced_val)
-            reduced_kw[reduced_key] = reduced_val
-        self.argument_depth -= 1
-        final_kw = self.expand_default_kwargs(reduced_kw)
-        return reduced_pos, final_kw
-
-    def expand_default_kwargs(self, kwargs: TYPE_nkwargs) -> TYPE_nkwargs:
-        if 'kwargs' not in kwargs:
-            return kwargs
-        to_expand = kwargs.pop('kwargs')
-        if not isinstance(to_expand, dict):
-            raise InterpreterException('Value of "kwargs" must be dictionary.')
-        if 'kwargs' in to_expand:
-            raise InterpreterException('Kwargs argument must not contain a "kwargs" entry. Points for thinking meta, though. :P')
-        for k, v in to_expand.items():
-            if k in kwargs:
-                raise InterpreterException('Entry "{}" defined both as a keyword argument and in a "kwarg" entry.'.format(k))
-            kwargs[k] = v
-        return kwargs
-
-    def kwargs_string_keys(self, kwargs: TYPE_nkwargs) -> T.Dict[str, TYPE_nvar]:
-        kw = {}  # type: T.Dict[str, TYPE_nvar]
-        for key, val in kwargs.items():
-            if not isinstance(key, str):
-                raise InterpreterException('Key of kwargs is not a string')
-            kw[key] = val
-        return kw
-
-    def assignment(self, node: mparser.AssignmentNode) -> None:
-        assert(isinstance(node, mparser.AssignmentNode))
-        if self.argument_depth != 0:
-            raise InvalidArguments('''Tried to assign values inside an argument list.
-To specify a keyword argument, use : instead of =.''')
-        var_name = node.var_name
-        if not isinstance(var_name, str):
-            raise InvalidArguments('Tried to assign value to a non-variable.')
-        value = self.evaluate_statement(node.value)
-        if not self.is_assignable(value):
-            raise InvalidCode('Tried to assign an invalid value to variable.')
-        # For mutable objects we need to make a copy on assignment
-        if isinstance(value, MutableInterpreterObject):
-            value = copy.deepcopy(value)
-        self.set_variable(var_name, value)
-        return None
-
-    def set_variable(self, varname: str, variable: TYPE_var) -> None:
-        if variable is None:
-            raise InvalidCode('Can not assign None to variable.')
-        if not isinstance(varname, str):
-            raise InvalidCode('First argument to set_variable must be a string.')
-        if not self.is_assignable(variable):
-            raise InvalidCode('Assigned value not of assignable type.')
-        if re.match('[_a-zA-Z][_0-9a-zA-Z]*$', varname) is None:
-            raise InvalidCode('Invalid variable name: ' + varname)
-        if varname in self.builtin:
-            raise InvalidCode('Tried to overwrite internal variable "%s"' % varname)
-        self.variables[varname] = variable
-
-    def get_variable(self, varname) -> TYPE_var:
-        if varname in self.builtin:
-            return self.builtin[varname]
-        if varname in self.variables:
-            return self.variables[varname]
-        raise InvalidCode('Unknown variable "%s".' % varname)
-
-    def is_assignable(self, value: T.Any) -> bool:
-        return isinstance(value, (InterpreterObject, dependencies.Dependency,
-                                  str, int, list, dict, mesonlib.File))
-
-    def validate_extraction(self, buildtarget: InterpreterObject) -> None:
-        raise InterpreterException('validate_extraction is not implemented in this context (please file a bug)')
diff --git a/meson/mesonbuild/linkers.py b/meson/mesonbuild/linkers.py
deleted file mode 100644 (file)
index fe1441e..0000000
+++ /dev/null
@@ -1,1200 +0,0 @@
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import abc
-import os
-import typing as T
-
-from . import mesonlib
-from .arglist import CompilerArgs
-from .envconfig import get_env_var
-
-if T.TYPE_CHECKING:
-    from .coredata import OptionDictType
-    from .environment import Environment
-
-
-class StaticLinker:
-
-    def __init__(self, exelist: T.List[str]):
-        self.exelist = exelist
-
-    def compiler_args(self, args: T.Optional[T.Iterable[str]] = None) -> CompilerArgs:
-        return CompilerArgs(self, args)
-
-    def can_linker_accept_rsp(self) -> bool:
-        """
-        Determines whether the linker can accept arguments using the @rsp syntax.
-        """
-        return mesonlib.is_windows()
-
-    def get_base_link_args(self, options: 'OptionDictType') -> T.List[str]:
-        """Like compilers.get_base_link_args, but for the static linker."""
-        return []
-
-    def get_exelist(self) -> T.List[str]:
-        return self.exelist.copy()
-
-    def get_std_link_args(self) -> T.List[str]:
-        return []
-
-    def get_buildtype_linker_args(self, buildtype: str) -> T.List[str]:
-        return []
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return[]
-
-    def get_coverage_link_args(self) -> T.List[str]:
-        return []
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return ([], set())
-
-    def thread_link_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def openmp_flags(self) -> T.List[str]:
-        return []
-
-    def get_option_link_args(self, options: 'OptionDictType') -> T.List[str]:
-        return []
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        return args[:]
-
-    @classmethod
-    def native_args_to_unix(cls, args: T.List[str]) -> T.List[str]:
-        return args[:]
-
-    def get_link_debugfile_name(self, targetfile: str) -> str:
-        return None
-
-    def get_link_debugfile_args(self, targetfile: str) -> T.List[str]:
-        # Static libraries do not have PDB files
-        return []
-
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return []
-
-
-class VisualStudioLikeLinker:
-    always_args = ['/NOLOGO']
-
-    def __init__(self, machine: str):
-        self.machine = machine
-
-    def get_always_args(self) -> T.List[str]:
-        return self.always_args.copy()
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return self.always_args.copy()
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        args = []  # type: T.List[str]
-        if self.machine:
-            args += ['/MACHINE:' + self.machine]
-        args += ['/OUT:' + target]
-        return args
-
-    @classmethod
-    def unix_args_to_native(cls, args: T.List[str]) -> T.List[str]:
-        from .compilers import VisualStudioCCompiler
-        return VisualStudioCCompiler.unix_args_to_native(args)
-
-    @classmethod
-    def native_args_to_unix(cls, args: T.List[str]) -> T.List[str]:
-        from .compilers import VisualStudioCCompiler
-        return VisualStudioCCompiler.native_args_to_unix(args)
-
-
-class VisualStudioLinker(VisualStudioLikeLinker, StaticLinker):
-
-    """Microsoft's lib static linker."""
-
-    def __init__(self, exelist: T.List[str], machine: str):
-        StaticLinker.__init__(self, exelist)
-        VisualStudioLikeLinker.__init__(self, machine)
-
-
-class IntelVisualStudioLinker(VisualStudioLikeLinker, StaticLinker):
-
-    """Intel's xilib static linker."""
-
-    def __init__(self, exelist: T.List[str], machine: str):
-        StaticLinker.__init__(self, exelist)
-        VisualStudioLikeLinker.__init__(self, machine)
-
-
-class ArLinker(StaticLinker):
-
-    def __init__(self, exelist: T.List[str]):
-        super().__init__(exelist)
-        self.id = 'ar'
-        pc, stdo = mesonlib.Popen_safe(self.exelist + ['-h'])[0:2]
-        # Enable deterministic builds if they are available.
-        if '[D]' in stdo:
-            self.std_args = ['csrD']
-        else:
-            self.std_args = ['csr']
-        self.can_rsp = '@<' in stdo
-
-    def can_linker_accept_rsp(self) -> bool:
-        return self.can_rsp
-
-    def get_std_link_args(self) -> T.List[str]:
-        return self.std_args
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return [target]
-
-
-class ArmarLinker(ArLinker):  # lgtm [py/missing-call-to-init]
-
-    def __init__(self, exelist: T.List[str]):
-        StaticLinker.__init__(self, exelist)
-        self.id = 'armar'
-        self.std_args = ['-csr']
-
-    def can_linker_accept_rsp(self) -> bool:
-        # armar can't accept arguments using the @rsp syntax
-        return False
-
-
-class DLinker(StaticLinker):
-    def __init__(self, exelist: T.List[str], arch: str):
-        super().__init__(exelist)
-        self.id = exelist[0]
-        self.arch = arch
-
-    def get_std_link_args(self) -> T.List[str]:
-        return ['-lib']
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['-of=' + target]
-
-    def get_linker_always_args(self) -> T.List[str]:
-        if mesonlib.is_windows():
-            if self.arch == 'x86_64':
-                return ['-m64']
-            elif self.arch == 'x86_mscoff' and self.id == 'dmd':
-                return ['-m32mscoff']
-            return ['-m32']
-        return []
-
-
-class CcrxLinker(StaticLinker):
-
-    def __init__(self, exelist: T.List[str]):
-        super().__init__(exelist)
-        self.id = 'rlink'
-
-    def can_linker_accept_rsp(self) -> bool:
-        return False
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['-output={}'.format(target)]
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return ['-nologo', '-form=library']
-
-
-class Xc16Linker(StaticLinker):
-
-    def __init__(self, exelist: T.List[str]):
-        super().__init__(exelist)
-        self.id = 'xc16-ar'
-
-    def can_linker_accept_rsp(self) -> bool:
-        return False
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['{}'.format(target)]
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return ['rcs']
-
-
-class C2000Linker(StaticLinker):
-
-    def __init__(self, exelist: T.List[str]):
-        super().__init__(exelist)
-        self.id = 'ar2000'
-
-    def can_linker_accept_rsp(self) -> bool:
-        return False
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return ['{}'.format(target)]
-
-    def get_linker_always_args(self) -> T.List[str]:
-        return ['-r']
-
-
-def prepare_rpaths(raw_rpaths: str, build_dir: str, from_dir: str) -> T.List[str]:
-    # The rpaths we write must be relative if they point to the build dir,
-    # because otherwise they have different length depending on the build
-    # directory. This breaks reproducible builds.
-    internal_format_rpaths = [evaluate_rpath(p, build_dir, from_dir) for p in raw_rpaths]
-    ordered_rpaths = order_rpaths(internal_format_rpaths)
-    return ordered_rpaths
-
-
-def order_rpaths(rpath_list: T.List[str]) -> T.List[str]:
-    # We want rpaths that point inside our build dir to always override
-    # those pointing to other places in the file system. This is so built
-    # binaries prefer our libraries to the ones that may lie somewhere
-    # in the file system, such as /lib/x86_64-linux-gnu.
-    #
-    # The correct thing to do here would be C++'s std::stable_partition.
-    # Python standard library does not have it, so replicate it with
-    # sort, which is guaranteed to be stable.
-    return sorted(rpath_list, key=os.path.isabs)
-
-
-def evaluate_rpath(p: str, build_dir: str, from_dir: str) -> str:
-    if p == from_dir:
-        return '' # relpath errors out in this case
-    elif os.path.isabs(p):
-        return p # These can be outside of build dir.
-    else:
-        return os.path.relpath(os.path.join(build_dir, p), os.path.join(build_dir, from_dir))
-
-
-class LinkerEnvVarsMixin(metaclass=abc.ABCMeta):
-
-    """Mixin reading LDFLAGS from the environment."""
-
-    @staticmethod
-    def get_args_from_envvars(for_machine: mesonlib.MachineChoice,
-                              is_cross: bool) -> T.List[str]:
-        raw_value = get_env_var(for_machine, is_cross, 'LDFLAGS')
-        if raw_value is not None:
-            return mesonlib.split_args(raw_value)
-        else:
-            return []
-
-class DynamicLinker(LinkerEnvVarsMixin, metaclass=abc.ABCMeta):
-
-    """Base class for dynamic linkers."""
-
-    _BUILDTYPE_ARGS = {
-        'plain': [],
-        'debug': [],
-        'debugoptimized': [],
-        'release': [],
-        'minsize': [],
-        'custom': [],
-    }  # type: T.Dict[str, T.List[str]]
-
-    def _apply_prefix(self, arg: T.Union[str, T.List[str]]) -> T.List[str]:
-        args = [arg] if isinstance(arg, str) else arg
-        if self.prefix_arg is None:
-            return args
-        elif isinstance(self.prefix_arg, str):
-            return [self.prefix_arg + arg for arg in args]
-        ret = []
-        for arg in args:
-            ret += self.prefix_arg + [arg]
-        return ret
-
-    def __init__(self, id_: str, exelist: T.List[str],
-                 for_machine: mesonlib.MachineChoice, prefix_arg: T.Union[str, T.List[str]],
-                 always_args: T.List[str], *, version: str = 'unknown version'):
-        self.exelist = exelist
-        self.for_machine = for_machine
-        self.version = version
-        self.id = id_
-        self.prefix_arg = prefix_arg
-        self.always_args = always_args
-
-    def __repr__(self) -> str:
-        return '<{}: v{} `{}`>'.format(type(self).__name__, self.version, ' '.join(self.exelist))
-
-    def get_id(self) -> str:
-        return self.id
-
-    def get_version_string(self) -> str:
-        return '({} {})'.format(self.id, self.version)
-
-    def get_exelist(self) -> T.List[str]:
-        return self.exelist.copy()
-
-    def get_accepts_rsp(self) -> bool:
-        # rsp files are only used when building on Windows because we want to
-        # avoid issues with quoting and max argument length
-        return mesonlib.is_windows()
-
-    def get_always_args(self) -> T.List[str]:
-        return self.always_args.copy()
-
-    def get_lib_prefix(self) -> str:
-        return ''
-
-    # XXX: is use_ldflags a compiler or a linker attribute?
-
-    def get_option_args(self, options: 'OptionDictType') -> T.List[str]:
-        return []
-
-    def has_multi_arguments(self, args: T.List[str], env: 'Environment') -> T.Tuple[bool, bool]:
-        m = 'Language {} does not support has_multi_link_arguments.'
-        raise mesonlib.EnvironmentException(m.format(self.id))
-
-    def get_debugfile_name(self, targetfile: str) -> str:
-        '''Name of debug file written out (see below)'''
-        return None
-
-    def get_debugfile_args(self, targetfile: str) -> T.List[str]:
-        """Some compilers (MSVC) write debug into a separate file.
-
-        This method takes the target object path and returns a list of
-        commands to append to the linker invocation to control where that
-        file is written.
-        """
-        return []
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return []
-
-    def get_std_shared_module_args(self, options: 'OptionDictType') -> T.List[str]:
-        return self.get_std_shared_lib_args()
-
-    def get_pie_args(self) -> T.List[str]:
-        # TODO: this really needs to take a boolean and return the args to
-        # disable pie, otherwise it only acts to enable pie if pie *isn't* the
-        # default.
-        m = 'Linker {} does not support position-independent executable'
-        raise mesonlib.EnvironmentException(m.format(self.id))
-
-    def get_lto_args(self) -> T.List[str]:
-        return []
-
-    def sanitizer_args(self, value: str) -> T.List[str]:
-        return []
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        # We can override these in children by just overriding the
-        # _BUILDTYPE_ARGS value.
-        return self._BUILDTYPE_ARGS[buildtype]
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return []
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        raise mesonlib.EnvironmentException(
-            'Linker {} does not support link_whole'.format(self.id))
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        raise mesonlib.EnvironmentException(
-            'Linker {} does not support allow undefined'.format(self.id))
-
-    @abc.abstractmethod
-    def get_output_args(self, outname: str) -> T.List[str]:
-        pass
-
-    def get_coverage_args(self) -> T.List[str]:
-        m = "Linker {} doesn't implement coverage data generation.".format(self.id)
-        raise mesonlib.EnvironmentException(m)
-
-    @abc.abstractmethod
-    def get_search_args(self, dirname: str) -> T.List[str]:
-        pass
-
-    def export_dynamic_args(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def import_library_args(self, implibname: str) -> T.List[str]:
-        """The name of the outputted import library.
-
-        This implementation is used only on Windows by compilers that use GNU ld
-        """
-        return []
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        return []
-
-    def no_undefined_args(self) -> T.List[str]:
-        """Arguments to error if there are any undefined symbols at link time.
-
-        This is the inverse of get_allow_undefined_args().
-
-        TODO: A future cleanup might merge this and
-              get_allow_undefined_args() into a single method taking a
-              boolean
-        """
-        return []
-
-    def fatal_warnings(self) -> T.List[str]:
-        """Arguments to make all warnings errors."""
-        return []
-
-    def headerpad_args(self) -> T.List[str]:
-        # Only used by the Apple linker
-        return []
-
-    def bitcode_args(self) -> T.List[str]:
-        raise mesonlib.MesonException('This linker does not support bitcode bundles')
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return ([], set())
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
-
-
-class PosixDynamicLinkerMixin:
-
-    """Mixin class for POSIX-ish linkers.
-
-    This is obviously a pretty small subset of the linker interface, but
-    enough dynamic linkers that meson supports are POSIX-like but not
-    GNU-like that it makes sense to split this out.
-    """
-
-    def get_output_args(self, outname: str) -> T.List[str]:
-        return ['-o', outname]
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return ['-shared']
-
-    def get_search_args(self, dirname: str) -> T.List[str]:
-        return ['-L' + dirname]
-
-
-class GnuLikeDynamicLinkerMixin:
-
-    """Mixin class for dynamic linkers that provides gnu-like interface.
-
-    This acts as a base for the GNU linkers (bfd and gold), LLVM's lld, and
-    other linkers like GNU-ld.
-    """
-
-    _BUILDTYPE_ARGS = {
-        'plain': [],
-        'debug': [],
-        'debugoptimized': [],
-        'release': ['-O1'],
-        'minsize': [],
-        'custom': [],
-    }  # type: T.Dict[str, T.List[str]]
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        # We can override these in children by just overriding the
-        # _BUILDTYPE_ARGS value.
-        return mesonlib.listify([self._apply_prefix(a) for a in self._BUILDTYPE_ARGS[buildtype]])
-
-    def get_pie_args(self) -> T.List[str]:
-        return ['-pie']
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return self._apply_prefix('--as-needed')
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        if not args:
-            return args
-        return self._apply_prefix('--whole-archive') + args + self._apply_prefix('--no-whole-archive')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return self._apply_prefix('--allow-shlib-undefined')
-
-    def get_lto_args(self) -> T.List[str]:
-        return ['-flto']
-
-    def sanitizer_args(self, value: str) -> T.List[str]:
-        if value == 'none':
-            return []
-        return ['-fsanitize=' + value]
-
-    def get_coverage_args(self) -> T.List[str]:
-        return ['--coverage']
-
-    def export_dynamic_args(self, env: 'Environment') -> T.List[str]:
-        m = env.machines[self.for_machine]
-        if m.is_windows() or m.is_cygwin():
-            return self._apply_prefix('--export-all-symbols')
-        return self._apply_prefix('-export-dynamic')
-
-    def import_library_args(self, implibname: str) -> T.List[str]:
-        return self._apply_prefix('--out-implib=' + implibname)
-
-    def thread_flags(self, env: 'Environment') -> T.List[str]:
-        if env.machines[self.for_machine].is_haiku():
-            return []
-        return ['-pthread']
-
-    def no_undefined_args(self) -> T.List[str]:
-        return self._apply_prefix('--no-undefined')
-
-    def fatal_warnings(self) -> T.List[str]:
-        return self._apply_prefix('--fatal-warnings')
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        m = env.machines[self.for_machine]
-        if m.is_windows() or m.is_cygwin():
-            # For PE/COFF the soname argument has no effect
-            return []
-        sostr = '' if soversion is None else '.' + soversion
-        return self._apply_prefix('-soname,{}{}.{}{}'.format(prefix, shlib_name, suffix, sostr))
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        m = env.machines[self.for_machine]
-        if m.is_windows() or m.is_cygwin():
-            return ([], set())
-        if not rpath_paths and not install_rpath and not build_rpath:
-            return ([], set())
-        args = []
-        origin_placeholder = '$ORIGIN'
-        processed_rpaths = prepare_rpaths(rpath_paths, build_dir, from_dir)
-        # Need to deduplicate rpaths, as macOS's install_name_tool
-        # is *very* allergic to duplicate -delete_rpath arguments
-        # when calling depfixer on installation.
-        all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
-        rpath_dirs_to_remove = set()
-        for p in all_paths:
-            rpath_dirs_to_remove.add(p.encode('utf8'))
-        # Build_rpath is used as-is (it is usually absolute).
-        if build_rpath != '':
-            all_paths.add(build_rpath)
-            for p in build_rpath.split(':'):
-                rpath_dirs_to_remove.add(p.encode('utf8'))
-
-        # TODO: should this actually be "for (dragonfly|open)bsd"?
-        if mesonlib.is_dragonflybsd() or mesonlib.is_openbsd():
-            # This argument instructs the compiler to record the value of
-            # ORIGIN in the .dynamic section of the elf. On Linux this is done
-            # by default, but is not on dragonfly/openbsd for some reason. Without this
-            # $ORIGIN in the runtime path will be undefined and any binaries
-            # linked against local libraries will fail to resolve them.
-            args.extend(self._apply_prefix('-z,origin'))
-
-        # In order to avoid relinking for RPATH removal, the binary needs to contain just
-        # enough space in the ELF header to hold the final installation RPATH.
-        paths = ':'.join(all_paths)
-        if len(paths) < len(install_rpath):
-            padding = 'X' * (len(install_rpath) - len(paths))
-            if not paths:
-                paths = padding
-            else:
-                paths = paths + ':' + padding
-        args.extend(self._apply_prefix('-rpath,' + paths))
-
-        # TODO: should this actually be "for solaris/sunos"?
-        if mesonlib.is_sunos():
-            return (args, rpath_dirs_to_remove)
-
-        # Rpaths to use while linking must be absolute. These are not
-        # written to the binary. Needed only with GNU ld:
-        # https://sourceware.org/bugzilla/show_bug.cgi?id=16936
-        # Not needed on Windows or other platforms that don't use RPATH
-        # https://github.com/mesonbuild/meson/issues/1897
-        #
-        # In addition, this linker option tends to be quite long and some
-        # compilers have trouble dealing with it. That's why we will include
-        # one option per folder, like this:
-        #
-        #   -Wl,-rpath-link,/path/to/folder1 -Wl,-rpath,/path/to/folder2 ...
-        #
-        # ...instead of just one single looooong option, like this:
-        #
-        #   -Wl,-rpath-link,/path/to/folder1:/path/to/folder2:...
-        for p in rpath_paths:
-            args.extend(self._apply_prefix('-rpath-link,' + os.path.join(build_dir, p)))
-
-        return (args, rpath_dirs_to_remove)
-
-
-class AppleDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Apple's ld implementation."""
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld64', *args, **kwargs)
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return self._apply_prefix('-dead_strip_dylibs')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return self._apply_prefix('-undefined,dynamic_lookup')
-
-    def get_std_shared_module_args(self, options: 'OptionDictType') -> T.List[str]:
-        return ['-bundle'] + self._apply_prefix('-undefined,dynamic_lookup')
-
-    def get_pie_args(self) -> T.List[str]:
-        return ['-pie']
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        result = []  # type: T.List[str]
-        for a in args:
-            result.extend(self._apply_prefix('-force_load'))
-            result.append(a)
-        return result
-
-    def get_coverage_args(self) -> T.List[str]:
-        return ['--coverage']
-
-    def sanitizer_args(self, value: str) -> T.List[str]:
-        if value == 'none':
-            return []
-        return ['-fsanitize=' + value]
-
-    def no_undefined_args(self) -> T.List[str]:
-        return self._apply_prefix('-undefined,error')
-
-    def headerpad_args(self) -> T.List[str]:
-        return self._apply_prefix('-headerpad_max_install_names')
-
-    def bitcode_args(self) -> T.List[str]:
-        return self._apply_prefix('-bitcode_bundle')
-
-    def fatal_warnings(self) -> T.List[str]:
-        return self._apply_prefix('-fatal_warnings')
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        if is_shared_module:
-            return []
-        install_name = ['@rpath/', prefix, shlib_name]
-        if soversion is not None:
-            install_name.append('.' + soversion)
-        install_name.append('.dylib')
-        args = ['-install_name', ''.join(install_name)]
-        if darwin_versions:
-            args.extend(['-compatibility_version', darwin_versions[0],
-                         '-current_version', darwin_versions[1]])
-        return args
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        if not rpath_paths and not install_rpath and not build_rpath:
-            return ([], set())
-        args = []
-        # @loader_path is the equivalent of $ORIGIN on macOS
-        # https://stackoverflow.com/q/26280738
-        origin_placeholder = '@loader_path'
-        processed_rpaths = prepare_rpaths(rpath_paths, build_dir, from_dir)
-        all_paths = mesonlib.OrderedSet([os.path.join(origin_placeholder, p) for p in processed_rpaths])
-        if build_rpath != '':
-            all_paths.add(build_rpath)
-        for rp in all_paths:
-            args.extend(self._apply_prefix('-rpath,' + rp))
-
-        return (args, set())
-
-
-class GnuDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Representation of GNU ld.bfd and ld.gold."""
-
-    def get_accepts_rsp(self) -> bool:
-        return True;
-
-
-class GnuGoldDynamicLinker(GnuDynamicLinker):
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld.gold', *args, **kwargs)
-
-
-class GnuBFDDynamicLinker(GnuDynamicLinker):
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld.bfd', *args, **kwargs)
-
-
-class LLVMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Representation of LLVM's ld.lld linker.
-
-    This is only the gnu-like linker, not the apple like or link.exe like
-    linkers.
-    """
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld.lld', *args, **kwargs)
-
-        # Some targets don't seem to support this argument (windows, wasm, ...)
-        _, _, e = mesonlib.Popen_safe(self.exelist + self._apply_prefix('--allow-shlib-undefined'))
-        self.has_allow_shlib_undefined = not ('unknown argument: --allow-shlib-undefined' in e)
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        if self.has_allow_shlib_undefined:
-            return self._apply_prefix('--allow-shlib-undefined')
-        return []
-
-
-class WASMDynamicLinker(GnuLikeDynamicLinkerMixin, PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Emscripten's wasm-ld."""
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld.wasm', *args, **kwargs)
-
-    def thread_link_flags(self, env: 'Environment') -> T.List[str]:
-        args = ['-s', 'USE_PTHREADS=1']
-        count = env.coredata.compiler_options[self.for_machine]['{}_thread_count'.format(self.language)].value  # type: int
-        if count:
-            args.extend(['-s', 'PTHREAD_POOL_SIZE={}'.format(count)])
-        return args
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0']
-
-    def no_undefined_args(self) -> T.List[str]:
-        return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=1']
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        raise mesonlib.MesonException('{} does not support shared libraries.'.format(self.id))
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return []
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return ([], set())
-
-
-class CcrxDynamicLinker(DynamicLinker):
-
-    """Linker for Renesis CCrx compiler."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice,
-                 *, version: str = 'unknown version'):
-        super().__init__('rlink', ['rlink.exe'], for_machine, '', [],
-                         version=version)
-
-    def get_accepts_rsp(self) -> bool:
-        return False
-
-    def get_lib_prefix(self) -> str:
-        return '-lib='
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return []
-
-    def get_output_args(self, outputname: str) -> T.List[str]:
-        return ['-output={}'.format(outputname)]
-
-    def get_search_args(self, dirname: str) -> 'T.NoReturn':
-        raise EnvironmentError('rlink.exe does not have a search dir argument')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
-
-
-class Xc16DynamicLinker(DynamicLinker):
-
-    """Linker for Microchip XC16 compiler."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice,
-                 *, version: str = 'unknown version'):
-        super().__init__('xc16-gcc', ['xc16-gcc.exe'], for_machine, '', [],
-                         version=version)
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        if not args:
-            return args
-        return self._apply_prefix('--start-group') + args + self._apply_prefix('--end-group')
-
-    def get_accepts_rsp(self) -> bool:
-        return False
-
-    def get_lib_prefix(self) -> str:
-        return ''
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return []
-
-    def get_output_args(self, outputname: str) -> T.List[str]:
-        return ['-o{}'.format(outputname)]
-
-    def get_search_args(self, dirname: str) -> 'T.NoReturn':
-        raise EnvironmentError('xc16-gcc.exe does not have a search dir argument')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        return ([], set())
-
-
-class C2000DynamicLinker(DynamicLinker):
-
-    """Linker for Texas Instruments C2000 compiler."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice,
-                 *, version: str = 'unknown version'):
-        super().__init__('cl2000', ['cl2000.exe'], for_machine, '', [],
-                         version=version)
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        if not args:
-            return args
-        return self._apply_prefix('--start-group') + args + self._apply_prefix('--end-group')
-
-    def get_accepts_rsp(self) -> bool:
-        return False
-
-    def get_lib_prefix(self) -> str:
-        return '-l='
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return []
-
-    def get_output_args(self, outputname: str) -> T.List[str]:
-        return ['-z', '--output_file={}'.format(outputname)]
-
-    def get_search_args(self, dirname: str) -> 'T.NoReturn':
-        raise EnvironmentError('cl2000.exe does not have a search dir argument')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-
-class ArmDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Linker for the ARM compiler."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice,
-                 *, version: str = 'unknown version'):
-        super().__init__('armlink', ['armlink'], for_machine, '', [],
-                         version=version)
-
-    def get_accepts_rsp(self) -> bool:
-        return False
-
-    def get_std_shared_lib_args(self) -> 'T.NoReturn':
-        raise mesonlib.MesonException('The Arm Linkers do not support shared libraries')
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-
-class ArmClangDynamicLinker(ArmDynamicLinker):
-
-    """Linker used with ARM's clang fork.
-
-    The interface is similar enough to the old ARM ld that it inherits and
-    extends a few things as needed.
-    """
-
-    def export_dynamic_args(self, env: 'Environment') -> T.List[str]:
-        return ['--export_dynamic']
-
-    def import_library_args(self, implibname: str) -> T.List[str]:
-        return ['--symdefs=' + implibname]
-
-
-class PGIDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
-
-    """PGI linker."""
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('pgi', *args, **kwargs)
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        # PGI -shared is Linux only.
-        if mesonlib.is_windows():
-            return ['-Bdynamic', '-Mmakedll']
-        elif mesonlib.is_linux():
-            return ['-shared']
-        return []
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        if not env.machines[self.for_machine].is_windows():
-            return (['-R' + os.path.join(build_dir, p) for p in rpath_paths], set())
-        return ([], set())
-
-
-class PGIStaticLinker(StaticLinker):
-    def __init__(self, exelist: T.List[str]):
-        super().__init__(exelist)
-        self.id = 'ar'
-        self.std_args = ['-r']
-
-    def get_std_link_args(self) -> T.List[str]:
-        return self.std_args
-
-    def get_output_args(self, target: str) -> T.List[str]:
-        return [target]
-
-
-class VisualStudioLikeLinkerMixin:
-
-    _BUILDTYPE_ARGS = {
-        'plain': [],
-        'debug': [],
-        'debugoptimized': [],
-        # The otherwise implicit REF and ICF linker optimisations are disabled by
-        # /DEBUG. REF implies ICF.
-        'release': ['/OPT:REF'],
-        'minsize': ['/INCREMENTAL:NO', '/OPT:REF'],
-        'custom': [],
-    }  # type: T.Dict[str, T.List[str]]
-
-    def __init__(self, *args, direct: bool = True, machine: str = 'x86', **kwargs):
-        super().__init__(*args, **kwargs)
-        self.machine = machine
-
-    def get_buildtype_args(self, buildtype: str) -> T.List[str]:
-        return mesonlib.listify([self._apply_prefix(a) for a in self._BUILDTYPE_ARGS[buildtype]])
-
-    def invoked_by_compiler(self) -> bool:
-        return not self.direct
-
-    def get_output_args(self, outputname: str) -> T.List[str]:
-        return self._apply_prefix(['/MACHINE:' + self.machine, '/OUT:' + outputname])
-
-    def get_always_args(self) -> T.List[str]:
-        return self._apply_prefix('/nologo') + super().get_always_args()
-
-    def get_search_args(self, dirname: str) -> T.List[str]:
-        return self._apply_prefix('/LIBPATH:' + dirname)
-
-    def get_std_shared_lib_args(self) -> T.List[str]:
-        return self._apply_prefix('/DLL')
-
-    def get_debugfile_name(self, targetfile: str) -> str:
-        basename = targetfile.rsplit('.', maxsplit=1)[0]
-        return basename + '.pdb'
-
-    def get_debugfile_args(self, targetfile: str) -> T.List[str]:
-        return self._apply_prefix(['/DEBUG', '/PDB:' + self.get_debugfile_name(targetfile)])
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        # Only since VS2015
-        args = mesonlib.listify(args)
-        l = []  # T.List[str]
-        for a in args:
-            l.extend(self._apply_prefix('/WHOLEARCHIVE:' + a))
-        return l
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
-
-    def import_library_args(self, implibname: str) -> T.List[str]:
-        """The command to generate the import library."""
-        return self._apply_prefix(['/IMPLIB:' + implibname])
-
-
-class MSVCDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
-
-    """Microsoft's Link.exe."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice, always_args: T.List[str], *,
-                 exelist: T.Optional[T.List[str]] = None,
-                 prefix: T.Union[str, T.List[str]] = '',
-                 machine: str = 'x86', version: str = 'unknown version',
-                 direct: bool = True):
-        super().__init__('link', exelist or ['link.exe'], for_machine,
-                         prefix, always_args, machine=machine, version=version, direct=direct)
-
-    def get_always_args(self) -> T.List[str]:
-        return self._apply_prefix(['/nologo', '/release']) + super().get_always_args()
-
-
-class ClangClDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
-
-    """Clang's lld-link.exe."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice, always_args: T.List[str], *,
-                 exelist: T.Optional[T.List[str]] = None,
-                 prefix: T.Union[str, T.List[str]] = '',
-                 machine: str = 'x86', version: str = 'unknown version',
-                 direct: bool = True):
-        super().__init__('lld-link', exelist or ['lld-link.exe'], for_machine,
-                         prefix, always_args, machine=machine, version=version, direct=direct)
-
-
-class XilinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
-
-    """Intel's Xilink.exe."""
-
-    def __init__(self, for_machine: mesonlib.MachineChoice, always_args: T.List[str],
-                 *, version: str = 'unknown version'):
-        super().__init__('xilink', ['xilink.exe'], for_machine, '', always_args, version=version)
-
-
-class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
-
-    """Sys-V derived linker used on Solaris and OpenSolaris."""
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('ld.solaris', *args, **kwargs)
-
-    def get_link_whole_for(self, args: T.List[str]) -> T.List[str]:
-        if not args:
-            return args
-        return self._apply_prefix('--whole-archive') + args + self._apply_prefix('--no-whole-archive')
-
-    def get_pie_args(self) -> T.List[str]:
-        # Available in Solaris 11.2 and later
-        return ['-z', 'type=pie']
-
-    def get_asneeded_args(self) -> T.List[str]:
-        return self._apply_prefix(['-z', 'ignore'])
-
-    def no_undefined_args(self) -> T.List[str]:
-        return ['-z', 'defs']
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return ['-z', 'nodefs']
-
-    def fatal_warnings(self) -> T.List[str]:
-        return ['-z', 'fatal-warnings']
-
-    def build_rpath_args(self, env: 'Environment', build_dir: str, from_dir: str,
-                         rpath_paths: str, build_rpath: str,
-                         install_rpath: str) -> T.Tuple[T.List[str], T.Set[bytes]]:
-        if not rpath_paths and not install_rpath and not build_rpath:
-            return ([], set())
-        processed_rpaths = prepare_rpaths(rpath_paths, build_dir, from_dir)
-        all_paths = mesonlib.OrderedSet([os.path.join('$ORIGIN', p) for p in processed_rpaths])
-        if build_rpath != '':
-            all_paths.add(build_rpath)
-
-        # In order to avoid relinking for RPATH removal, the binary needs to contain just
-        # enough space in the ELF header to hold the final installation RPATH.
-        paths = ':'.join(all_paths)
-        if len(paths) < len(install_rpath):
-            padding = 'X' * (len(install_rpath) - len(paths))
-            if not paths:
-                paths = padding
-            else:
-                paths = paths + ':' + padding
-        return (self._apply_prefix('-rpath,{}'.format(paths)), set())
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        sostr = '' if soversion is None else '.' + soversion
-        return self._apply_prefix('-soname,{}{}.{}{}'.format(prefix, shlib_name, suffix, sostr))
-
-
-class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker):
-
-    """Digital Mars dynamic linker for windows."""
-
-    def __init__(self, exelist: T.List[str], for_machine: mesonlib.MachineChoice,
-                 *, version: str = 'unknown version'):
-        # Use optlink instead of link so we don't interfer with other link.exe
-        # implementations.
-        super().__init__('optlink', exelist, for_machine, '', [], version=version)
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_debugfile_args(self, targetfile: str) -> T.List[str]:
-        # Optlink does not generate pdb files.
-        return []
-
-    def get_always_args(self) -> T.List[str]:
-        return []
-
-
-class CudaLinker(PosixDynamicLinkerMixin, DynamicLinker):
-    """Cuda linker (nvlink)"""
-
-    def __init__(self, *args, **kwargs):
-        super().__init__('nvlink', *args, **kwargs)
-
-    @staticmethod
-    def parse_version():
-        version_cmd = ['nvlink', '--version']
-        try:
-            _, out, _ = mesonlib.Popen_safe(version_cmd)
-        except OSError:
-            return 'unknown version'
-        # Output example:
-        # nvlink: NVIDIA (R) Cuda linker
-        # Copyright (c) 2005-2018 NVIDIA Corporation
-        # Built on Sun_Sep_30_21:09:22_CDT_2018
-        # Cuda compilation tools, release 10.0, V10.0.166
-        # we need the most verbose version output. Luckily starting with V
-        return out.strip().split('V')[-1]
-
-    def get_accepts_rsp(self) -> bool:
-        # nvcc does not support response files
-        return False
-
-    def get_lib_prefix(self) -> str:
-        if not mesonlib.is_windows():
-            return ''
-        # nvcc doesn't recognize Meson's default .a extension for static libraries on
-        # Windows and passes it to cl as an object file, resulting in 'warning D9024 :
-        # unrecognized source file type 'xxx.a', object file assumed'.
-        #
-        # nvcc's --library= option doesn't help: it takes the library name without the
-        # extension and assumes that the extension on Windows is .lib; prefixing the
-        # library with -Xlinker= seems to work.
-        from .compilers import CudaCompiler
-        return CudaCompiler.LINKER_PREFIX
-
-    def fatal_warnings(self) -> T.List[str]:
-        return ['--warning-as-error']
-
-    def get_allow_undefined_args(self) -> T.List[str]:
-        return []
-
-    def get_soname_args(self, env: 'Environment', prefix: str, shlib_name: str,
-                        suffix: str, soversion: str, darwin_versions: T.Tuple[str, str],
-                        is_shared_module: bool) -> T.List[str]:
-        return []
diff --git a/meson/mesonbuild/mcompile.py b/meson/mesonbuild/mcompile.py
deleted file mode 100644 (file)
index 8e2a38f..0000000
+++ /dev/null
@@ -1,304 +0,0 @@
-# Copyright 2020 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Entrypoint script for backend agnostic compile."""
-
-import json
-import re
-import sys
-import typing as T
-from collections import defaultdict
-from pathlib import Path
-
-from . import mlog
-from . import mesonlib
-from . import coredata
-from .mesonlib import MesonException
-from mesonbuild.environment import detect_ninja
-from mesonbuild.coredata import UserArrayOption
-
-if T.TYPE_CHECKING:
-    import argparse
-
-def array_arg(value: str) -> T.List[str]:
-    return UserArrayOption(None, value, allow_dups=True, user_input=True).value
-
-def validate_builddir(builddir: Path) -> None:
-    if not (builddir / 'meson-private' / 'coredata.dat' ).is_file():
-        raise MesonException('Current directory is not a meson build directory: `{}`.\n'
-                             'Please specify a valid build dir or change the working directory to it.\n'
-                             'It is also possible that the build directory was generated with an old\n'
-                             'meson version. Please regenerate it in this case.'.format(builddir))
-
-def get_backend_from_coredata(builddir: Path) -> str:
-    """
-    Gets `backend` option value from coredata
-    """
-    return coredata.load(str(builddir)).get_builtin_option('backend')
-
-def parse_introspect_data(builddir: Path) -> T.Dict[str, T.List[dict]]:
-    """
-    Converts a List of name-to-dict to a dict of name-to-dicts (since names are not unique)
-    """
-    path_to_intro = builddir / 'meson-info' / 'intro-targets.json'
-    if not path_to_intro.exists():
-        raise MesonException('`{}` is missing! Directory is not configured yet?'.format(path_to_intro.name))
-    with path_to_intro.open() as f:
-        schema = json.load(f)
-
-    parsed_data = defaultdict(list) # type: T.Dict[str, T.List[dict]]
-    for target in schema:
-        parsed_data[target['name']] += [target]
-    return parsed_data
-
-class ParsedTargetName:
-    full_name = ''
-    name = ''
-    type = ''
-    path = ''
-
-    def __init__(self, target: str):
-        self.full_name = target
-        split = target.rsplit(':', 1)
-        if len(split) > 1:
-            self.type = split[1]
-            if not self._is_valid_type(self.type):
-                raise MesonException('Can\'t invoke target `{}`: unknown target type: `{}`'.format(target, self.type))
-
-        split = split[0].rsplit('/', 1)
-        if len(split) > 1:
-            self.path = split[0]
-            self.name = split[1]
-        else:
-            self.name = split[0]
-
-    @staticmethod
-    def _is_valid_type(type: str) -> bool:
-        # Ammend docs in Commands.md when editing this list
-        allowed_types = {
-            'executable',
-            'static_library',
-            'shared_library',
-            'shared_module',
-            'custom',
-            'run',
-            'jar',
-        }
-        return type in allowed_types
-
-def get_target_from_intro_data(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> dict:
-    if target.name not in introspect_data:
-        raise MesonException('Can\'t invoke target `{}`: target not found'.format(target.full_name))
-
-    intro_targets = introspect_data[target.name]
-    found_targets = []
-
-    resolved_bdir = builddir.resolve()
-
-    if not target.type and not target.path:
-        found_targets = intro_targets
-    else:
-        for intro_target in intro_targets:
-            if (intro_target['subproject'] or
-                    (target.type and target.type != intro_target['type'].replace(' ', '_')) or
-                    (target.path
-                         and intro_target['filename'] != 'no_name'
-                         and Path(target.path) != Path(intro_target['filename'][0]).relative_to(resolved_bdir).parent)):
-                continue
-            found_targets += [intro_target]
-
-    if not found_targets:
-        raise MesonException('Can\'t invoke target `{}`: target not found'.format(target.full_name))
-    elif len(found_targets) > 1:
-        raise MesonException('Can\'t invoke target `{}`: ambigious name. Add target type and/or path: `PATH/NAME:TYPE`'.format(target.full_name))
-
-    return found_targets[0]
-
-def generate_target_names_ninja(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> T.List[str]:
-    intro_target = get_target_from_intro_data(target, builddir, introspect_data)
-
-    if intro_target['type'] == 'run':
-        return [target.name]
-    else:
-        return [str(Path(out_file).relative_to(builddir.resolve())) for out_file in intro_target['filename']]
-
-def get_parsed_args_ninja(options: 'argparse.Namespace', builddir: Path) -> T.List[str]:
-    runner = detect_ninja()
-    if runner is None:
-        raise MesonException('Cannot find ninja.')
-    mlog.log('Found runner:', runner)
-
-    cmd = runner + ['-C', builddir.as_posix()]
-
-    if options.targets:
-        intro_data = parse_introspect_data(builddir)
-        for t in options.targets:
-            cmd.extend(generate_target_names_ninja(ParsedTargetName(t), builddir, intro_data))
-    if options.clean:
-        cmd.append('clean')
-
-    # If the value is set to < 1 then don't set anything, which let's
-    # ninja/samu decide what to do.
-    if options.jobs > 0:
-        cmd.extend(['-j', str(options.jobs)])
-    if options.load_average > 0:
-        cmd.extend(['-l', str(options.load_average)])
-
-    if options.verbose:
-        cmd.append('-v')
-
-    cmd += options.ninja_args
-
-    return cmd
-
-def generate_target_name_vs(target: ParsedTargetName, builddir: Path, introspect_data: dict) -> str:
-    intro_target = get_target_from_intro_data(target, builddir, introspect_data)
-
-    assert intro_target['type'] != 'run', 'Should not reach here: `run` targets must be handle above'
-
-    # Normalize project name
-    # Source: https://docs.microsoft.com/en-us/visualstudio/msbuild/how-to-build-specific-targets-in-solutions-by-using-msbuild-exe
-    target_name = re.sub('[\%\$\@\;\.\(\)\']', '_', intro_target['id'])
-    rel_path = Path(intro_target['filename'][0]).relative_to(builddir.resolve()).parent
-    if rel_path != '.':
-        target_name = str(rel_path / target_name)
-    return target_name
-
-def get_parsed_args_vs(options: 'argparse.Namespace', builddir: Path) -> T.List[str]:
-    slns = list(builddir.glob('*.sln'))
-    assert len(slns) == 1, 'More than one solution in a project?'
-    sln = slns[0]
-
-    cmd = ['msbuild']
-
-    if options.targets:
-        intro_data = parse_introspect_data(builddir)
-        has_run_target = any(map(
-            lambda t:
-                get_target_from_intro_data(ParsedTargetName(t), builddir, intro_data)['type'] == 'run',
-            options.targets
-        ))
-
-        if has_run_target:
-            # `run` target can't be used the same way as other targets on `vs` backend.
-            # They are defined as disabled projects, which can't be invoked as `.sln`
-            # target and have to be invoked directly as project instead.
-            # Issue: https://github.com/microsoft/msbuild/issues/4772
-
-            if len(options.targets) > 1:
-                raise MesonException('Only one target may be specified when `run` target type is used on this backend.')
-            intro_target = get_target_from_intro_data(ParsedTargetName(options.targets[0]), builddir, intro_data)
-            proj_dir = Path(intro_target['filename'][0]).parent
-            proj = proj_dir/'{}.vcxproj'.format(intro_target['id'])
-            cmd += [str(proj.resolve())]
-        else:
-            cmd += [str(sln.resolve())]
-            cmd.extend(['-target:{}'.format(generate_target_name_vs(ParsedTargetName(t), builddir, intro_data)) for t in options.targets])
-    else:
-        cmd += [str(sln.resolve())]
-
-    if options.clean:
-        cmd.extend(['-target:Clean'])
-
-    # In msbuild `-maxCpuCount` with no number means "detect cpus", the default is `-maxCpuCount:1`
-    if options.jobs > 0:
-        cmd.append('-maxCpuCount:{}'.format(options.jobs))
-    else:
-        cmd.append('-maxCpuCount')
-
-    if options.load_average:
-        mlog.warning('Msbuild does not have a load-average switch, ignoring.')
-
-    if not options.verbose:
-        cmd.append('-verbosity:minimal')
-
-    cmd += options.vs_args
-
-    return cmd
-
-def add_arguments(parser: 'argparse.ArgumentParser') -> None:
-    """Add compile specific arguments."""
-    parser.add_argument(
-        'targets',
-        metavar='TARGET',
-        nargs='*',
-        default=None,
-        help='Targets to build. Target has the following format: [PATH_TO_TARGET/]TARGET_NAME[:TARGET_TYPE].')
-    parser.add_argument(
-        '--clean',
-        action='store_true',
-        help='Clean the build directory.'
-    )
-    parser.add_argument(
-        '-C',
-        action='store',
-        dest='builddir',
-        type=Path,
-        default='.',
-        help='The directory containing build files to be built.'
-    )
-    parser.add_argument(
-        '-j', '--jobs',
-        action='store',
-        default=0,
-        type=int,
-        help='The number of worker jobs to run (if supported). If the value is less than 1 the build program will guess.'
-    )
-    parser.add_argument(
-        '-l', '--load-average',
-        action='store',
-        default=0,
-        type=int,
-        help='The system load average to try to maintain (if supported).'
-    )
-    parser.add_argument(
-        '-v', '--verbose',
-        action='store_true',
-        help='Show more verbose output.'
-    )
-    parser.add_argument(
-        '--ninja-args',
-        type=array_arg,
-        default=[],
-        help='Arguments to pass to `ninja` (applied only on `ninja` backend).'
-    )
-    parser.add_argument(
-        '--vs-args',
-        type=array_arg,
-        default=[],
-        help='Arguments to pass to `msbuild` (applied only on `vs` backend).'
-    )
-
-def run(options: 'argparse.Namespace') -> int:
-    bdir = options.builddir  # type: Path
-    validate_builddir(bdir.resolve())
-
-    cmd = []  # type: T.List[str]
-
-    if options.targets and options.clean:
-        raise MesonException('`TARGET` and `--clean` can\'t be used simultaneously')
-
-    backend = get_backend_from_coredata(bdir)
-    if backend == 'ninja':
-        cmd = get_parsed_args_ninja(options, bdir)
-    elif backend.startswith('vs'):
-        cmd = get_parsed_args_vs(options, bdir)
-    else:
-        # TODO: xcode?
-        raise MesonException(
-            'Backend `{}` is not yet supported by `compile`. Use generated project files directly instead.'.format(backend))
-
-    p, *_ = mesonlib.Popen_safe(cmd, stdout=sys.stdout.buffer, stderr=sys.stderr.buffer)
-
-    return p.returncode
diff --git a/meson/mesonbuild/mconf.py b/meson/mesonbuild/mconf.py
deleted file mode 100644 (file)
index 2e03cab..0000000
+++ /dev/null
@@ -1,286 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-from . import coredata, environment, mesonlib, build, mintro, mlog
-from .ast import AstIDGenerator
-
-def add_arguments(parser):
-    coredata.register_builtin_arguments(parser)
-    parser.add_argument('builddir', nargs='?', default='.')
-    parser.add_argument('--clearcache', action='store_true', default=False,
-                        help='Clear cached state (e.g. found dependencies)')
-
-
-def make_lower_case(val):
-    if isinstance(val, bool):
-        return str(val).lower()
-    elif isinstance(val, list):
-        return [make_lower_case(i) for i in val]
-    else:
-        return str(val)
-
-
-class ConfException(mesonlib.MesonException):
-    pass
-
-
-class Conf:
-    def __init__(self, build_dir):
-        self.build_dir = os.path.abspath(os.path.realpath(build_dir))
-        if 'meson.build' in [os.path.basename(self.build_dir), self.build_dir]:
-            self.build_dir = os.path.dirname(self.build_dir)
-        self.build = None
-        self.max_choices_line_length = 60
-        self.name_col = []
-        self.value_col = []
-        self.choices_col = []
-        self.descr_col = []
-        self.has_choices = False
-        self.all_subprojects = set()
-        self.yielding_options = set()
-
-        if os.path.isdir(os.path.join(self.build_dir, 'meson-private')):
-            self.build = build.load(self.build_dir)
-            self.source_dir = self.build.environment.get_source_dir()
-            self.coredata = coredata.load(self.build_dir)
-            self.default_values_only = False
-        elif os.path.isfile(os.path.join(self.build_dir, environment.build_filename)):
-            # Make sure that log entries in other parts of meson don't interfere with the JSON output
-            mlog.disable()
-            self.source_dir = os.path.abspath(os.path.realpath(self.build_dir))
-            intr = mintro.IntrospectionInterpreter(self.source_dir, '', 'ninja', visitors = [AstIDGenerator()])
-            intr.analyze()
-            # Re-enable logging just in case
-            mlog.enable()
-            self.coredata = intr.coredata
-            self.default_values_only = True
-        else:
-            raise ConfException('Directory {} is neither a Meson build directory nor a project source directory.'.format(build_dir))
-
-    def clear_cache(self):
-        self.coredata.deps.host.clear()
-        self.coredata.deps.build.clear()
-
-    def set_options(self, options):
-        self.coredata.set_options(options)
-
-    def save(self):
-        # Do nothing when using introspection
-        if self.default_values_only:
-            return
-        # Only called if something has changed so overwrite unconditionally.
-        coredata.save(self.coredata, self.build_dir)
-        # We don't write the build file because any changes to it
-        # are erased when Meson is executed the next time, i.e. when
-        # Ninja is run.
-
-    def print_aligned(self):
-        col_widths = (max([len(i) for i in self.name_col], default=0),
-                      max([len(i) for i in self.value_col], default=0),
-                      max([len(i) for i in self.choices_col], default=0))
-
-        for line in zip(self.name_col, self.value_col, self.choices_col, self.descr_col):
-            if self.has_choices:
-                print('{0:{width[0]}} {1:{width[1]}} {2:{width[2]}} {3}'.format(*line, width=col_widths))
-            else:
-                print('{0:{width[0]}} {1:{width[1]}} {3}'.format(*line, width=col_widths))
-
-    def split_options_per_subproject(self, options):
-        result = {}
-        for k, o in options.items():
-            subproject = ''
-            if ':' in k:
-                subproject, optname = k.split(':')
-                if o.yielding and optname in options:
-                    self.yielding_options.add(k)
-                self.all_subprojects.add(subproject)
-            result.setdefault(subproject, {})[k] = o
-        return result
-
-    def _add_line(self, name, value, choices, descr):
-        self.name_col.append(' ' * self.print_margin + name)
-        self.value_col.append(value)
-        self.choices_col.append(choices)
-        self.descr_col.append(descr)
-
-    def add_option(self, name, descr, value, choices):
-        if isinstance(value, list):
-            value = '[{0}]'.format(', '.join(make_lower_case(value)))
-        else:
-            value = make_lower_case(value)
-
-        if choices:
-            self.has_choices = True
-            if isinstance(choices, list):
-                choices_list = make_lower_case(choices)
-                current = '['
-                while choices_list:
-                    i = choices_list.pop(0)
-                    if len(current) + len(i) >= self.max_choices_line_length:
-                        self._add_line(name, value, current + ',', descr)
-                        name = ''
-                        value = ''
-                        descr = ''
-                        current = ' '
-                    if len(current) > 1:
-                        current += ', '
-                    current += i
-                choices = current + ']'
-            else:
-                choices = make_lower_case(choices)
-        else:
-            choices = ''
-
-        self._add_line(name, value, choices, descr)
-
-    def add_title(self, title):
-        titles = {'descr': 'Description', 'value': 'Current Value', 'choices': 'Possible Values'}
-        if self.default_values_only:
-            titles['value'] = 'Default Value'
-        self._add_line('', '', '', '')
-        self._add_line(title, titles['value'], titles['choices'], titles['descr'])
-        self._add_line('-' * len(title), '-' * len(titles['value']), '-' * len(titles['choices']), '-' * len(titles['descr']))
-
-    def add_section(self, section):
-        self.print_margin = 0
-        self._add_line('', '', '', '')
-        self._add_line(section + ':', '', '', '')
-        self.print_margin = 2
-
-    def print_options(self, title, options):
-        if not options:
-            return
-        if title:
-            self.add_title(title)
-        for k, o in sorted(options.items()):
-            printable_value = o.printable_value()
-            if k in self.yielding_options:
-                printable_value = '<inherited from main project>'
-            self.add_option(k, o.description, printable_value, o.choices)
-
-    def print_conf(self):
-        def print_default_values_warning():
-            mlog.warning('The source directory instead of the build directory was specified.')
-            mlog.warning('Only the default values for the project are printed, and all command line parameters are ignored.')
-
-        if self.default_values_only:
-            print_default_values_warning()
-            print('')
-
-        print('Core properties:')
-        print('  Source dir', self.source_dir)
-        if not self.default_values_only:
-            print('  Build dir ', self.build_dir)
-
-        dir_option_names = ['bindir',
-                            'datadir',
-                            'includedir',
-                            'infodir',
-                            'libdir',
-                            'libexecdir',
-                            'localedir',
-                            'localstatedir',
-                            'mandir',
-                            'prefix',
-                            'sbindir',
-                            'sharedstatedir',
-                            'sysconfdir']
-        test_option_names = ['errorlogs',
-                             'stdsplit']
-        core_option_names = [k for k in self.coredata.builtins if k not in dir_option_names + test_option_names]
-
-        dir_options = {k: o for k, o in self.coredata.builtins.items() if k in dir_option_names}
-        test_options = {k: o for k, o in self.coredata.builtins.items() if k in test_option_names}
-        core_options = {k: o for k, o in self.coredata.builtins.items() if k in core_option_names}
-
-        def insert_build_prefix(k):
-            idx = k.find(':')
-            if idx < 0:
-                return 'build.' + k
-            return k[:idx + 1] + 'build.' + k[idx + 1:]
-
-        core_options = self.split_options_per_subproject(core_options)
-        host_compiler_options = self.split_options_per_subproject(
-            dict(self.coredata.flatten_lang_iterator(
-                self.coredata.compiler_options.host.items())))
-        build_compiler_options = self.split_options_per_subproject(
-            dict(self.coredata.flatten_lang_iterator(
-                (insert_build_prefix(k), o)
-                for k, o in self.coredata.compiler_options.build.items())))
-        project_options = self.split_options_per_subproject(self.coredata.user_options)
-        show_build_options = self.default_values_only or self.build.environment.is_cross_build()
-
-        self.add_section('Main project options')
-        self.print_options('Core options', core_options[''])
-        self.print_options('', self.coredata.builtins_per_machine.host)
-        if show_build_options:
-            self.print_options('', {insert_build_prefix(k): o for k, o in self.coredata.builtins_per_machine.build.items()})
-        self.print_options('Backend options', self.coredata.backend_options)
-        self.print_options('Base options', self.coredata.base_options)
-        self.print_options('Compiler options', host_compiler_options.get('', {}))
-        if show_build_options:
-            self.print_options('', build_compiler_options.get('', {}))
-        self.print_options('Directories', dir_options)
-        self.print_options('Testing options', test_options)
-        self.print_options('Project options', project_options.get('', {}))
-        for subproject in sorted(self.all_subprojects):
-            if subproject == '':
-                continue
-            self.add_section('Subproject ' + subproject)
-            if subproject in core_options:
-                self.print_options('Core options', core_options[subproject])
-            if subproject in host_compiler_options:
-                self.print_options('Compiler options', host_compiler_options[subproject])
-            if subproject in build_compiler_options and show_build_options:
-                self.print_options('', build_compiler_options[subproject])
-            if subproject in project_options:
-                self.print_options('Project options', project_options[subproject])
-        self.print_aligned()
-
-        # Print the warning twice so that the user shouldn't be able to miss it
-        if self.default_values_only:
-            print('')
-            print_default_values_warning()
-
-def run(options):
-    coredata.parse_cmd_line_options(options)
-    builddir = os.path.abspath(os.path.realpath(options.builddir))
-    c = None
-    try:
-        c = Conf(builddir)
-        if c.default_values_only:
-            c.print_conf()
-            return 0
-
-        save = False
-        if len(options.cmd_line_options) > 0:
-            c.set_options(options.cmd_line_options)
-            coredata.update_cmd_line_file(builddir, options)
-            save = True
-        elif options.clearcache:
-            c.clear_cache()
-            save = True
-        else:
-            c.print_conf()
-        if save:
-            c.save()
-            mintro.update_build_options(c.coredata, c.build.environment.info_dir)
-            mintro.write_meson_info_file(c.build, [])
-    except ConfException as e:
-        print('Meson configurator encountered an error:')
-        if c is not None and c.build is not None:
-            mintro.write_meson_info_file(c.build, [e])
-        raise e
-    return 0
diff --git a/meson/mesonbuild/mdist.py b/meson/mesonbuild/mdist.py
deleted file mode 100644 (file)
index fbda240..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import gzip
-import os
-import sys
-import shutil
-import subprocess
-import hashlib
-import json
-from glob import glob
-from pathlib import Path
-from mesonbuild.environment import detect_ninja
-from mesonbuild.mesonlib import windows_proof_rmtree, MesonException
-from mesonbuild.wrap import wrap
-from mesonbuild import mlog, build
-
-archive_choices = ['gztar', 'xztar', 'zip']
-archive_extension = {'gztar': '.tar.gz',
-                     'xztar': '.tar.xz',
-                     'zip': '.zip'}
-
-def add_arguments(parser):
-    parser.add_argument('-C', default='.', dest='wd',
-                        help='directory to cd into before running')
-    parser.add_argument('--formats', default='xztar',
-                        help='Comma separated list of archive types to create.')
-    parser.add_argument('--include-subprojects', action='store_true',
-                        help='Include source code of subprojects that have been used for the build.')
-    parser.add_argument('--no-tests', action='store_true',
-                        help='Do not build and test generated packages.')
-
-
-def create_hash(fname):
-    hashname = fname + '.sha256sum'
-    m = hashlib.sha256()
-    m.update(open(fname, 'rb').read())
-    with open(hashname, 'w') as f:
-        f.write('{} {}\n'.format(m.hexdigest(), os.path.basename(fname)))
-    print(os.path.relpath(fname), m.hexdigest())
-
-
-def del_gitfiles(dirname):
-    for f in glob(os.path.join(dirname, '.git*')):
-        if os.path.isdir(f) and not os.path.islink(f):
-            windows_proof_rmtree(f)
-        else:
-            os.unlink(f)
-
-def process_submodules(dirname):
-    module_file = os.path.join(dirname, '.gitmodules')
-    if not os.path.exists(module_file):
-        return
-    subprocess.check_call(['git', 'submodule', 'update', '--init', '--recursive'], cwd=dirname)
-    for line in open(module_file):
-        line = line.strip()
-        if '=' not in line:
-            continue
-        k, v = line.split('=', 1)
-        k = k.strip()
-        v = v.strip()
-        if k != 'path':
-            continue
-        del_gitfiles(os.path.join(dirname, v))
-
-
-def run_dist_scripts(src_root, bld_root, dist_root, dist_scripts):
-    assert(os.path.isabs(dist_root))
-    env = os.environ.copy()
-    env['MESON_DIST_ROOT'] = dist_root
-    env['MESON_SOURCE_ROOT'] = src_root
-    env['MESON_BUILD_ROOT'] = bld_root
-    for d in dist_scripts:
-        script = d['exe']
-        args = d['args']
-        name = ' '.join(script + args)
-        print('Running custom dist script {!r}'.format(name))
-        try:
-            rc = subprocess.call(script + args, env=env)
-            if rc != 0:
-                sys.exit('Dist script errored out')
-        except OSError:
-            print('Failed to run dist script {!r}'.format(name))
-            sys.exit(1)
-
-def is_git(src_root):
-    _git = os.path.join(src_root, '.git')
-    return os.path.isdir(_git) or os.path.isfile(_git)
-
-def git_have_dirty_index(src_root):
-    '''Check whether there are uncommitted changes in git'''
-    ret = subprocess.call(['git', '-C', src_root, 'diff-index', '--quiet', 'HEAD'])
-    return ret == 1
-
-def git_clone(src_root, distdir):
-    if git_have_dirty_index(src_root):
-        mlog.warning('Repository has uncommitted changes that will not be included in the dist tarball')
-    if os.path.exists(distdir):
-        shutil.rmtree(distdir)
-    os.makedirs(distdir)
-    subprocess.check_call(['git', 'clone', '--shared', src_root, distdir])
-    process_submodules(distdir)
-    del_gitfiles(distdir)
-
-def create_dist_git(dist_name, archives, src_root, bld_root, dist_sub, dist_scripts, subprojects):
-    distdir = os.path.join(dist_sub, dist_name)
-    git_clone(src_root, distdir)
-    for path in subprojects:
-        sub_src_root = os.path.join(src_root, path)
-        sub_distdir = os.path.join(distdir, path)
-        if os.path.exists(sub_distdir):
-            continue
-        if is_git(sub_src_root):
-            git_clone(sub_src_root, sub_distdir)
-        else:
-            shutil.copytree(sub_src_root, sub_distdir)
-    run_dist_scripts(src_root, bld_root, distdir, dist_scripts)
-    output_names = []
-    for a in archives:
-        compressed_name = distdir + archive_extension[a]
-        shutil.make_archive(distdir, a, root_dir=dist_sub, base_dir=dist_name)
-        output_names.append(compressed_name)
-    shutil.rmtree(distdir)
-    return output_names
-
-def is_hg(src_root):
-    return os.path.isdir(os.path.join(src_root, '.hg'))
-
-def hg_have_dirty_index(src_root):
-    '''Check whether there are uncommitted changes in hg'''
-    out = subprocess.check_output(['hg', '-R', src_root, 'summary'])
-    return b'commit: (clean)' not in out
-
-def create_dist_hg(dist_name, archives, src_root, bld_root, dist_sub, dist_scripts):
-    if hg_have_dirty_index(src_root):
-        mlog.warning('Repository has uncommitted changes that will not be included in the dist tarball')
-    if dist_scripts:
-        mlog.warning('dist scripts are not supported in Mercurial projects')
-
-    os.makedirs(dist_sub, exist_ok=True)
-    tarname = os.path.join(dist_sub, dist_name + '.tar')
-    xzname = tarname + '.xz'
-    gzname = tarname + '.gz'
-    zipname = os.path.join(dist_sub, dist_name + '.zip')
-    # Note that -X interprets relative paths using the current working
-    # directory, not the repository root, so this must be an absolute path:
-    # https://bz.mercurial-scm.org/show_bug.cgi?id=6267
-    #
-    # .hg[a-z]* is used instead of .hg* to keep .hg_archival.txt, which may
-    # be useful to link the tarball to the Mercurial revision for either
-    # manual inspection or in case any code interprets it for a --version or
-    # similar.
-    subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'tar',
-                           '-X', src_root + '/.hg[a-z]*', tarname])
-    output_names = []
-    if 'xztar' in archives:
-        import lzma
-        with lzma.open(xzname, 'wb') as xf, open(tarname, 'rb') as tf:
-            shutil.copyfileobj(tf, xf)
-        output_names.append(xzname)
-    if 'gztar' in archives:
-        with gzip.open(gzname, 'wb') as zf, open(tarname, 'rb') as tf:
-            shutil.copyfileobj(tf, zf)
-        output_names.append(gzname)
-    os.unlink(tarname)
-    if 'zip' in archives:
-        subprocess.check_call(['hg', 'archive', '-R', src_root, '-S', '-t', 'zip', zipname])
-        output_names.append(zipname)
-    return output_names
-
-def run_dist_steps(meson_command, unpacked_src_dir, builddir, installdir, ninja_args):
-    if subprocess.call(meson_command + ['--backend=ninja', unpacked_src_dir, builddir]) != 0:
-        print('Running Meson on distribution package failed')
-        return 1
-    if subprocess.call(ninja_args, cwd=builddir) != 0:
-        print('Compiling the distribution package failed')
-        return 1
-    if subprocess.call(ninja_args + ['test'], cwd=builddir) != 0:
-        print('Running unit tests on the distribution package failed')
-        return 1
-    myenv = os.environ.copy()
-    myenv['DESTDIR'] = installdir
-    if subprocess.call(ninja_args + ['install'], cwd=builddir, env=myenv) != 0:
-        print('Installing the distribution package failed')
-        return 1
-    return 0
-
-def check_dist(packagename, meson_command, extra_meson_args, bld_root, privdir):
-    print('Testing distribution package {}'.format(packagename))
-    unpackdir = os.path.join(privdir, 'dist-unpack')
-    builddir = os.path.join(privdir, 'dist-build')
-    installdir = os.path.join(privdir, 'dist-install')
-    for p in (unpackdir, builddir, installdir):
-        if os.path.exists(p):
-            windows_proof_rmtree(p)
-        os.mkdir(p)
-    ninja_args = detect_ninja()
-    shutil.unpack_archive(packagename, unpackdir)
-    unpacked_files = glob(os.path.join(unpackdir, '*'))
-    assert(len(unpacked_files) == 1)
-    unpacked_src_dir = unpacked_files[0]
-    with open(os.path.join(bld_root, 'meson-info', 'intro-buildoptions.json')) as boptions:
-        meson_command += ['-D{name}={value}'.format(**o) for o in json.load(boptions)
-                          if o['name'] not in ['backend', 'install_umask', 'buildtype']]
-    meson_command += extra_meson_args
-
-    ret = run_dist_steps(meson_command, unpacked_src_dir, builddir, installdir, ninja_args)
-    if ret > 0:
-        print('Dist check build directory was {}'.format(builddir))
-    else:
-        windows_proof_rmtree(unpackdir)
-        windows_proof_rmtree(builddir)
-        windows_proof_rmtree(installdir)
-        print('Distribution package {} tested'.format(packagename))
-    return ret
-
-def determine_archives_to_generate(options):
-    result = []
-    for i in options.formats.split(','):
-        if i not in archive_choices:
-            sys.exit('Value "{}" not one of permitted values {}.'.format(i, archive_choices))
-        result.append(i)
-    if len(i) == 0:
-        sys.exit('No archive types specified.')
-    return result
-
-def run(options):
-    options.wd = os.path.abspath(options.wd)
-    buildfile = Path(options.wd) / 'meson-private' / 'build.dat'
-    if not buildfile.is_file():
-        raise MesonException('Directory {!r} does not seem to be a Meson build directory.'.format(options.wd))
-    b = build.load(options.wd)
-    # This import must be load delayed, otherwise it will get the default
-    # value of None.
-    from mesonbuild.mesonlib import meson_command
-    src_root = b.environment.source_dir
-    bld_root = b.environment.build_dir
-    priv_dir = os.path.join(bld_root, 'meson-private')
-    dist_sub = os.path.join(bld_root, 'meson-dist')
-
-    dist_name = b.project_name + '-' + b.project_version
-
-    archives = determine_archives_to_generate(options)
-
-    subprojects = []
-    extra_meson_args = []
-    if options.include_subprojects:
-        subproject_dir = os.path.join(src_root, b.subproject_dir)
-        for sub in b.subprojects:
-            directory = wrap.get_directory(subproject_dir, sub)
-            subprojects.append(os.path.join(b.subproject_dir, directory))
-        extra_meson_args.append('-Dwrap_mode=nodownload')
-
-    if is_git(src_root):
-        names = create_dist_git(dist_name, archives, src_root, bld_root, dist_sub, b.dist_scripts, subprojects)
-    elif is_hg(src_root):
-        if subprojects:
-            print('--include-subprojects option currently not supported with Mercurial')
-            return 1
-        names = create_dist_hg(dist_name, archives, src_root, bld_root, dist_sub, b.dist_scripts)
-    else:
-        print('Dist currently only works with Git or Mercurial repos')
-        return 1
-    if names is None:
-        return 1
-    rc = 0
-    if not options.no_tests:
-        # Check only one.
-        rc = check_dist(names[0], meson_command, extra_meson_args, bld_root, priv_dir)
-    if rc == 0:
-        for name in names:
-            create_hash(name)
-    return rc
diff --git a/meson/mesonbuild/mesondata.py b/meson/mesonbuild/mesondata.py
deleted file mode 100644 (file)
index 1f223c2..0000000
+++ /dev/null
@@ -1,374 +0,0 @@
-# Copyright 2020 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-####
-####  WARNING: This is an automatically generated file! Do not edit!
-####           Generated by tools/gen_data.py
-####
-
-
-from pathlib import Path
-import typing as T
-
-if T.TYPE_CHECKING:
-    from .environment import Environment
-
-######################
-# BEGIN Data section #
-######################
-
-file_0_data_CMakeListsLLVM_txt = '''\
-cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION} )
-
-set(PACKAGE_FOUND FALSE)
-
-while(TRUE)
-  find_package(LLVM REQUIRED CONFIG QUIET)
-
-  # ARCHS has to be set via the CMD interface
-  if(LLVM_FOUND OR "${ARCHS}" STREQUAL "")
-    break()
-  endif()
-
-  list(GET       ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
-  list(REMOVE_AT ARCHS 0)
-endwhile()
-
-if(LLVM_FOUND)
-  set(PACKAGE_FOUND TRUE)
-
-  foreach(mod IN LISTS LLVM_MESON_MODULES)
-    # Reset variables
-    set(out_mods)
-    set(real_mods)
-
-    # Generate a lower and upper case version
-    string(TOLOWER "${mod}" mod_L)
-    string(TOUPPER "${mod}" mod_U)
-
-    # Get the mapped components
-    llvm_map_components_to_libnames(out_mods ${mod} ${mod_L} ${mod_U})
-    list(SORT              out_mods)
-    list(REMOVE_DUPLICATES out_mods)
-
-    # Make sure that the modules exist
-    foreach(i IN LISTS out_mods)
-      if(TARGET ${i})
-        list(APPEND real_mods ${i})
-      endif()
-    endforeach()
-
-    # Set the output variables
-    set(MESON_LLVM_TARGETS_${mod} ${real_mods})
-    foreach(i IN LISTS real_mods)
-      set(MESON_TARGET_TO_LLVM_${i} ${mod})
-    endforeach()
-  endforeach()
-
-  # Check the following variables:
-  # LLVM_PACKAGE_VERSION
-  # LLVM_VERSION
-  # LLVM_VERSION_STRING
-  if(NOT DEFINED PACKAGE_VERSION)
-    if(DEFINED LLVM_PACKAGE_VERSION)
-      set(PACKAGE_VERSION "${LLVM_PACKAGE_VERSION}")
-    elseif(DEFINED LLVM_VERSION)
-      set(PACKAGE_VERSION "${LLVM_VERSION}")
-    elseif(DEFINED LLVM_VERSION_STRING)
-      set(PACKAGE_VERSION "${LLVM_VERSION_STRING}")
-    endif()
-  endif()
-
-  # Check the following variables:
-  # LLVM_LIBRARIES
-  # LLVM_LIBS
-  set(libs)
-  if(DEFINED LLVM_LIBRARIES)
-    set(libs LLVM_LIBRARIES)
-  elseif(DEFINED LLVM_LIBS)
-    set(libs LLVM_LIBS)
-  endif()
-
-  # Check the following variables:
-  # LLVM_INCLUDE_DIRS
-  # LLVM_INCLUDES
-  # LLVM_INCLUDE_DIR
-  set(includes)
-  if(DEFINED LLVM_INCLUDE_DIRS)
-    set(includes LLVM_INCLUDE_DIRS)
-  elseif(DEFINED LLVM_INCLUDES)
-    set(includes LLVM_INCLUDES)
-  elseif(DEFINED LLVM_INCLUDE_DIR)
-    set(includes LLVM_INCLUDE_DIR)
-  endif()
-
-  # Check the following variables:
-  # LLVM_DEFINITIONS
-  set(definitions)
-  if(DEFINED LLVM_DEFINITIONS)
-    set(definitions LLVM_DEFINITIONS)
-  endif()
-
-  set(PACKAGE_INCLUDE_DIRS "${${includes}}")
-  set(PACKAGE_DEFINITIONS  "${${definitions}}")
-  set(PACKAGE_LIBRARIES    "${${libs}}")
-endif()
-'''
-
-file_1_data_CMakePathInfo_txt = '''\
-cmake_minimum_required(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION})
-
-set(TMP_PATHS_LIST)
-list(APPEND TMP_PATHS_LIST ${CMAKE_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_APPBUNDLE_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST $ENV{CMAKE_APPBUNDLE_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_PREFIX_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_FRAMEWORK_PATH})
-list(APPEND TMP_PATHS_LIST ${CMAKE_SYSTEM_APPBUNDLE_PATH})
-
-set(LIB_ARCH_LIST)
-if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)
-  file(GLOB implicit_dirs RELATIVE /lib /lib/*-linux-gnu* )
-  foreach(dir ${implicit_dirs})
-    if("${dir}" MATCHES "${CMAKE_LIBRARY_ARCHITECTURE_REGEX}")
-      list(APPEND LIB_ARCH_LIST "${dir}")
-    endif()
-  endforeach()
-endif()
-
-# "Export" these variables:
-set(MESON_ARCH_LIST ${LIB_ARCH_LIST})
-set(MESON_PATHS_LIST ${TMP_PATHS_LIST})
-set(MESON_CMAKE_ROOT ${CMAKE_ROOT})
-set(MESON_CMAKE_SYSROOT ${CMAKE_SYSROOT})
-set(MESON_FIND_ROOT_PATH ${CMAKE_FIND_ROOT_PATH})
-
-message(STATUS ${TMP_PATHS_LIST})
-'''
-
-file_2_data_CMakeLists_txt = '''\
-# fail noisily if attempt to use this file without setting:
-# cmake_minimum_required(VERSION ${CMAKE_VERSION})
-# project(... LANGUAGES ...)
-
-cmake_policy(SET CMP0000 NEW)
-
-set(PACKAGE_FOUND FALSE)
-set(_packageName "${NAME}")
-string(TOUPPER "${_packageName}" PACKAGE_NAME)
-
-while(TRUE)
-  find_package("${NAME}" QUIET COMPONENTS ${COMPS})
-
-  # ARCHS has to be set via the CMD interface
-  if(${_packageName}_FOUND OR ${PACKAGE_NAME}_FOUND OR "${ARCHS}" STREQUAL "")
-    break()
-  endif()
-
-  list(GET       ARCHS 0 CMAKE_LIBRARY_ARCHITECTURE)
-  list(REMOVE_AT ARCHS 0)
-endwhile()
-
-if(${_packageName}_FOUND  OR  ${PACKAGE_NAME}_FOUND)
-  set(PACKAGE_FOUND TRUE)
-
-  # Check the following variables:
-  # FOO_VERSION
-  # Foo_VERSION
-  # FOO_VERSION_STRING
-  # Foo_VERSION_STRING
-  if(NOT DEFINED PACKAGE_VERSION)
-    if(DEFINED ${_packageName}_VERSION)
-      set(PACKAGE_VERSION "${${_packageName}_VERSION}")
-    elseif(DEFINED ${PACKAGE_NAME}_VERSION)
-      set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION}")
-    elseif(DEFINED ${_packageName}_VERSION_STRING)
-      set(PACKAGE_VERSION "${${_packageName}_VERSION_STRING}")
-    elseif(DEFINED ${PACKAGE_NAME}_VERSION_STRING)
-      set(PACKAGE_VERSION "${${PACKAGE_NAME}_VERSION_STRING}")
-    endif()
-  endif()
-
-  # Check the following variables:
-  # FOO_LIBRARIES
-  # Foo_LIBRARIES
-  # FOO_LIBS
-  # Foo_LIBS
-  set(libs)
-  if(DEFINED ${_packageName}_LIBRARIES)
-    set(libs ${_packageName}_LIBRARIES)
-  elseif(DEFINED ${PACKAGE_NAME}_LIBRARIES)
-    set(libs ${PACKAGE_NAME}_LIBRARIES)
-  elseif(DEFINED ${_packageName}_LIBS)
-    set(libs ${_packageName}_LIBS)
-  elseif(DEFINED ${PACKAGE_NAME}_LIBS)
-    set(libs ${PACKAGE_NAME}_LIBS)
-  endif()
-
-  # Check the following variables:
-  # FOO_INCLUDE_DIRS
-  # Foo_INCLUDE_DIRS
-  # FOO_INCLUDES
-  # Foo_INCLUDES
-  # FOO_INCLUDE_DIR
-  # Foo_INCLUDE_DIR
-  set(includes)
-  if(DEFINED ${_packageName}_INCLUDE_DIRS)
-    set(includes ${_packageName}_INCLUDE_DIRS)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIRS)
-    set(includes ${PACKAGE_NAME}_INCLUDE_DIRS)
-  elseif(DEFINED ${_packageName}_INCLUDES)
-    set(includes ${_packageName}_INCLUDES)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDES)
-    set(includes ${PACKAGE_NAME}_INCLUDES)
-  elseif(DEFINED ${_packageName}_INCLUDE_DIR)
-    set(includes ${_packageName}_INCLUDE_DIR)
-  elseif(DEFINED ${PACKAGE_NAME}_INCLUDE_DIR)
-    set(includes ${PACKAGE_NAME}_INCLUDE_DIR)
-  endif()
-
-  # Check the following variables:
-  # FOO_DEFINITIONS
-  # Foo_DEFINITIONS
-  set(definitions)
-  if(DEFINED ${_packageName}_DEFINITIONS)
-    set(definitions ${_packageName}_DEFINITIONS)
-  elseif(DEFINED ${PACKAGE_NAME}_DEFINITIONS)
-    set(definitions ${PACKAGE_NAME}_DEFINITIONS)
-  endif()
-
-  set(PACKAGE_INCLUDE_DIRS "${${includes}}")
-  set(PACKAGE_DEFINITIONS  "${${definitions}}")
-  set(PACKAGE_LIBRARIES    "${${libs}}")
-endif()
-'''
-
-file_3_data_preload_cmake = '''\
-if(MESON_PS_LOADED)
-  return()
-endif()
-
-set(MESON_PS_LOADED ON)
-
-# Dummy macros that have a special meaning in the meson code
-macro(meson_ps_execute_delayed_calls)
-endmacro()
-
-macro(meson_ps_reload_vars)
-endmacro()
-
-# Helper macro to inspect the current CMake state
-macro(meson_ps_inspect_vars)
-  set(MESON_PS_CMAKE_CURRENT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}")
-  set(MESON_PS_CMAKE_CURRENT_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-  meson_ps_execute_delayed_calls()
-endmacro()
-
-
-# Override some system functions with custom code and forward the args
-# to the original function
-macro(add_custom_command)
-  meson_ps_inspect_vars()
-  _add_custom_command(${ARGV})
-endmacro()
-
-macro(add_custom_target)
-  meson_ps_inspect_vars()
-  _add_custom_target(${ARGV})
-endmacro()
-
-macro(set_property)
-  meson_ps_inspect_vars()
-  _set_property(${ARGV})
-endmacro()
-
-function(set_source_files_properties)
-  set(FILES)
-  set(I 0)
-  set(PROPERTIES OFF)
-
-  while(I LESS ARGC)
-    if(NOT PROPERTIES)
-      if("${ARGV${I}}" STREQUAL "PROPERTIES")
-        set(PROPERTIES ON)
-      else()
-        list(APPEND FILES "${ARGV${I}}")
-      endif()
-
-      math(EXPR I "${I} + 1")
-    else()
-      set(ID_IDX ${I})
-      math(EXPR PROP_IDX "${ID_IDX} + 1")
-
-      set(ID   "${ARGV${ID_IDX}}")
-      set(PROP "${ARGV${PROP_IDX}}")
-
-      set_property(SOURCE ${FILES} PROPERTY "${ID}" "${PROP}")
-      math(EXPR I "${I} + 2")
-    endif()
-  endwhile()
-endfunction()
-
-set(MESON_PS_DELAYED_CALLS add_custom_command;add_custom_target;set_property)
-meson_ps_reload_vars()
-'''
-
-
-####################
-# END Data section #
-####################
-
-class DataFile:
-    def __init__(self, path: Path, sha256sum: str, data: str) -> None:
-        self.path = path
-        self.sha256sum = sha256sum
-        self.data = data
-
-    def write_once(self, path: Path) -> None:
-        if not path.exists():
-            path.write_text(self.data)
-
-    def write_to_private(self, env: 'Environment') -> Path:
-        out_file = Path(env.scratch_dir) / 'data' / self.path.name
-        out_file.parent.mkdir(exist_ok=True)
-        self.write_once(out_file)
-        return out_file
-
-
-mesondata = {
-    'dependencies/data/CMakeListsLLVM.txt': DataFile(
-        Path('dependencies/data/CMakeListsLLVM.txt'),
-        '412cec3315597041a978d018cdaca282dcd47693793540da88ae2f80d0cbd7cd',
-        file_0_data_CMakeListsLLVM_txt,
-    ),
-    'dependencies/data/CMakePathInfo.txt': DataFile(
-        Path('dependencies/data/CMakePathInfo.txt'),
-        '90da8b443982d9c87139b7dc84228eb58cab4315764949637208f25e2bda7db2',
-        file_1_data_CMakePathInfo_txt,
-    ),
-    'dependencies/data/CMakeLists.txt': DataFile(
-        Path('dependencies/data/CMakeLists.txt'),
-        '71a2d58381f912bbfb1c8709884d34d721f682edf2fca001e1f582f0bffd0da7',
-        file_2_data_CMakeLists_txt,
-    ),
-    'cmake/data/preload.cmake': DataFile(
-        Path('cmake/data/preload.cmake'),
-        '064d047b18a5c919ad016b838bed50c5d40aebe9e53da0e70eff9d52a2c1ca1f',
-        file_3_data_preload_cmake,
-    ),
-}
diff --git a/meson/mesonbuild/mesonlib.py b/meson/mesonbuild/mesonlib.py
deleted file mode 100644 (file)
index 77163d7..0000000
+++ /dev/null
@@ -1,1712 +0,0 @@
-# Copyright 2012-2020 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""A library of random helper functionality."""
-from pathlib import Path
-import sys
-import stat
-import time
-import platform, subprocess, operator, os, shlex, shutil, re
-import collections
-from enum import Enum
-from functools import lru_cache, wraps
-from itertools import tee, filterfalse
-import typing as T
-import uuid
-import textwrap
-
-from mesonbuild import mlog
-
-if T.TYPE_CHECKING:
-    from .build import ConfigurationData
-    from .coredata import OptionDictType, UserOption
-    from .compilers.compilers import CompilerType
-    from .interpreterbase import ObjectHolder
-
-_T = T.TypeVar('_T')
-_U = T.TypeVar('_U')
-
-have_fcntl = False
-have_msvcrt = False
-# TODO: this is such a hack, this really should be either in coredata or in the
-# interpreter
-# {subproject: project_meson_version}
-project_meson_versions = collections.defaultdict(str)  # type: T.DefaultDict[str, str]
-
-try:
-    import fcntl
-    have_fcntl = True
-except Exception:
-    pass
-
-try:
-    import msvcrt
-    have_msvcrt = True
-except Exception:
-    pass
-
-from glob import glob
-
-if os.path.basename(sys.executable) == 'meson.exe':
-    # In Windows and using the MSI installed executable.
-    python_command = [sys.executable, 'runpython']
-else:
-    python_command = [sys.executable]
-meson_command = None
-
-GIT = shutil.which('git')
-def git(cmd: T.List[str], workingdir: str, **kwargs: T.Any) -> subprocess.CompletedProcess:
-    pc = subprocess.run([GIT, '-C', workingdir] + cmd,
-                        # Redirect stdin to DEVNULL otherwise git messes up the
-                        # console and ANSI colors stop working on Windows.
-                        stdin=subprocess.DEVNULL, **kwargs)
-    # Sometimes git calls git recursively, such as `git submodule update
-    # --recursive` which will be without the above workaround, so set the
-    # console mode again just in case.
-    mlog.setup_console()
-    return pc
-
-
-def set_meson_command(mainfile: str) -> None:
-    global python_command
-    global meson_command
-    # On UNIX-like systems `meson` is a Python script
-    # On Windows `meson` and `meson.exe` are wrapper exes
-    if not mainfile.endswith('.py'):
-        meson_command = [mainfile]
-    elif os.path.isabs(mainfile) and mainfile.endswith('mesonmain.py'):
-        # Can't actually run meson with an absolute path to mesonmain.py, it must be run as -m mesonbuild.mesonmain
-        meson_command = python_command + ['-m', 'mesonbuild.mesonmain']
-    else:
-        # Either run uninstalled, or full path to meson-script.py
-        meson_command = python_command + [mainfile]
-    # We print this value for unit tests.
-    if 'MESON_COMMAND_TESTS' in os.environ:
-        mlog.log('meson_command is {!r}'.format(meson_command))
-
-
-def is_ascii_string(astring: T.Union[str, bytes]) -> bool:
-    try:
-        if isinstance(astring, str):
-            astring.encode('ascii')
-        elif isinstance(astring, bytes):
-            astring.decode('ascii')
-    except UnicodeDecodeError:
-        return False
-    return True
-
-
-def check_direntry_issues(direntry_array: T.Union[T.List[T.Union[str, bytes]], str, bytes]) -> None:
-    import locale
-    # Warn if the locale is not UTF-8. This can cause various unfixable issues
-    # such as os.stat not being able to decode filenames with unicode in them.
-    # There is no way to reset both the preferred encoding and the filesystem
-    # encoding, so we can just warn about it.
-    e = locale.getpreferredencoding()
-    if e.upper() != 'UTF-8' and not is_windows():
-        if not isinstance(direntry_array, list):
-            direntry_array = [direntry_array]
-        for de in direntry_array:
-            if is_ascii_string(de):
-                continue
-            mlog.warning(textwrap.dedent('''
-                You are using {!r} which is not a Unicode-compatible
-                locale but you are trying to access a file system entry called {!r} which is
-                not pure ASCII. This may cause problems.
-                '''.format(e, de)), file=sys.stderr)
-
-
-# Put this in objects that should not get dumped to pickle files
-# by accident.
-import threading
-an_unpicklable_object = threading.Lock()
-
-
-class MesonException(Exception):
-    '''Exceptions thrown by Meson'''
-
-    file = None    # type: T.Optional[str]
-    lineno = None  # type: T.Optional[int]
-    colno = None   # type: T.Optional[int]
-
-
-class EnvironmentException(MesonException):
-    '''Exceptions thrown while processing and creating the build environment'''
-
-
-class FileMode:
-    # The first triad is for owner permissions, the second for group permissions,
-    # and the third for others (everyone else).
-    # For the 1st character:
-    #  'r' means can read
-    #  '-' means not allowed
-    # For the 2nd character:
-    #  'w' means can write
-    #  '-' means not allowed
-    # For the 3rd character:
-    #  'x' means can execute
-    #  's' means can execute and setuid/setgid is set (owner/group triads only)
-    #  'S' means cannot execute and setuid/setgid is set (owner/group triads only)
-    #  't' means can execute and sticky bit is set ("others" triads only)
-    #  'T' means cannot execute and sticky bit is set ("others" triads only)
-    #  '-' means none of these are allowed
-    #
-    # The meanings of 'rwx' perms is not obvious for directories; see:
-    # https://www.hackinglinuxexposed.com/articles/20030424.html
-    #
-    # For information on this notation such as setuid/setgid/sticky bits, see:
-    # https://en.wikipedia.org/wiki/File_system_permissions#Symbolic_notation
-    symbolic_perms_regex = re.compile('[r-][w-][xsS-]' # Owner perms
-                                      '[r-][w-][xsS-]' # Group perms
-                                      '[r-][w-][xtT-]') # Others perms
-
-    def __init__(self, perms: T.Optional[str] = None, owner: T.Optional[str] = None,
-                 group: T.Optional[str] = None):
-        self.perms_s = perms
-        self.perms = self.perms_s_to_bits(perms)
-        self.owner = owner
-        self.group = group
-
-    def __repr__(self) -> str:
-        ret = '<FileMode: {!r} owner={} group={}'
-        return ret.format(self.perms_s, self.owner, self.group)
-
-    @classmethod
-    def perms_s_to_bits(cls, perms_s: T.Optional[str]) -> int:
-        '''
-        Does the opposite of stat.filemode(), converts strings of the form
-        'rwxr-xr-x' to st_mode enums which can be passed to os.chmod()
-        '''
-        if perms_s is None:
-            # No perms specified, we will not touch the permissions
-            return -1
-        eg = 'rwxr-xr-x'
-        if not isinstance(perms_s, str):
-            msg = 'Install perms must be a string. For example, {!r}'
-            raise MesonException(msg.format(eg))
-        if len(perms_s) != 9 or not cls.symbolic_perms_regex.match(perms_s):
-            msg = 'File perms {!r} must be exactly 9 chars. For example, {!r}'
-            raise MesonException(msg.format(perms_s, eg))
-        perms = 0
-        # Owner perms
-        if perms_s[0] == 'r':
-            perms |= stat.S_IRUSR
-        if perms_s[1] == 'w':
-            perms |= stat.S_IWUSR
-        if perms_s[2] == 'x':
-            perms |= stat.S_IXUSR
-        elif perms_s[2] == 'S':
-            perms |= stat.S_ISUID
-        elif perms_s[2] == 's':
-            perms |= stat.S_IXUSR
-            perms |= stat.S_ISUID
-        # Group perms
-        if perms_s[3] == 'r':
-            perms |= stat.S_IRGRP
-        if perms_s[4] == 'w':
-            perms |= stat.S_IWGRP
-        if perms_s[5] == 'x':
-            perms |= stat.S_IXGRP
-        elif perms_s[5] == 'S':
-            perms |= stat.S_ISGID
-        elif perms_s[5] == 's':
-            perms |= stat.S_IXGRP
-            perms |= stat.S_ISGID
-        # Others perms
-        if perms_s[6] == 'r':
-            perms |= stat.S_IROTH
-        if perms_s[7] == 'w':
-            perms |= stat.S_IWOTH
-        if perms_s[8] == 'x':
-            perms |= stat.S_IXOTH
-        elif perms_s[8] == 'T':
-            perms |= stat.S_ISVTX
-        elif perms_s[8] == 't':
-            perms |= stat.S_IXOTH
-            perms |= stat.S_ISVTX
-        return perms
-
-class File:
-    def __init__(self, is_built: bool, subdir: str, fname: str):
-        self.is_built = is_built
-        self.subdir = subdir
-        self.fname = fname
-
-    def __str__(self) -> str:
-        return self.relative_name()
-
-    def __repr__(self) -> str:
-        ret = '<File: {0}'
-        if not self.is_built:
-            ret += ' (not built)'
-        ret += '>'
-        return ret.format(self.relative_name())
-
-    @staticmethod
-    @lru_cache(maxsize=None)
-    def from_source_file(source_root: str, subdir: str, fname: str) -> 'File':
-        if not os.path.isfile(os.path.join(source_root, subdir, fname)):
-            raise MesonException('File %s does not exist.' % fname)
-        return File(False, subdir, fname)
-
-    @staticmethod
-    def from_built_file(subdir: str, fname: str) -> 'File':
-        return File(True, subdir, fname)
-
-    @staticmethod
-    def from_absolute_file(fname: str) -> 'File':
-        return File(False, '', fname)
-
-    @lru_cache(maxsize=None)
-    def rel_to_builddir(self, build_to_src: str) -> str:
-        if self.is_built:
-            return self.relative_name()
-        else:
-            return os.path.join(build_to_src, self.subdir, self.fname)
-
-    @lru_cache(maxsize=None)
-    def absolute_path(self, srcdir: str, builddir: str) -> str:
-        absdir = srcdir
-        if self.is_built:
-            absdir = builddir
-        return os.path.join(absdir, self.relative_name())
-
-    def endswith(self, ending: str) -> bool:
-        return self.fname.endswith(ending)
-
-    def split(self, s: str) -> T.List[str]:
-        return self.fname.split(s)
-
-    def __eq__(self, other) -> bool:
-        if not isinstance(other, File):
-            return NotImplemented
-        return (self.fname, self.subdir, self.is_built) == (other.fname, other.subdir, other.is_built)
-
-    def __hash__(self) -> int:
-        return hash((self.fname, self.subdir, self.is_built))
-
-    @lru_cache(maxsize=None)
-    def relative_name(self) -> str:
-        return os.path.join(self.subdir, self.fname)
-
-
-def get_compiler_for_source(compilers: T.Iterable['CompilerType'], src: str) -> 'CompilerType':
-    """Given a set of compilers and a source, find the compiler for that source type."""
-    for comp in compilers:
-        if comp.can_compile(src):
-            return comp
-    raise MesonException('No specified compiler can handle file {!s}'.format(src))
-
-
-def classify_unity_sources(compilers: T.Iterable['CompilerType'], sources: T.Iterable[str]) -> T.Dict['CompilerType', T.List[str]]:
-    compsrclist = {}  # type: T.Dict[CompilerType, T.List[str]]
-    for src in sources:
-        comp = get_compiler_for_source(compilers, src)
-        if comp not in compsrclist:
-            compsrclist[comp] = [src]
-        else:
-            compsrclist[comp].append(src)
-    return compsrclist
-
-
-class OrderedEnum(Enum):
-    """
-    An Enum which additionally offers homogeneous ordered comparison.
-    """
-    def __ge__(self, other):
-        if self.__class__ is other.__class__:
-            return self.value >= other.value
-        return NotImplemented
-
-    def __gt__(self, other):
-        if self.__class__ is other.__class__:
-            return self.value > other.value
-        return NotImplemented
-
-    def __le__(self, other):
-        if self.__class__ is other.__class__:
-            return self.value <= other.value
-        return NotImplemented
-
-    def __lt__(self, other):
-        if self.__class__ is other.__class__:
-            return self.value < other.value
-        return NotImplemented
-
-
-class MachineChoice(OrderedEnum):
-
-    """Enum class representing one of the two abstract machine names used in
-    most places: the build, and host, machines.
-    """
-
-    BUILD = 0
-    HOST = 1
-
-    def get_lower_case_name(self) -> str:
-        return PerMachine('build', 'host')[self]
-
-    def get_prefix(self) -> str:
-        return PerMachine('build.', '')[self]
-
-
-class PerMachine(T.Generic[_T]):
-    def __init__(self, build: _T, host: _T):
-        self.build = build
-        self.host = host
-
-    def __getitem__(self, machine: MachineChoice) -> _T:
-        return {
-            MachineChoice.BUILD:  self.build,
-            MachineChoice.HOST:   self.host,
-        }[machine]
-
-    def __setitem__(self, machine: MachineChoice, val: _T) -> None:
-        setattr(self, machine.get_lower_case_name(), val)
-
-    def miss_defaulting(self) -> "PerMachineDefaultable[T.Optional[_T]]":
-        """Unset definition duplicated from their previous to None
-
-        This is the inverse of ''default_missing''. By removing defaulted
-        machines, we can elaborate the original and then redefault them and thus
-        avoid repeating the elaboration explicitly.
-        """
-        unfreeze = PerMachineDefaultable() # type: PerMachineDefaultable[T.Optional[_T]]
-        unfreeze.build = self.build
-        unfreeze.host = self.host
-        if unfreeze.host == unfreeze.build:
-            unfreeze.host = None
-        return unfreeze
-
-
-class PerThreeMachine(PerMachine[_T]):
-    """Like `PerMachine` but includes `target` too.
-
-    It turns out just one thing do we need track the target machine. There's no
-    need to computer the `target` field so we don't bother overriding the
-    `__getitem__`/`__setitem__` methods.
-    """
-    def __init__(self, build: _T, host: _T, target: _T):
-        super().__init__(build, host)
-        self.target = target
-
-    def miss_defaulting(self) -> "PerThreeMachineDefaultable[T.Optional[_T]]":
-        """Unset definition duplicated from their previous to None
-
-        This is the inverse of ''default_missing''. By removing defaulted
-        machines, we can elaborate the original and then redefault them and thus
-        avoid repeating the elaboration explicitly.
-        """
-        unfreeze = PerThreeMachineDefaultable() # type: PerThreeMachineDefaultable[T.Optional[_T]]
-        unfreeze.build = self.build
-        unfreeze.host = self.host
-        unfreeze.target = self.target
-        if unfreeze.target == unfreeze.host:
-            unfreeze.target = None
-        if unfreeze.host == unfreeze.build:
-            unfreeze.host = None
-        return unfreeze
-
-    def matches_build_machine(self, machine: MachineChoice) -> bool:
-        return self.build == self[machine]
-
-
-class PerMachineDefaultable(PerMachine[T.Optional[_T]]):
-    """Extends `PerMachine` with the ability to default from `None`s.
-    """
-    def __init__(self):
-        super().__init__(None, None)
-
-    def default_missing(self) -> "PerMachine[T.Optional[_T]]":
-        """Default host to build
-
-        This allows just specifying nothing in the native case, and just host in the
-        cross non-compiler case.
-        """
-        freeze = PerMachine(self.build, self.host)
-        if freeze.host is None:
-            freeze.host = freeze.build
-        return freeze
-
-
-class PerThreeMachineDefaultable(PerMachineDefaultable, PerThreeMachine[T.Optional[_T]]):
-    """Extends `PerThreeMachine` with the ability to default from `None`s.
-    """
-    def __init__(self):
-        PerThreeMachine.__init__(self, None, None, None)
-
-    def default_missing(self) -> "PerThreeMachine[T.Optional[_T]]":
-        """Default host to build and target to host.
-
-        This allows just specifying nothing in the native case, just host in the
-        cross non-compiler case, and just target in the native-built
-        cross-compiler case.
-        """
-        freeze = PerThreeMachine(self.build, self.host, self.target)
-        if freeze.host is None:
-            freeze.host = freeze.build
-        if freeze.target is None:
-            freeze.target = freeze.host
-        return freeze
-
-
-def is_sunos() -> bool:
-    return platform.system().lower() == 'sunos'
-
-
-def is_osx() -> bool:
-    return platform.system().lower() == 'darwin'
-
-
-def is_linux() -> bool:
-    return platform.system().lower() == 'linux'
-
-
-def is_android() -> bool:
-    return platform.system().lower() == 'android'
-
-
-def is_haiku() -> bool:
-    return platform.system().lower() == 'haiku'
-
-
-def is_openbsd() -> bool:
-    return platform.system().lower() == 'openbsd'
-
-
-def is_windows() -> bool:
-    platname = platform.system().lower()
-    return platname == 'windows' or 'mingw' in platname
-
-
-def is_cygwin() -> bool:
-    return platform.system().lower().startswith('cygwin')
-
-
-def is_debianlike() -> bool:
-    return os.path.isfile('/etc/debian_version')
-
-
-def is_dragonflybsd() -> bool:
-    return platform.system().lower() == 'dragonfly'
-
-
-def is_netbsd() -> bool:
-    return platform.system().lower() == 'netbsd'
-
-
-def is_freebsd() -> bool:
-    return platform.system().lower() == 'freebsd'
-
-def is_irix() -> bool:
-    return platform.system().startswith('irix')
-
-def is_hurd() -> bool:
-    return platform.system().lower() == 'gnu'
-
-def is_qnx() -> bool:
-    return platform.system().lower() == 'qnx'
-
-def exe_exists(arglist: T.List[str]) -> bool:
-    try:
-        if subprocess.run(arglist, timeout=10).returncode == 0:
-            return True
-    except (FileNotFoundError, subprocess.TimeoutExpired):
-        pass
-    return False
-
-
-@lru_cache(maxsize=None)
-def darwin_get_object_archs(objpath: str) -> T.List[str]:
-    '''
-    For a specific object (executable, static library, dylib, etc), run `lipo`
-    to fetch the list of archs supported by it. Supports both thin objects and
-    'fat' objects.
-    '''
-    _, stdo, stderr = Popen_safe(['lipo', '-info', objpath])
-    if not stdo:
-        mlog.debug('lipo {}: {}'.format(objpath, stderr))
-        return None
-    stdo = stdo.rsplit(': ', 1)[1]
-    # Convert from lipo-style archs to meson-style CPUs
-    stdo = stdo.replace('i386', 'x86')
-    stdo = stdo.replace('arm64', 'aarch64')
-    # Add generic name for armv7 and armv7s
-    if 'armv7' in stdo:
-        stdo += ' arm'
-    return stdo.split()
-
-
-def detect_vcs(source_dir: T.Union[str, Path]) -> T.Optional[T.Dict[str, str]]:
-    vcs_systems = [
-        dict(name = 'git',        cmd = 'git', repo_dir = '.git', get_rev = 'git describe --dirty=+', rev_regex = '(.*)', dep = '.git/logs/HEAD'),
-        dict(name = 'mercurial',  cmd = 'hg',  repo_dir = '.hg',  get_rev = 'hg id -i',               rev_regex = '(.*)', dep = '.hg/dirstate'),
-        dict(name = 'subversion', cmd = 'svn', repo_dir = '.svn', get_rev = 'svn info',               rev_regex = 'Revision: (.*)', dep = '.svn/wc.db'),
-        dict(name = 'bazaar',     cmd = 'bzr', repo_dir = '.bzr', get_rev = 'bzr revno',              rev_regex = '(.*)', dep = '.bzr'),
-    ]
-    if isinstance(source_dir, str):
-        source_dir = Path(source_dir)
-
-    parent_paths_and_self = collections.deque(source_dir.parents)
-    # Prepend the source directory to the front so we can check it;
-    # source_dir.parents doesn't include source_dir
-    parent_paths_and_self.appendleft(source_dir)
-    for curdir in parent_paths_and_self:
-        for vcs in vcs_systems:
-            if Path.is_dir(curdir.joinpath(vcs['repo_dir'])) and shutil.which(vcs['cmd']):
-                vcs['wc_dir'] = str(curdir)
-                return vcs
-    return None
-
-# a helper class which implements the same version ordering as RPM
-class Version:
-    def __init__(self, s: str):
-        self._s = s
-
-        # split into numeric, alphabetic and non-alphanumeric sequences
-        sequences1 = re.finditer(r'(\d+|[a-zA-Z]+|[^a-zA-Z\d]+)', s)
-
-        # non-alphanumeric separators are discarded
-        sequences2 = [m for m in sequences1 if not re.match(r'[^a-zA-Z\d]+', m.group(1))]
-
-        # numeric sequences are converted from strings to ints
-        sequences3 = [int(m.group(1)) if m.group(1).isdigit() else m.group(1) for m in sequences2]
-
-        self._v = sequences3
-
-    def __str__(self):
-        return '%s (V=%s)' % (self._s, str(self._v))
-
-    def __repr__(self):
-        return '<Version: {}>'.format(self._s)
-
-    def __lt__(self, other):
-        if isinstance(other, Version):
-            return self.__cmp(other, operator.lt)
-        return NotImplemented
-
-    def __gt__(self, other):
-        if isinstance(other, Version):
-            return self.__cmp(other, operator.gt)
-        return NotImplemented
-
-    def __le__(self, other):
-        if isinstance(other, Version):
-            return self.__cmp(other, operator.le)
-        return NotImplemented
-
-    def __ge__(self, other):
-        if isinstance(other, Version):
-            return self.__cmp(other, operator.ge)
-        return NotImplemented
-
-    def __eq__(self, other):
-        if isinstance(other, Version):
-            return self._v == other._v
-        return NotImplemented
-
-    def __ne__(self, other):
-        if isinstance(other, Version):
-            return self._v != other._v
-        return NotImplemented
-
-    def __cmp(self, other: 'Version', comparator: T.Callable[[T.Any, T.Any], bool]) -> bool:
-        # compare each sequence in order
-        for ours, theirs in zip(self._v, other._v):
-            # sort a non-digit sequence before a digit sequence
-            ours_is_int = isinstance(ours, int)
-            theirs_is_int = isinstance(theirs, int)
-            if ours_is_int != theirs_is_int:
-                return comparator(ours_is_int, theirs_is_int)
-
-            if ours != theirs:
-                return comparator(ours, theirs)
-
-        # if equal length, all components have matched, so equal
-        # otherwise, the version with a suffix remaining is greater
-        return comparator(len(self._v), len(other._v))
-
-
-def _version_extract_cmpop(vstr2: str) -> T.Tuple[T.Callable[[T.Any, T.Any], bool], str]:
-    if vstr2.startswith('>='):
-        cmpop = operator.ge
-        vstr2 = vstr2[2:]
-    elif vstr2.startswith('<='):
-        cmpop = operator.le
-        vstr2 = vstr2[2:]
-    elif vstr2.startswith('!='):
-        cmpop = operator.ne
-        vstr2 = vstr2[2:]
-    elif vstr2.startswith('=='):
-        cmpop = operator.eq
-        vstr2 = vstr2[2:]
-    elif vstr2.startswith('='):
-        cmpop = operator.eq
-        vstr2 = vstr2[1:]
-    elif vstr2.startswith('>'):
-        cmpop = operator.gt
-        vstr2 = vstr2[1:]
-    elif vstr2.startswith('<'):
-        cmpop = operator.lt
-        vstr2 = vstr2[1:]
-    else:
-        cmpop = operator.eq
-
-    return (cmpop, vstr2)
-
-
-def version_compare(vstr1: str, vstr2: str) -> bool:
-    (cmpop, vstr2) = _version_extract_cmpop(vstr2)
-    return cmpop(Version(vstr1), Version(vstr2))
-
-
-def version_compare_many(vstr1: str, conditions: T.Union[str, T.Iterable[str]]) -> T.Tuple[bool, T.List[str], T.List[str]]:
-    if isinstance(conditions, str):
-        conditions = [conditions]
-    found = []
-    not_found = []
-    for req in conditions:
-        if not version_compare(vstr1, req):
-            not_found.append(req)
-        else:
-            found.append(req)
-    return not_found == [], not_found, found
-
-
-# determine if the minimum version satisfying the condition |condition| exceeds
-# the minimum version for a feature |minimum|
-def version_compare_condition_with_min(condition: str, minimum: str) -> bool:
-    if condition.startswith('>='):
-        cmpop = operator.le
-        condition = condition[2:]
-    elif condition.startswith('<='):
-        return False
-    elif condition.startswith('!='):
-        return False
-    elif condition.startswith('=='):
-        cmpop = operator.le
-        condition = condition[2:]
-    elif condition.startswith('='):
-        cmpop = operator.le
-        condition = condition[1:]
-    elif condition.startswith('>'):
-        cmpop = operator.lt
-        condition = condition[1:]
-    elif condition.startswith('<'):
-        return False
-    else:
-        cmpop = operator.le
-
-    # Declaring a project(meson_version: '>=0.46') and then using features in
-    # 0.46.0 is valid, because (knowing the meson versioning scheme) '0.46.0' is
-    # the lowest version which satisfies the constraint '>=0.46'.
-    #
-    # But this will fail here, because the minimum version required by the
-    # version constraint ('0.46') is strictly less (in our version comparison)
-    # than the minimum version needed for the feature ('0.46.0').
-    #
-    # Map versions in the constraint of the form '0.46' to '0.46.0', to embed
-    # this knowledge of the meson versioning scheme.
-    condition = condition.strip()
-    if re.match(r'^\d+.\d+$', condition):
-        condition += '.0'
-
-    return cmpop(Version(minimum), Version(condition))
-
-
-def default_libdir() -> str:
-    if is_debianlike():
-        try:
-            pc = subprocess.Popen(['dpkg-architecture', '-qDEB_HOST_MULTIARCH'],
-                                  stdout=subprocess.PIPE,
-                                  stderr=subprocess.DEVNULL)
-            (stdo, _) = pc.communicate()
-            if pc.returncode == 0:
-                archpath = stdo.decode().strip()
-                return 'lib/' + archpath
-        except Exception:
-            pass
-    if is_freebsd() or is_irix():
-        return 'lib'
-    if os.path.isdir('/usr/lib64') and not os.path.islink('/usr/lib64'):
-        return 'lib64'
-    return 'lib'
-
-
-def default_libexecdir() -> str:
-    # There is no way to auto-detect this, so it must be set at build time
-    return 'libexec'
-
-
-def default_prefix() -> str:
-    return 'c:/' if is_windows() else '/usr/local'
-
-
-def get_library_dirs() -> T.List[str]:
-    if is_windows():
-        return ['C:/mingw/lib'] # TODO: get programmatically
-    if is_osx():
-        return ['/usr/lib'] # TODO: get programmatically
-    # The following is probably Debian/Ubuntu specific.
-    # /usr/local/lib is first because it contains stuff
-    # installed by the sysadmin and is probably more up-to-date
-    # than /usr/lib. If you feel that this search order is
-    # problematic, please raise the issue on the mailing list.
-    unixdirs = ['/usr/local/lib', '/usr/lib', '/lib']
-
-    if is_freebsd():
-        return unixdirs
-    # FIXME: this needs to be further genericized for aarch64 etc.
-    machine = platform.machine()
-    if machine in ('i386', 'i486', 'i586', 'i686'):
-        plat = 'i386'
-    elif machine.startswith('arm'):
-        plat = 'arm'
-    else:
-        plat = ''
-
-    # Solaris puts 32-bit libraries in the main /lib & /usr/lib directories
-    # and 64-bit libraries in platform specific subdirectories.
-    if is_sunos():
-        if machine == 'i86pc':
-            plat = 'amd64'
-        elif machine.startswith('sun4'):
-            plat = 'sparcv9'
-
-    usr_platdir = Path('/usr/lib/') / plat
-    if usr_platdir.is_dir():
-        unixdirs += [str(x) for x in (usr_platdir).iterdir() if x.is_dir()]
-    if os.path.exists('/usr/lib64'):
-        unixdirs.append('/usr/lib64')
-
-    lib_platdir = Path('/lib/') / plat
-    if lib_platdir.is_dir():
-        unixdirs += [str(x) for x in (lib_platdir).iterdir() if x.is_dir()]
-    if os.path.exists('/lib64'):
-        unixdirs.append('/lib64')
-
-    return unixdirs
-
-
-def has_path_sep(name: str, sep: str = '/\\') -> bool:
-    'Checks if any of the specified @sep path separators are in @name'
-    for each in sep:
-        if each in name:
-            return True
-    return False
-
-
-if is_windows():
-    # shlex.split is not suitable for splitting command line on Window (https://bugs.python.org/issue1724822);
-    # shlex.quote is similarly problematic. Below are "proper" implementations of these functions according to
-    # https://docs.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments and
-    # https://blogs.msdn.microsoft.com/twistylittlepassagesallalike/2011/04/23/everyone-quotes-command-line-arguments-the-wrong-way/
-
-    _whitespace = ' \t\n\r'
-    _find_unsafe_char = re.compile(r'[{}"]'.format(_whitespace)).search
-
-    def quote_arg(arg: str) -> str:
-        if arg and not _find_unsafe_char(arg):
-            return arg
-
-        result = '"'
-        num_backslashes = 0
-        for c in arg:
-            if c == '\\':
-                num_backslashes += 1
-            else:
-                if c == '"':
-                    # Escape all backslashes and the following double quotation mark
-                    num_backslashes = num_backslashes * 2 + 1
-
-                result += num_backslashes * '\\' + c
-                num_backslashes = 0
-
-        # Escape all backslashes, but let the terminating double quotation
-        # mark we add below be interpreted as a metacharacter
-        result += (num_backslashes * 2) * '\\' + '"'
-        return result
-
-    def split_args(cmd: str) -> T.List[str]:
-        result = []
-        arg = ''
-        num_backslashes = 0
-        num_quotes = 0
-        in_quotes = False
-        for c in cmd:
-            if c == '\\':
-                num_backslashes += 1
-            else:
-                if c == '"' and not (num_backslashes % 2):
-                    # unescaped quote, eat it
-                    arg += (num_backslashes // 2) * '\\'
-                    num_quotes += 1
-                    in_quotes = not in_quotes
-                elif c in _whitespace and not in_quotes:
-                    if arg or num_quotes:
-                        # reached the end of the argument
-                        result.append(arg)
-                        arg = ''
-                        num_quotes = 0
-                else:
-                    if c == '"':
-                        # escaped quote
-                        num_backslashes = (num_backslashes - 1) // 2
-
-                    arg += num_backslashes * '\\' + c
-
-                num_backslashes = 0
-
-        if arg or num_quotes:
-            result.append(arg)
-
-        return result
-else:
-    def quote_arg(arg: str) -> str:
-        return shlex.quote(arg)
-
-    def split_args(cmd: str) -> T.List[str]:
-        return shlex.split(cmd)
-
-
-def join_args(args: T.Iterable[str]) -> str:
-    return ' '.join([quote_arg(x) for x in args])
-
-
-def do_replacement(regex: T.Pattern[str], line: str, variable_format: str,
-                   confdata: 'ConfigurationData') -> T.Tuple[str, T.Set[str]]:
-    missing_variables = set()  # type: T.Set[str]
-    if variable_format == 'cmake':
-        start_tag = '${'
-        backslash_tag = '\\${'
-    else:
-        assert variable_format in ['meson', 'cmake@']
-        start_tag = '@'
-        backslash_tag = '\\@'
-
-    def variable_replace(match: T.Match[str]) -> str:
-        # Pairs of escape characters before '@' or '\@'
-        if match.group(0).endswith('\\'):
-            num_escapes = match.end(0) - match.start(0)
-            return '\\' * (num_escapes // 2)
-        # Single escape character and '@'
-        elif match.group(0) == backslash_tag:
-            return start_tag
-        # Template variable to be replaced
-        else:
-            varname = match.group(1)
-            if varname in confdata:
-                (var, desc) = confdata.get(varname)
-                if isinstance(var, str):
-                    pass
-                elif isinstance(var, int):
-                    var = str(var)
-                else:
-                    msg = 'Tried to replace variable {!r} value with ' \
-                          'something other than a string or int: {!r}'
-                    raise MesonException(msg.format(varname, var))
-            else:
-                missing_variables.add(varname)
-                var = ''
-            return var
-    return re.sub(regex, variable_replace, line), missing_variables
-
-def do_define(regex: T.Pattern[str], line: str, confdata: 'ConfigurationData', variable_format: str) -> str:
-    def get_cmake_define(line: str, confdata: 'ConfigurationData') -> str:
-        arr = line.split()
-        define_value=[]
-        for token in arr[2:]:
-            try:
-                (v, desc) = confdata.get(token)
-                define_value += [v]
-            except KeyError:
-                define_value += [token]
-        return ' '.join(define_value)
-
-    arr = line.split()
-    if variable_format == 'meson' and len(arr) != 2:
-      raise MesonException('#mesondefine does not contain exactly two tokens: %s' % line.strip())
-
-    varname = arr[1]
-    try:
-        (v, desc) = confdata.get(varname)
-    except KeyError:
-        return '/* #undef %s */\n' % varname
-    if isinstance(v, bool):
-        if v:
-            return '#define %s\n' % varname
-        else:
-            return '#undef %s\n' % varname
-    elif isinstance(v, int):
-        return '#define %s %d\n' % (varname, v)
-    elif isinstance(v, str):
-        if variable_format == 'meson':
-            result = v
-        else:
-            result = get_cmake_define(line, confdata)
-        result = '#define %s %s\n' % (varname, result)
-        (result, missing_variable) = do_replacement(regex, result, variable_format, confdata)
-        return result
-    else:
-        raise MesonException('#mesondefine argument "%s" is of unknown type.' % varname)
-
-def do_conf_str (data: list, confdata: 'ConfigurationData', variable_format: str,
-                 encoding: str = 'utf-8') -> T.Tuple[T.List[str],T.Set[str], bool]:
-    def line_is_valid(line : str, variable_format: str):
-      if variable_format == 'meson':
-          if '#cmakedefine' in line:
-              return False
-      else: #cmake format
-         if '#mesondefine' in line:
-            return False
-      return True
-
-    # Only allow (a-z, A-Z, 0-9, _, -) as valid characters for a define
-    # Also allow escaping '@' with '\@'
-    if variable_format in ['meson', 'cmake@']:
-        regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@')
-    elif variable_format == 'cmake':
-        regex = re.compile(r'(?:\\\\)+(?=\\?\$)|\\\${|\${([-a-zA-Z0-9_]+)}')
-    else:
-        raise MesonException('Format "{}" not handled'.format(variable_format))
-
-    search_token = '#mesondefine'
-    if variable_format != 'meson':
-        search_token = '#cmakedefine'
-
-    result = []
-    missing_variables = set()
-    # Detect when the configuration data is empty and no tokens were found
-    # during substitution so we can warn the user to use the `copy:` kwarg.
-    confdata_useless = not confdata.keys()
-    for line in data:
-        if line.startswith(search_token):
-            confdata_useless = False
-            line = do_define(regex, line, confdata, variable_format)
-        else:
-            if not line_is_valid(line,variable_format):
-                raise MesonException('Format "{}" mismatched'.format(variable_format))
-            line, missing = do_replacement(regex, line, variable_format, confdata)
-            missing_variables.update(missing)
-            if missing:
-                confdata_useless = False
-        result.append(line)
-
-    return result, missing_variables, confdata_useless
-
-def do_conf_file(src: str, dst: str, confdata: 'ConfigurationData', variable_format: str,
-                 encoding: str = 'utf-8') -> T.Tuple[T.Set[str], bool]:
-    try:
-        with open(src, encoding=encoding, newline='') as f:
-            data = f.readlines()
-    except Exception as e:
-        raise MesonException('Could not read input file %s: %s' % (src, str(e)))
-
-    (result, missing_variables, confdata_useless) = do_conf_str(data, confdata, variable_format, encoding)
-    dst_tmp = dst + '~'
-    try:
-        with open(dst_tmp, 'w', encoding=encoding, newline='') as f:
-            f.writelines(result)
-    except Exception as e:
-        raise MesonException('Could not write output file %s: %s' % (dst, str(e)))
-    shutil.copymode(src, dst_tmp)
-    replace_if_different(dst, dst_tmp)
-    return missing_variables, confdata_useless
-
-CONF_C_PRELUDE = '''/*
- * Autogenerated by the Meson build system.
- * Do not edit, your changes will be lost.
- */
-
-#pragma once
-
-'''
-
-CONF_NASM_PRELUDE = '''; Autogenerated by the Meson build system.
-; Do not edit, your changes will be lost.
-
-'''
-
-def dump_conf_header(ofilename: str, cdata: 'ConfigurationData', output_format: str) -> None:
-    if output_format == 'c':
-        prelude = CONF_C_PRELUDE
-        prefix = '#'
-    elif output_format == 'nasm':
-        prelude = CONF_NASM_PRELUDE
-        prefix = '%'
-
-    ofilename_tmp = ofilename + '~'
-    with open(ofilename_tmp, 'w', encoding='utf-8') as ofile:
-        ofile.write(prelude)
-        for k in sorted(cdata.keys()):
-            (v, desc) = cdata.get(k)
-            if desc:
-                if output_format == 'c':
-                    ofile.write('/* %s */\n' % desc)
-                elif output_format == 'nasm':
-                    for line in desc.split('\n'):
-                        ofile.write('; %s\n' % line)
-            if isinstance(v, bool):
-                if v:
-                    ofile.write('%sdefine %s\n\n' % (prefix, k))
-                else:
-                    ofile.write('%sundef %s\n\n' % (prefix, k))
-            elif isinstance(v, (int, str)):
-                ofile.write('%sdefine %s %s\n\n' % (prefix, k, v))
-            else:
-                raise MesonException('Unknown data type in configuration file entry: ' + k)
-    replace_if_different(ofilename, ofilename_tmp)
-
-
-def replace_if_different(dst: str, dst_tmp: str) -> None:
-    # If contents are identical, don't touch the file to prevent
-    # unnecessary rebuilds.
-    different = True
-    try:
-        with open(dst, 'rb') as f1, open(dst_tmp, 'rb') as f2:
-            if f1.read() == f2.read():
-                different = False
-    except FileNotFoundError:
-        pass
-    if different:
-        os.replace(dst_tmp, dst)
-    else:
-        os.unlink(dst_tmp)
-
-
-@T.overload
-def unholder(item: 'ObjectHolder[_T]') -> _T: ...
-
-@T.overload
-def unholder(item: T.List['ObjectHolder[_T]']) -> T.List[_T]: ...
-
-@T.overload
-def unholder(item: T.List[_T]) -> T.List[_T]: ...
-
-@T.overload
-def unholder(item: T.List[T.Union[_T, 'ObjectHolder[_T]']]) -> T.List[_T]: ...
-
-def unholder(item):
-    """Get the held item of an object holder or list of object holders."""
-    if isinstance(item, list):
-        return [i.held_object if hasattr(i, 'held_object') else i for i in item]
-    if hasattr(item, 'held_object'):
-        return item.held_object
-    return item
-
-
-def listify(item: T.Any, flatten: bool = True) -> T.List[T.Any]:
-    '''
-    Returns a list with all args embedded in a list if they are not a list.
-    This function preserves order.
-    @flatten: Convert lists of lists to a flat list
-    '''
-    if not isinstance(item, list):
-        return [item]
-    result = []  # type: T.List[T.Any]
-    for i in item:
-        if flatten and isinstance(i, list):
-            result += listify(i, flatten=True)
-        else:
-            result.append(i)
-    return result
-
-
-def extract_as_list(dict_object: T.Dict[_T, _U], key: _T, pop: bool = False) -> T.List[_U]:
-    '''
-    Extracts all values from given dict_object and listifies them.
-    '''
-    fetch = dict_object.get
-    if pop:
-        fetch = dict_object.pop
-    # If there's only one key, we don't return a list with one element
-    return listify(fetch(key, []), flatten=True)
-
-
-def typeslistify(item: 'T.Union[_T, T.Sequence[_T]]',
-                 types: 'T.Union[T.Type[_T], T.Tuple[T.Type[_T]]]') -> T.List[_T]:
-    '''
-    Ensure that type(@item) is one of @types or a
-    list of items all of which are of type @types
-    '''
-    if isinstance(item, types):
-        item = T.cast(T.List[_T], [item])
-    if not isinstance(item, list):
-        raise MesonException('Item must be a list or one of {!r}'.format(types))
-    for i in item:
-        if i is not None and not isinstance(i, types):
-            raise MesonException('List item must be one of {!r}'.format(types))
-    return item
-
-
-def stringlistify(item: T.Union[T.Any, T.Sequence[T.Any]]) -> T.List[str]:
-    return typeslistify(item, str)
-
-
-def expand_arguments(args: T.Iterable[str]) -> T.Optional[T.List[str]]:
-    expended_args = []  # type: T.List[str]
-    for arg in args:
-        if not arg.startswith('@'):
-            expended_args.append(arg)
-            continue
-
-        args_file = arg[1:]
-        try:
-            with open(args_file) as f:
-                extended_args = f.read().split()
-            expended_args += extended_args
-        except Exception as e:
-            mlog.error('Expanding command line arguments:',  args_file, 'not found')
-            mlog.exception(e)
-            return None
-    return expended_args
-
-
-def partition(pred: T.Callable[[_T], object], iterable: T.Iterator[_T]) -> T.Tuple[T.Iterator[_T], T.Iterator[_T]]:
-    """Use a predicate to partition entries into false entries and true
-    entries.
-
-    >>> x, y = partition(is_odd, range(10))
-    >>> (list(x), list(y))
-    ([0, 2, 4, 6, 8], [1, 3, 5, 7, 9])
-    """
-    t1, t2 = tee(iterable)
-    return filterfalse(pred, t1), filter(pred, t2)
-
-
-def Popen_safe(args: T.List[str], write: T.Optional[str] = None,
-               stdout: T.Union[T.BinaryIO, int] = subprocess.PIPE,
-               stderr: T.Union[T.BinaryIO, int] = subprocess.PIPE,
-               **kwargs: T.Any) -> T.Tuple[subprocess.Popen, str, str]:
-    import locale
-    encoding = locale.getpreferredencoding()
-    # Redirect stdin to DEVNULL otherwise the command run by us here might mess
-    # up the console and ANSI colors will stop working on Windows.
-    if 'stdin' not in kwargs:
-        kwargs['stdin'] = subprocess.DEVNULL
-    if sys.version_info < (3, 6) or not sys.stdout.encoding or encoding.upper() != 'UTF-8':
-        p, o, e = Popen_safe_legacy(args, write=write, stdout=stdout, stderr=stderr, **kwargs)
-    else:
-        p = subprocess.Popen(args, universal_newlines=True, close_fds=False,
-                             stdout=stdout, stderr=stderr, **kwargs)
-        o, e = p.communicate(write)
-    # Sometimes the command that we run will call another command which will be
-    # without the above stdin workaround, so set the console mode again just in
-    # case.
-    mlog.setup_console()
-    return p, o, e
-
-
-def Popen_safe_legacy(args: T.List[str], write: T.Optional[str] = None,
-                      stdout: T.Union[T.BinaryIO, int] = subprocess.PIPE,
-                      stderr: T.Union[T.BinaryIO, int] = subprocess.PIPE,
-                      **kwargs: T.Any) -> T.Tuple[subprocess.Popen, str, str]:
-    p = subprocess.Popen(args, universal_newlines=False, close_fds=False,
-                         stdout=stdout, stderr=stderr, **kwargs)
-    input_ = None  # type: T.Optional[bytes]
-    if write is not None:
-        input_ = write.encode('utf-8')
-    o, e = p.communicate(input_)
-    if o is not None:
-        if sys.stdout.encoding:
-            o = o.decode(encoding=sys.stdout.encoding, errors='replace').replace('\r\n', '\n')
-        else:
-            o = o.decode(errors='replace').replace('\r\n', '\n')
-    if e is not None:
-        if sys.stderr.encoding:
-            e = e.decode(encoding=sys.stderr.encoding, errors='replace').replace('\r\n', '\n')
-        else:
-            e = e.decode(errors='replace').replace('\r\n', '\n')
-    return p, o, e
-
-
-def iter_regexin_iter(regexiter: T.Iterable[str], initer: T.Iterable[str]) -> T.Optional[str]:
-    '''
-    Takes each regular expression in @regexiter and tries to search for it in
-    every item in @initer. If there is a match, returns that match.
-    Else returns False.
-    '''
-    for regex in regexiter:
-        for ii in initer:
-            if not isinstance(ii, str):
-                continue
-            match = re.search(regex, ii)
-            if match:
-                return match.group()
-    return None
-
-
-def _substitute_values_check_errors(command: T.List[str], values: T.Dict[str, str]) -> None:
-    # Error checking
-    inregex = ['@INPUT([0-9]+)?@', '@PLAINNAME@', '@BASENAME@']  # type: T.List[str]
-    outregex = ['@OUTPUT([0-9]+)?@', '@OUTDIR@']                 # type: T.List[str]
-    if '@INPUT@' not in values:
-        # Error out if any input-derived templates are present in the command
-        match = iter_regexin_iter(inregex, command)
-        if match:
-            m = 'Command cannot have {!r}, since no input files were specified'
-            raise MesonException(m.format(match))
-    else:
-        if len(values['@INPUT@']) > 1:
-            # Error out if @PLAINNAME@ or @BASENAME@ is present in the command
-            match = iter_regexin_iter(inregex[1:], command)
-            if match:
-                raise MesonException('Command cannot have {!r} when there is '
-                                     'more than one input file'.format(match))
-        # Error out if an invalid @INPUTnn@ template was specified
-        for each in command:
-            if not isinstance(each, str):
-                continue
-            match2 = re.search(inregex[0], each)
-            if match2 and match2.group() not in values:
-                m = 'Command cannot have {!r} since there are only {!r} inputs'
-                raise MesonException(m.format(match2.group(), len(values['@INPUT@'])))
-    if '@OUTPUT@' not in values:
-        # Error out if any output-derived templates are present in the command
-        match = iter_regexin_iter(outregex, command)
-        if match:
-            m = 'Command cannot have {!r} since there are no outputs'
-            raise MesonException(m.format(match))
-    else:
-        # Error out if an invalid @OUTPUTnn@ template was specified
-        for each in command:
-            if not isinstance(each, str):
-                continue
-            match2 = re.search(outregex[0], each)
-            if match2 and match2.group() not in values:
-                m = 'Command cannot have {!r} since there are only {!r} outputs'
-                raise MesonException(m.format(match2.group(), len(values['@OUTPUT@'])))
-
-
-def substitute_values(command: T.List[str], values: T.Dict[str, str]) -> T.List[str]:
-    '''
-    Substitute the template strings in the @values dict into the list of
-    strings @command and return a new list. For a full list of the templates,
-    see get_filenames_templates_dict()
-
-    If multiple inputs/outputs are given in the @values dictionary, we
-    substitute @INPUT@ and @OUTPUT@ only if they are the entire string, not
-    just a part of it, and in that case we substitute *all* of them.
-    '''
-    # Error checking
-    _substitute_values_check_errors(command, values)
-    # Substitution
-    outcmd = []  # type: T.List[str]
-    rx_keys = [re.escape(key) for key in values if key not in ('@INPUT@', '@OUTPUT@')]
-    value_rx = re.compile('|'.join(rx_keys)) if rx_keys else None
-    for vv in command:
-        if not isinstance(vv, str):
-            outcmd.append(vv)
-        elif '@INPUT@' in vv:
-            inputs = values['@INPUT@']
-            if vv == '@INPUT@':
-                outcmd += inputs
-            elif len(inputs) == 1:
-                outcmd.append(vv.replace('@INPUT@', inputs[0]))
-            else:
-                raise MesonException("Command has '@INPUT@' as part of a "
-                                     "string and more than one input file")
-        elif '@OUTPUT@' in vv:
-            outputs = values['@OUTPUT@']
-            if vv == '@OUTPUT@':
-                outcmd += outputs
-            elif len(outputs) == 1:
-                outcmd.append(vv.replace('@OUTPUT@', outputs[0]))
-            else:
-                raise MesonException("Command has '@OUTPUT@' as part of a "
-                                     "string and more than one output file")
-        # Append values that are exactly a template string.
-        # This is faster than a string replace.
-        elif vv in values:
-            outcmd.append(values[vv])
-        # Substitute everything else with replacement
-        elif value_rx:
-            outcmd.append(value_rx.sub(lambda m: values[m.group(0)], vv))
-        else:
-            outcmd.append(vv)
-    return outcmd
-
-
-def get_filenames_templates_dict(inputs: T.List[str], outputs: T.List[str]) -> T.Dict[str, T.Union[str, T.List[str]]]:
-    '''
-    Create a dictionary with template strings as keys and values as values for
-    the following templates:
-
-    @INPUT@  - the full path to one or more input files, from @inputs
-    @OUTPUT@ - the full path to one or more output files, from @outputs
-    @OUTDIR@ - the full path to the directory containing the output files
-
-    If there is only one input file, the following keys are also created:
-
-    @PLAINNAME@ - the filename of the input file
-    @BASENAME@ - the filename of the input file with the extension removed
-
-    If there is more than one input file, the following keys are also created:
-
-    @INPUT0@, @INPUT1@, ... one for each input file
-
-    If there is more than one output file, the following keys are also created:
-
-    @OUTPUT0@, @OUTPUT1@, ... one for each output file
-    '''
-    values = {}  # type: T.Dict[str, T.Union[str, T.List[str]]]
-    # Gather values derived from the input
-    if inputs:
-        # We want to substitute all the inputs.
-        values['@INPUT@'] = inputs
-        for (ii, vv) in enumerate(inputs):
-            # Write out @INPUT0@, @INPUT1@, ...
-            values['@INPUT{}@'.format(ii)] = vv
-        if len(inputs) == 1:
-            # Just one value, substitute @PLAINNAME@ and @BASENAME@
-            values['@PLAINNAME@'] = plain = os.path.basename(inputs[0])
-            values['@BASENAME@'] = os.path.splitext(plain)[0]
-    if outputs:
-        # Gather values derived from the outputs, similar to above.
-        values['@OUTPUT@'] = outputs
-        for (ii, vv) in enumerate(outputs):
-            values['@OUTPUT{}@'.format(ii)] = vv
-        # Outdir should be the same for all outputs
-        values['@OUTDIR@'] = os.path.dirname(outputs[0])
-        # Many external programs fail on empty arguments.
-        if values['@OUTDIR@'] == '':
-            values['@OUTDIR@'] = '.'
-    return values
-
-
-def _make_tree_writable(topdir: str) -> None:
-    # Ensure all files and directories under topdir are writable
-    # (and readable) by owner.
-    for d, _, files in os.walk(topdir):
-        os.chmod(d, os.stat(d).st_mode | stat.S_IWRITE | stat.S_IREAD)
-        for fname in files:
-            fpath = os.path.join(d, fname)
-            if os.path.isfile(fpath):
-                os.chmod(fpath, os.stat(fpath).st_mode | stat.S_IWRITE | stat.S_IREAD)
-
-
-def windows_proof_rmtree(f: str) -> None:
-    # On Windows if anyone is holding a file open you can't
-    # delete it. As an example an anti virus scanner might
-    # be scanning files you are trying to delete. The only
-    # way to fix this is to try again and again.
-    delays = [0.1, 0.1, 0.2, 0.2, 0.2, 0.5, 0.5, 1, 1, 1, 1, 2]
-    # Start by making the tree wriable.
-    _make_tree_writable(f)
-    for d in delays:
-        try:
-            shutil.rmtree(f)
-            return
-        except FileNotFoundError:
-            return
-        except OSError:
-            time.sleep(d)
-    # Try one last time and throw if it fails.
-    shutil.rmtree(f)
-
-
-def windows_proof_rm(fpath: str) -> None:
-    """Like windows_proof_rmtree, but for a single file."""
-    if os.path.isfile(fpath):
-        os.chmod(fpath, os.stat(fpath).st_mode | stat.S_IWRITE | stat.S_IREAD)
-    delays = [0.1, 0.1, 0.2, 0.2, 0.2, 0.5, 0.5, 1, 1, 1, 1, 2]
-    for d in delays:
-        try:
-            os.unlink(fpath)
-            return
-        except FileNotFoundError:
-            return
-        except OSError:
-            time.sleep(d)
-    os.unlink(fpath)
-
-
-def detect_subprojects(spdir_name: str, current_dir: str = '',
-                       result: T.Optional[T.Dict[str, T.List[str]]] = None) -> T.Optional[T.Dict[str, T.List[str]]]:
-    if result is None:
-        result = {}
-    spdir = os.path.join(current_dir, spdir_name)
-    if not os.path.exists(spdir):
-        return result
-    for trial in glob(os.path.join(spdir, '*')):
-        basename = os.path.basename(trial)
-        if trial == 'packagecache':
-            continue
-        append_this = True
-        if os.path.isdir(trial):
-            detect_subprojects(spdir_name, trial, result)
-        elif trial.endswith('.wrap') and os.path.isfile(trial):
-            basename = os.path.splitext(basename)[0]
-        else:
-            append_this = False
-        if append_this:
-            if basename in result:
-                result[basename].append(trial)
-            else:
-                result[basename] = [trial]
-    return result
-
-
-def substring_is_in_list(substr: str, strlist: T.List[str]) -> bool:
-    for s in strlist:
-        if substr in s:
-            return True
-    return False
-
-
-class OrderedSet(T.MutableSet[_T]):
-    """A set that preserves the order in which items are added, by first
-    insertion.
-    """
-    def __init__(self, iterable: T.Optional[T.Iterable[_T]] = None):
-        # typing.OrderedDict is new in 3.7.2, so we can't use that, but we can
-        # use MutableMapping, which is fine in this case.
-        self.__container = collections.OrderedDict()  # type: T.MutableMapping[_T, None]
-        if iterable:
-            self.update(iterable)
-
-    def __contains__(self, value: object) -> bool:
-        return value in self.__container
-
-    def __iter__(self) -> T.Iterator[_T]:
-        return iter(self.__container.keys())
-
-    def __len__(self) -> int:
-        return len(self.__container)
-
-    def __repr__(self) -> str:
-        # Don't print 'OrderedSet("")' for an empty set.
-        if self.__container:
-            return 'OrderedSet("{}")'.format(
-                '", "'.join(repr(e) for e in self.__container.keys()))
-        return 'OrderedSet()'
-
-    def __reversed__(self) -> T.Iterator[_T]:
-        # Mypy is complaining that sets cant be reversed, which is true for
-        # unordered sets, but this is an ordered, set so reverse() makes sense.
-        return reversed(self.__container.keys())  # type: ignore
-
-    def add(self, value: _T) -> None:
-        self.__container[value] = None
-
-    def discard(self, value: _T) -> None:
-        if value in self.__container:
-            del self.__container[value]
-
-    def update(self, iterable: T.Iterable[_T]) -> None:
-        for item in iterable:
-            self.__container[item] = None
-
-    def difference(self, set_: T.Union[T.Set[_T], 'OrderedSet[_T]']) -> 'OrderedSet[_T]':
-        return type(self)(e for e in self if e not in set_)
-
-class BuildDirLock:
-
-    def __init__(self, builddir: str):
-        self.lockfilename = os.path.join(builddir, 'meson-private/meson.lock')
-
-    def __enter__(self):
-        self.lockfile = open(self.lockfilename, 'w')
-        try:
-            if have_fcntl:
-                fcntl.flock(self.lockfile, fcntl.LOCK_EX | fcntl.LOCK_NB)
-            elif have_msvcrt:
-                msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_NBLCK, 1)
-        except (BlockingIOError, PermissionError):
-            self.lockfile.close()
-            raise MesonException('Some other Meson process is already using this build directory. Exiting.')
-
-    def __exit__(self, *args):
-        if have_fcntl:
-            fcntl.flock(self.lockfile, fcntl.LOCK_UN)
-        elif have_msvcrt:
-            msvcrt.locking(self.lockfile.fileno(), msvcrt.LK_UNLCK, 1)
-        self.lockfile.close()
-
-def relpath(path: str, start: str) -> str:
-    # On Windows a relative path can't be evaluated for paths on two different
-    # drives (i.e. c:\foo and f:\bar).  The only thing left to do is to use the
-    # original absolute path.
-    try:
-        return os.path.relpath(path, start)
-    except (TypeError, ValueError):
-        return path
-
-def path_is_in_root(path: Path, root: Path, resolve: bool = False) -> bool:
-    # Check wheter a path is within the root directory root
-    try:
-        if resolve:
-            path.resolve().relative_to(root.resolve())
-        else:
-            path.relative_to(root)
-    except ValueError:
-        return False
-    return True
-
-class LibType(Enum):
-
-    """Enumeration for library types."""
-
-    SHARED = 0
-    STATIC = 1
-    PREFER_SHARED = 2
-    PREFER_STATIC = 3
-
-
-class ProgressBarFallback:  # lgtm [py/iter-returns-non-self]
-    '''
-    Fallback progress bar implementation when tqdm is not found
-
-    Since this class is not an actual iterator, but only provides a minimal
-    fallback, it is safe to ignore the 'Iterator does not return self from
-    __iter__ method' warning.
-    '''
-    def __init__(self, iterable: T.Optional[T.Iterable[str]] = None, total: T.Optional[int] = None,
-                 bar_type: T.Optional[str] = None, desc: T.Optional[str] = None):
-        if iterable is not None:
-            self.iterable = iter(iterable)
-            return
-        self.total = total
-        self.done = 0
-        self.printed_dots = 0
-        if self.total and bar_type == 'download':
-            print('Download size:', self.total)
-        if desc:
-            print('{}: '.format(desc), end='')
-
-    # Pretend to be an iterator when called as one and don't print any
-    # progress
-    def __iter__(self) -> T.Iterator[str]:
-        return self.iterable
-
-    def __next__(self) -> str:
-        return next(self.iterable)
-
-    def print_dot(self) -> None:
-        print('.', end='')
-        sys.stdout.flush()
-        self.printed_dots += 1
-
-    def update(self, progress: int) -> None:
-        self.done += progress
-        if not self.total:
-            # Just print one dot per call if we don't have a total length
-            self.print_dot()
-            return
-        ratio = int(self.done / self.total * 10)
-        while self.printed_dots < ratio:
-            self.print_dot()
-
-    def close(self) -> None:
-        print('')
-
-try:
-    from tqdm import tqdm
-except ImportError:
-    # ideally we would use a typing.Protocol here, but it's part of typing_extensions until 3.8
-    ProgressBar = ProgressBarFallback  # type: T.Union[T.Type[ProgressBarFallback], T.Type[ProgressBarTqdm]]
-else:
-    class ProgressBarTqdm(tqdm):
-        def __init__(self, *args, bar_type: T.Optional[str] = None, **kwargs):
-            if bar_type == 'download':
-                kwargs.update({'unit': 'bytes', 'leave': True})
-            else:
-                kwargs.update({'leave': False})
-            kwargs['ncols'] = 100
-            super().__init__(*args, **kwargs)
-
-    ProgressBar = ProgressBarTqdm
-
-
-def get_wine_shortpath(winecmd: T.List[str], wine_paths: T.Sequence[str]) -> str:
-    """Get A short version of @wine_paths to avoid reaching WINEPATH number
-    of char limit.
-    """
-
-    wine_paths = list(OrderedSet(wine_paths))
-
-    getShortPathScript = '%s.bat' % str(uuid.uuid4()).lower()[:5]
-    with open(getShortPathScript, mode='w') as f:
-        f.write("@ECHO OFF\nfor %%x in (%*) do (\n echo|set /p=;%~sx\n)\n")
-        f.flush()
-    try:
-        with open(os.devnull, 'w') as stderr:
-            wine_path = subprocess.check_output(
-                winecmd +
-                ['cmd', '/C', getShortPathScript] + wine_paths,
-                stderr=stderr).decode('utf-8')
-    except subprocess.CalledProcessError as e:
-        print("Could not get short paths: %s" % e)
-        wine_path = ';'.join(wine_paths)
-    finally:
-        os.remove(getShortPathScript)
-    if len(wine_path) > 2048:
-        raise MesonException(
-            'WINEPATH size {} > 2048'
-            ' this will cause random failure.'.format(
-                len(wine_path)))
-
-    return wine_path.strip(';')
-
-
-def run_once(func: T.Callable[..., _T]) -> T.Callable[..., _T]:
-    ret = []  # type: T.List[_T]
-
-    @wraps(func)
-    def wrapper(*args: T.Any, **kwargs: T.Any) -> _T:
-        if ret:
-            return ret[0]
-
-        val = func(*args, **kwargs)
-        ret.append(val)
-        return val
-
-    return wrapper
-
-
-class OptionProxy(T.Generic[_T]):
-    def __init__(self, value: _T):
-        self.value = value
-
-
-class OptionOverrideProxy:
-
-    '''Mimic an option list but transparently override selected option
-    values.
-    '''
-
-    # TODO: the typing here could be made more explicit using a TypeDict from
-    # python 3.8 or typing_extensions
-
-    def __init__(self, overrides: T.Dict[str, T.Any], *options: 'OptionDictType'):
-        self.overrides = overrides
-        self.options = options
-
-    def __getitem__(self, option_name: str) -> T.Any:
-        for opts in self.options:
-            if option_name in opts:
-                return self._get_override(option_name, opts[option_name])
-        raise KeyError('Option not found', option_name)
-
-    def _get_override(self, option_name: str, base_opt: 'UserOption[T.Any]') -> T.Union[OptionProxy[T.Any], 'UserOption[T.Any]']:
-        if option_name in self.overrides:
-            return OptionProxy(base_opt.validate_value(self.overrides[option_name]))
-        return base_opt
-
-    def copy(self) -> T.Dict[str, T.Any]:
-        result = {}  # type: T.Dict[str, T.Any]
-        for opts in self.options:
-            for option_name in opts:
-                result[option_name] = self._get_override(option_name, opts[option_name])
-        return result
diff --git a/meson/mesonbuild/mesonmain.py b/meson/mesonbuild/mesonmain.py
deleted file mode 100644 (file)
index e07c0df..0000000
+++ /dev/null
@@ -1,243 +0,0 @@
-# Copyright 2012-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-import os.path
-import importlib
-import traceback
-import argparse
-import codecs
-import shutil
-
-from . import mesonlib
-from . import mlog
-from . import mconf, mdist, minit, minstall, mintro, msetup, mtest, rewriter, msubprojects, munstable_coredata, mcompile
-from .mesonlib import MesonException
-from .environment import detect_msys2_arch
-from .wrap import wraptool
-
-
-# Note: when adding arguments, please also add them to the completion
-# scripts in $MESONSRC/data/shell-completions/
-class CommandLineParser:
-    def __init__(self):
-        self.term_width = shutil.get_terminal_size().columns
-        self.formatter = lambda prog: argparse.HelpFormatter(prog, max_help_position=int(self.term_width / 2), width=self.term_width)
-
-        self.commands = {}
-        self.hidden_commands = []
-        self.parser = argparse.ArgumentParser(prog='meson', formatter_class=self.formatter)
-        self.subparsers = self.parser.add_subparsers(title='Commands', dest='command',
-                                                     description='If no command is specified it defaults to setup command.')
-        self.add_command('setup', msetup.add_arguments, msetup.run,
-                         help_msg='Configure the project')
-        self.add_command('configure', mconf.add_arguments, mconf.run,
-                         help_msg='Change project options',)
-        self.add_command('dist', mdist.add_arguments, mdist.run,
-                         help_msg='Generate release archive',)
-        self.add_command('install', minstall.add_arguments, minstall.run,
-                         help_msg='Install the project')
-        self.add_command('introspect', mintro.add_arguments, mintro.run,
-                         help_msg='Introspect project')
-        self.add_command('init', minit.add_arguments, minit.run,
-                         help_msg='Create a new project')
-        self.add_command('test', mtest.add_arguments, mtest.run,
-                         help_msg='Run tests')
-        self.add_command('wrap', wraptool.add_arguments, wraptool.run,
-                         help_msg='Wrap tools')
-        self.add_command('subprojects', msubprojects.add_arguments, msubprojects.run,
-                         help_msg='Manage subprojects')
-        self.add_command('help', self.add_help_arguments, self.run_help_command,
-                         help_msg='Print help of a subcommand')
-        self.add_command('rewrite', lambda parser: rewriter.add_arguments(parser, self.formatter), rewriter.run,
-                         help_msg='Modify the project definition')
-        self.add_command('compile', mcompile.add_arguments, mcompile.run,
-                         help_msg='Build the project')
-
-        # Hidden commands
-        self.add_command('runpython', self.add_runpython_arguments, self.run_runpython_command,
-                         help_msg=argparse.SUPPRESS)
-        self.add_command('unstable-coredata', munstable_coredata.add_arguments, munstable_coredata.run,
-                         help_msg=argparse.SUPPRESS)
-
-    def add_command(self, name, add_arguments_func, run_func, help_msg, aliases=None):
-        aliases = aliases or []
-        # FIXME: Cannot have hidden subparser:
-        # https://bugs.python.org/issue22848
-        if help_msg == argparse.SUPPRESS:
-            p = argparse.ArgumentParser(prog='meson ' + name, formatter_class=self.formatter)
-            self.hidden_commands.append(name)
-        else:
-            p = self.subparsers.add_parser(name, help=help_msg, aliases=aliases, formatter_class=self.formatter)
-        add_arguments_func(p)
-        p.set_defaults(run_func=run_func)
-        for i in [name] + aliases:
-            self.commands[i] = p
-
-    def add_runpython_arguments(self, parser):
-        parser.add_argument('-c', action='store_true', dest='eval_arg', default=False)
-        parser.add_argument('script_file')
-        parser.add_argument('script_args', nargs=argparse.REMAINDER)
-
-    def run_runpython_command(self, options):
-        import runpy
-        if options.eval_arg:
-            exec(options.script_file)
-        else:
-            sys.argv[1:] = options.script_args
-            sys.path.insert(0, os.path.dirname(options.script_file))
-            runpy.run_path(options.script_file, run_name='__main__')
-        return 0
-
-    def add_help_arguments(self, parser):
-        parser.add_argument('command', nargs='?')
-
-    def run_help_command(self, options):
-        if options.command:
-            self.commands[options.command].print_help()
-        else:
-            self.parser.print_help()
-        return 0
-
-    def run(self, args):
-        print_py35_notice = False
-        # If first arg is not a known command, assume user wants to run the setup
-        # command.
-        known_commands = list(self.commands.keys()) + ['-h', '--help']
-        if not args or args[0] not in known_commands:
-            args = ['setup'] + args
-
-        # Hidden commands have their own parser instead of using the global one
-        if args[0] in self.hidden_commands:
-            command = args[0]
-            parser = self.commands[command]
-            args = args[1:]
-        else:
-            parser = self.parser
-            command = None
-
-        args = mesonlib.expand_arguments(args)
-        options = parser.parse_args(args)
-
-        if command is None:
-            command = options.command
-
-        if command in ('setup', 'compile', 'test', 'install') and sys.version_info < (3, 6):
-            print_py35_notice = True
-
-        try:
-            return options.run_func(options)
-        except MesonException as e:
-            mlog.exception(e)
-            logfile = mlog.shutdown()
-            if logfile is not None:
-                mlog.log("\nA full log can be found at", mlog.bold(logfile))
-            if os.environ.get('MESON_FORCE_BACKTRACE'):
-                raise
-            return 1
-        except Exception:
-            if os.environ.get('MESON_FORCE_BACKTRACE'):
-                raise
-            traceback.print_exc()
-            return 2
-        finally:
-            if print_py35_notice:
-                mlog.notice('You are using Python 3.5 which is EOL. Starting with v0.57, '
-                            'Meson will require Python 3.6 or newer', fatal=False)
-            mlog.shutdown()
-
-def run_script_command(script_name, script_args):
-    # Map script name to module name for those that doesn't match
-    script_map = {'exe': 'meson_exe',
-                  'install': 'meson_install',
-                  'delsuffix': 'delwithsuffix',
-                  'gtkdoc': 'gtkdochelper',
-                  'hotdoc': 'hotdochelper',
-                  'regencheck': 'regen_checker'}
-    module_name = script_map.get(script_name, script_name)
-
-    try:
-        module = importlib.import_module('mesonbuild.scripts.' + module_name)
-    except ModuleNotFoundError as e:
-        mlog.exception(e)
-        return 1
-
-    try:
-        return module.run(script_args)
-    except MesonException as e:
-        mlog.error('Error in {} helper script:'.format(script_name))
-        mlog.exception(e)
-        return 1
-
-def ensure_stdout_accepts_unicode():
-    if sys.stdout.encoding and not sys.stdout.encoding.upper().startswith('UTF-'):
-        if sys.version_info >= (3, 7):
-            sys.stdout.reconfigure(errors='surrogateescape')
-        else:
-            sys.stdout = codecs.getwriter('utf-8')(sys.stdout.detach(),
-                                                   errors='surrogateescape')
-            sys.stdout.encoding = 'UTF-8'
-            if not hasattr(sys.stdout, 'buffer'):
-                sys.stdout.buffer = sys.stdout.raw if hasattr(sys.stdout, 'raw') else sys.stdout
-
-def run(original_args, mainfile):
-    if sys.version_info < (3, 5):
-        print('Meson works correctly only with python 3.5+.')
-        print('You have python {}.'.format(sys.version))
-        print('Please update your environment')
-        return 1
-
-    # Meson gets confused if stdout can't output Unicode, if the
-    # locale isn't Unicode, just force stdout to accept it. This tries
-    # to emulate enough of PEP 540 to work elsewhere.
-    ensure_stdout_accepts_unicode()
-
-    # https://github.com/mesonbuild/meson/issues/3653
-    if sys.platform.lower() == 'msys':
-        mlog.error('This python3 seems to be msys/python on MSYS2 Windows, which is known to have path semantics incompatible with Meson')
-        msys2_arch = detect_msys2_arch()
-        if msys2_arch:
-            mlog.error('Please install and use mingw-w64-i686-python3 and/or mingw-w64-x86_64-python3 with Pacman')
-        else:
-            mlog.error('Please download and use Python as detailed at: https://mesonbuild.com/Getting-meson.html')
-        return 2
-
-    # Set the meson command that will be used to run scripts and so on
-    mesonlib.set_meson_command(mainfile)
-
-    args = original_args[:]
-
-    # Special handling of internal commands called from backends, they don't
-    # need to go through argparse.
-    if len(args) >= 2 and args[0] == '--internal':
-        if args[1] == 'regenerate':
-            # Rewrite "meson --internal regenerate" command line to
-            # "meson --reconfigure"
-            args = ['--reconfigure'] + args[2:]
-        else:
-            return run_script_command(args[1], args[2:])
-
-    return CommandLineParser().run(args)
-
-def main():
-    # Always resolve the command path so Ninja can find it for regen, tests, etc.
-    if 'meson.exe' in sys.executable:
-        assert(os.path.isabs(sys.executable))
-        launcher = sys.executable
-    else:
-        launcher = os.path.realpath(sys.argv[0])
-    return run(sys.argv[1:], launcher)
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/meson/mesonbuild/minit.py b/meson/mesonbuild/minit.py
deleted file mode 100644 (file)
index 06e6dd4..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Code that creates simple startup projects."""
-
-from pathlib import Path
-from enum import Enum
-import subprocess
-import shutil
-import sys
-import os
-import re
-from glob import glob
-from mesonbuild import mesonlib
-from mesonbuild.environment import detect_ninja
-from mesonbuild.templates.samplefactory import sameple_generator
-
-'''
-we currently have one meson template at this time.
-'''
-from mesonbuild.templates.mesontemplates import create_meson_build
-
-FORTRAN_SUFFIXES = {'.f', '.for', '.F', '.f90', '.F90'}
-LANG_SUFFIXES = {'.c', '.cc', '.cpp', '.cs', '.cu', '.d', '.m', '.mm', '.rs', '.java'} | FORTRAN_SUFFIXES
-LANG_SUPPORTED = {'c', 'cpp', 'cs', 'cuda', 'd', 'fortran', 'java', 'rust', 'objc', 'objcpp'}
-
-DEFAULT_PROJECT = 'executable'
-DEFAULT_VERSION = '0.1'
-class DEFAULT_TYPES(Enum):
-    EXE = 'executable'
-    LIB = 'library'
-
-INFO_MESSAGE = '''Sample project created. To build it run the
-following commands:
-
-meson setup builddir
-meson compile -C builddir
-'''
-
-
-def create_sample(options) -> None:
-    '''
-    Based on what arguments are passed we check for a match in language
-    then check for project type and create new Meson samples project.
-    '''
-    sample_gen = sameple_generator(options)
-    if options.type == DEFAULT_TYPES['EXE'].value:
-        sample_gen.create_executable()
-    elif options.type == DEFAULT_TYPES['LIB'].value:
-        sample_gen.create_library()
-    else:
-        raise RuntimeError('Unreachable code')
-    print(INFO_MESSAGE)
-
-def autodetect_options(options, sample: bool = False) -> None:
-    '''
-    Here we autodetect options for args not passed in so don't have to
-    think about it.
-    '''
-    if not options.name:
-        options.name = Path().resolve().stem
-        if not re.match('[a-zA-Z_][a-zA-Z0-9]*', options.name) and sample:
-            raise SystemExit('Name of current directory "{}" is not usable as a sample project name.\n'
-                             'Specify a project name with --name.'.format(options.name))
-        print('Using "{}" (name of current directory) as project name.'
-              .format(options.name))
-    if not options.executable:
-        options.executable = options.name
-        print('Using "{}" (project name) as name of executable to build.'
-              .format(options.executable))
-    if sample:
-        # The rest of the autodetection is not applicable to generating sample projects.
-        return
-    if not options.srcfiles:
-        srcfiles = []
-        for f in (f for f in Path().iterdir() if f.is_file()):
-            if f.suffix in LANG_SUFFIXES:
-                srcfiles.append(f)
-        if not srcfiles:
-            raise SystemExit('No recognizable source files found.\n'
-                             'Run meson init in an empty directory to create a sample project.')
-        options.srcfiles = srcfiles
-        print("Detected source files: " + ' '.join(map(str, srcfiles)))
-    options.srcfiles = [Path(f) for f in options.srcfiles]
-    if not options.language:
-        for f in options.srcfiles:
-            if f.suffix == '.c':
-                options.language = 'c'
-                break
-            if f.suffix in ('.cc', '.cpp'):
-                options.language = 'cpp'
-                break
-            if f.suffix in '.cs':
-                options.language = 'cs'
-                break
-            if f.suffix == '.cu':
-                options.language = 'cuda'
-                break
-            if f.suffix == '.d':
-                options.language = 'd'
-                break
-            if f.suffix in FORTRAN_SUFFIXES:
-                options.language = 'fortran'
-                break
-            if f.suffix == '.rs':
-                options.language = 'rust'
-                break
-            if f.suffix == '.m':
-                options.language = 'objc'
-                break
-            if f.suffix == '.mm':
-                options.language = 'objcpp'
-                break
-            if f.suffix == '.java':
-                options.language = 'java'
-                break
-        if not options.language:
-            raise SystemExit("Can't autodetect language, please specify it with -l.")
-        print("Detected language: " + options.language)
-
-def add_arguments(parser):
-    '''
-    Here we add args for that the user can passed when making a new
-    Meson project.
-    '''
-    parser.add_argument("srcfiles", metavar="sourcefile", nargs="*", help="source files. default: all recognized files in current directory")
-    parser.add_argument('-C', default='.', dest='wd', help='directory to cd into before running')
-    parser.add_argument("-n", "--name", help="project name. default: name of current directory")
-    parser.add_argument("-e", "--executable", help="executable name. default: project name")
-    parser.add_argument("-d", "--deps", help="dependencies, comma-separated")
-    parser.add_argument("-l", "--language", choices=sorted(LANG_SUPPORTED), help="project language. default: autodetected based on source files")
-    parser.add_argument("-b", "--build", action='store_true', help="build after generation")
-    parser.add_argument("--builddir", default='build', help="directory for build")
-    parser.add_argument("-f", "--force", action="store_true", help="force overwrite of existing files and directories.")
-    parser.add_argument('--type', default=DEFAULT_PROJECT, choices=('executable', 'library'), help="project type. default: {} based project".format(DEFAULT_PROJECT))
-    parser.add_argument('--version', default=DEFAULT_VERSION, help="project version. default: {}".format(DEFAULT_VERSION))
-
-def run(options) -> int:
-    '''
-    Here we generate the new Meson sample project.
-    '''
-    if not Path(options.wd).exists():
-        sys.exit('Project source root directory not found. Run this command in source directory root.')
-    os.chdir(options.wd)
-
-    if not glob('*'):
-        autodetect_options(options, sample=True)
-        if not options.language:
-            print('Defaulting to generating a C language project.')
-            options.language = 'c'
-        create_sample(options)
-    else:
-        autodetect_options(options)
-        if Path('meson.build').is_file() and not options.force:
-            raise SystemExit('meson.build already exists. Use --force to overwrite.')
-        create_meson_build(options)
-    if options.build:
-        if Path(options.builddir).is_dir() and options.force:
-            print('Build directory already exists, deleting it.')
-            shutil.rmtree(options.builddir)
-        print('Building...')
-        cmd = mesonlib.meson_command + [options.builddir]
-        ret = subprocess.run(cmd)
-        if ret.returncode:
-            raise SystemExit
-        cmd = detect_ninja() + ['-C', options.builddir]
-        ret = subprocess.run(cmd)
-        if ret.returncode:
-            raise SystemExit
-    return 0
diff --git a/meson/mesonbuild/minstall.py b/meson/mesonbuild/minstall.py
deleted file mode 100644 (file)
index b95ff36..0000000
+++ /dev/null
@@ -1,545 +0,0 @@
-# Copyright 2013-2014 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys, pickle, os, shutil, subprocess, errno
-import argparse
-import shlex
-from glob import glob
-from .scripts import depfixer
-from .scripts import destdir_join
-from .mesonlib import is_windows, Popen_safe
-from .mtest import rebuild_all
-try:
-    from __main__ import __file__ as main_file
-except ImportError:
-    # Happens when running as meson.exe which is native Windows.
-    # This is only used for pkexec which is not, so this is fine.
-    main_file = None
-
-symlink_warning = '''Warning: trying to copy a symlink that points to a file. This will copy the file,
-but this will be changed in a future version of Meson to copy the symlink as is. Please update your
-build definitions so that it will not break when the change happens.'''
-
-selinux_updates = []
-
-def add_arguments(parser):
-    parser.add_argument('-C', default='.', dest='wd',
-                        help='directory to cd into before running')
-    parser.add_argument('--profile-self', action='store_true', dest='profile',
-                        help=argparse.SUPPRESS)
-    parser.add_argument('--no-rebuild', default=False, action='store_true',
-                        help='Do not rebuild before installing.')
-    parser.add_argument('--only-changed', default=False, action='store_true',
-                        help='Only overwrite files that are older than the copied file.')
-    parser.add_argument('--quiet', default=False, action='store_true',
-                        help='Do not print every file that was installed.')
-
-class DirMaker:
-    def __init__(self, lf):
-        self.lf = lf
-        self.dirs = []
-
-    def makedirs(self, path, exist_ok=False):
-        dirname = os.path.normpath(path)
-        dirs = []
-        while dirname != os.path.dirname(dirname):
-            if not os.path.exists(dirname):
-                dirs.append(dirname)
-            dirname = os.path.dirname(dirname)
-        os.makedirs(path, exist_ok=exist_ok)
-
-        # store the directories in creation order, with the parent directory
-        # before the child directories. Future calls of makedir() will not
-        # create the parent directories, so the last element in the list is
-        # the last one to be created. That is the first one to be removed on
-        # __exit__
-        dirs.reverse()
-        self.dirs += dirs
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, exception_type, value, traceback):
-        self.dirs.reverse()
-        for d in self.dirs:
-            append_to_log(self.lf, d)
-
-def is_executable(path, follow_symlinks=False):
-    '''Checks whether any of the "x" bits are set in the source file mode.'''
-    return bool(os.stat(path, follow_symlinks=follow_symlinks).st_mode & 0o111)
-
-def append_to_log(lf, line):
-    lf.write(line)
-    if not line.endswith('\n'):
-        lf.write('\n')
-    lf.flush()
-
-def set_chown(path, user=None, group=None, dir_fd=None, follow_symlinks=True):
-    # shutil.chown will call os.chown without passing all the parameters
-    # and particularly follow_symlinks, thus we replace it temporary
-    # with a lambda with all the parameters so that follow_symlinks will
-    # be actually passed properly.
-    # Not nice, but better than actually rewriting shutil.chown until
-    # this python bug is fixed: https://bugs.python.org/issue18108
-    real_os_chown = os.chown
-    try:
-        os.chown = lambda p, u, g: real_os_chown(p, u, g,
-                                                 dir_fd=dir_fd,
-                                                 follow_symlinks=follow_symlinks)
-        shutil.chown(path, user, group)
-    except Exception:
-        raise
-    finally:
-        os.chown = real_os_chown
-
-def set_chmod(path, mode, dir_fd=None, follow_symlinks=True):
-    try:
-        os.chmod(path, mode, dir_fd=dir_fd, follow_symlinks=follow_symlinks)
-    except (NotImplementedError, OSError, SystemError):
-        if not os.path.islink(path):
-            os.chmod(path, mode, dir_fd=dir_fd)
-
-def sanitize_permissions(path, umask):
-    if umask == 'preserve':
-        return
-    new_perms = 0o777 if is_executable(path, follow_symlinks=False) else 0o666
-    new_perms &= ~umask
-    try:
-        set_chmod(path, new_perms, follow_symlinks=False)
-    except PermissionError as e:
-        msg = '{!r}: Unable to set permissions {!r}: {}, ignoring...'
-        print(msg.format(path, new_perms, e.strerror))
-
-def set_mode(path, mode, default_umask):
-    if mode is None or (mode.perms_s or mode.owner or mode.group) is None:
-        # Just sanitize permissions with the default umask
-        sanitize_permissions(path, default_umask)
-        return
-    # No chown() on Windows, and must set one of owner/group
-    if not is_windows() and (mode.owner or mode.group) is not None:
-        try:
-            set_chown(path, mode.owner, mode.group, follow_symlinks=False)
-        except PermissionError as e:
-            msg = '{!r}: Unable to set owner {!r} and group {!r}: {}, ignoring...'
-            print(msg.format(path, mode.owner, mode.group, e.strerror))
-        except LookupError:
-            msg = '{!r}: Non-existent owner {!r} or group {!r}: ignoring...'
-            print(msg.format(path, mode.owner, mode.group))
-        except OSError as e:
-            if e.errno == errno.EINVAL:
-                msg = '{!r}: Non-existent numeric owner {!r} or group {!r}: ignoring...'
-                print(msg.format(path, mode.owner, mode.group))
-            else:
-                raise
-    # Must set permissions *after* setting owner/group otherwise the
-    # setuid/setgid bits will get wiped by chmod
-    # NOTE: On Windows you can set read/write perms; the rest are ignored
-    if mode.perms_s is not None:
-        try:
-            set_chmod(path, mode.perms, follow_symlinks=False)
-        except PermissionError as e:
-            msg = '{!r}: Unable to set permissions {!r}: {}, ignoring...'
-            print(msg.format(path, mode.perms_s, e.strerror))
-    else:
-        sanitize_permissions(path, default_umask)
-
-def restore_selinux_contexts():
-    '''
-    Restores the SELinux context for files in @selinux_updates
-
-    If $DESTDIR is set, do not warn if the call fails.
-    '''
-    try:
-        subprocess.check_call(['selinuxenabled'])
-    except (FileNotFoundError, NotADirectoryError, PermissionError, subprocess.CalledProcessError):
-        # If we don't have selinux or selinuxenabled returned 1, failure
-        # is ignored quietly.
-        return
-
-    if not shutil.which('restorecon'):
-        # If we don't have restorecon, failure is ignored quietly.
-        return
-
-    if not selinux_updates:
-        # If the list of files is empty, do not try to call restorecon.
-        return
-
-    with subprocess.Popen(['restorecon', '-F', '-f-', '-0'],
-                          stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) as proc:
-        out, err = proc.communicate(input=b'\0'.join(os.fsencode(f) for f in selinux_updates) + b'\0')
-        if proc.returncode != 0 and not os.environ.get('DESTDIR'):
-            print('Failed to restore SELinux context of installed files...',
-                  'Standard output:', out.decode(),
-                  'Standard error:', err.decode(), sep='\n')
-
-
-def get_destdir_path(d, path):
-    if os.path.isabs(path):
-        output = destdir_join(d.destdir, path)
-    else:
-        output = os.path.join(d.fullprefix, path)
-    return output
-
-
-def check_for_stampfile(fname):
-    '''Some languages e.g. Rust have output files
-    whose names are not known at configure time.
-    Check if this is the case and return the real
-    file instead.'''
-    if fname.endswith('.so') or fname.endswith('.dll'):
-        if os.stat(fname).st_size == 0:
-            (base, suffix) = os.path.splitext(fname)
-            files = glob(base + '-*' + suffix)
-            if len(files) > 1:
-                print("Stale dynamic library files in build dir. Can't install.")
-                sys.exit(1)
-            if len(files) == 1:
-                return files[0]
-    elif fname.endswith('.a') or fname.endswith('.lib'):
-        if os.stat(fname).st_size == 0:
-            (base, suffix) = os.path.splitext(fname)
-            files = glob(base + '-*' + '.rlib')
-            if len(files) > 1:
-                print("Stale static library files in build dir. Can't install.")
-                sys.exit(1)
-            if len(files) == 1:
-                return files[0]
-    return fname
-
-class Installer:
-
-    def __init__(self, options, lf):
-        self.did_install_something = False
-        self.options = options
-        self.lf = lf
-        self.preserved_file_count = 0
-
-    def log(self, msg):
-        if not self.options.quiet:
-            print(msg)
-
-    def should_preserve_existing_file(self, from_file, to_file):
-        if not self.options.only_changed:
-            return False
-        # Always replace danging symlinks
-        if os.path.islink(from_file) and not os.path.isfile(from_file):
-            return False
-        from_time = os.stat(from_file).st_mtime
-        to_time = os.stat(to_file).st_mtime
-        return from_time <= to_time
-
-    def do_copyfile(self, from_file, to_file, makedirs=None):
-        outdir = os.path.split(to_file)[0]
-        if not os.path.isfile(from_file) and not os.path.islink(from_file):
-            raise RuntimeError('Tried to install something that isn\'t a file:'
-                               '{!r}'.format(from_file))
-        # copyfile fails if the target file already exists, so remove it to
-        # allow overwriting a previous install. If the target is not a file, we
-        # want to give a readable error.
-        if os.path.exists(to_file):
-            if not os.path.isfile(to_file):
-                raise RuntimeError('Destination {!r} already exists and is not '
-                                   'a file'.format(to_file))
-            if self.should_preserve_existing_file(from_file, to_file):
-                append_to_log(self.lf, '# Preserving old file {}\n'.format(to_file))
-                self.preserved_file_count += 1
-                return False
-            os.remove(to_file)
-        elif makedirs:
-            # Unpack tuple
-            dirmaker, outdir = makedirs
-            # Create dirs if needed
-            dirmaker.makedirs(outdir, exist_ok=True)
-        self.log('Installing {} to {}'.format(from_file, outdir))
-        if os.path.islink(from_file):
-            if not os.path.exists(from_file):
-                # Dangling symlink. Replicate as is.
-                shutil.copy(from_file, outdir, follow_symlinks=False)
-            else:
-                # Remove this entire branch when changing the behaviour to duplicate
-                # symlinks rather than copying what they point to.
-                print(symlink_warning)
-                shutil.copyfile(from_file, to_file)
-                shutil.copystat(from_file, to_file)
-        else:
-            shutil.copyfile(from_file, to_file)
-            shutil.copystat(from_file, to_file)
-        selinux_updates.append(to_file)
-        append_to_log(self.lf, to_file)
-        return True
-
-    def do_copydir(self, data, src_dir, dst_dir, exclude, install_mode):
-        '''
-        Copies the contents of directory @src_dir into @dst_dir.
-
-        For directory
-            /foo/
-              bar/
-                excluded
-                foobar
-              file
-        do_copydir(..., '/foo', '/dst/dir', {'bar/excluded'}) creates
-            /dst/
-              dir/
-                bar/
-                  foobar
-                file
-
-        Args:
-            src_dir: str, absolute path to the source directory
-            dst_dir: str, absolute path to the destination directory
-            exclude: (set(str), set(str)), tuple of (exclude_files, exclude_dirs),
-                     each element of the set is a path relative to src_dir.
-        '''
-        if not os.path.isabs(src_dir):
-            raise ValueError('src_dir must be absolute, got {}'.format(src_dir))
-        if not os.path.isabs(dst_dir):
-            raise ValueError('dst_dir must be absolute, got {}'.format(dst_dir))
-        if exclude is not None:
-            exclude_files, exclude_dirs = exclude
-        else:
-            exclude_files = exclude_dirs = set()
-        for root, dirs, files in os.walk(src_dir):
-            assert os.path.isabs(root)
-            for d in dirs[:]:
-                abs_src = os.path.join(root, d)
-                filepart = os.path.relpath(abs_src, start=src_dir)
-                abs_dst = os.path.join(dst_dir, filepart)
-                # Remove these so they aren't visited by os.walk at all.
-                if filepart in exclude_dirs:
-                    dirs.remove(d)
-                    continue
-                if os.path.isdir(abs_dst):
-                    continue
-                if os.path.exists(abs_dst):
-                    print('Tried to copy directory {} but a file of that name already exists.'.format(abs_dst))
-                    sys.exit(1)
-                data.dirmaker.makedirs(abs_dst)
-                shutil.copystat(abs_src, abs_dst)
-                sanitize_permissions(abs_dst, data.install_umask)
-            for f in files:
-                abs_src = os.path.join(root, f)
-                filepart = os.path.relpath(abs_src, start=src_dir)
-                if filepart in exclude_files:
-                    continue
-                abs_dst = os.path.join(dst_dir, filepart)
-                if os.path.isdir(abs_dst):
-                    print('Tried to copy file {} but a directory of that name already exists.'.format(abs_dst))
-                    sys.exit(1)
-                parent_dir = os.path.dirname(abs_dst)
-                if not os.path.isdir(parent_dir):
-                    os.mkdir(parent_dir)
-                    shutil.copystat(os.path.dirname(abs_src), parent_dir)
-                # FIXME: what about symlinks?
-                self.do_copyfile(abs_src, abs_dst)
-                set_mode(abs_dst, install_mode, data.install_umask)
-
-    def do_install(self, datafilename):
-        with open(datafilename, 'rb') as ifile:
-            d = pickle.load(ifile)
-        d.destdir = os.environ.get('DESTDIR', '')
-        d.fullprefix = destdir_join(d.destdir, d.prefix)
-
-        if d.install_umask != 'preserve':
-            os.umask(d.install_umask)
-
-        self.did_install_something = False
-        try:
-            d.dirmaker = DirMaker(self.lf)
-            with d.dirmaker:
-                self.install_subdirs(d) # Must be first, because it needs to delete the old subtree.
-                self.install_targets(d)
-                self.install_headers(d)
-                self.install_man(d)
-                self.install_data(d)
-                restore_selinux_contexts()
-                self.run_install_script(d)
-                if not self.did_install_something:
-                    self.log('Nothing to install.')
-                if not self.options.quiet and self.preserved_file_count > 0:
-                    self.log('Preserved {} unchanged files, see {} for the full list'
-                             .format(self.preserved_file_count, os.path.normpath(self.lf.name)))
-        except PermissionError:
-            if shutil.which('pkexec') is not None and 'PKEXEC_UID' not in os.environ:
-                print('Installation failed due to insufficient permissions.')
-                print('Attempting to use polkit to gain elevated privileges...')
-                os.execlp('pkexec', 'pkexec', sys.executable, main_file, *sys.argv[1:],
-                          '-C', os.getcwd())
-            else:
-                raise
-
-    def install_subdirs(self, d):
-        for (src_dir, dst_dir, mode, exclude) in d.install_subdirs:
-            self.did_install_something = True
-            full_dst_dir = get_destdir_path(d, dst_dir)
-            self.log('Installing subdir {} to {}'.format(src_dir, full_dst_dir))
-            d.dirmaker.makedirs(full_dst_dir, exist_ok=True)
-            self.do_copydir(d, src_dir, full_dst_dir, exclude, mode)
-
-    def install_data(self, d):
-        for i in d.data:
-            fullfilename = i[0]
-            outfilename = get_destdir_path(d, i[1])
-            mode = i[2]
-            outdir = os.path.dirname(outfilename)
-            if self.do_copyfile(fullfilename, outfilename, makedirs=(d.dirmaker, outdir)):
-                self.did_install_something = True
-            set_mode(outfilename, mode, d.install_umask)
-
-    def install_man(self, d):
-        for m in d.man:
-            full_source_filename = m[0]
-            outfilename = get_destdir_path(d, m[1])
-            outdir = os.path.dirname(outfilename)
-            install_mode = m[2]
-            if self.do_copyfile(full_source_filename, outfilename, makedirs=(d.dirmaker, outdir)):
-                self.did_install_something = True
-            set_mode(outfilename, install_mode, d.install_umask)
-
-    def install_headers(self, d):
-        for t in d.headers:
-            fullfilename = t[0]
-            fname = os.path.basename(fullfilename)
-            outdir = get_destdir_path(d, t[1])
-            outfilename = os.path.join(outdir, fname)
-            install_mode = t[2]
-            if self.do_copyfile(fullfilename, outfilename, makedirs=(d.dirmaker, outdir)):
-                self.did_install_something = True
-            set_mode(outfilename, install_mode, d.install_umask)
-
-    def run_install_script(self, d):
-        env = {'MESON_SOURCE_ROOT': d.source_dir,
-               'MESON_BUILD_ROOT': d.build_dir,
-               'MESON_INSTALL_PREFIX': d.prefix,
-               'MESON_INSTALL_DESTDIR_PREFIX': d.fullprefix,
-               'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in d.mesonintrospect]),
-               }
-        if self.options.quiet:
-            env['MESON_INSTALL_QUIET'] = '1'
-
-        child_env = os.environ.copy()
-        child_env.update(env)
-
-        for i in d.install_scripts:
-            self.did_install_something = True  # Custom script must report itself if it does nothing.
-            script = i['exe']
-            args = i['args']
-            name = ' '.join(script + args)
-            self.log('Running custom install script {!r}'.format(name))
-            try:
-                rc = subprocess.call(script + args, env=child_env)
-            except OSError:
-                print('FAILED: install script \'{}\' could not be run, stopped'.format(name))
-                # POSIX shells return 127 when a command could not be found
-                sys.exit(127)
-            if rc != 0:
-                print('FAILED: install script \'{}\' exit code {}, stopped'.format(name, rc))
-                sys.exit(rc)
-
-    def install_targets(self, d):
-        for t in d.targets:
-            if not os.path.exists(t.fname):
-                # For example, import libraries of shared modules are optional
-                if t.optional:
-                    self.log('File {!r} not found, skipping'.format(t.fname))
-                    continue
-                else:
-                    raise RuntimeError('File {!r} could not be found'.format(t.fname))
-            file_copied = False # not set when a directory is copied
-            fname = check_for_stampfile(t.fname)
-            outdir = get_destdir_path(d, t.outdir)
-            outname = os.path.join(outdir, os.path.basename(fname))
-            final_path = os.path.join(d.prefix, t.outdir, os.path.basename(fname))
-            aliases = t.aliases
-            should_strip = t.strip
-            install_rpath = t.install_rpath
-            install_name_mappings = t.install_name_mappings
-            install_mode = t.install_mode
-            if not os.path.exists(fname):
-                raise RuntimeError('File {!r} could not be found'.format(fname))
-            elif os.path.isfile(fname):
-                file_copied = self.do_copyfile(fname, outname, makedirs=(d.dirmaker, outdir))
-                set_mode(outname, install_mode, d.install_umask)
-                if should_strip and d.strip_bin is not None:
-                    if fname.endswith('.jar'):
-                        self.log('Not stripping jar target:', os.path.basename(fname))
-                        continue
-                    self.log('Stripping target {!r} using {}.'.format(fname, d.strip_bin[0]))
-                    ps, stdo, stde = Popen_safe(d.strip_bin + [outname])
-                    if ps.returncode != 0:
-                        print('Could not strip file.\n')
-                        print('Stdout:\n{}\n'.format(stdo))
-                        print('Stderr:\n{}\n'.format(stde))
-                        sys.exit(1)
-                if fname.endswith('.js'):
-                    # Emscripten outputs js files and optionally a wasm file.
-                    # If one was generated, install it as well.
-                    wasm_source = os.path.splitext(fname)[0] + '.wasm'
-                    if os.path.exists(wasm_source):
-                        wasm_output = os.path.splitext(outname)[0] + '.wasm'
-                        file_copied = self.do_copyfile(wasm_source, wasm_output)
-            elif os.path.isdir(fname):
-                fname = os.path.join(d.build_dir, fname.rstrip('/'))
-                outname = os.path.join(outdir, os.path.basename(fname))
-                d.dirmaker.makedirs(outdir, exist_ok=True)
-                self.do_copydir(d, fname, outname, None, install_mode)
-            else:
-                raise RuntimeError('Unknown file type for {!r}'.format(fname))
-            printed_symlink_error = False
-            for alias, to in aliases.items():
-                try:
-                    symlinkfilename = os.path.join(outdir, alias)
-                    try:
-                        os.remove(symlinkfilename)
-                    except FileNotFoundError:
-                        pass
-                    os.symlink(to, symlinkfilename)
-                    append_to_log(self.lf, symlinkfilename)
-                except (NotImplementedError, OSError):
-                    if not printed_symlink_error:
-                        print("Symlink creation does not work on this platform. "
-                              "Skipping all symlinking.")
-                        printed_symlink_error = True
-            if file_copied:
-                self.did_install_something = True
-                try:
-                    depfixer.fix_rpath(outname, t.rpath_dirs_to_remove, install_rpath, final_path,
-                                       install_name_mappings, verbose=False)
-                except SystemExit as e:
-                    if isinstance(e.code, int) and e.code == 0:
-                        pass
-                    else:
-                        raise
-
-def run(opts):
-    datafilename = 'meson-private/install.dat'
-    private_dir = os.path.dirname(datafilename)
-    log_dir = os.path.join(private_dir, '../meson-logs')
-    if not os.path.exists(os.path.join(opts.wd, datafilename)):
-        sys.exit('Install data not found. Run this command in build directory root.')
-    if not opts.no_rebuild:
-        if not rebuild_all(opts.wd):
-            sys.exit(-1)
-    os.chdir(opts.wd)
-    with open(os.path.join(log_dir, 'install-log.txt'), 'w') as lf:
-        installer = Installer(opts, lf)
-        append_to_log(lf, '# List of files installed by Meson')
-        append_to_log(lf, '# Does not contain files installed by custom scripts.')
-        if opts.profile:
-            import cProfile as profile
-            fname = os.path.join(private_dir, 'profile-installer.log')
-            profile.runctx('installer.do_install(datafilename)', globals(), locals(), filename=fname)
-        else:
-            installer.do_install(datafilename)
-    return 0
diff --git a/meson/mesonbuild/mintro.py b/meson/mesonbuild/mintro.py
deleted file mode 100644 (file)
index cccedaa..0000000
+++ /dev/null
@@ -1,531 +0,0 @@
-# Copyright 2014-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""This is a helper script for IDE developers. It allows you to
-extract information such as list of targets, files, compiler flags,
-tests and so on. All output is in JSON for simple parsing.
-
-Currently only works for the Ninja backend. Others use generated
-project files and don't need this info."""
-
-import collections
-import json
-from . import build, coredata as cdata
-from . import mesonlib
-from .ast import IntrospectionInterpreter, build_target_functions, AstConditionLevel, AstIDGenerator, AstIndentationGenerator, AstJSONPrinter
-from . import mlog
-from .backend import backends
-from .mparser import BaseNode, FunctionNode, ArrayNode, ArgumentNode, StringNode
-from .interpreter import Interpreter
-from pathlib import PurePath
-import typing as T
-import os
-
-def get_meson_info_file(info_dir: str) -> str:
-    return os.path.join(info_dir, 'meson-info.json')
-
-def get_meson_introspection_version() -> str:
-    return '1.0.0'
-
-def get_meson_introspection_required_version() -> T.List[str]:
-    return ['>=1.0', '<2.0']
-
-class IntroCommand:
-    def __init__(self,
-                 desc: str,
-                 func: T.Optional[T.Callable[[], T.Union[dict, list]]] = None,
-                 no_bd: T.Optional[T.Callable[[IntrospectionInterpreter], T.Union[dict, list]]] = None) -> None:
-        self.desc = desc + '.'
-        self.func = func
-        self.no_bd = no_bd
-
-def get_meson_introspection_types(coredata: T.Optional[cdata.CoreData] = None,
-                                  builddata: T.Optional[build.Build] = None,
-                                  backend: T.Optional[backends.Backend] = None,
-                                  sourcedir: T.Optional[str] = None) -> 'T.Mapping[str, IntroCommand]':
-    if backend and builddata:
-        benchmarkdata = backend.create_test_serialisation(builddata.get_benchmarks())
-        testdata = backend.create_test_serialisation(builddata.get_tests())
-        installdata = backend.create_install_data()
-        interpreter = backend.interpreter
-    else:
-        benchmarkdata = testdata = installdata = None
-
-    # Enforce key order for argparse
-    return collections.OrderedDict([
-        ('ast', IntroCommand('Dump the AST of the meson file', no_bd=dump_ast)),
-        ('benchmarks', IntroCommand('List all benchmarks', func=lambda: list_benchmarks(benchmarkdata))),
-        ('buildoptions', IntroCommand('List all build options', func=lambda: list_buildoptions(coredata), no_bd=list_buildoptions_from_source)),
-        ('buildsystem_files', IntroCommand('List files that make up the build system', func=lambda: list_buildsystem_files(builddata, interpreter))),
-        ('dependencies', IntroCommand('List external dependencies', func=lambda: list_deps(coredata), no_bd=list_deps_from_source)),
-        ('scan_dependencies', IntroCommand('Scan for dependencies used in the meson.build file', no_bd=list_deps_from_source)),
-        ('installed', IntroCommand('List all installed files and directories', func=lambda: list_installed(installdata))),
-        ('projectinfo', IntroCommand('Information about projects', func=lambda: list_projinfo(builddata), no_bd=list_projinfo_from_source)),
-        ('targets', IntroCommand('List top level targets', func=lambda: list_targets(builddata, installdata, backend), no_bd=list_targets_from_source)),
-        ('tests', IntroCommand('List all unit tests', func=lambda: list_tests(testdata))),
-    ])
-
-def add_arguments(parser):
-    intro_types = get_meson_introspection_types()
-    for key, val in intro_types.items():
-        flag = '--' + key.replace('_', '-')
-        parser.add_argument(flag, action='store_true', dest=key, default=False, help=val.desc)
-
-    parser.add_argument('--backend', choices=sorted(cdata.backendlist), dest='backend', default='ninja',
-                        help='The backend to use for the --buildoptions introspection.')
-    parser.add_argument('-a', '--all', action='store_true', dest='all', default=False,
-                        help='Print all available information.')
-    parser.add_argument('-i', '--indent', action='store_true', dest='indent', default=False,
-                        help='Enable pretty printed JSON.')
-    parser.add_argument('-f', '--force-object-output', action='store_true', dest='force_dict', default=False,
-                        help='Always use the new JSON format for multiple entries (even for 0 and 1 introspection commands)')
-    parser.add_argument('builddir', nargs='?', default='.', help='The build directory')
-
-def dump_ast(intr: IntrospectionInterpreter) -> T.Dict[str, T.Any]:
-    printer = AstJSONPrinter()
-    intr.ast.accept(printer)
-    return printer.result
-
-def list_installed(installdata):
-    res = {}
-    if installdata is not None:
-        for t in installdata.targets:
-            res[os.path.join(installdata.build_dir, t.fname)] = \
-                os.path.join(installdata.prefix, t.outdir, os.path.basename(t.fname))
-            for alias in t.aliases.keys():
-                res[os.path.join(installdata.build_dir, alias)] = \
-                    os.path.join(installdata.prefix, t.outdir, os.path.basename(alias))
-        for path, installpath, _ in installdata.data:
-            res[path] = os.path.join(installdata.prefix, installpath)
-        for path, installdir, _ in installdata.headers:
-            res[path] = os.path.join(installdata.prefix, installdir, os.path.basename(path))
-        for path, installpath, _ in installdata.man:
-            res[path] = os.path.join(installdata.prefix, installpath)
-        for path, installpath, _, _ in installdata.install_subdirs:
-            res[path] = os.path.join(installdata.prefix, installpath)
-    return res
-
-def list_targets_from_source(intr: IntrospectionInterpreter) -> T.List[T.Dict[str, T.Union[bool, str, T.List[T.Union[str, T.Dict[str, T.Union[str, T.List[str], bool]]]]]]]:
-    tlist = []  # type: T.List[T.Dict[str, T.Union[bool, str, T.List[T.Union[str, T.Dict[str, T.Union[str, T.List[str], bool]]]]]]]
-    for i in intr.targets:
-        sources = []  # type: T.List[str]
-        for n in i['sources']:
-            args = []  # type: T.List[BaseNode]
-            if isinstance(n, FunctionNode):
-                args = list(n.args.arguments)
-                if n.func_name in build_target_functions:
-                    args.pop(0)
-            elif isinstance(n, ArrayNode):
-                args = n.args.arguments
-            elif isinstance(n, ArgumentNode):
-                args = n.arguments
-            for j in args:
-                if isinstance(j, StringNode):
-                    assert isinstance(j.value, str)
-                    sources += [j.value]
-                elif isinstance(j, str):
-                    sources += [j]
-
-        tlist += [{
-            'name': i['name'],
-            'id': i['id'],
-            'type': i['type'],
-            'defined_in': i['defined_in'],
-            'filename': [os.path.join(i['subdir'], x) for x in i['outputs']],
-            'build_by_default': i['build_by_default'],
-            'target_sources': [{
-                'language': 'unknown',
-                'compiler': [],
-                'parameters': [],
-                'sources': [os.path.normpath(os.path.join(os.path.abspath(intr.source_root), i['subdir'], x)) for x in sources],
-                'generated_sources': []
-            }],
-            'subproject': None, # Subprojects are not supported
-            'installed': i['installed']
-        }]
-
-    return tlist
-
-def list_targets(builddata: build.Build, installdata, backend: backends.Backend) -> T.List[T.Dict[str, T.Union[bool, str, T.List[T.Union[str, T.Dict[str, T.Union[str, T.List[str], bool]]]]]]]:
-    tlist = []  # type: T.List[T.Dict[str, T.Union[bool, str, T.List[T.Union[str, T.Dict[str, T.Union[str, T.List[str], bool]]]]]]]
-    build_dir = builddata.environment.get_build_dir()
-    src_dir = builddata.environment.get_source_dir()
-
-    # Fast lookup table for installation files
-    install_lookuptable = {}
-    for i in installdata.targets:
-        out = [os.path.join(installdata.prefix, i.outdir, os.path.basename(i.fname))]
-        out += [os.path.join(installdata.prefix, i.outdir, os.path.basename(x)) for x in i.aliases]
-        install_lookuptable[os.path.basename(i.fname)] = [str(PurePath(x)) for x in out]
-
-    for (idname, target) in builddata.get_targets().items():
-        if not isinstance(target, build.Target):
-            raise RuntimeError('The target object in `builddata.get_targets()` is not of type `build.Target`. Please file a bug with this error message.')
-
-        t = {
-            'name': target.get_basename(),
-            'id': idname,
-            'type': target.get_typename(),
-            'defined_in': os.path.normpath(os.path.join(src_dir, target.subdir, 'meson.build')),
-            'filename': [os.path.join(build_dir, target.subdir, x) for x in target.get_outputs()],
-            'build_by_default': target.build_by_default,
-            'target_sources': backend.get_introspection_data(idname, target),
-            'subproject': target.subproject or None
-        }
-
-        if installdata and target.should_install():
-            t['installed'] = True
-            t['install_filename'] = [install_lookuptable.get(x, [None]) for x in target.get_outputs()]
-            t['install_filename'] = [x for sublist in t['install_filename'] for x in sublist]  # flatten the list
-        else:
-            t['installed'] = False
-        tlist.append(t)
-    return tlist
-
-def list_buildoptions_from_source(intr: IntrospectionInterpreter) -> T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]:
-    subprojects = [i['name'] for i in intr.project_data['subprojects']]
-    return list_buildoptions(intr.coredata, subprojects)
-
-def list_buildoptions(coredata: cdata.CoreData, subprojects: T.Optional[T.List[str]] = None) -> T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]:
-    optlist = []  # type: T.List[T.Dict[str, T.Union[str, bool, int, T.List[str]]]]
-
-    dir_option_names = ['bindir',
-                        'datadir',
-                        'includedir',
-                        'infodir',
-                        'libdir',
-                        'libexecdir',
-                        'localedir',
-                        'localstatedir',
-                        'mandir',
-                        'prefix',
-                        'sbindir',
-                        'sharedstatedir',
-                        'sysconfdir']
-    test_option_names = ['errorlogs',
-                         'stdsplit']
-    core_option_names = [k for k in coredata.builtins if k not in dir_option_names + test_option_names]
-
-    dir_options = {k: o for k, o in coredata.builtins.items() if k in dir_option_names}
-    test_options = {k: o for k, o in coredata.builtins.items() if k in test_option_names}
-    core_options = {k: o for k, o in coredata.builtins.items() if k in core_option_names}
-
-    if subprojects:
-        # Add per subproject built-in options
-        sub_core_options = {}
-        for sub in subprojects:
-            for k, o in core_options.items():
-                if o.yielding:
-                    continue
-                sub_core_options[sub + ':' + k] = o
-        core_options.update(sub_core_options)
-
-    def add_keys(options: T.Dict[str, cdata.UserOption], section: str, machine: str = 'any') -> None:
-        for key in sorted(options.keys()):
-            opt = options[key]
-            optdict = {'name': key, 'value': opt.value, 'section': section, 'machine': machine}
-            if isinstance(opt, cdata.UserStringOption):
-                typestr = 'string'
-            elif isinstance(opt, cdata.UserBooleanOption):
-                typestr = 'boolean'
-            elif isinstance(opt, cdata.UserComboOption):
-                optdict['choices'] = opt.choices
-                typestr = 'combo'
-            elif isinstance(opt, cdata.UserIntegerOption):
-                typestr = 'integer'
-            elif isinstance(opt, cdata.UserArrayOption):
-                typestr = 'array'
-            else:
-                raise RuntimeError("Unknown option type")
-            optdict['type'] = typestr
-            optdict['description'] = opt.description
-            optlist.append(optdict)
-
-    add_keys(core_options, 'core')
-    add_keys(coredata.builtins_per_machine.host, 'core', machine='host')
-    add_keys(
-        {'build.' + k: o for k, o in coredata.builtins_per_machine.build.items()},
-        'core',
-        machine='build',
-    )
-    add_keys(coredata.backend_options, 'backend')
-    add_keys(coredata.base_options, 'base')
-    add_keys(
-        dict(coredata.flatten_lang_iterator(coredata.compiler_options.host.items())),
-        'compiler',
-        machine='host',
-    )
-    add_keys(
-        {
-            'build.' + k: o for k, o in
-            coredata.flatten_lang_iterator(coredata.compiler_options.build.items())
-        },
-        'compiler',
-        machine='build',
-    )
-    add_keys(dir_options, 'directory')
-    add_keys(coredata.user_options, 'user')
-    add_keys(test_options, 'test')
-    return optlist
-
-def find_buildsystem_files_list(src_dir) -> T.List[str]:
-    # I feel dirty about this. But only slightly.
-    filelist = []  # type: T.List[str]
-    for root, _, files in os.walk(src_dir):
-        for f in files:
-            if f == 'meson.build' or f == 'meson_options.txt':
-                filelist.append(os.path.relpath(os.path.join(root, f), src_dir))
-    return filelist
-
-def list_buildsystem_files(builddata: build.Build, interpreter: Interpreter) -> T.List[str]:
-    src_dir = builddata.environment.get_source_dir()
-    filelist = interpreter.get_build_def_files()
-    filelist = [PurePath(src_dir, x).as_posix() for x in filelist]
-    return filelist
-
-def list_deps_from_source(intr: IntrospectionInterpreter) -> T.List[T.Dict[str, T.Union[str, bool]]]:
-    result = []  # type: T.List[T.Dict[str, T.Union[str, bool]]]
-    for i in intr.dependencies:
-        keys = [
-            'name',
-            'required',
-            'version',
-            'has_fallback',
-            'conditional',
-        ]
-        result += [{k: v for k, v in i.items() if k in keys}]
-    return result
-
-def list_deps(coredata: cdata.CoreData) -> T.List[T.Dict[str, T.Union[str, T.List[str]]]]:
-    result = []  # type: T.List[T.Dict[str, T.Union[str, T.List[str]]]]
-    for d in coredata.deps.host.values():
-        if d.found():
-            result += [{'name': d.name,
-                        'version': d.get_version(),
-                        'compile_args': d.get_compile_args(),
-                        'link_args': d.get_link_args()}]
-    return result
-
-def get_test_list(testdata) -> T.List[T.Dict[str, T.Union[str, int, T.List[str], T.Dict[str, str]]]]:
-    result = []  # type: T.List[T.Dict[str, T.Union[str, int, T.List[str], T.Dict[str, str]]]]
-    for t in testdata:
-        to = {}
-        if isinstance(t.fname, str):
-            fname = [t.fname]
-        else:
-            fname = t.fname
-        to['cmd'] = fname + t.cmd_args
-        if isinstance(t.env, build.EnvironmentVariables):
-            to['env'] = t.env.get_env({})
-        else:
-            to['env'] = t.env
-        to['name'] = t.name
-        to['workdir'] = t.workdir
-        to['timeout'] = t.timeout
-        to['suite'] = t.suite
-        to['is_parallel'] = t.is_parallel
-        to['priority'] = t.priority
-        to['protocol'] = str(t.protocol)
-        result.append(to)
-    return result
-
-def list_tests(testdata) -> T.List[T.Dict[str, T.Union[str, int, T.List[str], T.Dict[str, str]]]]:
-    return get_test_list(testdata)
-
-def list_benchmarks(benchdata) -> T.List[T.Dict[str, T.Union[str, int, T.List[str], T.Dict[str, str]]]]:
-    return get_test_list(benchdata)
-
-def list_projinfo(builddata: build.Build) -> T.Dict[str, T.Union[str, T.List[T.Dict[str, str]]]]:
-    result = {'version': builddata.project_version,
-              'descriptive_name': builddata.project_name,
-              'subproject_dir': builddata.subproject_dir}
-    subprojects = []
-    for k, v in builddata.subprojects.items():
-        c = {'name': k,
-             'version': v,
-             'descriptive_name': builddata.projects.get(k)}
-        subprojects.append(c)
-    result['subprojects'] = subprojects
-    return result
-
-def list_projinfo_from_source(intr: IntrospectionInterpreter) -> T.Dict[str, T.Union[str, T.List[T.Dict[str, str]]]]:
-    sourcedir = intr.source_root
-    files = find_buildsystem_files_list(sourcedir)
-    files = [os.path.normpath(x) for x in files]
-
-    for i in intr.project_data['subprojects']:
-        basedir = os.path.join(intr.subproject_dir, i['name'])
-        i['buildsystem_files'] = [x for x in files if x.startswith(basedir)]
-        files = [x for x in files if not x.startswith(basedir)]
-
-    intr.project_data['buildsystem_files'] = files
-    intr.project_data['subproject_dir'] = intr.subproject_dir
-    return intr.project_data
-
-def print_results(options, results: T.Sequence[T.Tuple[str, T.Union[dict, T.List[T.Any]]]], indent: int) -> int:
-    if not results and not options.force_dict:
-        print('No command specified')
-        return 1
-    elif len(results) == 1 and not options.force_dict:
-        # Make to keep the existing output format for a single option
-        print(json.dumps(results[0][1], indent=indent))
-    else:
-        out = {}
-        for i in results:
-            out[i[0]] = i[1]
-        print(json.dumps(out, indent=indent))
-    return 0
-
-def run(options) -> int:
-    datadir = 'meson-private'
-    infodir = 'meson-info'
-    if options.builddir is not None:
-        datadir = os.path.join(options.builddir, datadir)
-        infodir = os.path.join(options.builddir, infodir)
-    indent = 4 if options.indent else None
-    results = []  # type: T.List[T.Tuple[str, T.Union[dict, T.List[T.Any]]]]
-    sourcedir = '.' if options.builddir == 'meson.build' else options.builddir[:-11]
-    intro_types = get_meson_introspection_types(sourcedir=sourcedir)
-
-    if 'meson.build' in [os.path.basename(options.builddir), options.builddir]:
-        # Make sure that log entries in other parts of meson don't interfere with the JSON output
-        mlog.disable()
-        backend = backends.get_backend_from_name(options.backend)
-        intr = IntrospectionInterpreter(sourcedir, '', backend.name, visitors = [AstIDGenerator(), AstIndentationGenerator(), AstConditionLevel()])
-        intr.analyze()
-        # Re-enable logging just in case
-        mlog.enable()
-        for key, val in intro_types.items():
-            if (not options.all and not getattr(options, key, False)) or not val.no_bd:
-                continue
-            results += [(key, val.no_bd(intr))]
-        return print_results(options, results, indent)
-
-    infofile = get_meson_info_file(infodir)
-    if not os.path.isdir(datadir) or not os.path.isdir(infodir) or not os.path.isfile(infofile):
-        print('Current directory is not a meson build directory.\n'
-              'Please specify a valid build dir or change the working directory to it.\n'
-              'It is also possible that the build directory was generated with an old\n'
-              'meson version. Please regenerate it in this case.')
-        return 1
-
-    with open(infofile, 'r') as fp:
-        raw = json.load(fp)
-        intro_vers = raw.get('introspection', {}).get('version', {}).get('full', '0.0.0')
-
-    vers_to_check = get_meson_introspection_required_version()
-    for i in vers_to_check:
-        if not mesonlib.version_compare(intro_vers, i):
-            print('Introspection version {} is not supported. '
-                  'The required version is: {}'
-                  .format(intro_vers, ' and '.join(vers_to_check)))
-            return 1
-
-    # Extract introspection information from JSON
-    for i in intro_types.keys():
-        if not intro_types[i].func:
-            continue
-        if not options.all and not getattr(options, i, False):
-            continue
-        curr = os.path.join(infodir, 'intro-{}.json'.format(i))
-        if not os.path.isfile(curr):
-            print('Introspection file {} does not exist.'.format(curr))
-            return 1
-        with open(curr, 'r') as fp:
-            results += [(i, json.load(fp))]
-
-    return print_results(options, results, indent)
-
-updated_introspection_files = []  # type: T.List[str]
-
-def write_intro_info(intro_info: T.Sequence[T.Tuple[str, T.Union[dict, T.List[T.Any]]]], info_dir: str) -> None:
-    global updated_introspection_files
-    for i in intro_info:
-        out_file = os.path.join(info_dir, 'intro-{}.json'.format(i[0]))
-        tmp_file = os.path.join(info_dir, 'tmp_dump.json')
-        with open(tmp_file, 'w') as fp:
-            json.dump(i[1], fp)
-            fp.flush() # Not sure if this is needed
-        os.replace(tmp_file, out_file)
-        updated_introspection_files += [i[0]]
-
-def generate_introspection_file(builddata: build.Build, backend: backends.Backend) -> None:
-    coredata = builddata.environment.get_coredata()
-    intro_types = get_meson_introspection_types(coredata=coredata, builddata=builddata, backend=backend)
-    intro_info = []  # type: T.List[T.Tuple[str, T.Union[dict, T.List[T.Any]]]]
-
-    for key, val in intro_types.items():
-        if not val.func:
-            continue
-        intro_info += [(key, val.func())]
-
-    write_intro_info(intro_info, builddata.environment.info_dir)
-
-def update_build_options(coredata: cdata.CoreData, info_dir) -> None:
-    intro_info = [
-        ('buildoptions', list_buildoptions(coredata))
-    ]
-
-    write_intro_info(intro_info, info_dir)
-
-def split_version_string(version: str) -> T.Dict[str, T.Union[str, int]]:
-    vers_list = version.split('.')
-    return {
-        'full': version,
-        'major': int(vers_list[0] if len(vers_list) > 0 else 0),
-        'minor': int(vers_list[1] if len(vers_list) > 1 else 0),
-        'patch': int(vers_list[2] if len(vers_list) > 2 else 0)
-    }
-
-def write_meson_info_file(builddata: build.Build, errors: list, build_files_updated: bool = False) -> None:
-    global updated_introspection_files
-    info_dir = builddata.environment.info_dir
-    info_file = get_meson_info_file(info_dir)
-    intro_types = get_meson_introspection_types()
-    intro_info = {}
-
-    for i in intro_types.keys():
-        if not intro_types[i].func:
-            continue
-        intro_info[i] = {
-            'file': 'intro-{}.json'.format(i),
-            'updated': i in updated_introspection_files
-        }
-
-    info_data = {
-        'meson_version': split_version_string(cdata.version),
-        'directories': {
-            'source': builddata.environment.get_source_dir(),
-            'build': builddata.environment.get_build_dir(),
-            'info': info_dir,
-        },
-        'introspection': {
-            'version': split_version_string(get_meson_introspection_version()),
-            'information': intro_info,
-        },
-        'build_files_updated': build_files_updated,
-    }
-
-    if errors:
-        info_data['error'] = True
-        info_data['error_list'] = [x if isinstance(x, str) else str(x) for x in errors]
-    else:
-        info_data['error'] = False
-
-    # Write the data to disc
-    tmp_file = os.path.join(info_dir, 'tmp_dump.json')
-    with open(tmp_file, 'w') as fp:
-        json.dump(info_data, fp)
-        fp.flush()
-    os.replace(tmp_file, info_file)
diff --git a/meson/mesonbuild/mlog.py b/meson/mesonbuild/mlog.py
deleted file mode 100644 (file)
index 9c19427..0000000
+++ /dev/null
@@ -1,353 +0,0 @@
-# Copyright 2013-2014 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import io
-import sys
-import time
-import platform
-import typing as T
-from contextlib import contextmanager
-from pathlib import Path
-
-"""This is (mostly) a standalone module used to write logging
-information about Meson runs. Some output goes to screen,
-some to logging dir and some goes to both."""
-
-def _windows_ansi() -> bool:
-    # windll only exists on windows, so mypy will get mad
-    from ctypes import windll, byref  # type: ignore
-    from ctypes.wintypes import DWORD
-
-    kernel = windll.kernel32
-    stdout = kernel.GetStdHandle(-11)
-    mode = DWORD()
-    if not kernel.GetConsoleMode(stdout, byref(mode)):
-        return False
-    # ENABLE_VIRTUAL_TERMINAL_PROCESSING == 0x4
-    # If the call to enable VT processing fails (returns 0), we fallback to
-    # original behavior
-    return bool(kernel.SetConsoleMode(stdout, mode.value | 0x4) or os.environ.get('ANSICON'))
-
-def colorize_console() -> bool:
-    _colorize_console = getattr(sys.stdout, 'colorize_console', None)  # type: bool
-    if _colorize_console is not None:
-        return _colorize_console
-
-    try:
-        if platform.system().lower() == 'windows':
-            _colorize_console = os.isatty(sys.stdout.fileno()) and _windows_ansi()
-        else:
-            _colorize_console = os.isatty(sys.stdout.fileno()) and os.environ.get('TERM', 'dumb') != 'dumb'
-    except Exception:
-        _colorize_console = False
-
-    sys.stdout.colorize_console = _colorize_console  # type: ignore[attr-defined]
-    return _colorize_console
-
-def setup_console():
-    # on Windows, a subprocess might call SetConsoleMode() on the console
-    # connected to stdout and turn off ANSI escape processing. Call this after
-    # running a subprocess to ensure we turn it on again.
-    if platform.system().lower() == 'windows':
-        try:
-            delattr(sys.stdout, 'colorize_console')
-        except AttributeError:
-            pass
-
-log_dir = None               # type: T.Optional[str]
-log_file = None              # type: T.Optional[T.TextIO]
-log_fname = 'meson-log.txt'  # type: str
-log_depth = 0                # type: int
-log_timestamp_start = None   # type: T.Optional[float]
-log_fatal_warnings = False   # type: bool
-log_disable_stdout = False   # type: bool
-log_errors_only = False      # type: bool
-_in_ci = 'CI' in os.environ  # type: bool
-_logged_once = set()         # type: T.Set[T.Tuple[str, ...]]
-log_warnings_counter = 0     # type: int
-
-def disable() -> None:
-    global log_disable_stdout
-    log_disable_stdout = True
-
-def enable() -> None:
-    global log_disable_stdout
-    log_disable_stdout = False
-
-def set_quiet() -> None:
-    global log_errors_only
-    log_errors_only = True
-
-def set_verbose() -> None:
-    global log_errors_only
-    log_errors_only = False
-
-def initialize(logdir: str, fatal_warnings: bool = False) -> None:
-    global log_dir, log_file, log_fatal_warnings
-    log_dir = logdir
-    log_file = open(os.path.join(logdir, log_fname), 'w', encoding='utf8')
-    log_fatal_warnings = fatal_warnings
-
-def set_timestamp_start(start: float) -> None:
-    global log_timestamp_start
-    log_timestamp_start = start
-
-def shutdown() -> T.Optional[str]:
-    global log_file
-    if log_file is not None:
-        path = log_file.name
-        exception_around_goer = log_file
-        log_file = None
-        exception_around_goer.close()
-        return path
-    return None
-
-class AnsiDecorator:
-    plain_code = "\033[0m"
-
-    def __init__(self, text: str, code: str, quoted: bool = False):
-        self.text = text
-        self.code = code
-        self.quoted = quoted
-
-    def get_text(self, with_codes: bool) -> str:
-        text = self.text
-        if with_codes:
-            text = self.code + self.text + AnsiDecorator.plain_code
-        if self.quoted:
-            text = '"{}"'.format(text)
-        return text
-
-def bold(text: str, quoted: bool = False) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1m", quoted=quoted)
-
-def red(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1;31m")
-
-def green(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1;32m")
-
-def yellow(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1;33m")
-
-def blue(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1;34m")
-
-def cyan(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[1;36m")
-
-def normal_red(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[31m")
-
-def normal_green(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[32m")
-
-def normal_yellow(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[33m")
-
-def normal_blue(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[34m")
-
-def normal_cyan(text: str) -> AnsiDecorator:
-    return AnsiDecorator(text, "\033[36m")
-
-# This really should be AnsiDecorator or anything that implements
-# __str__(), but that requires protocols from typing_extensions
-def process_markup(args: T.Sequence[T.Union[AnsiDecorator, str]], keep: bool) -> T.List[str]:
-    arr = []  # type: T.List[str]
-    if log_timestamp_start is not None:
-        arr = ['[{:.3f}]'.format(time.monotonic() - log_timestamp_start)]
-    for arg in args:
-        if arg is None:
-            continue
-        if isinstance(arg, str):
-            arr.append(arg)
-        elif isinstance(arg, AnsiDecorator):
-            arr.append(arg.get_text(keep))
-        else:
-            arr.append(str(arg))
-    return arr
-
-def force_print(*args: str, **kwargs: T.Any) -> None:
-    if log_disable_stdout:
-        return
-    iostr = io.StringIO()
-    kwargs['file'] = iostr
-    print(*args, **kwargs)
-
-    raw = iostr.getvalue()
-    if log_depth > 0:
-        prepend = '|' * log_depth
-        raw = prepend + raw.replace('\n', '\n' + prepend, raw.count('\n') - 1)
-
-    # _Something_ is going to get printed.
-    try:
-        print(raw, end='')
-    except UnicodeEncodeError:
-        cleaned = raw.encode('ascii', 'replace').decode('ascii')
-        print(cleaned, end='')
-
-# We really want a heterogeneous dict for this, but that's in typing_extensions
-def debug(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
-    arr = process_markup(args, False)
-    if log_file is not None:
-        print(*arr, file=log_file, **kwargs)
-        log_file.flush()
-
-def _debug_log_cmd(cmd: str, args: T.List[str]) -> None:
-    if not _in_ci:
-        return
-    args = ['"{}"'.format(x) for x in args]  # Quote all args, just in case
-    debug('!meson_ci!/{} {}'.format(cmd, ' '.join(args)))
-
-def cmd_ci_include(file: str) -> None:
-    _debug_log_cmd('ci_include', [file])
-
-def log(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
-        **kwargs: T.Any) -> None:
-    arr = process_markup(args, False)
-    if log_file is not None:
-        print(*arr, file=log_file, **kwargs)
-        log_file.flush()
-    if colorize_console():
-        arr = process_markup(args, True)
-    if not log_errors_only or is_error:
-        force_print(*arr, **kwargs)
-
-def log_once(*args: T.Union[str, AnsiDecorator], is_error: bool = False,
-             **kwargs: T.Any) -> None:
-    """Log variant that only prints a given message one time per meson invocation.
-
-    This considers ansi decorated values by the values they wrap without
-    regard for the AnsiDecorator itself.
-    """
-    t = tuple(a.text if isinstance(a, AnsiDecorator) else a for a in args)
-    if t in _logged_once:
-        return
-    _logged_once.add(t)
-    log(*args, is_error=is_error, **kwargs)
-
-# This isn't strictly correct. What we really want here is something like:
-# class StringProtocol(typing_extensions.Protocol):
-#
-#      def __str__(self) -> str: ...
-#
-# This would more accurately embody what this function can handle, but we
-# don't have that yet, so instead we'll do some casting to work around it
-def get_error_location_string(fname: str, lineno: str) -> str:
-    return '{}:{}:'.format(fname, lineno)
-
-def _log_error(severity: str, *rargs: T.Union[str, AnsiDecorator],
-               once: bool = False, fatal: bool = True, **kwargs: T.Any) -> None:
-    from .mesonlib import MesonException, relpath
-
-    # The typing requirements here are non-obvious. Lists are invariant,
-    # therefore T.List[A] and T.List[T.Union[A, B]] are not able to be joined
-    if severity == 'notice':
-        label = [bold('NOTICE:')]  # type: T.List[T.Union[str, AnsiDecorator]]
-    elif severity == 'warning':
-        label = [yellow('WARNING:')]
-    elif severity == 'error':
-        label = [red('ERROR:')]
-    elif severity == 'deprecation':
-        label = [red('DEPRECATION:')]
-    else:
-        raise MesonException('Invalid severity ' + severity)
-    # rargs is a tuple, not a list
-    args = label + list(rargs)
-
-    location = kwargs.pop('location', None)
-    if location is not None:
-        location_file = relpath(location.filename, os.getcwd())
-        location_str = get_error_location_string(location_file, location.lineno)
-        # Unions are frankly awful, and we have to T.cast here to get mypy
-        # to understand that the list concatenation is safe
-        location_list = T.cast(T.List[T.Union[str, AnsiDecorator]], [location_str])
-        args = location_list + args
-
-    if once:
-        log_once(*args, **kwargs)
-    else:
-        log(*args, **kwargs)
-
-    global log_warnings_counter
-    log_warnings_counter += 1
-
-    if log_fatal_warnings and fatal:
-        raise MesonException("Fatal warnings enabled, aborting")
-
-def error(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
-    return _log_error('error', *args, **kwargs, is_error=True)
-
-def warning(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
-    return _log_error('warning', *args, **kwargs, is_error=True)
-
-def deprecation(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
-    return _log_error('deprecation', *args, **kwargs, is_error=True)
-
-def notice(*args: T.Union[str, AnsiDecorator], **kwargs: T.Any) -> None:
-    return _log_error('notice', *args, **kwargs, is_error=False)
-
-def get_relative_path(target: Path, current: Path) -> Path:
-    """Get the path to target from current"""
-    # Go up "current" until we find a common ancestor to target
-    acc = ['.']
-    for part in [current, *current.parents]:
-        try:
-            path = target.relative_to(part)
-            return Path(*acc, path)
-        except ValueError:
-            pass
-        acc += ['..']
-
-    # we failed, should not get here
-    return target
-
-def exception(e: Exception, prefix: T.Optional[AnsiDecorator] = None) -> None:
-    if prefix is None:
-        prefix = red('ERROR:')
-    log()
-    args = []  # type: T.List[T.Union[AnsiDecorator, str]]
-    if all(getattr(e, a, None) is not None for a in ['file', 'lineno', 'colno']):
-        # Mypy doesn't follow hasattr, and it's pretty easy to visually inspect
-        # that this is correct, so we'll just ignore it.
-        path = get_relative_path(Path(e.file), Path(os.getcwd()))  # type: ignore
-        args.append('{}:{}:{}:'.format(path, e.lineno, e.colno))  # type: ignore
-    if prefix:
-        args.append(prefix)
-    args.append(str(e))
-    log(*args)
-
-# Format a list for logging purposes as a string. It separates
-# all but the last item with commas, and the last with 'and'.
-def format_list(input_list: T.List[str]) -> str:
-    l = len(input_list)
-    if l > 2:
-        return ' and '.join([', '.join(input_list[:-1]), input_list[-1]])
-    elif l == 2:
-        return ' and '.join(input_list)
-    elif l == 1:
-        return input_list[0]
-    else:
-        return ''
-
-@contextmanager
-def nested() -> T.Generator[None, None, None]:
-    global log_depth
-    log_depth += 1
-    try:
-        yield
-    finally:
-        log_depth -= 1
diff --git a/meson/mesonbuild/modules/__init__.py b/meson/mesonbuild/modules/__init__.py
deleted file mode 100644 (file)
index 47be039..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies that
-# are UI-related.
-
-import os
-
-from .. import build
-from ..mesonlib import unholder
-
-
-class ExtensionModule:
-    def __init__(self, interpreter):
-        self.interpreter = interpreter
-        self.snippets = set() # List of methods that operate only on the interpreter.
-
-    def is_snippet(self, funcname):
-        return funcname in self.snippets
-
-
-def get_include_args(include_dirs, prefix='-I'):
-    '''
-    Expand include arguments to refer to the source and build dirs
-    by using @SOURCE_ROOT@ and @BUILD_ROOT@ for later substitution
-    '''
-    if not include_dirs:
-        return []
-
-    dirs_str = []
-    for dirs in unholder(include_dirs):
-        if isinstance(dirs, str):
-            dirs_str += ['%s%s' % (prefix, dirs)]
-            continue
-
-        # Should be build.IncludeDirs object.
-        basedir = dirs.get_curdir()
-        for d in dirs.get_incdirs():
-            expdir = os.path.join(basedir, d)
-            srctreedir = os.path.join('@SOURCE_ROOT@', expdir)
-            buildtreedir = os.path.join('@BUILD_ROOT@', expdir)
-            dirs_str += ['%s%s' % (prefix, buildtreedir),
-                         '%s%s' % (prefix, srctreedir)]
-        for d in dirs.get_extra_build_dirs():
-            dirs_str += ['%s%s' % (prefix, d)]
-
-    return dirs_str
-
-def is_module_library(fname):
-    '''
-    Check if the file is a library-like file generated by a module-specific
-    target, such as GirTarget or TypelibTarget
-    '''
-    if hasattr(fname, 'fname'):
-        fname = fname.fname
-    suffix = fname.split('.')[-1]
-    return suffix in ('gir', 'typelib')
-
-
-class ModuleReturnValue:
-    def __init__(self, return_value, new_objects):
-        self.return_value = return_value
-        assert(isinstance(new_objects, list))
-        self.new_objects = new_objects
-
-class GResourceTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, kwargs):
-        super().__init__(name, subdir, subproject, kwargs)
-
-class GResourceHeaderTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, kwargs):
-        super().__init__(name, subdir, subproject, kwargs)
-
-class GirTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, kwargs):
-        super().__init__(name, subdir, subproject, kwargs)
-
-class TypelibTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, kwargs):
-        super().__init__(name, subdir, subproject, kwargs)
-
-class VapiTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, kwargs):
-        super().__init__(name, subdir, subproject, kwargs)
diff --git a/meson/mesonbuild/modules/cmake.py b/meson/mesonbuild/modules/cmake.py
deleted file mode 100644 (file)
index 2383753..0000000
+++ /dev/null
@@ -1,395 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-import re
-import os, os.path, pathlib
-import shutil
-import typing as T
-
-from . import ExtensionModule, ModuleReturnValue
-
-from .. import build, dependencies, mesonlib, mlog
-from ..cmake import SingleTargetOptions, TargetOptions, cmake_defines_to_args
-from ..interpreter import ConfigurationDataHolder, InterpreterException, SubprojectHolder
-from ..interpreterbase import (
-    InterpreterObject,
-    ObjectHolder,
-
-    FeatureNew,
-    FeatureNewKwargs,
-    FeatureDeprecatedKwargs,
-
-    stringArgs,
-    permittedKwargs,
-    noPosargs,
-    noKwargs,
-
-    InvalidArguments,
-)
-
-
-COMPATIBILITIES = ['AnyNewerVersion', 'SameMajorVersion', 'SameMinorVersion', 'ExactVersion']
-
-# Taken from https://github.com/Kitware/CMake/blob/master/Modules/CMakePackageConfigHelpers.cmake
-PACKAGE_INIT_BASE = '''
-####### Expanded from \\@PACKAGE_INIT\\@ by configure_package_config_file() #######
-####### Any changes to this file will be overwritten by the next CMake run ####
-####### The input file was @inputFileName@ ########
-
-get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/@PACKAGE_RELATIVE_PATH@" ABSOLUTE)
-'''
-PACKAGE_INIT_EXT = '''
-# Use original install prefix when loaded through a "/usr move"
-# cross-prefix symbolic link such as /lib -> /usr/lib.
-get_filename_component(_realCurr "${CMAKE_CURRENT_LIST_DIR}" REALPATH)
-get_filename_component(_realOrig "@absInstallDir@" REALPATH)
-if(_realCurr STREQUAL _realOrig)
-  set(PACKAGE_PREFIX_DIR "@installPrefix@")
-endif()
-unset(_realOrig)
-unset(_realCurr)
-'''
-PACKAGE_INIT_SET_AND_CHECK = '''
-macro(set_and_check _var _file)
-  set(${_var} "${_file}")
-  if(NOT EXISTS "${_file}")
-    message(FATAL_ERROR "File or directory ${_file} referenced by variable ${_var} does not exist !")
-  endif()
-endmacro()
-
-####################################################################################
-'''
-
-class CMakeSubprojectHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, subp, pv):
-        assert(isinstance(subp, SubprojectHolder))
-        assert(hasattr(subp, 'cm_interpreter'))
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, subp, pv)
-        self.methods.update({'get_variable': self.get_variable,
-                             'dependency': self.dependency,
-                             'include_directories': self.include_directories,
-                             'target': self.target,
-                             'target_type': self.target_type,
-                             'target_list': self.target_list,
-                             'found': self.found_method,
-                             })
-
-    def _args_to_info(self, args):
-        if len(args) != 1:
-            raise InterpreterException('Exactly one argument is required.')
-
-        tgt = args[0]
-        res = self.held_object.cm_interpreter.target_info(tgt)
-        if res is None:
-            raise InterpreterException('The CMake target {} does not exist\n'.format(tgt) +
-                                       '  Use the following command in your meson.build to list all available targets:\n\n' +
-                                       '    message(\'CMaket targets:\\n - \' + \'\\n - \'.join(<cmake_subproject>.target_list()))')
-
-        # Make sure that all keys are present (if not this is a bug)
-        assert(all([x in res for x in ['inc', 'src', 'dep', 'tgt', 'func']]))
-        return res
-
-    @noKwargs
-    @stringArgs
-    def get_variable(self, args, kwargs):
-        return self.held_object.get_variable_method(args, kwargs)
-
-    @noKwargs
-    @stringArgs
-    def dependency(self, args, kwargs):
-        info = self._args_to_info(args)
-        return self.get_variable([info['dep']], kwargs)
-
-    @noKwargs
-    @stringArgs
-    def include_directories(self, args, kwargs):
-        info = self._args_to_info(args)
-        return self.get_variable([info['inc']], kwargs)
-
-    @noKwargs
-    @stringArgs
-    def target(self, args, kwargs):
-        info = self._args_to_info(args)
-        return self.get_variable([info['tgt']], kwargs)
-
-    @noKwargs
-    @stringArgs
-    def target_type(self, args, kwargs):
-        info = self._args_to_info(args)
-        return info['func']
-
-    @noPosargs
-    @noKwargs
-    def target_list(self, args, kwargs):
-        return self.held_object.cm_interpreter.target_list()
-
-    @noPosargs
-    @noKwargs
-    @FeatureNew('CMakeSubproject.found()', '0.53.2')
-    def found_method(self, args, kwargs):
-        return self.held_object is not None
-
-
-class CMakeSubprojectOptions(InterpreterObject):
-    def __init__(self) -> None:
-        super().__init__()
-        self.cmake_options = []  # type: T.List[str]
-        self.target_options = TargetOptions()
-
-        self.methods.update(
-            {
-                'add_cmake_defines': self.add_cmake_defines,
-                'set_override_option': self.set_override_option,
-                'set_install': self.set_install,
-                'append_compile_args': self.append_compile_args,
-                'append_link_args': self.append_link_args,
-                'clear': self.clear,
-            }
-        )
-
-    def _get_opts(self, kwargs: dict) -> SingleTargetOptions:
-        if 'target' in kwargs:
-            return self.target_options[kwargs['target']]
-        return self.target_options.global_options
-
-    @noKwargs
-    def add_cmake_defines(self, args, kwargs) -> None:
-        self.cmake_options += cmake_defines_to_args(args)
-
-    @stringArgs
-    @permittedKwargs({'target'})
-    def set_override_option(self, args, kwargs) -> None:
-        if len(args) != 2:
-            raise InvalidArguments('set_override_option takes exactly 2 positional arguments')
-        self._get_opts(kwargs).set_opt(args[0], args[1])
-
-    @permittedKwargs({'target'})
-    def set_install(self, args, kwargs) -> None:
-        if len(args) != 1 or not isinstance(args[0], bool):
-            raise InvalidArguments('set_install takes exactly 1 boolean argument')
-        self._get_opts(kwargs).set_install(args[0])
-
-    @stringArgs
-    @permittedKwargs({'target'})
-    def append_compile_args(self, args, kwargs) -> None:
-        if len(args) < 2:
-            raise InvalidArguments('append_compile_args takes at least 2 positional arguments')
-        self._get_opts(kwargs).append_args(args[0], args[1:])
-
-    @stringArgs
-    @permittedKwargs({'target'})
-    def append_link_args(self, args, kwargs) -> None:
-        if not args:
-            raise InvalidArguments('append_link_args takes at least 1 positional argument')
-        self._get_opts(kwargs).append_link_args(args)
-
-    @noPosargs
-    @noKwargs
-    def clear(self, args, kwargs) -> None:
-        self.cmake_options.clear()
-        self.target_options = TargetOptions()
-
-
-class CmakeModule(ExtensionModule):
-    cmake_detected = False
-    cmake_root = None
-
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.snippets.add('configure_package_config_file')
-        self.snippets.add('subproject')
-
-    def detect_voidp_size(self, env):
-        compilers = env.coredata.compilers.host
-        compiler = compilers.get('c', None)
-        if not compiler:
-            compiler = compilers.get('cpp', None)
-
-        if not compiler:
-            raise mesonlib.MesonException('Requires a C or C++ compiler to compute sizeof(void *).')
-
-        return compiler.sizeof('void *', '', env)
-
-    def detect_cmake(self):
-        if self.cmake_detected:
-            return True
-
-        cmakebin = dependencies.ExternalProgram('cmake', silent=False)
-        p, stdout, stderr = mesonlib.Popen_safe(cmakebin.get_command() + ['--system-information', '-G', 'Ninja'])[0:3]
-        if p.returncode != 0:
-            mlog.log('error retrieving cmake information: returnCode={0} stdout={1} stderr={2}'.format(p.returncode, stdout, stderr))
-            return False
-
-        match = re.search('\nCMAKE_ROOT \\"([^"]+)"\n', stdout.strip())
-        if not match:
-            mlog.log('unable to determine cmake root')
-            return False
-
-        cmakePath = pathlib.PurePath(match.group(1))
-        self.cmake_root = os.path.join(*cmakePath.parts)
-        self.cmake_detected = True
-        return True
-
-    @permittedKwargs({'version', 'name', 'compatibility', 'install_dir'})
-    def write_basic_package_version_file(self, state, _args, kwargs):
-        version = kwargs.get('version', None)
-        if not isinstance(version, str):
-            raise mesonlib.MesonException('Version must be specified.')
-
-        name = kwargs.get('name', None)
-        if not isinstance(name, str):
-            raise mesonlib.MesonException('Name not specified.')
-
-        compatibility = kwargs.get('compatibility', 'AnyNewerVersion')
-        if not isinstance(compatibility, str):
-            raise mesonlib.MesonException('compatibility is not string.')
-        if compatibility not in COMPATIBILITIES:
-            raise mesonlib.MesonException('compatibility must be either AnyNewerVersion, SameMajorVersion or ExactVersion.')
-
-        if not self.detect_cmake():
-            raise mesonlib.MesonException('Unable to find cmake')
-
-        pkgroot = kwargs.get('install_dir', None)
-        if pkgroot is None:
-            pkgroot = os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'cmake', name)
-        if not isinstance(pkgroot, str):
-            raise mesonlib.MesonException('Install_dir must be a string.')
-
-        template_file = os.path.join(self.cmake_root, 'Modules', 'BasicConfigVersion-{}.cmake.in'.format(compatibility))
-        if not os.path.exists(template_file):
-            raise mesonlib.MesonException('your cmake installation doesn\'t support the {} compatibility'.format(compatibility))
-
-        version_file = os.path.join(state.environment.scratch_dir, '{}ConfigVersion.cmake'.format(name))
-
-        conf = {
-            'CVF_VERSION': (version, ''),
-            'CMAKE_SIZEOF_VOID_P': (str(self.detect_voidp_size(state.environment)), '')
-        }
-        mesonlib.do_conf_file(template_file, version_file, conf, 'meson')
-
-        res = build.Data(mesonlib.File(True, state.environment.get_scratch_dir(), version_file), pkgroot)
-        return ModuleReturnValue(res, [res])
-
-    def create_package_file(self, infile, outfile, PACKAGE_RELATIVE_PATH, extra, confdata):
-        package_init = PACKAGE_INIT_BASE.replace('@PACKAGE_RELATIVE_PATH@', PACKAGE_RELATIVE_PATH)
-        package_init = package_init.replace('@inputFileName@', infile)
-        package_init += extra
-        package_init += PACKAGE_INIT_SET_AND_CHECK
-
-        try:
-            with open(infile, "r") as fin:
-                data = fin.readlines()
-        except Exception as e:
-            raise mesonlib.MesonException('Could not read input file %s: %s' % (infile, str(e)))
-
-        result = []
-        regex = re.compile(r'(?:\\\\)+(?=\\?@)|\\@|@([-a-zA-Z0-9_]+)@')
-        for line in data:
-            line = line.replace('@PACKAGE_INIT@', package_init)
-            line, _missing = mesonlib.do_replacement(regex, line, 'meson', confdata)
-
-            result.append(line)
-
-        outfile_tmp = outfile + "~"
-        with open(outfile_tmp, "w", encoding='utf-8') as fout:
-            fout.writelines(result)
-
-        shutil.copymode(infile, outfile_tmp)
-        mesonlib.replace_if_different(outfile, outfile_tmp)
-
-    @permittedKwargs({'input', 'name', 'install_dir', 'configuration'})
-    def configure_package_config_file(self, interpreter, state, args, kwargs):
-        if args:
-            raise mesonlib.MesonException('configure_package_config_file takes only keyword arguments.')
-
-        if 'input' not in kwargs:
-            raise mesonlib.MesonException('configure_package_config_file requires "input" keyword.')
-        inputfile = kwargs['input']
-        if isinstance(inputfile, list):
-            if len(inputfile) != 1:
-                m = "Keyword argument 'input' requires exactly one file"
-                raise mesonlib.MesonException(m)
-            inputfile = inputfile[0]
-        if not isinstance(inputfile, (str, mesonlib.File)):
-            raise mesonlib.MesonException("input must be a string or a file")
-        if isinstance(inputfile, str):
-            inputfile = mesonlib.File.from_source_file(state.environment.source_dir, state.subdir, inputfile)
-
-        ifile_abs = inputfile.absolute_path(state.environment.source_dir, state.environment.build_dir)
-
-        if 'name' not in kwargs:
-            raise mesonlib.MesonException('"name" not specified.')
-        name = kwargs['name']
-
-        (ofile_path, ofile_fname) = os.path.split(os.path.join(state.subdir, '{}Config.cmake'.format(name)))
-        ofile_abs = os.path.join(state.environment.build_dir, ofile_path, ofile_fname)
-
-        install_dir = kwargs.get('install_dir', os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'cmake', name))
-        if not isinstance(install_dir, str):
-            raise mesonlib.MesonException('"install_dir" must be a string.')
-
-        if 'configuration' not in kwargs:
-            raise mesonlib.MesonException('"configuration" not specified.')
-        conf = kwargs['configuration']
-        if not isinstance(conf, ConfigurationDataHolder):
-            raise mesonlib.MesonException('Argument "configuration" is not of type configuration_data')
-
-        prefix = state.environment.coredata.get_builtin_option('prefix')
-        abs_install_dir = install_dir
-        if not os.path.isabs(abs_install_dir):
-            abs_install_dir = os.path.join(prefix, install_dir)
-
-        PACKAGE_RELATIVE_PATH = os.path.relpath(prefix, abs_install_dir)
-        extra = ''
-        if re.match('^(/usr)?/lib(64)?/.+', abs_install_dir):
-            extra = PACKAGE_INIT_EXT.replace('@absInstallDir@', abs_install_dir)
-            extra = extra.replace('@installPrefix@', prefix)
-
-        self.create_package_file(ifile_abs, ofile_abs, PACKAGE_RELATIVE_PATH, extra, conf.held_object)
-        conf.mark_used()
-
-        conffile = os.path.normpath(inputfile.relative_name())
-        if conffile not in interpreter.build_def_files:
-            interpreter.build_def_files.append(conffile)
-
-        res = build.Data(mesonlib.File(True, ofile_path, ofile_fname), install_dir)
-        interpreter.build.data.append(res)
-
-        return res
-
-    @FeatureNew('subproject', '0.51.0')
-    @FeatureNewKwargs('subproject', '0.55.0', ['options'])
-    @FeatureDeprecatedKwargs('subproject', '0.55.0', ['cmake_options'])
-    @permittedKwargs({'cmake_options', 'required', 'options'})
-    @stringArgs
-    def subproject(self, interpreter, state, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Subproject takes exactly one argument')
-        if 'cmake_options' in kwargs and 'options' in kwargs:
-            raise InterpreterException('"options" cannot be used together with "cmake_options"')
-        dirname = args[0]
-        subp = interpreter.do_subproject(dirname, 'cmake', kwargs)
-        if not subp.held_object:
-            return subp
-        return CMakeSubprojectHolder(subp, dirname)
-
-    @FeatureNew('subproject_options', '0.55.0')
-    @noKwargs
-    @noPosargs
-    def subproject_options(self, state, args, kwargs) -> ModuleReturnValue:
-        opts = CMakeSubprojectOptions()
-        return ModuleReturnValue(opts, [])
-
-def initialize(*args, **kwargs):
-    return CmakeModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/dlang.py b/meson/mesonbuild/modules/dlang.py
deleted file mode 100644 (file)
index d4f62e4..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This file contains the detection logic for external dependencies that
-# are UI-related.
-
-import json
-import os
-
-from . import ExtensionModule
-
-from .. import mlog
-
-from ..mesonlib import (
-    Popen_safe, MesonException
-)
-
-from ..dependencies.base import (
-    ExternalProgram, DubDependency
-)
-
-from ..interpreter import DependencyHolder
-
-class DlangModule(ExtensionModule):
-    class_dubbin = None
-    init_dub = False
-
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.snippets.add('generate_dub_file')
-
-    def _init_dub(self):
-        if DlangModule.class_dubbin is None:
-            self.dubbin = DubDependency.class_dubbin
-            DlangModule.class_dubbin = self.dubbin
-        else:
-            self.dubbin = DlangModule.class_dubbin
-
-        if DlangModule.class_dubbin is None:
-            self.dubbin = self.check_dub()
-            DlangModule.class_dubbin = self.dubbin
-        else:
-            self.dubbin = DlangModule.class_dubbin
-
-        if not self.dubbin:
-            if not self.dubbin:
-                raise MesonException('DUB not found.')
-
-    def generate_dub_file(self, interpreter, state, args, kwargs):
-        if not DlangModule.init_dub:
-            self._init_dub()
-
-        if len(args) < 2:
-            raise MesonException('Missing arguments')
-
-        config = {
-            'name': args[0]
-        }
-
-        config_path = os.path.join(args[1], 'dub.json')
-        if os.path.exists(config_path):
-            with open(config_path, 'r', encoding='utf8') as ofile:
-                try:
-                    config = json.load(ofile)
-                except ValueError:
-                    mlog.warning('Failed to load the data in dub.json')
-
-        warn_publishing = ['description', 'license']
-        for arg in warn_publishing:
-            if arg not in kwargs and \
-               arg not in config:
-                mlog.warning('Without', mlog.bold(arg), 'the DUB package can\'t be published')
-
-        for key, value in kwargs.items():
-            if key == 'dependencies':
-                config[key] = {}
-                if isinstance(value, list):
-                    for dep in value:
-                        if isinstance(dep, DependencyHolder):
-                            name = dep.method_call('name', [], [])
-                            ret, res = self._call_dubbin(['describe', name])
-                            if ret == 0:
-                                version = dep.method_call('version', [], [])
-                                if version is None:
-                                    config[key][name] = ''
-                                else:
-                                    config[key][name] = version
-                elif isinstance(value, DependencyHolder):
-                    name = value.method_call('name', [], [])
-                    ret, res = self._call_dubbin(['describe', name])
-                    if ret == 0:
-                        version = value.method_call('version', [], [])
-                        if version is None:
-                            config[key][name] = ''
-                        else:
-                            config[key][name] = version
-            else:
-                config[key] = value
-
-        with open(config_path, 'w', encoding='utf8') as ofile:
-            ofile.write(json.dumps(config, indent=4, ensure_ascii=False))
-
-    def _call_dubbin(self, args, env=None):
-        p, out = Popen_safe(self.dubbin.get_command() + args, env=env)[0:2]
-        return p.returncode, out.strip()
-
-    def check_dub(self):
-        dubbin = ExternalProgram('dub', silent=True)
-        if dubbin.found():
-            try:
-                p, out = Popen_safe(dubbin.get_command() + ['--version'])[0:2]
-                if p.returncode != 0:
-                    mlog.warning('Found dub {!r} but couldn\'t run it'
-                                 ''.format(' '.join(dubbin.get_command())))
-                    # Set to False instead of None to signify that we've already
-                    # searched for it and not found it
-                    dubbin = False
-            except (FileNotFoundError, PermissionError):
-                dubbin = False
-        else:
-            dubbin = False
-        if dubbin:
-            mlog.log('Found DUB:', mlog.bold(dubbin.get_path()),
-                     '(%s)' % out.strip())
-        else:
-            mlog.log('Found DUB:', mlog.red('NO'))
-        return dubbin
-
-def initialize(*args, **kwargs):
-    return DlangModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/fs.py b/meson/mesonbuild/modules/fs.py
deleted file mode 100644 (file)
index d483111..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import typing as T
-import hashlib
-from pathlib import Path, PurePath, PureWindowsPath
-
-from .. import mlog
-from . import ExtensionModule
-from . import ModuleReturnValue
-from ..mesonlib import MesonException
-from ..interpreterbase import FeatureNew
-
-from ..interpreterbase import stringArgs, noKwargs
-if T.TYPE_CHECKING:
-    from ..interpreter import ModuleState
-
-class FSModule(ExtensionModule):
-
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.snippets.add('generate_dub_file')
-
-    def _absolute_dir(self, state: 'ModuleState', arg: str) -> Path:
-        """
-        make an absolute path from a relative path, WITHOUT resolving symlinks
-        """
-        return Path(state.source_root) / state.subdir / Path(arg).expanduser()
-
-    def _resolve_dir(self, state: 'ModuleState', arg: str) -> Path:
-        """
-        resolves symlinks and makes absolute a directory relative to calling meson.build,
-        if not already absolute
-        """
-        path = self._absolute_dir(state, arg)
-        try:
-            # accomodate unresolvable paths e.g. symlink loops
-            path = path.resolve()
-        except Exception:
-            # return the best we could do
-            pass
-        return path
-
-    def _check(self, check: str, state: 'ModuleState', args: T.Sequence[str]) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.{} takes exactly one argument.'.format(check))
-        test_file = self._resolve_dir(state, args[0])
-        val = getattr(test_file, check)()
-        if isinstance(val, Path):
-            val = str(val)
-        return ModuleReturnValue(val, [])
-
-    @stringArgs
-    @noKwargs
-    @FeatureNew('fs.expanduser', '0.54.0')
-    def expanduser(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.expanduser takes exactly one argument.')
-        return ModuleReturnValue(str(Path(args[0]).expanduser()), [])
-
-    @stringArgs
-    @noKwargs
-    @FeatureNew('fs.is_absolute', '0.54.0')
-    def is_absolute(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.is_absolute takes exactly one argument.')
-        return ModuleReturnValue(PurePath(args[0]).is_absolute(), [])
-
-    @stringArgs
-    @noKwargs
-    @FeatureNew('fs.as_posix', '0.54.0')
-    def as_posix(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        """
-        this function assumes you are passing a Windows path, even if on a Unix-like system
-        and so ALL '\' are turned to '/', even if you meant to escape a character
-        """
-        if len(args) != 1:
-            raise MesonException('fs.as_posix takes exactly one argument.')
-        return ModuleReturnValue(PureWindowsPath(args[0]).as_posix(), [])
-
-    @stringArgs
-    @noKwargs
-    def exists(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        return self._check('exists', state, args)
-
-    @stringArgs
-    @noKwargs
-    def is_symlink(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.is_symlink takes exactly one argument.')
-        return ModuleReturnValue(self._absolute_dir(state, args[0]).is_symlink(), [])
-
-    @stringArgs
-    @noKwargs
-    def is_file(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        return self._check('is_file', state, args)
-
-    @stringArgs
-    @noKwargs
-    def is_dir(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        return self._check('is_dir', state, args)
-
-    @stringArgs
-    @noKwargs
-    def hash(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 2:
-            raise MesonException('fs.hash takes exactly two arguments.')
-        file = self._resolve_dir(state, args[0])
-        if not file.is_file():
-            raise MesonException('{} is not a file and therefore cannot be hashed'.format(file))
-        try:
-            h = hashlib.new(args[1])
-        except ValueError:
-            raise MesonException('hash algorithm {} is not available'.format(args[1]))
-        mlog.debug('computing {} sum of {} size {} bytes'.format(args[1], file, file.stat().st_size))
-        h.update(file.read_bytes())
-        return ModuleReturnValue(h.hexdigest(), [])
-
-    @stringArgs
-    @noKwargs
-    def size(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.size takes exactly one argument.')
-        file = self._resolve_dir(state, args[0])
-        if not file.is_file():
-            raise MesonException('{} is not a file and therefore cannot be sized'.format(file))
-        try:
-            return ModuleReturnValue(file.stat().st_size, [])
-        except ValueError:
-            raise MesonException('{} size could not be determined'.format(args[0]))
-
-    @stringArgs
-    @noKwargs
-    def is_samepath(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 2:
-            raise MesonException('fs.is_samepath takes exactly two arguments.')
-        file1 = self._resolve_dir(state, args[0])
-        file2 = self._resolve_dir(state, args[1])
-        if not file1.exists():
-            return ModuleReturnValue(False, [])
-        if not file2.exists():
-            return ModuleReturnValue(False, [])
-        try:
-            return ModuleReturnValue(file1.samefile(file2), [])
-        except OSError:
-            return ModuleReturnValue(False, [])
-
-    @stringArgs
-    @noKwargs
-    def replace_suffix(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 2:
-            raise MesonException('fs.replace_suffix takes exactly two arguments.')
-        original = PurePath(args[0])
-        new = original.with_suffix(args[1])
-        return ModuleReturnValue(str(new), [])
-
-    @stringArgs
-    @noKwargs
-    def parent(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.parent takes exactly one argument.')
-        original = PurePath(args[0])
-        new = original.parent
-        return ModuleReturnValue(str(new), [])
-
-    @stringArgs
-    @noKwargs
-    def name(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.name takes exactly one argument.')
-        original = PurePath(args[0])
-        new = original.name
-        return ModuleReturnValue(str(new), [])
-
-    @stringArgs
-    @noKwargs
-    @FeatureNew('fs.stem', '0.54.0')
-    def stem(self, state: 'ModuleState', args: T.Sequence[str], kwargs: dict) -> ModuleReturnValue:
-        if len(args) != 1:
-            raise MesonException('fs.stem takes exactly one argument.')
-        original = PurePath(args[0])
-        new = original.stem
-        return ModuleReturnValue(str(new), [])
-
-def initialize(*args, **kwargs) -> FSModule:
-    return FSModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/gnome.py b/meson/mesonbuild/modules/gnome.py
deleted file mode 100644 (file)
index 1faa128..0000000
+++ /dev/null
@@ -1,1699 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''This module provides helper functions for Gnome/GLib related
-functionality such as gobject-introspection, gresources and gtk-doc'''
-
-import os
-import copy
-import subprocess
-import functools
-
-from .. import build
-from .. import mlog
-from .. import mesonlib
-from .. import interpreter
-from . import GResourceTarget, GResourceHeaderTarget, GirTarget, TypelibTarget, VapiTarget
-from . import get_include_args
-from . import ExtensionModule
-from . import ModuleReturnValue
-from ..mesonlib import (
-    MachineChoice, MesonException, OrderedSet, Popen_safe, extract_as_list,
-    join_args, unholder,
-)
-from ..dependencies import Dependency, PkgConfigDependency, InternalDependency, ExternalProgram
-from ..interpreterbase import noKwargs, permittedKwargs, FeatureNew, FeatureNewKwargs, FeatureDeprecatedKwargs
-
-# gresource compilation is broken due to the way
-# the resource compiler and Ninja clash about it
-#
-# https://github.com/ninja-build/ninja/issues/1184
-# https://bugzilla.gnome.org/show_bug.cgi?id=774368
-gresource_dep_needed_version = '>= 2.51.1'
-
-native_glib_version = None
-
-class GnomeModule(ExtensionModule):
-    gir_dep = None
-
-    @staticmethod
-    def _get_native_glib_version(state):
-        global native_glib_version
-        if native_glib_version is None:
-            glib_dep = PkgConfigDependency('glib-2.0', state.environment,
-                                           {'native': True, 'required': False})
-            if glib_dep.found():
-                native_glib_version = glib_dep.get_version()
-            else:
-                mlog.warning('Could not detect glib version, assuming 2.54. '
-                             'You may get build errors if your glib is older.')
-                native_glib_version = '2.54'
-        return native_glib_version
-
-    @mesonlib.run_once
-    def __print_gresources_warning(self, state):
-        if not mesonlib.version_compare(self._get_native_glib_version(state),
-                                        gresource_dep_needed_version):
-            mlog.warning('GLib compiled dependencies do not work reliably with \n'
-                         'the current version of GLib. See the following upstream issue:',
-                         mlog.bold('https://bugzilla.gnome.org/show_bug.cgi?id=774368'))
-
-    @staticmethod
-    def _print_gdbus_warning():
-        mlog.warning('Code generated with gdbus_codegen() requires the root directory be added to\n'
-                     '  include_directories of targets with GLib < 2.51.3:',
-                     mlog.bold('https://github.com/mesonbuild/meson/issues/1387'),
-                     once=True)
-
-    @FeatureNewKwargs('gnome.compile_resources', '0.37.0', ['gresource_bundle', 'export', 'install_header'])
-    @permittedKwargs({'source_dir', 'c_name', 'dependencies', 'export', 'gresource_bundle', 'install_header',
-                      'install', 'install_dir', 'extra_args', 'build_by_default'})
-    def compile_resources(self, state, args, kwargs):
-        self.__print_gresources_warning(state)
-        glib_version = self._get_native_glib_version(state)
-
-        cmd = ['glib-compile-resources', '@INPUT@']
-
-        source_dirs, dependencies = [mesonlib.extract_as_list(kwargs, c, pop=True) for c in  ['source_dir', 'dependencies']]
-
-        if len(args) < 2:
-            raise MesonException('Not enough arguments; the name of the resource '
-                                 'and the path to the XML file are required')
-
-        # Validate dependencies
-        for (ii, dep) in enumerate(dependencies):
-            if hasattr(dep, 'held_object'):
-                dependencies[ii] = dep = dep.held_object
-            if not isinstance(dep, (mesonlib.File, build.CustomTarget, build.CustomTargetIndex)):
-                m = 'Unexpected dependency type {!r} for gnome.compile_resources() ' \
-                    '"dependencies" argument.\nPlease pass the return value of ' \
-                    'custom_target() or configure_file()'
-                raise MesonException(m.format(dep))
-            if isinstance(dep, (build.CustomTarget, build.CustomTargetIndex)):
-                if not mesonlib.version_compare(glib_version, gresource_dep_needed_version):
-                    m = 'The "dependencies" argument of gnome.compile_resources() can not\n' \
-                        'be used with the current version of glib-compile-resources due to\n' \
-                        '<https://bugzilla.gnome.org/show_bug.cgi?id=774368>'
-                    raise MesonException(m)
-
-        ifile = args[1]
-        if isinstance(ifile, mesonlib.File):
-            # glib-compile-resources will be run inside the source dir,
-            # so we need either 'src_to_build' or the absolute path.
-            # Absolute path is the easiest choice.
-            if ifile.is_built:
-                ifile = os.path.join(state.environment.get_build_dir(), ifile.subdir, ifile.fname)
-            else:
-                ifile = os.path.join(ifile.subdir, ifile.fname)
-        elif isinstance(ifile, str):
-            ifile = os.path.join(state.subdir, ifile)
-        elif isinstance(ifile, (interpreter.CustomTargetHolder,
-                                interpreter.CustomTargetIndexHolder,
-                                interpreter.GeneratedObjectsHolder)):
-            m = 'Resource xml files generated at build-time cannot be used ' \
-                'with gnome.compile_resources() because we need to scan ' \
-                'the xml for dependencies. Use configure_file() instead ' \
-                'to generate it at configure-time.'
-            raise MesonException(m)
-        else:
-            raise MesonException('Invalid file argument: {!r}'.format(ifile))
-
-        depend_files, depends, subdirs = self._get_gresource_dependencies(
-            state, ifile, source_dirs, dependencies)
-
-        # Make source dirs relative to build dir now
-        source_dirs = [os.path.join(state.build_to_src, state.subdir, d) for d in source_dirs]
-        # Ensure build directories of generated deps are included
-        source_dirs += subdirs
-        # Always include current directory, but after paths set by user
-        source_dirs.append(os.path.join(state.build_to_src, state.subdir))
-
-        for source_dir in OrderedSet(source_dirs):
-            cmd += ['--sourcedir', source_dir]
-
-        if 'c_name' in kwargs:
-            cmd += ['--c-name', kwargs.pop('c_name')]
-        export = kwargs.pop('export', False)
-        if not export:
-            cmd += ['--internal']
-
-        cmd += ['--generate', '--target', '@OUTPUT@']
-
-        cmd += mesonlib.stringlistify(kwargs.pop('extra_args', []))
-
-        gresource = kwargs.pop('gresource_bundle', False)
-        if gresource:
-            output = args[0] + '.gresource'
-            name = args[0] + '_gresource'
-        else:
-            output = args[0] + '.c'
-            name = args[0] + '_c'
-
-        if kwargs.get('install', False) and not gresource:
-            raise MesonException('The install kwarg only applies to gresource bundles, see install_header')
-
-        install_header = kwargs.pop('install_header', False)
-        if install_header and gresource:
-            raise MesonException('The install_header kwarg does not apply to gresource bundles')
-        if install_header and not export:
-            raise MesonException('GResource header is installed yet export is not enabled')
-
-        kwargs['input'] = args[1]
-        kwargs['output'] = output
-        kwargs['depends'] = depends
-        if not mesonlib.version_compare(glib_version, gresource_dep_needed_version):
-            # This will eventually go out of sync if dependencies are added
-            kwargs['depend_files'] = depend_files
-            kwargs['command'] = cmd
-        else:
-            depfile = kwargs['output'] + '.d'
-            kwargs['depfile'] = depfile
-            kwargs['command'] = copy.copy(cmd) + ['--dependency-file', '@DEPFILE@']
-        target_c = GResourceTarget(name, state.subdir, state.subproject, kwargs)
-
-        if gresource: # Only one target for .gresource files
-            return ModuleReturnValue(target_c, [target_c])
-
-        h_kwargs = {
-            'command': cmd,
-            'input': args[1],
-            'output': args[0] + '.h',
-            # The header doesn't actually care about the files yet it errors if missing
-            'depends': depends
-        }
-        if 'build_by_default' in kwargs:
-            h_kwargs['build_by_default'] = kwargs['build_by_default']
-        if install_header:
-            h_kwargs['install'] = install_header
-            h_kwargs['install_dir'] = kwargs.get('install_dir',
-                                                 state.environment.coredata.get_builtin_option('includedir'))
-        target_h = GResourceHeaderTarget(args[0] + '_h', state.subdir, state.subproject, h_kwargs)
-        rv = [target_c, target_h]
-        return ModuleReturnValue(rv, rv)
-
-    def _get_gresource_dependencies(self, state, input_file, source_dirs, dependencies):
-
-        cmd = ['glib-compile-resources',
-               input_file,
-               '--generate-dependencies']
-
-        # Prefer generated files over source files
-        cmd += ['--sourcedir', state.subdir] # Current build dir
-        for source_dir in source_dirs:
-            cmd += ['--sourcedir', os.path.join(state.subdir, source_dir)]
-
-        try:
-            pc, stdout, stderr = Popen_safe(cmd, cwd=state.environment.get_source_dir())
-        except (FileNotFoundError, PermissionError):
-            raise MesonException('Could not execute glib-compile-resources.')
-        if pc.returncode != 0:
-            m = 'glib-compile-resources failed to get dependencies for {}:\n{}'
-            mlog.warning(m.format(cmd[1], stderr))
-            raise subprocess.CalledProcessError(pc.returncode, cmd)
-
-        dep_files = stdout.split('\n')[:-1]
-
-        depends = []
-        subdirs = []
-        for resfile in dep_files[:]:
-            resbasename = os.path.basename(resfile)
-            for dep in unholder(dependencies):
-                if isinstance(dep, mesonlib.File):
-                    if dep.fname != resbasename:
-                        continue
-                    dep_files.remove(resfile)
-                    dep_files.append(dep)
-                    subdirs.append(dep.subdir)
-                    break
-                elif isinstance(dep, (build.CustomTarget, build.CustomTargetIndex)):
-                    fname = None
-                    outputs = {(o, os.path.basename(o)) for o in dep.get_outputs()}
-                    for o, baseo in outputs:
-                        if baseo == resbasename:
-                            fname = o
-                            break
-                    if fname is not None:
-                        dep_files.remove(resfile)
-                        depends.append(dep)
-                        subdirs.append(dep.get_subdir())
-                        break
-            else:
-                # In generate-dependencies mode, glib-compile-resources doesn't raise
-                # an error for missing resources but instead prints whatever filename
-                # was listed in the input file.  That's good because it means we can
-                # handle resource files that get generated as part of the build, as
-                # follows.
-                #
-                # If there are multiple generated resource files with the same basename
-                # then this code will get confused.
-                try:
-                    f = mesonlib.File.from_source_file(state.environment.get_source_dir(),
-                                                       ".", resfile)
-                except MesonException:
-                    raise MesonException(
-                        'Resource "%s" listed in "%s" was not found. If this is a '
-                        'generated file, pass the target that generates it to '
-                        'gnome.compile_resources() using the "dependencies" '
-                        'keyword argument.' % (resfile, input_file))
-                dep_files.remove(resfile)
-                dep_files.append(f)
-        return dep_files, depends, subdirs
-
-    def _get_link_args(self, state, lib, depends, include_rpath=False,
-                       use_gir_args=False):
-        link_command = []
-        # Construct link args
-        if isinstance(lib, build.SharedLibrary):
-            libdir = os.path.join(state.environment.get_build_dir(), state.backend.get_target_dir(lib))
-            link_command.append('-L' + libdir)
-            if include_rpath:
-                link_command.append('-Wl,-rpath,' + libdir)
-            depends.append(lib)
-            # Needed for the following binutils bug:
-            # https://github.com/mesonbuild/meson/issues/1911
-            # However, g-ir-scanner does not understand -Wl,-rpath
-            # so we need to use -L instead
-            for d in state.backend.determine_rpath_dirs(lib):
-                d = os.path.join(state.environment.get_build_dir(), d)
-                link_command.append('-L' + d)
-                if include_rpath:
-                    link_command.append('-Wl,-rpath,' + d)
-        if use_gir_args and self._gir_has_option('--extra-library'):
-            link_command.append('--extra-library=' + lib.name)
-        else:
-            link_command.append('-l' + lib.name)
-        return link_command
-
-    def _get_dependencies_flags(self, deps, state, depends, include_rpath=False,
-                                use_gir_args=False, separate_nodedup=False):
-        cflags = OrderedSet()
-        internal_ldflags = OrderedSet()
-        external_ldflags = OrderedSet()
-        # External linker flags that can't be de-duped reliably because they
-        # require two args in order, such as -framework AVFoundation
-        external_ldflags_nodedup = []
-        gi_includes = OrderedSet()
-        deps = mesonlib.unholder(mesonlib.listify(deps))
-
-        for dep in deps:
-            if isinstance(dep, Dependency):
-                girdir = dep.get_variable(pkgconfig='girdir', internal='girdir', default_value='')
-                if girdir:
-                    gi_includes.update([girdir])
-            if isinstance(dep, InternalDependency):
-                cflags.update(dep.get_compile_args())
-                cflags.update(get_include_args(dep.include_directories))
-                for lib in unholder(dep.libraries):
-                    if isinstance(lib, build.SharedLibrary):
-                        internal_ldflags.update(self._get_link_args(state, lib, depends, include_rpath))
-                        libdepflags = self._get_dependencies_flags(lib.get_external_deps(), state, depends, include_rpath,
-                                                                   use_gir_args, True)
-                        cflags.update(libdepflags[0])
-                        internal_ldflags.update(libdepflags[1])
-                        external_ldflags.update(libdepflags[2])
-                        external_ldflags_nodedup += libdepflags[3]
-                        gi_includes.update(libdepflags[4])
-                extdepflags = self._get_dependencies_flags(dep.ext_deps, state, depends, include_rpath,
-                                                           use_gir_args, True)
-                cflags.update(extdepflags[0])
-                internal_ldflags.update(extdepflags[1])
-                external_ldflags.update(extdepflags[2])
-                external_ldflags_nodedup += extdepflags[3]
-                gi_includes.update(extdepflags[4])
-                for source in unholder(dep.sources):
-                    if isinstance(source, GirTarget):
-                        gi_includes.update([os.path.join(state.environment.get_build_dir(),
-                                            source.get_subdir())])
-            # This should be any dependency other than an internal one.
-            elif isinstance(dep, Dependency):
-                cflags.update(dep.get_compile_args())
-                ldflags = iter(dep.get_link_args(raw=True))
-                for lib in ldflags:
-                    if (os.path.isabs(lib) and
-                            # For PkgConfigDependency only:
-                            getattr(dep, 'is_libtool', False)):
-                        lib_dir = os.path.dirname(lib)
-                        external_ldflags.update(["-L%s" % lib_dir])
-                        if include_rpath:
-                            external_ldflags.update(['-Wl,-rpath {}'.format(lib_dir)])
-                        libname = os.path.basename(lib)
-                        if libname.startswith("lib"):
-                            libname = libname[3:]
-                        libname = libname.split(".so")[0]
-                        lib = "-l%s" % libname
-                    # FIXME: Hack to avoid passing some compiler options in
-                    if lib.startswith("-W"):
-                        continue
-                    # If it's a framework arg, slurp the framework name too
-                    # to preserve the order of arguments
-                    if lib == '-framework':
-                        external_ldflags_nodedup += [lib, next(ldflags)]
-                    else:
-                        external_ldflags.update([lib])
-            elif isinstance(dep, (build.StaticLibrary, build.SharedLibrary)):
-                cflags.update(get_include_args(dep.get_include_dirs()))
-                depends.append(dep)
-            else:
-                mlog.log('dependency {!r} not handled to build gir files'.format(dep))
-                continue
-
-        if use_gir_args and self._gir_has_option('--extra-library'):
-            def fix_ldflags(ldflags):
-                fixed_ldflags = OrderedSet()
-                for ldflag in ldflags:
-                    if ldflag.startswith("-l"):
-                        ldflag = ldflag.replace('-l', '--extra-library=', 1)
-                    fixed_ldflags.add(ldflag)
-                return fixed_ldflags
-            internal_ldflags = fix_ldflags(internal_ldflags)
-            external_ldflags = fix_ldflags(external_ldflags)
-        if not separate_nodedup:
-            external_ldflags.update(external_ldflags_nodedup)
-            return cflags, internal_ldflags, external_ldflags, gi_includes
-        else:
-            return cflags, internal_ldflags, external_ldflags, external_ldflags_nodedup, gi_includes
-
-    def _unwrap_gir_target(self, girtarget, state):
-        while hasattr(girtarget, 'held_object'):
-            girtarget = girtarget.held_object
-
-        if not isinstance(girtarget, (build.Executable, build.SharedLibrary,
-                                      build.StaticLibrary)):
-            raise MesonException('Gir target must be an executable or library')
-
-        STATIC_BUILD_REQUIRED_VERSION = ">=1.58.1"
-        if isinstance(girtarget, (build.StaticLibrary)) and \
-           not mesonlib.version_compare(
-               self._get_gir_dep(state)[0].get_version(),
-               STATIC_BUILD_REQUIRED_VERSION):
-            raise MesonException('Static libraries can only be introspected with GObject-Introspection ' + STATIC_BUILD_REQUIRED_VERSION)
-
-        return girtarget
-
-    def _get_gir_dep(self, state):
-        if not self.gir_dep:
-            kwargs = {'native': True, 'required': True}
-            holder = self.interpreter.func_dependency(state.current_node, ['gobject-introspection-1.0'], kwargs)
-            self.gir_dep = holder.held_object
-            giscanner = state.environment.lookup_binary_entry(MachineChoice.HOST, 'g-ir-scanner')
-            if giscanner is not None:
-                self.giscanner = ExternalProgram.from_entry('g-ir-scanner', giscanner)
-            elif self.gir_dep.type_name == 'pkgconfig':
-                self.giscanner = ExternalProgram('g_ir_scanner', self.gir_dep.get_pkgconfig_variable('g_ir_scanner', {}))
-            else:
-                self.giscanner = self.interpreter.find_program_impl('g-ir-scanner')
-            gicompiler = state.environment.lookup_binary_entry(MachineChoice.HOST, 'g-ir-compiler')
-            if gicompiler is not None:
-                self.gicompiler = ExternalProgram.from_entry('g-ir-compiler', gicompiler)
-            elif self.gir_dep.type_name == 'pkgconfig':
-                self.gicompiler = ExternalProgram('g_ir_compiler', self.gir_dep.get_pkgconfig_variable('g_ir_compiler', {}))
-            else:
-                self.gicompiler = self.interpreter.find_program_impl('g-ir-compiler')
-        return self.gir_dep, self.giscanner, self.gicompiler
-
-    @functools.lru_cache(maxsize=None)
-    def _gir_has_option(self, option):
-        exe = self.giscanner
-        if hasattr(exe, 'held_object'):
-            exe = exe.held_object
-        if isinstance(exe, interpreter.OverrideProgram):
-            # Handle overridden g-ir-scanner
-            assert option in ['--extra-library', '--sources-top-dirs']
-            return True
-        p, o, e = Popen_safe(exe.get_command() + ['--help'], stderr=subprocess.STDOUT)
-        return p.returncode == 0 and option in o
-
-    def _scan_header(self, kwargs):
-        ret = []
-        header = kwargs.pop('header', None)
-        if header:
-            if not isinstance(header, str):
-                raise MesonException('header must be a string')
-            ret = ['--c-include=' + header]
-        return ret
-
-    def _scan_extra_args(self, kwargs):
-        return mesonlib.stringlistify(kwargs.pop('extra_args', []))
-
-    def _scan_link_withs(self, state, depends, kwargs):
-        ret = []
-        if 'link_with' in kwargs:
-            link_with = mesonlib.extract_as_list(kwargs, 'link_with', pop = True)
-
-            for link in link_with:
-                ret += self._get_link_args(state, link.held_object, depends,
-                                           use_gir_args=True)
-        return ret
-
-    # May mutate depends and gir_inc_dirs
-    def _scan_include(self, state, depends, gir_inc_dirs, kwargs):
-        ret = []
-
-        if 'includes' in kwargs:
-            includes = mesonlib.extract_as_list(kwargs, 'includes', pop = True)
-            for inc in unholder(includes):
-                if isinstance(inc, str):
-                    ret += ['--include=%s' % (inc, )]
-                elif isinstance(inc, GirTarget):
-                    gir_inc_dirs += [
-                        os.path.join(state.environment.get_build_dir(),
-                                     inc.get_subdir()),
-                    ]
-                    ret += [
-                        "--include-uninstalled=%s" % (os.path.join(inc.get_subdir(), inc.get_basename()), )
-                    ]
-                    depends += [inc]
-                else:
-                    raise MesonException(
-                        'Gir includes must be str, GirTarget, or list of them')
-
-        return ret
-
-    def _scan_symbol_prefix(self, kwargs):
-        ret = []
-
-        if 'symbol_prefix' in kwargs:
-            sym_prefixes = mesonlib.stringlistify(kwargs.pop('symbol_prefix', []))
-            ret += ['--symbol-prefix=%s' % sym_prefix for sym_prefix in sym_prefixes]
-
-        return ret
-
-    def _scan_identifier_prefix(self, kwargs):
-        ret = []
-
-        if 'identifier_prefix' in kwargs:
-            identifier_prefix = kwargs.pop('identifier_prefix')
-            if not isinstance(identifier_prefix, str):
-                raise MesonException('Gir identifier prefix must be str')
-            ret += ['--identifier-prefix=%s' % identifier_prefix]
-
-        return ret
-
-    def _scan_export_packages(self, kwargs):
-        ret = []
-
-        if 'export_packages' in kwargs:
-            pkgs = kwargs.pop('export_packages')
-            if isinstance(pkgs, str):
-                ret += ['--pkg-export=%s' % pkgs]
-            elif isinstance(pkgs, list):
-                ret += ['--pkg-export=%s' % pkg for pkg in pkgs]
-            else:
-                raise MesonException('Gir export packages must be str or list')
-
-        return ret
-
-    def _scan_inc_dirs(self, kwargs):
-        ret = mesonlib.extract_as_list(kwargs, 'include_directories', pop = True)
-        for incd in ret:
-            if not isinstance(incd.held_object, (str, build.IncludeDirs)):
-                raise MesonException(
-                    'Gir include dirs should be include_directories().')
-        return ret
-
-    def _scan_langs(self, state, langs):
-        ret = []
-
-        for lang in langs:
-            link_args = state.environment.coredata.get_external_link_args(MachineChoice.HOST, lang)
-            for link_arg in link_args:
-                if link_arg.startswith('-L'):
-                    ret.append(link_arg)
-
-        return ret
-
-    def _scan_gir_targets(self, state, girtargets):
-        ret = []
-
-        for girtarget in girtargets:
-            if isinstance(girtarget, build.Executable):
-                ret += ['--program', girtarget]
-            else:
-                # Because of https://gitlab.gnome.org/GNOME/gobject-introspection/merge_requests/72
-                # we can't use the full path until this is merged.
-                if isinstance(girtarget, build.SharedLibrary):
-                    libname = girtarget.get_basename()
-                else:
-                    libname = os.path.join("@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id(), girtarget.get_filename())
-                ret += ['--library', libname]
-                # need to put our output directory first as we need to use the
-                # generated libraries instead of any possibly installed system/prefix
-                # ones.
-                ret += ["-L@PRIVATE_OUTDIR_ABS_%s@" % girtarget.get_id()]
-                # Needed for the following binutils bug:
-                # https://github.com/mesonbuild/meson/issues/1911
-                # However, g-ir-scanner does not understand -Wl,-rpath
-                # so we need to use -L instead
-                for d in state.backend.determine_rpath_dirs(girtarget):
-                    d = os.path.join(state.environment.get_build_dir(), d)
-                    ret.append('-L' + d)
-
-        return ret
-
-    def _get_girtargets_langs_compilers(self, girtargets):
-        ret = []
-        for girtarget in girtargets:
-            for lang, compiler in girtarget.compilers.items():
-                # XXX: Can you use g-i with any other language?
-                if lang in ('c', 'cpp', 'objc', 'objcpp', 'd'):
-                    ret.append((lang, compiler))
-                    break
-
-        return ret
-
-    def _get_gir_targets_deps(self, girtargets):
-        ret = []
-        for girtarget in girtargets:
-            ret += girtarget.get_all_link_deps()
-            ret += girtarget.get_external_deps()
-        return ret
-
-    def _get_gir_targets_inc_dirs(self, girtargets):
-        ret = []
-        for girtarget in girtargets:
-            ret += girtarget.get_include_dirs()
-        return ret
-
-    def _get_langs_compilers_flags(self, state, langs_compilers):
-        cflags = []
-        internal_ldflags = []
-        external_ldflags = []
-
-        for lang, compiler in langs_compilers:
-            if state.global_args.get(lang):
-                cflags += state.global_args[lang]
-            if state.project_args.get(lang):
-                cflags += state.project_args[lang]
-            if 'b_sanitize' in compiler.base_options:
-                sanitize = state.environment.coredata.base_options['b_sanitize'].value
-                cflags += compiler.sanitizer_compile_args(sanitize)
-                sanitize = sanitize.split(',')
-                # These must be first in ldflags
-                if 'address' in sanitize:
-                    internal_ldflags += ['-lasan']
-                if 'thread' in sanitize:
-                    internal_ldflags += ['-ltsan']
-                if 'undefined' in sanitize:
-                    internal_ldflags += ['-lubsan']
-                # FIXME: Linking directly to lib*san is not recommended but g-ir-scanner
-                # does not understand -f LDFLAGS. https://bugzilla.gnome.org/show_bug.cgi?id=783892
-                # ldflags += compiler.sanitizer_link_args(sanitize)
-
-        return cflags, internal_ldflags, external_ldflags
-
-    def _make_gir_filelist(self, state, srcdir, ns, nsversion, girtargets, libsources):
-        gir_filelist_dir = state.backend.get_target_private_dir_abs(girtargets[0])
-        if not os.path.isdir(gir_filelist_dir):
-            os.mkdir(gir_filelist_dir)
-        gir_filelist_filename = os.path.join(gir_filelist_dir, '%s_%s_gir_filelist' % (ns, nsversion))
-
-        with open(gir_filelist_filename, 'w', encoding='utf-8') as gir_filelist:
-            for s in unholder(libsources):
-                if isinstance(s, (build.CustomTarget, build.CustomTargetIndex)):
-                    for custom_output in s.get_outputs():
-                        gir_filelist.write(os.path.join(state.environment.get_build_dir(),
-                                                        state.backend.get_target_dir(s),
-                                                        custom_output) + '\n')
-                elif isinstance(s, mesonlib.File):
-                    gir_filelist.write(s.rel_to_builddir(state.build_to_src) + '\n')
-                elif isinstance(s, build.GeneratedList):
-                    for gen_src in s.get_outputs():
-                        gir_filelist.write(os.path.join(srcdir, gen_src) + '\n')
-                else:
-                    gir_filelist.write(os.path.join(srcdir, s) + '\n')
-
-        return gir_filelist_filename
-
-    def _make_gir_target(self, state, girfile, scan_command, depends, kwargs):
-        scankwargs = {'output': girfile,
-                      'command': scan_command,
-                      'depends': depends}
-
-        if 'install' in kwargs:
-            scankwargs['install'] = kwargs['install']
-            scankwargs['install_dir'] = kwargs.get('install_dir_gir',
-                                                   os.path.join(state.environment.get_datadir(), 'gir-1.0'))
-
-        if 'build_by_default' in kwargs:
-            scankwargs['build_by_default'] = kwargs['build_by_default']
-
-        return GirTarget(girfile, state.subdir, state.subproject, scankwargs)
-
-    def _make_typelib_target(self, state, typelib_output, typelib_cmd, kwargs):
-        typelib_kwargs = {
-            'output': typelib_output,
-            'command': typelib_cmd,
-        }
-
-        if 'install' in kwargs:
-            typelib_kwargs['install'] = kwargs['install']
-            typelib_kwargs['install_dir'] = kwargs.get('install_dir_typelib',
-                                                       os.path.join(state.environment.get_libdir(), 'girepository-1.0'))
-
-        if 'build_by_default' in kwargs:
-            typelib_kwargs['build_by_default'] = kwargs['build_by_default']
-
-        return TypelibTarget(typelib_output, state.subdir, state.subproject, typelib_kwargs)
-
-    # May mutate depends
-    def _gather_typelib_includes_and_update_depends(self, state, deps, depends):
-        # Need to recursively add deps on GirTarget sources from our
-        # dependencies and also find the include directories needed for the
-        # typelib generation custom target below.
-        typelib_includes = []
-        for dep in unholder(deps):
-            # Add a dependency on each GirTarget listed in dependencies and add
-            # the directory where it will be generated to the typelib includes
-            if isinstance(dep, InternalDependency):
-                for source in unholder(dep.sources):
-                    if isinstance(source, GirTarget) and source not in depends:
-                        depends.append(source)
-                        subdir = os.path.join(state.environment.get_build_dir(),
-                                              source.get_subdir())
-                        if subdir not in typelib_includes:
-                            typelib_includes.append(subdir)
-            # Do the same, but for dependencies of dependencies. These are
-            # stored in the list of generated sources for each link dep (from
-            # girtarget.get_all_link_deps() above).
-            # FIXME: Store this in the original form from declare_dependency()
-            # so it can be used here directly.
-            elif isinstance(dep, build.SharedLibrary):
-                for source in dep.generated:
-                    if isinstance(source, GirTarget):
-                        subdir = os.path.join(state.environment.get_build_dir(),
-                                              source.get_subdir())
-                        if subdir not in typelib_includes:
-                            typelib_includes.append(subdir)
-            if isinstance(dep, Dependency):
-                girdir = dep.get_variable(pkgconfig='girdir', internal='girdir', default_value='')
-                if girdir and girdir not in typelib_includes:
-                    typelib_includes.append(girdir)
-        return typelib_includes
-
-    def _get_external_args_for_langs(self, state, langs):
-        ret = []
-        for lang in langs:
-            ret += state.environment.coredata.get_external_args(MachineChoice.HOST, lang)
-        return ret
-
-    @staticmethod
-    def _get_scanner_cflags(cflags):
-        'g-ir-scanner only accepts -I/-D/-U; must ignore all other flags'
-        for f in cflags:
-            if f.startswith(('-D', '-U', '-I')):
-                yield f
-
-    @staticmethod
-    def _get_scanner_ldflags(ldflags):
-        'g-ir-scanner only accepts -L/-l; must ignore -F and other linker flags'
-        for f in ldflags:
-            if f.startswith(('-L', '-l', '--extra-library')):
-                yield f
-
-    @FeatureNewKwargs('generate_gir', '0.55.0', ['fatal_warnings'])
-    @FeatureNewKwargs('generate_gir', '0.40.0', ['build_by_default'])
-    @permittedKwargs({'sources', 'nsversion', 'namespace', 'symbol_prefix', 'identifier_prefix',
-                      'export_packages', 'includes', 'dependencies', 'link_with', 'include_directories',
-                      'install', 'install_dir_gir', 'install_dir_typelib', 'extra_args',
-                      'packages', 'header', 'build_by_default', 'fatal_warnings'})
-    def generate_gir(self, state, args, kwargs):
-        if not args:
-            raise MesonException('generate_gir takes at least one argument')
-        if kwargs.get('install_dir'):
-            raise MesonException('install_dir is not supported with generate_gir(), see "install_dir_gir" and "install_dir_typelib"')
-
-        girtargets = [self._unwrap_gir_target(arg, state) for arg in args]
-
-        if len(girtargets) > 1 and any([isinstance(el, build.Executable) for el in girtargets]):
-            raise MesonException('generate_gir only accepts a single argument when one of the arguments is an executable')
-
-        gir_dep, giscanner, gicompiler = self._get_gir_dep(state)
-
-        ns = kwargs.get('namespace')
-        if not ns:
-            raise MesonException('Missing "namespace" keyword argument')
-        nsversion = kwargs.get('nsversion')
-        if not nsversion:
-            raise MesonException('Missing "nsversion" keyword argument')
-        libsources = mesonlib.extract_as_list(kwargs, 'sources', pop=True)
-        girfile = '%s-%s.gir' % (ns, nsversion)
-        srcdir = os.path.join(state.environment.get_source_dir(), state.subdir)
-        builddir = os.path.join(state.environment.get_build_dir(), state.subdir)
-        depends = gir_dep.sources + girtargets
-        gir_inc_dirs = []
-        langs_compilers = self._get_girtargets_langs_compilers(girtargets)
-        cflags, internal_ldflags, external_ldflags = self._get_langs_compilers_flags(state, langs_compilers)
-        deps = self._get_gir_targets_deps(girtargets)
-        deps += mesonlib.unholder(extract_as_list(kwargs, 'dependencies', pop=True))
-        deps += [gir_dep]
-        typelib_includes = self._gather_typelib_includes_and_update_depends(state, deps, depends)
-        # ldflags will be misinterpreted by gir scanner (showing
-        # spurious dependencies) but building GStreamer fails if they
-        # are not used here.
-        dep_cflags, dep_internal_ldflags, dep_external_ldflags, gi_includes = \
-            self._get_dependencies_flags(deps, state, depends, use_gir_args=True)
-        cflags += list(self._get_scanner_cflags(dep_cflags))
-        cflags += list(self._get_scanner_cflags(self._get_external_args_for_langs(state, [lc[0] for lc in langs_compilers])))
-        internal_ldflags += list(self._get_scanner_ldflags(dep_internal_ldflags))
-        external_ldflags += list(self._get_scanner_ldflags(dep_external_ldflags))
-        girtargets_inc_dirs = self._get_gir_targets_inc_dirs(girtargets)
-        inc_dirs = self._scan_inc_dirs(kwargs)
-
-        scan_command = [giscanner]
-        scan_command += ['--no-libtool']
-        scan_command += ['--namespace=' + ns, '--nsversion=' + nsversion]
-        scan_command += ['--warn-all']
-        scan_command += ['--output', '@OUTPUT@']
-        scan_command += self._scan_header(kwargs)
-        scan_command += self._scan_extra_args(kwargs)
-        scan_command += ['-I' + srcdir, '-I' + builddir]
-        scan_command += get_include_args(girtargets_inc_dirs)
-        scan_command += ['--filelist=' + self._make_gir_filelist(state, srcdir, ns, nsversion, girtargets, libsources)]
-        scan_command += self._scan_link_withs(state, depends, kwargs)
-        scan_command += self._scan_include(state, depends, gir_inc_dirs, kwargs)
-        scan_command += self._scan_symbol_prefix(kwargs)
-        scan_command += self._scan_identifier_prefix(kwargs)
-        scan_command += self._scan_export_packages(kwargs)
-        scan_command += ['--cflags-begin']
-        scan_command += cflags
-        scan_command += ['--cflags-end']
-        scan_command += get_include_args(inc_dirs)
-        scan_command += get_include_args(list(gi_includes) + gir_inc_dirs + inc_dirs, prefix='--add-include-path=')
-        scan_command += list(internal_ldflags)
-        scan_command += self._scan_gir_targets(state, girtargets)
-        scan_command += self._scan_langs(state, [lc[0] for lc in langs_compilers])
-        scan_command += list(external_ldflags)
-
-        if self._gir_has_option('--sources-top-dirs'):
-            scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_source_dir(), self.interpreter.subproject_dir, state.subproject)]
-            scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_build_dir(), self.interpreter.subproject_dir, state.subproject)]
-
-        if '--warn-error' in scan_command:
-            mlog.deprecation('Passing --warn-error is deprecated in favor of "fatal_warnings" keyword argument since v0.55')
-        fatal_warnings = kwargs.get('fatal_warnings', False)
-        if not isinstance(fatal_warnings, bool):
-            raise MesonException('fatal_warnings keyword argument must be a boolean')
-        if fatal_warnings:
-            scan_command.append('--warn-error')
-
-        scan_target = self._make_gir_target(state, girfile, scan_command, depends, kwargs)
-
-        typelib_output = '%s-%s.typelib' % (ns, nsversion)
-        typelib_cmd = [gicompiler, scan_target, '--output', '@OUTPUT@']
-        typelib_cmd += get_include_args(gir_inc_dirs, prefix='--includedir=')
-
-        for incdir in typelib_includes:
-            typelib_cmd += ["--includedir=" + incdir]
-
-        typelib_target = self._make_typelib_target(state, typelib_output, typelib_cmd, kwargs)
-
-        rv = [scan_target, typelib_target]
-
-        return ModuleReturnValue(rv, rv)
-
-    @FeatureNewKwargs('build target', '0.40.0', ['build_by_default'])
-    @permittedKwargs({'build_by_default', 'depend_files'})
-    def compile_schemas(self, state, args, kwargs):
-        if args:
-            raise MesonException('Compile_schemas does not take positional arguments.')
-        srcdir = os.path.join(state.build_to_src, state.subdir)
-        outdir = state.subdir
-
-        cmd = [self.interpreter.find_program_impl('glib-compile-schemas')]
-        cmd += ['--targetdir', outdir, srcdir]
-        kwargs['command'] = cmd
-        kwargs['input'] = []
-        kwargs['output'] = 'gschemas.compiled'
-        if state.subdir == '':
-            targetname = 'gsettings-compile'
-        else:
-            targetname = 'gsettings-compile-' + state.subdir.replace('/', '_')
-        target_g = build.CustomTarget(targetname, state.subdir, state.subproject, kwargs)
-        return ModuleReturnValue(target_g, [target_g])
-
-    @permittedKwargs({'sources', 'media', 'symlink_media', 'languages'})
-    @FeatureDeprecatedKwargs('gnome.yelp', '0.43.0', ['languages'],
-                             'Use a LINGUAS file in the source directory instead')
-    def yelp(self, state, args, kwargs):
-        if len(args) < 1:
-            raise MesonException('Yelp requires a project id')
-
-        project_id = args[0]
-        sources = mesonlib.stringlistify(kwargs.pop('sources', []))
-        if not sources:
-            if len(args) > 1:
-                sources = mesonlib.stringlistify(args[1:])
-            if not sources:
-                raise MesonException('Yelp requires a list of sources')
-        source_str = '@@'.join(sources)
-
-        langs = mesonlib.stringlistify(kwargs.pop('languages', []))
-        media = mesonlib.stringlistify(kwargs.pop('media', []))
-        symlinks = kwargs.pop('symlink_media', True)
-
-        if not isinstance(symlinks, bool):
-            raise MesonException('symlink_media must be a boolean')
-
-        if kwargs:
-            raise MesonException('Unknown arguments passed: {}'.format(', '.join(kwargs.keys())))
-
-        script = state.environment.get_build_command()
-        args = ['--internal',
-                'yelphelper',
-                'install',
-                '--subdir=' + state.subdir,
-                '--id=' + project_id,
-                '--installdir=' + os.path.join(state.environment.get_datadir(), 'help'),
-                '--sources=' + source_str]
-        if symlinks:
-            args.append('--symlinks=true')
-        if media:
-            args.append('--media=' + '@@'.join(media))
-        if langs:
-            args.append('--langs=' + '@@'.join(langs))
-        inscript = build.RunScript(script, args)
-
-        potargs = state.environment.get_build_command() + [
-            '--internal', 'yelphelper', 'pot',
-            '--subdir=' + state.subdir,
-            '--id=' + project_id,
-            '--sources=' + source_str,
-        ]
-        pottarget = build.RunTarget('help-' + project_id + '-pot', potargs[0],
-                                    potargs[1:], [], state.subdir, state.subproject)
-
-        poargs = state.environment.get_build_command() + [
-            '--internal', 'yelphelper', 'update-po',
-            '--subdir=' + state.subdir,
-            '--id=' + project_id,
-            '--sources=' + source_str,
-            '--langs=' + '@@'.join(langs),
-        ]
-        potarget = build.RunTarget('help-' + project_id + '-update-po', poargs[0],
-                                   poargs[1:], [], state.subdir, state.subproject)
-
-        rv = [inscript, pottarget, potarget]
-        return ModuleReturnValue(None, rv)
-
-    @FeatureNewKwargs('gnome.gtkdoc', '0.52.0', ['check'])
-    @FeatureNewKwargs('gnome.gtkdoc', '0.48.0', ['c_args'])
-    @FeatureNewKwargs('gnome.gtkdoc', '0.48.0', ['module_version'])
-    @FeatureNewKwargs('gnome.gtkdoc', '0.37.0', ['namespace', 'mode'])
-    @permittedKwargs({'main_xml', 'main_sgml', 'src_dir', 'dependencies', 'install',
-                      'install_dir', 'scan_args', 'scanobjs_args', 'gobject_typesfile',
-                      'fixxref_args', 'html_args', 'html_assets', 'content_files',
-                      'mkdb_args', 'ignore_headers', 'include_directories',
-                      'namespace', 'mode', 'expand_content_files', 'module_version',
-                      'c_args', 'check'})
-    def gtkdoc(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException('Gtkdoc must have one positional argument.')
-        modulename = args[0]
-        if not isinstance(modulename, str):
-            raise MesonException('Gtkdoc arg must be string.')
-        if 'src_dir' not in kwargs:
-            raise MesonException('Keyword argument src_dir missing.')
-        main_file = kwargs.get('main_sgml', '')
-        if not isinstance(main_file, str):
-            raise MesonException('Main sgml keyword argument must be a string.')
-        main_xml = kwargs.get('main_xml', '')
-        if not isinstance(main_xml, str):
-            raise MesonException('Main xml keyword argument must be a string.')
-        moduleversion = kwargs.get('module_version', '')
-        if not isinstance(moduleversion, str):
-            raise MesonException('Module version keyword argument must be a string.')
-        if main_xml != '':
-            if main_file != '':
-                raise MesonException('You can only specify main_xml or main_sgml, not both.')
-            main_file = main_xml
-        targetname = modulename + ('-' + moduleversion if moduleversion else '') + '-doc'
-        command = state.environment.get_build_command()
-
-        namespace = kwargs.get('namespace', '')
-        mode = kwargs.get('mode', 'auto')
-        VALID_MODES = ('xml', 'sgml', 'none', 'auto')
-        if mode not in VALID_MODES:
-            raise MesonException('gtkdoc: Mode {} is not a valid mode: {}'.format(mode, VALID_MODES))
-
-        src_dirs = mesonlib.extract_as_list(kwargs, 'src_dir')
-        header_dirs = []
-        for src_dir in src_dirs:
-            if hasattr(src_dir, 'held_object'):
-                src_dir = src_dir.held_object
-                if not isinstance(src_dir, build.IncludeDirs):
-                    raise MesonException('Invalid keyword argument for src_dir.')
-                for inc_dir in src_dir.get_incdirs():
-                    header_dirs.append(os.path.join(state.environment.get_source_dir(),
-                                                    src_dir.get_curdir(), inc_dir))
-                    header_dirs.append(os.path.join(state.environment.get_build_dir(),
-                                                    src_dir.get_curdir(), inc_dir))
-            else:
-                header_dirs.append(src_dir)
-
-        args = ['--internal', 'gtkdoc',
-                '--sourcedir=' + state.environment.get_source_dir(),
-                '--builddir=' + state.environment.get_build_dir(),
-                '--subdir=' + state.subdir,
-                '--headerdirs=' + '@@'.join(header_dirs),
-                '--mainfile=' + main_file,
-                '--modulename=' + modulename,
-                '--moduleversion=' + moduleversion,
-                '--mode=' + mode]
-        for tool in ['scan', 'scangobj', 'mkdb', 'mkhtml', 'fixxref']:
-            program_name = 'gtkdoc-' + tool
-            program = self.interpreter.find_program_impl(program_name)
-            path = program.held_object.get_path()
-            args.append('--{}={}'.format(program_name, path))
-        if namespace:
-            args.append('--namespace=' + namespace)
-        args += self._unpack_args('--htmlargs=', 'html_args', kwargs)
-        args += self._unpack_args('--scanargs=', 'scan_args', kwargs)
-        args += self._unpack_args('--scanobjsargs=', 'scanobjs_args', kwargs)
-        args += self._unpack_args('--gobjects-types-file=', 'gobject_typesfile', kwargs, state)
-        args += self._unpack_args('--fixxrefargs=', 'fixxref_args', kwargs)
-        args += self._unpack_args('--mkdbargs=', 'mkdb_args', kwargs)
-        args += self._unpack_args('--html-assets=', 'html_assets', kwargs, state)
-
-        depends = []
-        content_files = []
-        for s in unholder(mesonlib.extract_as_list(kwargs, 'content_files')):
-            if isinstance(s, (build.CustomTarget, build.CustomTargetIndex)):
-                depends.append(s)
-                for o in s.get_outputs():
-                    content_files.append(os.path.join(state.environment.get_build_dir(),
-                                                      state.backend.get_target_dir(s),
-                                                      o))
-            elif isinstance(s, mesonlib.File):
-                content_files.append(s.absolute_path(state.environment.get_source_dir(),
-                                                     state.environment.get_build_dir()))
-            elif isinstance(s, build.GeneratedList):
-                depends.append(s)
-                for gen_src in s.get_outputs():
-                    content_files.append(os.path.join(state.environment.get_source_dir(),
-                                                      state.subdir,
-                                                      gen_src))
-            elif isinstance(s, str):
-                content_files.append(os.path.join(state.environment.get_source_dir(),
-                                                  state.subdir,
-                                                  s))
-            else:
-                raise MesonException(
-                    'Invalid object type: {!r}'.format(s.__class__.__name__))
-        args += ['--content-files=' + '@@'.join(content_files)]
-
-        args += self._unpack_args('--expand-content-files=', 'expand_content_files', kwargs, state)
-        args += self._unpack_args('--ignore-headers=', 'ignore_headers', kwargs)
-        args += self._unpack_args('--installdir=', 'install_dir', kwargs)
-        args += self._get_build_args(kwargs, state, depends)
-        custom_kwargs = {'output': modulename + '-decl.txt',
-                         'command': command + args,
-                         'depends': depends,
-                         'build_always_stale': True,
-                         }
-        custom_target = build.CustomTarget(targetname, state.subdir, state.subproject, custom_kwargs)
-        alias_target = build.AliasTarget(targetname, [custom_target], state.subdir, state.subproject)
-        if kwargs.get('check', False):
-            check_cmd = self.interpreter.find_program_impl('gtkdoc-check')
-            check_env = ['DOC_MODULE=' + modulename,
-                         'DOC_MAIN_SGML_FILE=' + main_file]
-            check_args = [targetname + '-check', check_cmd]
-            check_kwargs = {'env': check_env,
-                            'workdir': os.path.join(state.environment.get_build_dir(), state.subdir),
-                            'depends': custom_target}
-            self.interpreter.add_test(state.current_node, check_args, check_kwargs, True)
-        res = [custom_target, alias_target]
-        if kwargs.get('install', True):
-            res.append(build.RunScript(command, args))
-        return ModuleReturnValue(custom_target, res)
-
-    def _get_build_args(self, kwargs, state, depends):
-        args = []
-        deps = mesonlib.unholder(extract_as_list(kwargs, 'dependencies'))
-        cflags = []
-        cflags.extend(mesonlib.stringlistify(kwargs.pop('c_args', [])))
-        deps_cflags, internal_ldflags, external_ldflags, gi_includes = \
-            self._get_dependencies_flags(deps, state, depends, include_rpath=True)
-        inc_dirs = mesonlib.extract_as_list(kwargs, 'include_directories')
-        for incd in inc_dirs:
-            if not isinstance(incd.held_object, (str, build.IncludeDirs)):
-                raise MesonException(
-                    'Gir include dirs should be include_directories().')
-
-        cflags.extend(deps_cflags)
-        cflags.extend(get_include_args(inc_dirs))
-        ldflags = []
-        ldflags.extend(internal_ldflags)
-        ldflags.extend(external_ldflags)
-
-        cflags.extend(state.environment.coredata.get_external_args(MachineChoice.HOST, 'c'))
-        ldflags.extend(state.environment.coredata.get_external_link_args(MachineChoice.HOST, 'c'))
-        compiler = state.environment.coredata.compilers[MachineChoice.HOST]['c']
-
-        compiler_flags = self._get_langs_compilers_flags(state, [('c', compiler)])
-        cflags.extend(compiler_flags[0])
-        ldflags.extend(compiler_flags[1])
-        ldflags.extend(compiler_flags[2])
-        if compiler:
-            args += ['--cc=%s' % join_args(compiler.get_exelist())]
-            args += ['--ld=%s' % join_args(compiler.get_linker_exelist())]
-        if cflags:
-            args += ['--cflags=%s' % join_args(cflags)]
-        if ldflags:
-            args += ['--ldflags=%s' % join_args(ldflags)]
-
-        return args
-
-    @noKwargs
-    def gtkdoc_html_dir(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException('Must have exactly one argument.')
-        modulename = args[0]
-        if not isinstance(modulename, str):
-            raise MesonException('Argument must be a string')
-        return ModuleReturnValue(os.path.join('share/gtk-doc/html', modulename), [])
-
-    @staticmethod
-    def _unpack_args(arg, kwarg_name, kwargs, expend_file_state=None):
-        if kwarg_name not in kwargs:
-            return []
-
-        new_args = mesonlib.extract_as_list(kwargs, kwarg_name)
-        args = []
-        for i in new_args:
-            if expend_file_state and isinstance(i, mesonlib.File):
-                i = i.absolute_path(expend_file_state.environment.get_source_dir(), expend_file_state.environment.get_build_dir())
-            elif expend_file_state and isinstance(i, str):
-                i = os.path.join(expend_file_state.environment.get_source_dir(), expend_file_state.subdir, i)
-            elif not isinstance(i, str):
-                raise MesonException(kwarg_name + ' values must be strings.')
-            args.append(i)
-
-        if args:
-            return [arg + '@@'.join(args)]
-
-        return []
-
-    def _get_autocleanup_args(self, kwargs, glib_version):
-        if not mesonlib.version_compare(glib_version, '>= 2.49.1'):
-            # Warn if requested, silently disable if not
-            if 'autocleanup' in kwargs:
-                mlog.warning('Glib version ({}) is too old to support the \'autocleanup\' '
-                             'kwarg, need 2.49.1 or newer'.format(glib_version))
-            return []
-        autocleanup = kwargs.pop('autocleanup', 'all')
-        values = ('none', 'objects', 'all')
-        if autocleanup not in values:
-            raise MesonException('gdbus_codegen does not support {!r} as an autocleanup value, '
-                                 'must be one of: {!r}'.format(autocleanup, ', '.join(values)))
-        return ['--c-generate-autocleanup', autocleanup]
-
-    @FeatureNewKwargs('build target', '0.46.0', ['install_header', 'install_dir', 'sources'])
-    @FeatureNewKwargs('build target', '0.40.0', ['build_by_default'])
-    @FeatureNewKwargs('build target', '0.47.0', ['extra_args', 'autocleanup'])
-    @permittedKwargs({'interface_prefix', 'namespace', 'extra_args', 'autocleanup', 'object_manager', 'build_by_default',
-                      'annotations', 'docbook', 'install_header', 'install_dir', 'sources'})
-    def gdbus_codegen(self, state, args, kwargs):
-        if len(args) not in (1, 2):
-            raise MesonException('gdbus_codegen takes at most two arguments, name and xml file.')
-        namebase = args[0]
-        xml_files = args[1:]
-        cmd = [self.interpreter.find_program_impl('gdbus-codegen')]
-        extra_args = mesonlib.stringlistify(kwargs.pop('extra_args', []))
-        cmd += extra_args
-        # Autocleanup supported?
-        glib_version = self._get_native_glib_version(state)
-        cmd += self._get_autocleanup_args(kwargs, glib_version)
-        if 'interface_prefix' in kwargs:
-            cmd += ['--interface-prefix', kwargs.pop('interface_prefix')]
-        if 'namespace' in kwargs:
-            cmd += ['--c-namespace', kwargs.pop('namespace')]
-        if kwargs.get('object_manager', False):
-            cmd += ['--c-generate-object-manager']
-        if 'sources' in kwargs:
-            xml_files += mesonlib.listify(kwargs.pop('sources'))
-        build_by_default = kwargs.get('build_by_default', False)
-
-        # Annotations are a bit ugly in that they are a list of lists of strings...
-        annotations = kwargs.pop('annotations', [])
-        if not isinstance(annotations, list):
-            raise MesonException('annotations takes a list')
-        if annotations and isinstance(annotations, list) and not isinstance(annotations[0], list):
-            annotations = [annotations]
-
-        for annotation in annotations:
-            if len(annotation) != 3 or not all(isinstance(i, str) for i in annotation):
-                raise MesonException('Annotations must be made up of 3 strings for ELEMENT, KEY, and VALUE')
-            cmd += ['--annotate'] + annotation
-
-        targets = []
-        install_header = kwargs.get('install_header', False)
-        install_dir = kwargs.get('install_dir', state.environment.coredata.get_builtin_option('includedir'))
-
-        output = namebase + '.c'
-        # Added in https://gitlab.gnome.org/GNOME/glib/commit/e4d68c7b3e8b01ab1a4231bf6da21d045cb5a816 (2.55.2)
-        # Fixed in https://gitlab.gnome.org/GNOME/glib/commit/cd1f82d8fc741a2203582c12cc21b4dacf7e1872 (2.56.2)
-        if mesonlib.version_compare(glib_version, '>= 2.56.2'):
-            custom_kwargs = {'input': xml_files,
-                             'output': output,
-                             'command': cmd + ['--body', '--output', '@OUTPUT@', '@INPUT@'],
-                             'build_by_default': build_by_default
-                             }
-        else:
-            if 'docbook' in kwargs:
-                docbook = kwargs['docbook']
-                if not isinstance(docbook, str):
-                    raise MesonException('docbook value must be a string.')
-
-                cmd += ['--generate-docbook', docbook]
-
-            # https://git.gnome.org/browse/glib/commit/?id=ee09bb704fe9ccb24d92dd86696a0e6bb8f0dc1a
-            if mesonlib.version_compare(glib_version, '>= 2.51.3'):
-                cmd += ['--output-directory', '@OUTDIR@', '--generate-c-code', namebase, '@INPUT@']
-            else:
-                self._print_gdbus_warning()
-                cmd += ['--generate-c-code', '@OUTDIR@/' + namebase, '@INPUT@']
-
-            custom_kwargs = {'input': xml_files,
-                             'output': output,
-                             'command': cmd,
-                             'build_by_default': build_by_default
-                             }
-
-        cfile_custom_target = build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)
-        targets.append(cfile_custom_target)
-
-        output = namebase + '.h'
-        if mesonlib.version_compare(glib_version, '>= 2.56.2'):
-            custom_kwargs = {'input': xml_files,
-                             'output': output,
-                             'command': cmd + ['--header', '--output', '@OUTPUT@', '@INPUT@'],
-                             'build_by_default': build_by_default,
-                             'install': install_header,
-                             'install_dir': install_dir
-                             }
-        else:
-            custom_kwargs = {'input': xml_files,
-                             'output': output,
-                             'command': cmd,
-                             'build_by_default': build_by_default,
-                             'install': install_header,
-                             'install_dir': install_dir,
-                             'depends': cfile_custom_target
-                             }
-
-        hfile_custom_target = build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)
-        targets.append(hfile_custom_target)
-
-        if 'docbook' in kwargs:
-            docbook = kwargs['docbook']
-            if not isinstance(docbook, str):
-                raise MesonException('docbook value must be a string.')
-
-            docbook_cmd = cmd + ['--output-directory', '@OUTDIR@', '--generate-docbook', docbook, '@INPUT@']
-
-            # The docbook output is always ${docbook}-${name_of_xml_file}
-            output = namebase + '-docbook'
-            outputs = []
-            for f in xml_files:
-                outputs.append('{}-{}'.format(docbook, os.path.basename(str(f))))
-
-            if mesonlib.version_compare(glib_version, '>= 2.56.2'):
-                custom_kwargs = {'input': xml_files,
-                                 'output': outputs,
-                                 'command': docbook_cmd,
-                                 'build_by_default': build_by_default
-                                 }
-            else:
-                custom_kwargs = {'input': xml_files,
-                                 'output': outputs,
-                                 'command': cmd,
-                                 'build_by_default': build_by_default,
-                                 'depends': cfile_custom_target
-                                 }
-
-            docbook_custom_target = build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs)
-            targets.append(docbook_custom_target)
-
-        return ModuleReturnValue(targets, targets)
-
-    @permittedKwargs({'sources', 'c_template', 'h_template', 'install_header', 'install_dir',
-                      'comments', 'identifier_prefix', 'symbol_prefix', 'eprod', 'vprod',
-                      'fhead', 'fprod', 'ftail', 'vhead', 'vtail', 'depends'})
-    def mkenums(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException('Mkenums requires one positional argument.')
-        basename = args[0]
-
-        if 'sources' not in kwargs:
-            raise MesonException('Missing keyword argument "sources".')
-        sources = kwargs.pop('sources')
-        if isinstance(sources, str):
-            sources = [sources]
-        elif not isinstance(sources, list):
-            raise MesonException(
-                'Sources keyword argument must be a string or array.')
-
-        cmd = []
-        known_kwargs = ['comments', 'eprod', 'fhead', 'fprod', 'ftail',
-                        'identifier_prefix', 'symbol_prefix', 'template',
-                        'vhead', 'vprod', 'vtail']
-        known_custom_target_kwargs = ['install_dir', 'build_always',
-                                      'depends', 'depend_files']
-        c_template = h_template = None
-        install_header = False
-        for arg, value in kwargs.items():
-            if arg == 'sources':
-                raise AssertionError("sources should've already been handled")
-            elif arg == 'c_template':
-                c_template = value
-                if isinstance(c_template, mesonlib.File):
-                    c_template = c_template.absolute_path(state.environment.source_dir, state.environment.build_dir)
-                if 'template' in kwargs:
-                    raise MesonException('Mkenums does not accept both '
-                                         'c_template and template keyword '
-                                         'arguments at the same time.')
-            elif arg == 'h_template':
-                h_template = value
-                if isinstance(h_template, mesonlib.File):
-                    h_template = h_template.absolute_path(state.environment.source_dir, state.environment.build_dir)
-                if 'template' in kwargs:
-                    raise MesonException('Mkenums does not accept both '
-                                         'h_template and template keyword '
-                                         'arguments at the same time.')
-            elif arg == 'install_header':
-                install_header = value
-            elif arg in known_kwargs:
-                cmd += ['--' + arg.replace('_', '-'), value]
-            elif arg not in known_custom_target_kwargs:
-                raise MesonException(
-                    'Mkenums does not take a %s keyword argument.' % (arg, ))
-        cmd = [self.interpreter.find_program_impl(['glib-mkenums', 'mkenums'])] + cmd
-        custom_kwargs = {}
-        for arg in known_custom_target_kwargs:
-            if arg in kwargs:
-                custom_kwargs[arg] = kwargs[arg]
-
-        targets = []
-
-        if h_template is not None:
-            h_output = os.path.basename(os.path.splitext(h_template)[0])
-            # We always set template as the first element in the source array
-            # so --template consumes it.
-            h_cmd = cmd + ['--template', '@INPUT@']
-            h_sources = [h_template] + sources
-            custom_kwargs['install'] = install_header
-            if 'install_dir' not in custom_kwargs:
-                custom_kwargs['install_dir'] = \
-                    state.environment.coredata.get_builtin_option('includedir')
-            h_target = self._make_mkenum_custom_target(state, h_sources,
-                                                       h_output, h_cmd,
-                                                       custom_kwargs)
-            targets.append(h_target)
-
-        if c_template is not None:
-            c_output = os.path.basename(os.path.splitext(c_template)[0])
-            # We always set template as the first element in the source array
-            # so --template consumes it.
-            c_cmd = cmd + ['--template', '@INPUT@']
-            c_sources = [c_template] + sources
-            # Never install the C file. Complain on bug tracker if you need it.
-            custom_kwargs['install'] = False
-            if h_template is not None:
-                if 'depends' in custom_kwargs:
-                    custom_kwargs['depends'] += [h_target]
-                else:
-                    custom_kwargs['depends'] = h_target
-            c_target = self._make_mkenum_custom_target(state, c_sources,
-                                                       c_output, c_cmd,
-                                                       custom_kwargs)
-            targets.insert(0, c_target)
-
-        if c_template is None and h_template is None:
-            generic_cmd = cmd + ['@INPUT@']
-            custom_kwargs['install'] = install_header
-            if 'install_dir' not in custom_kwargs:
-                custom_kwargs['install_dir'] = \
-                    state.environment.coredata.get_builtin_option('includedir')
-            target = self._make_mkenum_custom_target(state, sources, basename,
-                                                     generic_cmd, custom_kwargs)
-            return ModuleReturnValue(target, [target])
-        elif len(targets) == 1:
-            return ModuleReturnValue(targets[0], [targets[0]])
-        else:
-            return ModuleReturnValue(targets, targets)
-
-    @FeatureNew('gnome.mkenums_simple', '0.42.0')
-    def mkenums_simple(self, state, args, kwargs):
-        hdr_filename = args[0] + '.h'
-        body_filename = args[0] + '.c'
-
-        # not really needed, just for sanity checking
-        forbidden_kwargs = ['c_template', 'h_template', 'eprod', 'fhead',
-                            'fprod', 'ftail', 'vhead', 'vtail', 'comments']
-        for arg in forbidden_kwargs:
-            if arg in kwargs:
-                raise MesonException('mkenums_simple() does not take a %s keyword argument' % (arg, ))
-
-        # kwargs to pass as-is from mkenums_simple() to mkenums()
-        shared_kwargs = ['sources', 'install_header', 'install_dir',
-                         'identifier_prefix', 'symbol_prefix']
-        mkenums_kwargs = {}
-        for arg in shared_kwargs:
-            if arg in kwargs:
-                mkenums_kwargs[arg] = kwargs[arg]
-
-        # .c file generation
-        c_file_kwargs = copy.deepcopy(mkenums_kwargs)
-        if 'sources' not in kwargs:
-            raise MesonException('Missing keyword argument "sources".')
-        sources = kwargs['sources']
-        if isinstance(sources, str):
-            sources = [sources]
-        elif not isinstance(sources, list):
-            raise MesonException(
-                'Sources keyword argument must be a string or array.')
-
-        # The `install_header` argument will be used by mkenums() when
-        # not using template files, so we need to forcibly unset it
-        # when generating the C source file, otherwise we will end up
-        # installing it
-        c_file_kwargs['install_header'] = False
-
-        header_prefix = kwargs.get('header_prefix', '')
-        decl_decorator = kwargs.get('decorator', '')
-        func_prefix = kwargs.get('function_prefix', '')
-        body_prefix = kwargs.get('body_prefix', '')
-
-        # Maybe we should write our own template files into the build dir
-        # instead, but that seems like much more work, nice as it would be.
-        fhead = ''
-        if body_prefix != '':
-            fhead += '%s\n' % body_prefix
-        fhead += '#include "%s"\n' % hdr_filename
-        for hdr in sources:
-            fhead += '#include "%s"\n' % os.path.basename(str(hdr))
-        fhead += '''
-#define C_ENUM(v) ((gint) v)
-#define C_FLAGS(v) ((guint) v)
-'''
-        c_file_kwargs['fhead'] = fhead
-
-        c_file_kwargs['fprod'] = '''
-/* enumerations from "@basename@" */
-'''
-
-        c_file_kwargs['vhead'] = '''
-GType
-%s@enum_name@_get_type (void)
-{
-  static volatile gsize gtype_id = 0;
-  static const G@Type@Value values[] = {''' % func_prefix
-
-        c_file_kwargs['vprod'] = '    { C_@TYPE@(@VALUENAME@), "@VALUENAME@", "@valuenick@" },'
-
-        c_file_kwargs['vtail'] = '''    { 0, NULL, NULL }
-  };
-  if (g_once_init_enter (&gtype_id)) {
-    GType new_type = g_@type@_register_static (g_intern_static_string ("@EnumName@"), values);
-    g_once_init_leave (&gtype_id, new_type);
-  }
-  return (GType) gtype_id;
-}'''
-
-        rv = self.mkenums(state, [body_filename], c_file_kwargs)
-        c_file = rv.return_value
-
-        # .h file generation
-        h_file_kwargs = copy.deepcopy(mkenums_kwargs)
-
-        h_file_kwargs['fhead'] = '''#pragma once
-
-#include <glib-object.h>
-{}
-
-G_BEGIN_DECLS
-'''.format(header_prefix)
-
-        h_file_kwargs['fprod'] = '''
-/* enumerations from "@basename@" */
-'''
-
-        h_file_kwargs['vhead'] = '''
-{}
-GType {}@enum_name@_get_type (void);
-#define @ENUMPREFIX@_TYPE_@ENUMSHORT@ ({}@enum_name@_get_type())'''.format(decl_decorator, func_prefix, func_prefix)
-
-        h_file_kwargs['ftail'] = '''
-G_END_DECLS'''
-
-        rv = self.mkenums(state, [hdr_filename], h_file_kwargs)
-        h_file = rv.return_value
-
-        return ModuleReturnValue([c_file, h_file], [c_file, h_file])
-
-    @staticmethod
-    def _make_mkenum_custom_target(state, sources, output, cmd, kwargs):
-        custom_kwargs = {
-            'input': sources,
-            'output': output,
-            'capture': True,
-            'command': cmd
-        }
-        custom_kwargs.update(kwargs)
-        return build.CustomTarget(output, state.subdir, state.subproject, custom_kwargs,
-                                  # https://github.com/mesonbuild/meson/issues/973
-                                  absolute_paths=True)
-
-    @permittedKwargs({'sources', 'prefix', 'install_header', 'install_dir', 'stdinc',
-                      'nostdinc', 'internal', 'skip_source', 'valist_marshallers',
-                      'extra_args'})
-    def genmarshal(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException(
-                'Genmarshal requires one positional argument.')
-        output = args[0]
-
-        if 'sources' not in kwargs:
-            raise MesonException('Missing keyword argument "sources".')
-        sources = kwargs.pop('sources')
-        if isinstance(sources, str):
-            sources = [sources]
-        elif not isinstance(sources, list):
-            raise MesonException(
-                'Sources keyword argument must be a string or array.')
-
-        new_genmarshal = mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.53.3')
-
-        cmd = [self.interpreter.find_program_impl('glib-genmarshal')]
-        known_kwargs = ['internal', 'nostdinc', 'skip_source', 'stdinc',
-                        'valist_marshallers', 'extra_args']
-        known_custom_target_kwargs = ['build_always', 'depends',
-                                      'depend_files', 'install_dir',
-                                      'install_header']
-        for arg, value in kwargs.items():
-            if arg == 'prefix':
-                cmd += ['--prefix', value]
-            elif arg == 'extra_args':
-                if new_genmarshal:
-                    cmd += mesonlib.stringlistify(value)
-                else:
-                    mlog.warning('The current version of GLib does not support extra arguments \n'
-                                 'for glib-genmarshal. You need at least GLib 2.53.3. See ',
-                                 mlog.bold('https://github.com/mesonbuild/meson/pull/2049'))
-            elif arg in known_kwargs and value:
-                cmd += ['--' + arg.replace('_', '-')]
-            elif arg not in known_custom_target_kwargs:
-                raise MesonException(
-                    'Genmarshal does not take a %s keyword argument.' % (
-                        arg, ))
-
-        install_header = kwargs.pop('install_header', False)
-        install_dir = kwargs.pop('install_dir', None)
-
-        custom_kwargs = {
-            'input': sources,
-        }
-
-        # https://github.com/GNOME/glib/commit/0fbc98097fac4d3e647684f344e508abae109fdf
-        if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.51.0'):
-            cmd += ['--output', '@OUTPUT@']
-        else:
-            custom_kwargs['capture'] = True
-
-        for arg in known_custom_target_kwargs:
-            if arg in kwargs:
-                custom_kwargs[arg] = kwargs[arg]
-
-        header_file = output + '.h'
-        custom_kwargs['command'] = cmd + ['--body', '@INPUT@']
-        if mesonlib.version_compare(self._get_native_glib_version(state), '>= 2.53.4'):
-            # Silence any warnings about missing prototypes
-            custom_kwargs['command'] += ['--include-header', header_file]
-        custom_kwargs['output'] = output + '.c'
-        body = build.CustomTarget(output + '_c', state.subdir, state.subproject, custom_kwargs)
-
-        custom_kwargs['install'] = install_header
-        if install_dir is not None:
-            custom_kwargs['install_dir'] = install_dir
-        if new_genmarshal:
-            cmd += ['--pragma-once']
-        custom_kwargs['command'] = cmd + ['--header', '@INPUT@']
-        custom_kwargs['output'] = header_file
-        header = build.CustomTarget(output + '_h', state.subdir, state.subproject, custom_kwargs)
-
-        rv = [body, header]
-        return ModuleReturnValue(rv, rv)
-
-    @staticmethod
-    def _vapi_args_to_command(prefix, variable, kwargs, accept_vapi=False):
-        arg_list = mesonlib.extract_as_list(kwargs, variable)
-        ret = []
-        for arg in arg_list:
-            if not isinstance(arg, str):
-                types = 'strings' + ' or InternalDependencys' if accept_vapi else ''
-                raise MesonException('All {} must be {}'.format(variable, types))
-            ret.append(prefix + arg)
-        return ret
-
-    def _extract_vapi_packages(self, state, kwargs):
-        '''
-        Packages are special because we need to:
-        - Get a list of packages for the .deps file
-        - Get a list of depends for any VapiTargets
-        - Get package name from VapiTargets
-        - Add include dirs for any VapiTargets
-        '''
-        arg_list = kwargs.get('packages')
-        if not arg_list:
-            return [], [], [], []
-        arg_list = mesonlib.listify(arg_list)
-        vapi_depends = []
-        vapi_packages = []
-        vapi_includes = []
-        ret = []
-        remaining_args = []
-        for arg in unholder(arg_list):
-            if isinstance(arg, InternalDependency):
-                targets = [t for t in arg.sources if isinstance(t, VapiTarget)]
-                for target in targets:
-                    srcdir = os.path.join(state.environment.get_source_dir(),
-                                          target.get_subdir())
-                    outdir = os.path.join(state.environment.get_build_dir(),
-                                          target.get_subdir())
-                    outfile = target.get_outputs()[0][:-5] # Strip .vapi
-                    ret.append('--vapidir=' + outdir)
-                    ret.append('--girdir=' + outdir)
-                    ret.append('--pkg=' + outfile)
-                    vapi_depends.append(target)
-                    vapi_packages.append(outfile)
-                    vapi_includes.append(srcdir)
-            else:
-                vapi_packages.append(arg)
-                remaining_args.append(arg)
-
-        kwargs['packages'] = remaining_args
-        vapi_args = ret + self._vapi_args_to_command('--pkg=', 'packages', kwargs, accept_vapi=True)
-        return vapi_args, vapi_depends, vapi_packages, vapi_includes
-
-    def _generate_deps(self, state, library, packages, install_dir):
-        outdir = state.environment.scratch_dir
-        fname = os.path.join(outdir, library + '.deps')
-        with open(fname, 'w') as ofile:
-            for package in packages:
-                ofile.write(package + '\n')
-        return build.Data(mesonlib.File(True, outdir, fname), install_dir)
-
-    def _get_vapi_link_with(self, target):
-        link_with = []
-        for dep in target.get_target_dependencies():
-            if isinstance(dep, build.SharedLibrary):
-                link_with.append(dep)
-            elif isinstance(dep, GirTarget):
-                link_with += self._get_vapi_link_with(dep)
-        return link_with
-
-    @permittedKwargs({'sources', 'packages', 'metadata_dirs', 'gir_dirs',
-                      'vapi_dirs', 'install', 'install_dir'})
-    def generate_vapi(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException('The library name is required')
-
-        if not isinstance(args[0], str):
-            raise MesonException('The first argument must be the name of the library')
-        created_values = []
-
-        library = args[0]
-        build_dir = os.path.join(state.environment.get_build_dir(), state.subdir)
-        source_dir = os.path.join(state.environment.get_source_dir(), state.subdir)
-        pkg_cmd, vapi_depends, vapi_packages, vapi_includes = self._extract_vapi_packages(state, kwargs)
-        if 'VAPIGEN' in os.environ:
-            cmd = [self.interpreter.find_program_impl(os.environ['VAPIGEN'])]
-        else:
-            cmd = [self.interpreter.find_program_impl('vapigen')]
-        cmd += ['--quiet', '--library=' + library, '--directory=' + build_dir]
-        cmd += self._vapi_args_to_command('--vapidir=', 'vapi_dirs', kwargs)
-        cmd += self._vapi_args_to_command('--metadatadir=', 'metadata_dirs', kwargs)
-        cmd += self._vapi_args_to_command('--girdir=', 'gir_dirs', kwargs)
-        cmd += pkg_cmd
-        cmd += ['--metadatadir=' + source_dir]
-
-        if 'sources' not in kwargs:
-            raise MesonException('sources are required to generate the vapi file')
-
-        inputs = mesonlib.extract_as_list(kwargs, 'sources')
-
-        link_with = []
-        for i in inputs:
-            if isinstance(i, str):
-                cmd.append(os.path.join(source_dir, i))
-            elif hasattr(i, 'held_object') and isinstance(i.held_object, GirTarget):
-                link_with += self._get_vapi_link_with(i.held_object)
-                subdir = os.path.join(state.environment.get_build_dir(),
-                                      i.held_object.get_subdir())
-                gir_file = os.path.join(subdir, i.held_object.get_outputs()[0])
-                cmd.append(gir_file)
-            else:
-                raise MesonException('Input must be a str or GirTarget')
-
-        vapi_output = library + '.vapi'
-        custom_kwargs = {
-            'command': cmd,
-            'input': inputs,
-            'output': vapi_output,
-            'depends': vapi_depends,
-        }
-        install_dir = kwargs.get('install_dir',
-                                 os.path.join(state.environment.coredata.get_builtin_option('datadir'),
-                                              'vala', 'vapi'))
-        if kwargs.get('install'):
-            custom_kwargs['install'] = kwargs['install']
-            custom_kwargs['install_dir'] = install_dir
-
-            # We shouldn't need this locally but we install it
-            deps_target = self._generate_deps(state, library, vapi_packages, install_dir)
-            created_values.append(deps_target)
-        vapi_target = VapiTarget(vapi_output, state.subdir, state.subproject, custom_kwargs)
-
-        # So to try our best to get this to just work we need:
-        # - link with with the correct library
-        # - include the vapi and dependent vapi files in sources
-        # - add relevant directories to include dirs
-        incs = [build.IncludeDirs(state.subdir, ['.'] + vapi_includes, False)]
-        sources = [vapi_target] + vapi_depends
-        rv = InternalDependency(None, incs, [], [], link_with, [], sources, [], {})
-        created_values.append(rv)
-        return ModuleReturnValue(rv, created_values)
-
-def initialize(*args, **kwargs):
-    return GnomeModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/hotdoc.py b/meson/mesonbuild/modules/hotdoc.py
deleted file mode 100644 (file)
index 5c04e27..0000000
+++ /dev/null
@@ -1,435 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''This module provides helper functions for generating documentation using hotdoc'''
-
-import os
-from collections import OrderedDict
-
-from mesonbuild import mesonlib
-from mesonbuild import mlog, build
-from mesonbuild.coredata import MesonException
-from . import ModuleReturnValue
-from . import ExtensionModule
-from . import get_include_args
-from ..dependencies import Dependency, InternalDependency, ExternalProgram
-from ..interpreterbase import FeatureNew, InvalidArguments, noPosargs, noKwargs
-from ..interpreter import CustomTargetHolder
-
-
-def ensure_list(value):
-    if not isinstance(value, list):
-        return [value]
-    return value
-
-
-MIN_HOTDOC_VERSION = '0.8.100'
-
-
-class HotdocTargetBuilder:
-    def __init__(self, name, state, hotdoc, interpreter, kwargs):
-        self.hotdoc = hotdoc
-        self.build_by_default = kwargs.pop('build_by_default', False)
-        self.kwargs = kwargs
-        self.name = name
-        self.state = state
-        self.interpreter = interpreter
-        self.include_paths = OrderedDict()
-
-        self.builddir = state.environment.get_build_dir()
-        self.sourcedir = state.environment.get_source_dir()
-        self.subdir = state.subdir
-        self.build_command = state.environment.get_build_command()
-
-        self.cmd = ['conf', '--project-name', name, "--disable-incremental-build",
-                    '--output', os.path.join(self.builddir, self.subdir, self.name + '-doc')]
-
-        self._extra_extension_paths = set()
-        self.extra_assets = set()
-        self._dependencies = []
-        self._subprojects = []
-
-    def process_known_arg(self, option, types, argname=None,
-                          value_processor=None, mandatory=False,
-                          force_list=False):
-        if not argname:
-            argname = option.strip("-").replace("-", "_")
-
-        value, _ = self.get_value(
-            types, argname, None, value_processor, mandatory, force_list)
-
-        self.set_arg_value(option, value)
-
-    def set_arg_value(self, option, value):
-        if value is None:
-            return
-
-        if isinstance(value, bool):
-            if value:
-                self.cmd.append(option)
-        elif isinstance(value, list):
-            # Do not do anything on empty lists
-            if value:
-                # https://bugs.python.org/issue9334 (from 2010 :( )
-                # The syntax with nargs=+ is inherently ambiguous
-                # A workaround for this case is to simply prefix with a space
-                # every value starting with a dash
-                escaped_value = []
-                for e in value:
-                    if isinstance(e, str) and e.startswith('-'):
-                        escaped_value += [' %s' % e]
-                    else:
-                        escaped_value += [e]
-                if option:
-                    self.cmd.extend([option] + escaped_value)
-                else:
-                    self.cmd.extend(escaped_value)
-        else:
-            # argparse gets confused if value(s) start with a dash.
-            # When an option expects a single value, the unambiguous way
-            # to specify it is with =
-            if isinstance(value, str):
-                self.cmd.extend(['%s=%s' % (option, value)])
-            else:
-                self.cmd.extend([option, value])
-
-    def check_extra_arg_type(self, arg, value):
-        value = getattr(value, 'held_object', value)
-        if isinstance(value, list):
-            for v in value:
-                self.check_extra_arg_type(arg, v)
-            return
-
-        valid_types = (str, bool, mesonlib.File, build.IncludeDirs, build.CustomTarget, build.BuildTarget)
-        if not isinstance(value, valid_types):
-            raise InvalidArguments('Argument "%s=%s" should be of type: %s.' % (
-                arg, value, [t.__name__ for t in valid_types]))
-
-    def process_extra_args(self):
-        for arg, value in self.kwargs.items():
-            option = "--" + arg.replace("_", "-")
-            self.check_extra_arg_type(arg, value)
-            self.set_arg_value(option, value)
-
-    def get_value(self, types, argname, default=None, value_processor=None,
-                  mandatory=False, force_list=False):
-        if not isinstance(types, list):
-            types = [types]
-        try:
-            uvalue = value = self.kwargs.pop(argname)
-            if value_processor:
-                value = value_processor(value)
-
-            for t in types:
-                if isinstance(value, t):
-                    if force_list and not isinstance(value, list):
-                        return [value], uvalue
-                    return value, uvalue
-            raise MesonException("%s field value %s is not valid,"
-                                 " valid types are %s" % (argname, value,
-                                                          types))
-        except KeyError:
-            if mandatory:
-                raise MesonException("%s mandatory field not found" % argname)
-
-            if default is not None:
-                return default, default
-
-        return None, None
-
-    def setup_extension_paths(self, paths):
-        if not isinstance(paths, list):
-            paths = [paths]
-
-        for path in paths:
-            self.add_extension_paths([path])
-
-        return []
-
-    def add_extension_paths(self, paths):
-        for path in paths:
-            if path in self._extra_extension_paths:
-                continue
-
-            self._extra_extension_paths.add(path)
-            self.cmd.extend(["--extra-extension-path", path])
-
-    def process_extra_extension_paths(self):
-        self.get_value([list, str], 'extra_extensions_paths',
-                       default="", value_processor=self.setup_extension_paths)
-
-    def replace_dirs_in_string(self, string):
-        return string.replace("@SOURCE_ROOT@", self.sourcedir).replace("@BUILD_ROOT@", self.builddir)
-
-    def process_gi_c_source_roots(self):
-        if self.hotdoc.run_hotdoc(['--has-extension=gi-extension']) != 0:
-            return
-
-        value, _ = self.get_value([list, str], 'gi_c_source_roots', default=[], force_list=True)
-        value.extend([
-            os.path.join(self.state.environment.get_source_dir(),
-                         self.interpreter.subproject_dir, self.state.subproject),
-            os.path.join(self.state.environment.get_build_dir(), self.interpreter.subproject_dir, self.state.subproject)
-        ])
-
-        self.cmd += ['--gi-c-source-roots'] + value
-
-    def process_dependencies(self, deps):
-        cflags = set()
-        for dep in mesonlib.listify(ensure_list(deps)):
-            dep = getattr(dep, "held_object", dep)
-            if isinstance(dep, InternalDependency):
-                inc_args = get_include_args(dep.include_directories)
-                cflags.update([self.replace_dirs_in_string(x)
-                               for x in inc_args])
-                cflags.update(self.process_dependencies(dep.libraries))
-                cflags.update(self.process_dependencies(dep.sources))
-                cflags.update(self.process_dependencies(dep.ext_deps))
-            elif isinstance(dep, Dependency):
-                cflags.update(dep.get_compile_args())
-            elif isinstance(dep, (build.StaticLibrary, build.SharedLibrary)):
-                self._dependencies.append(dep)
-                for incd in dep.get_include_dirs():
-                    cflags.update(incd.get_incdirs())
-            elif isinstance(dep, HotdocTarget):
-                # Recurse in hotdoc target dependencies
-                self.process_dependencies(dep.get_target_dependencies())
-                self._subprojects.extend(dep.subprojects)
-                self.process_dependencies(dep.subprojects)
-                self.add_include_path(os.path.join(self.builddir, dep.hotdoc_conf.subdir))
-                self.cmd += ['--extra-assets=' + p for p in dep.extra_assets]
-                self.add_extension_paths(dep.extra_extension_paths)
-            elif isinstance(dep, build.CustomTarget) or isinstance(dep, build.BuildTarget):
-                self._dependencies.append(dep)
-
-        return [f.strip('-I') for f in cflags]
-
-    def process_extra_assets(self):
-        self._extra_assets, _ = self.get_value("--extra-assets", (str, list), default=[],
-                                               force_list=True)
-        for assets_path in self._extra_assets:
-            self.cmd.extend(["--extra-assets", assets_path])
-
-    def process_subprojects(self):
-        _, value = self.get_value([
-            list, HotdocTarget], argname="subprojects",
-            force_list=True, value_processor=self.process_dependencies)
-
-        if value is not None:
-            self._subprojects.extend(value)
-
-    def flatten_config_command(self):
-        cmd = []
-        for arg in mesonlib.listify(self.cmd, flatten=True):
-            arg = getattr(arg, 'held_object', arg)
-            if isinstance(arg, mesonlib.File):
-                arg = arg.absolute_path(self.state.environment.get_source_dir(),
-                                        self.state.environment.get_build_dir())
-            elif isinstance(arg, build.IncludeDirs):
-                for inc_dir in arg.get_incdirs():
-                    cmd.append(os.path.join(self.sourcedir, arg.get_curdir(), inc_dir))
-                    cmd.append(os.path.join(self.builddir, arg.get_curdir(), inc_dir))
-
-                continue
-            elif isinstance(arg, build.CustomTarget) or isinstance(arg, build.BuildTarget):
-                self._dependencies.append(arg)
-                arg = self.interpreter.backend.get_target_filename_abs(arg)
-
-            cmd.append(arg)
-
-        return cmd
-
-    def generate_hotdoc_config(self):
-        cwd = os.path.abspath(os.curdir)
-        ncwd = os.path.join(self.sourcedir, self.subdir)
-        mlog.log('Generating Hotdoc configuration for: ', mlog.bold(self.name))
-        os.chdir(ncwd)
-        self.hotdoc.run_hotdoc(self.flatten_config_command())
-        os.chdir(cwd)
-
-    def ensure_file(self, value):
-        if isinstance(value, list):
-            res = []
-            for val in value:
-                res.append(self.ensure_file(val))
-            return res
-
-        if not isinstance(value, mesonlib.File):
-            return mesonlib.File.from_source_file(self.sourcedir, self.subdir, value)
-
-        return value
-
-    def ensure_dir(self, value):
-        if os.path.isabs(value):
-            _dir = value
-        else:
-            _dir = os.path.join(self.sourcedir, self.subdir, value)
-
-        if not os.path.isdir(_dir):
-            raise InvalidArguments('"%s" is not a directory.' % _dir)
-
-        return os.path.relpath(_dir, os.path.join(self.builddir, self.subdir))
-
-    def check_forbiden_args(self):
-        for arg in ['conf_file']:
-            if arg in self.kwargs:
-                raise InvalidArguments('Argument "%s" is forbidden.' % arg)
-
-    def add_include_path(self, path):
-        self.include_paths[path] = path
-
-    def make_targets(self):
-        self.check_forbiden_args()
-        file_types = (str, mesonlib.File)
-        self.process_known_arg("--index", file_types, mandatory=True, value_processor=self.ensure_file)
-        self.process_known_arg("--project-version", str, mandatory=True)
-        self.process_known_arg("--sitemap", file_types, mandatory=True, value_processor=self.ensure_file)
-        self.process_known_arg("--html-extra-theme", str, value_processor=self.ensure_dir)
-        self.process_known_arg(None, list, "include_paths", force_list=True,
-                               value_processor=lambda x: [self.add_include_path(self.ensure_dir(v)) for v in ensure_list(x)])
-        self.process_known_arg('--c-include-directories',
-                               [Dependency, build.StaticLibrary, build.SharedLibrary, list], argname="dependencies",
-                               force_list=True, value_processor=self.process_dependencies)
-        self.process_gi_c_source_roots()
-        self.process_extra_assets()
-        self.process_extra_extension_paths()
-        self.process_subprojects()
-
-        install, install = self.get_value(bool, "install", mandatory=False)
-        self.process_extra_args()
-
-        fullname = self.name + '-doc'
-        hotdoc_config_name = fullname + '.json'
-        hotdoc_config_path = os.path.join(
-            self.builddir, self.subdir, hotdoc_config_name)
-        with open(hotdoc_config_path, 'w') as f:
-            f.write('{}')
-
-        self.cmd += ['--conf-file', hotdoc_config_path]
-        self.add_include_path(os.path.join(self.builddir, self.subdir))
-        self.add_include_path(os.path.join(self.sourcedir, self.subdir))
-
-        depfile = os.path.join(self.builddir, self.subdir, self.name + '.deps')
-        self.cmd += ['--deps-file-dest', depfile]
-
-        for path in self.include_paths.keys():
-            self.cmd.extend(['--include-path', path])
-
-        if self.state.environment.coredata.get_builtin_option('werror', self.state.subproject):
-            self.cmd.append('--fatal-warning')
-        self.generate_hotdoc_config()
-
-        target_cmd = self.build_command + ["--internal", "hotdoc"] + \
-            self.hotdoc.get_command() + ['run', '--conf-file', hotdoc_config_name] + \
-            ['--builddir', os.path.join(self.builddir, self.subdir)]
-
-        target = HotdocTarget(fullname,
-                              subdir=self.subdir,
-                              subproject=self.state.subproject,
-                              hotdoc_conf=mesonlib.File.from_built_file(
-                                  self.subdir, hotdoc_config_name),
-                              extra_extension_paths=self._extra_extension_paths,
-                              extra_assets=self._extra_assets,
-                              subprojects=self._subprojects,
-                              command=target_cmd,
-                              depends=self._dependencies,
-                              output=fullname,
-                              depfile=os.path.basename(depfile),
-                              build_by_default=self.build_by_default)
-
-        install_script = None
-        if install is True:
-            install_script = HotdocRunScript(self.build_command, [
-                "--internal", "hotdoc",
-                "--install", os.path.join(fullname, 'html'),
-                '--name', self.name,
-                '--builddir', os.path.join(self.builddir, self.subdir)] +
-                self.hotdoc.get_command() +
-                ['run', '--conf-file', hotdoc_config_name])
-
-        return (target, install_script)
-
-
-class HotdocTargetHolder(CustomTargetHolder):
-    def __init__(self, target, interp):
-        super().__init__(target, interp)
-        self.methods.update({'config_path': self.config_path_method})
-
-    @noPosargs
-    @noKwargs
-    def config_path_method(self, *args, **kwargs):
-        conf = self.held_object.hotdoc_conf.absolute_path(self.interpreter.environment.source_dir,
-                                                          self.interpreter.environment.build_dir)
-        return self.interpreter.holderify(conf)
-
-
-class HotdocTarget(build.CustomTarget):
-    def __init__(self, name, subdir, subproject, hotdoc_conf, extra_extension_paths, extra_assets,
-                 subprojects, **kwargs):
-        super().__init__(name, subdir, subproject, kwargs, absolute_paths=True)
-        self.hotdoc_conf = hotdoc_conf
-        self.extra_extension_paths = extra_extension_paths
-        self.extra_assets = extra_assets
-        self.subprojects = subprojects
-
-    def __getstate__(self):
-        # Make sure we do not try to pickle subprojects
-        res = self.__dict__.copy()
-        res['subprojects'] = []
-
-        return res
-
-
-class HotdocRunScript(build.RunScript):
-    def __init__(self, script, args):
-        super().__init__(script, args)
-
-
-class HotDocModule(ExtensionModule):
-    @FeatureNew('Hotdoc Module', '0.48.0')
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.hotdoc = ExternalProgram('hotdoc')
-        if not self.hotdoc.found():
-            raise MesonException('hotdoc executable not found')
-
-        try:
-            from hotdoc.run_hotdoc import run  # noqa: F401
-            self.hotdoc.run_hotdoc = run
-        except Exception as e:
-            raise MesonException('hotdoc %s required but not found. (%s)' % (
-                MIN_HOTDOC_VERSION, e))
-
-    @noKwargs
-    def has_extensions(self, state, args, kwargs):
-        res = self.hotdoc.run_hotdoc(['--has-extension=%s' % extension for extension in args]) == 0
-        return ModuleReturnValue(res, [res])
-
-    def generate_doc(self, state, args, kwargs):
-        if len(args) != 1:
-            raise MesonException('One positional argument is'
-                                 ' required for the project name.')
-
-        project_name = args[0]
-        builder = HotdocTargetBuilder(project_name, state, self.hotdoc, self.interpreter, kwargs)
-        target, install_script = builder.make_targets()
-        targets = [HotdocTargetHolder(target, self.interpreter)]
-        if install_script:
-            targets.append(install_script)
-
-        return ModuleReturnValue(targets[0], targets)
-
-
-def initialize(interpreter):
-    return HotDocModule(interpreter)
diff --git a/meson/mesonbuild/modules/i18n.py b/meson/mesonbuild/modules/i18n.py
deleted file mode 100644 (file)
index 2652e7d..0000000
+++ /dev/null
@@ -1,189 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import shutil
-
-from os import path
-from .. import coredata, mesonlib, build, mlog
-from ..mesonlib import MesonException
-from . import ModuleReturnValue
-from . import ExtensionModule
-from ..interpreterbase import permittedKwargs, FeatureNew, FeatureNewKwargs
-
-PRESET_ARGS = {
-    'glib': [
-        '--from-code=UTF-8',
-        '--add-comments',
-
-        # https://developer.gnome.org/glib/stable/glib-I18N.html
-        '--keyword=_',
-        '--keyword=N_',
-        '--keyword=C_:1c,2',
-        '--keyword=NC_:1c,2',
-        '--keyword=g_dcgettext:2',
-        '--keyword=g_dngettext:2,3',
-        '--keyword=g_dpgettext2:2c,3',
-
-        '--flag=N_:1:pass-c-format',
-        '--flag=C_:2:pass-c-format',
-        '--flag=NC_:2:pass-c-format',
-        '--flag=g_dngettext:2:pass-c-format',
-        '--flag=g_strdup_printf:1:c-format',
-        '--flag=g_string_printf:2:c-format',
-        '--flag=g_string_append_printf:2:c-format',
-        '--flag=g_error_new:3:c-format',
-        '--flag=g_set_error:4:c-format',
-        '--flag=g_markup_printf_escaped:1:c-format',
-        '--flag=g_log:3:c-format',
-        '--flag=g_print:1:c-format',
-        '--flag=g_printerr:1:c-format',
-        '--flag=g_printf:1:c-format',
-        '--flag=g_fprintf:2:c-format',
-        '--flag=g_sprintf:2:c-format',
-        '--flag=g_snprintf:3:c-format',
-    ]
-}
-
-
-class I18nModule(ExtensionModule):
-
-    @staticmethod
-    def nogettext_warning():
-        mlog.warning('Gettext not found, all translation targets will be ignored.', once=True)
-        return ModuleReturnValue(None, [])
-
-    @staticmethod
-    def _get_data_dirs(state, dirs):
-        """Returns source directories of relative paths"""
-        src_dir = path.join(state.environment.get_source_dir(), state.subdir)
-        return [path.join(src_dir, d) for d in dirs]
-
-    @FeatureNew('i18n.merge_file', '0.37.0')
-    @FeatureNewKwargs('i18n.merge_file', '0.51.0', ['args'])
-    @permittedKwargs(build.CustomTarget.known_kwargs | {'data_dirs', 'po_dir', 'type', 'args'})
-    def merge_file(self, state, args, kwargs):
-        if not shutil.which('xgettext'):
-            return self.nogettext_warning()
-        podir = kwargs.pop('po_dir', None)
-        if not podir:
-            raise MesonException('i18n: po_dir is a required kwarg')
-        podir = path.join(state.build_to_src, state.subdir, podir)
-
-        file_type = kwargs.pop('type', 'xml')
-        VALID_TYPES = ('xml', 'desktop')
-        if file_type not in VALID_TYPES:
-            raise MesonException('i18n: "{}" is not a valid type {}'.format(file_type, VALID_TYPES))
-
-        datadirs = self._get_data_dirs(state, mesonlib.stringlistify(kwargs.pop('data_dirs', [])))
-        datadirs = '--datadirs=' + ':'.join(datadirs) if datadirs else None
-
-        command = state.environment.get_build_command() + [
-            '--internal', 'msgfmthelper',
-            '@INPUT@', '@OUTPUT@', file_type, podir
-        ]
-        if datadirs:
-            command.append(datadirs)
-
-        if 'args' in kwargs:
-            command.append('--')
-            command.append(mesonlib.stringlistify(kwargs.pop('args', [])))
-
-        kwargs['command'] = command
-
-        inputfile = kwargs['input']
-        if hasattr(inputfile, 'held_object'):
-            ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs)
-        else:
-            if isinstance(inputfile, list):
-                # We only use this input file to create a name of the custom target.
-                # Thus we can ignore the other entries.
-                inputfile = inputfile[0]
-            if isinstance(inputfile, str):
-                inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
-                                                           state.subdir, inputfile)
-            output = kwargs['output']
-            ifile_abs = inputfile.absolute_path(state.environment.source_dir,
-                                                state.environment.build_dir)
-            values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
-            outputs = mesonlib.substitute_values([output], values)
-            output = outputs[0]
-            ct = build.CustomTarget(output + '_' + state.subdir.replace('/', '@').replace('\\', '@') + '_merge', state.subdir, state.subproject, kwargs)
-        return ModuleReturnValue(ct, [ct])
-
-    @FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset'])
-    @FeatureNewKwargs('i18n.gettext', '0.50.0', ['install_dir'])
-    @permittedKwargs({'po_dir', 'data_dirs', 'type', 'languages', 'args', 'preset', 'install', 'install_dir'})
-    def gettext(self, state, args, kwargs):
-        if len(args) != 1:
-            raise coredata.MesonException('Gettext requires one positional argument (package name).')
-        if not shutil.which('xgettext'):
-            return self.nogettext_warning()
-        packagename = args[0]
-        languages = mesonlib.stringlistify(kwargs.get('languages', []))
-        datadirs = self._get_data_dirs(state, mesonlib.stringlistify(kwargs.get('data_dirs', [])))
-        extra_args = mesonlib.stringlistify(kwargs.get('args', []))
-
-        preset = kwargs.pop('preset', None)
-        if preset:
-            preset_args = PRESET_ARGS.get(preset)
-            if not preset_args:
-                raise coredata.MesonException('i18n: Preset "{}" is not one of the valid options: {}'.format(
-                                              preset, list(PRESET_ARGS.keys())))
-            extra_args = set(preset_args + extra_args)
-
-        pkg_arg = '--pkgname=' + packagename
-        lang_arg = '--langs=' + '@@'.join(languages) if languages else None
-        datadirs = '--datadirs=' + ':'.join(datadirs) if datadirs else None
-        extra_args = '--extra-args=' + '@@'.join(extra_args) if extra_args else None
-
-        potargs = state.environment.get_build_command() + ['--internal', 'gettext', 'pot', pkg_arg]
-        if datadirs:
-            potargs.append(datadirs)
-        if extra_args:
-            potargs.append(extra_args)
-        pottarget = build.RunTarget(packagename + '-pot', potargs[0], potargs[1:], [], state.subdir, state.subproject)
-
-        gmoargs = state.environment.get_build_command() + ['--internal', 'gettext', 'gen_gmo']
-        if lang_arg:
-            gmoargs.append(lang_arg)
-        gmotarget = build.RunTarget(packagename + '-gmo', gmoargs[0], gmoargs[1:], [], state.subdir, state.subproject)
-
-        updatepoargs = state.environment.get_build_command() + ['--internal', 'gettext', 'update_po', pkg_arg]
-        if lang_arg:
-            updatepoargs.append(lang_arg)
-        if datadirs:
-            updatepoargs.append(datadirs)
-        if extra_args:
-            updatepoargs.append(extra_args)
-        updatepotarget = build.RunTarget(packagename + '-update-po', updatepoargs[0], updatepoargs[1:], [], state.subdir, state.subproject)
-
-        targets = [pottarget, gmotarget, updatepotarget]
-
-        install = kwargs.get('install', True)
-        if install:
-            install_dir = kwargs.get('install_dir', state.environment.coredata.get_builtin_option('localedir'))
-            script = state.environment.get_build_command()
-            args = ['--internal', 'gettext', 'install',
-                    '--subdir=' + state.subdir,
-                    '--localedir=' + install_dir,
-                    pkg_arg]
-            if lang_arg:
-                args.append(lang_arg)
-            iscript = build.RunScript(script, args)
-            targets.append(iscript)
-
-        return ModuleReturnValue(None, targets)
-
-def initialize(*args, **kwargs):
-    return I18nModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/modtest.py b/meson/mesonbuild/modules/modtest.py
deleted file mode 100644 (file)
index 533989f..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from . import ModuleReturnValue
-from . import ExtensionModule
-from ..interpreterbase import noKwargs
-
-class TestModule(ExtensionModule):
-
-    @noKwargs
-    def print_hello(self, state, args, kwargs):
-        print('Hello from a Meson module')
-        rv = ModuleReturnValue(None, [])
-        return rv
-
-def initialize(*args, **kwargs):
-    return TestModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/pkgconfig.py b/meson/mesonbuild/modules/pkgconfig.py
deleted file mode 100644 (file)
index b7a12ff..0000000
+++ /dev/null
@@ -1,527 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os, types
-from pathlib import PurePath
-
-from .. import build
-from .. import dependencies
-from ..dependencies.misc import ThreadDependency
-from .. import mesonlib
-from .. import mlog
-from . import ModuleReturnValue
-from . import ExtensionModule
-from ..interpreterbase import permittedKwargs, FeatureNew, FeatureNewKwargs
-
-already_warned_objs = set()
-
-class DependenciesHelper:
-    def __init__(self, state, name):
-        self.state = state
-        self.name = name
-        self.pub_libs = []
-        self.pub_reqs = []
-        self.priv_libs = []
-        self.priv_reqs = []
-        self.cflags = []
-        self.version_reqs = {}
-
-    def add_pub_libs(self, libs):
-        libs, reqs, cflags = self._process_libs(libs, True)
-        self.pub_libs = libs + self.pub_libs # prepend to preserve dependencies
-        self.pub_reqs += reqs
-        self.cflags += cflags
-
-    def add_priv_libs(self, libs):
-        libs, reqs, _ = self._process_libs(libs, False)
-        self.priv_libs = libs + self.priv_libs
-        self.priv_reqs += reqs
-
-    def add_pub_reqs(self, reqs):
-        self.pub_reqs += self._process_reqs(reqs)
-
-    def add_priv_reqs(self, reqs):
-        self.priv_reqs += self._process_reqs(reqs)
-
-    def _check_generated_pc_deprecation(self, obj):
-        if not hasattr(obj, 'generated_pc_warn'):
-            return
-        name = obj.generated_pc_warn[0]
-        if (name, obj.name) in already_warned_objs:
-            return
-        mlog.deprecation('Library', mlog.bold(obj.name), 'was passed to the '
-                         '"libraries" keyword argument of a previous call '
-                         'to generate() method instead of first positional '
-                         'argument.', 'Adding', mlog.bold(obj.generated_pc),
-                         'to "Requires" field, but this is a deprecated '
-                         'behaviour that will change in a future version '
-                         'of Meson. Please report the issue if this '
-                         'warning cannot be avoided in your case.',
-                         location=obj.generated_pc_warn[1])
-        already_warned_objs.add((name, obj.name))
-
-    def _process_reqs(self, reqs):
-        '''Returns string names of requirements'''
-        processed_reqs = []
-        for obj in mesonlib.unholder(mesonlib.listify(reqs)):
-            if not isinstance(obj, str):
-                FeatureNew.single_use('pkgconfig.generate requirement from non-string object', '0.46.0', self.state.subproject)
-            if hasattr(obj, 'generated_pc'):
-                self._check_generated_pc_deprecation(obj)
-                processed_reqs.append(obj.generated_pc)
-            elif hasattr(obj, 'pcdep'):
-                pcdeps = mesonlib.listify(obj.pcdep)
-                for d in pcdeps:
-                    processed_reqs.append(d.name)
-                    self.add_version_reqs(d.name, obj.version_reqs)
-            elif isinstance(obj, dependencies.PkgConfigDependency):
-                if obj.found():
-                    processed_reqs.append(obj.name)
-                    self.add_version_reqs(obj.name, obj.version_reqs)
-            elif isinstance(obj, str):
-                name, version_req = self.split_version_req(obj)
-                processed_reqs.append(name)
-                self.add_version_reqs(name, version_req)
-            elif isinstance(obj, dependencies.Dependency) and not obj.found():
-                pass
-            elif isinstance(obj, ThreadDependency):
-                pass
-            else:
-                raise mesonlib.MesonException('requires argument not a string, '
-                                              'library with pkgconfig-generated file '
-                                              'or pkgconfig-dependency object, '
-                                              'got {!r}'.format(obj))
-        return processed_reqs
-
-    def add_cflags(self, cflags):
-        self.cflags += mesonlib.stringlistify(cflags)
-
-    def _process_libs(self, libs, public):
-        libs = mesonlib.unholder(mesonlib.listify(libs))
-        processed_libs = []
-        processed_reqs = []
-        processed_cflags = []
-        for obj in libs:
-            shared_library_only = getattr(obj, 'shared_library_only', False)
-            if hasattr(obj, 'pcdep'):
-                pcdeps = mesonlib.listify(obj.pcdep)
-                for d in pcdeps:
-                    processed_reqs.append(d.name)
-                    self.add_version_reqs(d.name, obj.version_reqs)
-            elif hasattr(obj, 'generated_pc'):
-                self._check_generated_pc_deprecation(obj)
-                processed_reqs.append(obj.generated_pc)
-            elif isinstance(obj, dependencies.PkgConfigDependency):
-                if obj.found():
-                    processed_reqs.append(obj.name)
-                    self.add_version_reqs(obj.name, obj.version_reqs)
-            elif isinstance(obj, dependencies.InternalDependency):
-                if obj.found():
-                    processed_libs += obj.get_link_args()
-                    processed_cflags += obj.get_compile_args()
-                    if public:
-                        self.add_pub_libs(obj.libraries)
-                    else:
-                        self.add_priv_libs(obj.libraries)
-            elif isinstance(obj, dependencies.Dependency):
-                if obj.found():
-                    processed_libs += obj.get_link_args()
-                    processed_cflags += obj.get_compile_args()
-            elif isinstance(obj, build.SharedLibrary) and shared_library_only:
-                # Do not pull dependencies for shared libraries because they are
-                # only required for static linking. Adding private requires has
-                # the side effect of exposing their cflags, which is the
-                # intended behaviour of pkg-config but force Debian to add more
-                # than needed build deps.
-                # See https://bugs.freedesktop.org/show_bug.cgi?id=105572
-                processed_libs.append(obj)
-            elif isinstance(obj, (build.SharedLibrary, build.StaticLibrary)):
-                processed_libs.append(obj)
-                if isinstance(obj, build.StaticLibrary) and public:
-                    self.add_pub_libs(obj.get_dependencies(for_pkgconfig=True))
-                    self.add_pub_libs(obj.get_external_deps())
-                else:
-                    self.add_priv_libs(obj.get_dependencies(for_pkgconfig=True))
-                    self.add_priv_libs(obj.get_external_deps())
-            elif isinstance(obj, str):
-                processed_libs.append(obj)
-            else:
-                raise mesonlib.MesonException('library argument not a string, library or dependency object.')
-
-        return processed_libs, processed_reqs, processed_cflags
-
-    def add_version_reqs(self, name, version_reqs):
-        if version_reqs:
-            if name not in self.version_reqs:
-                self.version_reqs[name] = set()
-            # Note that pkg-config is picky about whitespace.
-            # 'foo > 1.2' is ok but 'foo>1.2' is not.
-            # foo, bar' is ok, but 'foo,bar' is not.
-            new_vreqs = [s for s in mesonlib.stringlistify(version_reqs)]
-            self.version_reqs[name].update(new_vreqs)
-
-    def split_version_req(self, s):
-        for op in ['>=', '<=', '!=', '==', '=', '>', '<']:
-            pos = s.find(op)
-            if pos > 0:
-                return s[0:pos].strip(), s[pos:].strip()
-        return s, None
-
-    def format_vreq(self, vreq):
-        # vreq are '>=1.0' and pkgconfig wants '>= 1.0'
-        for op in ['>=', '<=', '!=', '==', '=', '>', '<']:
-            if vreq.startswith(op):
-                return op + ' ' + vreq[len(op):]
-        return vreq
-
-    def format_reqs(self, reqs):
-        result = []
-        for name in reqs:
-            vreqs = self.version_reqs.get(name, None)
-            if vreqs:
-                result += [name + ' ' + self.format_vreq(vreq) for vreq in vreqs]
-            else:
-                result += [name]
-        return ', '.join(result)
-
-    def remove_dups(self):
-        def _fn(xs, libs=False):
-            # Remove duplicates whilst preserving original order
-            result = []
-            for x in xs:
-                # Don't de-dup unknown strings to avoid messing up arguments like:
-                # ['-framework', 'CoreAudio', '-framework', 'CoreMedia']
-                known_flags = ['-pthread']
-                cannot_dedup = libs and isinstance(x, str) and \
-                    not x.startswith(('-l', '-L')) and \
-                    x not in known_flags
-                if x not in result or cannot_dedup:
-                    result.append(x)
-            return result
-        self.pub_libs = _fn(self.pub_libs, True)
-        self.pub_reqs = _fn(self.pub_reqs)
-        self.priv_libs = _fn(self.priv_libs, True)
-        self.priv_reqs = _fn(self.priv_reqs)
-        self.cflags = _fn(self.cflags)
-
-        # Remove from private libs/reqs if they are in public already
-        self.priv_libs = [i for i in self.priv_libs if i not in self.pub_libs]
-        self.priv_reqs = [i for i in self.priv_reqs if i not in self.pub_reqs]
-
-class PkgConfigModule(ExtensionModule):
-
-    def _get_lname(self, l, msg, pcfile):
-        # Nothing special
-        if not l.name_prefix_set:
-            return l.name
-        # Sometimes people want the library to start with 'lib' everywhere,
-        # which is achieved by setting name_prefix to '' and the target name to
-        # 'libfoo'. In that case, try to get the pkg-config '-lfoo' arg correct.
-        if l.prefix == '' and l.name.startswith('lib'):
-            return l.name[3:]
-        # If the library is imported via an import library which is always
-        # named after the target name, '-lfoo' is correct.
-        if isinstance(l, build.SharedLibrary) and l.import_filename:
-            return l.name
-        # In other cases, we can't guarantee that the compiler will be able to
-        # find the library via '-lfoo', so tell the user that.
-        mlog.warning(msg.format(l.name, 'name_prefix', l.name, pcfile))
-        return l.name
-
-    def _escape(self, value):
-        '''
-        We cannot use quote_arg because it quotes with ' and " which does not
-        work with pkg-config and pkgconf at all.
-        '''
-        # We should always write out paths with / because pkg-config requires
-        # spaces to be quoted with \ and that messes up on Windows:
-        # https://bugs.freedesktop.org/show_bug.cgi?id=103203
-        if isinstance(value, PurePath):
-            value = value.as_posix()
-        return value.replace(' ', r'\ ')
-
-    def _make_relative(self, prefix, subdir):
-        if isinstance(prefix, PurePath):
-            prefix = prefix.as_posix()
-        if isinstance(subdir, PurePath):
-            subdir = subdir.as_posix()
-        try:
-            if os.path.commonpath([prefix, subdir]) == prefix:
-                skip = len(prefix) + 1
-                subdir = subdir[skip:]
-        except ValueError:
-            pass
-        return subdir
-
-    def generate_pkgconfig_file(self, state, deps, subdirs, name, description,
-                                url, version, pcfile, conflicts, variables,
-                                uninstalled=False, dataonly=False):
-        deps.remove_dups()
-        coredata = state.environment.get_coredata()
-        if uninstalled:
-            outdir = os.path.join(state.environment.build_dir, 'meson-uninstalled')
-            if not os.path.exists(outdir):
-                os.mkdir(outdir)
-            prefix = PurePath(state.environment.get_build_dir())
-            srcdir = PurePath(state.environment.get_source_dir())
-        else:
-            outdir = state.environment.scratch_dir
-            prefix = PurePath(coredata.get_builtin_option('prefix'))
-            # These always return paths relative to prefix
-            libdir = PurePath(coredata.get_builtin_option('libdir'))
-            incdir = PurePath(coredata.get_builtin_option('includedir'))
-        fname = os.path.join(outdir, pcfile)
-        with open(fname, 'w', encoding='utf-8') as ofile:
-            if not dataonly:
-                ofile.write('prefix={}\n'.format(self._escape(prefix)))
-                if uninstalled:
-                    ofile.write('srcdir={}\n'.format(self._escape(srcdir)))
-                else:
-                    ofile.write('libdir={}\n'.format(self._escape('${prefix}' / libdir)))
-                    ofile.write('includedir={}\n'.format(self._escape('${prefix}' / incdir)))
-            if variables:
-                ofile.write('\n')
-            for k, v in variables:
-                ofile.write('{}={}\n'.format(k, self._escape(v)))
-            ofile.write('\n')
-            ofile.write('Name: %s\n' % name)
-            if len(description) > 0:
-                ofile.write('Description: %s\n' % description)
-            if len(url) > 0:
-                ofile.write('URL: %s\n' % url)
-            ofile.write('Version: %s\n' % version)
-            reqs_str = deps.format_reqs(deps.pub_reqs)
-            if len(reqs_str) > 0:
-                ofile.write('Requires: {}\n'.format(reqs_str))
-            reqs_str = deps.format_reqs(deps.priv_reqs)
-            if len(reqs_str) > 0:
-                ofile.write('Requires.private: {}\n'.format(reqs_str))
-            if len(conflicts) > 0:
-                ofile.write('Conflicts: {}\n'.format(' '.join(conflicts)))
-
-            def generate_libs_flags(libs):
-                msg = 'Library target {0!r} has {1!r} set. Compilers ' \
-                      'may not find it from its \'-l{2}\' linker flag in the ' \
-                      '{3!r} pkg-config file.'
-                Lflags = []
-                for l in libs:
-                    if isinstance(l, str):
-                        yield l
-                    else:
-                        if uninstalled:
-                            install_dir = os.path.dirname(state.backend.get_target_filename_abs(l))
-                        else:
-                            install_dir = l.get_custom_install_dir()[0]
-                        if install_dir is False:
-                            continue
-                        if 'cs' in l.compilers:
-                            if isinstance(install_dir, str):
-                                Lflag = '-r${prefix}/%s/%s' % (self._escape(self._make_relative(prefix, install_dir)), l.filename)
-                            else:  # install_dir is True
-                                Lflag = '-r${libdir}/%s' % l.filename
-                        else:
-                            if isinstance(install_dir, str):
-                                Lflag = '-L${prefix}/%s' % self._escape(self._make_relative(prefix, install_dir))
-                            else:  # install_dir is True
-                                Lflag = '-L${libdir}'
-                        if Lflag not in Lflags:
-                            Lflags.append(Lflag)
-                            yield Lflag
-                        lname = self._get_lname(l, msg, pcfile)
-                        # If using a custom suffix, the compiler may not be able to
-                        # find the library
-                        if l.name_suffix_set:
-                            mlog.warning(msg.format(l.name, 'name_suffix', lname, pcfile))
-                        if 'cs' not in l.compilers:
-                            yield '-l%s' % lname
-
-            def get_uninstalled_include_dirs(libs):
-                result = []
-                for l in libs:
-                    if isinstance(l, str):
-                        continue
-                    if l.get_subdir() not in result:
-                        result.append(l.get_subdir())
-                    for i in l.get_include_dirs():
-                        curdir = i.get_curdir()
-                        for d in i.get_incdirs():
-                            path = os.path.join(curdir, d)
-                            if path not in result:
-                                result.append(path)
-                return result
-
-            def generate_uninstalled_cflags(libs):
-                for d in get_uninstalled_include_dirs(libs):
-                    for basedir in ['${prefix}', '${srcdir}']:
-                        path = os.path.join(basedir, d)
-                        yield '-I%s' % self._escape(path)
-
-            if len(deps.pub_libs) > 0:
-                ofile.write('Libs: {}\n'.format(' '.join(generate_libs_flags(deps.pub_libs))))
-            if len(deps.priv_libs) > 0:
-                ofile.write('Libs.private: {}\n'.format(' '.join(generate_libs_flags(deps.priv_libs))))
-
-            cflags = []
-            if uninstalled:
-                cflags += generate_uninstalled_cflags(deps.pub_libs + deps.priv_libs)
-            else:
-                for d in subdirs:
-                    if d == '.':
-                        cflags.append('-I${includedir}')
-                    else:
-                        cflags.append(self._escape(PurePath('-I${includedir}') / d))
-            cflags += [self._escape(f) for f in deps.cflags]
-            if cflags and not dataonly:
-                ofile.write('Cflags: {}\n'.format(' '.join(cflags)))
-
-    @FeatureNewKwargs('pkgconfig.generate', '0.54.0', ['uninstalled_variables'])
-    @FeatureNewKwargs('pkgconfig.generate', '0.42.0', ['extra_cflags'])
-    @FeatureNewKwargs('pkgconfig.generate', '0.41.0', ['variables'])
-    @FeatureNewKwargs('pkgconfig.generate', '0.54.0', ['dataonly'])
-    @permittedKwargs({'libraries', 'version', 'name', 'description', 'filebase',
-                      'subdirs', 'requires', 'requires_private', 'libraries_private',
-                      'install_dir', 'extra_cflags', 'variables', 'url', 'd_module_versions',
-                      'dataonly', 'conflicts'})
-    def generate(self, state, args, kwargs):
-        default_version = state.project_version['version']
-        default_install_dir = None
-        default_description = None
-        default_name = None
-        mainlib = None
-        default_subdirs = ['.']
-        if not args and 'version' not in kwargs:
-            FeatureNew.single_use('pkgconfig.generate implicit version keyword', '0.46.0', state.subproject)
-        elif len(args) == 1:
-            FeatureNew.single_use('pkgconfig.generate optional positional argument', '0.46.0', state.subproject)
-            mainlib = getattr(args[0], 'held_object', args[0])
-            if not isinstance(mainlib, (build.StaticLibrary, build.SharedLibrary)):
-                raise mesonlib.MesonException('Pkgconfig_gen first positional argument must be a library object')
-            default_name = mainlib.name
-            default_description = state.project_name + ': ' + mainlib.name
-            install_dir = mainlib.get_custom_install_dir()[0]
-            if isinstance(install_dir, str):
-                default_install_dir = os.path.join(install_dir, 'pkgconfig')
-        elif len(args) > 1:
-            raise mesonlib.MesonException('Too many positional arguments passed to Pkgconfig_gen.')
-
-        dataonly = kwargs.get('dataonly', False)
-        if dataonly:
-            default_subdirs = []
-            blocked_vars = ['libraries', 'libraries_private', 'require_private', 'extra_cflags', 'subdirs']
-            if len(set(kwargs) & set(blocked_vars)) > 0:
-                raise mesonlib.MesonException('Cannot combine dataonly with any of {}'.format(blocked_vars))
-
-        subdirs = mesonlib.stringlistify(kwargs.get('subdirs', default_subdirs))
-        version = kwargs.get('version', default_version)
-        if not isinstance(version, str):
-            raise mesonlib.MesonException('Version must be specified.')
-        name = kwargs.get('name', default_name)
-        if not isinstance(name, str):
-            raise mesonlib.MesonException('Name not specified.')
-        filebase = kwargs.get('filebase', name)
-        if not isinstance(filebase, str):
-            raise mesonlib.MesonException('Filebase must be a string.')
-        description = kwargs.get('description', default_description)
-        if not isinstance(description, str):
-            raise mesonlib.MesonException('Description is not a string.')
-        url = kwargs.get('url', '')
-        if not isinstance(url, str):
-            raise mesonlib.MesonException('URL is not a string.')
-        conflicts = mesonlib.stringlistify(kwargs.get('conflicts', []))
-
-        # Prepend the main library to public libraries list. This is required
-        # so dep.add_pub_libs() can handle dependency ordering correctly and put
-        # extra libraries after the main library.
-        libraries = mesonlib.extract_as_list(kwargs, 'libraries')
-        if mainlib:
-            libraries = [mainlib] + libraries
-
-        deps = DependenciesHelper(state, filebase)
-        deps.add_pub_libs(libraries)
-        deps.add_priv_libs(kwargs.get('libraries_private', []))
-        deps.add_pub_reqs(kwargs.get('requires', []))
-        deps.add_priv_reqs(kwargs.get('requires_private', []))
-        deps.add_cflags(kwargs.get('extra_cflags', []))
-
-        dversions = kwargs.get('d_module_versions', None)
-        if dversions:
-            compiler = state.environment.coredata.compilers.host.get('d')
-            if compiler:
-                deps.add_cflags(compiler.get_feature_args({'versions': dversions}, None))
-
-        def parse_variable_list(stringlist):
-            reserved = ['prefix', 'libdir', 'includedir']
-            variables = []
-            for var in stringlist:
-                # foo=bar=baz is ('foo', 'bar=baz')
-                l = var.split('=', 1)
-                if len(l) < 2:
-                    raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var))
-
-                name, value = l[0].strip(), l[1].strip()
-                if not name or not value:
-                    raise mesonlib.MesonException('Invalid variable "{}". Variables must be in \'name=value\' format'.format(var))
-
-                # Variable names must not contain whitespaces
-                if any(c.isspace() for c in name):
-                    raise mesonlib.MesonException('Invalid whitespace in assignment "{}"'.format(var))
-
-                if name in reserved:
-                    raise mesonlib.MesonException('Variable "{}" is reserved'.format(name))
-
-                variables.append((name, value))
-
-            return variables
-
-        variables = parse_variable_list(mesonlib.stringlistify(kwargs.get('variables', [])))
-
-        pcfile = filebase + '.pc'
-        pkgroot = kwargs.get('install_dir', default_install_dir)
-        if pkgroot is None:
-            if mesonlib.is_freebsd():
-                pkgroot = os.path.join(state.environment.coredata.get_builtin_option('prefix'), 'libdata', 'pkgconfig')
-            else:
-                pkgroot = os.path.join(state.environment.coredata.get_builtin_option('libdir'), 'pkgconfig')
-        if not isinstance(pkgroot, str):
-            raise mesonlib.MesonException('Install_dir must be a string.')
-        self.generate_pkgconfig_file(state, deps, subdirs, name, description, url,
-                                     version, pcfile, conflicts, variables,
-                                     False, dataonly)
-        res = build.Data(mesonlib.File(True, state.environment.get_scratch_dir(), pcfile), pkgroot)
-        variables = parse_variable_list(mesonlib.stringlistify(kwargs.get('uninstalled_variables', [])))
-        pcfile = filebase + '-uninstalled.pc'
-        self.generate_pkgconfig_file(state, deps, subdirs, name, description, url,
-                                     version, pcfile, conflicts, variables,
-                                     uninstalled=True, dataonly=dataonly)
-        # Associate the main library with this generated pc file. If the library
-        # is used in any subsequent call to the generated, it will generate a
-        # 'Requires:' or 'Requires.private:'.
-        # Backward compatibility: We used to set 'generated_pc' on all public
-        # libraries instead of just the main one. Keep doing that but warn if
-        # anyone is relying on that deprecated behaviour.
-        if mainlib:
-            if not hasattr(mainlib, 'generated_pc'):
-                mainlib.generated_pc = filebase
-            else:
-                mlog.warning('Already generated a pkg-config file for', mlog.bold(mainlib.name))
-        else:
-            for lib in deps.pub_libs:
-                if not isinstance(lib, str) and not hasattr(lib, 'generated_pc'):
-                    lib.generated_pc = filebase
-                    location = state.current_node
-                    lib.generated_pc_warn = [name, location]
-        return ModuleReturnValue(res, [res])
-
-def initialize(*args, **kwargs):
-    return PkgConfigModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/python.py b/meson/mesonbuild/modules/python.py
deleted file mode 100644 (file)
index ceabd76..0000000
+++ /dev/null
@@ -1,594 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import json
-import shutil
-import typing as T
-
-from pathlib import Path
-from .. import mesonlib
-from ..mesonlib import MachineChoice, MesonException
-from . import ExtensionModule
-from mesonbuild.modules import ModuleReturnValue
-from ..interpreterbase import (
-    noPosargs, noKwargs, permittedKwargs,
-    InvalidArguments,
-    FeatureNew, FeatureNewKwargs, disablerIfNotFound
-)
-from ..interpreter import ExternalProgramHolder, extract_required_kwarg, permitted_kwargs
-from ..build import known_shmod_kwargs
-from .. import mlog
-from ..environment import detect_cpu_family
-from ..dependencies.base import (
-    DependencyMethods, ExternalDependency,
-    ExternalProgram, PkgConfigDependency,
-    NonExistingExternalProgram
-)
-
-mod_kwargs = set(['subdir'])
-mod_kwargs.update(known_shmod_kwargs)
-mod_kwargs -= set(['name_prefix', 'name_suffix'])
-
-class PythonDependency(ExternalDependency):
-
-    def __init__(self, python_holder, environment, kwargs):
-        super().__init__('python', environment, kwargs)
-        self.name = 'python'
-        self.static = kwargs.get('static', False)
-        self.embed = kwargs.get('embed', False)
-        self.version = python_holder.version
-        self.platform = python_holder.platform
-        self.pkgdep = None
-        self.variables = python_holder.variables
-        self.paths = python_holder.paths
-        self.link_libpython = python_holder.link_libpython
-        if mesonlib.version_compare(self.version, '>= 3.0'):
-            self.major_version = 3
-        else:
-            self.major_version = 2
-
-        # We first try to find the necessary python variables using pkgconfig
-        if DependencyMethods.PKGCONFIG in self.methods and not python_holder.is_pypy:
-            pkg_version = self.variables.get('LDVERSION') or self.version
-            pkg_libdir = self.variables.get('LIBPC')
-            pkg_embed = '-embed' if self.embed and mesonlib.version_compare(self.version, '>=3.8') else ''
-            pkg_name = 'python-{}{}'.format(pkg_version, pkg_embed)
-
-            # If python-X.Y.pc exists in LIBPC, we will try to use it
-            if pkg_libdir is not None and Path(os.path.join(pkg_libdir, '{}.pc'.format(pkg_name))).is_file():
-                old_pkg_libdir = os.environ.get('PKG_CONFIG_LIBDIR')
-                old_pkg_path = os.environ.get('PKG_CONFIG_PATH')
-
-                os.environ.pop('PKG_CONFIG_PATH', None)
-
-                if pkg_libdir:
-                    os.environ['PKG_CONFIG_LIBDIR'] = pkg_libdir
-
-                try:
-                    self.pkgdep = PkgConfigDependency(pkg_name, environment, kwargs)
-                    mlog.debug('Found "{}" via pkgconfig lookup in LIBPC ({})'.format(pkg_name, pkg_libdir))
-                    py_lookup_method = 'pkgconfig'
-                except MesonException as e:
-                    mlog.debug('"{}" could not be found in LIBPC ({})'.format(pkg_name, pkg_libdir))
-                    mlog.debug(e)
-
-                if old_pkg_path is not None:
-                    os.environ['PKG_CONFIG_PATH'] = old_pkg_path
-
-                if old_pkg_libdir is not None:
-                    os.environ['PKG_CONFIG_LIBDIR'] = old_pkg_libdir
-                else:
-                    os.environ.pop('PKG_CONFIG_LIBDIR', None)
-            else:
-                mlog.debug('"{}" could not be found in LIBPC ({}), this is likely due to a relocated python installation'.format(pkg_name, pkg_libdir))
-
-            # If lookup via LIBPC failed, try to use fallback PKG_CONFIG_LIBDIR/PKG_CONFIG_PATH mechanisms
-            if self.pkgdep is None or not self.pkgdep.found():
-                try:
-                    self.pkgdep = PkgConfigDependency(pkg_name, environment, kwargs)
-                    mlog.debug('Found "{}" via fallback pkgconfig lookup in PKG_CONFIG_LIBDIR/PKG_CONFIG_PATH'.format(pkg_name))
-                    py_lookup_method = 'pkgconfig-fallback'
-                except MesonException as e:
-                    mlog.debug('"{}" could not be found via fallback pkgconfig lookup in PKG_CONFIG_LIBDIR/PKG_CONFIG_PATH'.format(pkg_name))
-                    mlog.debug(e)
-
-        if self.pkgdep and self.pkgdep.found():
-            self.compile_args = self.pkgdep.get_compile_args()
-            self.link_args = self.pkgdep.get_link_args()
-            self.is_found = True
-            self.pcdep = self.pkgdep
-        else:
-            self.pkgdep = None
-
-            # Finally, try to find python via SYSCONFIG as a final measure
-            if DependencyMethods.SYSCONFIG in self.methods:
-                if mesonlib.is_windows():
-                    self._find_libpy_windows(environment)
-                else:
-                    self._find_libpy(python_holder, environment)
-                if self.is_found:
-                    mlog.debug('Found "python-{}" via SYSCONFIG module'.format(self.version))
-                    py_lookup_method = 'sysconfig'
-
-        if self.is_found:
-            mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.green('YES ({})'.format(py_lookup_method)))
-        else:
-            mlog.log('Dependency', mlog.bold(self.name), 'found:', mlog.red('NO'))
-
-    def _find_libpy(self, python_holder, environment):
-        if python_holder.is_pypy:
-            if self.major_version == 3:
-                libname = 'pypy3-c'
-            else:
-                libname = 'pypy-c'
-            libdir = os.path.join(self.variables.get('base'), 'bin')
-            libdirs = [libdir]
-        else:
-            libname = 'python{}'.format(self.version)
-            if 'DEBUG_EXT' in self.variables:
-                libname += self.variables['DEBUG_EXT']
-            if 'ABIFLAGS' in self.variables:
-                libname += self.variables['ABIFLAGS']
-            libdirs = []
-
-        largs = self.clib_compiler.find_library(libname, environment, libdirs)
-        if largs is not None:
-            self.link_args = largs
-
-        self.is_found = largs is not None or self.link_libpython
-
-        inc_paths = mesonlib.OrderedSet([
-            self.variables.get('INCLUDEPY'),
-            self.paths.get('include'),
-            self.paths.get('platinclude')])
-
-        self.compile_args += ['-I' + path for path in inc_paths if path]
-
-    def get_windows_python_arch(self):
-        if self.platform == 'mingw':
-            pycc = self.variables.get('CC')
-            if pycc.startswith('x86_64'):
-                return '64'
-            elif pycc.startswith(('i686', 'i386')):
-                return '32'
-            else:
-                mlog.log('MinGW Python built with unknown CC {!r}, please file'
-                         'a bug'.format(pycc))
-                return None
-        elif self.platform == 'win32':
-            return '32'
-        elif self.platform in ('win64', 'win-amd64'):
-            return '64'
-        mlog.log('Unknown Windows Python platform {!r}'.format(self.platform))
-        return None
-
-    def get_windows_link_args(self):
-        if self.platform.startswith('win'):
-            vernum = self.variables.get('py_version_nodot')
-            if self.static:
-                libpath = Path('libs') / 'libpython{}.a'.format(vernum)
-            else:
-                comp = self.get_compiler()
-                if comp.id == "gcc":
-                    libpath = 'python{}.dll'.format(vernum)
-                else:
-                    libpath = Path('libs') / 'python{}.lib'.format(vernum)
-            lib = Path(self.variables.get('base')) / libpath
-        elif self.platform == 'mingw':
-            if self.static:
-                libname = self.variables.get('LIBRARY')
-            else:
-                libname = self.variables.get('LDLIBRARY')
-            lib = Path(self.variables.get('LIBDIR')) / libname
-        if not lib.exists():
-            mlog.log('Could not find Python3 library {!r}'.format(str(lib)))
-            return None
-        return [str(lib)]
-
-    def _find_libpy_windows(self, env):
-        '''
-        Find python3 libraries on Windows and also verify that the arch matches
-        what we are building for.
-        '''
-        pyarch = self.get_windows_python_arch()
-        if pyarch is None:
-            self.is_found = False
-            return
-        arch = detect_cpu_family(env.coredata.compilers.host)
-        if arch == 'x86':
-            arch = '32'
-        elif arch == 'x86_64':
-            arch = '64'
-        else:
-            # We can't cross-compile Python 3 dependencies on Windows yet
-            mlog.log('Unknown architecture {!r} for'.format(arch),
-                     mlog.bold(self.name))
-            self.is_found = False
-            return
-        # Pyarch ends in '32' or '64'
-        if arch != pyarch:
-            mlog.log('Need', mlog.bold(self.name), 'for {}-bit, but '
-                     'found {}-bit'.format(arch, pyarch))
-            self.is_found = False
-            return
-        # This can fail if the library is not found
-        largs = self.get_windows_link_args()
-        if largs is None:
-            self.is_found = False
-            return
-        self.link_args = largs
-        # Compile args
-        inc_paths = mesonlib.OrderedSet([
-            self.variables.get('INCLUDEPY'),
-            self.paths.get('include'),
-            self.paths.get('platinclude')])
-
-        self.compile_args += ['-I' + path for path in inc_paths if path]
-
-        # https://sourceforge.net/p/mingw-w64/mailman/message/30504611/
-        if pyarch == '64' and self.major_version == 2:
-            self.compile_args += ['-DMS_WIN64']
-
-        self.is_found = True
-
-    @staticmethod
-    def get_methods():
-        if mesonlib.is_windows():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG]
-        elif mesonlib.is_osx():
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.EXTRAFRAMEWORK]
-        else:
-            return [DependencyMethods.PKGCONFIG, DependencyMethods.SYSCONFIG]
-
-    def get_pkgconfig_variable(self, variable_name, kwargs):
-        if self.pkgdep:
-            return self.pkgdep.get_pkgconfig_variable(variable_name, kwargs)
-        else:
-            return super().get_pkgconfig_variable(variable_name, kwargs)
-
-
-INTROSPECT_COMMAND = '''import sysconfig
-import json
-import sys
-
-install_paths = sysconfig.get_paths(scheme='posix_prefix', vars={'base': '', 'platbase': '', 'installed_base': ''})
-
-def links_against_libpython():
-    from distutils.core import Distribution, Extension
-    cmd = Distribution().get_command_obj('build_ext')
-    cmd.ensure_finalized()
-    return bool(cmd.get_libraries(Extension('dummy', [])))
-
-print (json.dumps ({
-  'variables': sysconfig.get_config_vars(),
-  'paths': sysconfig.get_paths(),
-  'install_paths': install_paths,
-  'version': sysconfig.get_python_version(),
-  'platform': sysconfig.get_platform(),
-  'is_pypy': '__pypy__' in sys.builtin_module_names,
-  'link_libpython': links_against_libpython(),
-}))
-'''
-
-
-class PythonInstallation(ExternalProgramHolder):
-    def __init__(self, interpreter, python, info):
-        ExternalProgramHolder.__init__(self, python, interpreter.subproject)
-        self.interpreter = interpreter
-        self.subproject = self.interpreter.subproject
-        prefix = self.interpreter.environment.coredata.get_builtin_option('prefix')
-        self.variables = info['variables']
-        self.paths = info['paths']
-        install_paths = info['install_paths']
-        self.platlib_install_path = os.path.join(prefix, install_paths['platlib'][1:])
-        self.purelib_install_path = os.path.join(prefix, install_paths['purelib'][1:])
-        self.version = info['version']
-        self.platform = info['platform']
-        self.is_pypy = info['is_pypy']
-        self.link_libpython = info['link_libpython']
-        self.methods.update({
-            'extension_module': self.extension_module_method,
-            'dependency': self.dependency_method,
-            'install_sources': self.install_sources_method,
-            'get_install_dir': self.get_install_dir_method,
-            'language_version': self.language_version_method,
-            'found': self.found_method,
-            'has_path': self.has_path_method,
-            'get_path': self.get_path_method,
-            'has_variable': self.has_variable_method,
-            'get_variable': self.get_variable_method,
-            'path': self.path_method,
-        })
-
-    @permittedKwargs(mod_kwargs)
-    def extension_module_method(self, args, kwargs):
-        if 'subdir' in kwargs and 'install_dir' in kwargs:
-            raise InvalidArguments('"subdir" and "install_dir" are mutually exclusive')
-
-        if 'subdir' in kwargs:
-            subdir = kwargs.pop('subdir', '')
-            if not isinstance(subdir, str):
-                raise InvalidArguments('"subdir" argument must be a string.')
-
-            kwargs['install_dir'] = os.path.join(self.platlib_install_path, subdir)
-
-        # On macOS and some Linux distros (Debian) distutils doesn't link
-        # extensions against libpython. We call into distutils and mirror its
-        # behavior. See https://github.com/mesonbuild/meson/issues/4117
-        if not self.link_libpython:
-            new_deps = []
-            for holder in mesonlib.extract_as_list(kwargs, 'dependencies'):
-                dep = holder.held_object
-                if isinstance(dep, PythonDependency):
-                    holder = self.interpreter.holderify(dep.get_partial_dependency(compile_args=True))
-                new_deps.append(holder)
-            kwargs['dependencies'] = new_deps
-
-        suffix = self.variables.get('EXT_SUFFIX') or self.variables.get('SO') or self.variables.get('.so')
-
-        # msys2's python3 has "-cpython-36m.dll", we have to be clever
-        split = suffix.rsplit('.', 1)
-        suffix = split.pop(-1)
-        args[0] += ''.join(s for s in split)
-
-        kwargs['name_prefix'] = ''
-        kwargs['name_suffix'] = suffix
-
-        return self.interpreter.func_shared_module(None, args, kwargs)
-
-    @permittedKwargs(permitted_kwargs['dependency'])
-    @FeatureNewKwargs('python_installation.dependency', '0.53.0', ['embed'])
-    def dependency_method(self, args, kwargs):
-        if args:
-            mlog.warning('python_installation.dependency() does not take any '
-                         'positional arguments. It always returns a Python '
-                         'dependency. This will become an error in the future.',
-                         location=self.interpreter.current_node)
-        dep = PythonDependency(self, self.interpreter.environment, kwargs)
-        return self.interpreter.holderify(dep)
-
-    @permittedKwargs(['pure', 'subdir'])
-    def install_sources_method(self, args, kwargs):
-        pure = kwargs.pop('pure', True)
-        if not isinstance(pure, bool):
-            raise InvalidArguments('"pure" argument must be a boolean.')
-
-        subdir = kwargs.pop('subdir', '')
-        if not isinstance(subdir, str):
-            raise InvalidArguments('"subdir" argument must be a string.')
-
-        if pure:
-            kwargs['install_dir'] = os.path.join(self.purelib_install_path, subdir)
-        else:
-            kwargs['install_dir'] = os.path.join(self.platlib_install_path, subdir)
-
-        return self.interpreter.holderify(self.interpreter.func_install_data(None, args, kwargs))
-
-    @noPosargs
-    @permittedKwargs(['pure', 'subdir'])
-    def get_install_dir_method(self, args, kwargs):
-        pure = kwargs.pop('pure', True)
-        if not isinstance(pure, bool):
-            raise InvalidArguments('"pure" argument must be a boolean.')
-
-        subdir = kwargs.pop('subdir', '')
-        if not isinstance(subdir, str):
-            raise InvalidArguments('"subdir" argument must be a string.')
-
-        if pure:
-            res = os.path.join(self.purelib_install_path, subdir)
-        else:
-            res = os.path.join(self.platlib_install_path, subdir)
-
-        return self.interpreter.module_method_callback(ModuleReturnValue(res, []))
-
-    @noPosargs
-    @noKwargs
-    def language_version_method(self, args, kwargs):
-        return self.interpreter.module_method_callback(ModuleReturnValue(self.version, []))
-
-    @noKwargs
-    def has_path_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InvalidArguments('has_path takes exactly one positional argument.')
-        path_name = args[0]
-        if not isinstance(path_name, str):
-            raise InvalidArguments('has_path argument must be a string.')
-
-        return self.interpreter.module_method_callback(ModuleReturnValue(path_name in self.paths, []))
-
-    @noKwargs
-    def get_path_method(self, args, kwargs):
-        if len(args) not in (1, 2):
-            raise InvalidArguments('get_path must have one or two arguments.')
-        path_name = args[0]
-        if not isinstance(path_name, str):
-            raise InvalidArguments('get_path argument must be a string.')
-
-        try:
-            path = self.paths[path_name]
-        except KeyError:
-            if len(args) == 2:
-                path = args[1]
-            else:
-                raise InvalidArguments('{} is not a valid path name'.format(path_name))
-
-        return self.interpreter.module_method_callback(ModuleReturnValue(path, []))
-
-    @noKwargs
-    def has_variable_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InvalidArguments('has_variable takes exactly one positional argument.')
-        var_name = args[0]
-        if not isinstance(var_name, str):
-            raise InvalidArguments('has_variable argument must be a string.')
-
-        return self.interpreter.module_method_callback(ModuleReturnValue(var_name in self.variables, []))
-
-    @noKwargs
-    def get_variable_method(self, args, kwargs):
-        if len(args) not in (1, 2):
-            raise InvalidArguments('get_variable must have one or two arguments.')
-        var_name = args[0]
-        if not isinstance(var_name, str):
-            raise InvalidArguments('get_variable argument must be a string.')
-
-        try:
-            var = self.variables[var_name]
-        except KeyError:
-            if len(args) == 2:
-                var = args[1]
-            else:
-                raise InvalidArguments('{} is not a valid variable name'.format(var_name))
-
-        return self.interpreter.module_method_callback(ModuleReturnValue(var, []))
-
-    @noPosargs
-    @noKwargs
-    @FeatureNew('Python module path method', '0.50.0')
-    def path_method(self, args, kwargs):
-        return super().path_method(args, kwargs)
-
-
-class PythonModule(ExtensionModule):
-
-    @FeatureNew('Python Module', '0.46.0')
-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-        self.snippets.add('find_installation')
-
-    # https://www.python.org/dev/peps/pep-0397/
-    def _get_win_pythonpath(self, name_or_path):
-        if name_or_path not in ['python2', 'python3']:
-            return None
-        if not shutil.which('py'):
-            # program not installed, return without an exception
-            return None
-        ver = {'python2': '-2', 'python3': '-3'}[name_or_path]
-        cmd = ['py', ver, '-c', "import sysconfig; print(sysconfig.get_config_var('BINDIR'))"]
-        _, stdout, _ = mesonlib.Popen_safe(cmd)
-        directory = stdout.strip()
-        if os.path.exists(directory):
-            return os.path.join(directory, 'python')
-        else:
-            return None
-
-    def _check_version(self, name_or_path, version):
-        if name_or_path == 'python2':
-            return mesonlib.version_compare(version, '< 3.0')
-        elif name_or_path == 'python3':
-            return mesonlib.version_compare(version, '>= 3.0')
-        return True
-
-    @FeatureNewKwargs('python.find_installation', '0.49.0', ['disabler'])
-    @FeatureNewKwargs('python.find_installation', '0.51.0', ['modules'])
-    @disablerIfNotFound
-    @permittedKwargs({'required', 'modules'})
-    def find_installation(self, interpreter, state, args, kwargs):
-        feature_check = FeatureNew('Passing "feature" option to find_installation', '0.48.0')
-        disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, feature_check)
-        want_modules = mesonlib.extract_as_list(kwargs, 'modules')  # type: T.List[str]
-        found_modules = []    # type: T.List[str]
-        missing_modules = []  # type: T.List[str]
-
-        if len(args) > 1:
-            raise InvalidArguments('find_installation takes zero or one positional argument.')
-
-        name_or_path = state.environment.lookup_binary_entry(MachineChoice.HOST, 'python')
-        if name_or_path is None and args:
-            name_or_path = args[0]
-            if not isinstance(name_or_path, str):
-                raise InvalidArguments('find_installation argument must be a string.')
-
-        if disabled:
-            mlog.log('Program', name_or_path or 'python', 'found:', mlog.red('NO'), '(disabled by:', mlog.bold(feature), ')')
-            return ExternalProgramHolder(NonExistingExternalProgram(), state.subproject)
-
-        if not name_or_path:
-            python = ExternalProgram('python3', mesonlib.python_command, silent=True)
-        else:
-            python = ExternalProgram.from_entry('python3', name_or_path)
-
-            if not python.found() and mesonlib.is_windows():
-                pythonpath = self._get_win_pythonpath(name_or_path)
-                if pythonpath is not None:
-                    name_or_path = pythonpath
-                    python = ExternalProgram(name_or_path, silent=True)
-
-            # Last ditch effort, python2 or python3 can be named python
-            # on various platforms, let's not give up just yet, if an executable
-            # named python is available and has a compatible version, let's use
-            # it
-            if not python.found() and name_or_path in ['python2', 'python3']:
-                python = ExternalProgram('python', silent=True)
-
-        if python.found() and want_modules:
-            for mod in want_modules:
-                p, out, err = mesonlib.Popen_safe(
-                    python.command +
-                    ['-c', 'import {0}'.format(mod)])
-                if p.returncode != 0:
-                    missing_modules.append(mod)
-                else:
-                    found_modules.append(mod)
-
-        msg = ['Program', python.name]
-        if want_modules:
-            msg.append('({})'.format(', '.join(want_modules)))
-        msg.append('found:')
-        if python.found() and not missing_modules:
-            msg.extend([mlog.green('YES'), '({})'.format(' '.join(python.command))])
-        else:
-            msg.append(mlog.red('NO'))
-        if found_modules:
-            msg.append('modules:')
-            msg.append(', '.join(found_modules))
-
-        mlog.log(*msg)
-
-        if not python.found():
-            if required:
-                raise mesonlib.MesonException('{} not found'.format(name_or_path or 'python'))
-            res = ExternalProgramHolder(NonExistingExternalProgram(), state.subproject)
-        elif missing_modules:
-            if required:
-                raise mesonlib.MesonException('{} is missing modules: {}'.format(name_or_path or 'python', ', '.join(missing_modules)))
-            res = ExternalProgramHolder(NonExistingExternalProgram(), state.subproject)
-        else:
-            # Sanity check, we expect to have something that at least quacks in tune
-            try:
-                cmd = python.get_command() + ['-c', INTROSPECT_COMMAND]
-                p, stdout, stderr = mesonlib.Popen_safe(cmd)
-                info = json.loads(stdout)
-            except json.JSONDecodeError:
-                info = None
-                mlog.debug('Could not introspect Python (%s): exit code %d' % (str(p.args), p.returncode))
-                mlog.debug('Program stdout:\n')
-                mlog.debug(stdout)
-                mlog.debug('Program stderr:\n')
-                mlog.debug(stderr)
-
-            if isinstance(info, dict) and 'version' in info and self._check_version(name_or_path, info['version']):
-                res = PythonInstallation(interpreter, python, info)
-            else:
-                res = ExternalProgramHolder(NonExistingExternalProgram(), state.subproject)
-                if required:
-                    raise mesonlib.MesonException('{} is not a valid python or it is missing setuptools'.format(python))
-
-        return res
-
-
-def initialize(*args, **kwargs):
-    return PythonModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/python3.py b/meson/mesonbuild/modules/python3.py
deleted file mode 100644 (file)
index 97bd5ec..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-# Copyright 2016-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sysconfig
-from .. import mesonlib, dependencies
-
-from . import ExtensionModule
-from mesonbuild.modules import ModuleReturnValue
-from ..interpreterbase import noKwargs, permittedKwargs, FeatureDeprecated
-from ..build import known_shmod_kwargs
-
-
-class Python3Module(ExtensionModule):
-    @FeatureDeprecated('python3 module', '0.48.0')
-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-        self.snippets.add('extension_module')
-
-    @permittedKwargs(known_shmod_kwargs)
-    def extension_module(self, interpreter, state, args, kwargs):
-        if 'name_prefix' in kwargs:
-            raise mesonlib.MesonException('Name_prefix is set automatically, specifying it is forbidden.')
-        if 'name_suffix' in kwargs:
-            raise mesonlib.MesonException('Name_suffix is set automatically, specifying it is forbidden.')
-        host_system = state.host_machine.system
-        if host_system == 'darwin':
-            # Default suffix is 'dylib' but Python does not use it for extensions.
-            suffix = 'so'
-        elif host_system == 'windows':
-            # On Windows the extension is pyd for some unexplainable reason.
-            suffix = 'pyd'
-        else:
-            suffix = []
-        kwargs['name_prefix'] = ''
-        kwargs['name_suffix'] = suffix
-        return interpreter.func_shared_module(None, args, kwargs)
-
-    @noKwargs
-    def find_python(self, state, args, kwargs):
-        command = state.environment.lookup_binary_entry(mesonlib.MachineChoice.HOST, 'python3')
-        if command is not None:
-            py3 = dependencies.ExternalProgram.from_entry('python3', command)
-        else:
-            py3 = dependencies.ExternalProgram('python3', mesonlib.python_command, silent=True)
-        return ModuleReturnValue(py3, [py3])
-
-    @noKwargs
-    def language_version(self, state, args, kwargs):
-        return ModuleReturnValue(sysconfig.get_python_version(), [])
-
-    @noKwargs
-    def sysconfig_path(self, state, args, kwargs):
-        if len(args) != 1:
-            raise mesonlib.MesonException('sysconfig_path() requires passing the name of path to get.')
-        path_name = args[0]
-        valid_names = sysconfig.get_path_names()
-        if path_name not in valid_names:
-            raise mesonlib.MesonException('{} is not a valid path name {}.'.format(path_name, valid_names))
-
-        # Get a relative path without a prefix, e.g. lib/python3.6/site-packages
-        path = sysconfig.get_path(path_name, vars={'base': '', 'platbase': '', 'installed_base': ''})[1:]
-        return ModuleReturnValue(path, [])
-
-
-def initialize(*args, **kwargs):
-    return Python3Module(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/qt.py b/meson/mesonbuild/modules/qt.py
deleted file mode 100644 (file)
index c810df6..0000000
+++ /dev/null
@@ -1,227 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-from .. import mlog
-from .. import build
-from ..mesonlib import MesonException, extract_as_list, File, unholder, version_compare
-from ..dependencies import Dependency, Qt4Dependency, Qt5Dependency, NonExistingExternalProgram
-import xml.etree.ElementTree as ET
-from . import ModuleReturnValue, get_include_args, ExtensionModule
-from ..interpreterbase import noPosargs, permittedKwargs, FeatureNew, FeatureNewKwargs
-from ..interpreter import extract_required_kwarg
-
-_QT_DEPS_LUT = {
-    4: Qt4Dependency,
-    5: Qt5Dependency
-}
-
-
-class QtBaseModule(ExtensionModule):
-    tools_detected = False
-    rcc_supports_depfiles = False
-
-    def __init__(self, interpreter, qt_version=5):
-        ExtensionModule.__init__(self, interpreter)
-        self.snippets.add('has_tools')
-        self.qt_version = qt_version
-
-    def _detect_tools(self, env, method, required=True):
-        if self.tools_detected:
-            return
-        self.tools_detected = True
-        mlog.log('Detecting Qt{version} tools'.format(version=self.qt_version))
-        kwargs = {'required': required, 'modules': 'Core', 'method': method}
-        qt = _QT_DEPS_LUT[self.qt_version](env, kwargs)
-        if qt.found():
-            # Get all tools and then make sure that they are the right version
-            self.moc, self.uic, self.rcc, self.lrelease = qt.compilers_detect(self.interpreter)
-            if version_compare(qt.version, '>=5.14.0'):
-                self.rcc_supports_depfiles = True
-            else:
-                mlog.warning('rcc dependencies will not work properly until you move to Qt >= 5.14:',
-                    mlog.bold('https://bugreports.qt.io/browse/QTBUG-45460'), fatal=False)
-        else:
-            suffix = '-qt{}'.format(self.qt_version)
-            self.moc = NonExistingExternalProgram(name='moc' + suffix)
-            self.uic = NonExistingExternalProgram(name='uic' + suffix)
-            self.rcc = NonExistingExternalProgram(name='rcc' + suffix)
-            self.lrelease = NonExistingExternalProgram(name='lrelease' + suffix)
-
-    def parse_qrc(self, state, rcc_file):
-        if type(rcc_file) is str:
-            abspath = os.path.join(state.environment.source_dir, state.subdir, rcc_file)
-            rcc_dirname = os.path.dirname(abspath)
-        elif type(rcc_file) is File:
-            abspath = rcc_file.absolute_path(state.environment.source_dir, state.environment.build_dir)
-            rcc_dirname = os.path.dirname(abspath)
-
-        try:
-            tree = ET.parse(abspath)
-            root = tree.getroot()
-            result = []
-            for child in root[0]:
-                if child.tag != 'file':
-                    mlog.warning("malformed rcc file: ", os.path.join(state.subdir, rcc_file))
-                    break
-                else:
-                    resource_path = child.text
-                    # We need to guess if the pointed resource is:
-                    #   a) in build directory -> implies a generated file
-                    #   b) in source directory
-                    #   c) somewhere else external dependency file to bundle
-                    #
-                    # Also from qrc documentation: relative path are always from qrc file
-                    # So relative path must always be computed from qrc file !
-                    if os.path.isabs(resource_path):
-                        # a)
-                        if resource_path.startswith(os.path.abspath(state.environment.build_dir)):
-                            resource_relpath = os.path.relpath(resource_path, state.environment.build_dir)
-                            result.append(File(is_built=True, subdir='', fname=resource_relpath))
-                        # either b) or c)
-                        else:
-                            result.append(File(is_built=False, subdir=state.subdir, fname=resource_path))
-                    else:
-                        path_from_rcc = os.path.normpath(os.path.join(rcc_dirname, resource_path))
-                        # a)
-                        if path_from_rcc.startswith(state.environment.build_dir):
-                            result.append(File(is_built=True, subdir=state.subdir, fname=resource_path))
-                        # b)
-                        else:
-                            result.append(File(is_built=False, subdir=state.subdir, fname=path_from_rcc))
-            return result
-        except Exception:
-            return []
-
-    @noPosargs
-    @permittedKwargs({'method', 'required'})
-    @FeatureNew('qt.has_tools', '0.54.0')
-    def has_tools(self, interpreter, state, args, kwargs):
-        method = kwargs.get('method', 'auto')
-        disabled, required, feature = extract_required_kwarg(kwargs, state.subproject, default=False)
-        if disabled:
-            mlog.log('qt.has_tools skipped: feature', mlog.bold(feature), 'disabled')
-            return False
-        self._detect_tools(state.environment, method, required=False)
-        for tool in (self.moc, self.uic, self.rcc, self.lrelease):
-            if not tool.found():
-                if required:
-                    raise MesonException('Qt tools not found')
-                return False
-        return True
-
-    @FeatureNewKwargs('qt.preprocess', '0.49.0', ['uic_extra_arguments'])
-    @FeatureNewKwargs('qt.preprocess', '0.44.0', ['moc_extra_arguments'])
-    @FeatureNewKwargs('qt.preprocess', '0.49.0', ['rcc_extra_arguments'])
-    @permittedKwargs({'moc_headers', 'moc_sources', 'uic_extra_arguments', 'moc_extra_arguments', 'rcc_extra_arguments', 'include_directories', 'dependencies', 'ui_files', 'qresources', 'method'})
-    def preprocess(self, state, args, kwargs):
-        rcc_files, ui_files, moc_headers, moc_sources, uic_extra_arguments, moc_extra_arguments, rcc_extra_arguments, sources, include_directories, dependencies \
-            = [extract_as_list(kwargs, c, pop=True) for c in ['qresources', 'ui_files', 'moc_headers', 'moc_sources', 'uic_extra_arguments', 'moc_extra_arguments', 'rcc_extra_arguments', 'sources', 'include_directories', 'dependencies']]
-        sources += args[1:]
-        method = kwargs.get('method', 'auto')
-        self._detect_tools(state.environment, method)
-        err_msg = "{0} sources specified and couldn't find {1}, " \
-                  "please check your qt{2} installation"
-        if (moc_headers or moc_sources) and not self.moc.found():
-            raise MesonException(err_msg.format('MOC', 'moc-qt{}'.format(self.qt_version), self.qt_version))
-        if rcc_files:
-            if not self.rcc.found():
-                raise MesonException(err_msg.format('RCC', 'rcc-qt{}'.format(self.qt_version), self.qt_version))
-            # custom output name set? -> one output file, multiple otherwise
-            if args:
-                qrc_deps = []
-                for i in rcc_files:
-                    qrc_deps += self.parse_qrc(state, i)
-                name = args[0]
-                rcc_kwargs = {'input': rcc_files,
-                              'output': name + '.cpp',
-                              'command': [self.rcc, '-name', name, '-o', '@OUTPUT@', rcc_extra_arguments, '@INPUT@'],
-                              'depend_files': qrc_deps}
-                res_target = build.CustomTarget(name, state.subdir, state.subproject, rcc_kwargs)
-                sources.append(res_target)
-            else:
-                for rcc_file in rcc_files:
-                    qrc_deps = self.parse_qrc(state, rcc_file)
-                    if type(rcc_file) is str:
-                        basename = os.path.basename(rcc_file)
-                    elif type(rcc_file) is File:
-                        basename = os.path.basename(rcc_file.fname)
-                    name = 'qt' + str(self.qt_version) + '-' + basename.replace('.', '_')
-                    rcc_kwargs = {'input': rcc_file,
-                                  'output': name + '.cpp',
-                                  'command': [self.rcc, '-name', '@BASENAME@', '-o', '@OUTPUT@', rcc_extra_arguments, '@INPUT@'],
-                                  'depend_files': qrc_deps}
-                    if self.rcc_supports_depfiles:
-                        rcc_kwargs['depfile'] = name + '.d'
-                        rcc_kwargs['command'] += ['--depfile', '@DEPFILE@']
-                    res_target = build.CustomTarget(name, state.subdir, state.subproject, rcc_kwargs)
-                    sources.append(res_target)
-        if ui_files:
-            if not self.uic.found():
-                raise MesonException(err_msg.format('UIC', 'uic-qt{}'.format(self.qt_version), self.qt_version))
-            arguments = uic_extra_arguments + ['-o', '@OUTPUT@', '@INPUT@']
-            ui_kwargs = {'output': 'ui_@BASENAME@.h',
-                         'arguments': arguments}
-            ui_gen = build.Generator([self.uic], ui_kwargs)
-            ui_output = ui_gen.process_files('Qt{} ui'.format(self.qt_version), ui_files, state)
-            sources.append(ui_output)
-        inc = get_include_args(include_dirs=include_directories)
-        compile_args = []
-        for dep in unholder(dependencies):
-            if isinstance(dep, Dependency):
-                for arg in dep.get_compile_args():
-                    if arg.startswith('-I') or arg.startswith('-D'):
-                        compile_args.append(arg)
-            else:
-                raise MesonException('Argument is of an unacceptable type {!r}.\nMust be '
-                                     'either an external dependency (returned by find_library() or '
-                                     'dependency()) or an internal dependency (returned by '
-                                     'declare_dependency()).'.format(type(dep).__name__))
-        if moc_headers:
-            arguments = moc_extra_arguments + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@']
-            moc_kwargs = {'output': 'moc_@BASENAME@.cpp',
-                          'arguments': arguments}
-            moc_gen = build.Generator([self.moc], moc_kwargs)
-            moc_output = moc_gen.process_files('Qt{} moc header'.format(self.qt_version), moc_headers, state)
-            sources.append(moc_output)
-        if moc_sources:
-            arguments = moc_extra_arguments + inc + compile_args + ['@INPUT@', '-o', '@OUTPUT@']
-            moc_kwargs = {'output': '@BASENAME@.moc',
-                          'arguments': arguments}
-            moc_gen = build.Generator([self.moc], moc_kwargs)
-            moc_output = moc_gen.process_files('Qt{} moc source'.format(self.qt_version), moc_sources, state)
-            sources.append(moc_output)
-        return ModuleReturnValue(sources, sources)
-
-    @FeatureNew('qt.compile_translations', '0.44.0')
-    @permittedKwargs({'ts_files', 'install', 'install_dir', 'build_by_default', 'method'})
-    def compile_translations(self, state, args, kwargs):
-        ts_files, install_dir = [extract_as_list(kwargs, c, pop=True) for c in  ['ts_files', 'install_dir']]
-        self._detect_tools(state.environment, kwargs.get('method', 'auto'))
-        translations = []
-        for ts in ts_files:
-            if not self.lrelease.found():
-                raise MesonException('qt.compile_translations: ' +
-                                     self.lrelease.name + ' not found')
-            cmd = [self.lrelease, '@INPUT@', '-qm', '@OUTPUT@']
-            lrelease_kwargs = {'output': '@BASENAME@.qm',
-                               'input': ts,
-                               'install': kwargs.get('install', False),
-                               'build_by_default': kwargs.get('build_by_default', False),
-                               'command': cmd}
-            if install_dir is not None:
-                lrelease_kwargs['install_dir'] = install_dir
-            lrelease_target = build.CustomTarget('qt{}-compile-{}'.format(self.qt_version, ts), state.subdir, state.subproject, lrelease_kwargs)
-            translations.append(lrelease_target)
-        return ModuleReturnValue(translations, translations)
diff --git a/meson/mesonbuild/modules/qt4.py b/meson/mesonbuild/modules/qt4.py
deleted file mode 100644 (file)
index e85a150..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .qt import QtBaseModule
-
-
-class Qt4Module(QtBaseModule):
-
-    def __init__(self, interpreter):
-        QtBaseModule.__init__(self, interpreter, qt_version=4)
-
-
-def initialize(*args, **kwargs):
-    return Qt4Module(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/qt5.py b/meson/mesonbuild/modules/qt5.py
deleted file mode 100644 (file)
index 873c2db..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .qt import QtBaseModule
-
-
-class Qt5Module(QtBaseModule):
-
-    def __init__(self, interpreter):
-        QtBaseModule.__init__(self, interpreter, qt_version=5)
-
-
-def initialize(*args, **kwargs):
-    return Qt5Module(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/rpm.py b/meson/mesonbuild/modules/rpm.py
deleted file mode 100644 (file)
index 073e338..0000000
+++ /dev/null
@@ -1,181 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''This module provides helper functions for RPM related
-functionality such as generating template RPM spec file.'''
-
-from .. import build
-from .. import compilers
-import datetime
-from .. import mlog
-from . import GirTarget, TypelibTarget
-from . import ModuleReturnValue
-from . import ExtensionModule
-from ..interpreterbase import noKwargs
-
-import os
-
-class RPMModule(ExtensionModule):
-
-    @noKwargs
-    def generate_spec_template(self, coredata, args, kwargs):
-        self.coredata = coredata
-        required_compilers = self.__get_required_compilers()
-        proj = coredata.project_name.replace(' ', '_').replace('\t', '_')
-        so_installed = False
-        devel_subpkg = False
-        files = set()
-        files_devel = set()
-        to_delete = set()
-        for target in coredata.targets.values():
-            if isinstance(target, build.Executable) and target.need_install:
-                files.add('%%{_bindir}/%s' % target.get_filename())
-            elif isinstance(target, build.SharedLibrary) and target.need_install:
-                files.add('%%{_libdir}/%s' % target.get_filename())
-                for alias in target.get_aliases():
-                    if alias.endswith('.so'):
-                        files_devel.add('%%{_libdir}/%s' % alias)
-                    else:
-                        files.add('%%{_libdir}/%s' % alias)
-                so_installed = True
-            elif isinstance(target, build.StaticLibrary) and target.need_install:
-                to_delete.add('%%{buildroot}%%{_libdir}/%s' % target.get_filename())
-                mlog.warning('removing', mlog.bold(target.get_filename()),
-                             'from package because packaging static libs not recommended')
-            elif isinstance(target, GirTarget) and target.should_install():
-                files_devel.add('%%{_datadir}/gir-1.0/%s' % target.get_filename()[0])
-            elif isinstance(target, TypelibTarget) and target.should_install():
-                files.add('%%{_libdir}/girepository-1.0/%s' % target.get_filename()[0])
-        for header in coredata.headers:
-            if header.get_install_subdir():
-                files_devel.add('%%{_includedir}/%s/' % header.get_install_subdir())
-            else:
-                for hdr_src in header.get_sources():
-                    files_devel.add('%%{_includedir}/%s' % hdr_src)
-        for man in coredata.man:
-            for man_file in man.get_sources():
-                files.add('%%{_mandir}/man%u/%s.*' % (int(man_file.split('.')[-1]), man_file))
-        if files_devel:
-            devel_subpkg = True
-
-        filename = os.path.join(coredata.environment.get_build_dir(),
-                                '%s.spec' % proj)
-        with open(filename, 'w+') as fn:
-            fn.write('Name: %s\n' % proj)
-            fn.write('Version: # FIXME\n')
-            fn.write('Release: 1%{?dist}\n')
-            fn.write('Summary: # FIXME\n')
-            fn.write('License: # FIXME\n')
-            fn.write('\n')
-            fn.write('Source0: %{name}-%{version}.tar.xz # FIXME\n')
-            fn.write('\n')
-            fn.write('BuildRequires: meson\n')
-            for compiler in required_compilers:
-                fn.write('BuildRequires: %s\n' % compiler)
-            for dep in coredata.environment.coredata.deps.host:
-                fn.write('BuildRequires: pkgconfig(%s)\n' % dep[0])
-#   ext_libs and ext_progs have been removed from coredata so the following code
-#   no longer works. It is kept as a reminder of the idea should anyone wish
-#   to re-implement it.
-#
-#            for lib in state.environment.coredata.ext_libs.values():
-#                name = lib.get_name()
-#                fn.write('BuildRequires: {} # FIXME\n'.format(name))
-#                mlog.warning('replace', mlog.bold(name), 'with the real package.',
-#                             'You can use following command to find package which '
-#                             'contains this lib:',
-#                             mlog.bold("dnf provides '*/lib{}.so'".format(name)))
-#            for prog in state.environment.coredata.ext_progs.values():
-#                if not prog.found():
-#                    fn.write('BuildRequires: %%{_bindir}/%s # FIXME\n' %
-#                             prog.get_name())
-#                else:
-#                    fn.write('BuildRequires: {}\n'.format(prog.get_path()))
-            fn.write('\n')
-            fn.write('%description\n')
-            fn.write('\n')
-            if devel_subpkg:
-                fn.write('%package devel\n')
-                fn.write('Summary: Development files for %{name}\n')
-                fn.write('Requires: %{name}%{?_isa} = %{?epoch:%{epoch}:}{version}-%{release}\n')
-                fn.write('\n')
-                fn.write('%description devel\n')
-                fn.write('Development files for %{name}.\n')
-                fn.write('\n')
-            fn.write('%prep\n')
-            fn.write('%autosetup\n')
-            fn.write('\n')
-            fn.write('%build\n')
-            fn.write('%meson\n')
-            fn.write('%meson_build\n')
-            fn.write('\n')
-            fn.write('%install\n')
-            fn.write('%meson_install\n')
-            if to_delete:
-                fn.write('rm -vf %s\n' % ' '.join(to_delete))
-            fn.write('\n')
-            fn.write('%check\n')
-            fn.write('%meson_test\n')
-            fn.write('\n')
-            fn.write('%files\n')
-            for f in files:
-                fn.write('%s\n' % f)
-            fn.write('\n')
-            if devel_subpkg:
-                fn.write('%files devel\n')
-                for f in files_devel:
-                    fn.write('%s\n' % f)
-                fn.write('\n')
-            if so_installed:
-                fn.write('%post -p /sbin/ldconfig\n')
-                fn.write('%postun -p /sbin/ldconfig\n')
-            fn.write('\n')
-            fn.write('%changelog\n')
-            fn.write('* %s meson <meson@example.com> - \n' %
-                     datetime.date.today().strftime('%a %b %d %Y'))
-            fn.write('- \n')
-            fn.write('\n')
-        mlog.log('RPM spec template written to %s.spec.\n' % proj)
-        return ModuleReturnValue(None, [])
-
-    def __get_required_compilers(self):
-        required_compilers = set()
-        for compiler in self.coredata.environment.coredata.compilers.host.values():
-            # Elbrus has one 'lcc' package for every compiler
-            if isinstance(compiler, compilers.GnuCCompiler):
-                required_compilers.add('gcc')
-            elif isinstance(compiler, compilers.GnuCPPCompiler):
-                required_compilers.add('gcc-c++')
-            elif isinstance(compiler, compilers.ElbrusCCompiler):
-                required_compilers.add('lcc')
-            elif isinstance(compiler, compilers.ElbrusCPPCompiler):
-                required_compilers.add('lcc')
-            elif isinstance(compiler, compilers.ElbrusFortranCompiler):
-                required_compilers.add('lcc')
-            elif isinstance(compiler, compilers.ValaCompiler):
-                required_compilers.add('vala')
-            elif isinstance(compiler, compilers.GnuFortranCompiler):
-                required_compilers.add('gcc-gfortran')
-            elif isinstance(compiler, compilers.GnuObjCCompiler):
-                required_compilers.add('gcc-objc')
-            elif compiler == compilers.GnuObjCPPCompiler:
-                required_compilers.add('gcc-objc++')
-            else:
-                mlog.log('RPM spec file not created, generation not allowed for:',
-                         mlog.bold(compiler.get_id()))
-        return required_compilers
-
-
-def initialize(*args, **kwargs):
-    return RPMModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/sourceset.py b/meson/mesonbuild/modules/sourceset.py
deleted file mode 100644 (file)
index e23e12e..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from collections import namedtuple
-from .. import mesonlib
-from ..mesonlib import listify
-from . import ExtensionModule
-from ..interpreterbase import (
-    noPosargs, noKwargs, permittedKwargs,
-    InterpreterObject, MutableInterpreterObject, ObjectHolder,
-    InterpreterException, InvalidArguments, InvalidCode, FeatureNew,
-)
-from ..interpreter import (
-    GeneratedListHolder, CustomTargetHolder,
-    CustomTargetIndexHolder
-)
-
-SourceSetRule = namedtuple('SourceSetRule', 'keys sources if_false sourcesets dependencies extra_deps')
-SourceFiles = namedtuple('SourceFiles', 'sources dependencies')
-
-class SourceSetHolder(MutableInterpreterObject, ObjectHolder):
-    def __init__(self, interpreter):
-        MutableInterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, list())
-        self.subproject = interpreter.subproject
-        self.environment = interpreter.environment
-        self.subdir = interpreter.subdir
-        self.frozen = False
-        self.methods.update({
-            'add': self.add_method,
-            'add_all': self.add_all_method,
-            'all_sources': self.all_sources_method,
-            'all_dependencies': self.all_dependencies_method,
-            'apply': self.apply_method,
-        })
-
-    def check_source_files(self, arg, allow_deps):
-        sources = []
-        deps = []
-        for x in arg:
-            if isinstance(x, (str, mesonlib.File,
-                              GeneratedListHolder, CustomTargetHolder,
-                              CustomTargetIndexHolder)):
-                sources.append(x)
-            elif hasattr(x, 'found'):
-                if not allow_deps:
-                    msg = 'Dependencies are not allowed in the if_false argument.'
-                    raise InvalidArguments(msg)
-                deps.append(x)
-            else:
-                msg = 'Sources must be strings or file-like objects.'
-                raise InvalidArguments(msg)
-        mesonlib.check_direntry_issues(sources)
-        return sources, deps
-
-    def check_conditions(self, arg):
-        keys = []
-        deps = []
-        for x in listify(arg):
-            if isinstance(x, str):
-                keys.append(x)
-            elif hasattr(x, 'found'):
-                deps.append(x)
-            else:
-                raise InvalidArguments('Conditions must be strings or dependency object')
-        return keys, deps
-
-    @permittedKwargs(['when', 'if_false', 'if_true'])
-    def add_method(self, args, kwargs):
-        if self.frozen:
-            raise InvalidCode('Tried to use \'add\' after querying the source set')
-        when = listify(kwargs.get('when', []))
-        if_true = listify(kwargs.get('if_true', []))
-        if_false = listify(kwargs.get('if_false', []))
-        if not when and not if_true and not if_false:
-            if_true = args
-        elif args:
-            raise InterpreterException('add called with both positional and keyword arguments')
-        keys, dependencies = self.check_conditions(when)
-        sources, extra_deps = self.check_source_files(if_true, True)
-        if_false, _ = self.check_source_files(if_false, False)
-        self.held_object.append(SourceSetRule(keys, sources, if_false, [], dependencies, extra_deps))
-
-    @permittedKwargs(['when', 'if_true'])
-    def add_all_method(self, args, kwargs):
-        if self.frozen:
-            raise InvalidCode('Tried to use \'add_all\' after querying the source set')
-        when = listify(kwargs.get('when', []))
-        if_true = listify(kwargs.get('if_true', []))
-        if not when and not if_true:
-            if_true = args
-        elif args:
-            raise InterpreterException('add_all called with both positional and keyword arguments')
-        keys, dependencies = self.check_conditions(when)
-        for s in if_true:
-            if not isinstance(s, SourceSetHolder):
-                raise InvalidCode('Arguments to \'add_all\' after the first must be source sets')
-            s.frozen = True
-        self.held_object.append(SourceSetRule(keys, [], [], if_true, dependencies, []))
-
-    def collect(self, enabled_fn, all_sources, into=None):
-        if not into:
-            into = SourceFiles(set(), set())
-        for entry in self.held_object:
-            if all(x.found() for x in entry.dependencies) and \
-               all(enabled_fn(key) for key in entry.keys):
-                into.sources.update(entry.sources)
-                into.dependencies.update(entry.dependencies)
-                into.dependencies.update(entry.extra_deps)
-                for ss in entry.sourcesets:
-                    ss.collect(enabled_fn, all_sources, into)
-                if not all_sources:
-                    continue
-            into.sources.update(entry.if_false)
-        return into
-
-    @noKwargs
-    @noPosargs
-    def all_sources_method(self, args, kwargs):
-        self.frozen = True
-        files = self.collect(lambda x: True, True)
-        return list(files.sources)
-
-    @noKwargs
-    @noPosargs
-    @FeatureNew('source_set.all_dependencies() method', '0.52.0')
-    def all_dependencies_method(self, args, kwargs):
-        self.frozen = True
-        files = self.collect(lambda x: True, True)
-        return list(files.dependencies)
-
-    @permittedKwargs(['strict'])
-    def apply_method(self, args, kwargs):
-        if len(args) != 1:
-            raise InterpreterException('Apply takes exactly one argument')
-        config_data = args[0]
-        self.frozen = True
-        strict = kwargs.get('strict', True)
-        if isinstance(config_data, dict):
-            def _get_from_config_data(key):
-                if strict and key not in config_data:
-                    raise InterpreterException('Entry {} not in configuration dictionary.'.format(key))
-                return config_data.get(key, False)
-        else:
-            config_cache = dict()
-
-            def _get_from_config_data(key):
-                nonlocal config_cache
-                if key not in config_cache:
-                    args = [key] if strict else [key, False]
-                    config_cache[key] = config_data.get_method(args, {})
-                return config_cache[key]
-
-        files = self.collect(_get_from_config_data, False)
-        res = SourceFilesHolder(files)
-        return res
-
-class SourceFilesHolder(InterpreterObject, ObjectHolder):
-    def __init__(self, files):
-        InterpreterObject.__init__(self)
-        ObjectHolder.__init__(self, files)
-        self.methods.update({
-            'sources': self.sources_method,
-            'dependencies': self.dependencies_method,
-        })
-
-    @noPosargs
-    @noKwargs
-    def sources_method(self, args, kwargs):
-        return list(self.held_object.sources)
-
-    @noPosargs
-    @noKwargs
-    def dependencies_method(self, args, kwargs):
-        return list(self.held_object.dependencies)
-
-class SourceSetModule(ExtensionModule):
-    @FeatureNew('SourceSet module', '0.51.0')
-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-        self.snippets.add('source_set')
-
-    @noKwargs
-    @noPosargs
-    def source_set(self, interpreter, state, args, kwargs):
-        return SourceSetHolder(interpreter)
-
-def initialize(*args, **kwargs):
-    return SourceSetModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/unstable_cuda.py b/meson/mesonbuild/modules/unstable_cuda.py
deleted file mode 100644 (file)
index 0d693c3..0000000
+++ /dev/null
@@ -1,271 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import re
-
-from ..mesonlib import version_compare
-from ..interpreter import CompilerHolder
-from ..compilers import CudaCompiler
-
-from . import ExtensionModule, ModuleReturnValue
-
-from ..interpreterbase import (
-    flatten, permittedKwargs, noKwargs,
-    InvalidArguments, FeatureNew
-)
-
-class CudaModule(ExtensionModule):
-
-    @FeatureNew('CUDA module', '0.50.0')
-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-
-    @noKwargs
-    def min_driver_version(self, state, args, kwargs):
-        argerror = InvalidArguments('min_driver_version must have exactly one positional argument: ' +
-                                    'an NVCC compiler object, or its version string.')
-
-        if len(args) != 1:
-            raise argerror
-        else:
-            cuda_version = self._version_from_compiler(args[0])
-            if cuda_version == 'unknown':
-                raise argerror
-
-        driver_version_table = [
-            {'cuda_version': '>=10.2.89',  'windows': '441.22', 'linux': '440.33'},
-            {'cuda_version': '>=10.1.105', 'windows': '418.96', 'linux': '418.39'},
-            {'cuda_version': '>=10.0.130', 'windows': '411.31', 'linux': '410.48'},
-            {'cuda_version': '>=9.2.148',  'windows': '398.26', 'linux': '396.37'},
-            {'cuda_version': '>=9.2.88',   'windows': '397.44', 'linux': '396.26'},
-            {'cuda_version': '>=9.1.85',   'windows': '391.29', 'linux': '390.46'},
-            {'cuda_version': '>=9.0.76',   'windows': '385.54', 'linux': '384.81'},
-            {'cuda_version': '>=8.0.61',   'windows': '376.51', 'linux': '375.26'},
-            {'cuda_version': '>=8.0.44',   'windows': '369.30', 'linux': '367.48'},
-            {'cuda_version': '>=7.5.16',   'windows': '353.66', 'linux': '352.31'},
-            {'cuda_version': '>=7.0.28',   'windows': '347.62', 'linux': '346.46'},
-        ]
-
-        driver_version = 'unknown'
-        for d in driver_version_table:
-            if version_compare(cuda_version, d['cuda_version']):
-                driver_version = d.get(state.host_machine.system, d['linux'])
-                break
-
-        return ModuleReturnValue(driver_version, [driver_version])
-
-    @permittedKwargs(['detected'])
-    def nvcc_arch_flags(self, state, args, kwargs):
-        nvcc_arch_args = self._validate_nvcc_arch_args(state, args, kwargs)
-        ret = self._nvcc_arch_flags(*nvcc_arch_args)[0]
-        return ModuleReturnValue(ret, [ret])
-
-    @permittedKwargs(['detected'])
-    def nvcc_arch_readable(self, state, args, kwargs):
-        nvcc_arch_args = self._validate_nvcc_arch_args(state, args, kwargs)
-        ret = self._nvcc_arch_flags(*nvcc_arch_args)[1]
-        return ModuleReturnValue(ret, [ret])
-
-    @staticmethod
-    def _break_arch_string(s):
-        s = re.sub('[ \t\r\n,;]+', ';', s)
-        s = s.strip(';').split(';')
-        return s
-
-    @staticmethod
-    def _detected_cc_from_compiler(c):
-        if isinstance(c, CompilerHolder):
-            c = c.compiler
-        if isinstance(c, CudaCompiler):
-            return c.detected_cc
-        return ''
-
-    @staticmethod
-    def _version_from_compiler(c):
-        if isinstance(c, CompilerHolder):
-            c = c.compiler
-        if isinstance(c, CudaCompiler):
-            return c.version
-        if isinstance(c, str):
-            return c
-        return 'unknown'
-
-    def _validate_nvcc_arch_args(self, state, args, kwargs):
-        argerror = InvalidArguments('The first argument must be an NVCC compiler object, or its version string!')
-
-        if len(args) < 1:
-            raise argerror
-        else:
-            compiler = args[0]
-            cuda_version = self._version_from_compiler(compiler)
-            if cuda_version == 'unknown':
-                raise argerror
-
-        arch_list = [] if len(args) <= 1 else flatten(args[1:])
-        arch_list = [self._break_arch_string(a) for a in arch_list]
-        arch_list = flatten(arch_list)
-        if len(arch_list) > 1 and not set(arch_list).isdisjoint({'All', 'Common', 'Auto'}):
-            raise InvalidArguments('''The special architectures 'All', 'Common' and 'Auto' must appear alone, as a positional argument!''')
-        arch_list = arch_list[0] if len(arch_list) == 1 else arch_list
-
-        detected = kwargs.get('detected', self._detected_cc_from_compiler(compiler))
-        detected = flatten([detected])
-        detected = [self._break_arch_string(a) for a in detected]
-        detected = flatten(detected)
-        if not set(detected).isdisjoint({'All', 'Common', 'Auto'}):
-            raise InvalidArguments('''The special architectures 'All', 'Common' and 'Auto' must appear alone, as a positional argument!''')
-
-        return cuda_version, arch_list, detected
-
-    def _nvcc_arch_flags(self, cuda_version, cuda_arch_list='Auto', detected=''):
-        """
-        Using the CUDA Toolkit version (the NVCC version) and the target
-        architectures, compute the NVCC architecture flags.
-        """
-
-        cuda_known_gpu_architectures  = ['Fermi', 'Kepler', 'Maxwell']  # noqa: E221
-        cuda_common_gpu_architectures = ['3.0', '3.5', '5.0']           # noqa: E221
-        cuda_limit_gpu_architecture   = None                            # noqa: E221
-        cuda_all_gpu_architectures    = ['3.0', '3.2', '3.5', '5.0']    # noqa: E221
-
-        if version_compare(cuda_version, '<7.0'):
-            cuda_limit_gpu_architecture = '5.2'
-
-        if version_compare(cuda_version, '>=7.0'):
-            cuda_known_gpu_architectures  += ['Kepler+Tegra', 'Kepler+Tesla', 'Maxwell+Tegra']  # noqa: E221
-            cuda_common_gpu_architectures += ['5.2']                                            # noqa: E221
-
-            if version_compare(cuda_version, '<8.0'):
-                cuda_common_gpu_architectures += ['5.2+PTX']  # noqa: E221
-                cuda_limit_gpu_architecture    = '6.0'        # noqa: E221
-
-        if version_compare(cuda_version, '>=8.0'):
-            cuda_known_gpu_architectures  += ['Pascal', 'Pascal+Tegra']  # noqa: E221
-            cuda_common_gpu_architectures += ['6.0', '6.1']              # noqa: E221
-            cuda_all_gpu_architectures    += ['6.0', '6.1', '6.2']       # noqa: E221
-
-            if version_compare(cuda_version, '<9.0'):
-                cuda_common_gpu_architectures += ['6.1+PTX']  # noqa: E221
-                cuda_limit_gpu_architecture    = '7.0'        # noqa: E221
-
-        if version_compare(cuda_version, '>=9.0'):
-            cuda_known_gpu_architectures  += ['Volta', 'Xavier']                   # noqa: E221
-            cuda_common_gpu_architectures += ['7.0', '7.0+PTX']                    # noqa: E221
-            cuda_all_gpu_architectures    += ['7.0', '7.0+PTX', '7.2', '7.2+PTX']  # noqa: E221
-
-            if version_compare(cuda_version, '<10.0'):
-                cuda_limit_gpu_architecture = '7.5'
-
-        if version_compare(cuda_version, '>=10.0'):
-            cuda_known_gpu_architectures  += ['Turing']          # noqa: E221
-            cuda_common_gpu_architectures += ['7.5', '7.5+PTX']  # noqa: E221
-            cuda_all_gpu_architectures    += ['7.5', '7.5+PTX']  # noqa: E221
-
-            if version_compare(cuda_version, '<11.0'):
-                cuda_limit_gpu_architecture = '8.0'
-
-        if not cuda_arch_list:
-            cuda_arch_list = 'Auto'
-
-        if   cuda_arch_list == 'All':     # noqa: E271
-            cuda_arch_list = cuda_known_gpu_architectures
-        elif cuda_arch_list == 'Common':  # noqa: E271
-            cuda_arch_list = cuda_common_gpu_architectures
-        elif cuda_arch_list == 'Auto':    # noqa: E271
-            if detected:
-                if isinstance(detected, list):
-                    cuda_arch_list = detected
-                else:
-                    cuda_arch_list = self._break_arch_string(detected)
-
-                if cuda_limit_gpu_architecture:
-                    filtered_cuda_arch_list = []
-                    for arch in cuda_arch_list:
-                        if arch:
-                            if version_compare(arch, '>=' + cuda_limit_gpu_architecture):
-                                arch = cuda_common_gpu_architectures[-1]
-                            if arch not in filtered_cuda_arch_list:
-                                filtered_cuda_arch_list.append(arch)
-                    cuda_arch_list = filtered_cuda_arch_list
-            else:
-                cuda_arch_list = cuda_common_gpu_architectures
-        elif isinstance(cuda_arch_list, str):
-            cuda_arch_list = self._break_arch_string(cuda_arch_list)
-
-        cuda_arch_list = sorted([x for x in set(cuda_arch_list) if x])
-
-        cuda_arch_bin = []
-        cuda_arch_ptx = []
-        for arch_name in cuda_arch_list:
-            arch_bin = []
-            arch_ptx = []
-            add_ptx = arch_name.endswith('+PTX')
-            if add_ptx:
-                arch_name = arch_name[:-len('+PTX')]
-
-            if re.fullmatch('[0-9]+\\.[0-9](\\([0-9]+\\.[0-9]\\))?', arch_name):
-                arch_bin, arch_ptx = [arch_name], [arch_name]
-            else:
-                arch_bin, arch_ptx = {
-                    'Fermi':         (['2.0', '2.1(2.0)'], []),
-                    'Kepler+Tegra':  (['3.2'],             []),
-                    'Kepler+Tesla':  (['3.7'],             []),
-                    'Kepler':        (['3.0', '3.5'],      ['3.5']),
-                    'Maxwell+Tegra': (['5.3'],             []),
-                    'Maxwell':       (['5.0', '5.2'],      ['5.2']),
-                    'Pascal':        (['6.0', '6.1'],      ['6.1']),
-                    'Pascal+Tegra':  (['6.2'],             []),
-                    'Volta':         (['7.0'],             ['7.0']),
-                    'Xavier':        (['7.2'],             []),
-                    'Turing':        (['7.5'],             ['7.5']),
-                }.get(arch_name, (None, None))
-
-            if arch_bin is None:
-                raise InvalidArguments('Unknown CUDA Architecture Name {}!'
-                                       .format(arch_name))
-
-            cuda_arch_bin += arch_bin
-
-            if add_ptx:
-                if not arch_ptx:
-                    arch_ptx = arch_bin
-                cuda_arch_ptx += arch_ptx
-
-        cuda_arch_bin = re.sub('\\.', '', ' '.join(cuda_arch_bin))
-        cuda_arch_ptx = re.sub('\\.', '', ' '.join(cuda_arch_ptx))
-        cuda_arch_bin = re.findall('[0-9()]+', cuda_arch_bin)
-        cuda_arch_ptx = re.findall('[0-9]+',   cuda_arch_ptx)
-        cuda_arch_bin = sorted(list(set(cuda_arch_bin)))
-        cuda_arch_ptx = sorted(list(set(cuda_arch_ptx)))
-
-        nvcc_flags = []
-        nvcc_archs_readable = []
-
-        for arch in cuda_arch_bin:
-            m = re.match('([0-9]+)\\(([0-9]+)\\)', arch)
-            if m:
-                nvcc_flags += ['-gencode', 'arch=compute_' + m[2] + ',code=sm_' + m[1]]
-                nvcc_archs_readable += ['sm_' + m[1]]
-            else:
-                nvcc_flags += ['-gencode', 'arch=compute_' + arch + ',code=sm_' + arch]
-                nvcc_archs_readable += ['sm_' + arch]
-
-        for arch in cuda_arch_ptx:
-            nvcc_flags += ['-gencode', 'arch=compute_' + arch + ',code=compute_' + arch]
-            nvcc_archs_readable += ['compute_' + arch]
-
-        return nvcc_flags, nvcc_archs_readable
-
-def initialize(*args, **kwargs):
-    return CudaModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/unstable_icestorm.py b/meson/mesonbuild/modules/unstable_icestorm.py
deleted file mode 100644 (file)
index 268c394..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .. import mesonlib
-from ..interpreterbase import flatten
-from ..interpreterbase import FeatureNew
-
-from . import ExtensionModule
-
-class IceStormModule(ExtensionModule):
-
-    @FeatureNew('FPGA/Icestorm Module', '0.45.0')
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.snippets.add('project')
-        self.yosys_bin = None
-
-    def detect_binaries(self, interpreter):
-        self.yosys_bin = interpreter.find_program_impl(['yosys'])
-        self.arachne_bin = interpreter.find_program_impl(['arachne-pnr'])
-        self.icepack_bin = interpreter.find_program_impl(['icepack'])
-        self.iceprog_bin = interpreter.find_program_impl(['iceprog'])
-        self.icetime_bin = interpreter.find_program_impl(['icetime'])
-
-    def project(self, interpreter, state, args, kwargs):
-        if not self.yosys_bin:
-            self.detect_binaries(interpreter)
-        if not args:
-            raise mesonlib.MesonException('Project requires at least one argument, which is the project name.')
-        proj_name = args[0]
-        arg_sources = args[1:]
-        if not isinstance(proj_name, str):
-            raise mesonlib.MesonException('Argument must be a string.')
-        kwarg_sources = kwargs.get('sources', [])
-        if not isinstance(kwarg_sources, list):
-            kwarg_sources = [kwarg_sources]
-        all_sources = interpreter.source_strings_to_files(flatten(arg_sources + kwarg_sources))
-        if 'constraint_file' not in kwargs:
-            raise mesonlib.MesonException('Constraint file not specified.')
-
-        constraint_file = interpreter.source_strings_to_files(kwargs['constraint_file'])
-        if len(constraint_file) != 1:
-            raise mesonlib.MesonException('Constraint file must contain one and only one entry.')
-        blif_name = proj_name + '_blif'
-        blif_fname = proj_name + '.blif'
-        asc_name = proj_name + '_asc'
-        asc_fname = proj_name + '.asc'
-        bin_name = proj_name + '_bin'
-        bin_fname = proj_name + '.bin'
-        time_name = proj_name + '-time'
-        upload_name = proj_name + '-upload'
-
-        blif_target = interpreter.func_custom_target(None, [blif_name], {
-            'input': all_sources,
-            'output': blif_fname,
-            'command': [self.yosys_bin, '-q', '-p', 'synth_ice40 -blif @OUTPUT@', '@INPUT@']})
-
-        asc_target = interpreter.func_custom_target(None, [asc_name], {
-            'input': blif_target,
-            'output': asc_fname,
-            'command': [self.arachne_bin, '-q', '-d', '1k', '-p', constraint_file, '@INPUT@', '-o', '@OUTPUT@']})
-
-        bin_target = interpreter.func_custom_target(None, [bin_name], {
-            'input': asc_target,
-            'output': bin_fname,
-            'command': [self.icepack_bin, '@INPUT@', '@OUTPUT@'],
-            'build_by_default': True})
-
-        interpreter.func_run_target(None, [upload_name], {
-            'command': [self.iceprog_bin, bin_target]})
-
-        interpreter.func_run_target(None, [time_name], {
-            'command': [self.icetime_bin, bin_target]})
-
-def initialize(*args, **kwargs):
-    return IceStormModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/unstable_keyval.py b/meson/mesonbuild/modules/unstable_keyval.py
deleted file mode 100644 (file)
index 3da2992..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-# Copyright 2017, 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from . import ExtensionModule
-
-from .. import mesonlib
-from ..mesonlib import typeslistify
-from ..interpreterbase import FeatureNew, noKwargs
-from ..interpreter import InvalidCode
-
-import os
-
-class KeyvalModule(ExtensionModule):
-
-    @FeatureNew('Keyval Module', '0.55.0')
-    def __init__(self, *args, **kwargs):
-        super().__init__(*args, **kwargs)
-        self.snippets.add('load')
-
-    def _load_file(self, path_to_config):
-        result = dict()
-        try:
-            with open(path_to_config) as f:
-                for line in f:
-                    if '#' in line:
-                        comment_idx = line.index('#')
-                        line = line[:comment_idx]
-                    line = line.strip()
-                    try:
-                        name, val = line.split('=', 1)
-                    except ValueError:
-                        continue
-                    result[name.strip()] = val.strip()
-        except IOError as e:
-            raise mesonlib.MesonException('Failed to load {}: {}'.format(path_to_config, e))
-
-        return result
-
-    @noKwargs
-    def load(self, interpreter, state, args, kwargs):
-        sources = typeslistify(args, (str, mesonlib.File))
-        if len(sources) != 1:
-            raise InvalidCode('load takes only one file input.')
-
-        s = sources[0]
-        is_built = False
-        if isinstance(s, mesonlib.File):
-            is_built = is_built or s.is_built
-            s = s.absolute_path(interpreter.environment.source_dir, interpreter.environment.build_dir)
-        else:
-            s = os.path.join(interpreter.environment.source_dir, s)
-
-        if s not in interpreter.build_def_files and not is_built:
-            interpreter.build_def_files.append(s)
-
-        return self._load_file(s)
-
-
-def initialize(*args, **kwargs):
-    return KeyvalModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/unstable_simd.py b/meson/mesonbuild/modules/unstable_simd.py
deleted file mode 100644 (file)
index 4c066fb..0000000
+++ /dev/null
@@ -1,86 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .. import mesonlib, compilers, mlog
-
-from . import ExtensionModule
-
-from ..interpreterbase import FeatureNew
-
-class SimdModule(ExtensionModule):
-
-    @FeatureNew('SIMD module', '0.42.0')
-    def __init__(self, interpreter):
-        super().__init__(interpreter)
-        self.snippets.add('check')
-        # FIXME add Altivec and AVX512.
-        self.isets = ('mmx',
-                      'sse',
-                      'sse2',
-                      'sse3',
-                      'ssse3',
-                      'sse41',
-                      'sse42',
-                      'avx',
-                      'avx2',
-                      'neon',
-                      )
-
-    def check(self, interpreter, state, args, kwargs):
-        result = []
-        if len(args) != 1:
-            raise mesonlib.MesonException('Check requires one argument, a name prefix for checks.')
-        prefix = args[0]
-        if not isinstance(prefix, str):
-            raise mesonlib.MesonException('Argument must be a string.')
-        if 'compiler' not in kwargs:
-            raise mesonlib.MesonException('Must specify compiler keyword')
-        if 'sources' in kwargs:
-            raise mesonlib.MesonException('SIMD module does not support the "sources" keyword')
-        basic_kwargs = {}
-        for key, value in kwargs.items():
-            if key not in self.isets and key != 'compiler':
-                basic_kwargs[key] = value
-        compiler = kwargs['compiler'].compiler
-        if not isinstance(compiler, compilers.compilers.Compiler):
-            raise mesonlib.MesonException('Compiler argument must be a compiler object.')
-        cdata = interpreter.func_configuration_data(None, [], {})
-        conf = cdata.held_object
-        for iset in self.isets:
-            if iset not in kwargs:
-                continue
-            iset_fname = kwargs[iset] # Might also be an array or Files. static_library will validate.
-            args = compiler.get_instruction_set_args(iset)
-            if args is None:
-                mlog.log('Compiler supports %s:' % iset, mlog.red('NO'))
-                continue
-            if args:
-                if not compiler.has_multi_arguments(args, state.environment)[0]:
-                    mlog.log('Compiler supports %s:' % iset, mlog.red('NO'))
-                    continue
-            mlog.log('Compiler supports %s:' % iset, mlog.green('YES'))
-            conf.values['HAVE_' + iset.upper()] = ('1', 'Compiler supports %s.' % iset)
-            libname = prefix + '_' + iset
-            lib_kwargs = {'sources': iset_fname,
-                          }
-            lib_kwargs.update(basic_kwargs)
-            langarg_key = compiler.get_language() + '_args'
-            old_lang_args = mesonlib.extract_as_list(lib_kwargs, langarg_key)
-            all_lang_args = old_lang_args + args
-            lib_kwargs[langarg_key] = all_lang_args
-            result.append(interpreter.func_static_lib(None, [libname], lib_kwargs))
-        return [result, cdata]
-
-def initialize(*args, **kwargs):
-    return SimdModule(*args, **kwargs)
diff --git a/meson/mesonbuild/modules/windows.py b/meson/mesonbuild/modules/windows.py
deleted file mode 100644 (file)
index 6050705..0000000
+++ /dev/null
@@ -1,159 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import enum
-import os
-import re
-
-from .. import mlog
-from .. import mesonlib, build
-from ..mesonlib import MachineChoice, MesonException, extract_as_list, unholder
-from . import get_include_args
-from . import ModuleReturnValue
-from . import ExtensionModule
-from ..interpreter import CustomTargetHolder
-from ..interpreterbase import permittedKwargs, FeatureNewKwargs, flatten
-from ..dependencies import ExternalProgram
-
-class ResourceCompilerType(enum.Enum):
-    windres = 1
-    rc = 2
-
-class WindowsModule(ExtensionModule):
-
-    def detect_compiler(self, compilers):
-        for l in ('c', 'cpp'):
-            if l in compilers:
-                return compilers[l]
-        raise MesonException('Resource compilation requires a C or C++ compiler.')
-
-    def _find_resource_compiler(self, state):
-        # FIXME: Does not handle `native: true` executables, see
-        # See https://github.com/mesonbuild/meson/issues/1531
-        # Take a parameter instead of the hardcoded definition below
-        for_machine = MachineChoice.HOST
-
-        if hasattr(self, '_rescomp'):
-            return self._rescomp
-
-        # Will try cross / native file and then env var
-        rescomp = ExternalProgram.from_bin_list(state.environment, for_machine, 'windres')
-
-        if not rescomp or not rescomp.found():
-            comp = self.detect_compiler(state.environment.coredata.compilers[for_machine])
-            if comp.id in {'msvc', 'clang-cl', 'intel-cl'}:
-                rescomp = ExternalProgram('rc', silent=True)
-            else:
-                rescomp = ExternalProgram('windres', silent=True)
-
-        if not rescomp.found():
-            raise MesonException('Could not find Windows resource compiler')
-
-        for (arg, match, rc_type) in [
-                ('/?', '^.*Microsoft.*Resource Compiler.*$', ResourceCompilerType.rc),
-                ('--version', '^.*GNU windres.*$', ResourceCompilerType.windres),
-        ]:
-            p, o, e = mesonlib.Popen_safe(rescomp.get_command() + [arg])
-            m = re.search(match, o, re.MULTILINE)
-            if m:
-                mlog.log('Windows resource compiler: %s' % m.group())
-                self._rescomp = (rescomp, rc_type)
-                break
-        else:
-            raise MesonException('Could not determine type of Windows resource compiler')
-
-        return self._rescomp
-
-    @FeatureNewKwargs('windows.compile_resources', '0.47.0', ['depend_files', 'depends'])
-    @permittedKwargs({'args', 'include_directories', 'depend_files', 'depends'})
-    def compile_resources(self, state, args, kwargs):
-        extra_args = mesonlib.stringlistify(flatten(kwargs.get('args', [])))
-        wrc_depend_files = extract_as_list(kwargs, 'depend_files', pop = True)
-        wrc_depends = extract_as_list(kwargs, 'depends', pop = True)
-        for d in wrc_depends:
-            if isinstance(d, CustomTargetHolder):
-                extra_args += get_include_args([d.outdir_include()])
-        inc_dirs = extract_as_list(kwargs, 'include_directories', pop = True)
-        for incd in inc_dirs:
-            if not isinstance(incd.held_object, (str, build.IncludeDirs)):
-                raise MesonException('Resource include dirs should be include_directories().')
-        extra_args += get_include_args(inc_dirs)
-
-        rescomp, rescomp_type = self._find_resource_compiler(state)
-        if rescomp_type == ResourceCompilerType.rc:
-            # RC is used to generate .res files, a special binary resource
-            # format, which can be passed directly to LINK (apparently LINK uses
-            # CVTRES internally to convert this to a COFF object)
-            suffix = 'res'
-            res_args = extra_args + ['/nologo', '/fo@OUTPUT@', '@INPUT@']
-        else:
-            # ld only supports object files, so windres is used to generate a
-            # COFF object
-            suffix = 'o'
-            res_args = extra_args + ['@INPUT@', '@OUTPUT@']
-
-            m = 'Argument {!r} has a space which may not work with windres due to ' \
-                'a MinGW bug: https://sourceware.org/bugzilla/show_bug.cgi?id=4933'
-            for arg in extra_args:
-                if ' ' in arg:
-                    mlog.warning(m.format(arg), fatal=False)
-
-        res_targets = []
-
-        def add_target(src):
-            if isinstance(src, list):
-                for subsrc in src:
-                    add_target(subsrc)
-                return
-            src = unholder(src)
-
-            if isinstance(src, str):
-                name_format = 'file {!r}'
-                name = os.path.join(state.subdir, src)
-            elif isinstance(src, mesonlib.File):
-                name_format = 'file {!r}'
-                name = src.relative_name()
-            elif isinstance(src, build.CustomTarget):
-                if len(src.get_outputs()) > 1:
-                    raise MesonException('windows.compile_resources does not accept custom targets with more than 1 output.')
-
-                name_format = 'target {!r}'
-                name = src.get_id()
-            else:
-                raise MesonException('Unexpected source type {!r}. windows.compile_resources accepts only strings, files, custom targets, and lists thereof.'.format(src))
-
-            # Path separators are not allowed in target names
-            name = name.replace('/', '_').replace('\\', '_')
-
-            res_kwargs = {
-                'output': name + '_@BASENAME@.' + suffix,
-                'input': [src],
-                'command': [rescomp] + res_args,
-                'depend_files': wrc_depend_files,
-                'depends': wrc_depends,
-            }
-
-            # instruct binutils windres to generate a preprocessor depfile
-            if rescomp_type == ResourceCompilerType.windres:
-                res_kwargs['depfile'] = res_kwargs['output'] + '.d'
-                res_kwargs['command'] += ['--preprocessor-arg=-MD', '--preprocessor-arg=-MQ@OUTPUT@', '--preprocessor-arg=-MF@DEPFILE@']
-
-            res_targets.append(build.CustomTarget('Windows resource for ' + name_format.format(name), state.subdir, state.subproject, res_kwargs))
-
-        add_target(args)
-
-        return ModuleReturnValue(res_targets, [res_targets])
-
-def initialize(*args, **kwargs):
-    return WindowsModule(*args, **kwargs)
diff --git a/meson/mesonbuild/mparser.py b/meson/mesonbuild/mparser.py
deleted file mode 100644 (file)
index b9e381e..0000000
+++ /dev/null
@@ -1,792 +0,0 @@
-# Copyright 2014-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import re
-import codecs
-import textwrap
-import types
-import typing as T
-from .mesonlib import MesonException
-from . import mlog
-
-if T.TYPE_CHECKING:
-    from .ast import AstVisitor
-
-# This is the regex for the supported escape sequences of a regular string
-# literal, like 'abc\x00'
-ESCAPE_SEQUENCE_SINGLE_RE = re.compile(r'''
-    ( \\U[A-Fa-f0-9]{8}   # 8-digit hex escapes
-    | \\u[A-Fa-f0-9]{4}   # 4-digit hex escapes
-    | \\x[A-Fa-f0-9]{2}   # 2-digit hex escapes
-    | \\[0-7]{1,3}        # Octal escapes
-    | \\N\{[^}]+\}        # Unicode characters by name
-    | \\[\\'abfnrtv]      # Single-character escapes
-    )''', re.UNICODE | re.VERBOSE)
-
-class MesonUnicodeDecodeError(MesonException):
-    def __init__(self, match):
-        super().__init__("%s" % match)
-        self.match = match
-
-def decode_match(match):
-    try:
-        return codecs.decode(match.group(0), 'unicode_escape')
-    except UnicodeDecodeError:
-        raise MesonUnicodeDecodeError(match.group(0))
-
-class ParseException(MesonException):
-    def __init__(self, text, line, lineno, colno):
-        # Format as error message, followed by the line with the error, followed by a caret to show the error column.
-        super().__init__("%s\n%s\n%s" % (text, line, '%s^' % (' ' * colno)))
-        self.lineno = lineno
-        self.colno = colno
-
-class BlockParseException(MesonException):
-    def __init__(self, text, line, lineno, colno, start_line, start_lineno, start_colno):
-        # This can be formatted in two ways - one if the block start and end are on the same line, and a different way if they are on different lines.
-
-        if lineno == start_lineno:
-            # If block start and end are on the same line, it is formatted as:
-            # Error message
-            # Followed by the line with the error
-            # Followed by a caret to show the block start
-            # Followed by underscores
-            # Followed by a caret to show the block end.
-            super().__init__("%s\n%s\n%s" % (text, line, '%s^%s^' % (' ' * start_colno, '_' * (colno - start_colno - 1))))
-        else:
-            # If block start and end are on different lines, it is formatted as:
-            # Error message
-            # Followed by the line with the error
-            # Followed by a caret to show the error column.
-            # Followed by a message saying where the block started.
-            # Followed by the line of the block start.
-            # Followed by a caret for the block start.
-            super().__init__("%s\n%s\n%s\nFor a block that started at %d,%d\n%s\n%s" % (text, line, '%s^' % (' ' * colno), start_lineno, start_colno, start_line, "%s^" % (' ' * start_colno)))
-        self.lineno = lineno
-        self.colno = colno
-
-TV_TokenTypes = T.TypeVar('TV_TokenTypes', int, str, bool)
-
-class Token(T.Generic[TV_TokenTypes]):
-    def __init__(self, tid: str, filename: str, line_start: int, lineno: int, colno: int, bytespan: T.Tuple[int, int], value: TV_TokenTypes):
-        self.tid = tid                # type: str
-        self.filename = filename      # type: str
-        self.line_start = line_start  # type: int
-        self.lineno = lineno          # type: int
-        self.colno = colno            # type: int
-        self.bytespan = bytespan      # type: T.Tuple[int, int]
-        self.value = value            # type: TV_TokenTypes
-
-    def __eq__(self, other) -> bool:
-        if isinstance(other, str):
-            return self.tid == other
-        return self.tid == other.tid
-
-class Lexer:
-    def __init__(self, code: str):
-        self.code = code
-        self.keywords = {'true', 'false', 'if', 'else', 'elif',
-                         'endif', 'and', 'or', 'not', 'foreach', 'endforeach',
-                         'in', 'continue', 'break'}
-        self.future_keywords = {'return'}
-        self.token_specification = [
-            # Need to be sorted longest to shortest.
-            ('ignore', re.compile(r'[ \t]')),
-            ('id', re.compile('[_a-zA-Z][_0-9a-zA-Z]*')),
-            ('number', re.compile(r'0[bB][01]+|0[oO][0-7]+|0[xX][0-9a-fA-F]+|0|[1-9]\d*')),
-            ('eol_cont', re.compile(r'\\\n')),
-            ('eol', re.compile(r'\n')),
-            ('multiline_string', re.compile(r"'''(.|\n)*?'''", re.M)),
-            ('comment', re.compile(r'#.*')),
-            ('lparen', re.compile(r'\(')),
-            ('rparen', re.compile(r'\)')),
-            ('lbracket', re.compile(r'\[')),
-            ('rbracket', re.compile(r'\]')),
-            ('lcurl', re.compile(r'\{')),
-            ('rcurl', re.compile(r'\}')),
-            ('dblquote', re.compile(r'"')),
-            ('string', re.compile(r"'([^'\\]|(\\.))*'")),
-            ('comma', re.compile(r',')),
-            ('plusassign', re.compile(r'\+=')),
-            ('dot', re.compile(r'\.')),
-            ('plus', re.compile(r'\+')),
-            ('dash', re.compile(r'-')),
-            ('star', re.compile(r'\*')),
-            ('percent', re.compile(r'%')),
-            ('fslash', re.compile(r'/')),
-            ('colon', re.compile(r':')),
-            ('equal', re.compile(r'==')),
-            ('nequal', re.compile(r'!=')),
-            ('assign', re.compile(r'=')),
-            ('le', re.compile(r'<=')),
-            ('lt', re.compile(r'<')),
-            ('ge', re.compile(r'>=')),
-            ('gt', re.compile(r'>')),
-            ('questionmark', re.compile(r'\?')),
-        ]
-
-    def getline(self, line_start: int) -> str:
-        return self.code[line_start:self.code.find('\n', line_start)]
-
-    def lex(self, filename: str) -> T.Generator[Token, None, None]:
-        line_start = 0
-        lineno = 1
-        loc = 0
-        par_count = 0
-        bracket_count = 0
-        curl_count = 0
-        col = 0
-        while loc < len(self.code):
-            matched = False
-            value = None  # type: T.Union[str, bool, int]
-            for (tid, reg) in self.token_specification:
-                mo = reg.match(self.code, loc)
-                if mo:
-                    curline = lineno
-                    curline_start = line_start
-                    col = mo.start() - line_start
-                    matched = True
-                    span_start = loc
-                    loc = mo.end()
-                    span_end = loc
-                    bytespan = (span_start, span_end)
-                    match_text = mo.group()
-                    if tid == 'ignore' or tid == 'comment':
-                        break
-                    elif tid == 'lparen':
-                        par_count += 1
-                    elif tid == 'rparen':
-                        par_count -= 1
-                    elif tid == 'lbracket':
-                        bracket_count += 1
-                    elif tid == 'rbracket':
-                        bracket_count -= 1
-                    elif tid == 'lcurl':
-                        curl_count += 1
-                    elif tid == 'rcurl':
-                        curl_count -= 1
-                    elif tid == 'dblquote':
-                        raise ParseException('Double quotes are not supported. Use single quotes.', self.getline(line_start), lineno, col)
-                    elif tid == 'string':
-                        # Handle here and not on the regexp to give a better error message.
-                        if match_text.find("\n") != -1:
-                            mlog.warning(textwrap.dedent("""\
-                                    Newline character in a string detected, use ''' (three single quotes) for multiline strings instead.
-                                    This will become a hard error in a future Meson release.\
-                                """),
-                                self.getline(line_start),
-                                str(lineno),
-                                str(col)
-                            )
-                        value = match_text[1:-1]
-                        try:
-                            value = ESCAPE_SEQUENCE_SINGLE_RE.sub(decode_match, value)
-                        except MesonUnicodeDecodeError as err:
-                            raise MesonException("Failed to parse escape sequence: '{}' in string:\n  {}".format(err.match, match_text))
-                    elif tid == 'multiline_string':
-                        tid = 'string'
-                        value = match_text[3:-3]
-                        lines = match_text.split('\n')
-                        if len(lines) > 1:
-                            lineno += len(lines) - 1
-                            line_start = mo.end() - len(lines[-1])
-                    elif tid == 'number':
-                        value = int(match_text, base=0)
-                    elif tid == 'eol_cont':
-                        lineno += 1
-                        line_start = loc
-                        break
-                    elif tid == 'eol':
-                        lineno += 1
-                        line_start = loc
-                        if par_count > 0 or bracket_count > 0 or curl_count > 0:
-                            break
-                    elif tid == 'id':
-                        if match_text in self.keywords:
-                            tid = match_text
-                        else:
-                            if match_text in self.future_keywords:
-                                mlog.warning("Identifier '{}' will become a reserved keyword in a future release. Please rename it.".format(match_text),
-                                             location=types.SimpleNamespace(filename=filename, lineno=lineno))
-                            value = match_text
-                    yield Token(tid, filename, curline_start, curline, col, bytespan, value)
-                    break
-            if not matched:
-                raise ParseException('lexer', self.getline(line_start), lineno, col)
-
-class BaseNode:
-    def __init__(self, lineno: int, colno: int, filename: str, end_lineno: T.Optional[int] = None, end_colno: T.Optional[int] = None):
-        self.lineno = lineno      # type: int
-        self.colno = colno        # type: int
-        self.filename = filename  # type: str
-        self.end_lineno = end_lineno if end_lineno is not None else self.lineno
-        self.end_colno = end_colno if end_colno is not None else self.colno
-
-        # Attributes for the visitors
-        self.level = 0            # type: int
-        self.ast_id = ''          # type: str
-        self.condition_level = 0  # type: int
-
-    def accept(self, visitor: 'AstVisitor') -> None:
-        fname = 'visit_{}'.format(type(self).__name__)
-        if hasattr(visitor, fname):
-            func = getattr(visitor, fname)
-            if callable(func):
-                func(self)
-
-class ElementaryNode(T.Generic[TV_TokenTypes], BaseNode):
-    def __init__(self, token: Token[TV_TokenTypes]):
-        super().__init__(token.lineno, token.colno, token.filename)
-        self.value = token.value        # type: TV_TokenTypes
-        self.bytespan = token.bytespan  # type: T.Tuple[int, int]
-
-class BooleanNode(ElementaryNode[bool]):
-    def __init__(self, token: Token[bool]):
-        super().__init__(token)
-        assert isinstance(self.value, bool)
-
-class IdNode(ElementaryNode[str]):
-    def __init__(self, token: Token[str]):
-        super().__init__(token)
-        assert isinstance(self.value, str)
-
-    def __str__(self):
-        return "Id node: '%s' (%d, %d)." % (self.value, self.lineno, self.colno)
-
-class NumberNode(ElementaryNode[int]):
-    def __init__(self, token: Token[int]):
-        super().__init__(token)
-        assert isinstance(self.value, int)
-
-class StringNode(ElementaryNode[str]):
-    def __init__(self, token: Token[str]):
-        super().__init__(token)
-        assert isinstance(self.value, str)
-
-    def __str__(self):
-        return "String node: '%s' (%d, %d)." % (self.value, self.lineno, self.colno)
-
-class ContinueNode(ElementaryNode):
-    pass
-
-class BreakNode(ElementaryNode):
-    pass
-
-class ArgumentNode(BaseNode):
-    def __init__(self, token: Token[TV_TokenTypes]):
-        super().__init__(token.lineno, token.colno, token.filename)
-        self.arguments = []  # type: T.List[BaseNode]
-        self.commas = []     # type: T.List[Token[TV_TokenTypes]]
-        self.kwargs = {}     # type: T.Dict[BaseNode, BaseNode]
-        self.order_error = False
-
-    def prepend(self, statement: BaseNode) -> None:
-        if self.num_kwargs() > 0:
-            self.order_error = True
-        if not isinstance(statement, EmptyNode):
-            self.arguments = [statement] + self.arguments
-
-    def append(self, statement: BaseNode) -> None:
-        if self.num_kwargs() > 0:
-            self.order_error = True
-        if not isinstance(statement, EmptyNode):
-            self.arguments += [statement]
-
-    def set_kwarg(self, name: IdNode, value: BaseNode) -> None:
-        if name.value in [x.value for x in self.kwargs.keys() if isinstance(x, IdNode)]:
-            mlog.warning('Keyword argument "{}" defined multiple times.'.format(name.value), location=self)
-            mlog.warning('This will be an error in future Meson releases.')
-        self.kwargs[name] = value
-
-    def set_kwarg_no_check(self, name: BaseNode, value: BaseNode) -> None:
-        self.kwargs[name] = value
-
-    def num_args(self) -> int:
-        return len(self.arguments)
-
-    def num_kwargs(self) -> int:
-        return len(self.kwargs)
-
-    def incorrect_order(self) -> bool:
-        return self.order_error
-
-    def __len__(self) -> int:
-        return self.num_args() # Fixme
-
-class ArrayNode(BaseNode):
-    def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int):
-        super().__init__(lineno, colno, args.filename, end_lineno=end_lineno, end_colno=end_colno)
-        self.args = args              # type: ArgumentNode
-
-class DictNode(BaseNode):
-    def __init__(self, args: ArgumentNode, lineno: int, colno: int, end_lineno: int, end_colno: int):
-        super().__init__(lineno, colno, args.filename, end_lineno=end_lineno, end_colno=end_colno)
-        self.args = args
-
-class EmptyNode(BaseNode):
-    def __init__(self, lineno: int, colno: int, filename: str):
-        super().__init__(lineno, colno, filename)
-        self.value = None
-
-class OrNode(BaseNode):
-    def __init__(self, left: BaseNode, right: BaseNode):
-        super().__init__(left.lineno, left.colno, left.filename)
-        self.left = left    # type: BaseNode
-        self.right = right  # type: BaseNode
-
-class AndNode(BaseNode):
-    def __init__(self, left: BaseNode, right: BaseNode):
-        super().__init__(left.lineno, left.colno, left.filename)
-        self.left = left    # type: BaseNode
-        self.right = right  # type: BaseNode
-
-class ComparisonNode(BaseNode):
-    def __init__(self, ctype: str, left: BaseNode, right: BaseNode):
-        super().__init__(left.lineno, left.colno, left.filename)
-        self.left = left    # type: BaseNode
-        self.right = right  # type: BaseNode
-        self.ctype = ctype  # type: str
-
-class ArithmeticNode(BaseNode):
-    def __init__(self, operation: str, left: BaseNode, right: BaseNode):
-        super().__init__(left.lineno, left.colno, left.filename)
-        self.left = left            # type: BaseNode
-        self.right = right          # type: BaseNode
-        self.operation = operation  # type: str
-
-class NotNode(BaseNode):
-    def __init__(self, token: Token[TV_TokenTypes], value: BaseNode):
-        super().__init__(token.lineno, token.colno, token.filename)
-        self.value = value  # type: BaseNode
-
-class CodeBlockNode(BaseNode):
-    def __init__(self, token: Token[TV_TokenTypes]):
-        super().__init__(token.lineno, token.colno, token.filename)
-        self.lines = []  # type: T.List[BaseNode]
-
-class IndexNode(BaseNode):
-    def __init__(self, iobject: BaseNode, index: BaseNode):
-        super().__init__(iobject.lineno, iobject.colno, iobject.filename)
-        self.iobject = iobject  # type: BaseNode
-        self.index = index      # type: BaseNode
-
-class MethodNode(BaseNode):
-    def __init__(self, filename: str, lineno: int, colno: int, source_object: BaseNode, name: str, args: ArgumentNode):
-        super().__init__(lineno, colno, filename)
-        self.source_object = source_object  # type: BaseNode
-        self.name = name                    # type: str
-        assert(isinstance(self.name, str))
-        self.args = args                    # type: ArgumentNode
-
-class FunctionNode(BaseNode):
-    def __init__(self, filename: str, lineno: int, colno: int, end_lineno: int, end_colno: int, func_name: str, args: ArgumentNode):
-        super().__init__(lineno, colno, filename, end_lineno=end_lineno, end_colno=end_colno)
-        self.func_name = func_name  # type: str
-        assert(isinstance(func_name, str))
-        self.args = args  # type: ArgumentNode
-
-class AssignmentNode(BaseNode):
-    def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode):
-        super().__init__(lineno, colno, filename)
-        self.var_name = var_name  # type: str
-        assert(isinstance(var_name, str))
-        self.value = value  # type: BaseNode
-
-class PlusAssignmentNode(BaseNode):
-    def __init__(self, filename: str, lineno: int, colno: int, var_name: str, value: BaseNode):
-        super().__init__(lineno, colno, filename)
-        self.var_name = var_name  # type: str
-        assert(isinstance(var_name, str))
-        self.value = value  # type: BaseNode
-
-class ForeachClauseNode(BaseNode):
-    def __init__(self, token: Token, varnames: T.List[str], items: BaseNode, block: CodeBlockNode):
-        super().__init__(token.lineno, token.colno, token.filename)
-        self.varnames = varnames  # type: T.List[str]
-        self.items = items        # type: BaseNode
-        self.block = block        # type: CodeBlockNode
-
-class IfNode(BaseNode):
-    def __init__(self, linenode: BaseNode, condition: BaseNode, block: CodeBlockNode):
-        super().__init__(linenode.lineno, linenode.colno, linenode.filename)
-        self.condition = condition  # type: BaseNode
-        self.block = block          # type: CodeBlockNode
-
-class IfClauseNode(BaseNode):
-    def __init__(self, linenode: BaseNode):
-        super().__init__(linenode.lineno, linenode.colno, linenode.filename)
-        self.ifs = []          # type: T.List[IfNode]
-        self.elseblock = None  # type: T.Union[EmptyNode, CodeBlockNode]
-
-class UMinusNode(BaseNode):
-    def __init__(self, current_location: Token, value: BaseNode):
-        super().__init__(current_location.lineno, current_location.colno, current_location.filename)
-        self.value = value  # type: BaseNode
-
-class TernaryNode(BaseNode):
-    def __init__(self, condition: BaseNode, trueblock: BaseNode, falseblock: BaseNode):
-        super().__init__(condition.lineno, condition.colno, condition.filename)
-        self.condition = condition    # type: BaseNode
-        self.trueblock = trueblock    # type: BaseNode
-        self.falseblock = falseblock  # type: BaseNode
-
-comparison_map = {'equal': '==',
-                  'nequal': '!=',
-                  'lt': '<',
-                  'le': '<=',
-                  'gt': '>',
-                  'ge': '>=',
-                  'in': 'in',
-                  'notin': 'not in',
-                  }
-
-# Recursive descent parser for Meson's definition language.
-# Very basic apart from the fact that we have many precedence
-# levels so there are not enough words to describe them all.
-# Enter numbering:
-#
-# 1 assignment
-# 2 or
-# 3 and
-# 4 comparison
-# 5 arithmetic
-# 6 negation
-# 7 funcall, method call
-# 8 parentheses
-# 9 plain token
-
-class Parser:
-    def __init__(self, code: str, filename: str):
-        self.lexer = Lexer(code)
-        self.stream = self.lexer.lex(filename)
-        self.current = Token('eof', '', 0, 0, 0, (0, 0), None)  # type: Token
-        self.getsym()
-        self.in_ternary = False
-
-    def getsym(self) -> None:
-        try:
-            self.current = next(self.stream)
-        except StopIteration:
-            self.current = Token('eof', '', self.current.line_start, self.current.lineno, self.current.colno + self.current.bytespan[1] - self.current.bytespan[0], (0, 0), None)
-
-    def getline(self) -> str:
-        return self.lexer.getline(self.current.line_start)
-
-    def accept(self, s: str) -> bool:
-        if self.current.tid == s:
-            self.getsym()
-            return True
-        return False
-
-    def accept_any(self, tids: T.Sequence[str]) -> str:
-        tid = self.current.tid
-        if tid in tids:
-            self.getsym()
-            return tid
-        return ''
-
-    def expect(self, s: str) -> bool:
-        if self.accept(s):
-            return True
-        raise ParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno)
-
-    def block_expect(self, s: str, block_start: Token) -> bool:
-        if self.accept(s):
-            return True
-        raise BlockParseException('Expecting %s got %s.' % (s, self.current.tid), self.getline(), self.current.lineno, self.current.colno, self.lexer.getline(block_start.line_start), block_start.lineno, block_start.colno)
-
-    def parse(self) -> CodeBlockNode:
-        block = self.codeblock()
-        self.expect('eof')
-        return block
-
-    def statement(self) -> BaseNode:
-        return self.e1()
-
-    def e1(self) -> BaseNode:
-        left = self.e2()
-        if self.accept('plusassign'):
-            value = self.e1()
-            if not isinstance(left, IdNode):
-                raise ParseException('Plusassignment target must be an id.', self.getline(), left.lineno, left.colno)
-            assert isinstance(left.value, str)
-            return PlusAssignmentNode(left.filename, left.lineno, left.colno, left.value, value)
-        elif self.accept('assign'):
-            value = self.e1()
-            if not isinstance(left, IdNode):
-                raise ParseException('Assignment target must be an id.',
-                                     self.getline(), left.lineno, left.colno)
-            assert isinstance(left.value, str)
-            return AssignmentNode(left.filename, left.lineno, left.colno, left.value, value)
-        elif self.accept('questionmark'):
-            if self.in_ternary:
-                raise ParseException('Nested ternary operators are not allowed.',
-                                     self.getline(), left.lineno, left.colno)
-            self.in_ternary = True
-            trueblock = self.e1()
-            self.expect('colon')
-            falseblock = self.e1()
-            self.in_ternary = False
-            return TernaryNode(left, trueblock, falseblock)
-        return left
-
-    def e2(self) -> BaseNode:
-        left = self.e3()
-        while self.accept('or'):
-            if isinstance(left, EmptyNode):
-                raise ParseException('Invalid or clause.',
-                                     self.getline(), left.lineno, left.colno)
-            left = OrNode(left, self.e3())
-        return left
-
-    def e3(self) -> BaseNode:
-        left = self.e4()
-        while self.accept('and'):
-            if isinstance(left, EmptyNode):
-                raise ParseException('Invalid and clause.',
-                                     self.getline(), left.lineno, left.colno)
-            left = AndNode(left, self.e4())
-        return left
-
-    def e4(self) -> BaseNode:
-        left = self.e5()
-        for nodename, operator_type in comparison_map.items():
-            if self.accept(nodename):
-                return ComparisonNode(operator_type, left, self.e5())
-        if self.accept('not') and self.accept('in'):
-            return ComparisonNode('notin', left, self.e5())
-        return left
-
-    def e5(self) -> BaseNode:
-        return self.e5addsub()
-
-    def e5addsub(self) -> BaseNode:
-        op_map = {
-            'plus': 'add',
-            'dash': 'sub',
-        }
-        left = self.e5muldiv()
-        while True:
-            op = self.accept_any(tuple(op_map.keys()))
-            if op:
-                left = ArithmeticNode(op_map[op], left, self.e5muldiv())
-            else:
-                break
-        return left
-
-    def e5muldiv(self) -> BaseNode:
-        op_map = {
-            'percent': 'mod',
-            'star': 'mul',
-            'fslash': 'div',
-        }
-        left = self.e6()
-        while True:
-            op = self.accept_any(tuple(op_map.keys()))
-            if op:
-                left = ArithmeticNode(op_map[op], left, self.e6())
-            else:
-                break
-        return left
-
-    def e6(self) -> BaseNode:
-        if self.accept('not'):
-            return NotNode(self.current, self.e7())
-        if self.accept('dash'):
-            return UMinusNode(self.current, self.e7())
-        return self.e7()
-
-    def e7(self) -> BaseNode:
-        left = self.e8()
-        block_start = self.current
-        if self.accept('lparen'):
-            args = self.args()
-            self.block_expect('rparen', block_start)
-            if not isinstance(left, IdNode):
-                raise ParseException('Function call must be applied to plain id',
-                                     self.getline(), left.lineno, left.colno)
-            assert isinstance(left.value, str)
-            left = FunctionNode(left.filename, left.lineno, left.colno, self.current.lineno, self.current.colno, left.value, args)
-        go_again = True
-        while go_again:
-            go_again = False
-            if self.accept('dot'):
-                go_again = True
-                left = self.method_call(left)
-            if self.accept('lbracket'):
-                go_again = True
-                left = self.index_call(left)
-        return left
-
-    def e8(self) -> BaseNode:
-        block_start = self.current
-        if self.accept('lparen'):
-            e = self.statement()
-            self.block_expect('rparen', block_start)
-            return e
-        elif self.accept('lbracket'):
-            args = self.args()
-            self.block_expect('rbracket', block_start)
-            return ArrayNode(args, block_start.lineno, block_start.colno, self.current.lineno, self.current.colno)
-        elif self.accept('lcurl'):
-            key_values = self.key_values()
-            self.block_expect('rcurl', block_start)
-            return DictNode(key_values, block_start.lineno, block_start.colno, self.current.lineno, self.current.colno)
-        else:
-            return self.e9()
-
-    def e9(self) -> BaseNode:
-        t = self.current
-        if self.accept('true'):
-            t.value = True
-            return BooleanNode(t)
-        if self.accept('false'):
-            t.value = False
-            return BooleanNode(t)
-        if self.accept('id'):
-            return IdNode(t)
-        if self.accept('number'):
-            return NumberNode(t)
-        if self.accept('string'):
-            return StringNode(t)
-        return EmptyNode(self.current.lineno, self.current.colno, self.current.filename)
-
-    def key_values(self) -> ArgumentNode:
-        s = self.statement()  # type: BaseNode
-        a = ArgumentNode(self.current)
-
-        while not isinstance(s, EmptyNode):
-            if self.accept('colon'):
-                a.set_kwarg_no_check(s, self.statement())
-                potential = self.current
-                if not self.accept('comma'):
-                    return a
-                a.commas.append(potential)
-            else:
-                raise ParseException('Only key:value pairs are valid in dict construction.',
-                                     self.getline(), s.lineno, s.colno)
-            s = self.statement()
-        return a
-
-    def args(self) -> ArgumentNode:
-        s = self.statement()  # type: BaseNode
-        a = ArgumentNode(self.current)
-
-        while not isinstance(s, EmptyNode):
-            potential = self.current
-            if self.accept('comma'):
-                a.commas.append(potential)
-                a.append(s)
-            elif self.accept('colon'):
-                if not isinstance(s, IdNode):
-                    raise ParseException('Dictionary key must be a plain identifier.',
-                                         self.getline(), s.lineno, s.colno)
-                a.set_kwarg(s, self.statement())
-                potential = self.current
-                if not self.accept('comma'):
-                    return a
-                a.commas.append(potential)
-            else:
-                a.append(s)
-                return a
-            s = self.statement()
-        return a
-
-    def method_call(self, source_object) -> MethodNode:
-        methodname = self.e9()
-        if not(isinstance(methodname, IdNode)):
-            raise ParseException('Method name must be plain id',
-                                 self.getline(), self.current.lineno, self.current.colno)
-        assert isinstance(methodname.value, str)
-        self.expect('lparen')
-        args = self.args()
-        self.expect('rparen')
-        method = MethodNode(methodname.filename, methodname.lineno, methodname.colno, source_object, methodname.value, args)
-        if self.accept('dot'):
-            return self.method_call(method)
-        return method
-
-    def index_call(self, source_object) -> IndexNode:
-        index_statement = self.statement()
-        self.expect('rbracket')
-        return IndexNode(source_object, index_statement)
-
-    def foreachblock(self) -> ForeachClauseNode:
-        t = self.current
-        self.expect('id')
-        assert isinstance(t.value, str)
-        varname = t
-        varnames = [t.value]  # type: T.List[str]
-
-        if self.accept('comma'):
-            t = self.current
-            self.expect('id')
-            assert isinstance(t.value, str)
-            varnames.append(t.value)
-
-        self.expect('colon')
-        items = self.statement()
-        block = self.codeblock()
-        return ForeachClauseNode(varname, varnames, items, block)
-
-    def ifblock(self) -> IfClauseNode:
-        condition = self.statement()
-        clause = IfClauseNode(condition)
-        self.expect('eol')
-        block = self.codeblock()
-        clause.ifs.append(IfNode(clause, condition, block))
-        self.elseifblock(clause)
-        clause.elseblock = self.elseblock()
-        return clause
-
-    def elseifblock(self, clause) -> None:
-        while self.accept('elif'):
-            s = self.statement()
-            self.expect('eol')
-            b = self.codeblock()
-            clause.ifs.append(IfNode(s, s, b))
-
-    def elseblock(self) -> T.Union[CodeBlockNode, EmptyNode]:
-        if self.accept('else'):
-            self.expect('eol')
-            return self.codeblock()
-        return EmptyNode(self.current.lineno, self.current.colno, self.current.filename)
-
-    def line(self) -> BaseNode:
-        block_start = self.current
-        if self.current == 'eol':
-            return EmptyNode(self.current.lineno, self.current.colno, self.current.filename)
-        if self.accept('if'):
-            ifblock = self.ifblock()
-            self.block_expect('endif', block_start)
-            return ifblock
-        if self.accept('foreach'):
-            forblock = self.foreachblock()
-            self.block_expect('endforeach', block_start)
-            return forblock
-        if self.accept('continue'):
-            return ContinueNode(self.current)
-        if self.accept('break'):
-            return BreakNode(self.current)
-        return self.statement()
-
-    def codeblock(self) -> CodeBlockNode:
-        block = CodeBlockNode(self.current)
-        cond = True
-        while cond:
-            curline = self.line()
-            if not isinstance(curline, EmptyNode):
-                block.lines.append(curline)
-            cond = self.accept('eol')
-        return block
diff --git a/meson/mesonbuild/msetup.py b/meson/mesonbuild/msetup.py
deleted file mode 100644 (file)
index 2521511..0000000
+++ /dev/null
@@ -1,246 +0,0 @@
-# Copyright 2016-2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import typing as T
-import time
-import sys, stat
-import datetime
-import os.path
-import platform
-import cProfile as profile
-import argparse
-import tempfile
-import shutil
-import glob
-
-from . import environment, interpreter, mesonlib
-from . import build
-from . import mlog, coredata
-from . import mintro
-from .mconf import make_lower_case
-from .mesonlib import MesonException
-
-def add_arguments(parser):
-    coredata.register_builtin_arguments(parser)
-    parser.add_argument('--native-file',
-                        default=[],
-                        action='append',
-                        help='File containing overrides for native compilation environment.')
-    parser.add_argument('--cross-file',
-                        default=[],
-                        action='append',
-                        help='File describing cross compilation environment.')
-    parser.add_argument('-v', '--version', action='version',
-                        version=coredata.version)
-    parser.add_argument('--profile-self', action='store_true', dest='profile',
-                        help=argparse.SUPPRESS)
-    parser.add_argument('--fatal-meson-warnings', action='store_true', dest='fatal_warnings',
-                        help='Make all Meson warnings fatal')
-    parser.add_argument('--reconfigure', action='store_true',
-                        help='Set options and reconfigure the project. Useful when new ' +
-                             'options have been added to the project and the default value ' +
-                             'is not working.')
-    parser.add_argument('--wipe', action='store_true',
-                        help='Wipe build directory and reconfigure using previous command line options. ' +
-                             'Useful when build directory got corrupted, or when rebuilding with a ' +
-                             'newer version of meson.')
-    parser.add_argument('builddir', nargs='?', default=None)
-    parser.add_argument('sourcedir', nargs='?', default=None)
-
-class MesonApp:
-    def __init__(self, options):
-        (self.source_dir, self.build_dir) = self.validate_dirs(options.builddir,
-                                                               options.sourcedir,
-                                                               options.reconfigure,
-                                                               options.wipe)
-        if options.wipe:
-            # Make a copy of the cmd line file to make sure we can always
-            # restore that file if anything bad happens. For example if
-            # configuration fails we need to be able to wipe again.
-            restore = []
-            with tempfile.TemporaryDirectory() as d:
-                for filename in [coredata.get_cmd_line_file(self.build_dir)] + glob.glob(os.path.join(self.build_dir, environment.Environment.private_dir, '*.ini')):
-                    try:
-                        restore.append((shutil.copy(filename, d), filename))
-                    except FileNotFoundError:
-                        raise MesonException(
-                            'Cannot find cmd_line.txt. This is probably because this '
-                            'build directory was configured with a meson version < 0.49.0.')
-
-                coredata.read_cmd_line_file(self.build_dir, options)
-
-                try:
-                    # Don't delete the whole tree, just all of the files and
-                    # folders in the tree. Otherwise calling wipe form the builddir
-                    # will cause a crash
-                    for l in os.listdir(self.build_dir):
-                        l = os.path.join(self.build_dir, l)
-                        if os.path.isdir(l) and not os.path.islink(l):
-                            mesonlib.windows_proof_rmtree(l)
-                        else:
-                            mesonlib.windows_proof_rm(l)
-                finally:
-                    for b, f in restore:
-                        os.makedirs(os.path.dirname(f), exist_ok=True)
-                        shutil.move(b, f)
-
-        self.options = options
-
-    def has_build_file(self, dirname: str) -> bool:
-        fname = os.path.join(dirname, environment.build_filename)
-        return os.path.exists(fname)
-
-    def validate_core_dirs(self, dir1: str, dir2: str) -> T.Tuple[str, str]:
-        if dir1 is None:
-            if dir2 is None:
-                if not os.path.exists('meson.build') and os.path.exists('../meson.build'):
-                    dir2 = '..'
-                else:
-                    raise MesonException('Must specify at least one directory name.')
-            dir1 = os.getcwd()
-        if dir2 is None:
-            dir2 = os.getcwd()
-        ndir1 = os.path.abspath(os.path.realpath(dir1))
-        ndir2 = os.path.abspath(os.path.realpath(dir2))
-        if not os.path.exists(ndir1):
-            os.makedirs(ndir1)
-        if not os.path.exists(ndir2):
-            os.makedirs(ndir2)
-        if not stat.S_ISDIR(os.stat(ndir1).st_mode):
-            raise MesonException('{} is not a directory'.format(dir1))
-        if not stat.S_ISDIR(os.stat(ndir2).st_mode):
-            raise MesonException('{} is not a directory'.format(dir2))
-        if os.path.samefile(dir1, dir2):
-            raise MesonException('Source and build directories must not be the same. Create a pristine build directory.')
-        if self.has_build_file(ndir1):
-            if self.has_build_file(ndir2):
-                raise MesonException('Both directories contain a build file {}.'.format(environment.build_filename))
-            return ndir1, ndir2
-        if self.has_build_file(ndir2):
-            return ndir2, ndir1
-        raise MesonException('Neither directory contains a build file {}.'.format(environment.build_filename))
-
-    def validate_dirs(self, dir1: str, dir2: str, reconfigure: bool, wipe: bool) -> T.Tuple[str, str]:
-        (src_dir, build_dir) = self.validate_core_dirs(dir1, dir2)
-        priv_dir = os.path.join(build_dir, 'meson-private/coredata.dat')
-        if os.path.exists(priv_dir):
-            if not reconfigure and not wipe:
-                print('Directory already configured.\n'
-                      '\nJust run your build command (e.g. ninja) and Meson will regenerate as necessary.\n'
-                      'If ninja fails, run "ninja reconfigure" or "meson --reconfigure"\n'
-                      'to force Meson to regenerate.\n'
-                      '\nIf build failures persist, run "meson setup --wipe" to rebuild from scratch\n'
-                      'using the same options as passed when configuring the build.'
-                      '\nTo change option values, run "meson configure" instead.')
-                raise SystemExit
-        else:
-            has_cmd_line_file = os.path.exists(coredata.get_cmd_line_file(build_dir))
-            if (wipe and not has_cmd_line_file) or (not wipe and reconfigure):
-                raise SystemExit('Directory does not contain a valid build tree:\n{}'.format(build_dir))
-        return src_dir, build_dir
-
-    def generate(self):
-        env = environment.Environment(self.source_dir, self.build_dir, self.options)
-        mlog.initialize(env.get_log_dir(), self.options.fatal_warnings)
-        if self.options.profile:
-            mlog.set_timestamp_start(time.monotonic())
-        with mesonlib.BuildDirLock(self.build_dir):
-            self._generate(env)
-
-    def _generate(self, env):
-        mlog.debug('Build started at', datetime.datetime.now().isoformat())
-        mlog.debug('Main binary:', sys.executable)
-        mlog.debug('Build Options:', coredata.get_cmd_line_options(self.build_dir, self.options))
-        mlog.debug('Python system:', platform.system())
-        mlog.log(mlog.bold('The Meson build system'))
-        mlog.log('Version:', coredata.version)
-        mlog.log('Source dir:', mlog.bold(self.source_dir))
-        mlog.log('Build dir:', mlog.bold(self.build_dir))
-        if env.is_cross_build():
-            mlog.log('Build type:', mlog.bold('cross build'))
-        else:
-            mlog.log('Build type:', mlog.bold('native build'))
-        b = build.Build(env)
-
-        intr = interpreter.Interpreter(b)
-        if env.is_cross_build():
-            logger_fun = mlog.log
-        else:
-            logger_fun = mlog.debug
-        logger_fun('Build machine cpu family:', mlog.bold(intr.builtin['build_machine'].cpu_family_method([], {})))
-        logger_fun('Build machine cpu:', mlog.bold(intr.builtin['build_machine'].cpu_method([], {})))
-        mlog.log('Host machine cpu family:', mlog.bold(intr.builtin['host_machine'].cpu_family_method([], {})))
-        mlog.log('Host machine cpu:', mlog.bold(intr.builtin['host_machine'].cpu_method([], {})))
-        logger_fun('Target machine cpu family:', mlog.bold(intr.builtin['target_machine'].cpu_family_method([], {})))
-        logger_fun('Target machine cpu:', mlog.bold(intr.builtin['target_machine'].cpu_method([], {})))
-        try:
-            if self.options.profile:
-                fname = os.path.join(self.build_dir, 'meson-private', 'profile-interpreter.log')
-                profile.runctx('intr.run()', globals(), locals(), filename=fname)
-            else:
-                intr.run()
-        except Exception as e:
-            mintro.write_meson_info_file(b, [e])
-            raise
-        # Print all default option values that don't match the current value
-        for def_opt_name, def_opt_value, cur_opt_value in intr.get_non_matching_default_options():
-            mlog.log('Option', mlog.bold(def_opt_name), 'is:',
-                     mlog.bold('{}'.format(make_lower_case(cur_opt_value.printable_value()))),
-                     '[default: {}]'.format(make_lower_case(def_opt_value)))
-        try:
-            dumpfile = os.path.join(env.get_scratch_dir(), 'build.dat')
-            # We would like to write coredata as late as possible since we use the existence of
-            # this file to check if we generated the build file successfully. Since coredata
-            # includes settings, the build files must depend on it and appear newer. However, due
-            # to various kernel caches, we cannot guarantee that any time in Python is exactly in
-            # sync with the time that gets applied to any files. Thus, we dump this file as late as
-            # possible, but before build files, and if any error occurs, delete it.
-            cdf = env.dump_coredata()
-            if self.options.profile:
-                fname = 'profile-{}-backend.log'.format(intr.backend.name)
-                fname = os.path.join(self.build_dir, 'meson-private', fname)
-                profile.runctx('intr.backend.generate()', globals(), locals(), filename=fname)
-            else:
-                intr.backend.generate()
-            build.save(b, dumpfile)
-            if env.first_invocation:
-                coredata.write_cmd_line_file(self.build_dir, self.options)
-            else:
-                coredata.update_cmd_line_file(self.build_dir, self.options)
-
-            # Generate an IDE introspection file with the same syntax as the already existing API
-            if self.options.profile:
-                fname = os.path.join(self.build_dir, 'meson-private', 'profile-introspector.log')
-                profile.runctx('mintro.generate_introspection_file(b, intr.backend)', globals(), locals(), filename=fname)
-            else:
-                mintro.generate_introspection_file(b, intr.backend)
-            mintro.write_meson_info_file(b, [], True)
-
-            # Post-conf scripts must be run after writing coredata or else introspection fails.
-            intr.backend.run_postconf_scripts()
-        except Exception as e:
-            mintro.write_meson_info_file(b, [e])
-            if 'cdf' in locals():
-                old_cdf = cdf + '.prev'
-                if os.path.exists(old_cdf):
-                    os.replace(old_cdf, cdf)
-                else:
-                    os.unlink(cdf)
-            raise
-
-def run(options) -> int:
-    coredata.parse_cmd_line_options(options)
-    app = MesonApp(options)
-    app.generate()
-    return 0
diff --git a/meson/mesonbuild/msubprojects.py b/meson/mesonbuild/msubprojects.py
deleted file mode 100755 (executable)
index 9a8b0cf..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-import os, subprocess
-import argparse
-
-from . import mlog
-from .mesonlib import git, Popen_safe
-from .wrap.wrap import API_ROOT, PackageDefinition, Resolver, WrapException
-from .wrap import wraptool
-
-def update_wrapdb_file(wrap, repo_dir, options):
-    patch_url = wrap.get('patch_url')
-    branch, revision = wraptool.parse_patch_url(patch_url)
-    new_branch, new_revision = wraptool.get_latest_version(wrap.name)
-    if new_branch == branch and new_revision == revision:
-        mlog.log('  -> Up to date.')
-        return
-    wraptool.update_wrap_file(wrap.filename, wrap.name, new_branch, new_revision)
-    msg = ['  -> New wrap file downloaded.']
-    # Meson reconfigure won't use the new wrap file as long as the source
-    # directory exists. We don't delete it ourself to avoid data loss in case
-    # user has changes in their copy.
-    if os.path.isdir(repo_dir):
-        msg += ['To use it, delete', mlog.bold(repo_dir), 'and run', mlog.bold('meson --reconfigure')]
-    mlog.log(*msg)
-
-def update_file(wrap, repo_dir, options):
-    patch_url = wrap.values.get('patch_url', '')
-    if patch_url.startswith(API_ROOT):
-        update_wrapdb_file(wrap, repo_dir, options)
-    elif not os.path.isdir(repo_dir):
-        # The subproject is not needed, or it is a tarball extracted in
-        # 'libfoo-1.0' directory and the version has been bumped and the new
-        # directory is 'libfoo-2.0'. In that case forcing a meson
-        # reconfigure will download and use the new tarball.
-        mlog.log('  -> Subproject has not been checked out. Run', mlog.bold('meson --reconfigure'), 'to fetch it if needed.')
-    else:
-        # The subproject has not changed, or the new source and/or patch
-        # tarballs should be extracted in the same directory than previous
-        # version.
-        mlog.log('  -> Subproject has not changed, or the new source/patch needs to be extracted on the same location.\n' +
-                 '     In that case, delete', mlog.bold(repo_dir), 'and run', mlog.bold('meson --reconfigure'))
-
-def git_output(cmd, workingdir):
-    return git(cmd, workingdir, check=True, universal_newlines=True,
-               stdout=subprocess.PIPE, stderr=subprocess.STDOUT).stdout
-
-def git_show(repo_dir):
-    commit_message = git_output(['show', '--quiet', '--pretty=format:%h%n%d%n%s%n[%an]'], repo_dir)
-    parts = [s.strip() for s in commit_message.split('\n')]
-    mlog.log('  ->', mlog.yellow(parts[0]), mlog.red(parts[1]), parts[2], mlog.blue(parts[3]))
-
-def update_git(wrap, repo_dir, options):
-    if not os.path.isdir(repo_dir):
-        mlog.log('  -> Not used.')
-        return
-    revision = wrap.get('revision')
-    ret = git_output(['rev-parse', '--abbrev-ref', 'HEAD'], repo_dir).strip()
-    if ret == 'HEAD':
-        try:
-            # We are currently in detached mode, just checkout the new revision
-            git_output(['fetch'], repo_dir)
-            git_output(['checkout', revision], repo_dir)
-        except subprocess.CalledProcessError as e:
-            out = e.output.strip()
-            mlog.log('  -> Could not checkout revision', mlog.cyan(revision))
-            mlog.log(mlog.red(out))
-            mlog.log(mlog.red(str(e)))
-            return
-    elif ret == revision:
-        try:
-            # We are in the same branch, pull latest commits
-            git_output(['-c', 'rebase.autoStash=true', 'pull', '--rebase'], repo_dir)
-        except subprocess.CalledProcessError as e:
-            out = e.output.strip()
-            mlog.log('  -> Could not rebase', mlog.bold(repo_dir), 'please fix and try again.')
-            mlog.log(mlog.red(out))
-            mlog.log(mlog.red(str(e)))
-            return
-    else:
-        # We are in another branch, probably user created their own branch and
-        # we should rebase it on top of wrap's branch.
-        if options.rebase:
-            try:
-                git_output(['fetch'], repo_dir)
-                git_output(['-c', 'rebase.autoStash=true', 'rebase', revision], repo_dir)
-            except subprocess.CalledProcessError as e:
-                out = e.output.strip()
-                mlog.log('  -> Could not rebase', mlog.bold(repo_dir), 'please fix and try again.')
-                mlog.log(mlog.red(out))
-                mlog.log(mlog.red(str(e)))
-                return
-        else:
-            mlog.log('  -> Target revision is', mlog.bold(revision), 'but currently in branch is', mlog.bold(ret), '\n' +
-                     '     To rebase your branch on top of', mlog.bold(revision), 'use', mlog.bold('--rebase'), 'option.')
-            return
-
-    git_output(['submodule', 'update', '--checkout', '--recursive'], repo_dir)
-    git_show(repo_dir)
-
-def update_hg(wrap, repo_dir, options):
-    if not os.path.isdir(repo_dir):
-        mlog.log('  -> Not used.')
-        return
-    revno = wrap.get('revision')
-    if revno.lower() == 'tip':
-        # Failure to do pull is not a fatal error,
-        # because otherwise you can't develop without
-        # a working net connection.
-        subprocess.call(['hg', 'pull'], cwd=repo_dir)
-    else:
-        if subprocess.call(['hg', 'checkout', revno], cwd=repo_dir) != 0:
-            subprocess.check_call(['hg', 'pull'], cwd=repo_dir)
-            subprocess.check_call(['hg', 'checkout', revno], cwd=repo_dir)
-
-def update_svn(wrap, repo_dir, options):
-    if not os.path.isdir(repo_dir):
-        mlog.log('  -> Not used.')
-        return
-    revno = wrap.get('revision')
-    p, out, _ = Popen_safe(['svn', 'info', '--show-item', 'revision', repo_dir])
-    current_revno = out
-    if current_revno == revno:
-        return
-    if revno.lower() == 'head':
-        # Failure to do pull is not a fatal error,
-        # because otherwise you can't develop without
-        # a working net connection.
-        subprocess.call(['svn', 'update'], cwd=repo_dir)
-    else:
-        subprocess.check_call(['svn', 'update', '-r', revno], cwd=repo_dir)
-
-def update(wrap, repo_dir, options):
-    mlog.log('Updating {}...'.format(wrap.name))
-    if wrap.type == 'file':
-        update_file(wrap, repo_dir, options)
-    elif wrap.type == 'git':
-        update_git(wrap, repo_dir, options)
-    elif wrap.type == 'hg':
-        update_hg(wrap, repo_dir, options)
-    elif wrap.type == 'svn':
-        update_svn(wrap, repo_dir, options)
-    else:
-        mlog.log('  -> Cannot update', wrap.type, 'subproject')
-
-def checkout(wrap, repo_dir, options):
-    if wrap.type != 'git' or not os.path.isdir(repo_dir):
-        return
-    branch_name = options.branch_name if options.branch_name else wrap.get('revision')
-    cmd = ['checkout', branch_name, '--']
-    if options.b:
-        cmd.insert(1, '-b')
-    mlog.log('Checkout {} in {}...'.format(branch_name, wrap.name))
-    try:
-        git_output(cmd, repo_dir)
-        git_show(repo_dir)
-    except subprocess.CalledProcessError as e:
-        out = e.output.strip()
-        mlog.log('  -> ', mlog.red(out))
-
-def download(wrap, repo_dir, options):
-    mlog.log('Download {}...'.format(wrap.name))
-    if os.path.isdir(repo_dir):
-        mlog.log('  -> Already downloaded')
-        return
-    try:
-        r = Resolver(os.path.dirname(repo_dir))
-        r.resolve(wrap.name, 'meson')
-        mlog.log('  -> done')
-    except WrapException as e:
-        mlog.log('  ->', mlog.red(str(e)))
-
-def foreach(wrap, repo_dir, options):
-    mlog.log('Executing command in {}'.format(repo_dir))
-    if not os.path.isdir(repo_dir):
-        mlog.log('  -> Not downloaded yet')
-        return
-    try:
-        out = subprocess.check_output([options.command] + options.args,
-                                      stderr=subprocess.STDOUT,
-                                      cwd=repo_dir).decode()
-        mlog.log(out, end='')
-    except subprocess.CalledProcessError as e:
-        err_message = "Command '{}' returned non-zero exit status {}.".format(" ".join(e.cmd), e.returncode)
-        out = e.output.decode()
-        mlog.log('  -> ', mlog.red(err_message))
-        mlog.log(out, end='')
-    except Exception as e:
-        mlog.log('  -> ', mlog.red(str(e)))
-
-def add_common_arguments(p):
-    p.add_argument('--sourcedir', default='.',
-                   help='Path to source directory')
-    p.add_argument('subprojects', nargs='*',
-                   help='List of subprojects (default: all)')
-
-def add_arguments(parser):
-    subparsers = parser.add_subparsers(title='Commands', dest='command')
-    subparsers.required = True
-
-    p = subparsers.add_parser('update', help='Update all subprojects from wrap files')
-    p.add_argument('--rebase', default=False, action='store_true',
-                   help='Rebase your branch on top of wrap\'s revision (git only)')
-    add_common_arguments(p)
-    p.set_defaults(subprojects_func=update)
-
-    p = subparsers.add_parser('checkout', help='Checkout a branch (git only)')
-    p.add_argument('-b', default=False, action='store_true',
-                   help='Create a new branch')
-    p.add_argument('branch_name', nargs='?',
-                   help='Name of the branch to checkout or create (default: revision set in wrap file)')
-    add_common_arguments(p)
-    p.set_defaults(subprojects_func=checkout)
-
-    p = subparsers.add_parser('download', help='Ensure subprojects are fetched, even if not in use. ' +
-                                               'Already downloaded subprojects are not modified. ' +
-                                               'This can be used to pre-fetch all subprojects and avoid downloads during configure.')
-    add_common_arguments(p)
-    p.set_defaults(subprojects_func=download)
-
-    p = subparsers.add_parser('foreach', help='Execute a command in each subproject directory.')
-    p.add_argument('command', metavar='command ...',
-                   help='Command to execute in each subproject directory')
-    p.add_argument('args', nargs=argparse.REMAINDER,
-                   help=argparse.SUPPRESS)
-    p.add_argument('--sourcedir', default='.',
-                   help='Path to source directory')
-    p.set_defaults(subprojects_func=foreach)
-
-def run(options):
-    src_dir = os.path.relpath(os.path.realpath(options.sourcedir))
-    if not os.path.isfile(os.path.join(src_dir, 'meson.build')):
-        mlog.error('Directory', mlog.bold(src_dir), 'does not seem to be a Meson source directory.')
-        return 1
-    subprojects_dir = os.path.join(src_dir, 'subprojects')
-    if not os.path.isdir(subprojects_dir):
-        mlog.log('Directory', mlog.bold(src_dir), 'does not seem to have subprojects.')
-        return 0
-    files = []
-    if hasattr(options, 'subprojects'):
-        for name in options.subprojects:
-            f = os.path.join(subprojects_dir, name + '.wrap')
-            if not os.path.isfile(f):
-                mlog.error('Subproject', mlog.bold(name), 'not found.')
-                return 1
-            else:
-                files.append(f)
-    if not files:
-        for f in os.listdir(subprojects_dir):
-            if f.endswith('.wrap'):
-                files.append(os.path.join(subprojects_dir, f))
-    for f in files:
-        wrap = PackageDefinition(f)
-        directory = wrap.values.get('directory', wrap.name)
-        repo_dir = os.path.join(subprojects_dir, directory)
-        options.subprojects_func(wrap, repo_dir, options)
-    return 0
diff --git a/meson/mesonbuild/mtest.py b/meson/mesonbuild/mtest.py
deleted file mode 100644 (file)
index c28bdd2..0000000
+++ /dev/null
@@ -1,1234 +0,0 @@
-# Copyright 2016-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# A tool to run tests in many different ways.
-
-from pathlib import Path
-from collections import namedtuple
-from copy import deepcopy
-import argparse
-import concurrent.futures as conc
-import datetime
-import enum
-import io
-import json
-import multiprocessing
-import os
-import pickle
-import platform
-import random
-import re
-import signal
-import subprocess
-import sys
-import tempfile
-import textwrap
-import time
-import typing as T
-import xml.etree.ElementTree as et
-
-from . import build
-from . import environment
-from . import mlog
-from .dependencies import ExternalProgram
-from .mesonlib import MesonException, get_wine_shortpath, split_args, join_args
-from .backend.backends import TestProtocol
-
-if T.TYPE_CHECKING:
-    from .backend.backends import TestSerialisation
-
-# GNU autotools interprets a return code of 77 from tests it executes to
-# mean that the test should be skipped.
-GNU_SKIP_RETURNCODE = 77
-
-# GNU autotools interprets a return code of 99 from tests it executes to
-# mean that the test failed even before testing what it is supposed to test.
-GNU_ERROR_RETURNCODE = 99
-
-def is_windows() -> bool:
-    platname = platform.system().lower()
-    return platname == 'windows' or 'mingw' in platname
-
-def is_cygwin() -> bool:
-    platname = platform.system().lower()
-    return 'cygwin' in platname
-
-def determine_worker_count() -> int:
-    varname = 'MESON_TESTTHREADS'
-    if varname in os.environ:
-        try:
-            num_workers = int(os.environ[varname])
-        except ValueError:
-            print('Invalid value in {}, using 1 thread.'.format(varname))
-            num_workers = 1
-    else:
-        try:
-            # Fails in some weird environments such as Debian
-            # reproducible build.
-            num_workers = multiprocessing.cpu_count()
-        except Exception:
-            num_workers = 1
-    return num_workers
-
-def add_arguments(parser: argparse.ArgumentParser) -> None:
-    parser.add_argument('--repeat', default=1, dest='repeat', type=int,
-                        help='Number of times to run the tests.')
-    parser.add_argument('--no-rebuild', default=False, action='store_true',
-                        help='Do not rebuild before running tests.')
-    parser.add_argument('--gdb', default=False, dest='gdb', action='store_true',
-                        help='Run test under gdb.')
-    parser.add_argument('--gdb-path', default='gdb', dest='gdb_path',
-                        help='Path to the gdb binary (default: gdb).')
-    parser.add_argument('--list', default=False, dest='list', action='store_true',
-                        help='List available tests.')
-    parser.add_argument('--wrapper', default=None, dest='wrapper', type=split_args,
-                        help='wrapper to run tests with (e.g. Valgrind)')
-    parser.add_argument('-C', default='.', dest='wd',
-                        # https://github.com/python/typeshed/issues/3107
-                        # https://github.com/python/mypy/issues/7177
-                        type=os.path.abspath,  # type: ignore
-                        help='directory to cd into before running')
-    parser.add_argument('--suite', default=[], dest='include_suites', action='append', metavar='SUITE',
-                        help='Only run tests belonging to the given suite.')
-    parser.add_argument('--no-suite', default=[], dest='exclude_suites', action='append', metavar='SUITE',
-                        help='Do not run tests belonging to the given suite.')
-    parser.add_argument('--no-stdsplit', default=True, dest='split', action='store_false',
-                        help='Do not split stderr and stdout in test logs.')
-    parser.add_argument('--print-errorlogs', default=False, action='store_true',
-                        help="Whether to print failing tests' logs.")
-    parser.add_argument('--benchmark', default=False, action='store_true',
-                        help="Run benchmarks instead of tests.")
-    parser.add_argument('--logbase', default='testlog',
-                        help="Base name for log file.")
-    parser.add_argument('--num-processes', default=determine_worker_count(), type=int,
-                        help='How many parallel processes to use.')
-    parser.add_argument('-v', '--verbose', default=False, action='store_true',
-                        help='Do not redirect stdout and stderr')
-    parser.add_argument('-q', '--quiet', default=False, action='store_true',
-                        help='Produce less output to the terminal.')
-    parser.add_argument('-t', '--timeout-multiplier', type=float, default=None,
-                        help='Define a multiplier for test timeout, for example '
-                        ' when running tests in particular conditions they might take'
-                        ' more time to execute.')
-    parser.add_argument('--setup', default=None, dest='setup',
-                        help='Which test setup to use.')
-    parser.add_argument('--test-args', default=[], type=split_args,
-                        help='Arguments to pass to the specified test(s) or all tests')
-    parser.add_argument('args', nargs='*',
-                        help='Optional list of tests to run')
-
-
-def returncode_to_status(retcode: int) -> str:
-    # Note: We can't use `os.WIFSIGNALED(result.returncode)` and the related
-    # functions here because the status returned by subprocess is munged. It
-    # returns a negative value if the process was killed by a signal rather than
-    # the raw status returned by `wait()`. Also, If a shell sits between Meson
-    # the the actual unit test that shell is likely to convert a termination due
-    # to a signal into an exit status of 128 plus the signal number.
-    if retcode < 0:
-        signum = -retcode
-        try:
-            signame = signal.Signals(signum).name
-        except ValueError:
-            signame = 'SIGinvalid'
-        return '(killed by signal {} {})'.format(signum, signame)
-
-    if retcode <= 128:
-        return '(exit status {})'.format(retcode)
-
-    signum = retcode - 128
-    try:
-        signame = signal.Signals(signum).name
-    except ValueError:
-        signame = 'SIGinvalid'
-    return '(exit status {} or signal {} {})'.format(retcode, signum, signame)
-
-def env_tuple_to_str(env: T.Iterable[T.Tuple[str, str]]) -> str:
-    return ''.join(["{}='{}' ".format(k, v) for k, v in env])
-
-
-class TestException(MesonException):
-    pass
-
-
-@enum.unique
-class TestResult(enum.Enum):
-
-    OK = 'OK'
-    TIMEOUT = 'TIMEOUT'
-    SKIP = 'SKIP'
-    FAIL = 'FAIL'
-    EXPECTEDFAIL = 'EXPECTEDFAIL'
-    UNEXPECTEDPASS = 'UNEXPECTEDPASS'
-    ERROR = 'ERROR'
-
-    @staticmethod
-    def maxlen() -> int:
-        return 14 # len(UNEXPECTEDPASS)
-
-
-class TAPParser:
-    Plan = namedtuple('Plan', ['count', 'late', 'skipped', 'explanation'])
-    Bailout = namedtuple('Bailout', ['message'])
-    Test = namedtuple('Test', ['number', 'name', 'result', 'explanation'])
-    Error = namedtuple('Error', ['message'])
-    Version = namedtuple('Version', ['version'])
-
-    _MAIN = 1
-    _AFTER_TEST = 2
-    _YAML = 3
-
-    _RE_BAILOUT = re.compile(r'Bail out!\s*(.*)')
-    _RE_DIRECTIVE = re.compile(r'(?:\s*\#\s*([Ss][Kk][Ii][Pp]\S*|[Tt][Oo][Dd][Oo])\b\s*(.*))?')
-    _RE_PLAN = re.compile(r'1\.\.([0-9]+)' + _RE_DIRECTIVE.pattern)
-    _RE_TEST = re.compile(r'((?:not )?ok)\s*(?:([0-9]+)\s*)?([^#]*)' + _RE_DIRECTIVE.pattern)
-    _RE_VERSION = re.compile(r'TAP version ([0-9]+)')
-    _RE_YAML_START = re.compile(r'(\s+)---.*')
-    _RE_YAML_END = re.compile(r'\s+\.\.\.\s*')
-
-    def __init__(self, io: T.Iterator[str]):
-        self.io = io
-
-    def parse_test(self, ok: bool, num: int, name: str, directive: T.Optional[str], explanation: T.Optional[str]) -> \
-            T.Generator[T.Union['TAPParser.Test', 'TAPParser.Error'], None, None]:
-        name = name.strip()
-        explanation = explanation.strip() if explanation else None
-        if directive is not None:
-            directive = directive.upper()
-            if directive == 'SKIP':
-                if ok:
-                    yield self.Test(num, name, TestResult.SKIP, explanation)
-                    return
-            elif directive == 'TODO':
-                yield self.Test(num, name, TestResult.UNEXPECTEDPASS if ok else TestResult.EXPECTEDFAIL, explanation)
-                return
-            else:
-                yield self.Error('invalid directive "{}"'.format(directive,))
-
-        yield self.Test(num, name, TestResult.OK if ok else TestResult.FAIL, explanation)
-
-    def parse(self) -> T.Generator[T.Union['TAPParser.Test', 'TAPParser.Error', 'TAPParser.Version', 'TAPParser.Plan', 'TAPParser.Bailout'], None, None]:
-        found_late_test = False
-        bailed_out = False
-        plan = None
-        lineno = 0
-        num_tests = 0
-        yaml_lineno = None
-        yaml_indent = ''
-        state = self._MAIN
-        version = 12
-        while True:
-            lineno += 1
-            try:
-                line = next(self.io).rstrip()
-            except StopIteration:
-                break
-
-            # YAML blocks are only accepted after a test
-            if state == self._AFTER_TEST:
-                if version >= 13:
-                    m = self._RE_YAML_START.match(line)
-                    if m:
-                        state = self._YAML
-                        yaml_lineno = lineno
-                        yaml_indent = m.group(1)
-                        continue
-                state = self._MAIN
-
-            elif state == self._YAML:
-                if self._RE_YAML_END.match(line):
-                    state = self._MAIN
-                    continue
-                if line.startswith(yaml_indent):
-                    continue
-                yield self.Error('YAML block not terminated (started on line {})'.format(yaml_lineno))
-                state = self._MAIN
-
-            assert state == self._MAIN
-            if line.startswith('#'):
-                continue
-
-            m = self._RE_TEST.match(line)
-            if m:
-                if plan and plan.late and not found_late_test:
-                    yield self.Error('unexpected test after late plan')
-                    found_late_test = True
-                num_tests += 1
-                num = num_tests if m.group(2) is None else int(m.group(2))
-                if num != num_tests:
-                    yield self.Error('out of order test numbers')
-                yield from self.parse_test(m.group(1) == 'ok', num,
-                                           m.group(3), m.group(4), m.group(5))
-                state = self._AFTER_TEST
-                continue
-
-            m = self._RE_PLAN.match(line)
-            if m:
-                if plan:
-                    yield self.Error('more than one plan found')
-                else:
-                    count = int(m.group(1))
-                    skipped = (count == 0)
-                    if m.group(2):
-                        if m.group(2).upper().startswith('SKIP'):
-                            if count > 0:
-                                yield self.Error('invalid SKIP directive for plan')
-                            skipped = True
-                        else:
-                            yield self.Error('invalid directive for plan')
-                    plan = self.Plan(count=count, late=(num_tests > 0),
-                                     skipped=skipped, explanation=m.group(3))
-                    yield plan
-                continue
-
-            m = self._RE_BAILOUT.match(line)
-            if m:
-                yield self.Bailout(m.group(1))
-                bailed_out = True
-                continue
-
-            m = self._RE_VERSION.match(line)
-            if m:
-                # The TAP version is only accepted as the first line
-                if lineno != 1:
-                    yield self.Error('version number must be on the first line')
-                    continue
-                version = int(m.group(1))
-                if version < 13:
-                    yield self.Error('version number should be at least 13')
-                else:
-                    yield self.Version(version=version)
-                continue
-
-            if not line:
-                continue
-
-            yield self.Error('unexpected input at line {}'.format((lineno,)))
-
-        if state == self._YAML:
-            yield self.Error('YAML block not terminated (started on line {})'.format(yaml_lineno))
-
-        if not bailed_out and plan and num_tests != plan.count:
-            if num_tests < plan.count:
-                yield self.Error('Too few tests run (expected {}, got {})'.format(plan.count, num_tests))
-            else:
-                yield self.Error('Too many tests run (expected {}, got {})'.format(plan.count, num_tests))
-
-
-
-class JunitBuilder:
-
-    """Builder for Junit test results.
-
-    Junit is impossible to stream out, it requires attributes counting the
-    total number of tests, failures, skips, and errors in the root element
-    and in each test suite. As such, we use a builder class to track each
-    test case, and calculate all metadata before writing it out.
-
-    For tests with multiple results (like from a TAP test), we record the
-    test as a suite with the project_name.test_name. This allows us to track
-    each result separately. For tests with only one result (such as exit-code
-    tests) we record each one into a suite with the name project_name. The use
-    of the project_name allows us to sort subproject tests separately from
-    the root project.
-    """
-
-    def __init__(self, filename: str) -> None:
-        self.filename = filename
-        self.root = et.Element(
-            'testsuites', tests='0', errors='0', failures='0')
-        self.suites = {}  # type: T.Dict[str, et.Element]
-
-    def log(self, name: str, test: 'TestRun') -> None:
-        """Log a single test case."""
-        if test.junit is not None:
-            for suite in test.junit.findall('.//testsuite'):
-                # Assume that we don't need to merge anything here...
-                suite.attrib['name'] = '{}.{}.{}'.format(test.project, name, suite.attrib['name'])
-
-                # GTest can inject invalid attributes
-                for case in suite.findall('.//testcase[@result]'):
-                    del case.attrib['result']
-                for case in suite.findall('.//testcase[@timestamp]'):
-                    del case.attrib['timestamp']
-                self.root.append(suite)
-            return
-
-        # In this case we have a test binary with multiple results.
-        # We want to record this so that each result is recorded
-        # separately
-        if test.results:
-            suitename = '{}.{}'.format(test.project, name)
-            assert suitename not in self.suites, 'duplicate suite'
-
-            suite = self.suites[suitename] = et.Element(
-                'testsuite',
-                name=suitename,
-                tests=str(len(test.results)),
-                errors=str(sum(1 for r in test.results if r is TestResult.ERROR)),
-                failures=str(sum(1 for r in test.results if r in
-                                 {TestResult.FAIL, TestResult.UNEXPECTEDPASS, TestResult.TIMEOUT})),
-                skipped=str(sum(1 for r in test.results if r is TestResult.SKIP)),
-            )
-
-            for i, result in enumerate(test.results):
-                # Both name and classname are required. Set them both to the
-                # number of the test in a TAP test, as TAP doesn't give names.
-                testcase = et.SubElement(suite, 'testcase', name=str(i), classname=str(i))
-                if result is TestResult.SKIP:
-                    et.SubElement(testcase, 'skipped')
-                elif result is TestResult.ERROR:
-                    et.SubElement(testcase, 'error')
-                elif result is TestResult.FAIL:
-                    et.SubElement(testcase, 'failure')
-                elif result is TestResult.UNEXPECTEDPASS:
-                    fail = et.SubElement(testcase, 'failure')
-                    fail.text = 'Test unexpected passed.'
-                elif result is TestResult.TIMEOUT:
-                    fail = et.SubElement(testcase, 'failure')
-                    fail.text = 'Test did not finish before configured timeout.'
-            if test.stdo:
-                out = et.SubElement(suite, 'system-out')
-                out.text = test.stdo.rstrip()
-            if test.stde:
-                err = et.SubElement(suite, 'system-err')
-                err.text = test.stde.rstrip()
-        else:
-            if test.project not in self.suites:
-                suite = self.suites[test.project] = et.Element(
-                    'testsuite', name=test.project, tests='1', errors='0',
-                    failures='0', skipped='0')
-            else:
-                suite = self.suites[test.project]
-                suite.attrib['tests'] = str(int(suite.attrib['tests']) + 1)
-
-            testcase = et.SubElement(suite, 'testcase', name=name, classname=name)
-            if test.res is TestResult.SKIP:
-                et.SubElement(testcase, 'skipped')
-                suite.attrib['skipped'] = str(int(suite.attrib['skipped']) + 1)
-            elif test.res is TestResult.ERROR:
-                et.SubElement(testcase, 'error')
-                suite.attrib['errors'] = str(int(suite.attrib['errors']) + 1)
-            elif test.res is TestResult.FAIL:
-                et.SubElement(testcase, 'failure')
-                suite.attrib['failures'] = str(int(suite.attrib['failures']) + 1)
-            if test.stdo:
-                out = et.SubElement(testcase, 'system-out')
-                out.text = test.stdo.rstrip()
-            if test.stde:
-                err = et.SubElement(testcase, 'system-err')
-                err.text = test.stde.rstrip()
-
-    def write(self) -> None:
-        """Calculate total test counts and write out the xml result."""
-        for suite in self.suites.values():
-            self.root.append(suite)
-            # Skipped is really not allowed in the "testsuits" element
-            for attr in ['tests', 'errors', 'failures']:
-                self.root.attrib[attr] = str(int(self.root.attrib[attr]) + int(suite.attrib[attr]))
-
-        tree = et.ElementTree(self.root)
-        with open(self.filename, 'wb') as f:
-            tree.write(f, encoding='utf-8', xml_declaration=True)
-
-
-class TestRun:
-
-    @classmethod
-    def make_gtest(cls, test: 'TestSerialisation', test_env: T.Dict[str, str],
-                   returncode: int, starttime: float, duration: float,
-                   stdo: T.Optional[str], stde: T.Optional[str],
-                   cmd: T.Optional[T.List[str]]) -> 'TestRun':
-        filename = '{}.xml'.format(test.name)
-        if test.workdir:
-            filename = os.path.join(test.workdir, filename)
-        tree = et.parse(filename)
-
-        return cls.make_exitcode(
-            test, test_env, returncode, starttime, duration, stdo, stde, cmd,
-            junit=tree)
-
-    @classmethod
-    def make_exitcode(cls, test: 'TestSerialisation', test_env: T.Dict[str, str],
-                      returncode: int, starttime: float, duration: float,
-                      stdo: T.Optional[str], stde: T.Optional[str],
-                      cmd: T.Optional[T.List[str]], **kwargs) -> 'TestRun':
-        if returncode == GNU_SKIP_RETURNCODE:
-            res = TestResult.SKIP
-        elif returncode == GNU_ERROR_RETURNCODE:
-            res = TestResult.ERROR
-        elif test.should_fail:
-            res = TestResult.EXPECTEDFAIL if bool(returncode) else TestResult.UNEXPECTEDPASS
-        else:
-            res = TestResult.FAIL if bool(returncode) else TestResult.OK
-        return cls(test, test_env, res, [], returncode, starttime, duration, stdo, stde, cmd, **kwargs)
-
-    @classmethod
-    def make_tap(cls, test: 'TestSerialisation', test_env: T.Dict[str, str],
-                 returncode: int, starttime: float, duration: float,
-                 stdo: str, stde: str,
-                 cmd: T.Optional[T.List[str]]) -> 'TestRun':
-        res = None    # type: T.Optional[TestResult]
-        results = []  # type: T.List[TestResult]
-        failed = False
-
-        for i in TAPParser(io.StringIO(stdo)).parse():
-            if isinstance(i, TAPParser.Bailout):
-                results.append(TestResult.ERROR)
-                failed = True
-            elif isinstance(i, TAPParser.Test):
-                results.append(i.result)
-                if i.result not in {TestResult.OK, TestResult.EXPECTEDFAIL, TestResult.SKIP}:
-                    failed = True
-            elif isinstance(i, TAPParser.Error):
-                results.append(TestResult.ERROR)
-                stde += '\nTAP parsing error: ' + i.message
-                failed = True
-
-        if returncode != 0:
-            res = TestResult.ERROR
-            stde += '\n(test program exited with status code {})'.format(returncode,)
-
-        if res is None:
-            # Now determine the overall result of the test based on the outcome of the subcases
-            if all(t is TestResult.SKIP for t in results):
-                # This includes the case where num_tests is zero
-                res = TestResult.SKIP
-            elif test.should_fail:
-                res = TestResult.EXPECTEDFAIL if failed else TestResult.UNEXPECTEDPASS
-            else:
-                res = TestResult.FAIL if failed else TestResult.OK
-
-        return cls(test, test_env, res, results, returncode, starttime, duration, stdo, stde, cmd)
-
-    def __init__(self, test: 'TestSerialisation', test_env: T.Dict[str, str],
-                 res: TestResult, results: T.List[TestResult], returncode:
-                 int, starttime: float, duration: float,
-                 stdo: T.Optional[str], stde: T.Optional[str],
-                 cmd: T.Optional[T.List[str]], *, junit: T.Optional[et.ElementTree] = None):
-        assert isinstance(res, TestResult)
-        self.res = res
-        self.results = results  # May be an empty list
-        self.returncode = returncode
-        self.starttime = starttime
-        self.duration = duration
-        self.stdo = stdo
-        self.stde = stde
-        self.cmd = cmd
-        self.env = test_env
-        self.should_fail = test.should_fail
-        self.project = test.project_name
-        self.junit = junit
-
-    def get_log(self) -> str:
-        res = '--- command ---\n'
-        if self.cmd is None:
-            res += 'NONE\n'
-        else:
-            test_only_env = set(self.env.items()) - set(os.environ.items())
-            starttime_str = time.strftime("%H:%M:%S", time.gmtime(self.starttime))
-            res += '{} {}{}\n'.format(
-                starttime_str, env_tuple_to_str(test_only_env), ' '.join(self.cmd)
-            )
-        if self.stdo:
-            res += '--- stdout ---\n'
-            res += self.stdo
-        if self.stde:
-            if res[-1:] != '\n':
-                res += '\n'
-            res += '--- stderr ---\n'
-            res += self.stde
-        if res[-1:] != '\n':
-            res += '\n'
-        res += '-------\n\n'
-        return res
-
-def decode(stream: T.Union[None, bytes]) -> str:
-    if stream is None:
-        return ''
-    try:
-        return stream.decode('utf-8')
-    except UnicodeDecodeError:
-        return stream.decode('iso-8859-1', errors='ignore')
-
-def write_json_log(jsonlogfile: T.TextIO, test_name: str, result: TestRun) -> None:
-    jresult = {'name': test_name,
-               'stdout': result.stdo,
-               'result': result.res.value,
-               'starttime': result.starttime,
-               'duration': result.duration,
-               'returncode': result.returncode,
-               'env': result.env,
-               'command': result.cmd}  # type: T.Dict[str, T.Any]
-    if result.stde:
-        jresult['stderr'] = result.stde
-    jsonlogfile.write(json.dumps(jresult) + '\n')
-
-def run_with_mono(fname: str) -> bool:
-    return fname.endswith('.exe') and not (is_windows() or is_cygwin())
-
-def load_benchmarks(build_dir: str) -> T.List['TestSerialisation']:
-    datafile = Path(build_dir) / 'meson-private' / 'meson_benchmark_setup.dat'
-    if not datafile.is_file():
-        raise TestException('Directory {!r} does not seem to be a Meson build directory.'.format(build_dir))
-    with datafile.open('rb') as f:
-        obj = T.cast(T.List['TestSerialisation'], pickle.load(f))
-    return obj
-
-def load_tests(build_dir: str) -> T.List['TestSerialisation']:
-    datafile = Path(build_dir) / 'meson-private' / 'meson_test_setup.dat'
-    if not datafile.is_file():
-        raise TestException('Directory {!r} does not seem to be a Meson build directory.'.format(build_dir))
-    with datafile.open('rb') as f:
-        obj = T.cast(T.List['TestSerialisation'], pickle.load(f))
-    return obj
-
-
-class SingleTestRunner:
-
-    def __init__(self, test: 'TestSerialisation', test_env: T.Dict[str, str],
-                 env: T.Dict[str, str], options: argparse.Namespace):
-        self.test = test
-        self.test_env = test_env
-        self.env = env
-        self.options = options
-
-    def _get_cmd(self) -> T.Optional[T.List[str]]:
-        if self.test.fname[0].endswith('.jar'):
-            return ['java', '-jar'] + self.test.fname
-        elif not self.test.is_cross_built and run_with_mono(self.test.fname[0]):
-            return ['mono'] + self.test.fname
-        elif self.test.cmd_is_built and self.test.needs_exe_wrapper:
-            if self.test.exe_runner is None:
-                # Can not run test on cross compiled executable
-                # because there is no execute wrapper.
-                return None
-            elif self.test.cmd_is_built:
-                # If the command is not built (ie, its a python script),
-                # then we don't check for the exe-wrapper
-                if not self.test.exe_runner.found():
-                    msg = ('The exe_wrapper defined in the cross file {!r} was not '
-                           'found. Please check the command and/or add it to PATH.')
-                    raise TestException(msg.format(self.test.exe_runner.name))
-                return self.test.exe_runner.get_command() + self.test.fname
-        return self.test.fname
-
-    def run(self) -> TestRun:
-        cmd = self._get_cmd()
-        if cmd is None:
-            skip_stdout = 'Not run because can not execute cross compiled binaries.'
-            return TestRun(self.test, self.test_env, TestResult.SKIP, [], GNU_SKIP_RETURNCODE, time.time(), 0.0, skip_stdout, None, None)
-        else:
-            wrap = TestHarness.get_wrapper(self.options)
-            if self.options.gdb:
-                self.test.timeout = None
-            return self._run_cmd(wrap + cmd + self.test.cmd_args + self.options.test_args)
-
-    def _run_cmd(self, cmd: T.List[str]) -> TestRun:
-        starttime = time.time()
-
-        if self.test.extra_paths:
-            self.env['PATH'] = os.pathsep.join(self.test.extra_paths + ['']) + self.env['PATH']
-            winecmd = []
-            for c in cmd:
-                winecmd.append(c)
-                if os.path.basename(c).startswith('wine'):
-                    self.env['WINEPATH'] = get_wine_shortpath(
-                        winecmd,
-                        ['Z:' + p for p in self.test.extra_paths] + self.env.get('WINEPATH', '').split(';')
-                    )
-                    break
-
-        # If MALLOC_PERTURB_ is not set, or if it is set to an empty value,
-        # (i.e., the test or the environment don't explicitly set it), set
-        # it ourselves. We do this unconditionally for regular tests
-        # because it is extremely useful to have.
-        # Setting MALLOC_PERTURB_="0" will completely disable this feature.
-        if ('MALLOC_PERTURB_' not in self.env or not self.env['MALLOC_PERTURB_']) and not self.options.benchmark:
-            self.env['MALLOC_PERTURB_'] = str(random.randint(1, 255))
-
-        stdout = None
-        stderr = None
-        if not self.options.verbose:
-            stdout = tempfile.TemporaryFile("wb+")
-            stderr = tempfile.TemporaryFile("wb+") if self.options.split else stdout
-        if self.test.protocol is TestProtocol.TAP and stderr is stdout:
-            stdout = tempfile.TemporaryFile("wb+")
-
-        # Let gdb handle ^C instead of us
-        if self.options.gdb:
-            previous_sigint_handler = signal.getsignal(signal.SIGINT)
-            # Make the meson executable ignore SIGINT while gdb is running.
-            signal.signal(signal.SIGINT, signal.SIG_IGN)
-
-        def preexec_fn() -> None:
-            if self.options.gdb:
-                # Restore the SIGINT handler for the child process to
-                # ensure it can handle it.
-                signal.signal(signal.SIGINT, signal.SIG_DFL)
-            else:
-                # We don't want setsid() in gdb because gdb needs the
-                # terminal in order to handle ^C and not show tcsetpgrp()
-                # errors avoid not being able to use the terminal.
-                os.setsid()  # type: ignore
-
-        extra_cmd = []  # type: T.List[str]
-        if self.test.protocol is TestProtocol.GTEST:
-            gtestname = '{}.xml'.format(self.test.name)
-            if self.test.workdir:
-                gtestname = '{}:{}'.format(self.test.workdir, self.test.name)
-            extra_cmd.append('--gtest_output=xml:{}'.format(gtestname))
-
-        p = subprocess.Popen(cmd + extra_cmd,
-                             stdout=stdout,
-                             stderr=stderr,
-                             env=self.env,
-                             cwd=self.test.workdir,
-                             preexec_fn=preexec_fn if not is_windows() else None)
-        timed_out = False
-        kill_test = False
-        if self.test.timeout is None:
-            timeout = None
-        elif self.options.timeout_multiplier is not None:
-            timeout = self.test.timeout * self.options.timeout_multiplier
-        else:
-            timeout = self.test.timeout
-        try:
-            p.communicate(timeout=timeout)
-        except subprocess.TimeoutExpired:
-            if self.options.verbose:
-                print('{} time out (After {} seconds)'.format(self.test.name, timeout))
-            timed_out = True
-        except KeyboardInterrupt:
-            mlog.warning('CTRL-C detected while running {}'.format(self.test.name))
-            kill_test = True
-        finally:
-            if self.options.gdb:
-                # Let us accept ^C again
-                signal.signal(signal.SIGINT, previous_sigint_handler)
-
-        additional_error = None
-
-        if kill_test or timed_out:
-            # Python does not provide multiplatform support for
-            # killing a process and all its children so we need
-            # to roll our own.
-            if is_windows():
-                subprocess.run(['taskkill', '/F', '/T', '/PID', str(p.pid)])
-            else:
-
-                def _send_signal_to_process_group(pgid : int, signum : int):
-                    """ sends a signal to a process group """
-                    try:
-                        os.killpg(pgid, signum) # type: ignore
-                    except ProcessLookupError:
-                        # Sometimes (e.g. with Wine) this happens.
-                        # There's nothing we can do (maybe the process
-                        # already died) so carry on.
-                        pass
-
-                # Send a termination signal to the process group that setsid()
-                # created - giving it a chance to perform any cleanup.
-                _send_signal_to_process_group(p.pid, signal.SIGTERM)
-
-                # Make sure the termination signal actually kills the process
-                # group, otherwise retry with a SIGKILL.
-                try:
-                    p.communicate(timeout=0.5)
-                except subprocess.TimeoutExpired:
-                    _send_signal_to_process_group(p.pid, signal.SIGKILL)
-            try:
-                p.communicate(timeout=1)
-            except subprocess.TimeoutExpired:
-                # An earlier kill attempt has not worked for whatever reason.
-                # Try to kill it one last time with a direct call.
-                # If the process has spawned children, they will remain around.
-                p.kill()
-                try:
-                    p.communicate(timeout=1)
-                except subprocess.TimeoutExpired:
-                    additional_error = 'Test process could not be killed.'
-            except ValueError:
-                additional_error = 'Could not read output. Maybe the process has redirected its stdout/stderr?'
-        endtime = time.time()
-        duration = endtime - starttime
-        if additional_error is None:
-            if stdout is None:
-                stdo = ''
-            else:
-                stdout.seek(0)
-                stdo = decode(stdout.read())
-            if stderr is None or stderr is stdout:
-                stde = ''
-            else:
-                stderr.seek(0)
-                stde = decode(stderr.read())
-        else:
-            stdo = ""
-            stde = additional_error
-        if timed_out:
-            return TestRun(self.test, self.test_env, TestResult.TIMEOUT, [], p.returncode, starttime, duration, stdo, stde, cmd)
-        else:
-            if self.test.protocol is TestProtocol.EXITCODE:
-                return TestRun.make_exitcode(self.test, self.test_env, p.returncode, starttime, duration, stdo, stde, cmd)
-            elif self.test.protocol is TestProtocol.GTEST:
-                return TestRun.make_gtest(self.test, self.test_env, p.returncode, starttime, duration, stdo, stde, cmd)
-            else:
-                if self.options.verbose:
-                    print(stdo, end='')
-                return TestRun.make_tap(self.test, self.test_env, p.returncode, starttime, duration, stdo, stde, cmd)
-
-
-class TestHarness:
-    def __init__(self, options: argparse.Namespace):
-        self.options = options
-        self.collected_logs = []  # type: T.List[str]
-        self.fail_count = 0
-        self.expectedfail_count = 0
-        self.unexpectedpass_count = 0
-        self.success_count = 0
-        self.skip_count = 0
-        self.timeout_count = 0
-        self.is_run = False
-        self.tests = None
-        self.results = []         # type: T.List[TestRun]
-        self.logfilename = None   # type: T.Optional[str]
-        self.logfile = None       # type: T.Optional[T.TextIO]
-        self.jsonlogfile = None   # type: T.Optional[T.TextIO]
-        self.junit = None         # type: T.Optional[JunitBuilder]
-        if self.options.benchmark:
-            self.tests = load_benchmarks(options.wd)
-        else:
-            self.tests = load_tests(options.wd)
-        ss = set()
-        for t in self.tests:
-            for s in t.suite:
-                ss.add(s)
-        self.suites = list(ss)
-
-    def __del__(self) -> None:
-        self.close_logfiles()
-
-    def __enter__(self):
-        return self
-
-    def __exit__(self, exc_type, exc_value, traceback) -> None:
-        self.close_logfiles()
-
-    def close_logfiles(self) -> None:
-        for f in ['logfile', 'jsonlogfile']:
-            lfile =  getattr(self, f)
-            if lfile:
-                lfile.close()
-                setattr(self, f, None)
-
-    def merge_suite_options(self, options: argparse.Namespace, test: 'TestSerialisation') -> T.Dict[str, str]:
-        if ':' in options.setup:
-            if options.setup not in self.build_data.test_setups:
-                sys.exit("Unknown test setup '{}'.".format(options.setup))
-            current = self.build_data.test_setups[options.setup]
-        else:
-            full_name = test.project_name + ":" + options.setup
-            if full_name not in self.build_data.test_setups:
-                sys.exit("Test setup '{}' not found from project '{}'.".format(options.setup, test.project_name))
-            current = self.build_data.test_setups[full_name]
-        if not options.gdb:
-            options.gdb = current.gdb
-        if options.gdb:
-            options.verbose = True
-        if options.timeout_multiplier is None:
-            options.timeout_multiplier = current.timeout_multiplier
-    #    if options.env is None:
-    #        options.env = current.env # FIXME, should probably merge options here.
-        if options.wrapper is not None and current.exe_wrapper is not None:
-            sys.exit('Conflict: both test setup and command line specify an exe wrapper.')
-        if options.wrapper is None:
-            options.wrapper = current.exe_wrapper
-        return current.env.get_env(os.environ.copy())
-
-    def get_test_runner(self, test: 'TestSerialisation') -> SingleTestRunner:
-        options = deepcopy(self.options)
-        if not options.setup:
-            options.setup = self.build_data.test_setup_default_name
-        if options.setup:
-            env = self.merge_suite_options(options, test)
-        else:
-            env = os.environ.copy()
-        test_env = test.env.get_env(env)
-        env.update(test_env)
-        if (test.is_cross_built and test.needs_exe_wrapper and
-                test.exe_runner and test.exe_runner.found()):
-            env['MESON_EXE_WRAPPER'] = join_args(test.exe_runner.get_command())
-        return SingleTestRunner(test, test_env, env, options)
-
-    def process_test_result(self, result: TestRun) -> None:
-        if result.res is TestResult.TIMEOUT:
-            self.timeout_count += 1
-        elif result.res is TestResult.SKIP:
-            self.skip_count += 1
-        elif result.res is TestResult.OK:
-            self.success_count += 1
-        elif result.res is TestResult.FAIL or result.res is TestResult.ERROR:
-            self.fail_count += 1
-        elif result.res is TestResult.EXPECTEDFAIL:
-            self.expectedfail_count += 1
-        elif result.res is TestResult.UNEXPECTEDPASS:
-            self.unexpectedpass_count += 1
-        else:
-            sys.exit('Unknown test result encountered: {}'.format(result.res))
-
-    def print_stats(self, test_count: int, name_max_len: int,
-                    tests: T.List['TestSerialisation'],
-                    name: str, result: TestRun, i: int) -> None:
-        ok_statuses = (TestResult.OK, TestResult.EXPECTEDFAIL)
-        bad_statuses = (TestResult.FAIL, TestResult.TIMEOUT,
-                        TestResult.UNEXPECTEDPASS, TestResult.ERROR)
-        result_str = '{num:{numlen}}/{testcount} {name:{name_max_len}} {res:{reslen}} {dur:.2f}s'.format(
-            numlen=len(str(test_count)),
-            num=i,
-            testcount=test_count,
-            name_max_len=name_max_len,
-            name=name,
-            reslen=TestResult.maxlen(),
-            res=result.res.value,
-            dur=result.duration)
-        if result.res is TestResult.FAIL:
-            result_str += ' ' + returncode_to_status(result.returncode)
-        if not self.options.quiet or result.res not in ok_statuses:
-            if result.res not in ok_statuses and mlog.colorize_console():
-                if result.res in bad_statuses:
-                    decorator = mlog.red
-                elif result.res is TestResult.SKIP:
-                    decorator = mlog.yellow
-                else:
-                    sys.exit('Unreachable code was ... well ... reached.')
-                print(decorator(result_str).get_text(True))
-            else:
-                print(result_str)
-        result_str += "\n\n" + result.get_log()
-        if result.res in bad_statuses:
-            if self.options.print_errorlogs:
-                self.collected_logs.append(result_str)
-        if self.logfile:
-            self.logfile.write(result_str)
-        if self.jsonlogfile:
-            write_json_log(self.jsonlogfile, name, result)
-        if self.junit:
-            self.junit.log(name, result)
-
-    def print_summary(self) -> None:
-        msg = textwrap.dedent('''
-            Ok:                 {:<4}
-            Expected Fail:      {:<4}
-            Fail:               {:<4}
-            Unexpected Pass:    {:<4}
-            Skipped:            {:<4}
-            Timeout:            {:<4}
-            ''').format(self.success_count, self.expectedfail_count, self.fail_count,
-           self.unexpectedpass_count, self.skip_count, self.timeout_count)
-        print(msg)
-        if self.logfile:
-            self.logfile.write(msg)
-        if self.junit:
-            self.junit.write()
-
-    def print_collected_logs(self) -> None:
-        if self.collected_logs:
-            if len(self.collected_logs) > 10:
-                print('\nThe output from 10 first failed tests:\n')
-            else:
-                print('\nThe output from the failed tests:\n')
-            for log in self.collected_logs[:10]:
-                lines = log.splitlines()
-                if len(lines) > 104:
-                    print('\n'.join(lines[0:4]))
-                    print('--- Listing only the last 100 lines from a long log. ---')
-                    lines = lines[-100:]
-                for line in lines:
-                    try:
-                        print(line)
-                    except UnicodeEncodeError:
-                        line = line.encode('ascii', errors='replace').decode()
-                        print(line)
-
-    def total_failure_count(self) -> int:
-        return self.fail_count + self.unexpectedpass_count + self.timeout_count
-
-    def doit(self) -> int:
-        if self.is_run:
-            raise RuntimeError('Test harness object can only be used once.')
-        self.is_run = True
-        tests = self.get_tests()
-        if not tests:
-            return 0
-        self.run_tests(tests)
-        return self.total_failure_count()
-
-    @staticmethod
-    def split_suite_string(suite: str) -> T.Tuple[str, str]:
-        if ':' in suite:
-            # mypy can't figure out that str.split(n, 1) will return a list of
-            # length 2, so we have to help it.
-            return T.cast(T.Tuple[str, str], tuple(suite.split(':', 1)))
-        else:
-            return suite, ""
-
-    @staticmethod
-    def test_in_suites(test: 'TestSerialisation', suites: T.List[str]) -> bool:
-        for suite in suites:
-            (prj_match, st_match) = TestHarness.split_suite_string(suite)
-            for prjst in test.suite:
-                (prj, st) = TestHarness.split_suite_string(prjst)
-
-                # the SUITE can be passed as
-                #     suite_name
-                # or
-                #     project_name:suite_name
-                # so we need to select only the test belonging to project_name
-
-                # this if handle the first case (i.e., SUITE == suite_name)
-
-                # in this way we can run tests belonging to different
-                # (sub)projects which share the same suite_name
-                if not st_match and st == prj_match:
-                    return True
-
-                # these two conditions are needed to handle the second option
-                # i.e., SUITE == project_name:suite_name
-
-                # in this way we select the only the tests of
-                # project_name with suite_name
-                if prj_match and prj != prj_match:
-                    continue
-                if st_match and st != st_match:
-                    continue
-                return True
-        return False
-
-    def test_suitable(self, test: 'TestSerialisation') -> bool:
-        return ((not self.options.include_suites or
-                TestHarness.test_in_suites(test, self.options.include_suites)) and not
-                TestHarness.test_in_suites(test, self.options.exclude_suites))
-
-    def get_tests(self) -> T.List['TestSerialisation']:
-        if not self.tests:
-            print('No tests defined.')
-            return []
-
-        if self.options.include_suites or self.options.exclude_suites:
-            tests = []
-            for tst in self.tests:
-                if self.test_suitable(tst):
-                    tests.append(tst)
-        else:
-            tests = self.tests
-
-        # allow specifying test names like "meson test foo1 foo2", where test('foo1', ...)
-        if self.options.args:
-            tests = [t for t in tests if t.name in self.options.args]
-
-        if not tests:
-            print('No suitable tests defined.')
-            return []
-
-        return tests
-
-    def open_log_files(self) -> None:
-        if not self.options.logbase or self.options.verbose:
-            return
-
-        namebase = None
-        logfile_base = os.path.join(self.options.wd, 'meson-logs', self.options.logbase)
-
-        if self.options.wrapper:
-            namebase = os.path.basename(self.get_wrapper(self.options)[0])
-        elif self.options.setup:
-            namebase = self.options.setup.replace(":", "_")
-
-        if namebase:
-            logfile_base += '-' + namebase.replace(' ', '_')
-
-        self.junit = JunitBuilder(logfile_base + '.junit.xml')
-
-        self.logfilename = logfile_base + '.txt'
-        self.jsonlogfilename = logfile_base + '.json'
-
-        self.jsonlogfile = open(self.jsonlogfilename, 'w', encoding='utf-8', errors='replace')
-        self.logfile = open(self.logfilename, 'w', encoding='utf-8', errors='surrogateescape')
-
-        self.logfile.write('Log of Meson test suite run on {}\n\n'.format(datetime.datetime.now().isoformat()))
-        inherit_env = env_tuple_to_str(os.environ.items())
-        self.logfile.write('Inherited environment: {}\n\n'.format(inherit_env))
-
-    @staticmethod
-    def get_wrapper(options: argparse.Namespace) -> T.List[str]:
-        wrap = []  # type: T.List[str]
-        if options.gdb:
-            wrap = [options.gdb_path, '--quiet', '--nh']
-            if options.repeat > 1:
-                wrap += ['-ex', 'run', '-ex', 'quit']
-            # Signal the end of arguments to gdb
-            wrap += ['--args']
-        if options.wrapper:
-            wrap += options.wrapper
-        return wrap
-
-    def get_pretty_suite(self, test: 'TestSerialisation') -> str:
-        if len(self.suites) > 1 and test.suite:
-            rv = TestHarness.split_suite_string(test.suite[0])[0]
-            s = "+".join(TestHarness.split_suite_string(s)[1] for s in test.suite)
-            if s:
-                rv += ":"
-            return rv + s + " / " + test.name
-        else:
-            return test.name
-
-    def run_tests(self, tests: T.List['TestSerialisation']) -> None:
-        executor = None
-        futures = []  # type: T.List[T.Tuple[conc.Future[TestRun], int, int, T.List[TestSerialisation], str, int]]
-        test_count = len(tests)
-        name_max_len = max([len(self.get_pretty_suite(test)) for test in tests])
-        self.open_log_files()
-        startdir = os.getcwd()
-        if self.options.wd:
-            os.chdir(self.options.wd)
-        self.build_data = build.load(os.getcwd())
-
-        try:
-            for _ in range(self.options.repeat):
-                for i, test in enumerate(tests, 1):
-                    visible_name = self.get_pretty_suite(test)
-                    single_test = self.get_test_runner(test)
-
-                    if not test.is_parallel or self.options.num_processes == 1 or single_test.options.gdb:
-                        self.drain_futures(futures)
-                        futures = []
-                        res = single_test.run()
-                        self.process_test_result(res)
-                        self.print_stats(test_count, name_max_len, tests, visible_name, res, i)
-                    else:
-                        if not executor:
-                            executor = conc.ThreadPoolExecutor(max_workers=self.options.num_processes)
-                        f = executor.submit(single_test.run)
-                        futures.append((f, test_count, name_max_len, tests, visible_name, i))
-                    if self.options.repeat > 1 and self.fail_count:
-                        break
-                if self.options.repeat > 1 and self.fail_count:
-                    break
-
-            self.drain_futures(futures)
-            self.print_summary()
-            self.print_collected_logs()
-
-            if self.logfilename:
-                print('Full log written to {}'.format(self.logfilename))
-        finally:
-            os.chdir(startdir)
-
-    def drain_futures(self, futures: T.List[T.Tuple['conc.Future[TestRun]', int, int, T.List['TestSerialisation'], str, int]]) -> None:
-        for x in futures:
-            (result, test_count, name_max_len, tests, name, i) = x
-            if self.options.repeat > 1 and self.fail_count:
-                result.cancel()
-            if self.options.verbose:
-                result.result()
-            self.process_test_result(result.result())
-            self.print_stats(test_count, name_max_len, tests, name, result.result(), i)
-
-    def run_special(self) -> int:
-        '''Tests run by the user, usually something like "under gdb 1000 times".'''
-        if self.is_run:
-            raise RuntimeError('Can not use run_special after a full run.')
-        tests = self.get_tests()
-        if not tests:
-            return 0
-        self.run_tests(tests)
-        return self.total_failure_count()
-
-
-def list_tests(th: TestHarness) -> bool:
-    tests = th.get_tests()
-    for t in tests:
-        print(th.get_pretty_suite(t))
-    return not tests
-
-def rebuild_all(wd: str) -> bool:
-    if not (Path(wd) / 'build.ninja').is_file():
-        print('Only ninja backend is supported to rebuild tests before running them.')
-        return True
-
-    ninja = environment.detect_ninja()
-    if not ninja:
-        print("Can't find ninja, can't rebuild test.")
-        return False
-
-    ret = subprocess.run(ninja + ['-C', wd]).returncode
-    if ret != 0:
-        print('Could not rebuild {}'.format(wd))
-        return False
-
-    return True
-
-def run(options: argparse.Namespace) -> int:
-    if options.benchmark:
-        options.num_processes = 1
-
-    if options.verbose and options.quiet:
-        print('Can not be both quiet and verbose at the same time.')
-        return 1
-
-    check_bin = None
-    if options.gdb:
-        options.verbose = True
-        if options.wrapper:
-            print('Must not specify both a wrapper and gdb at the same time.')
-            return 1
-        check_bin = 'gdb'
-
-    if options.wrapper:
-        check_bin = options.wrapper[0]
-
-    if check_bin is not None:
-        exe = ExternalProgram(check_bin, silent=True)
-        if not exe.found():
-            print('Could not find requested program: {!r}'.format(check_bin))
-            return 1
-
-    if not options.list and not options.no_rebuild:
-        if not rebuild_all(options.wd):
-            # We return 125 here in case the build failed.
-            # The reason is that exit code 125 tells `git bisect run` that the current commit should be skipped.
-            # Thus users can directly use `meson test` to bisect without needing to handle the does-not-build case separately in a wrapper script.
-            return 125
-
-    with TestHarness(options) as th:
-        try:
-            if options.list:
-                return list_tests(th)
-            if not options.args:
-                return th.doit()
-            return th.run_special()
-        except TestException as e:
-            print('Meson test encountered an error:\n')
-            if os.environ.get('MESON_FORCE_BACKTRACE'):
-                raise e
-            else:
-                print(e)
-            return 1
-
-def run_with_args(args: T.List[str]) -> int:
-    parser = argparse.ArgumentParser(prog='meson test')
-    add_arguments(parser)
-    options = parser.parse_args(args)
-    return run(options)
diff --git a/meson/mesonbuild/munstable_coredata.py b/meson/mesonbuild/munstable_coredata.py
deleted file mode 100644 (file)
index 5463f16..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-from . import coredata as cdata
-from .mesonlib import MachineChoice
-
-import os.path
-import pprint
-import textwrap
-
-def add_arguments(parser):
-    parser.add_argument('--all', action='store_true', dest='all', default=False,
-                        help='Show data not used by current backend.')
-
-    parser.add_argument('builddir', nargs='?', default='.', help='The build directory')
-
-
-def dump_compilers(compilers):
-    for lang, compiler in compilers.items():
-        print('  ' + lang + ':')
-        print('      Id: ' + compiler.id)
-        print('      Command: ' + ' '.join(compiler.exelist))
-        if compiler.full_version:
-            print('      Full version: ' + compiler.full_version)
-        if compiler.version:
-            print('      Detected version: ' + compiler.version)
-
-
-def dump_guids(d):
-    for name, value in d.items():
-        print('  ' + name + ': ' + value)
-
-
-def run(options):
-    datadir = 'meson-private'
-    if options.builddir is not None:
-        datadir = os.path.join(options.builddir, datadir)
-    if not os.path.isdir(datadir):
-        print('Current directory is not a build dir. Please specify it or '
-              'change the working directory to it.')
-        return 1
-
-    all_backends = options.all
-
-    print('This is a dump of the internal unstable cache of meson. This is for debugging only.')
-    print('Do NOT parse, this will change from version to version in incompatible ways')
-    print('')
-
-    coredata = cdata.load(options.builddir)
-    backend = coredata.get_builtin_option('backend')
-    for k, v in sorted(coredata.__dict__.items()):
-        if k in ('backend_options', 'base_options', 'builtins', 'compiler_options', 'user_options'):
-            # use `meson configure` to view these
-            pass
-        elif k in ['install_guid', 'test_guid', 'regen_guid']:
-            if all_backends or backend.startswith('vs'):
-                print(k + ': ' + v)
-        elif k == 'target_guids':
-            if all_backends or backend.startswith('vs'):
-                print(k + ':')
-                dump_guids(v)
-        elif k in ['lang_guids']:
-            if all_backends or backend.startswith('vs') or backend == 'xcode':
-                print(k + ':')
-                dump_guids(v)
-        elif k == 'meson_command':
-            if all_backends or backend.startswith('vs'):
-                print('Meson command used in build file regeneration: ' + ' '.join(v))
-        elif k == 'pkgconf_envvar':
-            print('Last seen PKGCONFIG environment variable value: ' + v)
-        elif k == 'version':
-            print('Meson version: ' + v)
-        elif k == 'cross_files':
-            if v:
-                print('Cross File: ' + ' '.join(v))
-        elif k == 'config_files':
-            if v:
-                print('Native File: ' + ' '.join(v))
-        elif k == 'compilers':
-            for for_machine in MachineChoice:
-                print('Cached {} machine compilers:'.format(
-                    for_machine.get_lower_case_name()))
-                dump_compilers(v[for_machine])
-        elif k == 'deps':
-            def print_dep(dep_key, dep):
-                print('  ' + dep_key[0] + ": ")
-                print('      compile args: ' + repr(dep.get_compile_args()))
-                print('      link args: ' + repr(dep.get_link_args()))
-                if dep.get_sources():
-                    print('      sources: ' + repr(dep.get_sources()))
-                print('      version: ' + repr(dep.get_version()))
-
-            for for_machine in iter(MachineChoice):
-                items_list = list(sorted(v[for_machine].items()))
-                if items_list:
-                    print('Cached dependencies for {} machine' % for_machine.get_lower_case_name())
-                    for dep_key, deps in items_list:
-                        for dep in deps:
-                            print_dep(dep_key, dep)
-        else:
-            print(k + ':')
-            print(textwrap.indent(pprint.pformat(v), '  '))
diff --git a/meson/mesonbuild/optinterpreter.py b/meson/mesonbuild/optinterpreter.py
deleted file mode 100644 (file)
index d47a3d2..0000000
+++ /dev/null
@@ -1,235 +0,0 @@
-# Copyright 2013-2014 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import re
-import functools
-import typing as T
-
-from . import compilers
-from . import coredata
-from . import mesonlib
-from . import mparser
-from .interpreterbase import FeatureNew
-
-forbidden_option_names = set(coredata.builtin_options.keys())
-forbidden_prefixes = [lang + '_' for lang in compilers.all_languages] + ['b_', 'backend_']
-reserved_prefixes = ['cross_']
-
-def is_invalid_name(name: str, *, log: bool = True) -> bool:
-    if name in forbidden_option_names:
-        return True
-    pref = name.split('_')[0] + '_'
-    if pref in forbidden_prefixes:
-        return True
-    if pref in reserved_prefixes:
-        if log:
-            from . import mlog
-            mlog.deprecation('Option uses prefix "%s", which is reserved for Meson. This will become an error in the future.' % pref)
-    return False
-
-class OptionException(mesonlib.MesonException):
-    pass
-
-
-def permitted_kwargs(permitted):
-    """Function that validates kwargs for options."""
-    def _wraps(func):
-        @functools.wraps(func)
-        def _inner(name, description, kwargs):
-            bad = [a for a in kwargs.keys() if a not in permitted]
-            if bad:
-                raise OptionException('Invalid kwargs for option "{}": "{}"'.format(
-                    name, ' '.join(bad)))
-            return func(description, kwargs)
-        return _inner
-    return _wraps
-
-
-optname_regex = re.compile('[^a-zA-Z0-9_-]')
-
-@permitted_kwargs({'value', 'yield'})
-def StringParser(description, kwargs):
-    return coredata.UserStringOption(description,
-                                     kwargs.get('value', ''),
-                                     kwargs.get('choices', []),
-                                     kwargs.get('yield', coredata.default_yielding))
-
-@permitted_kwargs({'value', 'yield'})
-def BooleanParser(description, kwargs):
-    return coredata.UserBooleanOption(description,
-                                      kwargs.get('value', True),
-                                      kwargs.get('yield', coredata.default_yielding))
-
-@permitted_kwargs({'value', 'yield', 'choices'})
-def ComboParser(description, kwargs):
-    if 'choices' not in kwargs:
-        raise OptionException('Combo option missing "choices" keyword.')
-    choices = kwargs['choices']
-    if not isinstance(choices, list):
-        raise OptionException('Combo choices must be an array.')
-    for i in choices:
-        if not isinstance(i, str):
-            raise OptionException('Combo choice elements must be strings.')
-    return coredata.UserComboOption(description,
-                                    choices,
-                                    kwargs.get('value', choices[0]),
-                                    kwargs.get('yield', coredata.default_yielding),)
-
-
-@permitted_kwargs({'value', 'min', 'max', 'yield'})
-def IntegerParser(description, kwargs):
-    if 'value' not in kwargs:
-        raise OptionException('Integer option must contain value argument.')
-    inttuple = (kwargs.get('min', None), kwargs.get('max', None), kwargs['value'])
-    return coredata.UserIntegerOption(description,
-                                      inttuple,
-                                      kwargs.get('yield', coredata.default_yielding))
-
-# FIXME: Cannot use FeatureNew while parsing options because we parse it before
-# reading options in project(). See func_project() in interpreter.py
-#@FeatureNew('array type option()', '0.44.0')
-@permitted_kwargs({'value', 'yield', 'choices'})
-def string_array_parser(description, kwargs):
-    if 'choices' in kwargs:
-        choices = kwargs['choices']
-        if not isinstance(choices, list):
-            raise OptionException('Array choices must be an array.')
-        for i in choices:
-            if not isinstance(i, str):
-                raise OptionException('Array choice elements must be strings.')
-            value = kwargs.get('value', choices)
-    else:
-        choices = None
-        value = kwargs.get('value', [])
-    if not isinstance(value, list):
-        raise OptionException('Array choices must be passed as an array.')
-    return coredata.UserArrayOption(description,
-                                    value,
-                                    choices=choices,
-                                    yielding=kwargs.get('yield', coredata.default_yielding))
-
-@permitted_kwargs({'value', 'yield'})
-def FeatureParser(description, kwargs):
-    return coredata.UserFeatureOption(description,
-                                      kwargs.get('value', 'auto'),
-                                      yielding=kwargs.get('yield', coredata.default_yielding))
-
-option_types = {'string': StringParser,
-                'boolean': BooleanParser,
-                'combo': ComboParser,
-                'integer': IntegerParser,
-                'array': string_array_parser,
-                'feature': FeatureParser,
-                } # type: T.Dict[str, T.Callable[[str, T.Dict], coredata.UserOption]]
-
-class OptionInterpreter:
-    def __init__(self, subproject):
-        self.options = {}
-        self.subproject = subproject
-
-    def process(self, option_file):
-        try:
-            with open(option_file, 'r', encoding='utf8') as f:
-                ast = mparser.Parser(f.read(), option_file).parse()
-        except mesonlib.MesonException as me:
-            me.file = option_file
-            raise me
-        if not isinstance(ast, mparser.CodeBlockNode):
-            e = OptionException('Option file is malformed.')
-            e.lineno = ast.lineno()
-            e.file = option_file
-            raise e
-        for cur in ast.lines:
-            try:
-                self.evaluate_statement(cur)
-            except Exception as e:
-                e.lineno = cur.lineno
-                e.colno = cur.colno
-                e.file = option_file
-                raise e
-
-    def reduce_single(self, arg):
-        if isinstance(arg, str):
-            return arg
-        elif isinstance(arg, (mparser.StringNode, mparser.BooleanNode,
-                              mparser.NumberNode)):
-            return arg.value
-        elif isinstance(arg, mparser.ArrayNode):
-            return [self.reduce_single(curarg) for curarg in arg.args.arguments]
-        elif isinstance(arg, mparser.UMinusNode):
-            res = self.reduce_single(arg.value)
-            if not isinstance(res, (int, float)):
-                raise OptionException('Token after "-" is not a number')
-            FeatureNew.single_use('negative numbers in meson_options.txt', '0.54.1', self.subproject)
-            return -res
-        elif isinstance(arg, mparser.NotNode):
-            res = self.reduce_single(arg.value)
-            if not isinstance(res, bool):
-                raise OptionException('Token after "not" is not a a boolean')
-            FeatureNew.single_use('negation ("not") in meson_options.txt', '0.54.1', self.subproject)
-            return not res
-        elif isinstance(arg, mparser.ArithmeticNode):
-            l = self.reduce_single(arg.left)
-            r = self.reduce_single(arg.right)
-            if not (arg.operation == 'add' and isinstance(l, str) and isinstance(r, str)):
-                raise OptionException('Only string concatenation with the "+" operator is allowed')
-            FeatureNew.single_use('string concatenation in meson_options.txt', '0.55.0', self.subproject)
-            return l + r
-        else:
-            raise OptionException('Arguments may only be string, int, bool, or array of those.')
-
-    def reduce_arguments(self, args):
-        assert(isinstance(args, mparser.ArgumentNode))
-        if args.incorrect_order():
-            raise OptionException('All keyword arguments must be after positional arguments.')
-        reduced_pos = [self.reduce_single(arg) for arg in args.arguments]
-        reduced_kw = {}
-        for key in args.kwargs.keys():
-            if not isinstance(key, mparser.IdNode):
-                raise OptionException('Keyword argument name is not a string.')
-            a = args.kwargs[key]
-            reduced_kw[key.value] = self.reduce_single(a)
-        return reduced_pos, reduced_kw
-
-    def evaluate_statement(self, node):
-        if not isinstance(node, mparser.FunctionNode):
-            raise OptionException('Option file may only contain option definitions')
-        func_name = node.func_name
-        if func_name != 'option':
-            raise OptionException('Only calls to option() are allowed in option files.')
-        (posargs, kwargs) = self.reduce_arguments(node.args)
-
-        if 'yield' in kwargs:
-           FeatureNew.single_use('option yield', '0.45.0', self.subproject)
-
-        if 'type' not in kwargs:
-            raise OptionException('Option call missing mandatory "type" keyword argument')
-        opt_type = kwargs.pop('type')
-        if opt_type not in option_types:
-            raise OptionException('Unknown type %s.' % opt_type)
-        if len(posargs) != 1:
-            raise OptionException('Option() must have one (and only one) positional argument')
-        opt_name = posargs[0]
-        if not isinstance(opt_name, str):
-            raise OptionException('Positional argument must be a string.')
-        if optname_regex.search(opt_name) is not None:
-            raise OptionException('Option names can only contain letters, numbers or dashes.')
-        if is_invalid_name(opt_name):
-            raise OptionException('Option name %s is reserved.' % opt_name)
-        if self.subproject != '':
-            opt_name = self.subproject + ':' + opt_name
-        opt = option_types[opt_type](opt_name, kwargs.pop('description', ''), kwargs)
-        if opt.description == '':
-            opt.description = opt_name
-        self.options[opt_name] = opt
diff --git a/meson/mesonbuild/rewriter.py b/meson/mesonbuild/rewriter.py
deleted file mode 100644 (file)
index 7730ab6..0000000
+++ /dev/null
@@ -1,969 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This class contains the basic functionality needed to run any interpreter
-# or an interpreter-based tool.
-
-# This tool is used to manipulate an existing Meson build definition.
-#
-# - add a file to a target
-# - remove files from a target
-# - move targets
-# - reindent?
-
-from .ast import IntrospectionInterpreter, build_target_functions, AstConditionLevel, AstIDGenerator, AstIndentationGenerator, AstPrinter
-from mesonbuild.mesonlib import MesonException
-from . import mlog, environment
-from functools import wraps
-from .mparser import Token, ArrayNode, ArgumentNode, AssignmentNode, BaseNode, BooleanNode, ElementaryNode, IdNode, FunctionNode, StringNode
-import json, os, re, sys
-import typing as T
-
-class RewriterException(MesonException):
-    pass
-
-def add_arguments(parser, formatter=None):
-    parser.add_argument('-s', '--sourcedir', type=str, default='.', metavar='SRCDIR', help='Path to source directory.')
-    parser.add_argument('-V', '--verbose', action='store_true', default=False, help='Enable verbose output')
-    parser.add_argument('-S', '--skip-errors', dest='skip', action='store_true', default=False, help='Skip errors instead of aborting')
-    subparsers = parser.add_subparsers(dest='type', title='Rewriter commands', description='Rewrite command to execute')
-
-    # Target
-    tgt_parser = subparsers.add_parser('target', help='Modify a target', formatter_class=formatter)
-    tgt_parser.add_argument('-s', '--subdir', default='', dest='subdir', help='Subdirectory of the new target (only for the "add_target" action)')
-    tgt_parser.add_argument('--type', dest='tgt_type', choices=rewriter_keys['target']['target_type'][2], default='executable',
-                            help='Type of the target to add (only for the "add_target" action)')
-    tgt_parser.add_argument('target', help='Name or ID of the target')
-    tgt_parser.add_argument('operation', choices=['add', 'rm', 'add_target', 'rm_target', 'info'],
-                            help='Action to execute')
-    tgt_parser.add_argument('sources', nargs='*', help='Sources to add/remove')
-
-    # KWARGS
-    kw_parser = subparsers.add_parser('kwargs', help='Modify keyword arguments', formatter_class=formatter)
-    kw_parser.add_argument('operation', choices=rewriter_keys['kwargs']['operation'][2],
-                           help='Action to execute')
-    kw_parser.add_argument('function', choices=list(rewriter_func_kwargs.keys()),
-                           help='Function type to modify')
-    kw_parser.add_argument('id', help='ID of the function to modify (can be anything for "project")')
-    kw_parser.add_argument('kwargs', nargs='*', help='Pairs of keyword and value')
-
-    # Default options
-    def_parser = subparsers.add_parser('default-options', help='Modify the project default options', formatter_class=formatter)
-    def_parser.add_argument('operation', choices=rewriter_keys['default_options']['operation'][2],
-                            help='Action to execute')
-    def_parser.add_argument('options', nargs='*', help='Key, value pairs of configuration option')
-
-    # JSON file/command
-    cmd_parser = subparsers.add_parser('command', help='Execute a JSON array of commands', formatter_class=formatter)
-    cmd_parser.add_argument('json', help='JSON string or file to execute')
-
-class RequiredKeys:
-    def __init__(self, keys):
-        self.keys = keys
-
-    def __call__(self, f):
-        @wraps(f)
-        def wrapped(*wrapped_args, **wrapped_kwargs):
-            assert(len(wrapped_args) >= 2)
-            cmd = wrapped_args[1]
-            for key, val in self.keys.items():
-                typ = val[0] # The type of the value
-                default = val[1] # The default value -- None is required
-                choices = val[2] # Valid choices -- None is for everything
-                if key not in cmd:
-                    if default is not None:
-                        cmd[key] = default
-                    else:
-                        raise RewriterException('Key "{}" is missing in object for {}'
-                                                .format(key, f.__name__))
-                if not isinstance(cmd[key], typ):
-                    raise RewriterException('Invalid type of "{}". Required is {} but provided was {}'
-                                            .format(key, typ.__name__, type(cmd[key]).__name__))
-                if choices is not None:
-                    assert(isinstance(choices, list))
-                    if cmd[key] not in choices:
-                        raise RewriterException('Invalid value of "{}": Possible values are {} but provided was "{}"'
-                                                .format(key, choices, cmd[key]))
-            return f(*wrapped_args, **wrapped_kwargs)
-
-        return wrapped
-
-class MTypeBase:
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        if node is None:
-            self.node = self._new_node()  # lgtm [py/init-calls-subclass] (node creation does not depend on base class state)
-        else:
-            self.node = node
-        self.node_type = None
-        for i in self.supported_nodes():  # lgtm [py/init-calls-subclass] (listing nodes does not depend on base class state)
-            if isinstance(self.node, i):
-                self.node_type = i
-
-    def _new_node(self):
-        # Overwrite in derived class
-        raise RewriterException('Internal error: _new_node of MTypeBase was called')
-
-    def can_modify(self):
-        return self.node_type is not None
-
-    def get_node(self):
-        return self.node
-
-    def supported_nodes(self):
-        # Overwrite in derived class
-        return []
-
-    def set_value(self, value):
-        # Overwrite in derived class
-        mlog.warning('Cannot set the value of type', mlog.bold(type(self).__name__), '--> skipping')
-
-    def add_value(self, value):
-        # Overwrite in derived class
-        mlog.warning('Cannot add a value of type', mlog.bold(type(self).__name__), '--> skipping')
-
-    def remove_value(self, value):
-        # Overwrite in derived class
-        mlog.warning('Cannot remove a value of type', mlog.bold(type(self).__name__), '--> skipping')
-
-    def remove_regex(self, value):
-        # Overwrite in derived class
-        mlog.warning('Cannot remove a regex in type', mlog.bold(type(self).__name__), '--> skipping')
-
-class MTypeStr(MTypeBase):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_node(self):
-        return StringNode(Token('', '', 0, 0, 0, None, ''))
-
-    def supported_nodes(self):
-        return [StringNode]
-
-    def set_value(self, value):
-        self.node.value = str(value)
-
-class MTypeBool(MTypeBase):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_node(self):
-        return BooleanNode(Token('', '', 0, 0, 0, None, False))
-
-    def supported_nodes(self):
-        return [BooleanNode]
-
-    def set_value(self, value):
-        self.node.value = bool(value)
-
-class MTypeID(MTypeBase):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_node(self):
-        return IdNode(Token('', '', 0, 0, 0, None, ''))
-
-    def supported_nodes(self):
-        return [IdNode]
-
-    def set_value(self, value):
-        self.node.value = str(value)
-
-class MTypeList(MTypeBase):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_node(self):
-        return ArrayNode(ArgumentNode(Token('', '', 0, 0, 0, None, '')), 0, 0, 0, 0)
-
-    def _new_element_node(self, value):
-        # Overwrite in derived class
-        raise RewriterException('Internal error: _new_element_node of MTypeList was called')
-
-    def _ensure_array_node(self):
-        if not isinstance(self.node, ArrayNode):
-            tmp = self.node
-            self.node = self._new_node()
-            self.node.args.arguments += [tmp]
-
-    def _check_is_equal(self, node, value) -> bool:
-        # Overwrite in derived class
-        return False
-
-    def _check_regex_matches(self, node, regex: str) -> bool:
-        # Overwrite in derived class
-        return False
-
-    def get_node(self):
-        if isinstance(self.node, ArrayNode):
-            if len(self.node.args.arguments) == 1:
-                return self.node.args.arguments[0]
-        return self.node
-
-    def supported_element_nodes(self):
-        # Overwrite in derived class
-        return []
-
-    def supported_nodes(self):
-        return [ArrayNode] + self.supported_element_nodes()
-
-    def set_value(self, value):
-        if not isinstance(value, list):
-            value = [value]
-        self._ensure_array_node()
-        self.node.args.arguments = [] # Remove all current nodes
-        for i in value:
-            self.node.args.arguments += [self._new_element_node(i)]
-
-    def add_value(self, value):
-        if not isinstance(value, list):
-            value = [value]
-        self._ensure_array_node()
-        for i in value:
-            self.node.args.arguments += [self._new_element_node(i)]
-
-    def _remove_helper(self, value, equal_func):
-        def check_remove_node(node):
-            for j in value:
-                if equal_func(i, j):
-                    return True
-            return False
-
-        if not isinstance(value, list):
-            value = [value]
-        self._ensure_array_node()
-        removed_list = []
-        for i in self.node.args.arguments:
-            if not check_remove_node(i):
-                removed_list += [i]
-        self.node.args.arguments = removed_list
-
-    def remove_value(self, value):
-        self._remove_helper(value, self._check_is_equal)
-
-    def remove_regex(self, regex: str):
-        self._remove_helper(regex, self._check_regex_matches)
-
-class MTypeStrList(MTypeList):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_element_node(self, value):
-        return StringNode(Token('', '', 0, 0, 0, None, str(value)))
-
-    def _check_is_equal(self, node, value) -> bool:
-        if isinstance(node, StringNode):
-            return node.value == value
-        return False
-
-    def _check_regex_matches(self, node, regex: str) -> bool:
-        if isinstance(node, StringNode):
-            return re.match(regex, node.value) is not None
-        return False
-
-    def supported_element_nodes(self):
-        return [StringNode]
-
-class MTypeIDList(MTypeList):
-    def __init__(self, node: T.Optional[BaseNode] = None):
-        super().__init__(node)
-
-    def _new_element_node(self, value):
-        return IdNode(Token('', '', 0, 0, 0, None, str(value)))
-
-    def _check_is_equal(self, node, value) -> bool:
-        if isinstance(node, IdNode):
-            return node.value == value
-        return False
-
-    def _check_regex_matches(self, node, regex: str) -> bool:
-        if isinstance(node, StringNode):
-            return re.match(regex, node.value) is not None
-        return False
-
-    def supported_element_nodes(self):
-        return [IdNode]
-
-rewriter_keys = {
-    'default_options': {
-        'operation': (str, None, ['set', 'delete']),
-        'options': (dict, {}, None)
-    },
-    'kwargs': {
-        'function': (str, None, None),
-        'id': (str, None, None),
-        'operation': (str, None, ['set', 'delete', 'add', 'remove', 'remove_regex', 'info']),
-        'kwargs': (dict, {}, None)
-    },
-    'target': {
-        'target': (str, None, None),
-        'operation': (str, None, ['src_add', 'src_rm', 'target_rm', 'target_add', 'info']),
-        'sources': (list, [], None),
-        'subdir': (str, '', None),
-        'target_type': (str, 'executable', ['both_libraries', 'executable', 'jar', 'library', 'shared_library', 'shared_module', 'static_library']),
-    }
-}
-
-rewriter_func_kwargs = {
-    'dependency': {
-        'language': MTypeStr,
-        'method': MTypeStr,
-        'native': MTypeBool,
-        'not_found_message': MTypeStr,
-        'required': MTypeBool,
-        'static': MTypeBool,
-        'version': MTypeStrList,
-        'modules': MTypeStrList
-    },
-    'target': {
-        'build_by_default': MTypeBool,
-        'build_rpath': MTypeStr,
-        'dependencies': MTypeIDList,
-        'gui_app': MTypeBool,
-        'link_with': MTypeIDList,
-        'export_dynamic': MTypeBool,
-        'implib': MTypeBool,
-        'install': MTypeBool,
-        'install_dir': MTypeStr,
-        'install_rpath': MTypeStr,
-        'pie': MTypeBool
-    },
-    'project': {
-        'default_options': MTypeStrList,
-        'meson_version': MTypeStr,
-        'license': MTypeStrList,
-        'subproject_dir': MTypeStr,
-        'version': MTypeStr
-    }
-}
-
-class Rewriter:
-    def __init__(self, sourcedir: str, generator: str = 'ninja', skip_errors: bool = False):
-        self.sourcedir = sourcedir
-        self.interpreter = IntrospectionInterpreter(sourcedir, '', generator, visitors = [AstIDGenerator(), AstIndentationGenerator(), AstConditionLevel()])
-        self.skip_errors = skip_errors
-        self.modefied_nodes = []
-        self.to_remove_nodes = []
-        self.to_add_nodes = []
-        self.functions = {
-            'default_options': self.process_default_options,
-            'kwargs': self.process_kwargs,
-            'target': self.process_target,
-        }
-        self.info_dump = None
-
-    def analyze_meson(self):
-        mlog.log('Analyzing meson file:', mlog.bold(os.path.join(self.sourcedir, environment.build_filename)))
-        self.interpreter.analyze()
-        mlog.log('  -- Project:', mlog.bold(self.interpreter.project_data['descriptive_name']))
-        mlog.log('  -- Version:', mlog.cyan(self.interpreter.project_data['version']))
-
-    def add_info(self, cmd_type: str, cmd_id: str, data: dict):
-        if self.info_dump is None:
-            self.info_dump = {}
-        if cmd_type not in self.info_dump:
-            self.info_dump[cmd_type] = {}
-        self.info_dump[cmd_type][cmd_id] = data
-
-    def print_info(self):
-        if self.info_dump is None:
-            return
-        sys.stderr.write(json.dumps(self.info_dump, indent=2))
-
-    def on_error(self):
-        if self.skip_errors:
-            return mlog.cyan('-->'), mlog.yellow('skipping')
-        return mlog.cyan('-->'), mlog.red('aborting')
-
-    def handle_error(self):
-        if self.skip_errors:
-            return None
-        raise MesonException('Rewriting the meson.build failed')
-
-    def find_target(self, target: str):
-        def check_list(name: str) -> T.List[BaseNode]:
-            result = []
-            for i in self.interpreter.targets:
-                if name == i['name'] or name == i['id']:
-                    result += [i]
-            return result
-
-        targets = check_list(target)
-        if targets:
-            if len(targets) == 1:
-                return targets[0]
-            else:
-                mlog.error('There are multiple targets matching', mlog.bold(target))
-                for i in targets:
-                    mlog.error('  -- Target name', mlog.bold(i['name']), 'with ID', mlog.bold(i['id']))
-                mlog.error('Please try again with the unique ID of the target', *self.on_error())
-                self.handle_error()
-                return None
-
-        # Check the assignments
-        tgt = None
-        if target in self.interpreter.assignments:
-            node = self.interpreter.assignments[target]
-            if isinstance(node, FunctionNode):
-                if node.func_name in ['executable', 'jar', 'library', 'shared_library', 'shared_module', 'static_library', 'both_libraries']:
-                    tgt = self.interpreter.assign_vals[target]
-
-        return tgt
-
-    def find_dependency(self, dependency: str):
-        def check_list(name: str):
-            for i in self.interpreter.dependencies:
-                if name == i['name']:
-                    return i
-            return None
-
-        dep = check_list(dependency)
-        if dep is not None:
-            return dep
-
-        # Check the assignments
-        if dependency in self.interpreter.assignments:
-            node = self.interpreter.assignments[dependency]
-            if isinstance(node, FunctionNode):
-                if node.func_name in ['dependency']:
-                    name = self.interpreter.flatten_args(node.args)[0]
-                    dep = check_list(name)
-
-        return dep
-
-    @RequiredKeys(rewriter_keys['default_options'])
-    def process_default_options(self, cmd):
-        # First, remove the old values
-        kwargs_cmd = {
-            'function': 'project',
-            'id': "/",
-            'operation': 'remove_regex',
-            'kwargs': {
-                'default_options': ['{}=.*'.format(x) for x in cmd['options'].keys()]
-            }
-        }
-        self.process_kwargs(kwargs_cmd)
-
-        # Then add the new values
-        if cmd['operation'] != 'set':
-            return
-
-        kwargs_cmd['operation'] = 'add'
-        kwargs_cmd['kwargs']['default_options'] = []
-
-        cdata = self.interpreter.coredata
-        options = {
-            **cdata.builtins,
-            **cdata.builtins_per_machine.host,
-            **{'build.' + k: o for k, o in cdata.builtins_per_machine.build.items()},
-            **cdata.backend_options,
-            **cdata.base_options,
-            **(dict(cdata.flatten_lang_iterator(cdata.compiler_options.host.items()))),
-            **{'build.' + k: o for k, o in cdata.flatten_lang_iterator(cdata.compiler_options.build.items())},
-            **cdata.user_options,
-        }
-
-        for key, val in sorted(cmd['options'].items()):
-            if key not in options:
-                mlog.error('Unknown options', mlog.bold(key), *self.on_error())
-                self.handle_error()
-                continue
-
-            try:
-                val = options[key].validate_value(val)
-            except MesonException as e:
-                mlog.error('Unable to set', mlog.bold(key), mlog.red(str(e)), *self.on_error())
-                self.handle_error()
-                continue
-
-            kwargs_cmd['kwargs']['default_options'] += ['{}={}'.format(key, val)]
-
-        self.process_kwargs(kwargs_cmd)
-
-    @RequiredKeys(rewriter_keys['kwargs'])
-    def process_kwargs(self, cmd):
-        mlog.log('Processing function type', mlog.bold(cmd['function']), 'with id', mlog.cyan("'" + cmd['id'] + "'"))
-        if cmd['function'] not in rewriter_func_kwargs:
-            mlog.error('Unknown function type', cmd['function'], *self.on_error())
-            return self.handle_error()
-        kwargs_def = rewriter_func_kwargs[cmd['function']]
-
-        # Find the function node to modify
-        node = None
-        arg_node = None
-        if cmd['function'] == 'project':
-            if cmd['id'] != '/':
-                mlog.error('The ID for the function type project must be "/"', *self.on_error())
-                return self.handle_error()
-            node = self.interpreter.project_node
-            arg_node = node.args
-        elif cmd['function'] == 'target':
-            tmp = self.find_target(cmd['id'])
-            if tmp:
-                node = tmp['node']
-                arg_node = node.args
-        elif cmd['function'] == 'dependency':
-            tmp = self.find_dependency(cmd['id'])
-            if tmp:
-                node = tmp['node']
-                arg_node = node.args
-        if not node:
-            mlog.error('Unable to find the function node')
-        assert(isinstance(node, FunctionNode))
-        assert(isinstance(arg_node, ArgumentNode))
-        # Transform the key nodes to plain strings
-        arg_node.kwargs = {k.value: v for k, v in arg_node.kwargs.items()}
-
-        # Print kwargs info
-        if cmd['operation'] == 'info':
-            info_data = {}
-            for key, val in sorted(arg_node.kwargs.items()):
-                info_data[key] = None
-                if isinstance(val, ElementaryNode):
-                    info_data[key] = val.value
-                elif isinstance(val, ArrayNode):
-                    data_list = []
-                    for i in val.args.arguments:
-                        element = None
-                        if isinstance(i, ElementaryNode):
-                            element = i.value
-                        data_list += [element]
-                    info_data[key] = data_list
-
-            self.add_info('kwargs', '{}#{}'.format(cmd['function'], cmd['id']), info_data)
-            return # Nothing else to do
-
-        # Modify the kwargs
-        num_changed = 0
-        for key, val in sorted(cmd['kwargs'].items()):
-            if key not in kwargs_def:
-                mlog.error('Cannot modify unknown kwarg', mlog.bold(key), *self.on_error())
-                self.handle_error()
-                continue
-
-            # Remove the key from the kwargs
-            if cmd['operation'] == 'delete':
-                if key in arg_node.kwargs:
-                    mlog.log('  -- Deleting', mlog.bold(key), 'from the kwargs')
-                    del arg_node.kwargs[key]
-                    num_changed += 1
-                else:
-                    mlog.log('  -- Key', mlog.bold(key), 'is already deleted')
-                continue
-
-            if key not in arg_node.kwargs:
-                arg_node.kwargs[key] = None
-            modifyer = kwargs_def[key](arg_node.kwargs[key])
-            if not modifyer.can_modify():
-                mlog.log('  -- Skipping', mlog.bold(key), 'because it is to complex to modify')
-
-            # Apply the operation
-            val_str = str(val)
-            if cmd['operation'] == 'set':
-                mlog.log('  -- Setting', mlog.bold(key), 'to', mlog.yellow(val_str))
-                modifyer.set_value(val)
-            elif cmd['operation'] == 'add':
-                mlog.log('  -- Adding', mlog.yellow(val_str), 'to', mlog.bold(key))
-                modifyer.add_value(val)
-            elif cmd['operation'] == 'remove':
-                mlog.log('  -- Removing', mlog.yellow(val_str), 'from', mlog.bold(key))
-                modifyer.remove_value(val)
-            elif cmd['operation'] == 'remove_regex':
-                mlog.log('  -- Removing all values matching', mlog.yellow(val_str), 'from', mlog.bold(key))
-                modifyer.remove_regex(val)
-
-            # Write back the result
-            arg_node.kwargs[key] = modifyer.get_node()
-            num_changed += 1
-
-        # Convert the keys back to IdNode's
-        arg_node.kwargs = {IdNode(Token('', '', 0, 0, 0, None, k)): v for k, v in arg_node.kwargs.items()}
-        if num_changed > 0 and node not in self.modefied_nodes:
-            self.modefied_nodes += [node]
-
-    def find_assignment_node(self, node: BaseNode) -> AssignmentNode:
-        if node.ast_id and node.ast_id in self.interpreter.reverse_assignment:
-            return self.interpreter.reverse_assignment[node.ast_id]
-        return None
-
-    @RequiredKeys(rewriter_keys['target'])
-    def process_target(self, cmd):
-        mlog.log('Processing target', mlog.bold(cmd['target']), 'operation', mlog.cyan(cmd['operation']))
-        target = self.find_target(cmd['target'])
-        if target is None and cmd['operation'] != 'target_add':
-            mlog.error('Unknown target', mlog.bold(cmd['target']), *self.on_error())
-            return self.handle_error()
-
-        # Make source paths relative to the current subdir
-        def rel_source(src: str) -> str:
-            subdir = os.path.abspath(os.path.join(self.sourcedir, target['subdir']))
-            if os.path.isabs(src):
-                return os.path.relpath(src, subdir)
-            elif not os.path.exists(src):
-                return src # Trust the user when the source doesn't exist
-            # Make sure that the path is relative to the subdir
-            return os.path.relpath(os.path.abspath(src), subdir)
-
-        if target is not None:
-            cmd['sources'] = [rel_source(x) for x in cmd['sources']]
-
-        # Utility function to get a list of the sources from a node
-        def arg_list_from_node(n):
-            args = []
-            if isinstance(n, FunctionNode):
-                args = list(n.args.arguments)
-                if n.func_name in build_target_functions:
-                    args.pop(0)
-            elif isinstance(n, ArrayNode):
-                args = n.args.arguments
-            elif isinstance(n, ArgumentNode):
-                args = n.arguments
-            return args
-
-        to_sort_nodes = []
-
-        if cmd['operation'] == 'src_add':
-            node = None
-            if target['sources']:
-                node = target['sources'][0]
-            else:
-                node = target['node']
-            assert(node is not None)
-
-            # Generate the current source list
-            src_list = []
-            for i in target['sources']:
-                for j in arg_list_from_node(i):
-                    if isinstance(j, StringNode):
-                        src_list += [j.value]
-
-            # Generate the new String nodes
-            to_append = []
-            for i in sorted(set(cmd['sources'])):
-                if i in src_list:
-                    mlog.log('  -- Source', mlog.green(i), 'is already defined for the target --> skipping')
-                    continue
-                mlog.log('  -- Adding source', mlog.green(i), 'at',
-                         mlog.yellow('{}:{}'.format(node.filename, node.lineno)))
-                token = Token('string', node.filename, 0, 0, 0, None, i)
-                to_append += [StringNode(token)]
-
-            # Append to the AST at the right place
-            arg_node = None
-            if isinstance(node, (FunctionNode, ArrayNode)):
-                arg_node = node.args
-            elif isinstance(node, ArgumentNode):
-                arg_node = node
-            assert(arg_node is not None)
-            arg_node.arguments += to_append
-
-            # Mark the node as modified
-            if arg_node not in to_sort_nodes and not isinstance(node, FunctionNode):
-                to_sort_nodes += [arg_node]
-            if node not in self.modefied_nodes:
-                self.modefied_nodes += [node]
-
-        elif cmd['operation'] == 'src_rm':
-            # Helper to find the exact string node and its parent
-            def find_node(src):
-                for i in target['sources']:
-                    for j in arg_list_from_node(i):
-                        if isinstance(j, StringNode):
-                            if j.value == src:
-                                return i, j
-                return None, None
-
-            for i in cmd['sources']:
-                # Try to find the node with the source string
-                root, string_node = find_node(i)
-                if root is None:
-                    mlog.warning('  -- Unable to find source', mlog.green(i), 'in the target')
-                    continue
-
-                # Remove the found string node from the argument list
-                arg_node = None
-                if isinstance(root, (FunctionNode, ArrayNode)):
-                    arg_node = root.args
-                elif isinstance(root, ArgumentNode):
-                    arg_node = root
-                assert(arg_node is not None)
-                mlog.log('  -- Removing source', mlog.green(i), 'from',
-                         mlog.yellow('{}:{}'.format(string_node.filename, string_node.lineno)))
-                arg_node.arguments.remove(string_node)
-
-                # Mark the node as modified
-                if arg_node not in to_sort_nodes and not isinstance(root, FunctionNode):
-                    to_sort_nodes += [arg_node]
-                if root not in self.modefied_nodes:
-                    self.modefied_nodes += [root]
-
-        elif cmd['operation'] == 'target_add':
-            if target is not None:
-                mlog.error('Can not add target', mlog.bold(cmd['target']), 'because it already exists', *self.on_error())
-                return self.handle_error()
-
-            id_base = re.sub(r'[- ]', '_', cmd['target'])
-            target_id = id_base + '_exe' if cmd['target_type'] == 'executable' else '_lib'
-            source_id = id_base + '_sources'
-            filename = os.path.join(cmd['subdir'], environment.build_filename)
-
-            # Build src list
-            src_arg_node = ArgumentNode(Token('string', filename, 0, 0, 0, None, ''))
-            src_arr_node = ArrayNode(src_arg_node, 0, 0, 0, 0)
-            src_far_node = ArgumentNode(Token('string', filename, 0, 0, 0, None, ''))
-            src_fun_node = FunctionNode(filename, 0, 0, 0, 0, 'files', src_far_node)
-            src_ass_node = AssignmentNode(filename, 0, 0, source_id, src_fun_node)
-            src_arg_node.arguments = [StringNode(Token('string', filename, 0, 0, 0, None, x)) for x in cmd['sources']]
-            src_far_node.arguments = [src_arr_node]
-
-            # Build target
-            tgt_arg_node = ArgumentNode(Token('string', filename, 0, 0, 0, None, ''))
-            tgt_fun_node = FunctionNode(filename, 0, 0, 0, 0, cmd['target_type'], tgt_arg_node)
-            tgt_ass_node = AssignmentNode(filename, 0, 0, target_id, tgt_fun_node)
-            tgt_arg_node.arguments = [
-                StringNode(Token('string', filename, 0, 0, 0, None, cmd['target'])),
-                IdNode(Token('string', filename, 0, 0, 0, None, source_id))
-            ]
-
-            src_ass_node.accept(AstIndentationGenerator())
-            tgt_ass_node.accept(AstIndentationGenerator())
-            self.to_add_nodes += [src_ass_node, tgt_ass_node]
-
-        elif cmd['operation'] == 'target_rm':
-            to_remove = self.find_assignment_node(target['node'])
-            if to_remove is None:
-                to_remove = target['node']
-            self.to_remove_nodes += [to_remove]
-            mlog.log('  -- Removing target', mlog.green(cmd['target']), 'at',
-                     mlog.yellow('{}:{}'.format(to_remove.filename, to_remove.lineno)))
-
-        elif cmd['operation'] == 'info':
-            # T.List all sources in the target
-            src_list = []
-            for i in target['sources']:
-                for j in arg_list_from_node(i):
-                    if isinstance(j, StringNode):
-                        src_list += [j.value]
-            test_data = {
-                'name': target['name'],
-                'sources': src_list
-            }
-            self.add_info('target', target['id'], test_data)
-
-        # Sort files
-        for i in to_sort_nodes:
-            convert = lambda text: int(text) if text.isdigit() else text.lower()
-            alphanum_key = lambda key: [convert(c) for c in re.split('([0-9]+)', key)]
-            path_sorter = lambda key: ([(key.count('/') <= idx, alphanum_key(x)) for idx, x in enumerate(key.split('/'))])
-
-            unknown = [x for x in i.arguments if not isinstance(x, StringNode)]
-            sources = [x for x in i.arguments if isinstance(x, StringNode)]
-            sources = sorted(sources, key=lambda x: path_sorter(x.value))
-            i.arguments = unknown + sources
-
-    def process(self, cmd):
-        if 'type' not in cmd:
-            raise RewriterException('Command has no key "type"')
-        if cmd['type'] not in self.functions:
-            raise RewriterException('Unknown command "{}". Supported commands are: {}'
-                                    .format(cmd['type'], list(self.functions.keys())))
-        self.functions[cmd['type']](cmd)
-
-    def apply_changes(self):
-        assert(all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.modefied_nodes))
-        assert(all(hasattr(x, 'lineno') and hasattr(x, 'colno') and hasattr(x, 'filename') for x in self.to_remove_nodes))
-        assert(all(isinstance(x, (ArrayNode, FunctionNode)) for x in self.modefied_nodes))
-        assert(all(isinstance(x, (ArrayNode, AssignmentNode, FunctionNode)) for x in self.to_remove_nodes))
-        # Sort based on line and column in reversed order
-        work_nodes = [{'node': x, 'action': 'modify'} for x in self.modefied_nodes]
-        work_nodes += [{'node': x, 'action': 'rm'} for x in self.to_remove_nodes]
-        work_nodes = list(sorted(work_nodes, key=lambda x: (x['node'].lineno, x['node'].colno), reverse=True))
-        work_nodes += [{'node': x, 'action': 'add'} for x in self.to_add_nodes]
-
-        # Generating the new replacement string
-        str_list = []
-        for i in work_nodes:
-            new_data = ''
-            if i['action'] == 'modify' or i['action'] == 'add':
-                printer = AstPrinter()
-                i['node'].accept(printer)
-                printer.post_process()
-                new_data = printer.result.strip()
-            data = {
-                'file': i['node'].filename,
-                'str': new_data,
-                'node': i['node'],
-                'action': i['action']
-            }
-            str_list += [data]
-
-        # Load build files
-        files = {}
-        for i in str_list:
-            if i['file'] in files:
-                continue
-            fpath = os.path.realpath(os.path.join(self.sourcedir, i['file']))
-            fdata = ''
-            # Create an empty file if it does not exist
-            if not os.path.exists(fpath):
-                with open(fpath, 'w'):
-                    pass
-            with open(fpath, 'r') as fp:
-                fdata = fp.read()
-
-            # Generate line offsets numbers
-            m_lines = fdata.splitlines(True)
-            offset = 0
-            line_offsets = []
-            for j in m_lines:
-                line_offsets += [offset]
-                offset += len(j)
-
-            files[i['file']] = {
-                'path': fpath,
-                'raw': fdata,
-                'offsets': line_offsets
-            }
-
-        # Replace in source code
-        def remove_node(i):
-            offsets = files[i['file']]['offsets']
-            raw = files[i['file']]['raw']
-            node = i['node']
-            line = node.lineno - 1
-            col = node.colno
-            start = offsets[line] + col
-            end = start
-            if isinstance(node, (ArrayNode, FunctionNode)):
-                end = offsets[node.end_lineno - 1] + node.end_colno
-
-            # Only removal is supported for assignments
-            elif isinstance(node, AssignmentNode) and i['action'] == 'rm':
-                if isinstance(node.value, (ArrayNode, FunctionNode)):
-                    remove_node({'file': i['file'], 'str': '', 'node': node.value, 'action': 'rm'})
-                    raw = files[i['file']]['raw']
-                while raw[end] != '=':
-                    end += 1
-                end += 1 # Handle the '='
-                while raw[end] in [' ', '\n', '\t']:
-                    end += 1
-
-            files[i['file']]['raw'] = raw[:start] + i['str'] + raw[end:]
-
-        for i in str_list:
-            if i['action'] in ['modify', 'rm']:
-                remove_node(i)
-            elif i['action'] in ['add']:
-                files[i['file']]['raw'] += i['str'] + '\n'
-
-        # Write the files back
-        for key, val in files.items():
-            mlog.log('Rewriting', mlog.yellow(key))
-            with open(val['path'], 'w') as fp:
-                fp.write(val['raw'])
-
-target_operation_map = {
-    'add': 'src_add',
-    'rm': 'src_rm',
-    'add_target': 'target_add',
-    'rm_target': 'target_rm',
-    'info': 'info',
-}
-
-def list_to_dict(in_list: T.List[str]) -> T.Dict[str, str]:
-    result = {}
-    it = iter(in_list)
-    try:
-        for i in it:
-            # calling next(it) is not a mistake, we're taking the next element from
-            # the iterator, avoiding the need to preprocess it into a sequence of
-            # key value pairs.
-            result[i] = next(it)
-    except StopIteration:
-        raise TypeError('in_list parameter of list_to_dict must have an even length.')
-    return result
-
-def generate_target(options) -> T.List[dict]:
-    return [{
-        'type': 'target',
-        'target': options.target,
-        'operation': target_operation_map[options.operation],
-        'sources': options.sources,
-        'subdir': options.subdir,
-        'target_type': options.tgt_type,
-    }]
-
-def generate_kwargs(options) -> T.List[dict]:
-    return [{
-        'type': 'kwargs',
-        'function': options.function,
-        'id': options.id,
-        'operation': options.operation,
-        'kwargs': list_to_dict(options.kwargs),
-    }]
-
-def generate_def_opts(options) -> T.List[dict]:
-    return [{
-        'type': 'default_options',
-        'operation': options.operation,
-        'options': list_to_dict(options.options),
-    }]
-
-def genreate_cmd(options) -> T.List[dict]:
-    if os.path.exists(options.json):
-        with open(options.json, 'r') as fp:
-            return json.load(fp)
-    else:
-        return json.loads(options.json)
-
-# Map options.type to the actual type name
-cli_type_map = {
-    'target': generate_target,
-    'tgt': generate_target,
-    'kwargs': generate_kwargs,
-    'default-options': generate_def_opts,
-    'def': generate_def_opts,
-    'command': genreate_cmd,
-    'cmd': genreate_cmd,
-}
-
-def run(options):
-    if not options.verbose:
-        mlog.set_quiet()
-
-    try:
-        rewriter = Rewriter(options.sourcedir, skip_errors=options.skip)
-        rewriter.analyze_meson()
-
-        if options.type is None:
-            mlog.error('No command specified')
-            return 1
-
-        commands = cli_type_map[options.type](options)
-
-        if not isinstance(commands, list):
-            raise TypeError('Command is not a list')
-
-        for i in commands:
-            if not isinstance(i, object):
-                raise TypeError('Command is not an object')
-            rewriter.process(i)
-
-        rewriter.apply_changes()
-        rewriter.print_info()
-        return 0
-    except Exception as e:
-        raise e
-    finally:
-        mlog.set_verbose()
diff --git a/meson/mesonbuild/scripts/__init__.py b/meson/mesonbuild/scripts/__init__.py
deleted file mode 100644 (file)
index af6bedc..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-def destdir_join(d1, d2):
-    # c:\destdir + c:\prefix must produce c:\destdir\prefix
-    if len(d1) > 1 and d1[1] == ':' \
-            and len(d2) > 1 and d2[1] == ':':
-        return d1 + d2[2:]
-    return d1 + d2
diff --git a/meson/mesonbuild/scripts/clangformat.py b/meson/mesonbuild/scripts/clangformat.py
deleted file mode 100644 (file)
index 4b441de..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import pathlib
-import subprocess
-from concurrent.futures import ThreadPoolExecutor
-
-from ..environment import detect_clangformat
-from ..compilers import lang_suffixes
-
-def clangformat(exelist, srcdir_name, builddir_name):
-    srcdir = pathlib.Path(srcdir_name)
-    suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp']))
-    suffixes.add('h')
-    futures = []
-    with ThreadPoolExecutor() as e:
-        for f in (x for suff in suffixes for x in srcdir.glob('**/*.' + suff)):
-            strf = str(f)
-            if strf.startswith(builddir_name):
-                continue
-            futures.append(e.submit(subprocess.check_call, exelist + ['-style=file', '-i', strf]))
-        [x.result() for x in futures]
-    return 0
-
-def run(args):
-    srcdir_name = args[0]
-    builddir_name = args[1]
-
-    exelist = detect_clangformat()
-    if not exelist:
-        print('Could not execute clang-format "%s"' % ' '.join(exelist))
-        return 1
-
-    return clangformat(exelist, srcdir_name, builddir_name)
diff --git a/meson/mesonbuild/scripts/clangtidy.py b/meson/mesonbuild/scripts/clangtidy.py
deleted file mode 100644 (file)
index 0452086..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import pathlib
-import subprocess
-import shutil
-from concurrent.futures import ThreadPoolExecutor
-
-from ..compilers import lang_suffixes
-
-def manual_clangformat(srcdir_name, builddir_name):
-    srcdir = pathlib.Path(srcdir_name)
-    suffixes = set(lang_suffixes['c']).union(set(lang_suffixes['cpp']))
-    suffixes.add('h')
-    futures = []
-    returncode = 0
-    with ThreadPoolExecutor() as e:
-        for f in (x for suff in suffixes for x in srcdir.glob('**/*.' + suff)):
-            strf = str(f)
-            if strf.startswith(builddir_name):
-                continue
-            futures.append(e.submit(subprocess.run, ['clang-tidy', '-p', builddir_name, strf]))
-        [max(returncode, x.result().returncode) for x in futures]
-    return returncode
-
-def clangformat(srcdir_name, builddir_name):
-    run_clang_tidy = None
-    for rct in ('run-clang-tidy', 'run-clang-tidy.py'):
-        if shutil.which(rct):
-            run_clang_tidy = rct
-            break
-    if run_clang_tidy:
-        return subprocess.run([run_clang_tidy, '-p', builddir_name]).returncode
-    else:
-        print('Could not find run-clang-tidy, running checks manually.')
-        manual_clangformat(srcdir_name, builddir_name)
-
-def run(args):
-    srcdir_name = args[0]
-    builddir_name = args[1]
-    return clangformat(srcdir_name, builddir_name)
diff --git a/meson/mesonbuild/scripts/cleantrees.py b/meson/mesonbuild/scripts/cleantrees.py
deleted file mode 100644 (file)
index 0af8dd0..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import sys
-import shutil
-import pickle
-
-def rmtrees(build_dir, trees):
-    for t in trees:
-        # Never delete trees outside of the builddir
-        if os.path.isabs(t):
-            print('Cannot delete dir with absolute path {!r}'.format(t))
-            continue
-        bt = os.path.join(build_dir, t)
-        # Skip if it doesn't exist, or if it is not a directory
-        if os.path.isdir(bt):
-            shutil.rmtree(bt, ignore_errors=True)
-
-def run(args):
-    if len(args) != 1:
-        print('Cleaner script for Meson. Do not run on your own please.')
-        print('cleantrees.py <data-file>')
-        return 1
-    with open(args[0], 'rb') as f:
-        data = pickle.load(f)
-    rmtrees(data.build_dir, data.trees)
-    # Never fail cleaning
-    return 0
-
-if __name__ == '__main__':
-    run(sys.argv[1:])
diff --git a/meson/mesonbuild/scripts/cmake_run_ctgt.py b/meson/mesonbuild/scripts/cmake_run_ctgt.py
deleted file mode 100755 (executable)
index 5c0b31f..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env python3
-
-import argparse
-import subprocess
-import shutil
-import os
-import sys
-from pathlib import Path
-
-def run(argsv):
-    commands = [[]]
-    SEPARATOR = ';;;'
-
-    # Generate CMD parameters
-    parser = argparse.ArgumentParser(description='Wrapper for add_custom_command')
-    parser.add_argument('-d', '--directory', type=str, metavar='D', required=True, help='Working directory to cwd to')
-    parser.add_argument('-o', '--outputs', nargs='+', metavar='O', required=True, help='Expected output files')
-    parser.add_argument('-O', '--original-outputs', nargs='*', metavar='O', default=[], help='Output files expected by CMake')
-    parser.add_argument('commands', nargs=argparse.REMAINDER, help='A "{}" seperated list of commands'.format(SEPARATOR))
-
-    # Parse
-    args = parser.parse_args(argsv)
-
-    dummy_target = None
-    if len(args.outputs) == 1 and len(args.original_outputs) == 0:
-        dummy_target = args.outputs[0]
-    elif len(args.outputs) != len(args.original_outputs):
-        print('Length of output list and original output list differ')
-        sys.exit(1)
-
-    for i in args.commands:
-        if i == SEPARATOR:
-            commands += [[]]
-            continue
-
-        i = i.replace('"', '')  # Remove lefover quotes
-        commands[-1] += [i]
-
-    # Execute
-    for i in commands:
-        # Skip empty lists
-        if not i:
-            continue
-
-        cmd = []
-        stdout = None
-        stderr = None
-        capture_file = ''
-
-        for j in i:
-            if j in ['>', '>>']:
-                stdout = subprocess.PIPE
-                continue
-            elif j in ['&>', '&>>']:
-                stdout = subprocess.PIPE
-                stderr = subprocess.STDOUT
-                continue
-
-            if stdout is not None or stderr is not None:
-                capture_file += j
-            else:
-                cmd += [j]
-
-        try:
-            os.makedirs(args.directory, exist_ok=True)
-
-            res = subprocess.run(cmd, stdout=stdout, stderr=stderr, cwd=args.directory, check=True)
-            if capture_file:
-                out_file = Path(args.directory) / capture_file
-                out_file.write_bytes(res.stdout)
-        except subprocess.CalledProcessError:
-            sys.exit(1)
-
-    if dummy_target:
-        with open(dummy_target, 'a'):
-            os.utime(dummy_target, None)
-        sys.exit(0)
-
-    # Copy outputs
-    zipped_outputs = zip(args.outputs, args.original_outputs)
-    for expected, generated in zipped_outputs:
-        do_copy = False
-        if not os.path.exists(expected):
-            if not os.path.exists(generated):
-                print('Unable to find generated file. This can cause the build to fail:')
-                print(generated)
-                do_copy = False
-            else:
-                do_copy = True
-        elif os.path.exists(generated):
-            if os.path.getmtime(generated) > os.path.getmtime(expected):
-                do_copy = True
-
-        if do_copy:
-            if os.path.exists(expected):
-                os.remove(expected)
-            shutil.copyfile(generated, expected)
-
-if __name__ == '__main__':
-    sys.run(sys.argv[1:])
diff --git a/meson/mesonbuild/scripts/commandrunner.py b/meson/mesonbuild/scripts/commandrunner.py
deleted file mode 100644 (file)
index 22da417..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-# Copyright 2014 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""This program is a wrapper to run external commands. It determines
-what to run, sets up the environment and executes the command."""
-
-import sys, os, subprocess, shutil, shlex
-import re
-
-def run_command(source_dir, build_dir, subdir, meson_command, command, arguments):
-    env = {'MESON_SOURCE_ROOT': source_dir,
-           'MESON_BUILD_ROOT': build_dir,
-           'MESON_SUBDIR': subdir,
-           'MESONINTROSPECT': ' '.join([shlex.quote(x) for x in meson_command + ['introspect']]),
-           }
-    cwd = os.path.join(source_dir, subdir)
-    child_env = os.environ.copy()
-    child_env.update(env)
-
-    # Is the command an executable in path?
-    exe = shutil.which(command)
-    if exe is not None:
-        command_array = [exe] + arguments
-    else:# No? Maybe it is a script in the source tree.
-        fullpath = os.path.join(source_dir, subdir, command)
-        command_array = [fullpath] + arguments
-    try:
-        return subprocess.Popen(command_array, env=child_env, cwd=cwd)
-    except FileNotFoundError:
-        print('Could not execute command "%s". File not found.' % command)
-        sys.exit(1)
-    except PermissionError:
-        print('Could not execute command "%s". File not executable.' % command)
-        sys.exit(1)
-    except OSError as err:
-        print('Could not execute command "{}": {}'.format(command, err))
-        sys.exit(1)
-    except subprocess.SubprocessError as err:
-        print('Could not execute command "{}": {}'.format(command, err))
-        sys.exit(1)
-
-def is_python_command(cmdname):
-    end_py_regex = r'python(3|3\.\d+)?(\.exe)?$'
-    return re.search(end_py_regex, cmdname) is not None
-
-def run(args):
-    if len(args) < 4:
-        print('commandrunner.py <source dir> <build dir> <subdir> <command> [arguments]')
-        return 1
-    src_dir = args[0]
-    build_dir = args[1]
-    subdir = args[2]
-    meson_command = args[3]
-    if is_python_command(meson_command):
-        meson_command = [meson_command, args[4]]
-        command = args[5]
-        arguments = args[6:]
-    else:
-        meson_command = [meson_command]
-        command = args[4]
-        arguments = args[5:]
-    pc = run_command(src_dir, build_dir, subdir, meson_command, command, arguments)
-    while True:
-        try:
-            pc.wait()
-            break
-        except KeyboardInterrupt:
-            pass
-    return pc.returncode
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/coverage.py b/meson/mesonbuild/scripts/coverage.py
deleted file mode 100644 (file)
index 7231972..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-# Copyright 2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from mesonbuild import environment, mesonlib
-
-import argparse, sys, os, subprocess, pathlib, stat
-
-def coverage(outputs, source_root, subproject_root, build_root, log_dir, use_llvm_cov):
-    outfiles = []
-    exitcode = 0
-
-    (gcovr_exe, gcovr_new_rootdir, lcov_exe, genhtml_exe, llvm_cov_exe) = environment.find_coverage_tools()
-
-    # gcovr >= 4.2 requires a different syntax for out of source builds
-    if gcovr_new_rootdir:
-        gcovr_base_cmd = [gcovr_exe, '-r', source_root, build_root]
-    else:
-        gcovr_base_cmd = [gcovr_exe, '-r', build_root]
-
-    if use_llvm_cov:
-        gcov_exe_args = ['--gcov-executable', llvm_cov_exe + ' gcov']
-    else:
-        gcov_exe_args = []
-
-    if not outputs or 'xml' in outputs:
-        if gcovr_exe:
-            subprocess.check_call(gcovr_base_cmd +
-                                  ['-x',
-                                   '-e', subproject_root,
-                                   '-o', os.path.join(log_dir, 'coverage.xml')
-                                   ] + gcov_exe_args)
-            outfiles.append(('Xml', pathlib.Path(log_dir, 'coverage.xml')))
-        elif outputs:
-            print('gcovr >= 3.3 needed to generate Xml coverage report')
-            exitcode = 1
-
-    if not outputs or 'text' in outputs:
-        if gcovr_exe:
-            subprocess.check_call(gcovr_base_cmd +
-                                  ['-e', subproject_root,
-                                   '-o', os.path.join(log_dir, 'coverage.txt')
-                                   ] + gcov_exe_args)
-            outfiles.append(('Text', pathlib.Path(log_dir, 'coverage.txt')))
-        elif outputs:
-            print('gcovr >= 3.3 needed to generate text coverage report')
-            exitcode = 1
-
-    if not outputs or 'html' in outputs:
-        if lcov_exe and genhtml_exe:
-            htmloutdir = os.path.join(log_dir, 'coveragereport')
-            covinfo = os.path.join(log_dir, 'coverage.info')
-            initial_tracefile = covinfo + '.initial'
-            run_tracefile = covinfo + '.run'
-            raw_tracefile = covinfo + '.raw'
-            if use_llvm_cov:
-                # Create a shim to allow using llvm-cov as a gcov tool.
-                if mesonlib.is_windows():
-                    llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.bat')
-                    with open(llvm_cov_shim_path, 'w') as llvm_cov_bat:
-                        llvm_cov_bat.write('@"{}" gcov %*'.format(llvm_cov_exe))
-                else:
-                    llvm_cov_shim_path = os.path.join(log_dir, 'llvm-cov.sh')
-                    with open(llvm_cov_shim_path, 'w') as llvm_cov_sh:
-                        llvm_cov_sh.write('#!/usr/bin/env sh\nexec "{}" gcov $@'.format(llvm_cov_exe))
-                    os.chmod(llvm_cov_shim_path, os.stat(llvm_cov_shim_path).st_mode | stat.S_IEXEC)
-                gcov_tool_args = ['--gcov-tool', llvm_cov_shim_path]
-            else:
-                gcov_tool_args = []
-            subprocess.check_call([lcov_exe,
-                                   '--directory', build_root,
-                                   '--capture',
-                                   '--initial',
-                                   '--output-file',
-                                   initial_tracefile] +
-                                  gcov_tool_args)
-            subprocess.check_call([lcov_exe,
-                                   '--directory', build_root,
-                                   '--capture',
-                                   '--output-file', run_tracefile,
-                                   '--no-checksum',
-                                   '--rc', 'lcov_branch_coverage=1'] +
-                                  gcov_tool_args)
-            # Join initial and test results.
-            subprocess.check_call([lcov_exe,
-                                   '-a', initial_tracefile,
-                                   '-a', run_tracefile,
-                                   '--rc', 'lcov_branch_coverage=1',
-                                   '-o', raw_tracefile])
-            # Remove all directories outside the source_root from the covinfo
-            subprocess.check_call([lcov_exe,
-                                   '--extract', raw_tracefile,
-                                   os.path.join(source_root, '*'),
-                                   '--rc', 'lcov_branch_coverage=1',
-                                   '--output-file', covinfo])
-            # Remove all directories inside subproject dir
-            subprocess.check_call([lcov_exe,
-                                   '--remove', covinfo,
-                                   os.path.join(subproject_root, '*'),
-                                   '--rc', 'lcov_branch_coverage=1',
-                                   '--output-file', covinfo])
-            subprocess.check_call([genhtml_exe,
-                                   '--prefix', build_root,
-                                   '--prefix', source_root,
-                                   '--output-directory', htmloutdir,
-                                   '--title', 'Code coverage',
-                                   '--legend',
-                                   '--show-details',
-                                   '--branch-coverage',
-                                   covinfo])
-            outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html')))
-        elif gcovr_exe:
-            htmloutdir = os.path.join(log_dir, 'coveragereport')
-            if not os.path.isdir(htmloutdir):
-                os.mkdir(htmloutdir)
-            subprocess.check_call(gcovr_base_cmd +
-                                  ['--html',
-                                   '--html-details',
-                                   '--print-summary',
-                                   '-e', subproject_root,
-                                   '-o', os.path.join(htmloutdir, 'index.html'),
-                                   ])
-            outfiles.append(('Html', pathlib.Path(htmloutdir, 'index.html')))
-        elif outputs:
-            print('lcov/genhtml or gcovr >= 3.3 needed to generate Html coverage report')
-            exitcode = 1
-
-    if not outputs and not outfiles:
-        print('Need gcovr or lcov/genhtml to generate any coverage reports')
-        exitcode = 1
-
-    if outfiles:
-        print('')
-        for (filetype, path) in outfiles:
-            print(filetype + ' coverage report can be found at', path.as_uri())
-
-    return exitcode
-
-def run(args):
-    if not os.path.isfile('build.ninja'):
-        print('Coverage currently only works with the Ninja backend.')
-        return 1
-    parser = argparse.ArgumentParser(description='Generate coverage reports')
-    parser.add_argument('--text', dest='outputs', action='append_const',
-                        const='text', help='generate Text report')
-    parser.add_argument('--xml', dest='outputs', action='append_const',
-                        const='xml', help='generate Xml report')
-    parser.add_argument('--html', dest='outputs', action='append_const',
-                        const='html', help='generate Html report')
-    parser.add_argument('--use_llvm_cov', action='store_true',
-                        help='use llvm-cov')
-    parser.add_argument('source_root')
-    parser.add_argument('subproject_root')
-    parser.add_argument('build_root')
-    parser.add_argument('log_dir')
-    options = parser.parse_args(args)
-    return coverage(options.outputs, options.source_root,
-                    options.subproject_root, options.build_root,
-                    options.log_dir, options.use_llvm_cov)
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/delwithsuffix.py b/meson/mesonbuild/scripts/delwithsuffix.py
deleted file mode 100644 (file)
index 0d410ae..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-# Copyright 2013 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os, sys
-
-def run(args):
-    if len(args) != 2:
-        print('delwithsuffix.py <root of subdir to process> <suffix to delete>')
-        sys.exit(1)
-
-    topdir = args[0]
-    suffix = args[1]
-    if suffix[0] != '.':
-        suffix = '.' + suffix
-
-    for (root, _, files) in os.walk(topdir):
-        for f in files:
-            if f.endswith(suffix):
-                fullname = os.path.join(root, f)
-                os.unlink(fullname)
-    return 0
-
-if __name__ == '__main__':
-    run(sys.argv[1:])
diff --git a/meson/mesonbuild/scripts/depfixer.py b/meson/mesonbuild/scripts/depfixer.py
deleted file mode 100644 (file)
index f927693..0000000
+++ /dev/null
@@ -1,478 +0,0 @@
-# Copyright 2013-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-import sys, struct
-import shutil, subprocess
-
-from ..mesonlib import OrderedSet
-
-SHT_STRTAB = 3
-DT_NEEDED = 1
-DT_RPATH = 15
-DT_RUNPATH = 29
-DT_STRTAB = 5
-DT_SONAME = 14
-DT_MIPS_RLD_MAP_REL = 1879048245
-
-# Global cache for tools
-INSTALL_NAME_TOOL = False
-
-class DataSizes:
-    def __init__(self, ptrsize, is_le):
-        if is_le:
-            p = '<'
-        else:
-            p = '>'
-        self.Half = p + 'h'
-        self.HalfSize = 2
-        self.Word = p + 'I'
-        self.WordSize = 4
-        self.Sword = p + 'i'
-        self.SwordSize = 4
-        if ptrsize == 64:
-            self.Addr = p + 'Q'
-            self.AddrSize = 8
-            self.Off = p + 'Q'
-            self.OffSize = 8
-            self.XWord = p + 'Q'
-            self.XWordSize = 8
-            self.Sxword = p + 'q'
-            self.SxwordSize = 8
-        else:
-            self.Addr = p + 'I'
-            self.AddrSize = 4
-            self.Off = p + 'I'
-            self.OffSize = 4
-
-class DynamicEntry(DataSizes):
-    def __init__(self, ifile, ptrsize, is_le):
-        super().__init__(ptrsize, is_le)
-        self.ptrsize = ptrsize
-        if ptrsize == 64:
-            self.d_tag = struct.unpack(self.Sxword, ifile.read(self.SxwordSize))[0]
-            self.val = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]
-        else:
-            self.d_tag = struct.unpack(self.Sword, ifile.read(self.SwordSize))[0]
-            self.val = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-
-    def write(self, ofile):
-        if self.ptrsize == 64:
-            ofile.write(struct.pack(self.Sxword, self.d_tag))
-            ofile.write(struct.pack(self.XWord, self.val))
-        else:
-            ofile.write(struct.pack(self.Sword, self.d_tag))
-            ofile.write(struct.pack(self.Word, self.val))
-
-class SectionHeader(DataSizes):
-    def __init__(self, ifile, ptrsize, is_le):
-        super().__init__(ptrsize, is_le)
-        if ptrsize == 64:
-            is_64 = True
-        else:
-            is_64 = False
-# Elf64_Word
-        self.sh_name = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Word
-        self.sh_type = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Xword
-        if is_64:
-            self.sh_flags = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]
-        else:
-            self.sh_flags = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Addr
-        self.sh_addr = struct.unpack(self.Addr, ifile.read(self.AddrSize))[0]
-# Elf64_Off
-        self.sh_offset = struct.unpack(self.Off, ifile.read(self.OffSize))[0]
-# Elf64_Xword
-        if is_64:
-            self.sh_size = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]
-        else:
-            self.sh_size = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Word
-        self.sh_link = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Word
-        self.sh_info = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Xword
-        if is_64:
-            self.sh_addralign = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]
-        else:
-            self.sh_addralign = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-# Elf64_Xword
-        if is_64:
-            self.sh_entsize = struct.unpack(self.XWord, ifile.read(self.XWordSize))[0]
-        else:
-            self.sh_entsize = struct.unpack(self.Word, ifile.read(self.WordSize))[0]
-
-class Elf(DataSizes):
-    def __init__(self, bfile, verbose=True):
-        self.bfile = bfile
-        self.verbose = verbose
-        self.bf = open(bfile, 'r+b')
-        try:
-            (self.ptrsize, self.is_le) = self.detect_elf_type()
-            super().__init__(self.ptrsize, self.is_le)
-            self.parse_header()
-            self.parse_sections()
-            self.parse_dynamic()
-        except (struct.error, RuntimeError):
-            self.bf.close()
-            raise
-
-    def __enter__(self):
-        return self
-
-    def __del__(self):
-        if self.bf:
-            self.bf.close()
-
-    def __exit__(self, exc_type, exc_value, traceback):
-        self.bf.close()
-        self.bf = None
-
-    def detect_elf_type(self):
-        data = self.bf.read(6)
-        if data[1:4] != b'ELF':
-            # This script gets called to non-elf targets too
-            # so just ignore them.
-            if self.verbose:
-                print('File "%s" is not an ELF file.' % self.bfile)
-            sys.exit(0)
-        if data[4] == 1:
-            ptrsize = 32
-        elif data[4] == 2:
-            ptrsize = 64
-        else:
-            sys.exit('File "%s" has unknown ELF class.' % self.bfile)
-        if data[5] == 1:
-            is_le = True
-        elif data[5] == 2:
-            is_le = False
-        else:
-            sys.exit('File "%s" has unknown ELF endianness.' % self.bfile)
-        return ptrsize, is_le
-
-    def parse_header(self):
-        self.bf.seek(0)
-        self.e_ident = struct.unpack('16s', self.bf.read(16))[0]
-        self.e_type = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_machine = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_version = struct.unpack(self.Word, self.bf.read(self.WordSize))[0]
-        self.e_entry = struct.unpack(self.Addr, self.bf.read(self.AddrSize))[0]
-        self.e_phoff = struct.unpack(self.Off, self.bf.read(self.OffSize))[0]
-        self.e_shoff = struct.unpack(self.Off, self.bf.read(self.OffSize))[0]
-        self.e_flags = struct.unpack(self.Word, self.bf.read(self.WordSize))[0]
-        self.e_ehsize = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_phentsize = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_phnum = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_shentsize = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_shnum = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-        self.e_shstrndx = struct.unpack(self.Half, self.bf.read(self.HalfSize))[0]
-
-    def parse_sections(self):
-        self.bf.seek(self.e_shoff)
-        self.sections = []
-        for _ in range(self.e_shnum):
-            self.sections.append(SectionHeader(self.bf, self.ptrsize, self.is_le))
-
-    def read_str(self):
-        arr = []
-        x = self.bf.read(1)
-        while x != b'\0':
-            arr.append(x)
-            x = self.bf.read(1)
-            if x == b'':
-                raise RuntimeError('Tried to read past the end of the file')
-        return b''.join(arr)
-
-    def find_section(self, target_name):
-        section_names = self.sections[self.e_shstrndx]
-        for i in self.sections:
-            self.bf.seek(section_names.sh_offset + i.sh_name)
-            name = self.read_str()
-            if name == target_name:
-                return i
-
-    def parse_dynamic(self):
-        sec = self.find_section(b'.dynamic')
-        self.dynamic = []
-        if sec is None:
-            return
-        self.bf.seek(sec.sh_offset)
-        while True:
-            e = DynamicEntry(self.bf, self.ptrsize, self.is_le)
-            self.dynamic.append(e)
-            if e.d_tag == 0:
-                break
-
-    def print_section_names(self):
-        section_names = self.sections[self.e_shstrndx]
-        for i in self.sections:
-            self.bf.seek(section_names.sh_offset + i.sh_name)
-            name = self.read_str()
-            print(name.decode())
-
-    def print_soname(self):
-        soname = None
-        strtab = None
-        for i in self.dynamic:
-            if i.d_tag == DT_SONAME:
-                soname = i
-            if i.d_tag == DT_STRTAB:
-                strtab = i
-        if soname is None or strtab is None:
-            print("This file does not have a soname")
-            return
-        self.bf.seek(strtab.val + soname.val)
-        print(self.read_str())
-
-    def get_entry_offset(self, entrynum):
-        sec = self.find_section(b'.dynstr')
-        for i in self.dynamic:
-            if i.d_tag == entrynum:
-                return sec.sh_offset + i.val
-        return None
-
-    def print_rpath(self):
-        offset = self.get_entry_offset(DT_RPATH)
-        if offset is None:
-            print("This file does not have an rpath.")
-        else:
-            self.bf.seek(offset)
-            print(self.read_str())
-
-    def print_runpath(self):
-        offset = self.get_entry_offset(DT_RUNPATH)
-        if offset is None:
-            print("This file does not have a runpath.")
-        else:
-            self.bf.seek(offset)
-            print(self.read_str())
-
-    def print_deps(self):
-        sec = self.find_section(b'.dynstr')
-        deps = []
-        for i in self.dynamic:
-            if i.d_tag == DT_NEEDED:
-                deps.append(i)
-        for i in deps:
-            offset = sec.sh_offset + i.val
-            self.bf.seek(offset)
-            name = self.read_str()
-            print(name)
-
-    def fix_deps(self, prefix):
-        sec = self.find_section(b'.dynstr')
-        deps = []
-        for i in self.dynamic:
-            if i.d_tag == DT_NEEDED:
-                deps.append(i)
-        for i in deps:
-            offset = sec.sh_offset + i.val
-            self.bf.seek(offset)
-            name = self.read_str()
-            if name.startswith(prefix):
-                basename = name.split(b'/')[-1]
-                padding = b'\0' * (len(name) - len(basename))
-                newname = basename + padding
-                assert(len(newname) == len(name))
-                self.bf.seek(offset)
-                self.bf.write(newname)
-
-    def fix_rpath(self, rpath_dirs_to_remove, new_rpath):
-        # The path to search for can be either rpath or runpath.
-        # Fix both of them to be sure.
-        self.fix_rpathtype_entry(rpath_dirs_to_remove, new_rpath, DT_RPATH)
-        self.fix_rpathtype_entry(rpath_dirs_to_remove, new_rpath, DT_RUNPATH)
-
-    def fix_rpathtype_entry(self, rpath_dirs_to_remove, new_rpath, entrynum):
-        if isinstance(new_rpath, str):
-            new_rpath = new_rpath.encode('utf8')
-        rp_off = self.get_entry_offset(entrynum)
-        if rp_off is None:
-            if self.verbose:
-                print('File does not have rpath. It should be a fully static executable.')
-            return
-        self.bf.seek(rp_off)
-
-        old_rpath = self.read_str()
-        # Some rpath entries may come from multiple sources.
-        # Only add each one once.
-        new_rpaths = OrderedSet()
-        if new_rpath:
-            new_rpaths.add(new_rpath)
-        if old_rpath:
-            # Filter out build-only rpath entries
-            # added by get_link_dep_subdirs() or
-            # specified by user with build_rpath.
-            for rpath_dir in old_rpath.split(b':'):
-                if not (rpath_dir in rpath_dirs_to_remove or
-                        rpath_dir == (b'X' * len(rpath_dir))):
-                    if rpath_dir:
-                        new_rpaths.add(rpath_dir)
-
-        # Prepend user-specified new entries while preserving the ones that came from pkgconfig etc.
-        new_rpath = b':'.join(new_rpaths)
-
-        if len(old_rpath) < len(new_rpath):
-            msg = "New rpath must not be longer than the old one.\n Old: {}\n New: {}".format(old_rpath, new_rpath)
-            sys.exit(msg)
-        # The linker does read-only string deduplication. If there is a
-        # string that shares a suffix with the rpath, they might get
-        # dedupped. This means changing the rpath string might break something
-        # completely unrelated. This has already happened once with X.org.
-        # Thus we want to keep this change as small as possible to minimize
-        # the chance of obliterating other strings. It might still happen
-        # but our behavior is identical to what chrpath does and it has
-        # been in use for ages so based on that this should be rare.
-        if not new_rpath:
-            self.remove_rpath_entry(entrynum)
-        else:
-            self.bf.seek(rp_off)
-            self.bf.write(new_rpath)
-            self.bf.write(b'\0')
-
-    def remove_rpath_entry(self, entrynum):
-        sec = self.find_section(b'.dynamic')
-        if sec is None:
-            return None
-        for (i, entry) in enumerate(self.dynamic):
-            if entry.d_tag == entrynum:
-                rpentry = self.dynamic[i]
-                rpentry.d_tag = 0
-                self.dynamic = self.dynamic[:i] + self.dynamic[i + 1:] + [rpentry]
-                break
-        # DT_MIPS_RLD_MAP_REL is relative to the offset of the tag. Adjust it consequently.
-        for entry in self.dynamic[i:]:
-            if entry.d_tag == DT_MIPS_RLD_MAP_REL:
-                entry.val += 2 * (self.ptrsize // 8)
-                break
-        self.bf.seek(sec.sh_offset)
-        for entry in self.dynamic:
-            entry.write(self.bf)
-        return None
-
-def fix_elf(fname, rpath_dirs_to_remove, new_rpath, verbose=True):
-    with Elf(fname, verbose) as e:
-        if new_rpath is None:
-            e.print_rpath()
-            e.print_runpath()
-        else:
-            e.fix_rpath(rpath_dirs_to_remove, new_rpath)
-
-def get_darwin_rpaths_to_remove(fname):
-    out = subprocess.check_output(['otool', '-l', fname],
-                                  universal_newlines=True,
-                                  stderr=subprocess.DEVNULL)
-    result = []
-    current_cmd = 'FOOBAR'
-    for line in out.split('\n'):
-        line = line.strip()
-        if ' ' not in line:
-            continue
-        key, value = line.strip().split(' ', 1)
-        if key == 'cmd':
-            current_cmd = value
-        if key == 'path' and current_cmd == 'LC_RPATH':
-            rp = value.split('(', 1)[0].strip()
-            result.append(rp)
-    return result
-
-def fix_darwin(fname, new_rpath, final_path, install_name_mappings):
-    try:
-        rpaths = get_darwin_rpaths_to_remove(fname)
-    except subprocess.CalledProcessError:
-        # Otool failed, which happens when invoked on a
-        # non-executable target. Just return.
-        return
-    try:
-        args = []
-        if rpaths:
-            # TODO: fix this properly, not totally clear how
-            #
-            # removing rpaths from binaries on macOS has tons of
-            # weird edge cases. For instance, if the user provided
-            # a '-Wl,-rpath' argument in LDFLAGS that happens to
-            # coincide with an rpath generated from a dependency,
-            # this would cause installation failures, as meson would
-            # generate install_name_tool calls with two identical
-            # '-delete_rpath' arguments, which install_name_tool
-            # fails on. Because meson itself ensures that it never
-            # adds duplicate rpaths, duplicate rpaths necessarily
-            # come from user variables. The idea of using OrderedSet
-            # is to remove *at most one* duplicate RPATH entry. This
-            # is not optimal, as it only respects the user's choice
-            # partially: if they provided a non-duplicate '-Wl,-rpath'
-            # argument, it gets removed, if they provided a duplicate
-            # one, it remains in the final binary. A potentially optimal
-            # solution would split all user '-Wl,-rpath' arguments from
-            # LDFLAGS, and later add them back with '-add_rpath'.
-            for rp in OrderedSet(rpaths):
-                args += ['-delete_rpath', rp]
-            subprocess.check_call(['install_name_tool', fname] + args,
-                                  stdout=subprocess.DEVNULL,
-                                  stderr=subprocess.DEVNULL)
-        args = []
-        if new_rpath:
-            args += ['-add_rpath', new_rpath]
-        # Rewrite -install_name @rpath/libfoo.dylib to /path/to/libfoo.dylib
-        if fname.endswith('dylib'):
-            args += ['-id', final_path]
-        if install_name_mappings:
-            for old, new in install_name_mappings.items():
-                args += ['-change', old, new]
-        if args:
-            subprocess.check_call(['install_name_tool', fname] + args,
-                                  stdout=subprocess.DEVNULL,
-                                  stderr=subprocess.DEVNULL)
-    except Exception as err:
-        raise SystemExit(err)
-
-def fix_jar(fname):
-    subprocess.check_call(['jar', 'xfv', fname, 'META-INF/MANIFEST.MF'])
-    with open('META-INF/MANIFEST.MF', 'r+') as f:
-        lines = f.readlines()
-        f.seek(0)
-        for line in lines:
-            if not line.startswith('Class-Path:'):
-                f.write(line)
-        f.truncate()
-    subprocess.check_call(['jar', 'ufm', fname, 'META-INF/MANIFEST.MF'])
-
-def fix_rpath(fname, rpath_dirs_to_remove, new_rpath, final_path, install_name_mappings, verbose=True):
-    global INSTALL_NAME_TOOL
-    # Static libraries, import libraries, debug information, headers, etc
-    # never have rpaths
-    # DLLs and EXE currently do not need runtime path fixing
-    if fname.endswith(('.a', '.lib', '.pdb', '.h', '.hpp', '.dll', '.exe')):
-        return
-    try:
-        if fname.endswith('.jar'):
-            fix_jar(fname)
-            return
-        fix_elf(fname, rpath_dirs_to_remove, new_rpath, verbose)
-        return
-    except SystemExit as e:
-        if isinstance(e.code, int) and e.code == 0:
-            pass
-        else:
-            raise
-    # We don't look for this on import because it will do a useless PATH lookup
-    # on non-mac platforms. That can be expensive on some Windows machines
-    # (upto 30ms), which is significant with --only-changed. For details, see:
-    # https://github.com/mesonbuild/meson/pull/6612#discussion_r378581401
-    if INSTALL_NAME_TOOL is False:
-        INSTALL_NAME_TOOL = shutil.which('install_name_tool')
-    if INSTALL_NAME_TOOL:
-        fix_darwin(fname, new_rpath, final_path, install_name_mappings)
diff --git a/meson/mesonbuild/scripts/dirchanger.py b/meson/mesonbuild/scripts/dirchanger.py
deleted file mode 100644 (file)
index 3d7f4e2..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''CD into dir given as first argument and execute
-the command given in the rest of the arguments.'''
-
-import os, subprocess, sys
-
-def run(args):
-    dirname = args[0]
-    command = args[1:]
-
-    os.chdir(dirname)
-    return subprocess.call(command)
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/gettext.py b/meson/mesonbuild/scripts/gettext.py
deleted file mode 100644 (file)
index f5c0421..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import shutil
-import argparse
-import subprocess
-from . import destdir_join
-
-parser = argparse.ArgumentParser()
-parser.add_argument('command')
-parser.add_argument('--pkgname', default='')
-parser.add_argument('--datadirs', default='')
-parser.add_argument('--langs', default='')
-parser.add_argument('--localedir', default='')
-parser.add_argument('--subdir', default='')
-parser.add_argument('--extra-args', default='')
-
-def read_linguas(src_sub):
-    # Syntax of this file is documented here:
-    # https://www.gnu.org/software/gettext/manual/html_node/po_002fLINGUAS.html
-    linguas = os.path.join(src_sub, 'LINGUAS')
-    try:
-        langs = []
-        with open(linguas) as f:
-            for line in f:
-                line = line.strip()
-                if line and not line.startswith('#'):
-                    langs += line.split()
-        return langs
-    except (FileNotFoundError, PermissionError):
-        print('Could not find file LINGUAS in {}'.format(src_sub))
-        return []
-
-def run_potgen(src_sub, pkgname, datadirs, args):
-    listfile = os.path.join(src_sub, 'POTFILES.in')
-    if not os.path.exists(listfile):
-        listfile = os.path.join(src_sub, 'POTFILES')
-        if not os.path.exists(listfile):
-            print('Could not find file POTFILES in %s' % src_sub)
-            return 1
-
-    child_env = os.environ.copy()
-    if datadirs:
-        child_env['GETTEXTDATADIRS'] = datadirs
-
-    ofile = os.path.join(src_sub, pkgname + '.pot')
-    return subprocess.call(['xgettext', '--package-name=' + pkgname, '-p', src_sub, '-f', listfile,
-                            '-D', os.environ['MESON_SOURCE_ROOT'], '-k_', '-o', ofile] + args,
-                           env=child_env)
-
-def gen_gmo(src_sub, bld_sub, langs):
-    for l in langs:
-        subprocess.check_call(['msgfmt', os.path.join(src_sub, l + '.po'),
-                               '-o', os.path.join(bld_sub, l + '.gmo')])
-    return 0
-
-def update_po(src_sub, pkgname, langs):
-    potfile = os.path.join(src_sub, pkgname + '.pot')
-    for l in langs:
-        pofile = os.path.join(src_sub, l + '.po')
-        if os.path.exists(pofile):
-            subprocess.check_call(['msgmerge', '-q', '-o', pofile, pofile, potfile])
-        else:
-            subprocess.check_call(['msginit', '--input', potfile, '--output-file', pofile, '--locale', l, '--no-translator'])
-    return 0
-
-def do_install(src_sub, bld_sub, dest, pkgname, langs):
-    for l in langs:
-        srcfile = os.path.join(bld_sub, l + '.gmo')
-        outfile = os.path.join(dest, l, 'LC_MESSAGES',
-                               pkgname + '.mo')
-        tempfile = outfile + '.tmp'
-        os.makedirs(os.path.dirname(outfile), exist_ok=True)
-        shutil.copyfile(srcfile, tempfile)
-        shutil.copystat(srcfile, tempfile)
-        os.replace(tempfile, outfile)
-        print('Installing %s to %s' % (srcfile, outfile))
-    return 0
-
-def run(args):
-    options = parser.parse_args(args)
-    subcmd = options.command
-    langs = options.langs.split('@@') if options.langs else None
-    extra_args = options.extra_args.split('@@') if options.extra_args else []
-    subdir = os.environ.get('MESON_SUBDIR', '')
-    if options.subdir:
-        subdir = options.subdir
-    src_sub = os.path.join(os.environ['MESON_SOURCE_ROOT'], subdir)
-    bld_sub = os.path.join(os.environ['MESON_BUILD_ROOT'], subdir)
-
-    if not langs:
-        langs = read_linguas(src_sub)
-
-    if subcmd == 'pot':
-        return run_potgen(src_sub, options.pkgname, options.datadirs, extra_args)
-    elif subcmd == 'gen_gmo':
-        return gen_gmo(src_sub, bld_sub, langs)
-    elif subcmd == 'update_po':
-        if run_potgen(src_sub, options.pkgname, options.datadirs, extra_args) != 0:
-            return 1
-        return update_po(src_sub, options.pkgname, langs)
-    elif subcmd == 'install':
-        destdir = os.environ.get('DESTDIR', '')
-        dest = destdir_join(destdir, os.path.join(os.environ['MESON_INSTALL_PREFIX'],
-                                                  options.localedir))
-        if gen_gmo(src_sub, bld_sub, langs) != 0:
-            return 1
-        do_install(src_sub, bld_sub, dest, options.pkgname, langs)
-    else:
-        print('Unknown subcommand.')
-        return 1
diff --git a/meson/mesonbuild/scripts/gtkdochelper.py b/meson/mesonbuild/scripts/gtkdochelper.py
deleted file mode 100644 (file)
index 812604a..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys, os
-import subprocess
-import shutil
-import argparse
-from ..mesonlib import MesonException, Popen_safe, is_windows, is_cygwin, split_args
-from . import destdir_join
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument('--sourcedir', dest='sourcedir')
-parser.add_argument('--builddir', dest='builddir')
-parser.add_argument('--subdir', dest='subdir')
-parser.add_argument('--headerdirs', dest='headerdirs')
-parser.add_argument('--mainfile', dest='mainfile')
-parser.add_argument('--modulename', dest='modulename')
-parser.add_argument('--moduleversion', dest='moduleversion')
-parser.add_argument('--htmlargs', dest='htmlargs', default='')
-parser.add_argument('--scanargs', dest='scanargs', default='')
-parser.add_argument('--scanobjsargs', dest='scanobjsargs', default='')
-parser.add_argument('--gobjects-types-file', dest='gobject_typesfile', default='')
-parser.add_argument('--fixxrefargs', dest='fixxrefargs', default='')
-parser.add_argument('--mkdbargs', dest='mkdbargs', default='')
-parser.add_argument('--ld', dest='ld', default='')
-parser.add_argument('--cc', dest='cc', default='')
-parser.add_argument('--ldflags', dest='ldflags', default='')
-parser.add_argument('--cflags', dest='cflags', default='')
-parser.add_argument('--content-files', dest='content_files', default='')
-parser.add_argument('--expand-content-files', dest='expand_content_files', default='')
-parser.add_argument('--html-assets', dest='html_assets', default='')
-parser.add_argument('--ignore-headers', dest='ignore_headers', default='')
-parser.add_argument('--namespace', dest='namespace', default='')
-parser.add_argument('--mode', dest='mode', default='')
-parser.add_argument('--installdir', dest='install_dir')
-parser.add_argument('--run', dest='run', default='')
-for tool in ['scan', 'scangobj', 'mkdb', 'mkhtml', 'fixxref']:
-    program_name = 'gtkdoc-' + tool
-    parser.add_argument('--' + program_name, dest=program_name.replace('-', '_'))
-
-def gtkdoc_run_check(cmd, cwd, library_paths=None):
-    if library_paths is None:
-        library_paths = []
-
-    env = dict(os.environ)
-    if is_windows() or is_cygwin():
-        if 'PATH' in env:
-            library_paths.extend(env['PATH'].split(os.pathsep))
-        env['PATH'] = os.pathsep.join(library_paths)
-    else:
-        if 'LD_LIBRARY_PATH' in env:
-            library_paths.extend(env['LD_LIBRARY_PATH'].split(os.pathsep))
-        env['LD_LIBRARY_PATH'] = os.pathsep.join(library_paths)
-
-    if is_windows():
-        cmd.insert(0, sys.executable)
-
-    # Put stderr into stdout since we want to print it out anyway.
-    # This preserves the order of messages.
-    p, out = Popen_safe(cmd, cwd=cwd, env=env, stderr=subprocess.STDOUT)[0:2]
-    if p.returncode != 0:
-        err_msg = ["{!r} failed with status {:d}".format(cmd, p.returncode)]
-        if out:
-            err_msg.append(out)
-        raise MesonException('\n'.join(err_msg))
-    elif out:
-        # Unfortunately Windows cmd.exe consoles may be using a codepage
-        # that might choke print() with a UnicodeEncodeError, so let's
-        # ignore such errors for now, as a compromise as we are outputting
-        # console output here...
-        try:
-            print(out)
-        except UnicodeEncodeError:
-            pass
-
-def build_gtkdoc(source_root, build_root, doc_subdir, src_subdirs,
-                 main_file, module, module_version,
-                 html_args, scan_args, fixxref_args, mkdb_args,
-                 gobject_typesfile, scanobjs_args, run, ld, cc, ldflags, cflags,
-                 html_assets, content_files, ignore_headers, namespace,
-                 expand_content_files, mode, options):
-    print("Building documentation for %s" % module)
-
-    src_dir_args = []
-    for src_dir in src_subdirs:
-        if not os.path.isabs(src_dir):
-            dirs = [os.path.join(source_root, src_dir),
-                    os.path.join(build_root, src_dir)]
-        else:
-            dirs = [src_dir]
-        src_dir_args += ['--source-dir=' + d for d in dirs]
-
-    doc_src = os.path.join(source_root, doc_subdir)
-    abs_out = os.path.join(build_root, doc_subdir)
-    htmldir = os.path.join(abs_out, 'html')
-
-    content_files += [main_file]
-    sections = os.path.join(doc_src, module + "-sections.txt")
-    if os.path.exists(sections):
-        content_files.append(sections)
-
-    overrides = os.path.join(doc_src, module + "-overrides.txt")
-    if os.path.exists(overrides):
-        content_files.append(overrides)
-
-    # Copy files to build directory
-    for f in content_files:
-        # FIXME: Use mesonlib.File objects so we don't need to do this
-        if not os.path.isabs(f):
-            f = os.path.join(doc_src, f)
-        elif os.path.commonpath([f, build_root]) == build_root:
-            continue
-        shutil.copyfile(f, os.path.join(abs_out, os.path.basename(f)))
-
-    shutil.rmtree(htmldir, ignore_errors=True)
-    try:
-        os.mkdir(htmldir)
-    except Exception:
-        pass
-
-    for f in html_assets:
-        f_abs = os.path.join(doc_src, f)
-        shutil.copyfile(f_abs, os.path.join(htmldir, os.path.basename(f_abs)))
-
-    scan_cmd = [options.gtkdoc_scan, '--module=' + module] + src_dir_args
-    if ignore_headers:
-        scan_cmd.append('--ignore-headers=' + ' '.join(ignore_headers))
-    # Add user-specified arguments
-    scan_cmd += scan_args
-    gtkdoc_run_check(scan_cmd, abs_out)
-
-    # Use the generated types file when available, otherwise gobject_typesfile
-    # would often be a path to source dir instead of build dir.
-    if '--rebuild-types' in scan_args:
-        gobject_typesfile = os.path.join(abs_out, module + '.types')
-
-    if gobject_typesfile:
-        scanobjs_cmd = [options.gtkdoc_scangobj] + scanobjs_args
-        scanobjs_cmd += ['--types=' + gobject_typesfile,
-                         '--module=' + module,
-                         '--run=' + run,
-                         '--cflags=' + cflags,
-                         '--ldflags=' + ldflags,
-                         '--cc=' + cc,
-                         '--ld=' + ld,
-                         '--output-dir=' + abs_out]
-
-        library_paths = []
-        for ldflag in split_args(ldflags):
-            if ldflag.startswith('-Wl,-rpath,'):
-                library_paths.append(ldflag[11:])
-
-        gtkdoc_run_check(scanobjs_cmd, build_root, library_paths)
-
-    # Make docbook files
-    if mode == 'auto':
-        # Guessing is probably a poor idea but these keeps compat
-        # with previous behavior
-        if main_file.endswith('sgml'):
-            modeflag = '--sgml-mode'
-        else:
-            modeflag = '--xml-mode'
-    elif mode == 'xml':
-        modeflag = '--xml-mode'
-    elif mode == 'sgml':
-        modeflag = '--sgml-mode'
-    else: # none
-        modeflag = None
-
-    mkdb_cmd = [options.gtkdoc_mkdb,
-                '--module=' + module,
-                '--output-format=xml',
-                '--expand-content-files=' + ' '.join(expand_content_files),
-                ] + src_dir_args
-    if namespace:
-        mkdb_cmd.append('--name-space=' + namespace)
-    if modeflag:
-        mkdb_cmd.append(modeflag)
-    if main_file:
-        # Yes, this is the flag even if the file is in xml.
-        mkdb_cmd.append('--main-sgml-file=' + main_file)
-    # Add user-specified arguments
-    mkdb_cmd += mkdb_args
-    gtkdoc_run_check(mkdb_cmd, abs_out)
-
-    # Make HTML documentation
-    mkhtml_cmd = [options.gtkdoc_mkhtml,
-                  '--path=' + ':'.join((doc_src, abs_out)),
-                  module,
-                  ] + html_args
-    if main_file:
-        mkhtml_cmd.append('../' + main_file)
-    else:
-        mkhtml_cmd.append('%s-docs.xml' % module)
-    # html gen must be run in the HTML dir
-    gtkdoc_run_check(mkhtml_cmd, htmldir)
-
-    # Fix cross-references in HTML files
-    fixref_cmd = [options.gtkdoc_fixxref,
-                  '--module=' + module,
-                  '--module-dir=html'] + fixxref_args
-    gtkdoc_run_check(fixref_cmd, abs_out)
-
-    if module_version:
-        shutil.move(os.path.join(htmldir, '{}.devhelp2'.format(module)),
-                    os.path.join(htmldir, '{}-{}.devhelp2'.format(module, module_version)))
-
-def install_gtkdoc(build_root, doc_subdir, install_prefix, datadir, module):
-    source = os.path.join(build_root, doc_subdir, 'html')
-    final_destination = os.path.join(install_prefix, datadir, module)
-    shutil.rmtree(final_destination, ignore_errors=True)
-    shutil.copytree(source, final_destination)
-
-def run(args):
-    options = parser.parse_args(args)
-    if options.htmlargs:
-        htmlargs = options.htmlargs.split('@@')
-    else:
-        htmlargs = []
-    if options.scanargs:
-        scanargs = options.scanargs.split('@@')
-    else:
-        scanargs = []
-    if options.scanobjsargs:
-        scanobjsargs = options.scanobjsargs.split('@@')
-    else:
-        scanobjsargs = []
-    if options.fixxrefargs:
-        fixxrefargs = options.fixxrefargs.split('@@')
-    else:
-        fixxrefargs = []
-    if options.mkdbargs:
-        mkdbargs = options.mkdbargs.split('@@')
-    else:
-        mkdbargs = []
-    build_gtkdoc(
-        options.sourcedir,
-        options.builddir,
-        options.subdir,
-        options.headerdirs.split('@@'),
-        options.mainfile,
-        options.modulename,
-        options.moduleversion,
-        htmlargs,
-        scanargs,
-        fixxrefargs,
-        mkdbargs,
-        options.gobject_typesfile,
-        scanobjsargs,
-        options.run,
-        options.ld,
-        options.cc,
-        options.ldflags,
-        options.cflags,
-        options.html_assets.split('@@') if options.html_assets else [],
-        options.content_files.split('@@') if options.content_files else [],
-        options.ignore_headers.split('@@') if options.ignore_headers else [],
-        options.namespace,
-        options.expand_content_files.split('@@') if options.expand_content_files else [],
-        options.mode,
-        options)
-
-    if 'MESON_INSTALL_PREFIX' in os.environ:
-        destdir = os.environ.get('DESTDIR', '')
-        install_prefix = destdir_join(destdir, os.environ['MESON_INSTALL_PREFIX'])
-        if options.install_dir:
-            install_dir = options.install_dir
-        else:
-            install_dir = options.modulename
-            if options.moduleversion:
-                install_dir += '-' + options.moduleversion
-        if os.path.isabs(install_dir):
-            install_dir = destdir_join(destdir, install_dir)
-        install_gtkdoc(options.builddir,
-                       options.subdir,
-                       install_prefix,
-                       'share/gtk-doc/html',
-                       install_dir)
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/hotdochelper.py b/meson/mesonbuild/scripts/hotdochelper.py
deleted file mode 100644 (file)
index 826745d..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-import os
-import shutil
-import subprocess
-
-from . import destdir_join
-
-import argparse
-
-parser = argparse.ArgumentParser()
-parser.add_argument('--install')
-parser.add_argument('--extra-extension-path', action="append", default=[])
-parser.add_argument('--name')
-parser.add_argument('--builddir')
-parser.add_argument('--project-version')
-
-
-def run(argv):
-    options, args = parser.parse_known_args(argv)
-    subenv = os.environ.copy()
-
-    for ext_path in options.extra_extension_path:
-        subenv['PYTHONPATH'] = subenv.get('PYTHONPATH', '') + ':' + ext_path
-
-    res = subprocess.call(args, cwd=options.builddir, env=subenv)
-    if res != 0:
-        exit(res)
-
-    if options.install:
-        source_dir = os.path.join(options.builddir, options.install)
-        destdir = os.environ.get('DESTDIR', '')
-        installdir = destdir_join(destdir,
-                                  os.path.join(os.environ['MESON_INSTALL_PREFIX'],
-                                               'share/doc/', options.name, "html"))
-
-        shutil.rmtree(installdir, ignore_errors=True)
-        shutil.copytree(source_dir, installdir)
diff --git a/meson/mesonbuild/scripts/meson_exe.py b/meson/mesonbuild/scripts/meson_exe.py
deleted file mode 100644 (file)
index a5acb22..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-# Copyright 2013-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import sys
-import argparse
-import pickle
-import platform
-import subprocess
-
-from .. import mesonlib
-from ..backend.backends import ExecutableSerialisation
-
-options = None
-
-def buildparser():
-    parser = argparse.ArgumentParser(description='Custom executable wrapper for Meson. Do not run on your own, mmm\'kay?')
-    parser.add_argument('--unpickle')
-    parser.add_argument('--capture')
-    return parser
-
-def is_windows():
-    platname = platform.system().lower()
-    return platname == 'windows' or 'mingw' in platname
-
-def is_cygwin():
-    platname = platform.system().lower()
-    return 'cygwin' in platname
-
-def run_exe(exe):
-    if exe.exe_runner:
-        if not exe.exe_runner.found():
-            raise AssertionError('BUG: Can\'t run cross-compiled exe {!r} with not-found '
-                                 'wrapper {!r}'.format(exe.cmd_args[0], exe.exe_runner.get_path()))
-        cmd_args = exe.exe_runner.get_command() + exe.cmd_args
-    else:
-        cmd_args = exe.cmd_args
-    child_env = os.environ.copy()
-    child_env.update(exe.env)
-    if exe.extra_paths:
-        child_env['PATH'] = (os.pathsep.join(exe.extra_paths + ['']) +
-                             child_env['PATH'])
-        if exe.exe_runner and mesonlib.substring_is_in_list('wine', exe.exe_runner.get_command()):
-            child_env['WINEPATH'] = mesonlib.get_wine_shortpath(
-                exe.exe_runner.get_command(),
-                ['Z:' + p for p in exe.extra_paths] + child_env.get('WINEPATH', '').split(';')
-            )
-
-    p = subprocess.Popen(cmd_args, env=child_env, cwd=exe.workdir,
-                         close_fds=False,
-                         stdout=subprocess.PIPE,
-                         stderr=subprocess.PIPE)
-    stdout, stderr = p.communicate()
-
-    if p.returncode == 0xc0000135:
-        # STATUS_DLL_NOT_FOUND on Windows indicating a common problem that is otherwise hard to diagnose
-        raise FileNotFoundError('Missing DLLs on calling {!r}'.format(exe.name))
-
-    if exe.capture and p.returncode == 0:
-        skip_write = False
-        try:
-            with open(exe.capture, 'rb') as cur:
-                skip_write = cur.read() == stdout
-        except IOError:
-            pass
-        if not skip_write:
-            with open(exe.capture, 'wb') as output:
-                output.write(stdout)
-    else:
-        sys.stdout.buffer.write(stdout)
-    if stderr:
-        sys.stderr.buffer.write(stderr)
-    return p.returncode
-
-def run(args):
-    global options
-    parser = buildparser()
-    options, cmd_args = parser.parse_known_args(args)
-    # argparse supports double dash to separate options and positional arguments,
-    # but the user has to remove it manually.
-    if cmd_args and cmd_args[0] == '--':
-        cmd_args = cmd_args[1:]
-    if not options.unpickle and not cmd_args:
-        parser.error('either --unpickle or executable and arguments are required')
-    if options.unpickle:
-        if cmd_args or options.capture:
-            parser.error('no other arguments can be used with --unpickle')
-        with open(options.unpickle, 'rb') as f:
-            exe = pickle.load(f)
-    else:
-        exe = ExecutableSerialisation(cmd_args, capture=options.capture)
-
-    return run_exe(exe)
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/msgfmthelper.py b/meson/mesonbuild/scripts/msgfmthelper.py
deleted file mode 100644 (file)
index 737f1bc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import argparse
-import subprocess
-import os
-
-parser = argparse.ArgumentParser()
-parser.add_argument('input')
-parser.add_argument('output')
-parser.add_argument('type')
-parser.add_argument('podir')
-parser.add_argument('--datadirs', default='')
-parser.add_argument('args', default=[], metavar='extra msgfmt argument', nargs='*')
-
-
-def run(args):
-    options = parser.parse_args(args)
-    env = None
-    if options.datadirs:
-        env = os.environ.copy()
-        env.update({'GETTEXTDATADIRS': options.datadirs})
-    return subprocess.call(['msgfmt', '--' + options.type, '-d', options.podir,
-                            '--template', options.input,  '-o', options.output] + options.args,
-                           env=env)
diff --git a/meson/mesonbuild/scripts/regen_checker.py b/meson/mesonbuild/scripts/regen_checker.py
deleted file mode 100644 (file)
index 80d9242..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys, os
-import pickle, subprocess
-
-# This could also be used for XCode.
-
-def need_regen(regeninfo, regen_timestamp):
-    for i in regeninfo.depfiles:
-        curfile = os.path.join(regeninfo.build_dir, i)
-        curtime = os.stat(curfile).st_mtime
-        if curtime > regen_timestamp:
-            return True
-    # The timestamp file gets automatically deleted by MSBuild during a 'Clean' build.
-    # We must make sure to recreate it, even if we do not regenerate the solution.
-    # Otherwise, Visual Studio will always consider the REGEN project out of date.
-    print("Everything is up-to-date, regeneration of build files is not needed.")
-    from ..backend.vs2010backend import Vs2010Backend
-    Vs2010Backend.touch_regen_timestamp(regeninfo.build_dir)
-    return False
-
-def regen(regeninfo, meson_command, backend):
-    cmd = meson_command + ['--internal',
-                           'regenerate',
-                           regeninfo.build_dir,
-                           regeninfo.source_dir,
-                           '--backend=' + backend]
-    subprocess.check_call(cmd)
-
-def run(args):
-    private_dir = args[0]
-    dumpfile = os.path.join(private_dir, 'regeninfo.dump')
-    coredata = os.path.join(private_dir, 'coredata.dat')
-    with open(dumpfile, 'rb') as f:
-        regeninfo = pickle.load(f)
-    with open(coredata, 'rb') as f:
-        coredata = pickle.load(f)
-    backend = coredata.get_builtin_option('backend')
-    regen_timestamp = os.stat(dumpfile).st_mtime
-    if need_regen(regeninfo, regen_timestamp):
-        regen(regeninfo, coredata.meson_command, backend)
-    sys.exit(0)
-
-if __name__ == '__main__':
-    run(sys.argv[1:])
diff --git a/meson/mesonbuild/scripts/scanbuild.py b/meson/mesonbuild/scripts/scanbuild.py
deleted file mode 100644 (file)
index 0190067..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import subprocess
-import shutil
-import tempfile
-from ..environment import detect_ninja, detect_scanbuild
-
-
-def scanbuild(exelist, srcdir, blddir, privdir, logdir, args):
-    with tempfile.TemporaryDirectory(dir=privdir) as scandir:
-        meson_cmd = exelist + args
-        build_cmd = exelist + ['-o', logdir] + detect_ninja() + ['-C', scandir]
-        rc = subprocess.call(meson_cmd + [srcdir, scandir])
-        if rc != 0:
-            return rc
-        return subprocess.call(build_cmd)
-
-
-def run(args):
-    srcdir = args[0]
-    blddir = args[1]
-    meson_cmd = args[2:]
-    privdir = os.path.join(blddir, 'meson-private')
-    logdir = os.path.join(blddir, 'meson-logs/scanbuild')
-    shutil.rmtree(logdir, ignore_errors=True)
-
-    exelist = detect_scanbuild()
-    if not exelist:
-        print('Could not execute scan-build "%s"' % ' '.join(exelist))
-        return 1
-
-    return scanbuild(exelist, srcdir, blddir, privdir, logdir, meson_cmd)
diff --git a/meson/mesonbuild/scripts/symbolextractor.py b/meson/mesonbuild/scripts/symbolextractor.py
deleted file mode 100644 (file)
index d36acf6..0000000
+++ /dev/null
@@ -1,311 +0,0 @@
-# Copyright 2013-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# This script extracts the symbols of a given shared library
-# into a file. If the symbols have not changed, the file is not
-# touched. This information is used to skip link steps if the
-# ABI has not changed.
-
-# This file is basically a reimplementation of
-# http://cgit.freedesktop.org/libreoffice/core/commit/?id=3213cd54b76bc80a6f0516aac75a48ff3b2ad67c
-
-import typing as T
-import os, sys
-from .. import mesonlib
-from .. import mlog
-from ..mesonlib import Popen_safe
-import argparse
-
-parser = argparse.ArgumentParser()
-
-parser.add_argument('--cross-host', default=None, dest='cross_host',
-                    help='cross compilation host platform')
-parser.add_argument('args', nargs='+')
-
-TOOL_WARNING_FILE = None
-RELINKING_WARNING = 'Relinking will always happen on source changes.'
-
-def dummy_syms(outfilename: str):
-    """Just touch it so relinking happens always."""
-    with open(outfilename, 'w'):
-        pass
-
-def write_if_changed(text: str, outfilename: str):
-    try:
-        with open(outfilename, 'r') as f:
-            oldtext = f.read()
-        if text == oldtext:
-            return
-    except FileNotFoundError:
-        pass
-    with open(outfilename, 'w') as f:
-        f.write(text)
-
-def print_tool_warning(tool: list, msg: str, stderr: str = None):
-    global TOOL_WARNING_FILE
-    if os.path.exists(TOOL_WARNING_FILE):
-        return
-    if len(tool) == 1:
-        tool = tool[0]
-    m = '{!r} {}. {}'.format(tool, msg, RELINKING_WARNING)
-    if stderr:
-        m += '\n' + stderr
-    mlog.warning(m)
-    # Write it out so we don't warn again
-    with open(TOOL_WARNING_FILE, 'w'):
-        pass
-
-def get_tool(name: str) -> T.List[str]:
-    evar = name.upper()
-    if evar in os.environ:
-        import shlex
-        return shlex.split(os.environ[evar])
-    return [name]
-
-def call_tool(name: str, args: T.List[str], **kwargs) -> str:
-    tool = get_tool(name)
-    try:
-        p, output, e = Popen_safe(tool + args, **kwargs)
-    except FileNotFoundError:
-        print_tool_warning(tool, 'not found')
-        return None
-    except PermissionError:
-        print_tool_warning(tool, 'not usable')
-        return None
-    if p.returncode != 0:
-        print_tool_warning(tool, 'does not work', e)
-        return None
-    return output
-
-def call_tool_nowarn(tool: T.List[str], **kwargs) -> T.Tuple[str, str]:
-    try:
-        p, output, e = Popen_safe(tool, **kwargs)
-    except FileNotFoundError:
-        return None, '{!r} not found\n'.format(tool[0])
-    except PermissionError:
-        return None, '{!r} not usable\n'.format(tool[0])
-    if p.returncode != 0:
-        return None, e
-    return output, None
-
-def gnu_syms(libfilename: str, outfilename: str):
-    # Get the name of the library
-    output = call_tool('readelf', ['-d', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    result = [x for x in output.split('\n') if 'SONAME' in x]
-    assert(len(result) <= 1)
-    # Get a list of all symbols exported
-    output = call_tool('nm', ['--dynamic', '--extern-only', '--defined-only',
-                              '--format=posix', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    for line in output.split('\n'):
-        if not line:
-            continue
-        line_split = line.split()
-        entry = line_split[0:2]
-        # Store the size of symbols pointing to data objects so we relink
-        # when those change, which is needed because of copy relocations
-        # https://github.com/mesonbuild/meson/pull/7132#issuecomment-628353702
-        if line_split[1].upper() in ('B', 'G', 'D') and len(line_split) >= 4:
-            entry += [line_split[3]]
-        result += [' '.join(entry)]
-    write_if_changed('\n'.join(result) + '\n', outfilename)
-
-def solaris_syms(libfilename: str, outfilename: str):
-    # gnu_syms() works with GNU nm & readelf, not Solaris nm & elfdump
-    origpath = os.environ['PATH']
-    os.environ['PATH'] = '/usr/gnu/bin:' + origpath
-    gnu_syms(libfilename, outfilename)
-    os.environ['PATH'] = origpath
-
-def osx_syms(libfilename: str, outfilename: str):
-    # Get the name of the library
-    output = call_tool('otool', ['-l', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    arr = output.split('\n')
-    for (i, val) in enumerate(arr):
-        if 'LC_ID_DYLIB' in val:
-            match = i
-            break
-    result = [arr[match + 2], arr[match + 5]] # Libreoffice stores all 5 lines but the others seem irrelevant.
-    # Get a list of all symbols exported
-    output = call_tool('nm', ['--extern-only', '--defined-only',
-                              '--format=posix', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    result += [' '.join(x.split()[0:2]) for x in output.split('\n')]
-    write_if_changed('\n'.join(result) + '\n', outfilename)
-
-def openbsd_syms(libfilename: str, outfilename: str):
-    # Get the name of the library
-    output = call_tool('readelf', ['-d', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    result = [x for x in output.split('\n') if 'SONAME' in x]
-    assert(len(result) <= 1)
-    # Get a list of all symbols exported
-    output = call_tool('nm', ['-D', '-P', '-g', libfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    # U = undefined (cope with the lack of --defined-only option)
-    result += [' '.join(x.split()[0:2]) for x in output.split('\n') if x and not x.endswith('U ')]
-    write_if_changed('\n'.join(result) + '\n', outfilename)
-
-def cygwin_syms(impfilename: str, outfilename: str):
-    # Get the name of the library
-    output = call_tool('dlltool', ['-I', impfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    result = [output]
-    # Get the list of all symbols exported
-    output = call_tool('nm', ['--extern-only', '--defined-only',
-                              '--format=posix', impfilename])
-    if not output:
-        dummy_syms(outfilename)
-        return
-    for line in output.split('\n'):
-        if ' T ' not in line:
-            continue
-        result.append(line.split(maxsplit=1)[0])
-    write_if_changed('\n'.join(result) + '\n', outfilename)
-
-def _get_implib_dllname(impfilename: str) -> T.Tuple[T.List[str], str]:
-    all_stderr = ''
-    # First try lib.exe, which is provided by MSVC. Then llvm-lib.exe, by LLVM
-    # for clang-cl.
-    #
-    # We cannot call get_tool on `lib` because it will look at the `LIB` env
-    # var which is the list of library paths MSVC will search for import
-    # libraries while linking.
-    for lib in (['lib'], get_tool('llvm-lib')):
-        output, e = call_tool_nowarn(lib + ['-list', impfilename])
-        if output:
-            # The output is a list of DLLs that each symbol exported by the import
-            # library is available in. We only build import libraries that point to
-            # a single DLL, so we can pick any of these. Pick the last one for
-            # simplicity. Also skip the last line, which is empty.
-            return output.split('\n')[-2:-1], None
-        all_stderr += e
-    # Next, try dlltool.exe which is provided by MinGW
-    output, e = call_tool_nowarn(get_tool('dlltool') + ['-I', impfilename])
-    if output:
-        return [output], None
-    all_stderr += e
-    return ([], all_stderr)
-
-def _get_implib_exports(impfilename: str) -> T.Tuple[T.List[str], str]:
-    all_stderr = ''
-    # Force dumpbin.exe to use en-US so we can parse its output
-    env = os.environ.copy()
-    env['VSLANG'] = '1033'
-    output, e = call_tool_nowarn(get_tool('dumpbin') + ['-exports', impfilename], env=env)
-    if output:
-        lines = output.split('\n')
-        start = lines.index('File Type: LIBRARY')
-        end = lines.index('  Summary')
-        return lines[start:end], None
-    all_stderr += e
-    # Next, try llvm-nm.exe provided by LLVM, then nm.exe provided by MinGW
-    for nm in ('llvm-nm', 'nm'):
-        output, e = call_tool_nowarn(get_tool(nm) + ['--extern-only', '--defined-only',
-                                                     '--format=posix', impfilename])
-        if output:
-            result = []
-            for line in output.split('\n'):
-                if ' T ' not in line or line.startswith('.text'):
-                    continue
-                result.append(line.split(maxsplit=1)[0])
-            return result, None
-        all_stderr += e
-    return ([], all_stderr)
-
-def windows_syms(impfilename: str, outfilename: str):
-    # Get the name of the library
-    result, e = _get_implib_dllname(impfilename)
-    if not result:
-        print_tool_warning('lib, llvm-lib, dlltool', 'do not work or were not found', e)
-        dummy_syms(outfilename)
-        return
-    # Get a list of all symbols exported
-    symbols, e = _get_implib_exports(impfilename)
-    if not symbols:
-        print_tool_warning('dumpbin, llvm-nm, nm', 'do not work or were not found', e)
-        dummy_syms(outfilename)
-        return
-    result += symbols
-    write_if_changed('\n'.join(result) + '\n', outfilename)
-
-def gen_symbols(libfilename: str, impfilename: str, outfilename: str, cross_host: str):
-    if cross_host is not None:
-        # In case of cross builds just always relink. In theory we could
-        # determine the correct toolset, but we would need to use the correct
-        # `nm`, `readelf`, etc, from the cross info which requires refactoring.
-        dummy_syms(outfilename)
-    elif mesonlib.is_linux() or mesonlib.is_hurd():
-        gnu_syms(libfilename, outfilename)
-    elif mesonlib.is_osx():
-        osx_syms(libfilename, outfilename)
-    elif mesonlib.is_openbsd():
-        openbsd_syms(libfilename, outfilename)
-    elif mesonlib.is_windows():
-        if os.path.isfile(impfilename):
-            windows_syms(impfilename, outfilename)
-        else:
-            # No import library. Not sure how the DLL is being used, so just
-            # rebuild everything that links to it every time.
-            dummy_syms(outfilename)
-    elif mesonlib.is_cygwin():
-        if os.path.isfile(impfilename):
-            cygwin_syms(impfilename, outfilename)
-        else:
-            # No import library. Not sure how the DLL is being used, so just
-            # rebuild everything that links to it every time.
-            dummy_syms(outfilename)
-    elif mesonlib.is_sunos():
-        solaris_syms(libfilename, outfilename)
-    else:
-        if not os.path.exists(TOOL_WARNING_FILE):
-            mlog.warning('Symbol extracting has not been implemented for this '
-                         'platform. ' + RELINKING_WARNING)
-            # Write it out so we don't warn again
-            with open(TOOL_WARNING_FILE, 'w'):
-                pass
-        dummy_syms(outfilename)
-
-def run(args):
-    global TOOL_WARNING_FILE
-    options = parser.parse_args(args)
-    if len(options.args) != 4:
-        print('symbolextractor.py <shared library file> <import library> <output file>')
-        sys.exit(1)
-    privdir = os.path.join(options.args[0], 'meson-private')
-    TOOL_WARNING_FILE = os.path.join(privdir, 'symbolextractor_tool_warning_printed')
-    libfile = options.args[1]
-    impfile = options.args[2] # Only used on Windows
-    outfile = options.args[3]
-    gen_symbols(libfile, impfile, outfile, options.cross_host)
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/tags.py b/meson/mesonbuild/scripts/tags.py
deleted file mode 100644 (file)
index 431bb5f..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import subprocess
-from pathlib import Path
-
-
-def ls_as_bytestream():
-    if os.path.exists('.git'):
-        return subprocess.run(['git', 'ls-tree', '-r', '--name-only', 'HEAD'],
-                              stdout=subprocess.PIPE).stdout
-
-    files = [str(p) for p in Path('.').glob('**/*')
-             if not p.is_dir() and
-             not next((x for x in p.parts if x.startswith('.')), None)]
-    return '\n'.join(files).encode()
-
-
-def cscope():
-    ls = b'\n'.join([b'"%s"' % f for f in ls_as_bytestream().split()])
-    return subprocess.run(['cscope', '-v', '-b', '-i-'], input=ls).returncode
-
-
-def ctags():
-    ls = ls_as_bytestream()
-    return subprocess.run(['ctags', '-L-'], input=ls).returncode
-
-
-def etags():
-    ls = ls_as_bytestream()
-    return subprocess.run(['etags', '-'], input=ls).returncode
-
-
-def run(args):
-    tool_name = args[0]
-    srcdir_name = args[1]
-    os.chdir(srcdir_name)
-    assert tool_name in ['cscope', 'ctags', 'etags']
-    return globals()[tool_name]()
diff --git a/meson/mesonbuild/scripts/uninstall.py b/meson/mesonbuild/scripts/uninstall.py
deleted file mode 100644 (file)
index bdc036b..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-
-logfile = 'meson-logs/install-log.txt'
-
-def do_uninstall(log):
-    failures = 0
-    successes = 0
-    for line in open(log):
-        if line.startswith('#'):
-            continue
-        fname = line.strip()
-        try:
-            if os.path.isdir(fname) and not os.path.islink(fname):
-                os.rmdir(fname)
-            else:
-                os.unlink(fname)
-            print('Deleted:', fname)
-            successes += 1
-        except Exception as e:
-            print('Could not delete %s: %s.' % (fname, e))
-            failures += 1
-    print('\nUninstall finished.\n')
-    print('Deleted:', successes)
-    print('Failed:', failures)
-    print('\nRemember that files created by custom scripts have not been removed.')
-
-def run(args):
-    if args:
-        print('Weird error.')
-        return 1
-    if not os.path.exists(logfile):
-        print('Log file does not exist, no installation has been done.')
-        return 0
-    do_uninstall(logfile)
-    return 0
diff --git a/meson/mesonbuild/scripts/vcstagger.py b/meson/mesonbuild/scripts/vcstagger.py
deleted file mode 100644 (file)
index 16dd4d1..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys, os, subprocess, re
-
-
-def config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, cmd):
-    try:
-        output = subprocess.check_output(cmd, cwd=source_dir)
-        new_string = re.search(regex_selector, output.decode()).group(1).strip()
-    except Exception:
-        new_string = fallback
-
-    with open(infile, encoding='utf8') as f:
-        new_data = f.read().replace(replace_string, new_string)
-    if os.path.exists(outfile):
-        with open(outfile, encoding='utf8') as f:
-            needs_update = (f.read() != new_data)
-    else:
-        needs_update = True
-    if needs_update:
-        with open(outfile, 'w', encoding='utf8') as f:
-            f.write(new_data)
-
-
-def run(args):
-    infile, outfile, fallback, source_dir, replace_string, regex_selector = args[0:6]
-    command = args[6:]
-    config_vcs_tag(infile, outfile, fallback, source_dir, replace_string, regex_selector, command)
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(run(sys.argv[1:]))
diff --git a/meson/mesonbuild/scripts/yelphelper.py b/meson/mesonbuild/scripts/yelphelper.py
deleted file mode 100644 (file)
index 95c8c9c..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import subprocess
-import shutil
-import argparse
-from .. import mlog
-from ..mesonlib import has_path_sep
-from . import destdir_join
-from .gettext import read_linguas
-
-parser = argparse.ArgumentParser()
-parser.add_argument('command')
-parser.add_argument('--id', dest='project_id')
-parser.add_argument('--subdir', dest='subdir')
-parser.add_argument('--installdir', dest='install_dir')
-parser.add_argument('--sources', dest='sources')
-parser.add_argument('--media', dest='media', default='')
-parser.add_argument('--langs', dest='langs', default='')
-parser.add_argument('--symlinks', type=bool, dest='symlinks', default=False)
-
-def build_pot(srcdir, project_id, sources):
-    # Must be relative paths
-    sources = [os.path.join('C', source) for source in sources]
-    outfile = os.path.join(srcdir, project_id + '.pot')
-    subprocess.call(['itstool', '-o', outfile] + sources)
-
-def update_po(srcdir, project_id, langs):
-    potfile = os.path.join(srcdir, project_id + '.pot')
-    for lang in langs:
-        pofile = os.path.join(srcdir, lang, lang + '.po')
-        subprocess.call(['msgmerge', '-q', '-o', pofile, pofile, potfile])
-
-def build_translations(srcdir, blddir, langs):
-    for lang in langs:
-        outdir = os.path.join(blddir, lang)
-        os.makedirs(outdir, exist_ok=True)
-        subprocess.call([
-            'msgfmt', os.path.join(srcdir, lang, lang + '.po'),
-            '-o', os.path.join(outdir, lang + '.gmo')
-        ])
-
-def merge_translations(blddir, sources, langs):
-    for lang in langs:
-        subprocess.call([
-            'itstool', '-m', os.path.join(blddir, lang, lang + '.gmo'),
-            '-o', os.path.join(blddir, lang)
-        ] + sources)
-
-def install_help(srcdir, blddir, sources, media, langs, install_dir, destdir, project_id, symlinks):
-    c_install_dir = os.path.join(install_dir, 'C', project_id)
-    for lang in langs + ['C']:
-        indir = destdir_join(destdir, os.path.join(install_dir, lang, project_id))
-        os.makedirs(indir, exist_ok=True)
-        for source in sources:
-            infile = os.path.join(srcdir if lang == 'C' else blddir, lang, source)
-            outfile = os.path.join(indir, source)
-            mlog.log('Installing %s to %s' % (infile, outfile))
-            shutil.copyfile(infile, outfile)
-            shutil.copystat(infile, outfile)
-        for m in media:
-            infile = os.path.join(srcdir, lang, m)
-            outfile = os.path.join(indir, m)
-            c_infile = os.path.join(srcdir, 'C', m)
-            if not os.path.exists(infile):
-                if not os.path.exists(c_infile):
-                    mlog.warning('Media file "%s" did not exist in C directory' % m)
-                    continue
-                elif symlinks:
-                    srcfile = os.path.join(c_install_dir, m)
-                    mlog.log('Symlinking %s to %s.' % (outfile, srcfile))
-                    if has_path_sep(m):
-                        os.makedirs(os.path.dirname(outfile), exist_ok=True)
-                    try:
-                        try:
-                            os.symlink(srcfile, outfile)
-                        except FileExistsError:
-                            os.remove(outfile)
-                            os.symlink(srcfile, outfile)
-                        continue
-                    except (NotImplementedError, OSError):
-                        mlog.warning('Symlinking not supported, falling back to copying')
-                        infile = c_infile
-                else:
-                    # Lang doesn't have media file so copy it over 'C' one
-                    infile = c_infile
-            mlog.log('Installing %s to %s' % (infile, outfile))
-            if has_path_sep(m):
-                os.makedirs(os.path.dirname(outfile), exist_ok=True)
-            shutil.copyfile(infile, outfile)
-            shutil.copystat(infile, outfile)
-
-def run(args):
-    options = parser.parse_args(args)
-    langs = options.langs.split('@@') if options.langs else []
-    media = options.media.split('@@') if options.media else []
-    sources = options.sources.split('@@')
-    destdir = os.environ.get('DESTDIR', '')
-    src_subdir = os.path.join(os.environ['MESON_SOURCE_ROOT'], options.subdir)
-    build_subdir = os.path.join(os.environ['MESON_BUILD_ROOT'], options.subdir)
-    abs_sources = [os.path.join(src_subdir, 'C', source) for source in sources]
-
-    if not langs:
-        langs = read_linguas(src_subdir)
-
-    if options.command == 'pot':
-        build_pot(src_subdir, options.project_id, sources)
-    elif options.command == 'update-po':
-        build_pot(src_subdir, options.project_id, sources)
-        update_po(src_subdir, options.project_id, langs)
-    elif options.command == 'build':
-        if langs:
-            build_translations(src_subdir, build_subdir, langs)
-    elif options.command == 'install':
-        install_dir = os.path.join(os.environ['MESON_INSTALL_PREFIX'], options.install_dir)
-        if langs:
-            build_translations(src_subdir, build_subdir, langs)
-            merge_translations(build_subdir, abs_sources, langs)
-        install_help(src_subdir, build_subdir, sources, media, langs, install_dir,
-                     destdir, options.project_id, options.symlinks)
diff --git a/meson/mesonbuild/templates/__init__.py b/meson/mesonbuild/templates/__init__.py
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/meson/mesonbuild/templates/cpptemplates.py b/meson/mesonbuild/templates/cpptemplates.py
deleted file mode 100644 (file)
index 834d955..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-hello_cpp_template = '''#include <iostream>
-
-#define PROJECT_NAME "{project_name}"
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] <<  "takes no arguments.\\n";
-        return 1;
-    }}
-    std::cout << "This is project " << PROJECT_NAME << ".\\n";
-    return 0;
-}}
-'''
-
-hello_cpp_meson_template = '''project('{project_name}', 'cpp',
-  version : '{version}',
-  default_options : ['warning_level=3',
-                     'cpp_std=c++14'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-lib_hpp_template = '''#pragma once
-#if defined _WIN32 || defined __CYGWIN__
-  #ifdef BUILDING_{utoken}
-    #define {utoken}_PUBLIC __declspec(dllexport)
-  #else
-    #define {utoken}_PUBLIC __declspec(dllimport)
-  #endif
-#else
-  #ifdef BUILDING_{utoken}
-      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
-  #else
-      #define {utoken}_PUBLIC
-  #endif
-#endif
-
-namespace {namespace} {{
-
-class {utoken}_PUBLIC {class_name} {{
-
-public:
-  {class_name}();
-  int get_number() const;
-
-private:
-
-  int number;
-
-}};
-
-}}
-
-'''
-
-lib_cpp_template = '''#include <{header_file}>
-
-namespace {namespace} {{
-
-{class_name}::{class_name}() {{
-    number = 6;
-}}
-
-int {class_name}::get_number() const {{
-  return number;
-}}
-
-}}
-'''
-
-lib_cpp_test_template = '''#include <{header_file}>
-#include <iostream>
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] << " takes no arguments.\\n";
-        return 1;
-    }}
-    {namespace}::{class_name} c;
-    return c.get_number() != 6;
-}}
-'''
-
-lib_cpp_meson_template = '''project('{project_name}', 'cpp',
-  version : '{version}',
-  default_options : ['warning_level=3', 'cpp_std=c++14'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  cpp_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-# Make this library usable from the system's
-# package manager.
-install_headers('{header_file}', subdir : '{header_dir}')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-
-class CppProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.cpp'
-        open(source_name, 'w').write(hello_cpp_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_cpp_meson_template.format(project_name=self.name,
-                                                                       exe_name=lowercase_token,
-                                                                       source_name=source_name,
-                                                                       version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        test_exe_name = lowercase_token + '_test'
-        namespace = lowercase_token
-        lib_hpp_name = lowercase_token + '.hpp'
-        lib_cpp_name = lowercase_token + '.cpp'
-        test_cpp_name = lowercase_token + '_test.cpp'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'class_name': class_name,
-                  'namespace': namespace,
-                  'header_file': lib_hpp_name,
-                  'source_file': lib_cpp_name,
-                  'test_source_file': test_cpp_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_hpp_name, 'w').write(lib_hpp_template.format(**kwargs))
-        open(lib_cpp_name, 'w').write(lib_cpp_template.format(**kwargs))
-        open(test_cpp_name, 'w').write(lib_cpp_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_cpp_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/cstemplates.py b/meson/mesonbuild/templates/cstemplates.py
deleted file mode 100644 (file)
index b9b376e..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-hello_cs_template = '''using System;
-
-public class {class_name} {{
-    const String PROJECT_NAME = "{project_name}";
-
-    static int Main(String[] args) {{
-      if (args.Length > 0) {{
-          System.Console.WriteLine(String.Format("{project_name} takes no arguments.."));
-          return 1;
-      }}
-      Console.WriteLine(String.Format("This is project {{0}}.", PROJECT_NAME));
-      return 0;
-    }}
-}}
-
-'''
-
-hello_cs_meson_template = '''project('{project_name}', 'cs',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-lib_cs_template = '''
-public class {class_name} {{
-    private const int number = 6;
-
-    public int get_number() {{
-      return number;
-    }}
-}}
-
-'''
-
-lib_cs_test_template = '''using System;
-
-public class {class_test} {{
-    static int Main(String[] args) {{
-      if (args.Length > 0) {{
-          System.Console.WriteLine("{project_name} takes no arguments..");
-          return 1;
-      }}
-      {class_name} c = new {class_name}();
-      Boolean result = true;
-      return result.CompareTo(c.get_number() != 6);
-    }}
-}}
-
-'''
-
-lib_cs_meson_template = '''project('{project_name}', 'cs',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-stlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : stlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : stlib)
-
-'''
-
-
-class CSharpProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        source_name = uppercase_token[0] + lowercase_token[1:] + '.cs'
-        open(source_name, 'w').write(hello_cs_template.format(project_name=self.name,
-                                                              class_name=class_name))
-        open('meson.build', 'w').write(hello_cs_meson_template.format(project_name=self.name,
-                                                                      exe_name=self.name,
-                                                                      source_name=source_name,
-                                                                      version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        class_test = uppercase_token[0] + lowercase_token[1:] + '_test'
-        project_test = lowercase_token + '_test'
-        lib_cs_name = uppercase_token[0] + lowercase_token[1:] + '.cs'
-        test_cs_name = uppercase_token[0] + lowercase_token[1:] + '_test.cs'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'class_test': class_test,
-                  'class_name': class_name,
-                  'source_file': lib_cs_name,
-                  'test_source_file': test_cs_name,
-                  'test_exe_name': project_test,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_cs_name, 'w').write(lib_cs_template.format(**kwargs))
-        open(test_cs_name, 'w').write(lib_cs_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_cs_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/ctemplates.py b/meson/mesonbuild/templates/ctemplates.py
deleted file mode 100644 (file)
index 30acef3..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-lib_h_template = '''#pragma once
-#if defined _WIN32 || defined __CYGWIN__
-  #ifdef BUILDING_{utoken}
-    #define {utoken}_PUBLIC __declspec(dllexport)
-  #else
-    #define {utoken}_PUBLIC __declspec(dllimport)
-  #endif
-#else
-  #ifdef BUILDING_{utoken}
-      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
-  #else
-      #define {utoken}_PUBLIC
-  #endif
-#endif
-
-int {utoken}_PUBLIC {function_name}();
-
-'''
-
-lib_c_template = '''#include <{header_file}>
-
-/* This function will not be exported and is not
- * directly callable by users of this library.
- */
-int internal_function() {{
-    return 0;
-}}
-
-int {function_name}() {{
-    return internal_function();
-}}
-'''
-
-lib_c_test_template = '''#include <{header_file}>
-#include <stdio.h>
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        printf("%s takes no arguments.\\n", argv[0]);
-        return 1;
-    }}
-    return {function_name}();
-}}
-'''
-
-lib_c_meson_template = '''project('{project_name}', 'c',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  c_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-# Make this library usable from the system's
-# package manager.
-install_headers('{header_file}', subdir : '{header_dir}')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-hello_c_template = '''#include <stdio.h>
-
-#define PROJECT_NAME "{project_name}"
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        printf("%s takes no arguments.\\n", argv[0]);
-        return 1;
-    }}
-    printf("This is project %s.\\n", PROJECT_NAME);
-    return 0;
-}}
-'''
-
-hello_c_meson_template = '''project('{project_name}', 'c',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-
-class CProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.c'
-        open(source_name, 'w').write(hello_c_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_c_meson_template.format(project_name=self.name,
-                                                                     exe_name=lowercase_token,
-                                                                     source_name=source_name,
-                                                                     version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_h_name = lowercase_token + '.h'
-        lib_c_name = lowercase_token + '.c'
-        test_c_name = lowercase_token + '_test.c'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'header_file': lib_h_name,
-                  'source_file': lib_c_name,
-                  'test_source_file': test_c_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_h_name, 'w').write(lib_h_template.format(**kwargs))
-        open(lib_c_name, 'w').write(lib_c_template.format(**kwargs))
-        open(test_c_name, 'w').write(lib_c_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_c_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/cudatemplates.py b/meson/mesonbuild/templates/cudatemplates.py
deleted file mode 100644 (file)
index 2321011..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-hello_cuda_template = '''#include <iostream>
-
-#define PROJECT_NAME "{project_name}"
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] <<  "takes no arguments.\\n";
-        return 1;
-    }}
-    std::cout << "This is project " << PROJECT_NAME << ".\\n";
-    return 0;
-}}
-'''
-
-hello_cuda_meson_template = '''project('{project_name}', ['cuda', 'cpp'],
-  version : '{version}',
-  default_options : ['warning_level=3',
-                     'cpp_std=c++14'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-lib_h_template = '''#pragma once
-#if defined _WIN32 || defined __CYGWIN__
-  #ifdef BUILDING_{utoken}
-    #define {utoken}_PUBLIC __declspec(dllexport)
-  #else
-    #define {utoken}_PUBLIC __declspec(dllimport)
-  #endif
-#else
-  #ifdef BUILDING_{utoken}
-      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
-  #else
-      #define {utoken}_PUBLIC
-  #endif
-#endif
-
-namespace {namespace} {{
-
-class {utoken}_PUBLIC {class_name} {{
-
-public:
-  {class_name}();
-  int get_number() const;
-
-private:
-
-  int number;
-
-}};
-
-}}
-
-'''
-
-lib_cuda_template = '''#include <{header_file}>
-
-namespace {namespace} {{
-
-{class_name}::{class_name}() {{
-    number = 6;
-}}
-
-int {class_name}::get_number() const {{
-  return number;
-}}
-
-}}
-'''
-
-lib_cuda_test_template = '''#include <{header_file}>
-#include <iostream>
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] << " takes no arguments.\\n";
-        return 1;
-    }}
-    {namespace}::{class_name} c;
-    return c.get_number() != 6;
-}}
-'''
-
-lib_cuda_meson_template = '''project('{project_name}', ['cuda', 'cpp'],
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  cpp_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-# Make this library usable from the system's
-# package manager.
-install_headers('{header_file}', subdir : '{header_dir}')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-
-class CudaProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.cu'
-        open(source_name, 'w').write(hello_cuda_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_cuda_meson_template.format(project_name=self.name,
-                                                                        exe_name=lowercase_token,
-                                                                        source_name=source_name,
-                                                                        version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        test_exe_name = lowercase_token + '_test'
-        namespace = lowercase_token
-        lib_h_name = lowercase_token + '.h'
-        lib_cuda_name = lowercase_token + '.cu'
-        test_cuda_name = lowercase_token + '_test.cu'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'class_name': class_name,
-                  'namespace': namespace,
-                  'header_file': lib_h_name,
-                  'source_file': lib_cuda_name,
-                  'test_source_file': test_cuda_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_h_name, 'w').write(lib_h_template.format(**kwargs))
-        open(lib_cuda_name, 'w').write(lib_cuda_template.format(**kwargs))
-        open(test_cuda_name, 'w').write(lib_cuda_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_cuda_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/dlangtemplates.py b/meson/mesonbuild/templates/dlangtemplates.py
deleted file mode 100644 (file)
index 84e6ab0..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-hello_d_template = '''module main;
-import std.stdio;
-
-enum PROJECT_NAME = "{project_name}";
-
-int main(string[] args) {{
-    if (args.length != 1){{
-        writefln("%s takes no arguments.\\n", args[0]);
-        return 1;
-    }}
-    writefln("This is project %s.\\n", PROJECT_NAME);
-    return 0;
-}}
-'''
-
-hello_d_meson_template = '''project('{project_name}', 'd',
-    version : '{version}',
-    default_options: ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-lib_d_template = '''module {module_file};
-
-/* This function will not be exported and is not
- * directly callable by users of this library.
- */
-int internal_function() {{
-    return 0;
-}}
-
-int {function_name}() {{
-    return internal_function();
-}}
-'''
-
-lib_d_test_template = '''module {module_file}_test;
-import std.stdio;
-import {module_file};
-
-
-int main(string[] args) {{
-    if (args.length != 1){{
-        writefln("%s takes no arguments.\\n", args[0]);
-        return 1;
-    }}
-    return {function_name}();
-}}
-'''
-
-lib_d_meson_template = '''project('{project_name}', 'd',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-stlib = static_library('{lib_name}', '{source_file}',
-  install : true,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : stlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : stlib)
-
-# Make this library usable from the Dlang
-# build system.
-dlang_mod = import('dlang')
-if find_program('dub', required: false).found()
-  dlang_mod.generate_dub_file(meson.project_name().to_lower(), meson.source_root(),
-    name : meson.project_name(),
-    license: meson.project_license(),
-    sourceFiles : '{source_file}',
-    description : 'Meson sample project.',
-    version : '{version}',
-  )
-endif
-'''
-
-
-class DlangProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.d'
-        open(source_name, 'w').write(hello_d_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_d_meson_template.format(project_name=self.name,
-                                                                     exe_name=lowercase_token,
-                                                                     source_name=source_name,
-                                                                     version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_m_name = lowercase_token
-        lib_d_name = lowercase_token + '.d'
-        test_d_name = lowercase_token + '_test.d'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'module_file': lib_m_name,
-                  'source_file': lib_d_name,
-                  'test_source_file': test_d_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_d_name, 'w').write(lib_d_template.format(**kwargs))
-        open(test_d_name, 'w').write(lib_d_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_d_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/fortrantemplates.py b/meson/mesonbuild/templates/fortrantemplates.py
deleted file mode 100644 (file)
index a4f3079..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-lib_fortran_template = '''
-! This procedure will not be exported and is not
-! directly callable by users of this library.
-
-module modfoo
-
-implicit none
-private
-public :: {function_name}
-
-contains
-
-integer function internal_function()
-    internal_function = 0
-end function internal_function
-
-integer function {function_name}()
-    {function_name} = internal_function()
-end function {function_name}
-
-end module modfoo
-'''
-
-lib_fortran_test_template = '''
-use modfoo
-
-print *,{function_name}()
-
-end program
-'''
-
-lib_fortran_meson_template = '''project('{project_name}', 'fortran',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  fortran_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-hello_fortran_template = '''
-implicit none
-
-character(len=*), parameter :: PROJECT_NAME = "{project_name}"
-
-print *,"This is project ", PROJECT_NAME
-
-end program
-'''
-
-hello_fortran_meson_template = '''project('{project_name}', 'fortran',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-
-class FortranProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.f90'
-        open(source_name, 'w').write(hello_fortran_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_fortran_meson_template.format(project_name=self.name,
-                                                                           exe_name=lowercase_token,
-                                                                           source_name=source_name,
-                                                                           version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_fortran_name = lowercase_token + '.f90'
-        test_fortran_name = lowercase_token + '_test.f90'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'source_file': lib_fortran_name,
-                  'test_source_file': test_fortran_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_fortran_name, 'w').write(lib_fortran_template.format(**kwargs))
-        open(test_fortran_name, 'w').write(lib_fortran_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_fortran_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/javatemplates.py b/meson/mesonbuild/templates/javatemplates.py
deleted file mode 100644 (file)
index 211faed..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-hello_java_template = '''
-
-public class {class_name} {{
-    final static String PROJECT_NAME = "{project_name}";
-
-    public static void main (String args[]) {{
-        if(args.length != 0) {{
-            System.out.println(args + " takes no arguments.");
-            System.exit(0);
-        }}
-        System.out.println("This is project " + PROJECT_NAME + ".");
-        System.exit(0);
-    }}
-}}
-
-'''
-
-hello_java_meson_template = '''project('{project_name}', 'java',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = jar('{exe_name}', '{source_name}',
-  main_class : '{exe_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-lib_java_template = '''
-
-public class {class_name} {{
-    final static int number = 6;
-
-    public final int get_number() {{
-      return number;
-    }}
-}}
-
-'''
-
-lib_java_test_template = '''
-
-public class {class_test} {{
-    public static void main (String args[]) {{
-        if(args.length != 0) {{
-            System.out.println(args + " takes no arguments.");
-            System.exit(1);
-        }}
-
-        {class_name} c = new {class_name}();
-        Boolean result = true;
-        System.exit(result.compareTo(c.get_number() != 6));
-    }}
-}}
-
-'''
-
-lib_java_meson_template = '''project('{project_name}', 'java',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-jarlib = jar('{class_name}', '{source_file}',
-  main_class : '{class_name}',
-  install : true,
-)
-
-test_jar = jar('{class_test}', '{test_source_file}',
-  main_class : '{class_test}',
-  link_with : jarlib)
-test('{test_name}', test_jar)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : jarlib)
-'''
-
-
-class JavaProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        source_name = uppercase_token[0] + lowercase_token[1:] + '.java'
-        open(source_name, 'w').write(hello_java_template.format(project_name=self.name,
-                                                                class_name=class_name))
-        open('meson.build', 'w').write(hello_java_meson_template.format(project_name=self.name,
-                                                                        exe_name=class_name,
-                                                                        source_name=source_name,
-                                                                        version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        class_name = uppercase_token[0] + lowercase_token[1:]
-        class_test = uppercase_token[0] + lowercase_token[1:] + '_test'
-        lib_java_name = uppercase_token[0] + lowercase_token[1:] + '.java'
-        test_java_name = uppercase_token[0] + lowercase_token[1:] + '_test.java'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'class_test': class_test,
-                  'class_name': class_name,
-                  'source_file': lib_java_name,
-                  'test_source_file': test_java_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_java_name, 'w').write(lib_java_template.format(**kwargs))
-        open(test_java_name, 'w').write(lib_java_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_java_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/mesontemplates.py b/meson/mesonbuild/templates/mesontemplates.py
deleted file mode 100644 (file)
index 6b341a2..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-meson_executable_template = '''project('{project_name}', '{language}',
-  version : '{version}',
-  default_options : [{default_options}])
-
-executable('{executable}',
-           {sourcespec},{depspec}
-           install : true)
-'''
-
-
-meson_jar_template = '''project('{project_name}', '{language}',
-  version : '{version}',
-  default_options : [{default_options}])
-
-jar('{executable}',
-    {sourcespec},{depspec}
-    main_class: '{main_class}',
-    install : true)
-'''
-
-
-def create_meson_build(options):
-    if options.type != 'executable':
-        raise SystemExit('\nGenerating a meson.build file from existing sources is\n'
-                         'supported only for project type "executable".\n'
-                         'Run meson init in an empty directory to create a sample project.')
-    default_options = ['warning_level=3']
-    if options.language == 'cpp':
-        # This shows how to set this very common option.
-        default_options += ['cpp_std=c++14']
-    # If we get a meson.build autoformatter one day, this code could
-    # be simplified quite a bit.
-    formatted_default_options = ', '.join("'{}'".format(x) for x in default_options)
-    sourcespec = ',\n           '.join("'{}'".format(x) for x in options.srcfiles)
-    depspec = ''
-    if options.deps:
-        depspec = '\n           dependencies : [\n              '
-        depspec += ',\n              '.join("dependency('{}')".format(x)
-                                            for x in options.deps.split(','))
-        depspec += '],'
-    if options.language != 'java':
-        content = meson_executable_template.format(project_name=options.name,
-                                                   language=options.language,
-                                                   version=options.version,
-                                                   executable=options.executable,
-                                                   sourcespec=sourcespec,
-                                                   depspec=depspec,
-                                                   default_options=formatted_default_options)
-    else:
-        content = meson_jar_template.format(project_name=options.name,
-                                            language=options.language,
-                                            version=options.version,
-                                            executable=options.executable,
-                                            main_class=options.name,
-                                            sourcespec=sourcespec,
-                                            depspec=depspec,
-                                            default_options=formatted_default_options)
-    open('meson.build', 'w').write(content)
-    print('Generated meson.build file:\n\n' + content)
diff --git a/meson/mesonbuild/templates/objcpptemplates.py b/meson/mesonbuild/templates/objcpptemplates.py
deleted file mode 100644 (file)
index 84299a8..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-lib_h_template = '''#pragma once
-#if defined _WIN32 || defined __CYGWIN__
-  #ifdef BUILDING_{utoken}
-    #define {utoken}_PUBLIC __declspec(dllexport)
-  #else
-    #define {utoken}_PUBLIC __declspec(dllimport)
-  #endif
-#else
-  #ifdef BUILDING_{utoken}
-      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
-  #else
-      #define {utoken}_PUBLIC
-  #endif
-#endif
-
-int {utoken}_PUBLIC {function_name}();
-
-'''
-
-lib_objcpp_template = '''#import <{header_file}>
-
-/* This function will not be exported and is not
- * directly callable by users of this library.
- */
-int internal_function() {{
-    return 0;
-}}
-
-int {function_name}() {{
-    return internal_function();
-}}
-'''
-
-lib_objcpp_test_template = '''#import <{header_file}>
-#import <iostream>
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] << " takes no arguments." << std::endl;
-        return 1;
-    }}
-    return {function_name}();
-}}
-'''
-
-lib_objcpp_meson_template = '''project('{project_name}', 'objcpp',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  objcpp_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-# Make this library usable from the system's
-# package manager.
-install_headers('{header_file}', subdir : '{header_dir}')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-hello_objcpp_template = '''#import <iostream>
-
-#define PROJECT_NAME "{project_name}"
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        std::cout << argv[0] << " takes no arguments." << std::endl;
-        return 1;
-    }}
-    std::cout << "This is project " << PROJECT_NAME << "." << std::endl;
-    return 0;
-}}
-'''
-
-hello_objcpp_meson_template = '''project('{project_name}', 'objcpp',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-
-class ObjCppProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.mm'
-        open(source_name, 'w').write(hello_objcpp_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_objcpp_meson_template.format(project_name=self.name,
-                                                                          exe_name=lowercase_token,
-                                                                          source_name=source_name,
-                                                                          version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_h_name = lowercase_token + '.h'
-        lib_objcpp_name = lowercase_token + '.mm'
-        test_objcpp_name = lowercase_token + '_test.mm'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'header_file': lib_h_name,
-                  'source_file': lib_objcpp_name,
-                  'test_source_file': test_objcpp_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_h_name, 'w').write(lib_h_template.format(**kwargs))
-        open(lib_objcpp_name, 'w').write(lib_objcpp_template.format(**kwargs))
-        open(test_objcpp_name, 'w').write(lib_objcpp_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_objcpp_meson_template.format(**kwargs))
-
diff --git a/meson/mesonbuild/templates/objctemplates.py b/meson/mesonbuild/templates/objctemplates.py
deleted file mode 100644 (file)
index 9ec4a5e..0000000
+++ /dev/null
@@ -1,165 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-lib_h_template = '''#pragma once
-#if defined _WIN32 || defined __CYGWIN__
-  #ifdef BUILDING_{utoken}
-    #define {utoken}_PUBLIC __declspec(dllexport)
-  #else
-    #define {utoken}_PUBLIC __declspec(dllimport)
-  #endif
-#else
-  #ifdef BUILDING_{utoken}
-      #define {utoken}_PUBLIC __attribute__ ((visibility ("default")))
-  #else
-      #define {utoken}_PUBLIC
-  #endif
-#endif
-
-int {utoken}_PUBLIC {function_name}();
-
-'''
-
-lib_objc_template = '''#import <{header_file}>
-
-/* This function will not be exported and is not
- * directly callable by users of this library.
- */
-int internal_function() {{
-    return 0;
-}}
-
-int {function_name}() {{
-    return internal_function();
-}}
-'''
-
-lib_objc_test_template = '''#import <{header_file}>
-#import <stdio.h>
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        printf("%s takes no arguments.\\n", argv[0]);
-        return 1;
-    }}
-    return {function_name}();
-}}
-'''
-
-lib_objc_meson_template = '''project('{project_name}', 'objc',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-# These arguments are only used to build the shared library
-# not the executables that use the library.
-lib_args = ['-DBUILDING_{utoken}']
-
-shlib = shared_library('{lib_name}', '{source_file}',
-  install : true,
-  objc_args : lib_args,
-  gnu_symbol_visibility : 'hidden',
-)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-
-# Make this library usable from the system's
-# package manager.
-install_headers('{header_file}', subdir : '{header_dir}')
-
-pkg_mod = import('pkgconfig')
-pkg_mod.generate(
-  name : '{project_name}',
-  filebase : '{ltoken}',
-  description : 'Meson sample project.',
-  subdirs : '{header_dir}',
-  libraries : shlib,
-  version : '{version}',
-)
-'''
-
-hello_objc_template = '''#import <stdio.h>
-
-#define PROJECT_NAME "{project_name}"
-
-int main(int argc, char **argv) {{
-    if(argc != 1) {{
-        printf("%s takes no arguments.\\n", argv[0]);
-        return 1;
-    }}
-    printf("This is project %s.\\n", PROJECT_NAME);
-    return 0;
-}}
-'''
-
-hello_objc_meson_template = '''project('{project_name}', 'objc',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-
-class ObjCProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.m'
-        open(source_name, 'w').write(hello_objc_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_objc_meson_template.format(project_name=self.name,
-                                                                        exe_name=lowercase_token,
-                                                                        source_name=source_name,
-                                                                        version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_h_name = lowercase_token + '.h'
-        lib_objc_name = lowercase_token + '.m'
-        test_objc_name = lowercase_token + '_test.m'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'header_file': lib_h_name,
-                  'source_file': lib_objc_name,
-                  'test_source_file': test_objc_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_h_name, 'w').write(lib_h_template.format(**kwargs))
-        open(lib_objc_name, 'w').write(lib_objc_template.format(**kwargs))
-        open(test_objc_name, 'w').write(lib_objc_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_objc_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/rusttemplates.py b/meson/mesonbuild/templates/rusttemplates.py
deleted file mode 100644 (file)
index c4ff53d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.sampleimpl import SampleImpl
-import re
-
-
-lib_rust_template = '''#![crate_name = "{crate_file}"]
-
-/* This function will not be exported and is not
- * directly callable by users of this library.
- */
-fn internal_function() -> i32 {{
-    return 0;
-}}
-
-pub fn {function_name}() -> i32 {{
-    return internal_function();
-}}
-'''
-
-lib_rust_test_template = '''extern crate {crate_file};
-
-fn main() {{
-    println!("printing: {{}}", {crate_file}::{function_name}());
-}}
-'''
-
-
-lib_rust_meson_template = '''project('{project_name}', 'rust',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-shlib = static_library('{lib_name}', '{source_file}', install : true)
-
-test_exe = executable('{test_exe_name}', '{test_source_file}',
-  link_with : shlib)
-test('{test_name}', test_exe)
-
-# Make this library usable as a Meson subproject.
-{ltoken}_dep = declare_dependency(
-  include_directories: include_directories('.'),
-  link_with : shlib)
-'''
-
-hello_rust_template = '''
-fn main() {{
-    let project_name = "{project_name}";
-    println!("This is project {{}}.\\n", project_name);
-}}
-'''
-
-hello_rust_meson_template = '''project('{project_name}', 'rust',
-  version : '{version}',
-  default_options : ['warning_level=3'])
-
-exe = executable('{exe_name}', '{source_name}',
-  install : true)
-
-test('basic', exe)
-'''
-
-
-class RustProject(SampleImpl):
-    def __init__(self, options):
-        super().__init__()
-        self.name = options.name
-        self.version = options.version
-
-    def create_executable(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        source_name = lowercase_token + '.rs'
-        open(source_name, 'w').write(hello_rust_template.format(project_name=self.name))
-        open('meson.build', 'w').write(hello_rust_meson_template.format(project_name=self.name,
-                                                                        exe_name=lowercase_token,
-                                                                        source_name=source_name,
-                                                                        version=self.version))
-
-    def create_library(self):
-        lowercase_token = re.sub(r'[^a-z0-9]', '_', self.name.lower())
-        uppercase_token = lowercase_token.upper()
-        function_name = lowercase_token[0:3] + '_func'
-        test_exe_name = lowercase_token + '_test'
-        lib_crate_name = lowercase_token
-        lib_rs_name = lowercase_token + '.rs'
-        test_rs_name = lowercase_token + '_test.rs'
-        kwargs = {'utoken': uppercase_token,
-                  'ltoken': lowercase_token,
-                  'header_dir': lowercase_token,
-                  'function_name': function_name,
-                  'crate_file': lib_crate_name,
-                  'source_file': lib_rs_name,
-                  'test_source_file': test_rs_name,
-                  'test_exe_name': test_exe_name,
-                  'project_name': self.name,
-                  'lib_name': lowercase_token,
-                  'test_name': lowercase_token,
-                  'version': self.version,
-                  }
-        open(lib_rs_name, 'w').write(lib_rust_template.format(**kwargs))
-        open(test_rs_name, 'w').write(lib_rust_test_template.format(**kwargs))
-        open('meson.build', 'w').write(lib_rust_meson_template.format(**kwargs))
diff --git a/meson/mesonbuild/templates/samplefactory.py b/meson/mesonbuild/templates/samplefactory.py
deleted file mode 100644 (file)
index 1da2bc1..0000000
+++ /dev/null
@@ -1,38 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-from mesonbuild.templates.fortrantemplates import FortranProject
-from mesonbuild.templates.objcpptemplates import ObjCppProject
-from mesonbuild.templates.dlangtemplates import DlangProject
-from mesonbuild.templates.rusttemplates import RustProject
-from mesonbuild.templates.javatemplates import JavaProject
-from mesonbuild.templates.cudatemplates import CudaProject
-from mesonbuild.templates.objctemplates import ObjCProject
-from mesonbuild.templates.cpptemplates import CppProject
-from mesonbuild.templates.cstemplates import CSharpProject
-from mesonbuild.templates.ctemplates import CProject
-
-
-def sameple_generator(options):
-    return {
-        'c': CProject,
-        'cpp': CppProject,
-        'cs': CSharpProject,
-        'cuda': CudaProject,
-        'objc': ObjCProject,
-        'objcpp': ObjCppProject,
-        'java': JavaProject,
-        'd': DlangProject,
-        'rust': RustProject,
-        'fortran': FortranProject
-    }[options.language](options)
diff --git a/meson/mesonbuild/templates/sampleimpl.py b/meson/mesonbuild/templates/sampleimpl.py
deleted file mode 100644 (file)
index 20ed8ab..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-# Copyright 2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-
-class SampleImpl:
-    def create_executable(self):
-        raise NotImplementedError('Sample implementation for "executable" not implemented!')
-
-    def create_library(self):
-        raise NotImplementedError('Sample implementation for "library" not implemented!')
diff --git a/meson/mesonbuild/wrap/__init__.py b/meson/mesonbuild/wrap/__init__.py
deleted file mode 100644 (file)
index 182a94d..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-from enum import Enum
-
-# Used for the --wrap-mode command-line argument
-#
-# Special wrap modes:
-#   nofallback: Don't download wraps for dependency() fallbacks
-#   nodownload: Don't download wraps for all subproject() calls
-#
-# subprojects are used for two purposes:
-# 1. To download and build dependencies by using .wrap
-#    files if they are not provided by the system. This is
-#    usually expressed via dependency(..., fallback: ...).
-# 2. To download and build 'copylibs' which are meant to be
-#    used by copying into your project. This is always done
-#    with an explicit subproject() call.
-#
-# --wrap-mode=nofallback will never do (1)
-# --wrap-mode=nodownload will do neither (1) nor (2)
-#
-# If you are building from a release tarball, you should be
-# able to safely use 'nodownload' since upstream is
-# expected to ship all required sources with the tarball.
-#
-# If you are building from a git repository, you will want
-# to use 'nofallback' so that any 'copylib' wraps will be
-# download as subprojects.
-#
-# --wrap-mode=forcefallback will ignore external dependencies,
-# even if they match the version requirements, and automatically
-# use the fallback if one was provided. This is useful for example
-# to make sure a project builds when using the fallbacks.
-#
-# Note that these options do not affect subprojects that
-# are git submodules since those are only usable in git
-# repositories, and you almost always want to download them.
-
-# This did _not_ work when inside the WrapMode class.
-# I don't know why. If you can fix this, patches welcome.
-string_to_value = {'default': 1,
-                   'nofallback': 2,
-                   'nodownload': 3,
-                   'forcefallback': 4,
-                   }
-
-class WrapMode(Enum):
-    default = 1
-    nofallback = 2
-    nodownload = 3
-    forcefallback = 4
-
-    def __str__(self) -> str:
-        return self.name
-
-    @staticmethod
-    def from_string(mode_name: str):
-        g = string_to_value[mode_name]
-        return WrapMode(g)
diff --git a/meson/mesonbuild/wrap/wrap.py b/meson/mesonbuild/wrap/wrap.py
deleted file mode 100644 (file)
index aba220e..0000000
+++ /dev/null
@@ -1,549 +0,0 @@
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from .. import mlog
-import contextlib
-import urllib.request
-import urllib.error
-import urllib.parse
-import os
-import hashlib
-import shutil
-import tempfile
-import stat
-import subprocess
-import sys
-import configparser
-import typing as T
-
-from pathlib import Path
-from . import WrapMode
-from .. import coredata
-from ..mesonlib import git, GIT, ProgressBar, MesonException
-
-if T.TYPE_CHECKING:
-    import http.client
-
-try:
-    # Importing is just done to check if SSL exists, so all warnings
-    # regarding 'imported but unused' can be safely ignored
-    import ssl  # noqa
-    has_ssl = True
-    API_ROOT = 'https://wrapdb.mesonbuild.com/v1/'
-except ImportError:
-    has_ssl = False
-    API_ROOT = 'http://wrapdb.mesonbuild.com/v1/'
-
-REQ_TIMEOUT = 600.0
-SSL_WARNING_PRINTED = False
-WHITELIST_SUBDOMAIN = 'wrapdb.mesonbuild.com'
-
-def quiet_git(cmd: T.List[str], workingdir: str) -> T.Tuple[bool, str]:
-    if not GIT:
-        return False, 'Git program not found.'
-    pc = git(cmd, workingdir, universal_newlines=True,
-             stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-    if pc.returncode != 0:
-        return False, pc.stderr
-    return True, pc.stdout
-
-def verbose_git(cmd: T.List[str], workingdir: str, check: bool = False) -> bool:
-    if not GIT:
-        return False
-    try:
-        return git(cmd, workingdir, check=check).returncode == 0
-    except subprocess.CalledProcessError:
-        raise WrapException('Git command failed')
-
-def whitelist_wrapdb(urlstr: str) -> urllib.parse.ParseResult:
-    """ raises WrapException if not whitelisted subdomain """
-    url = urllib.parse.urlparse(urlstr)
-    if not url.hostname:
-        raise WrapException('{} is not a valid URL'.format(urlstr))
-    if not url.hostname.endswith(WHITELIST_SUBDOMAIN):
-        raise WrapException('{} is not a whitelisted WrapDB URL'.format(urlstr))
-    if has_ssl and not url.scheme == 'https':
-        raise WrapException('WrapDB did not have expected SSL https url, instead got {}'.format(urlstr))
-    return url
-
-def open_wrapdburl(urlstring: str) -> 'http.client.HTTPResponse':
-    global SSL_WARNING_PRINTED
-
-    url = whitelist_wrapdb(urlstring)
-    if has_ssl:
-        try:
-            return urllib.request.urlopen(urllib.parse.urlunparse(url), timeout=REQ_TIMEOUT)
-        except urllib.error.URLError as excp:
-            raise WrapException('WrapDB connection failed to {} with error {}'.format(urlstring, excp))
-
-    # following code is only for those without Python SSL
-    nossl_url = url._replace(scheme='http')
-    if not SSL_WARNING_PRINTED:
-        mlog.warning('SSL module not available in {}: WrapDB traffic not authenticated.'.format(sys.executable))
-        SSL_WARNING_PRINTED = True
-    try:
-        return urllib.request.urlopen(urllib.parse.urlunparse(nossl_url), timeout=REQ_TIMEOUT)
-    except urllib.error.URLError as excp:
-        raise WrapException('WrapDB connection failed to {} with error {}'.format(urlstring, excp))
-
-
-class WrapException(MesonException):
-    pass
-
-class WrapNotFoundException(WrapException):
-    pass
-
-class PackageDefinition:
-    def __init__(self, fname: str):
-        self.filename = fname
-        self.type = None
-        self.values = {} # type: T.Dict[str, str]
-        self.provided_deps = {} # type: T.Dict[str, T.Optional[str]]
-        self.provided_programs = [] # type: T.List[str]
-        self.basename = os.path.basename(fname)
-        self.name = self.basename
-        if self.name.endswith('.wrap'):
-            self.name = self.name[:-5]
-        self.provided_deps[self.name] = None
-        if fname.endswith('.wrap'):
-            self.parse_wrap(fname)
-        self.directory = self.values.get('directory', self.name)
-        if os.path.dirname(self.directory):
-            raise WrapException('Directory key must be a name and not a path')
-
-    def parse_wrap(self, fname: str):
-        try:
-            self.config = configparser.ConfigParser(interpolation=None)
-            self.config.read(fname)
-        except configparser.Error:
-            raise WrapException('Failed to parse {}'.format(self.basename))
-        self.parse_wrap_section()
-        self.parse_provide_section()
-
-    def parse_wrap_section(self):
-        if len(self.config.sections()) < 1:
-            raise WrapException('Missing sections in {}'.format(self.basename))
-        self.wrap_section = self.config.sections()[0]
-        if not self.wrap_section.startswith('wrap-'):
-            m = '{!r} is not a valid first section in {}'
-            raise WrapException(m.format(self.wrap_section, self.basename))
-        self.type = self.wrap_section[5:]
-        self.values = dict(self.config[self.wrap_section])
-
-    def parse_provide_section(self):
-        if self.config.has_section('provide'):
-            for k, v in self.config['provide'].items():
-                if k == 'dependency_names':
-                    # A comma separated list of dependency names that does not
-                    # need a variable name
-                    names = {n.strip(): None for n in v.split(',')}
-                    self.provided_deps.update(names)
-                    continue
-                if k == 'program_names':
-                    # A comma separated list of program names
-                    names = [n.strip() for n in v.split(',')]
-                    self.provided_programs += names
-                    continue
-                if not v:
-                    m = ('Empty dependency variable name for {!r} in {}. '
-                         'If the subproject uses meson.override_dependency() '
-                         'it can be added in the "dependency_names" special key.')
-                    raise WrapException(m.format(k, self.basename))
-                self.provided_deps[k] = v
-
-    def get(self, key: str) -> str:
-        try:
-            return self.values[key]
-        except KeyError:
-            m = 'Missing key {!r} in {}'
-            raise WrapException(m.format(key, self.basename))
-
-def get_directory(subdir_root: str, packagename: str) -> str:
-    fname = os.path.join(subdir_root, packagename + '.wrap')
-    if os.path.isfile(fname):
-        wrap = PackageDefinition(fname)
-        return wrap.directory
-    return packagename
-
-class Resolver:
-    def __init__(self, subdir_root: str, wrap_mode=WrapMode.default):
-        self.wrap_mode = wrap_mode
-        self.subdir_root = subdir_root
-        self.cachedir = os.path.join(self.subdir_root, 'packagecache')
-        self.filesdir = os.path.join(self.subdir_root, 'packagefiles')
-        self.wraps = {} # type: T.Dict[str, PackageDefinition]
-        self.provided_deps = {} # type: T.Dict[str, PackageDefinition]
-        self.provided_programs = {} # type: T.Dict[str, PackageDefinition]
-        self.load_wraps()
-
-    def load_wraps(self):
-        if not os.path.isdir(self.subdir_root):
-            return
-        root, dirs, files = next(os.walk(self.subdir_root))
-        for i in files:
-            if not i.endswith('.wrap'):
-                continue
-            fname = os.path.join(self.subdir_root, i)
-            wrap = PackageDefinition(fname)
-            self.wraps[wrap.name] = wrap
-            if wrap.directory in dirs:
-                dirs.remove(wrap.directory)
-        # Add dummy package definition for directories not associated with a wrap file.
-        for i in dirs:
-            if i in ['packagecache', 'packagefiles']:
-                continue
-            fname = os.path.join(self.subdir_root, i)
-            wrap = PackageDefinition(fname)
-            self.wraps[wrap.name] = wrap
-
-        for wrap in self.wraps.values():
-            for k in wrap.provided_deps.keys():
-                if k in self.provided_deps:
-                    prev_wrap = self.provided_deps[k]
-                    m = 'Multiple wrap files provide {!r} dependency: {} and {}'
-                    raise WrapException(m.format(k, wrap.basename, prev_wrap.basename))
-                self.provided_deps[k] = wrap
-            for k in wrap.provided_programs:
-                if k in self.provided_programs:
-                    prev_wrap = self.provided_programs[k]
-                    m = 'Multiple wrap files provide {!r} program: {} and {}'
-                    raise WrapException(m.format(k, wrap.basename, prev_wrap.basename))
-                self.provided_programs[k] = wrap
-
-    def find_dep_provider(self, packagename: str):
-        # Return value is in the same format as fallback kwarg:
-        # ['subproject_name', 'variable_name'], or 'subproject_name'.
-        wrap = self.provided_deps.get(packagename)
-        if wrap:
-            dep_var = wrap.provided_deps.get(packagename)
-            if dep_var:
-                return [wrap.name, dep_var]
-            return wrap.name
-        return None
-
-    def find_program_provider(self, names: T.List[str]):
-        for name in names:
-            wrap = self.provided_programs.get(name)
-            if wrap:
-                return wrap.name
-        return None
-
-    def resolve(self, packagename: str, method: str, current_subproject: str = '') -> str:
-        self.current_subproject = current_subproject
-        self.packagename = packagename
-        self.directory = packagename
-        self.wrap = self.wraps.get(packagename)
-        if not self.wrap:
-            m = 'Subproject directory not found and {}.wrap file not found'
-            raise WrapNotFoundException(m.format(self.packagename))
-        self.directory = self.wrap.directory
-        self.dirname = os.path.join(self.subdir_root, self.directory)
-
-        meson_file = os.path.join(self.dirname, 'meson.build')
-        cmake_file = os.path.join(self.dirname, 'CMakeLists.txt')
-
-        if method not in ['meson', 'cmake']:
-            raise WrapException('Only the methods "meson" and "cmake" are supported')
-
-        # The directory is there and has meson.build? Great, use it.
-        if method == 'meson' and os.path.exists(meson_file):
-            return self.directory
-        if method == 'cmake' and os.path.exists(cmake_file):
-            return self.directory
-
-        # Check if the subproject is a git submodule
-        self.resolve_git_submodule()
-
-        if os.path.exists(self.dirname):
-            if not os.path.isdir(self.dirname):
-                raise WrapException('Path already exists but is not a directory')
-        else:
-            if self.wrap.type == 'file':
-                self.get_file()
-            else:
-                self.check_can_download()
-                if self.wrap.type == 'git':
-                    self.get_git()
-                elif self.wrap.type == "hg":
-                    self.get_hg()
-                elif self.wrap.type == "svn":
-                    self.get_svn()
-                else:
-                    raise WrapException('Unknown wrap type {!r}'.format(self.wrap.type))
-            self.apply_patch()
-
-        # A meson.build or CMakeLists.txt file is required in the directory
-        if method == 'meson' and not os.path.exists(meson_file):
-            raise WrapException('Subproject exists but has no meson.build file')
-        if method == 'cmake' and not os.path.exists(cmake_file):
-            raise WrapException('Subproject exists but has no CMakeLists.txt file')
-
-        return self.directory
-
-    def check_can_download(self) -> None:
-        # Don't download subproject data based on wrap file if requested.
-        # Git submodules are ok (see above)!
-        if self.wrap_mode is WrapMode.nodownload:
-            m = 'Automatic wrap-based subproject downloading is disabled'
-            raise WrapException(m)
-
-    def resolve_git_submodule(self) -> bool:
-        if not GIT:
-            raise WrapException('Git program not found.')
-        # Are we in a git repository?
-        ret, out = quiet_git(['rev-parse'], self.subdir_root)
-        if not ret:
-            return False
-        # Is `dirname` a submodule?
-        ret, out = quiet_git(['submodule', 'status', self.dirname], self.subdir_root)
-        if not ret:
-            return False
-        # Submodule has not been added, add it
-        if out.startswith('+'):
-            mlog.warning('git submodule might be out of date')
-            return True
-        elif out.startswith('U'):
-            raise WrapException('git submodule has merge conflicts')
-        # Submodule exists, but is deinitialized or wasn't initialized
-        elif out.startswith('-'):
-            if verbose_git(['submodule', 'update', '--init', self.dirname], self.subdir_root):
-                return True
-            raise WrapException('git submodule failed to init')
-        # Submodule looks fine, but maybe it wasn't populated properly. Do a checkout.
-        elif out.startswith(' '):
-            verbose_git(['checkout', '.'], self.dirname)
-            # Even if checkout failed, try building it anyway and let the user
-            # handle any problems manually.
-            return True
-        elif out == '':
-            # It is not a submodule, just a folder that exists in the main repository.
-            return False
-        m = 'Unknown git submodule output: {!r}'
-        raise WrapException(m.format(out))
-
-    def get_file(self) -> None:
-        path = self.get_file_internal('source')
-        extract_dir = self.subdir_root
-        # Some upstreams ship packages that do not have a leading directory.
-        # Create one for them.
-        if 'lead_directory_missing' in self.wrap.values:
-            os.mkdir(self.dirname)
-            extract_dir = self.dirname
-        shutil.unpack_archive(path, extract_dir)
-
-    def get_git(self) -> None:
-        if not GIT:
-            raise WrapException('Git program not found.')
-        revno = self.wrap.get('revision')
-        is_shallow = False
-        depth_option = []    # type: T.List[str]
-        if self.wrap.values.get('depth', '') != '':
-            is_shallow = True
-            depth_option = ['--depth', self.wrap.values.get('depth')]
-        # for some reason git only allows commit ids to be shallowly fetched by fetch not with clone
-        if is_shallow and self.is_git_full_commit_id(revno):
-            # git doesn't support directly cloning shallowly for commits,
-            # so we follow https://stackoverflow.com/a/43136160
-            verbose_git(['init', self.directory], self.subdir_root, check=True)
-            verbose_git(['remote', 'add', 'origin', self.wrap.get('url')], self.dirname, check=True)
-            revno = self.wrap.get('revision')
-            verbose_git(['fetch', *depth_option, 'origin', revno], self.dirname, check=True)
-            verbose_git(['checkout', revno], self.dirname, check=True)
-            if self.wrap.values.get('clone-recursive', '').lower() == 'true':
-                verbose_git(['submodule', 'update', '--init', '--checkout',
-                             '--recursive', *depth_option], self.dirname, check=True)
-            push_url = self.wrap.values.get('push-url')
-            if push_url:
-                verbose_git(['remote', 'set-url', '--push', 'origin', push_url], self.dirname, check=True)
-        else:
-            if not is_shallow:
-                verbose_git(['clone', self.wrap.get('url'), self.directory], self.subdir_root, check=True)
-                if revno.lower() != 'head':
-                    if not verbose_git(['checkout', revno], self.dirname):
-                        verbose_git(['fetch', self.wrap.get('url'), revno], self.dirname, check=True)
-                        verbose_git(['checkout', revno], self.dirname, check=True)
-            else:
-                verbose_git(['clone', *depth_option, '--branch', revno, self.wrap.get('url'),
-                             self.directory], self.subdir_root, check=True)
-            if self.wrap.values.get('clone-recursive', '').lower() == 'true':
-                verbose_git(['submodule', 'update', '--init', '--checkout', '--recursive', *depth_option],
-                            self.dirname, check=True)
-            push_url = self.wrap.values.get('push-url')
-            if push_url:
-                verbose_git(['remote', 'set-url', '--push', 'origin', push_url], self.dirname, check=True)
-
-    def is_git_full_commit_id(self, revno: str) -> bool:
-        result = False
-        if len(revno) in (40, 64): # 40 for sha1, 64 for upcoming sha256
-            result = all((ch in '0123456789AaBbCcDdEeFf' for ch in revno))
-        return result
-
-    def get_hg(self) -> None:
-        revno = self.wrap.get('revision')
-        hg = shutil.which('hg')
-        if not hg:
-            raise WrapException('Mercurial program not found.')
-        subprocess.check_call([hg, 'clone', self.wrap.get('url'),
-                               self.directory], cwd=self.subdir_root)
-        if revno.lower() != 'tip':
-            subprocess.check_call([hg, 'checkout', revno],
-                                  cwd=self.dirname)
-
-    def get_svn(self) -> None:
-        revno = self.wrap.get('revision')
-        svn = shutil.which('svn')
-        if not svn:
-            raise WrapException('SVN program not found.')
-        subprocess.check_call([svn, 'checkout', '-r', revno, self.wrap.get('url'),
-                               self.directory], cwd=self.subdir_root)
-
-    def get_data(self, urlstring: str) -> T.Tuple[str, str]:
-        blocksize = 10 * 1024
-        h = hashlib.sha256()
-        tmpfile = tempfile.NamedTemporaryFile(mode='wb', dir=self.cachedir, delete=False)
-        url = urllib.parse.urlparse(urlstring)
-        if url.hostname and url.hostname.endswith(WHITELIST_SUBDOMAIN):
-            resp = open_wrapdburl(urlstring)
-        elif WHITELIST_SUBDOMAIN in urlstring:
-            raise WrapException('{} may be a WrapDB-impersonating URL'.format(urlstring))
-        else:
-            try:
-                req = urllib.request.Request(urlstring, headers={'User-Agent': 'mesonbuild/{}'.format(coredata.version)})
-                resp = urllib.request.urlopen(req, timeout=REQ_TIMEOUT)
-            except urllib.error.URLError as e:
-                mlog.log(str(e))
-                raise WrapException('could not get {} is the internet available?'.format(urlstring))
-        with contextlib.closing(resp) as resp:
-            try:
-                dlsize = int(resp.info()['Content-Length'])
-            except TypeError:
-                dlsize = None
-            if dlsize is None:
-                print('Downloading file of unknown size.')
-                while True:
-                    block = resp.read(blocksize)
-                    if block == b'':
-                        break
-                    h.update(block)
-                    tmpfile.write(block)
-                hashvalue = h.hexdigest()
-                return hashvalue, tmpfile.name
-            sys.stdout.flush()
-            progress_bar = ProgressBar(bar_type='download', total=dlsize,
-                                       desc='Downloading')
-            while True:
-                block = resp.read(blocksize)
-                if block == b'':
-                    break
-                h.update(block)
-                tmpfile.write(block)
-                progress_bar.update(len(block))
-            progress_bar.close()
-            hashvalue = h.hexdigest()
-        return hashvalue, tmpfile.name
-
-    def check_hash(self, what: str, path: str, hash_required: bool = True) -> None:
-        if what + '_hash' not in self.wrap.values and not hash_required:
-            return
-        expected = self.wrap.get(what + '_hash')
-        h = hashlib.sha256()
-        with open(path, 'rb') as f:
-            h.update(f.read())
-        dhash = h.hexdigest()
-        if dhash != expected:
-            raise WrapException('Incorrect hash for {}:\n {} expected\n {} actual.'.format(what, expected, dhash))
-
-    def download(self, what: str, ofname: str, fallback=False) -> None:
-        self.check_can_download()
-        srcurl = self.wrap.get(what + ('_fallback_url' if fallback else '_url'))
-        mlog.log('Downloading', mlog.bold(self.packagename), what, 'from', mlog.bold(srcurl))
-        try:
-            dhash, tmpfile = self.get_data(srcurl)
-            expected = self.wrap.get(what + '_hash')
-            if dhash != expected:
-                os.remove(tmpfile)
-                raise WrapException('Incorrect hash for {}:\n {} expected\n {} actual.'.format(what, expected, dhash))
-        except WrapException:
-            if not fallback:
-                if what + '_fallback_url' in self.wrap.values:
-                    return self.download(what, ofname, fallback=True)
-                mlog.log('A fallback URL could be specified using',
-                         mlog.bold(what + '_fallback_url'), 'key in the wrap file')
-            raise
-        os.rename(tmpfile, ofname)
-
-    def get_file_internal(self, what: str) -> str:
-        filename = self.wrap.get(what + '_filename')
-        if what + '_url' in self.wrap.values:
-            cache_path = os.path.join(self.cachedir, filename)
-
-            if os.path.exists(cache_path):
-                self.check_hash(what, cache_path)
-                mlog.log('Using', mlog.bold(self.packagename), what, 'from cache.')
-                return cache_path
-
-            if not os.path.isdir(self.cachedir):
-                os.mkdir(self.cachedir)
-            self.download(what, cache_path)
-            return cache_path
-        else:
-            from ..interpreterbase import FeatureNew
-            FeatureNew('Local wrap patch files without {}_url'.format(what), '0.55.0').use(self.current_subproject)
-            path = Path(self.filesdir) / filename
-
-            if not path.exists():
-                raise WrapException('File "{}" does not exist'.format(path))
-            self.check_hash(what, path.as_posix(), hash_required=False)
-
-            return path.as_posix()
-
-    def apply_patch(self) -> None:
-        if 'patch_filename' in self.wrap.values and 'patch_directory' in self.wrap.values:
-            m = 'Wrap file {!r} must not have both "patch_filename" and "patch_directory"'
-            raise WrapException(m.format(self.wrap.basename))
-        if 'patch_filename' in self.wrap.values:
-            path = self.get_file_internal('patch')
-            try:
-                shutil.unpack_archive(path, self.subdir_root)
-            except Exception:
-                with tempfile.TemporaryDirectory() as workdir:
-                    shutil.unpack_archive(path, workdir)
-                    self.copy_tree(workdir, self.subdir_root)
-        elif 'patch_directory' in self.wrap.values:
-            from ..interpreterbase import FeatureNew
-            FeatureNew('patch_directory', '0.55.0').use(self.current_subproject)
-            patch_dir = self.wrap.values['patch_directory']
-            src_dir = os.path.join(self.filesdir, patch_dir)
-            if not os.path.isdir(src_dir):
-                raise WrapException('patch directory does not exists: {}'.format(patch_dir))
-            self.copy_tree(src_dir, self.dirname)
-
-    def copy_tree(self, root_src_dir: str, root_dst_dir: str) -> None:
-        """
-        Copy directory tree. Overwrites also read only files.
-        """
-        for src_dir, _, files in os.walk(root_src_dir):
-            dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
-            if not os.path.exists(dst_dir):
-                os.makedirs(dst_dir)
-            for file_ in files:
-                src_file = os.path.join(src_dir, file_)
-                dst_file = os.path.join(dst_dir, file_)
-                if os.path.exists(dst_file):
-                    try:
-                        os.remove(dst_file)
-                    except PermissionError:
-                        os.chmod(dst_file, stat.S_IWUSR)
-                        os.remove(dst_file)
-                shutil.copy2(src_file, dst_dir)
diff --git a/meson/mesonbuild/wrap/wraptool.py b/meson/mesonbuild/wrap/wraptool.py
deleted file mode 100644 (file)
index e01e159..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-# Copyright 2015-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import json
-import sys, os
-import configparser
-import shutil
-
-from glob import glob
-
-from .wrap import API_ROOT, open_wrapdburl
-
-from .. import mesonlib
-
-def add_arguments(parser):
-    subparsers = parser.add_subparsers(title='Commands', dest='command')
-    subparsers.required = True
-
-    p = subparsers.add_parser('list', help='show all available projects')
-    p.set_defaults(wrap_func=list_projects)
-
-    p = subparsers.add_parser('search', help='search the db by name')
-    p.add_argument('name')
-    p.set_defaults(wrap_func=search)
-
-    p = subparsers.add_parser('install', help='install the specified project')
-    p.add_argument('name')
-    p.set_defaults(wrap_func=install)
-
-    p = subparsers.add_parser('update', help='update the project to its newest available release')
-    p.add_argument('name')
-    p.set_defaults(wrap_func=update)
-
-    p = subparsers.add_parser('info', help='show available versions of a project')
-    p.add_argument('name')
-    p.set_defaults(wrap_func=info)
-
-    p = subparsers.add_parser('status', help='show installed and available versions of your projects')
-    p.set_defaults(wrap_func=status)
-
-    p = subparsers.add_parser('promote', help='bring a subsubproject up to the master project')
-    p.add_argument('project_path')
-    p.set_defaults(wrap_func=promote)
-
-def get_result(urlstring):
-    u = open_wrapdburl(urlstring)
-    data = u.read().decode('utf-8')
-    jd = json.loads(data)
-    if jd['output'] != 'ok':
-        print('Got bad output from server.', file=sys.stderr)
-        raise SystemExit(data)
-    return jd
-
-def get_projectlist():
-    jd = get_result(API_ROOT + 'projects')
-    projects = jd['projects']
-    return projects
-
-def list_projects(options):
-    projects = get_projectlist()
-    for p in projects:
-        print(p)
-
-def search(options):
-    name = options.name
-    jd = get_result(API_ROOT + 'query/byname/' + name)
-    for p in jd['projects']:
-        print(p)
-
-def get_latest_version(name: str) -> tuple:
-    jd = get_result(API_ROOT + 'query/get_latest/' + name)
-    branch = jd['branch']
-    revision = jd['revision']
-    return branch, revision
-
-def install(options):
-    name = options.name
-    if not os.path.isdir('subprojects'):
-        raise SystemExit('Subprojects dir not found. Run this script in your source root directory.')
-    if os.path.isdir(os.path.join('subprojects', name)):
-        raise SystemExit('Subproject directory for this project already exists.')
-    wrapfile = os.path.join('subprojects', name + '.wrap')
-    if os.path.exists(wrapfile):
-        raise SystemExit('Wrap file already exists.')
-    (branch, revision) = get_latest_version(name)
-    u = open_wrapdburl(API_ROOT + 'projects/{}/{}/{}/get_wrap'.format(name, branch, revision))
-    data = u.read()
-    with open(wrapfile, 'wb') as f:
-        f.write(data)
-    print('Installed', name, 'branch', branch, 'revision', revision)
-
-def parse_patch_url(patch_url):
-    arr = patch_url.split('/')
-    return arr[-3], int(arr[-2])
-
-def get_current_version(wrapfile):
-    cp = configparser.ConfigParser(interpolation=None)
-    cp.read(wrapfile)
-    cp = cp['wrap-file']
-    patch_url = cp['patch_url']
-    branch, revision = parse_patch_url(patch_url)
-    return branch, revision, cp['directory'], cp['source_filename'], cp['patch_filename']
-
-def update_wrap_file(wrapfile, name, new_branch, new_revision):
-    u = open_wrapdburl(API_ROOT + 'projects/{}/{}/{}/get_wrap'.format(name, new_branch, new_revision))
-    data = u.read()
-    with open(wrapfile, 'wb') as f:
-        f.write(data)
-
-def update(options):
-    name = options.name
-    if not os.path.isdir('subprojects'):
-        raise SystemExit('Subprojects dir not found. Run this command in your source root directory.')
-    wrapfile = os.path.join('subprojects', name + '.wrap')
-    if not os.path.exists(wrapfile):
-        raise SystemExit('Project ' + name + ' is not in use.')
-    (branch, revision, subdir, src_file, patch_file) = get_current_version(wrapfile)
-    (new_branch, new_revision) = get_latest_version(name)
-    if new_branch == branch and new_revision == revision:
-        print('Project ' + name + ' is already up to date.')
-        raise SystemExit
-    update_wrap_file(wrapfile, name, new_branch, new_revision)
-    shutil.rmtree(os.path.join('subprojects', subdir), ignore_errors=True)
-    try:
-        os.unlink(os.path.join('subprojects/packagecache', src_file))
-    except FileNotFoundError:
-        pass
-    try:
-        os.unlink(os.path.join('subprojects/packagecache', patch_file))
-    except FileNotFoundError:
-        pass
-    print('Updated', name, 'to branch', new_branch, 'revision', new_revision)
-
-def info(options):
-    name = options.name
-    jd = get_result(API_ROOT + 'projects/' + name)
-    versions = jd['versions']
-    if not versions:
-        raise SystemExit('No available versions of' + name)
-    print('Available versions of {}:'.format(name))
-    for v in versions:
-        print(' ', v['branch'], v['revision'])
-
-def do_promotion(from_path, spdir_name):
-    if os.path.isfile(from_path):
-        assert(from_path.endswith('.wrap'))
-        shutil.copy(from_path, spdir_name)
-    elif os.path.isdir(from_path):
-        sproj_name = os.path.basename(from_path)
-        outputdir = os.path.join(spdir_name, sproj_name)
-        if os.path.exists(outputdir):
-            raise SystemExit('Output dir {} already exists. Will not overwrite.'.format(outputdir))
-        shutil.copytree(from_path, outputdir, ignore=shutil.ignore_patterns('subprojects'))
-
-def promote(options):
-    argument = options.project_path
-    spdir_name = 'subprojects'
-    sprojs = mesonlib.detect_subprojects(spdir_name)
-
-    # check if the argument is a full path to a subproject directory or wrap file
-    system_native_path_argument = argument.replace('/', os.sep)
-    for matches in sprojs.values():
-        if system_native_path_argument in matches:
-            do_promotion(system_native_path_argument, spdir_name)
-            return
-
-    # otherwise the argument is just a subproject basename which must be unambiguous
-    if argument not in sprojs:
-        raise SystemExit('Subproject {} not found in directory tree.'.format(argument))
-    matches = sprojs[argument]
-    if len(matches) > 1:
-        print('There is more than one version of {} in tree. Please specify which one to promote:\n'.format(argument), file=sys.stderr)
-        for s in matches:
-            print(s, file=sys.stderr)
-        raise SystemExit(1)
-    do_promotion(matches[0], spdir_name)
-
-def status(options):
-    print('Subproject status')
-    for w in glob('subprojects/*.wrap'):
-        name = os.path.basename(w)[:-5]
-        try:
-            (latest_branch, latest_revision) = get_latest_version(name)
-        except Exception:
-            print('', name, 'not available in wrapdb.', file=sys.stderr)
-            continue
-        try:
-            (current_branch, current_revision, _, _, _) = get_current_version(w)
-        except Exception:
-            print('Wrap file not from wrapdb.', file=sys.stderr)
-            continue
-        if current_branch == latest_branch and current_revision == latest_revision:
-            print('', name, 'up to date. Branch {}, revision {}.'.format(current_branch, current_revision))
-        else:
-            print('', name, 'not up to date. Have {} {}, but {} {} is available.'.format(current_branch, current_revision, latest_branch, latest_revision))
-
-def run(options):
-    options.wrap_func(options)
-    return 0
diff --git a/meson/msi/License.rtf b/meson/msi/License.rtf
deleted file mode 100644 (file)
index b3945ba..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fswiss\fprq2\fcharset0 Arial;}}
-{\colortbl ;\red0\green0\blue255;}
-{\*\generator Msftedit 5.41.21.2510;}\viewkind4\uc1\pard\qc\lang1033\b\f0\fs18 Apache License\par
-Version 2.0, January 2004\par
-{\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/"}}{\fldrslt{\ul\cf1 http://www.apache.org/licenses/}}}\f0\fs18\par
-\b0\par
-\pard TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION\par
-\par
-\pard\fi-180\li180 1. Definitions.\par
-\par
-\pard\li180 "License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.\par
-\par
-"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.\par
-\par
-"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.\par
-\par
-"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.\par
-\par
-"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.\par
-\par
-"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.\par
-\par
-"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).\par
-\par
-"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.\par
-\par
-"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."\par
-\par
-"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.\par
-\pard\par
-\pard\fi-180\li180 2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.\par
-\par
-3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.\par
-\par
-4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:\par
-\pard\par
-\pard\fi-270\li450 (a) You must give any other recipients of the Work or Derivative Works a copy of this License; and\par
-\par
-(b) You must cause any modified files to carry prominent notices stating that You changed the files; and\par
-\par
-(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and\par
-\par
-(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.\par
-\pard\par
-\pard\li180 You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or  for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.\par
-\pard\par
-\pard\fi-180\li180 5. Submission of Contributions. Unless You explicitly state otherwise,  any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.\par
-\par
-6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.\par
-\par
-7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.\par
-\par
-8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.\par
-\par
-9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.\par
-\pard\par
-END OF TERMS AND CONDITIONS\par
-\par
-APPENDIX: How to apply the Apache License to your work.\par
-\par
-To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!)  The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.\par
-\par
-\pard\li180 Copyright [yyyy] [name of copyright owner]\par
-\par
-Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.  You may obtain a copy of the License at\par
-\par
-\pard\li360{\field{\*\fldinst{HYPERLINK "http://www.apache.org/licenses/LICENSE-2.0"}}{\fldrslt{\ul\cf1 http://www.apache.org/licenses/LICENSE-2.0}}}\f0\fs18\par
-\pard\li180\par
-Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\par
-\pard\par
-\par
-}
-\0
\ No newline at end of file
diff --git a/meson/msi/createmsi.py b/meson/msi/createmsi.py
deleted file mode 100644 (file)
index f80d1dc..0000000
+++ /dev/null
@@ -1,354 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2017 The Meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-'''
-    This script is for generating MSI packages
-    for Windows users.
-'''
-import subprocess
-import shutil
-import uuid
-import sys
-import os
-from glob import glob
-import platform
-import xml.etree.ElementTree as ET
-
-sys.path.append(os.getcwd())
-from mesonbuild import coredata
-
-def gen_guid():
-    '''
-       Generate guid
-    '''
-    return str(uuid.uuid4()).upper()
-
-class Node:
-    '''
-       Node to hold path and directory values
-    '''
-
-    def __init__(self, dirs, files):
-        self.check_dirs(dirs)
-        self.check_files(files)
-        self.dirs = dirs
-        self.files = files
-
-    @staticmethod
-    def check_dirs(dirs):
-        '''
-           Check to see if directory is instance of list
-        '''
-        assert isinstance(dirs, list)
-
-    @staticmethod
-    def check_files(files):
-        '''
-           Check to see if files is instance of list
-        '''
-        assert isinstance(files, list)
-
-
-class PackageGenerator:
-    '''
-       Package generator for MSI pacakges
-    '''
-
-    def __init__(self):
-        self.product_name = 'Meson Build System'
-        self.manufacturer = 'The Meson Development Team'
-        self.version = coredata.version.replace('dev', '')
-        self.root = None
-        self.guid = '*'
-        self.update_guid = '141527EE-E28A-4D14-97A4-92E6075D28B2'
-        self.main_xml = 'meson.wxs'
-        self.main_o = 'meson.wixobj'
-        self.bytesize = 32 if '32' in platform.architecture()[0] else 64
-        self.final_output = 'meson-{}-{}.msi'.format(self.version, self.bytesize)
-        self.staging_dirs = ['dist', 'dist2']
-        if self.bytesize == 64:
-            self.progfile_dir = 'ProgramFiles64Folder'
-            redist_glob = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC142_CRT_x64.msm'
-        else:
-            self.progfile_dir = 'ProgramFilesFolder'
-            redist_glob = 'C:\\Program Files*\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC142_CRT_x86.msm'
-        trials = glob(redist_glob)
-        if len(trials) != 1:
-            sys.exit('Could not find unique MSM setup:' + '\n'.join(trials))
-        self.redist_path = trials[0]
-        self.component_num = 0
-        self.feature_properties = {
-            self.staging_dirs[0]: {
-                'Id': 'MainProgram',
-                'Title': 'Meson',
-                'Description': 'Meson executables',
-                'Level': '1',
-                'Absent': 'disallow',
-            },
-            self.staging_dirs[1]: {
-                'Id': 'NinjaProgram',
-                'Title': 'Ninja',
-                'Description': 'Ninja build tool',
-                'Level': '1',
-            }
-        }
-        self.feature_components = {}
-        for s_d in self.staging_dirs:
-            self.feature_components[s_d] = []
-
-    @staticmethod
-    def get_all_modules_from_dir(dirname):
-        '''
-           Get all modules required for Meson build MSI package
-           from directories.
-        '''
-        modname = os.path.basename(dirname)
-        modules = [os.path.splitext(os.path.split(x)[1])[0] for x in glob(os.path.join(dirname, '*'))]
-        modules = ['mesonbuild.' + modname + '.' + x for x in modules if not x.startswith('_')]
-        return modules
-
-    @staticmethod
-    def get_more_modules():
-        '''
-           Getter for missing Modules.
-           Python packagers want to be minimal and only copy the things
-           that they can see that being used. They are blind to many things.
-        '''
-        return ['distutils.archive_util',
-                'distutils.cmd',
-                'distutils.config',
-                'distutils.core',
-                'distutils.debug',
-                'distutils.dep_util',
-                'distutils.dir_util',
-                'distutils.dist',
-                'distutils.errors',
-                'distutils.extension',
-                'distutils.fancy_getopt',
-                'distutils.file_util',
-                'distutils.spawn',
-                'distutils.util',
-                'distutils.version',
-                'distutils.command.build_ext',
-                'distutils.command.build',
-                ]
-
-    def build_dist(self):
-        '''
-           Build dist file from PyInstaller info
-        '''
-        for sdir in self.staging_dirs:
-            if os.path.exists(sdir):
-                shutil.rmtree(sdir)
-        main_stage, ninja_stage = self.staging_dirs
-        modules = self.get_all_modules_from_dir('mesonbuild/modules')
-        modules += self.get_all_modules_from_dir('mesonbuild/scripts')
-        modules += self.get_more_modules()
-
-        pyinstaller = shutil.which('pyinstaller')
-        if not pyinstaller:
-            print("ERROR: This script requires pyinstaller.")
-            sys.exit(1)
-
-        pyinstaller_tmpdir = 'pyinst-tmp'
-        if os.path.exists(pyinstaller_tmpdir):
-            shutil.rmtree(pyinstaller_tmpdir)
-        pyinst_cmd = [pyinstaller,
-                      '--clean',
-                      '--distpath',
-                      pyinstaller_tmpdir]
-        for m in modules:
-            pyinst_cmd += ['--hidden-import', m]
-        pyinst_cmd += ['meson.py']
-        subprocess.check_call(pyinst_cmd)
-        shutil.move(pyinstaller_tmpdir + '/meson', main_stage)
-        if not os.path.exists(os.path.join(main_stage, 'meson.exe')):
-            sys.exit('Meson exe missing from staging dir.')
-        os.mkdir(ninja_stage)
-        shutil.copy(shutil.which('ninja'), ninja_stage)
-        if not os.path.exists(os.path.join(ninja_stage, 'ninja.exe')):
-            sys.exit('Ninja exe missing from staging dir.')
-
-    def generate_files(self):
-        '''
-           Generate package files for MSI installer package
-        '''
-        self.root = ET.Element('Wix', {'xmlns': 'http://schemas.microsoft.com/wix/2006/wi'})
-        product = ET.SubElement(self.root, 'Product', {
-            'Name': self.product_name,
-            'Manufacturer': 'The Meson Development Team',
-            'Id': self.guid,
-            'UpgradeCode': self.update_guid,
-            'Language': '1033',
-            'Codepage':  '1252',
-            'Version': self.version,
-        })
-
-        package = ET.SubElement(product, 'Package', {
-            'Id': '*',
-            'Keywords': 'Installer',
-            'Description': 'Meson {} installer'.format(self.version),
-            'Comments': 'Meson is a high performance build system',
-            'Manufacturer': 'The Meson Development Team',
-            'InstallerVersion': '500',
-            'Languages': '1033',
-            'Compressed': 'yes',
-            'SummaryCodepage': '1252',
-        })
-
-        ET.SubElement(product, 'MajorUpgrade',
-                      {'DowngradeErrorMessage': 'A newer version of Meson is already installed.'})
-
-        if self.bytesize == 64:
-            package.set('Platform', 'x64')
-        ET.SubElement(product, 'Media', {
-            'Id': '1',
-            'Cabinet': 'meson.cab',
-            'EmbedCab': 'yes',
-        })
-        targetdir = ET.SubElement(product, 'Directory', {
-            'Id': 'TARGETDIR',
-            'Name': 'SourceDir',
-        })
-        progfiledir = ET.SubElement(targetdir, 'Directory', {
-            'Id': self.progfile_dir,
-        })
-        installdir = ET.SubElement(progfiledir, 'Directory', {
-            'Id': 'INSTALLDIR',
-            'Name': 'Meson',
-        })
-        ET.SubElement(installdir, 'Merge', {
-            'Id': 'VCRedist',
-            'SourceFile': self.redist_path,
-            'DiskId': '1',
-            'Language': '0',
-        })
-
-        ET.SubElement(product, 'Property', {
-            'Id': 'WIXUI_INSTALLDIR',
-            'Value': 'INSTALLDIR',
-        })
-        ET.SubElement(product, 'UIRef', {
-            'Id': 'WixUI_FeatureTree',
-        })
-        for s_d in self.staging_dirs:
-            assert os.path.isdir(s_d)
-        top_feature = ET.SubElement(product, 'Feature', {
-            'Id': 'Complete',
-            'Title': 'Meson ' + self.version,
-            'Description': 'The complete package',
-            'Display': 'expand',
-            'Level': '1',
-            'ConfigurableDirectory': 'INSTALLDIR',
-        })
-        for s_d in self.staging_dirs:
-            nodes = {}
-            for root, dirs, files in os.walk(s_d):
-                cur_node = Node(dirs, files)
-                nodes[root] = cur_node
-            self.create_xml(nodes, s_d, installdir, s_d)
-            self.build_features(top_feature, s_d)
-        vcredist_feature = ET.SubElement(top_feature, 'Feature', {
-            'Id': 'VCRedist',
-            'Title': 'Visual C++ runtime',
-            'AllowAdvertise': 'no',
-            'Display': 'hidden',
-            'Level': '1',
-        })
-        ET.SubElement(vcredist_feature, 'MergeRef', {'Id': 'VCRedist'})
-        ET.ElementTree(self.root).write(self.main_xml, encoding='utf-8', xml_declaration=True)
-        # ElementTree can not do prettyprinting so do it manually
-        import xml.dom.minidom
-        doc = xml.dom.minidom.parse(self.main_xml)
-        with open(self.main_xml, 'w') as open_file:
-            open_file.write(doc.toprettyxml())
-
-    def build_features(self, top_feature, staging_dir):
-        '''
-           Generate build features
-        '''
-        feature = ET.SubElement(top_feature, 'Feature', self.feature_properties[staging_dir])
-        for component_id in self.feature_components[staging_dir]:
-            ET.SubElement(feature, 'ComponentRef', {
-                'Id': component_id,
-            })
-
-    def create_xml(self, nodes, current_dir, parent_xml_node, staging_dir):
-        '''
-           Create XML file
-        '''
-        cur_node = nodes[current_dir]
-        if cur_node.files:
-            component_id = 'ApplicationFiles{}'.format(self.component_num)
-            comp_xml_node = ET.SubElement(parent_xml_node, 'Component', {
-                'Id': component_id,
-                'Guid': gen_guid(),
-            })
-            self.feature_components[staging_dir].append(component_id)
-            if self.bytesize == 64:
-                comp_xml_node.set('Win64', 'yes')
-            if self.component_num == 0:
-                ET.SubElement(comp_xml_node, 'Environment', {
-                    'Id': 'Environment',
-                    'Name': 'PATH',
-                    'Part': 'last',
-                    'System': 'yes',
-                    'Action': 'set',
-                    'Value': '[INSTALLDIR]',
-                })
-            self.component_num += 1
-            for f_node in cur_node.files:
-                file_id = os.path.join(current_dir, f_node).replace('\\', '_').replace('#', '_').replace('-', '_')
-                ET.SubElement(comp_xml_node, 'File', {
-                    'Id': file_id,
-                    'Name': f_node,
-                    'Source': os.path.join(current_dir, f_node),
-                })
-
-        for dirname in cur_node.dirs:
-            dir_id = os.path.join(current_dir, dirname).replace('\\', '_').replace('/', '_')
-            dir_node = ET.SubElement(parent_xml_node, 'Directory', {
-                'Id': dir_id,
-                'Name': dirname,
-            })
-            self.create_xml(nodes, os.path.join(current_dir, dirname), dir_node, staging_dir)
-
-    def build_package(self):
-        '''
-           Generate the Meson build MSI package.
-        '''
-        wixdir = 'c:\\Program Files\\Wix Toolset v3.11\\bin'
-        if not os.path.isdir(wixdir):
-            wixdir = 'c:\\Program Files (x86)\\Wix Toolset v3.11\\bin'
-        if not os.path.isdir(wixdir):
-            print("ERROR: This script requires WIX")
-            sys.exit(1)
-        subprocess.check_call([os.path.join(wixdir, 'candle'), self.main_xml])
-        subprocess.check_call([os.path.join(wixdir, 'light'),
-                               '-ext', 'WixUIExtension',
-                               '-cultures:en-us',
-                               '-dWixUILicenseRtf=msi\\License.rtf',
-                               '-out', self.final_output,
-                               self.main_o])
-
-if __name__ == '__main__':
-    if not os.path.exists('meson.py'):
-        sys.exit(print('Run me in the top level source dir.'))
-    subprocess.check_call(['pip', 'install', '--upgrade', 'pyinstaller'])
-
-    p = PackageGenerator()
-    p.build_dist()
-    p.generate_files()
-    p.build_package()
diff --git a/meson/pyproject.toml b/meson/pyproject.toml
deleted file mode 100644 (file)
index d1e6ae6..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-[build-system]
-requires = ["setuptools", "wheel"]
diff --git a/meson/run_cross_test.py b/meson/run_cross_test.py
deleted file mode 100755 (executable)
index 1e67876..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2013-2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''Runs the basic test suite through a cross compiler.
-
-This is now just a wrapper around run_project_tests.py with specific arguments
-'''
-
-import argparse
-import subprocess
-from mesonbuild import mesonlib
-from mesonbuild.coredata import version as meson_version
-
-
-def runtests(cross_file, failfast):
-    tests = ['--only', 'common']
-    cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja'] + (['--failfast'] if failfast else []) + tests + ['--cross-file', cross_file]
-    return subprocess.call(cmd)
-
-def main():
-    parser = argparse.ArgumentParser()
-    parser.add_argument('--failfast', action='store_true')
-    parser.add_argument('cross_file')
-    options = parser.parse_args()
-    return runtests(options.cross_file, options.failfast)
-
-if __name__ == '__main__':
-    print('Meson build system', meson_version, 'Cross Tests')
-    raise SystemExit(main())
diff --git a/meson/run_meson_command_tests.py b/meson/run_meson_command_tests.py
deleted file mode 100755 (executable)
index 7bc6185..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2018 The Meson development team
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import tempfile
-import unittest
-import subprocess
-import zipapp
-from pathlib import Path
-
-from mesonbuild.mesonlib import windows_proof_rmtree, python_command, is_windows
-from mesonbuild.coredata import version as meson_version
-
-
-def get_pypath():
-    import sysconfig
-    pypath = sysconfig.get_path('purelib', vars={'base': ''})
-    # Ensure that / is the path separator and not \, then strip /
-    return Path(pypath).as_posix().strip('/')
-
-def get_pybindir():
-    import sysconfig
-    # 'Scripts' on Windows and 'bin' on other platforms including MSYS
-    return sysconfig.get_path('scripts', vars={'base': ''}).strip('\\/')
-
-class CommandTests(unittest.TestCase):
-    '''
-    Test that running meson in various ways works as expected by checking the
-    value of mesonlib.meson_command that was set during configuration.
-    '''
-
-    def setUp(self):
-        super().setUp()
-        self.orig_env = os.environ.copy()
-        self.orig_dir = os.getcwd()
-        os.environ['MESON_COMMAND_TESTS'] = '1'
-        self.tmpdir = Path(tempfile.mkdtemp()).resolve()
-        self.src_root = Path(__file__).resolve().parent
-        self.testdir = str(self.src_root / 'test cases/common/1 trivial')
-        self.meson_args = ['--backend=ninja']
-
-    def tearDown(self):
-        try:
-            windows_proof_rmtree(str(self.tmpdir))
-        except FileNotFoundError:
-            pass
-        os.environ.clear()
-        os.environ.update(self.orig_env)
-        os.chdir(str(self.orig_dir))
-        super().tearDown()
-
-    def _run(self, command, workdir=None):
-        '''
-        Run a command while printing the stdout, and also return a copy of it
-        '''
-        # If this call hangs CI will just abort. It is very hard to distinguish
-        # between CI issue and test bug in that case. Set timeout and fail loud
-        # instead.
-        p = subprocess.run(command, stdout=subprocess.PIPE,
-                           env=os.environ.copy(), universal_newlines=True,
-                           cwd=workdir, timeout=60 * 5)
-        print(p.stdout)
-        if p.returncode != 0:
-            raise subprocess.CalledProcessError(p.returncode, command)
-        return p.stdout
-
-    def assertMesonCommandIs(self, line, cmd):
-        self.assertTrue(line.startswith('meson_command '), msg=line)
-        self.assertEqual(line, 'meson_command is {!r}'.format(cmd))
-
-    def test_meson_uninstalled(self):
-        # This is what the meson command must be for all these cases
-        resolved_meson_command = python_command + [str(self.src_root / 'meson.py')]
-        # Absolute path to meson.py
-        os.chdir('/')
-        builddir = str(self.tmpdir / 'build1')
-        meson_py = str(self.src_root / 'meson.py')
-        meson_setup = [meson_py, 'setup']
-        meson_command = python_command + meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-        # ./meson.py
-        os.chdir(str(self.src_root))
-        builddir = str(self.tmpdir / 'build2')
-        meson_py = './meson.py'
-        meson_setup = [meson_py, 'setup']
-        meson_command = python_command + meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-        # Symlink to meson.py
-        if is_windows():
-            # Symlinks require admin perms
-            return
-        os.chdir(str(self.src_root))
-        builddir = str(self.tmpdir / 'build3')
-        # Create a symlink to meson.py in bindir, and add it to PATH
-        bindir = (self.tmpdir / 'bin')
-        bindir.mkdir()
-        (bindir / 'meson').symlink_to(self.src_root / 'meson.py')
-        os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
-        # See if it works!
-        meson_py = 'meson'
-        meson_setup = [meson_py, 'setup']
-        meson_command = meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-
-    def test_meson_installed(self):
-        # Install meson
-        prefix = self.tmpdir / 'prefix'
-        pylibdir = prefix / get_pypath()
-        bindir = prefix / get_pybindir()
-        pylibdir.mkdir(parents=True)
-        # XXX: join with empty name so it always ends with os.sep otherwise
-        # distutils complains that prefix isn't contained in PYTHONPATH
-        os.environ['PYTHONPATH'] = os.path.join(str(pylibdir), '')
-        os.environ['PATH'] = str(bindir) + os.pathsep + os.environ['PATH']
-        self._run(python_command + ['setup.py', 'install', '--prefix', str(prefix)])
-        # Fix importlib-metadata by appending all dirs in pylibdir
-        PYTHONPATHS = [pylibdir] + [x for x in pylibdir.iterdir()]
-        PYTHONPATHS = [os.path.join(str(x), '') for x in PYTHONPATHS]
-        os.environ['PYTHONPATH'] = os.pathsep.join(PYTHONPATHS)
-        # Check that all the files were installed correctly
-        self.assertTrue(bindir.is_dir())
-        self.assertTrue(pylibdir.is_dir())
-        from setup import packages
-        # Extract list of expected python module files
-        expect = set()
-        for pkg in packages:
-            expect.update([p.as_posix() for p in Path(pkg.replace('.', '/')).glob('*.py')])
-        # Check what was installed, only count files that are inside 'mesonbuild'
-        have = set()
-        for p in Path(pylibdir).glob('**/*.py'):
-            s = p.as_posix()
-            if 'mesonbuild' not in s:
-                continue
-            if '/data/' in s:
-                continue
-            have.add(s[s.rfind('mesonbuild'):])
-        self.assertEqual(have, expect)
-        # Run `meson`
-        os.chdir('/')
-        resolved_meson_command = [str(bindir / 'meson')]
-        builddir = str(self.tmpdir / 'build1')
-        meson_setup = ['meson', 'setup']
-        meson_command = meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-        # Run `/path/to/meson`
-        builddir = str(self.tmpdir / 'build2')
-        meson_setup = [str(bindir / 'meson'), 'setup']
-        meson_command = meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-        # Run `python3 -m mesonbuild.mesonmain`
-        resolved_meson_command = python_command + ['-m', 'mesonbuild.mesonmain']
-        builddir = str(self.tmpdir / 'build3')
-        meson_setup = ['-m', 'mesonbuild.mesonmain', 'setup']
-        meson_command = python_command + meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-        if is_windows():
-            # Next part requires a shell
-            return
-        # `meson` is a wrapper to `meson.real`
-        resolved_meson_command = [str(bindir / 'meson.real')]
-        builddir = str(self.tmpdir / 'build4')
-        (bindir / 'meson').rename(bindir / 'meson.real')
-        wrapper = (bindir / 'meson')
-        wrapper.open('w').write('#!/bin/sh\n\nmeson.real "$@"')
-        wrapper.chmod(0o755)
-        meson_setup = [str(wrapper), 'setup']
-        meson_command = meson_setup + self.meson_args
-        stdo = self._run(meson_command + [self.testdir, builddir])
-        self.assertMesonCommandIs(stdo.split('\n')[0], resolved_meson_command)
-
-    def test_meson_exe_windows(self):
-        raise unittest.SkipTest('NOT IMPLEMENTED')
-
-    def test_meson_zipapp(self):
-        if is_windows():
-            raise unittest.SkipTest('NOT IMPLEMENTED')
-        source = Path(__file__).resolve().parent.as_posix()
-        target = self.tmpdir / 'meson.pyz'
-        zipapp.create_archive(source=source, target=target, interpreter=python_command[0], main=None)
-        self._run([target.as_posix(), '--help'])
-
-
-if __name__ == '__main__':
-    print('Meson build system', meson_version, 'Command Tests')
-    raise SystemExit(unittest.main(buffer=True))
diff --git a/meson/run_project_tests.py b/meson/run_project_tests.py
deleted file mode 100755 (executable)
index 348c5ca..0000000
+++ /dev/null
@@ -1,1300 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2012-2019 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from concurrent.futures import ProcessPoolExecutor, CancelledError
-from enum import Enum
-from io import StringIO
-from pathlib import Path, PurePath
-import argparse
-import functools
-import itertools
-import json
-import multiprocessing
-import os
-import re
-import shlex
-import shutil
-import signal
-import subprocess
-import sys
-import tempfile
-import time
-import typing as T
-import xml.etree.ElementTree as ET
-
-from mesonbuild import build
-from mesonbuild import environment
-from mesonbuild import compilers
-from mesonbuild import mesonlib
-from mesonbuild import mlog
-from mesonbuild import mtest
-from mesonbuild.mesonlib import MachineChoice, Popen_safe
-from mesonbuild.coredata import backendlist, version as meson_version
-
-from run_tests import get_fake_options, run_configure, get_meson_script
-from run_tests import get_backend_commands, get_backend_args_for_dir, Backend
-from run_tests import ensure_backend_detects_changes
-from run_tests import guess_backend
-
-ALL_TESTS = ['cmake', 'common', 'warning-meson', 'failing-meson', 'failing-build', 'failing-test',
-             'keyval', 'platform-osx', 'platform-windows', 'platform-linux',
-             'java', 'C#', 'vala',  'rust', 'd', 'objective c', 'objective c++',
-             'fortran', 'swift', 'cuda', 'python3', 'python', 'fpga', 'frameworks', 'nasm', 'wasm'
-             ]
-
-
-class BuildStep(Enum):
-    configure = 1
-    build = 2
-    test = 3
-    install = 4
-    clean = 5
-    validate = 6
-
-
-class TestResult(BaseException):
-    def __init__(self, cicmds):
-        self.msg = ''  # empty msg indicates test success
-        self.stdo = ''
-        self.stde = ''
-        self.mlog = ''
-        self.cicmds = cicmds
-        self.conftime = 0
-        self.buildtime = 0
-        self.testtime = 0
-
-    def add_step(self, step, stdo, stde, mlog='', time=0):
-        self.step = step
-        self.stdo += stdo
-        self.stde += stde
-        self.mlog += mlog
-        if step == BuildStep.configure:
-            self.conftime = time
-        elif step == BuildStep.build:
-            self.buildtime = time
-        elif step == BuildStep.test:
-            self.testtime = time
-
-    def fail(self, msg):
-        self.msg = msg
-
-class InstalledFile:
-    def __init__(self, raw: T.Dict[str, str]):
-        self.path = raw['file']
-        self.typ = raw['type']
-        self.platform = raw.get('platform', None)
-        self.language = raw.get('language', 'c')  # type: str
-
-        version = raw.get('version', '')  # type: str
-        if version:
-            self.version = version.split('.')  # type: T.List[str]
-        else:
-            # split on '' will return [''], we want an empty list though
-            self.version = []
-
-    def get_path(self, compiler: str, env: environment.Environment) -> T.Optional[Path]:
-        p = Path(self.path)
-        canonical_compiler = compiler
-        if ((compiler in ['clang-cl', 'intel-cl']) or
-                (env.machines.host.is_windows() and compiler in {'pgi', 'dmd', 'ldc'})):
-            canonical_compiler = 'msvc'
-
-        has_pdb = False
-        if self.language in {'c', 'cpp'}:
-            has_pdb = canonical_compiler == 'msvc'
-        elif self.language == 'd':
-            # dmd's optlink does not genearte pdb iles
-            has_pdb = env.coredata.compilers.host['d'].linker.id in {'link', 'lld-link'}
-
-        # Abort if the platform does not match
-        matches = {
-            'msvc': canonical_compiler == 'msvc',
-            'gcc': canonical_compiler != 'msvc',
-            'cygwin': env.machines.host.is_cygwin(),
-            '!cygwin': not env.machines.host.is_cygwin(),
-        }.get(self.platform or '', True)
-        if not matches:
-            return None
-
-        # Handle the different types
-        if self.typ in ['file', 'dir']:
-            return p
-        elif self.typ == 'shared_lib':
-            if env.machines.host.is_windows() or env.machines.host.is_cygwin():
-                # Windows only has foo.dll and foo-X.dll
-                if len(self.version) > 1:
-                    return None
-                if self.version:
-                    p = p.with_name('{}-{}'.format(p.name, self.version[0]))
-                return p.with_suffix('.dll')
-
-            p = p.with_name('lib{}'.format(p.name))
-            if env.machines.host.is_darwin():
-                # MacOS only has libfoo.dylib and libfoo.X.dylib
-                if len(self.version) > 1:
-                    return None
-
-                # pathlib.Path.with_suffix replaces, not appends
-                suffix = '.dylib'
-                if self.version:
-                    suffix = '.{}{}'.format(self.version[0], suffix)
-            else:
-                # pathlib.Path.with_suffix replaces, not appends
-                suffix = '.so'
-                if self.version:
-                    suffix = '{}.{}'.format(suffix, '.'.join(self.version))
-            return p.with_suffix(suffix)
-        elif self.typ == 'exe':
-            if env.machines.host.is_windows() or env.machines.host.is_cygwin():
-                return p.with_suffix('.exe')
-        elif self.typ == 'pdb':
-            if self.version:
-                p = p.with_name('{}-{}'.format(p.name, self.version[0]))
-            return p.with_suffix('.pdb') if has_pdb else None
-        elif self.typ == 'implib' or self.typ == 'implibempty':
-            if env.machines.host.is_windows() and canonical_compiler == 'msvc':
-                # only MSVC doesn't generate empty implibs
-                if self.typ == 'implibempty' and compiler == 'msvc':
-                    return None
-                return p.parent / (re.sub(r'^lib', '', p.name) + '.lib')
-            elif env.machines.host.is_windows() or env.machines.host.is_cygwin():
-                return p.with_suffix('.dll.a')
-            else:
-                return None
-        elif self.typ == 'expr':
-            return Path(platform_fix_name(p.as_posix(), canonical_compiler, env))
-        else:
-            raise RuntimeError('Invalid installed file type {}'.format(self.typ))
-
-        return p
-
-    def get_paths(self, compiler: str, env: environment.Environment, installdir: Path) -> T.List[Path]:
-        p = self.get_path(compiler, env)
-        if not p:
-            return []
-        if self.typ == 'dir':
-            abs_p = installdir / p
-            if not abs_p.exists():
-                raise RuntimeError('{} does not exist'.format(p))
-            if not abs_p.is_dir():
-                raise RuntimeError('{} is not a directory'.format(p))
-            return [x.relative_to(installdir) for x in abs_p.rglob('*') if x.is_file() or x.is_symlink()]
-        else:
-            return [p]
-
-@functools.total_ordering
-class TestDef:
-    def __init__(self, path: Path, name: T.Optional[str], args: T.List[str], skip: bool = False):
-        self.path = path
-        self.name = name
-        self.args = args
-        self.skip = skip
-        self.env = os.environ.copy()
-        self.installed_files = []  # type: T.List[InstalledFile]
-        self.do_not_set_opts = []  # type: T.List[str]
-        self.stdout = [] # type: T.List[T.Dict[str, str]]
-
-    def __repr__(self) -> str:
-        return '<{}: {:<48} [{}: {}] -- {}>'.format(type(self).__name__, str(self.path), self.name, self.args, self.skip)
-
-    def display_name(self) -> str:
-        if self.name:
-            return '{}   ({})'.format(self.path.as_posix(), self.name)
-        return self.path.as_posix()
-
-    def __lt__(self, other: T.Any) -> bool:
-        if isinstance(other, TestDef):
-            # None is not sortable, so replace it with an empty string
-            s_id = int(self.path.name.split(' ')[0])
-            o_id = int(other.path.name.split(' ')[0])
-            return (s_id, self.path, self.name or '') < (o_id, other.path, other.name or '')
-        return NotImplemented
-
-class AutoDeletedDir:
-    def __init__(self, d):
-        self.dir = d
-
-    def __enter__(self):
-        os.makedirs(self.dir, exist_ok=True)
-        return self.dir
-
-    def __exit__(self, _type, value, traceback):
-        # We don't use tempfile.TemporaryDirectory, but wrap the
-        # deletion in the AutoDeletedDir class because
-        # it fails on Windows due antivirus programs
-        # holding files open.
-        mesonlib.windows_proof_rmtree(self.dir)
-
-failing_logs = []
-print_debug = 'MESON_PRINT_TEST_OUTPUT' in os.environ
-under_ci = 'CI' in os.environ
-under_xenial_ci = under_ci and ('XENIAL' in os.environ)
-skip_scientific = under_ci and ('SKIP_SCIENTIFIC' in os.environ)
-do_debug = under_ci or print_debug
-no_meson_log_msg = 'No meson-log.txt found.'
-
-system_compiler = None
-compiler_id_map = {}  # type: T.Dict[str, str]
-tool_vers_map = {}    # type: T.Dict[str, str]
-
-class StopException(Exception):
-    def __init__(self):
-        super().__init__('Stopped by user')
-
-stop = False
-def stop_handler(signal, frame):
-    global stop
-    stop = True
-signal.signal(signal.SIGINT, stop_handler)
-signal.signal(signal.SIGTERM, stop_handler)
-
-def setup_commands(optbackend):
-    global do_debug, backend, backend_flags
-    global compile_commands, clean_commands, test_commands, install_commands, uninstall_commands
-    backend, backend_flags = guess_backend(optbackend, shutil.which('msbuild'))
-    compile_commands, clean_commands, test_commands, install_commands, \
-        uninstall_commands = get_backend_commands(backend, do_debug)
-
-# TODO try to eliminate or at least reduce this function
-def platform_fix_name(fname: str, canonical_compiler: str, env: environment.Environment) -> str:
-    if '?lib' in fname:
-        if env.machines.host.is_windows() and canonical_compiler == 'msvc':
-            fname = re.sub(r'lib/\?lib(.*)\.', r'bin/\1.', fname)
-            fname = re.sub(r'/\?lib/', r'/bin/', fname)
-        elif env.machines.host.is_windows():
-            fname = re.sub(r'lib/\?lib(.*)\.', r'bin/lib\1.', fname)
-            fname = re.sub(r'\?lib(.*)\.dll$', r'lib\1.dll', fname)
-            fname = re.sub(r'/\?lib/', r'/bin/', fname)
-        elif env.machines.host.is_cygwin():
-            fname = re.sub(r'lib/\?lib(.*)\.so$', r'bin/cyg\1.dll', fname)
-            fname = re.sub(r'lib/\?lib(.*)\.', r'bin/cyg\1.', fname)
-            fname = re.sub(r'\?lib(.*)\.dll$', r'cyg\1.dll', fname)
-            fname = re.sub(r'/\?lib/', r'/bin/', fname)
-        else:
-            fname = re.sub(r'\?lib', 'lib', fname)
-
-    if fname.endswith('?so'):
-        if env.machines.host.is_windows() and canonical_compiler == 'msvc':
-            fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
-            fname = re.sub(r'/(?:lib|)([^/]*?)\?so$', r'/\1.dll', fname)
-            return fname
-        elif env.machines.host.is_windows():
-            fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
-            fname = re.sub(r'/([^/]*?)\?so$', r'/\1.dll', fname)
-            return fname
-        elif env.machines.host.is_cygwin():
-            fname = re.sub(r'lib/([^/]*)\?so$', r'bin/\1.dll', fname)
-            fname = re.sub(r'/lib([^/]*?)\?so$', r'/cyg\1.dll', fname)
-            fname = re.sub(r'/([^/]*?)\?so$', r'/\1.dll', fname)
-            return fname
-        elif env.machines.host.is_darwin():
-            return fname[:-3] + '.dylib'
-        else:
-            return fname[:-3] + '.so'
-
-    return fname
-
-def validate_install(test: TestDef, installdir: Path, compiler: str, env: environment.Environment) -> str:
-    ret_msg = ''
-    expected_raw = []  # type: T.List[Path]
-    for i in test.installed_files:
-        try:
-            expected_raw += i.get_paths(compiler, env, installdir)
-        except RuntimeError as err:
-            ret_msg += 'Expected path error: {}\n'.format(err)
-    expected = {x: False for x in expected_raw}
-    found = [x.relative_to(installdir) for x in installdir.rglob('*') if x.is_file() or x.is_symlink()]
-    # Mark all found files as found and detect unexpected files
-    for fname in found:
-        if fname not in expected:
-            ret_msg += 'Extra file {} found.\n'.format(fname)
-            continue
-        expected[fname] = True
-    # Check if expected files were found
-    for p, f in expected.items():
-        if not f:
-            ret_msg += 'Expected file {} missing.\n'.format(p)
-    # List dir content on error
-    if ret_msg != '':
-        ret_msg += '\nInstall dir contents:\n'
-        for i in found:
-            ret_msg += '  - {}\n'.format(i)
-    return ret_msg
-
-def log_text_file(logfile, testdir, stdo, stde):
-    global stop, executor, futures
-    logfile.write('%s\nstdout\n\n---\n' % testdir.as_posix())
-    logfile.write(stdo)
-    logfile.write('\n\n---\n\nstderr\n\n---\n')
-    logfile.write(stde)
-    logfile.write('\n\n---\n\n')
-    if print_debug:
-        try:
-            print(stdo)
-        except UnicodeError:
-            sanitized_out = stdo.encode('ascii', errors='replace').decode()
-            print(sanitized_out)
-        try:
-            print(stde, file=sys.stderr)
-        except UnicodeError:
-            sanitized_err = stde.encode('ascii', errors='replace').decode()
-            print(sanitized_err, file=sys.stderr)
-    if stop:
-        print("Aborting..")
-        for f in futures:
-            f[2].cancel()
-        executor.shutdown()
-        raise StopException()
-
-
-def bold(text):
-    return mlog.bold(text).get_text(mlog.colorize_console())
-
-
-def green(text):
-    return mlog.green(text).get_text(mlog.colorize_console())
-
-
-def red(text):
-    return mlog.red(text).get_text(mlog.colorize_console())
-
-
-def yellow(text):
-    return mlog.yellow(text).get_text(mlog.colorize_console())
-
-
-def _run_ci_include(args: T.List[str]) -> str:
-    if not args:
-        return 'At least one parameter required'
-    try:
-        file_path = Path(args[0])
-        data = file_path.open(errors='ignore', encoding='utf-8').read()
-        return 'Included file {}:\n{}\n'.format(args[0], data)
-    except Exception:
-        return 'Failed to open {} ({})'.format(args[0])
-
-ci_commands = {
-    'ci_include': _run_ci_include
-}
-
-def run_ci_commands(raw_log: str) -> T.List[str]:
-    res = []
-    for l in raw_log.splitlines():
-        if not l.startswith('!meson_ci!/'):
-            continue
-        cmd = shlex.split(l[11:])
-        if not cmd or cmd[0] not in ci_commands:
-            continue
-        res += ['CI COMMAND {}:\n{}\n'.format(cmd[0], ci_commands[cmd[0]](cmd[1:]))]
-    return res
-
-def _compare_output(expected: T.List[T.Dict[str, str]], output: str, desc: str) -> str:
-    if expected:
-        i = iter(expected)
-
-        def next_expected(i):
-            # Get the next expected line
-            item = next(i)
-            how = item.get('match', 'literal')
-            expected = item.get('line')
-
-            # Simple heuristic to automatically convert path separators for
-            # Windows:
-            #
-            # Any '/' appearing before 'WARNING' or 'ERROR' (i.e. a path in a
-            # filename part of a location) is replaced with '\' (in a re: '\\'
-            # which matches a literal '\')
-            #
-            # (There should probably be a way to turn this off for more complex
-            # cases which don't fit this)
-            if mesonlib.is_windows():
-                if how != "re":
-                    sub = r'\\'
-                else:
-                    sub = r'\\\\'
-                expected = re.sub(r'/(?=.*(WARNING|ERROR))', sub, expected)
-
-            return how, expected
-
-        try:
-            how, expected = next_expected(i)
-            for actual in output.splitlines():
-                if how == "re":
-                    match = bool(re.match(expected, actual))
-                else:
-                    match = (expected == actual)
-                if match:
-                    how, expected = next_expected(i)
-
-            # reached the end of output without finding expected
-            return 'expected "{}" not found in {}'.format(expected, desc)
-        except StopIteration:
-            # matched all expected lines
-            pass
-
-    return ''
-
-def validate_output(test: TestDef, stdo: str, stde: str) -> str:
-    return _compare_output(test.stdout, stdo, 'stdout')
-
-# There are some class variables and such that cahce
-# information. Clear all of these. The better solution
-# would be to change the code so that no state is persisted
-# but that would be a lot of work given that Meson was originally
-# coded to run as a batch process.
-def clear_internal_caches():
-    import mesonbuild.interpreterbase
-    from mesonbuild.dependencies import CMakeDependency
-    from mesonbuild.mesonlib import PerMachine
-    mesonbuild.interpreterbase.FeatureNew.feature_registry = {}
-    CMakeDependency.class_cmakeinfo = PerMachine(None, None)
-
-def run_test_inprocess(testdir):
-    old_stdout = sys.stdout
-    sys.stdout = mystdout = StringIO()
-    old_stderr = sys.stderr
-    sys.stderr = mystderr = StringIO()
-    old_cwd = os.getcwd()
-    os.chdir(testdir)
-    test_log_fname = Path('meson-logs', 'testlog.txt')
-    try:
-        returncode_test = mtest.run_with_args(['--no-rebuild'])
-        if test_log_fname.exists():
-            test_log = test_log_fname.open(errors='ignore').read()
-        else:
-            test_log = ''
-        returncode_benchmark = mtest.run_with_args(['--no-rebuild', '--benchmark', '--logbase', 'benchmarklog'])
-    finally:
-        sys.stdout = old_stdout
-        sys.stderr = old_stderr
-        os.chdir(old_cwd)
-    return max(returncode_test, returncode_benchmark), mystdout.getvalue(), mystderr.getvalue(), test_log
-
-# Build directory name must be the same so Ccache works over
-# consecutive invocations.
-def create_deterministic_builddir(test: TestDef, use_tmpdir: bool) -> str:
-    import hashlib
-    src_dir = test.path.as_posix()
-    if test.name:
-        src_dir += test.name
-    rel_dirname = 'b ' + hashlib.sha256(src_dir.encode(errors='ignore')).hexdigest()[0:10]
-    abs_pathname = os.path.join(tempfile.gettempdir() if use_tmpdir else os.getcwd(), rel_dirname)
-    os.mkdir(abs_pathname)
-    return abs_pathname
-
-def run_test(test: TestDef, extra_args, compiler, backend, flags, commands, should_fail, use_tmp: bool):
-    if test.skip:
-        return None
-    with AutoDeletedDir(create_deterministic_builddir(test, use_tmp)) as build_dir:
-        with AutoDeletedDir(tempfile.mkdtemp(prefix='i ', dir=None if use_tmp else os.getcwd())) as install_dir:
-            try:
-                return _run_test(test, build_dir, install_dir, extra_args, compiler, backend, flags, commands, should_fail)
-            except TestResult as r:
-                return r
-            finally:
-                mlog.shutdown() # Close the log file because otherwise Windows wets itself.
-
-def _run_test(test: TestDef, test_build_dir: str, install_dir: str, extra_args, compiler, backend, flags, commands, should_fail):
-    compile_commands, clean_commands, install_commands, uninstall_commands = commands
-    gen_start = time.time()
-    # Configure in-process
-    gen_args = []  # type: T.List[str]
-    if 'prefix' not in test.do_not_set_opts:
-        gen_args += ['--prefix', 'x:/usr'] if mesonlib.is_windows() else ['--prefix', '/usr']
-    if 'libdir' not in test.do_not_set_opts:
-        gen_args += ['--libdir', 'lib']
-    gen_args += [test.path.as_posix(), test_build_dir] + flags + extra_args
-    nativefile = test.path / 'nativefile.ini'
-    crossfile = test.path / 'crossfile.ini'
-    if nativefile.exists():
-        gen_args.extend(['--native-file', nativefile.as_posix()])
-    if crossfile.exists():
-        gen_args.extend(['--cross-file', crossfile.as_posix()])
-    (returncode, stdo, stde) = run_configure(gen_args, env=test.env)
-    try:
-        logfile = Path(test_build_dir, 'meson-logs', 'meson-log.txt')
-        mesonlog = logfile.open(errors='ignore', encoding='utf-8').read()
-    except Exception:
-        mesonlog = no_meson_log_msg
-    cicmds = run_ci_commands(mesonlog)
-    testresult = TestResult(cicmds)
-    testresult.add_step(BuildStep.configure, stdo, stde, mesonlog, time.time() - gen_start)
-    output_msg = validate_output(test, stdo, stde)
-    testresult.mlog += output_msg
-    if output_msg:
-        testresult.fail('Unexpected output while configuring.')
-        return testresult
-    if should_fail == 'meson':
-        if returncode == 1:
-            return testresult
-        elif returncode != 0:
-            testresult.fail('Test exited with unexpected status {}.'.format(returncode))
-            return testresult
-        else:
-            testresult.fail('Test that should have failed succeeded.')
-            return testresult
-    if returncode != 0:
-        testresult.fail('Generating the build system failed.')
-        return testresult
-    builddata = build.load(test_build_dir)
-    dir_args = get_backend_args_for_dir(backend, test_build_dir)
-
-    # Build with subprocess
-    def build_step():
-        build_start = time.time()
-        pc, o, e = Popen_safe(compile_commands + dir_args, cwd=test_build_dir)
-        testresult.add_step(BuildStep.build, o, e, '', time.time() - build_start)
-        if should_fail == 'build':
-            if pc.returncode != 0:
-                raise testresult
-            testresult.fail('Test that should have failed to build succeeded.')
-            raise testresult
-        if pc.returncode != 0:
-            testresult.fail('Compiling source code failed.')
-            raise testresult
-
-    # Touch the meson.build file to force a regenerate
-    def force_regenerate():
-        ensure_backend_detects_changes(backend)
-        os.utime(str(test.path / 'meson.build'))
-
-    # just test building
-    build_step()
-
-    # test that regeneration works for build step
-    force_regenerate()
-    build_step()  # TBD: assert nothing gets built after the regenerate?
-
-    # test that regeneration works for test step
-    force_regenerate()
-
-    # Test in-process
-    clear_internal_caches()
-    test_start = time.time()
-    (returncode, tstdo, tstde, test_log) = run_test_inprocess(test_build_dir)
-    testresult.add_step(BuildStep.test, tstdo, tstde, test_log, time.time() - test_start)
-    if should_fail == 'test':
-        if returncode != 0:
-            return testresult
-        testresult.fail('Test that should have failed to run unit tests succeeded.')
-        return testresult
-    if returncode != 0:
-        testresult.fail('Running unit tests failed.')
-        return testresult
-
-    # Do installation, if the backend supports it
-    if install_commands:
-        env = os.environ.copy()
-        env['DESTDIR'] = install_dir
-        # Install with subprocess
-        pi, o, e = Popen_safe(install_commands, cwd=test_build_dir, env=env)
-        testresult.add_step(BuildStep.install, o, e)
-        if pi.returncode != 0:
-            testresult.fail('Running install failed.')
-            return testresult
-
-    # Clean with subprocess
-    env = os.environ.copy()
-    pi, o, e = Popen_safe(clean_commands + dir_args, cwd=test_build_dir, env=env)
-    testresult.add_step(BuildStep.clean, o, e)
-    if pi.returncode != 0:
-        testresult.fail('Running clean failed.')
-        return testresult
-
-    # Validate installed files
-    testresult.add_step(BuildStep.install, '', '')
-    if not install_commands:
-        return testresult
-    install_msg = validate_install(test, Path(install_dir), compiler, builddata.environment)
-    if install_msg:
-        testresult.fail('\n' + install_msg)
-        return testresult
-
-    return testresult
-
-def gather_tests(testdir: Path, stdout_mandatory: bool) -> T.List[TestDef]:
-    tests = [t.name for t in testdir.iterdir() if t.is_dir()]
-    tests = [t for t in tests if not t.startswith('.')]  # Filter non-tests files (dot files, etc)
-    test_defs = [TestDef(testdir / t, None, []) for t in tests]
-    all_tests = []  # type: T.List[TestDef]
-    for t in test_defs:
-        test_def = {}
-        test_def_file = t.path / 'test.json'
-        if test_def_file.is_file():
-            test_def = json.loads(test_def_file.read_text())
-
-        # Handle additional environment variables
-        env = {}  # type: T.Dict[str, str]
-        if 'env' in test_def:
-            assert isinstance(test_def['env'], dict)
-            env = test_def['env']
-            for key, val in env.items():
-                val = val.replace('@ROOT@', t.path.resolve().as_posix())
-                env[key] = val
-
-        # Handle installed files
-        installed = []  # type: T.List[InstalledFile]
-        if 'installed' in test_def:
-            installed = [InstalledFile(x) for x in test_def['installed']]
-
-        # Handle expected output
-        stdout = test_def.get('stdout', [])
-        if stdout_mandatory and not stdout:
-            raise RuntimeError("{} must contain a non-empty stdout key".format(test_def_file))
-
-        # Handle the do_not_set_opts list
-        do_not_set_opts = test_def.get('do_not_set_opts', [])  # type: T.List[str]
-
-        # Skip tests if the tool requirements are not met
-        if 'tools' in test_def:
-            assert isinstance(test_def['tools'], dict)
-            for tool, vers_req in test_def['tools'].items():
-                if tool not in tool_vers_map:
-                    t.skip = True
-                elif not mesonlib.version_compare(tool_vers_map[tool], vers_req):
-                    t.skip = True
-
-        # Skip the matrix code and just update the existing test
-        if 'matrix' not in test_def:
-            t.env.update(env)
-            t.installed_files = installed
-            t.do_not_set_opts = do_not_set_opts
-            t.stdout = stdout
-            all_tests += [t]
-            continue
-
-        # 'matrix; entry is present, so build multiple tests from matrix definition
-        opt_list = []  # type: T.List[T.List[T.Tuple[str, bool]]]
-        matrix = test_def['matrix']
-        assert "options" in matrix
-        for key, val in matrix["options"].items():
-            assert isinstance(val, list)
-            tmp_opts = []  # type: T.List[T.Tuple[str, bool]]
-            for i in val:
-                assert isinstance(i, dict)
-                assert "val" in i
-                skip = False
-
-                # Skip the matrix entry if environment variable is present
-                if 'skip_on_env' in i:
-                    for skip_env_var in i['skip_on_env']:
-                        if skip_env_var in os.environ:
-                            skip = True
-
-                # Only run the test if all compiler ID's match
-                if 'compilers' in i:
-                    for lang, id_list in i['compilers'].items():
-                        if lang not in compiler_id_map or compiler_id_map[lang] not in id_list:
-                            skip = True
-                            break
-
-                # Add an empty matrix entry
-                if i['val'] is None:
-                    tmp_opts += [(None, skip)]
-                    continue
-
-                tmp_opts += [('{}={}'.format(key, i['val']), skip)]
-
-            if opt_list:
-                new_opt_list = []  # type: T.List[T.List[T.Tuple[str, bool]]]
-                for i in opt_list:
-                    for j in tmp_opts:
-                        new_opt_list += [[*i, j]]
-                opt_list = new_opt_list
-            else:
-                opt_list = [[x] for x in tmp_opts]
-
-        # Exclude specific configurations
-        if 'exclude' in matrix:
-            assert isinstance(matrix['exclude'], list)
-            new_opt_list = []  # type: T.List[T.List[T.Tuple[str, bool]]]
-            for i in opt_list:
-                exclude = False
-                opt_names = [x[0] for x in i]
-                for j in matrix['exclude']:
-                    ex_list = ['{}={}'.format(k, v) for k, v in j.items()]
-                    if all([x in opt_names for x in ex_list]):
-                        exclude = True
-                        break
-
-                if not exclude:
-                    new_opt_list += [i]
-
-            opt_list = new_opt_list
-
-        for i in opt_list:
-            name = ' '.join([x[0] for x in i if x[0] is not None])
-            opts = ['-D' + x[0] for x in i if x[0] is not None]
-            skip = any([x[1] for x in i])
-            test = TestDef(t.path, name, opts, skip or t.skip)
-            test.env.update(env)
-            test.installed_files = installed
-            test.do_not_set_opts = do_not_set_opts
-            test.stdout = stdout
-            all_tests += [test]
-
-    return sorted(all_tests)
-
-def have_d_compiler():
-    if shutil.which("ldc2"):
-        return True
-    elif shutil.which("ldc"):
-        return True
-    elif shutil.which("gdc"):
-        return True
-    elif shutil.which("dmd"):
-        # The Windows installer sometimes produces a DMD install
-        # that exists but segfaults every time the compiler is run.
-        # Don't know why. Don't know how to fix. Skip in this case.
-        cp = subprocess.run(['dmd', '--version'],
-                            stdout=subprocess.PIPE,
-                            stderr=subprocess.PIPE)
-        if cp.stdout == b'':
-            return False
-        return True
-    return False
-
-def have_objc_compiler(use_tmp: bool) -> bool:
-    with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir=None if use_tmp else '.')) as build_dir:
-        env = environment.Environment(None, build_dir, get_fake_options('/'))
-        try:
-            objc_comp = env.detect_objc_compiler(MachineChoice.HOST)
-        except mesonlib.MesonException:
-            return False
-        if not objc_comp:
-            return False
-        env.coredata.process_new_compiler('objc', objc_comp, env)
-        try:
-            objc_comp.sanity_check(env.get_scratch_dir(), env)
-        except mesonlib.MesonException:
-            return False
-    return True
-
-def have_objcpp_compiler(use_tmp: bool) -> bool:
-    with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir=None if use_tmp else '.')) as build_dir:
-        env = environment.Environment(None, build_dir, get_fake_options('/'))
-        try:
-            objcpp_comp = env.detect_objcpp_compiler(MachineChoice.HOST)
-        except mesonlib.MesonException:
-            return False
-        if not objcpp_comp:
-            return False
-        env.coredata.process_new_compiler('objcpp', objcpp_comp, env)
-        try:
-            objcpp_comp.sanity_check(env.get_scratch_dir(), env)
-        except mesonlib.MesonException:
-            return False
-    return True
-
-def have_java():
-    if shutil.which('javac') and shutil.which('java'):
-        return True
-    return False
-
-def skippable(suite, test):
-    # Everything is optional when not running on CI, or on Ubuntu 16.04 CI
-    if not under_ci or under_xenial_ci:
-        return True
-
-    if not suite.endswith('frameworks'):
-        return True
-
-    # this test assumptions aren't valid for Windows paths
-    if test.endswith('38 libdir must be inside prefix'):
-        return True
-
-    # gtk-doc test may be skipped, pending upstream fixes for spaces in
-    # filenames landing in the distro used for CI
-    if test.endswith('10 gtk-doc'):
-        return True
-
-    # NetCDF is not in the CI Docker image
-    if test.endswith('netcdf'):
-        return True
-
-    # MSVC doesn't link with GFortran
-    if test.endswith('14 fortran links c'):
-        return True
-
-    # Blocks are not supported on all compilers
-    if test.endswith('29 blocks'):
-        return True
-
-    # Scientific libraries are skippable on certain systems
-    # See the discussion here: https://github.com/mesonbuild/meson/pull/6562
-    if any([x in test for x in ['17 mpi', '25 hdf5', '30 scalapack']]) and skip_scientific:
-        return True
-
-    # These create OS specific tests, and need to be skippable
-    if any([x in test for x in ['16 sdl', '17 mpi']]):
-        return True
-
-    # No frameworks test should be skipped on linux CI, as we expect all
-    # prerequisites to be installed
-    if mesonlib.is_linux():
-        return False
-
-    # Boost test should only be skipped for windows CI build matrix entries
-    # which don't define BOOST_ROOT
-    if test.endswith('1 boost'):
-        if mesonlib.is_windows():
-            return 'BOOST_ROOT' not in os.environ
-        return False
-
-    # Qt is provided on macOS by Homebrew
-    if test.endswith('4 qt') and mesonlib.is_osx():
-        return False
-
-    # Other framework tests are allowed to be skipped on other platforms
-    return True
-
-def skip_csharp(backend) -> bool:
-    if backend is not Backend.ninja:
-        return True
-    if not shutil.which('resgen'):
-        return True
-    if shutil.which('mcs'):
-        return False
-    if shutil.which('csc'):
-        # Only support VS2017 for now. Earlier versions fail
-        # under CI in mysterious ways.
-        try:
-            stdo = subprocess.check_output(['csc', '/version'])
-        except subprocess.CalledProcessError:
-            return True
-        # Having incrementing version numbers would be too easy.
-        # Microsoft reset the versioning back to 1.0 (from 4.x)
-        # when they got the Roslyn based compiler. Thus there
-        # is NO WAY to reliably do version number comparisons.
-        # Only support the version that ships with VS2017.
-        return not stdo.startswith(b'2.')
-    return True
-
-# In Azure some setups have a broken rustc that will error out
-# on all compilation attempts.
-
-def has_broken_rustc() -> bool:
-    dirname = 'brokenrusttest'
-    if os.path.exists(dirname):
-        mesonlib.windows_proof_rmtree(dirname)
-    os.mkdir(dirname)
-    open(dirname + '/sanity.rs', 'w').write('''fn main() {
-}
-''')
-    pc = subprocess.run(['rustc', '-o', 'sanity.exe', 'sanity.rs'],
-                        cwd=dirname,
-                        stdout = subprocess.DEVNULL,
-                        stderr = subprocess.DEVNULL)
-    mesonlib.windows_proof_rmtree(dirname)
-    return pc.returncode != 0
-
-def should_skip_rust(backend: Backend) -> bool:
-    if not shutil.which('rustc'):
-        return True
-    if backend is not Backend.ninja:
-        return True
-    if mesonlib.is_windows() and has_broken_rustc():
-        return True
-    return False
-
-def detect_tests_to_run(only: T.List[str], use_tmp: bool) -> T.List[T.Tuple[str, T.List[TestDef], bool]]:
-    """
-    Parameters
-    ----------
-    only: list of str, optional
-        specify names of tests to run
-
-    Returns
-    -------
-    gathered_tests: list of tuple of str, list of TestDef, bool
-        tests to run
-    """
-
-    skip_fortran = not(shutil.which('gfortran') or
-                       shutil.which('flang') or
-                       shutil.which('pgfortran') or
-                       shutil.which('ifort'))
-
-    class TestCategory:
-        def __init__(self, category: str, subdir: str, skip: bool = False, stdout_mandatory: bool = False):
-            self.category = category                  # category name
-            self.subdir = subdir                      # subdirectory
-            self.skip = skip                          # skip condition
-            self.stdout_mandatory = stdout_mandatory  # expected stdout is mandatory for tests in this categroy
-
-    all_tests = [
-        TestCategory('cmake', 'cmake', not shutil.which('cmake') or (os.environ.get('compiler') == 'msvc2015' and under_ci)),
-        TestCategory('common', 'common'),
-        TestCategory('warning-meson', 'warning', stdout_mandatory=True),
-        TestCategory('failing-meson', 'failing', stdout_mandatory=True),
-        TestCategory('failing-build', 'failing build'),
-        TestCategory('failing-test',  'failing test'),
-        TestCategory('keyval', 'keyval'),
-        TestCategory('platform-osx', 'osx', not mesonlib.is_osx()),
-        TestCategory('platform-windows', 'windows', not mesonlib.is_windows() and not mesonlib.is_cygwin()),
-        TestCategory('platform-linux', 'linuxlike', mesonlib.is_osx() or mesonlib.is_windows()),
-        TestCategory('java', 'java', backend is not Backend.ninja or mesonlib.is_osx() or not have_java()),
-        TestCategory('C#', 'csharp', skip_csharp(backend)),
-        TestCategory('vala', 'vala', backend is not Backend.ninja or not shutil.which(os.environ.get('VALAC', 'valac'))),
-        TestCategory('rust', 'rust', should_skip_rust(backend)),
-        TestCategory('d', 'd', backend is not Backend.ninja or not have_d_compiler()),
-        TestCategory('objective c', 'objc', backend not in (Backend.ninja, Backend.xcode) or not have_objc_compiler(options.use_tmpdir)),
-        TestCategory('objective c++', 'objcpp', backend not in (Backend.ninja, Backend.xcode) or not have_objcpp_compiler(options.use_tmpdir)),
-        TestCategory('fortran', 'fortran', skip_fortran or backend != Backend.ninja),
-        TestCategory('swift', 'swift', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('swiftc')),
-        # CUDA tests on Windows: use Ninja backend:  python run_project_tests.py --only cuda --backend ninja
-        TestCategory('cuda', 'cuda', backend not in (Backend.ninja, Backend.xcode) or not shutil.which('nvcc')),
-        TestCategory('python3', 'python3', backend is not Backend.ninja),
-        TestCategory('python', 'python', backend is not Backend.ninja),
-        TestCategory('fpga', 'fpga', shutil.which('yosys') is None),
-        TestCategory('frameworks', 'frameworks'),
-        TestCategory('nasm', 'nasm'),
-        TestCategory('wasm', 'wasm', shutil.which('emcc') is None or backend is not Backend.ninja),
-    ]
-
-    categories = [t.category for t in all_tests]
-    assert categories == ALL_TESTS, 'argparse("--only", choices=ALL_TESTS) need to be updated to match all_tests categories'
-
-    if only:
-        all_tests = [t for t in all_tests if t.category in only]
-
-    gathered_tests = [(t.category, gather_tests(Path('test cases', t.subdir), t.stdout_mandatory), t.skip) for t in all_tests]
-    return gathered_tests
-
-def run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
-              log_name_base: str, failfast: bool,
-              extra_args: T.List[str], use_tmp: bool) -> T.Tuple[int, int, int]:
-    global logfile
-    txtname = log_name_base + '.txt'
-    with open(txtname, 'w', encoding='utf-8', errors='ignore') as lf:
-        logfile = lf
-        return _run_tests(all_tests, log_name_base, failfast, extra_args, use_tmp)
-
-def _run_tests(all_tests: T.List[T.Tuple[str, T.List[TestDef], bool]],
-               log_name_base: str, failfast: bool,
-               extra_args: T.List[str], use_tmp: bool) -> T.Tuple[int, int, int]:
-    global stop, executor, futures, system_compiler
-    xmlname = log_name_base + '.xml'
-    junit_root = ET.Element('testsuites')
-    conf_time = 0
-    build_time = 0
-    test_time = 0
-    passing_tests = 0
-    failing_tests = 0
-    skipped_tests = 0
-    commands = (compile_commands, clean_commands, install_commands, uninstall_commands)
-
-    try:
-        # This fails in some CI environments for unknown reasons.
-        num_workers = multiprocessing.cpu_count()
-    except Exception as e:
-        print('Could not determine number of CPUs due to the following reason:' + str(e))
-        print('Defaulting to using only one process')
-        num_workers = 1
-    # Due to Ninja deficiency, almost 50% of build time
-    # is spent waiting. Do something useful instead.
-    #
-    # Remove this once the following issue has been resolved:
-    # https://github.com/mesonbuild/meson/pull/2082
-    if not mesonlib.is_windows():  # twice as fast on Windows by *not* multiplying by 2.
-        num_workers *= 2
-    executor = ProcessPoolExecutor(max_workers=num_workers)
-
-    for name, test_cases, skipped in all_tests:
-        current_suite = ET.SubElement(junit_root, 'testsuite', {'name': name, 'tests': str(len(test_cases))})
-        print()
-        if skipped:
-            print(bold('Not running %s tests.' % name))
-        else:
-            print(bold('Running %s tests.' % name))
-        print()
-        futures = []
-        for t in test_cases:
-            # Jenkins screws us over by automatically sorting test cases by name
-            # and getting it wrong by not doing logical number sorting.
-            (testnum, testbase) = t.path.name.split(' ', 1)
-            testname = '%.3d %s' % (int(testnum), testbase)
-            if t.name:
-                testname += ' ({})'.format(t.name)
-            should_fail = False
-            suite_args = []
-            if name.startswith('failing'):
-                should_fail = name.split('failing-')[1]
-            if name.startswith('warning'):
-                suite_args = ['--fatal-meson-warnings']
-                should_fail = name.split('warning-')[1]
-
-            t.skip = skipped or t.skip
-            result = executor.submit(run_test, t, extra_args + suite_args + t.args,
-                                     system_compiler, backend, backend_flags, commands, should_fail, use_tmp)
-            futures.append((testname, t, result))
-        for (testname, t, result) in futures:
-            sys.stdout.flush()
-            try:
-                result = result.result()
-            except CancelledError:
-                continue
-            if (result is None) or (('MESON_SKIP_TEST' in result.stdo) and (skippable(name, t.path.as_posix()))):
-                print(yellow('Skipping:'), t.display_name())
-                current_test = ET.SubElement(current_suite, 'testcase', {'name': testname,
-                                                                         'classname': name})
-                ET.SubElement(current_test, 'skipped', {})
-                skipped_tests += 1
-            else:
-                without_install = "" if len(install_commands) > 0 else " (without install)"
-                if result.msg != '':
-                    print(red('Failed test{} during {}: {!r}'.format(without_install, result.step.name, t.display_name())))
-                    print('Reason:', result.msg)
-                    failing_tests += 1
-                    if result.step == BuildStep.configure and result.mlog != no_meson_log_msg:
-                        # For configure failures, instead of printing stdout,
-                        # print the meson log if available since it's a superset
-                        # of stdout and often has very useful information.
-                        failing_logs.append(result.mlog)
-                    elif under_ci:
-                        # Always print the complete meson log when running in
-                        # a CI. This helps debugging issues that only occur in
-                        # a hard to reproduce environment
-                        failing_logs.append(result.mlog)
-                        failing_logs.append(result.stdo)
-                    else:
-                        failing_logs.append(result.stdo)
-                    for cmd_res in result.cicmds:
-                        failing_logs.append(cmd_res)
-                    failing_logs.append(result.stde)
-                    if failfast:
-                        print("Cancelling the rest of the tests")
-                        for (_, _, res) in futures:
-                            res.cancel()
-                else:
-                    print('Succeeded test%s: %s' % (without_install, t.display_name()))
-                    passing_tests += 1
-                conf_time += result.conftime
-                build_time += result.buildtime
-                test_time += result.testtime
-                total_time = conf_time + build_time + test_time
-                log_text_file(logfile, t.path, result.stdo, result.stde)
-                current_test = ET.SubElement(current_suite, 'testcase', {'name': testname,
-                                                                         'classname': name,
-                                                                         'time': '%.3f' % total_time})
-                if result.msg != '':
-                    ET.SubElement(current_test, 'failure', {'message': result.msg})
-                stdoel = ET.SubElement(current_test, 'system-out')
-                stdoel.text = result.stdo
-                stdeel = ET.SubElement(current_test, 'system-err')
-                stdeel.text = result.stde
-
-            if failfast and failing_tests > 0:
-                break
-
-    print("\nTotal configuration time: %.2fs" % conf_time)
-    print("Total build time: %.2fs" % build_time)
-    print("Total test time: %.2fs" % test_time)
-    ET.ElementTree(element=junit_root).write(xmlname, xml_declaration=True, encoding='UTF-8')
-    return passing_tests, failing_tests, skipped_tests
-
-def check_file(file: Path):
-    lines = file.read_bytes().split(b'\n')
-    tabdetector = re.compile(br' *\t')
-    for i, line in enumerate(lines):
-        if re.match(tabdetector, line):
-            raise SystemExit("File {} contains a tab indent on line {:d}. Only spaces are permitted.".format(file, i + 1))
-        if line.endswith(b'\r'):
-            raise SystemExit("File {} contains DOS line ending on line {:d}. Only unix-style line endings are permitted.".format(file, i + 1))
-
-def check_format():
-    check_suffixes = {'.c',
-                      '.cpp',
-                      '.cxx',
-                      '.cc',
-                      '.rs',
-                      '.f90',
-                      '.vala',
-                      '.d',
-                      '.s',
-                      '.m',
-                      '.mm',
-                      '.asm',
-                      '.java',
-                      '.txt',
-                      '.py',
-                      '.swift',
-                      '.build',
-                      '.md',
-                      }
-    skip_dirs = {
-        '.dub',                         # external deps are here
-        '.pytest_cache',
-        'meson-logs', 'meson-private',
-        '.eggs', '_cache',              # e.g. .mypy_cache
-        'venv',                         # virtualenvs have DOS line endings
-    }
-    for (root, _, filenames) in os.walk('.'):
-        if any([x in root for x in skip_dirs]):
-            continue
-        for fname in filenames:
-            file = Path(fname)
-            if file.suffix.lower() in check_suffixes:
-                if file.name in ('sitemap.txt', 'meson-test-run.txt'):
-                    continue
-                check_file(root / file)
-
-def check_meson_commands_work(options):
-    global backend, compile_commands, test_commands, install_commands
-    testdir = PurePath('test cases', 'common', '1 trivial').as_posix()
-    meson_commands = mesonlib.python_command + [get_meson_script()]
-    with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir=None if options.use_tmpdir else '.')) as build_dir:
-        print('Checking that configuring works...')
-        gen_cmd = meson_commands + [testdir, build_dir] + backend_flags + options.extra_args
-        pc, o, e = Popen_safe(gen_cmd)
-        if pc.returncode != 0:
-            raise RuntimeError('Failed to configure {!r}:\n{}\n{}'.format(testdir, e, o))
-        print('Checking that building works...')
-        dir_args = get_backend_args_for_dir(backend, build_dir)
-        pc, o, e = Popen_safe(compile_commands + dir_args, cwd=build_dir)
-        if pc.returncode != 0:
-            raise RuntimeError('Failed to build {!r}:\n{}\n{}'.format(testdir, e, o))
-        print('Checking that testing works...')
-        pc, o, e = Popen_safe(test_commands, cwd=build_dir)
-        if pc.returncode != 0:
-            raise RuntimeError('Failed to test {!r}:\n{}\n{}'.format(testdir, e, o))
-        if install_commands:
-            print('Checking that installing works...')
-            pc, o, e = Popen_safe(install_commands, cwd=build_dir)
-            if pc.returncode != 0:
-                raise RuntimeError('Failed to install {!r}:\n{}\n{}'.format(testdir, e, o))
-
-
-def detect_system_compiler(options):
-    global system_compiler, compiler_id_map
-
-    with AutoDeletedDir(tempfile.mkdtemp(prefix='b ', dir=None if options.use_tmpdir else '.')) as build_dir:
-        fake_opts = get_fake_options('/')
-        if options.cross_file:
-            fake_opts.cross_file = [options.cross_file]
-        env = environment.Environment(None, build_dir, fake_opts)
-        print()
-        for lang in sorted(compilers.all_languages):
-            try:
-                comp = env.compiler_from_language(lang, MachineChoice.HOST)
-                details = '{:<10} {} {}'.format('[' + comp.get_id() + ']', ' '.join(comp.get_exelist()), comp.get_version_string())
-                compiler_id_map[lang] = comp.get_id()
-            except mesonlib.MesonException:
-                comp = None
-                details = '[not found]'
-            print('%-7s: %s' % (lang, details))
-
-            # note C compiler for later use by platform_fix_name()
-            if lang == 'c':
-                if comp:
-                    system_compiler = comp.get_id()
-                else:
-                    raise RuntimeError("Could not find C compiler.")
-        print()
-
-def print_tool_versions():
-    tools = [
-        {
-            'tool': 'ninja',
-            'args': ['--version'],
-            'regex': re.compile(r'^([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
-            'match_group': 1,
-        },
-        {
-            'tool': 'cmake',
-            'args': ['--version'],
-            'regex': re.compile(r'^cmake version ([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
-            'match_group': 1,
-        },
-        {
-            'tool': 'hotdoc',
-            'args': ['--version'],
-            'regex': re.compile(r'^([0-9]+(\.[0-9]+)*(-[a-z0-9]+)?)$'),
-            'match_group': 1,
-        },
-    ]
-
-    def get_version(t: dict) -> str:
-        exe = shutil.which(t['tool'])
-        if not exe:
-            return 'not found'
-
-        args = [t['tool']] + t['args']
-        pc, o, e = Popen_safe(args)
-        if pc.returncode != 0:
-            return '{} (invalid {} executable)'.format(exe, t['tool'])
-        for i in o.split('\n'):
-            i = i.strip('\n\r\t ')
-            m = t['regex'].match(i)
-            if m is not None:
-                tool_vers_map[t['tool']] = m.group(t['match_group'])
-                return '{} ({})'.format(exe, m.group(t['match_group']))
-
-        return '{} (unknown)'.format(exe)
-
-    max_width = max([len(x['tool']) for x in tools] + [7])
-    for tool in tools:
-        print('{0:<{2}}: {1}'.format(tool['tool'], get_version(tool), max_width))
-    print()
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description="Run the test suite of Meson.")
-    parser.add_argument('extra_args', nargs='*',
-                        help='arguments that are passed directly to Meson (remember to have -- before these).')
-    parser.add_argument('--backend', dest='backend', choices=backendlist)
-    parser.add_argument('--failfast', action='store_true',
-                        help='Stop running if test case fails')
-    parser.add_argument('--no-unittests', action='store_true',
-                        help='Not used, only here to simplify run_tests.py')
-    parser.add_argument('--only', help='name of test(s) to run', nargs='+', choices=ALL_TESTS)
-    parser.add_argument('--cross-file', action='store', help='File describing cross compilation environment.')
-    parser.add_argument('--use-tmpdir', action='store_true', help='Use tmp directory for temporary files.')
-    options = parser.parse_args()
-    if options.cross_file:
-        options.extra_args += ['--cross-file', options.cross_file]
-
-    print('Meson build system', meson_version, 'Project Tests')
-    print('Using python', sys.version.split('\n')[0])
-    setup_commands(options.backend)
-    detect_system_compiler(options)
-    print_tool_versions()
-    script_dir = os.path.split(__file__)[0]
-    if script_dir != '':
-        os.chdir(script_dir)
-    check_format()
-    check_meson_commands_work(options)
-    try:
-        all_tests = detect_tests_to_run(options.only, options.use_tmpdir)
-        (passing_tests, failing_tests, skipped_tests) = run_tests(all_tests, 'meson-test-run', options.failfast, options.extra_args, options.use_tmpdir)
-    except StopException:
-        pass
-    print('\nTotal passed tests:', green(str(passing_tests)))
-    print('Total failed tests:', red(str(failing_tests)))
-    print('Total skipped tests:', yellow(str(skipped_tests)))
-    if failing_tests > 0:
-        print('\nMesonlogs of failing tests\n')
-        for l in failing_logs:
-            try:
-                print(l, '\n')
-            except UnicodeError:
-                print(l.encode('ascii', errors='replace').decode(), '\n')
-    for name, dirs, _ in all_tests:
-        dir_names = list(set(x.path.name for x in dirs))
-        for k, g in itertools.groupby(dir_names, key=lambda x: x.split()[0]):
-            tests = list(g)
-            if len(tests) != 1:
-                print('WARNING: The %s suite contains duplicate "%s" tests: "%s"' % (name, k, '", "'.join(tests)))
-    raise SystemExit(failing_tests)
diff --git a/meson/run_tests.py b/meson/run_tests.py
deleted file mode 100755 (executable)
index 08ad78a..0000000
+++ /dev/null
@@ -1,405 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2012-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import os
-import sys
-import time
-import shutil
-import subprocess
-import tempfile
-import platform
-import argparse
-from io import StringIO
-from enum import Enum
-from glob import glob
-from pathlib import Path
-from mesonbuild import compilers
-from mesonbuild import dependencies
-from mesonbuild import mesonlib
-from mesonbuild import mesonmain
-from mesonbuild import mtest
-from mesonbuild import mlog
-from mesonbuild.environment import Environment, detect_ninja
-from mesonbuild.coredata import backendlist, version as meson_version
-
-NINJA_1_9_OR_NEWER = False
-NINJA_CMD = None
-# If we're on CI, just assume we have ninja in PATH and it's new enough because
-# we provide that. This avoids having to detect ninja for every subprocess unit
-# test that we run.
-if 'CI' in os.environ:
-    NINJA_1_9_OR_NEWER = True
-    NINJA_CMD = ['ninja']
-else:
-    # Look for 1.9 to see if https://github.com/ninja-build/ninja/issues/1219
-    # is fixed
-    NINJA_CMD = detect_ninja('1.9')
-    if NINJA_CMD is not None:
-        NINJA_1_9_OR_NEWER = True
-    else:
-        mlog.warning('Found ninja <1.9, tests will run slower', once=True)
-        NINJA_CMD = detect_ninja()
-if NINJA_CMD is None:
-    raise RuntimeError('Could not find Ninja v1.7 or newer')
-
-def guess_backend(backend, msbuild_exe: str):
-    # Auto-detect backend if unspecified
-    backend_flags = []
-    if backend is None:
-        if msbuild_exe is not None and (mesonlib.is_windows() and not _using_intelcl()):
-            backend = 'vs' # Meson will auto-detect VS version to use
-        else:
-            backend = 'ninja'
-    # Set backend arguments for Meson
-    if backend.startswith('vs'):
-        backend_flags = ['--backend=' + backend]
-        backend = Backend.vs
-    elif backend == 'xcode':
-        backend_flags = ['--backend=xcode']
-        backend = Backend.xcode
-    elif backend == 'ninja':
-        backend_flags = ['--backend=ninja']
-        backend = Backend.ninja
-    else:
-        raise RuntimeError('Unknown backend: {!r}'.format(backend))
-    return (backend, backend_flags)
-
-
-def _using_intelcl() -> bool:
-    """
-    detect if intending to using Intel-Cl compilers (Intel compilers on Windows)
-    Sufficient evidence of intent is that user is working in the Intel compiler
-    shell environment, otherwise this function returns False
-    """
-    if not mesonlib.is_windows():
-        return False
-    # handle where user tried to "blank" MKLROOT and left space(s)
-    if not os.environ.get('MKLROOT', '').strip():
-        return False
-    if (os.environ.get('CC') == 'icl' or
-            os.environ.get('CXX') == 'icl' or
-            os.environ.get('FC') == 'ifort'):
-        return True
-    # Intel-Cl users might not have the CC,CXX,FC envvars set,
-    # but because they're in Intel shell, the exe's below are on PATH
-    if shutil.which('icl') or shutil.which('ifort'):
-        return True
-    mlog.warning('It appears you might be intending to use Intel compiler on Windows '
-                 'since non-empty environment variable MKLROOT is set to {} '
-                 'However, Meson cannot find the Intel WIndows compiler executables (icl,ifort).'
-                 'Please try using the Intel shell.'.format(os.environ.get('MKLROOT')))
-    return False
-
-
-# Fake classes and objects for mocking
-class FakeBuild:
-    def __init__(self, env):
-        self.environment = env
-
-class FakeCompilerOptions:
-    def __init__(self):
-        self.value = []
-
-def get_fake_options(prefix=''):
-    opts = argparse.Namespace()
-    opts.native_file = []
-    opts.cross_file = None
-    opts.wrap_mode = None
-    opts.prefix = prefix
-    opts.cmd_line_options = {}
-    return opts
-
-def get_fake_env(sdir='', bdir=None, prefix='', opts=None):
-    if opts is None:
-        opts = get_fake_options(prefix)
-    env = Environment(sdir, bdir, opts)
-    env.coredata.compiler_options.host['c']['args'] = FakeCompilerOptions()
-    env.machines.host.cpu_family = 'x86_64' # Used on macOS inside find_library
-    return env
-
-
-Backend = Enum('Backend', 'ninja vs xcode')
-
-if 'MESON_EXE' in os.environ:
-    meson_exe = mesonlib.split_args(os.environ['MESON_EXE'])
-else:
-    meson_exe = None
-
-if mesonlib.is_windows() or mesonlib.is_cygwin():
-    exe_suffix = '.exe'
-else:
-    exe_suffix = ''
-
-def get_meson_script():
-    '''
-    Guess the meson that corresponds to the `mesonbuild` that has been imported
-    so we can run configure and other commands in-process, since mesonmain.run
-    needs to know the meson_command to use.
-
-    Also used by run_unittests.py to determine what meson to run when not
-    running in-process (which is the default).
-    '''
-    # Is there a meson.py next to the mesonbuild currently in use?
-    mesonbuild_dir = Path(mesonmain.__file__).resolve().parent.parent
-    meson_script = mesonbuild_dir / 'meson.py'
-    if meson_script.is_file():
-        return str(meson_script)
-    # Then if mesonbuild is in PYTHONPATH, meson must be in PATH
-    mlog.warning('Could not find meson.py next to the mesonbuild module. '
-                 'Trying system meson...')
-    meson_cmd = shutil.which('meson')
-    if meson_cmd:
-        return meson_cmd
-    raise RuntimeError('Could not find {!r} or a meson in PATH'.format(meson_script))
-
-def get_backend_args_for_dir(backend, builddir):
-    '''
-    Visual Studio backend needs to be given the solution to build
-    '''
-    if backend is Backend.vs:
-        sln_name = glob(os.path.join(builddir, '*.sln'))[0]
-        return [os.path.split(sln_name)[-1]]
-    return []
-
-def find_vcxproj_with_target(builddir, target):
-    import re, fnmatch
-    t, ext = os.path.splitext(target)
-    if ext:
-        p = r'<TargetName>{}</TargetName>\s*<TargetExt>\{}</TargetExt>'.format(t, ext)
-    else:
-        p = r'<TargetName>{}</TargetName>'.format(t)
-    for _, _, files in os.walk(builddir):
-        for f in fnmatch.filter(files, '*.vcxproj'):
-            f = os.path.join(builddir, f)
-            with open(f, 'r', encoding='utf-8') as o:
-                if re.search(p, o.read(), flags=re.MULTILINE):
-                    return f
-    raise RuntimeError('No vcxproj matching {!r} in {!r}'.format(p, builddir))
-
-def get_builddir_target_args(backend, builddir, target):
-    dir_args = []
-    if not target:
-        dir_args = get_backend_args_for_dir(backend, builddir)
-    if target is None:
-        return dir_args
-    if backend is Backend.vs:
-        vcxproj = find_vcxproj_with_target(builddir, target)
-        target_args = [vcxproj]
-    elif backend is Backend.xcode:
-        target_args = ['-target', target]
-    elif backend is Backend.ninja:
-        target_args = [target]
-    else:
-        raise AssertionError('Unknown backend: {!r}'.format(backend))
-    return target_args + dir_args
-
-def get_backend_commands(backend, debug=False):
-    install_cmd = []
-    uninstall_cmd = []
-    if backend is Backend.vs:
-        cmd = ['msbuild']
-        clean_cmd = cmd + ['/target:Clean']
-        test_cmd = cmd + ['RUN_TESTS.vcxproj']
-    elif backend is Backend.xcode:
-        cmd = ['xcodebuild']
-        # In Xcode9 new build system's clean command fails when using a custom build directory.
-        # Maybe use it when CI uses Xcode10 we can remove '-UseNewBuildSystem=FALSE'
-        clean_cmd = cmd + ['-alltargets', 'clean', '-UseNewBuildSystem=FALSE']
-        test_cmd = cmd + ['-target', 'RUN_TESTS']
-    elif backend is Backend.ninja:
-        global NINJA_CMD
-        cmd = NINJA_CMD + ['-w', 'dupbuild=err', '-d', 'explain']
-        if debug:
-            cmd += ['-v']
-        clean_cmd = cmd + ['clean']
-        test_cmd = cmd + ['test', 'benchmark']
-        install_cmd = cmd + ['install']
-        uninstall_cmd = cmd + ['uninstall']
-    else:
-        raise AssertionError('Unknown backend: {!r}'.format(backend))
-    return cmd, clean_cmd, test_cmd, install_cmd, uninstall_cmd
-
-def ensure_backend_detects_changes(backend):
-    global NINJA_1_9_OR_NEWER
-    if backend is not Backend.ninja:
-        return
-    need_workaround = False
-    # We're not running on HFS+ which only stores dates in seconds:
-    # https://developer.apple.com/legacy/library/technotes/tn/tn1150.html#HFSPlusDates
-    # XXX: Upgrade Travis image to Apple FS when that becomes available
-    # TODO: Detect HFS+ vs APFS
-    if mesonlib.is_osx():
-        mlog.warning('Running on HFS+, enabling timestamp resolution workaround', once=True)
-        need_workaround = True
-    # We're using ninja >= 1.9 which has QuLogic's patch for sub-1s resolution
-    # timestamps
-    if not NINJA_1_9_OR_NEWER:
-        mlog.warning('Don\'t have ninja >= 1.9, enabling timestamp resolution workaround', once=True)
-        need_workaround = True
-    # Increase the difference between build.ninja's timestamp and the timestamp
-    # of whatever you changed: https://github.com/ninja-build/ninja/issues/371
-    if need_workaround:
-        time.sleep(1)
-
-def run_mtest_inprocess(commandlist):
-    old_stdout = sys.stdout
-    sys.stdout = mystdout = StringIO()
-    old_stderr = sys.stderr
-    sys.stderr = mystderr = StringIO()
-    try:
-        returncode = mtest.run_with_args(commandlist)
-    finally:
-        sys.stdout = old_stdout
-        sys.stderr = old_stderr
-    return returncode, mystdout.getvalue(), mystderr.getvalue()
-
-def clear_meson_configure_class_caches():
-    compilers.CCompiler.library_dirs_cache = {}
-    compilers.CCompiler.program_dirs_cache = {}
-    compilers.CCompiler.find_library_cache = {}
-    compilers.CCompiler.find_framework_cache = {}
-    dependencies.PkgConfigDependency.pkgbin_cache = {}
-    dependencies.PkgConfigDependency.class_pkgbin = mesonlib.PerMachine(None, None)
-
-def run_configure_inprocess(commandlist, env=None):
-    old_stdout = sys.stdout
-    sys.stdout = mystdout = StringIO()
-    old_stderr = sys.stderr
-    sys.stderr = mystderr = StringIO()
-    old_environ = os.environ.copy()
-    if env is not None:
-        os.environ.update(env)
-    try:
-        returncode = mesonmain.run(commandlist, get_meson_script())
-    finally:
-        sys.stdout = old_stdout
-        sys.stderr = old_stderr
-        clear_meson_configure_class_caches()
-        os.environ.clear()
-        os.environ.update(old_environ)
-    return returncode, mystdout.getvalue(), mystderr.getvalue()
-
-def run_configure_external(full_command, env=None):
-    pc, o, e = mesonlib.Popen_safe(full_command, env=env)
-    return pc.returncode, o, e
-
-def run_configure(commandlist, env=None):
-    global meson_exe
-    if meson_exe:
-        return run_configure_external(meson_exe + commandlist, env=env)
-    return run_configure_inprocess(commandlist, env=env)
-
-def print_system_info():
-    print(mlog.bold('System information.').get_text(mlog.colorize_console()))
-    print('Architecture:', platform.architecture())
-    print('Machine:', platform.machine())
-    print('Platform:', platform.system())
-    print('Processor:', platform.processor())
-    print('System:', platform.system())
-    print('')
-    print(flush=True)
-
-def main():
-    print_system_info()
-    parser = argparse.ArgumentParser()
-    parser.add_argument('--cov', action='store_true')
-    parser.add_argument('--backend', default=None, dest='backend',
-                        choices=backendlist)
-    parser.add_argument('--cross', default=[], dest='cross', action='append')
-    parser.add_argument('--failfast', action='store_true')
-    parser.add_argument('--no-unittests', action='store_true', default=False)
-    (options, _) = parser.parse_known_args()
-    # Enable coverage early...
-    enable_coverage = options.cov
-    if enable_coverage:
-        os.makedirs('.coverage', exist_ok=True)
-        sys.argv.remove('--cov')
-        import coverage
-        coverage.process_startup()
-    returncode = 0
-    cross = options.cross
-    backend, _ = guess_backend(options.backend, shutil.which('msbuild'))
-    no_unittests = options.no_unittests
-    # Running on a developer machine? Be nice!
-    if not mesonlib.is_windows() and not mesonlib.is_haiku() and 'CI' not in os.environ:
-        os.nice(20)
-    # Appveyor sets the `platform` environment variable which completely messes
-    # up building with the vs2010 and vs2015 backends.
-    #
-    # Specifically, MSBuild reads the `platform` environment variable to set
-    # the configured value for the platform (Win32/x64/arm), which breaks x86
-    # builds.
-    #
-    # Appveyor setting this also breaks our 'native build arch' detection for
-    # Windows in environment.py:detect_windows_arch() by overwriting the value
-    # of `platform` set by vcvarsall.bat.
-    #
-    # While building for x86, `platform` should be unset.
-    if 'APPVEYOR' in os.environ and os.environ['arch'] == 'x86':
-        os.environ.pop('platform')
-    # Run tests
-    # Can't pass arguments to unit tests, so set the backend to use in the environment
-    env = os.environ.copy()
-    env['MESON_UNIT_TEST_BACKEND'] = backend.name
-    with tempfile.TemporaryDirectory() as temp_dir:
-        # Enable coverage on all subsequent processes.
-        if enable_coverage:
-            Path(temp_dir, 'usercustomize.py').open('w').write(
-                'import coverage\n'
-                'coverage.process_startup()\n')
-            env['COVERAGE_PROCESS_START'] = '.coveragerc'
-            if 'PYTHONPATH' in env:
-                env['PYTHONPATH'] = os.pathsep.join([temp_dir, env.get('PYTHONPATH')])
-            else:
-                env['PYTHONPATH'] = temp_dir
-        if not cross:
-            cmd = mesonlib.python_command + ['run_meson_command_tests.py', '-v']
-            if options.failfast:
-                cmd += ['--failfast']
-            returncode += subprocess.call(cmd, env=env)
-            if options.failfast and returncode != 0:
-                return returncode
-            if no_unittests:
-                print('Skipping all unit tests.')
-                print(flush=True)
-                returncode = 0
-            else:
-                print(mlog.bold('Running unittests.').get_text(mlog.colorize_console()))
-                print(flush=True)
-                cmd = mesonlib.python_command + ['run_unittests.py', '-v']
-                if options.failfast:
-                    cmd += ['--failfast']
-                returncode += subprocess.call(cmd, env=env)
-                if options.failfast and returncode != 0:
-                    return returncode
-            cmd = mesonlib.python_command + ['run_project_tests.py'] + sys.argv[1:]
-            returncode += subprocess.call(cmd, env=env)
-        else:
-            cross_test_args = mesonlib.python_command + ['run_cross_test.py']
-            for cf in options.cross:
-                print(mlog.bold('Running {} cross tests.'.format(cf)).get_text(mlog.colorize_console()))
-                print(flush=True)
-                cmd = cross_test_args + ['cross/' + cf]
-                if options.failfast:
-                    cmd += ['--failfast']
-                returncode += subprocess.call(cmd, env=env)
-                if options.failfast and returncode != 0:
-                    return returncode
-    return returncode
-
-if __name__ == '__main__':
-    print('Meson build system', meson_version, 'Project and Unit Tests')
-    raise SystemExit(main())
diff --git a/meson/run_unittests.py b/meson/run_unittests.py
deleted file mode 100755 (executable)
index 9f36669..0000000
+++ /dev/null
@@ -1,8640 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2016-2017 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import typing as T
-import stat
-import subprocess
-import re
-import json
-import tempfile
-import textwrap
-import os
-import shutil
-import sys
-import unittest
-import platform
-import pickle
-import functools
-import io
-import operator
-import threading
-import urllib.error
-import urllib.request
-import zipfile
-import hashlib
-from itertools import chain
-from unittest import mock
-from configparser import ConfigParser
-from contextlib import contextmanager
-from glob import glob
-from pathlib import (PurePath, Path)
-from distutils.dir_util import copy_tree
-import typing as T
-
-import mesonbuild.mlog
-import mesonbuild.depfile
-import mesonbuild.dependencies.base
-import mesonbuild.compilers
-import mesonbuild.envconfig
-import mesonbuild.environment
-import mesonbuild.mesonlib
-import mesonbuild.coredata
-import mesonbuild.modules.gnome
-from mesonbuild.interpreter import Interpreter, ObjectHolder
-from mesonbuild.ast import AstInterpreter
-from mesonbuild.mesonlib import (
-    BuildDirLock, LibType, MachineChoice, PerMachine, Version, is_windows,
-    is_osx, is_cygwin, is_dragonflybsd, is_openbsd, is_haiku, is_sunos,
-    windows_proof_rmtree, python_command, version_compare, split_args,
-    quote_arg, relpath, is_linux
-)
-from mesonbuild.environment import detect_ninja
-from mesonbuild.mesonlib import MesonException, EnvironmentException
-from mesonbuild.dependencies import PkgConfigDependency, ExternalProgram
-import mesonbuild.dependencies.base
-from mesonbuild.build import Target, ConfigurationData
-import mesonbuild.modules.pkgconfig
-
-from mesonbuild.mtest import TAPParser, TestResult
-
-from run_tests import (
-    Backend, FakeBuild, FakeCompilerOptions,
-    ensure_backend_detects_changes, exe_suffix, get_backend_commands,
-    get_builddir_target_args, get_fake_env, get_fake_options, get_meson_script,
-    run_configure_inprocess, run_mtest_inprocess
-)
-
-
-URLOPEN_TIMEOUT = 5
-
-@contextmanager
-def chdir(path: str):
-    curdir = os.getcwd()
-    os.chdir(path)
-    yield
-    os.chdir(curdir)
-
-
-def get_dynamic_section_entry(fname, entry):
-    if is_cygwin() or is_osx():
-        raise unittest.SkipTest('Test only applicable to ELF platforms')
-
-    try:
-        raw_out = subprocess.check_output(['readelf', '-d', fname],
-                                          universal_newlines=True)
-    except FileNotFoundError:
-        # FIXME: Try using depfixer.py:Elf() as a fallback
-        raise unittest.SkipTest('readelf not found')
-    pattern = re.compile(entry + r': \[(.*?)\]')
-    for line in raw_out.split('\n'):
-        m = pattern.search(line)
-        if m is not None:
-            return m.group(1)
-    return None # The file did not contain the specified entry.
-
-def get_soname(fname):
-    return get_dynamic_section_entry(fname, 'soname')
-
-def get_rpath(fname):
-    return get_dynamic_section_entry(fname, r'(?:rpath|runpath)')
-
-def is_tarball():
-    if not os.path.isdir('docs'):
-        return True
-    return False
-
-def is_ci():
-    if 'CI' in os.environ:
-        return True
-    return False
-
-def is_pull():
-    # Travis
-    if os.environ.get('TRAVIS_PULL_REQUEST', 'false') != 'false':
-        return True
-    # Azure
-    if 'SYSTEM_PULLREQUEST_ISFORK' in os.environ:
-        return True
-    return False
-
-def _git_init(project_dir):
-    subprocess.check_call(['git', 'init'], cwd=project_dir, stdout=subprocess.DEVNULL)
-    subprocess.check_call(['git', 'config',
-                           'user.name', 'Author Person'], cwd=project_dir)
-    subprocess.check_call(['git', 'config',
-                           'user.email', 'teh_coderz@example.com'], cwd=project_dir)
-    subprocess.check_call('git add *', cwd=project_dir, shell=True,
-                          stdout=subprocess.DEVNULL)
-    subprocess.check_call(['git', 'commit', '-a', '-m', 'I am a project'], cwd=project_dir,
-                          stdout=subprocess.DEVNULL)
-
-@functools.lru_cache()
-def is_real_gnu_compiler(path):
-    '''
-    Check if the gcc we have is a real gcc and not a macOS wrapper around clang
-    '''
-    if not path:
-        return False
-    out = subprocess.check_output([path, '--version'], universal_newlines=True, stderr=subprocess.STDOUT)
-    return 'Free Software Foundation' in out
-
-def skipIfNoExecutable(exename):
-    '''
-    Skip this test if the given executable is not found.
-    '''
-    def wrapper(func):
-        @functools.wraps(func)
-        def wrapped(*args, **kwargs):
-            if shutil.which(exename) is None:
-                raise unittest.SkipTest(exename + ' not found')
-            return func(*args, **kwargs)
-        return wrapped
-    return wrapper
-
-def skipIfNoPkgconfig(f):
-    '''
-    Skip this test if no pkg-config is found, unless we're on CI.
-    This allows users to run our test suite without having
-    pkg-config installed on, f.ex., macOS, while ensuring that our CI does not
-    silently skip the test because of misconfiguration.
-
-    Note: Yes, we provide pkg-config even while running Windows CI
-    '''
-    @functools.wraps(f)
-    def wrapped(*args, **kwargs):
-        if not is_ci() and shutil.which('pkg-config') is None:
-            raise unittest.SkipTest('pkg-config not found')
-        return f(*args, **kwargs)
-    return wrapped
-
-def skipIfNoPkgconfigDep(depname):
-    '''
-    Skip this test if the given pkg-config dep is not found, unless we're on CI.
-    '''
-    def wrapper(func):
-        @functools.wraps(func)
-        def wrapped(*args, **kwargs):
-            if not is_ci() and shutil.which('pkg-config') is None:
-                raise unittest.SkipTest('pkg-config not found')
-            if not is_ci() and subprocess.call(['pkg-config', '--exists', depname]) != 0:
-                raise unittest.SkipTest('pkg-config dependency {} not found.'.format(depname))
-            return func(*args, **kwargs)
-        return wrapped
-    return wrapper
-
-def skip_if_no_cmake(f):
-    '''
-    Skip this test if no cmake is found, unless we're on CI.
-    This allows users to run our test suite without having
-    cmake installed on, f.ex., macOS, while ensuring that our CI does not
-    silently skip the test because of misconfiguration.
-    '''
-    @functools.wraps(f)
-    def wrapped(*args, **kwargs):
-        if not is_ci() and shutil.which('cmake') is None:
-            raise unittest.SkipTest('cmake not found')
-        return f(*args, **kwargs)
-    return wrapped
-
-def skip_if_not_language(lang):
-    def wrapper(func):
-        @functools.wraps(func)
-        def wrapped(*args, **kwargs):
-            try:
-                env = get_fake_env()
-                f = getattr(env, 'detect_{}_compiler'.format(lang))
-                f(MachineChoice.HOST)
-            except EnvironmentException:
-                raise unittest.SkipTest('No {} compiler found.'.format(lang))
-            return func(*args, **kwargs)
-        return wrapped
-    return wrapper
-
-def skip_if_env_set(key):
-    '''
-    Skip a test if a particular env is set, except when running under CI
-    '''
-    def wrapper(func):
-        @functools.wraps(func)
-        def wrapped(*args, **kwargs):
-            old = None
-            if key in os.environ:
-                if not is_ci():
-                    raise unittest.SkipTest('Env var {!r} set, skipping'.format(key))
-                old = os.environ.pop(key)
-            try:
-                return func(*args, **kwargs)
-            finally:
-                if old is not None:
-                    os.environ[key] = old
-        return wrapped
-    return wrapper
-
-def skip_if_not_base_option(feature):
-    """Skip tests if The compiler does not support a given base option.
-
-    for example, ICC doesn't currently support b_sanitize.
-    """
-    def actual(f):
-        @functools.wraps(f)
-        def wrapped(*args, **kwargs):
-            env = get_fake_env()
-            cc = env.detect_c_compiler(MachineChoice.HOST)
-            if feature not in cc.base_options:
-                raise unittest.SkipTest(
-                    '{} not available with {}'.format(feature, cc.id))
-            return f(*args, **kwargs)
-        return wrapped
-    return actual
-
-
-@contextmanager
-def temp_filename():
-    '''A context manager which provides a filename to an empty temporary file.
-
-    On exit the file will be deleted.
-    '''
-
-    fd, filename = tempfile.mkstemp()
-    os.close(fd)
-    try:
-        yield filename
-    finally:
-        try:
-            os.remove(filename)
-        except OSError:
-            pass
-
-@contextmanager
-def no_pkgconfig():
-    '''
-    A context manager that overrides shutil.which and ExternalProgram to force
-    them to return None for pkg-config to simulate it not existing.
-    '''
-    old_which = shutil.which
-    old_search = ExternalProgram._search
-
-    def new_search(self, name, search_dir):
-        if name == 'pkg-config':
-            return [None]
-        return old_search(self, name, search_dir)
-
-    def new_which(cmd, *kwargs):
-        if cmd == 'pkg-config':
-            return None
-        return old_which(cmd, *kwargs)
-
-    shutil.which = new_which
-    ExternalProgram._search = new_search
-    try:
-        yield
-    finally:
-        shutil.which = old_which
-        ExternalProgram._search = old_search
-
-
-class InternalTests(unittest.TestCase):
-
-    def test_version_number(self):
-        searchfunc = mesonbuild.environment.search_version
-        self.assertEqual(searchfunc('foobar 1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('foobar 2016.10.28 1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('2016.10.28 1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('foobar 2016.10.128'), '2016.10.128')
-        self.assertEqual(searchfunc('2016.10.128'), '2016.10.128')
-        self.assertEqual(searchfunc('2016.10'), '2016.10')
-        self.assertEqual(searchfunc('2016.10 1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('oops v1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('2016.oops 1.2.3'), '1.2.3')
-        self.assertEqual(searchfunc('2016.x'), 'unknown version')
-
-
-    def test_mode_symbolic_to_bits(self):
-        modefunc = mesonbuild.mesonlib.FileMode.perms_s_to_bits
-        self.assertEqual(modefunc('---------'), 0)
-        self.assertEqual(modefunc('r--------'), stat.S_IRUSR)
-        self.assertEqual(modefunc('---r-----'), stat.S_IRGRP)
-        self.assertEqual(modefunc('------r--'), stat.S_IROTH)
-        self.assertEqual(modefunc('-w-------'), stat.S_IWUSR)
-        self.assertEqual(modefunc('----w----'), stat.S_IWGRP)
-        self.assertEqual(modefunc('-------w-'), stat.S_IWOTH)
-        self.assertEqual(modefunc('--x------'), stat.S_IXUSR)
-        self.assertEqual(modefunc('-----x---'), stat.S_IXGRP)
-        self.assertEqual(modefunc('--------x'), stat.S_IXOTH)
-        self.assertEqual(modefunc('--S------'), stat.S_ISUID)
-        self.assertEqual(modefunc('-----S---'), stat.S_ISGID)
-        self.assertEqual(modefunc('--------T'), stat.S_ISVTX)
-        self.assertEqual(modefunc('--s------'), stat.S_ISUID | stat.S_IXUSR)
-        self.assertEqual(modefunc('-----s---'), stat.S_ISGID | stat.S_IXGRP)
-        self.assertEqual(modefunc('--------t'), stat.S_ISVTX | stat.S_IXOTH)
-        self.assertEqual(modefunc('rwx------'), stat.S_IRWXU)
-        self.assertEqual(modefunc('---rwx---'), stat.S_IRWXG)
-        self.assertEqual(modefunc('------rwx'), stat.S_IRWXO)
-        # We could keep listing combinations exhaustively but that seems
-        # tedious and pointless. Just test a few more.
-        self.assertEqual(modefunc('rwxr-xr-x'),
-                         stat.S_IRWXU |
-                         stat.S_IRGRP | stat.S_IXGRP |
-                         stat.S_IROTH | stat.S_IXOTH)
-        self.assertEqual(modefunc('rw-r--r--'),
-                         stat.S_IRUSR | stat.S_IWUSR |
-                         stat.S_IRGRP |
-                         stat.S_IROTH)
-        self.assertEqual(modefunc('rwsr-x---'),
-                         stat.S_IRWXU | stat.S_ISUID |
-                         stat.S_IRGRP | stat.S_IXGRP)
-
-    def test_compiler_args_class_none_flush(self):
-        cc = mesonbuild.compilers.CCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock())
-        a = cc.compiler_args(['-I.'])
-        #first we are checking if the tree construction deduplicates the correct -I argument
-        a += ['-I..']
-        a += ['-I./tests/']
-        a += ['-I./tests2/']
-        #think this here as assertion, we cannot apply it, otherwise the CompilerArgs would already flush the changes:
-        # assertEqual(a, ['-I.', '-I./tests2/', '-I./tests/', '-I..', '-I.'])
-        a += ['-I.']
-        a += ['-I.', '-I./tests/']
-        self.assertEqual(a, ['-I.', '-I./tests/', '-I./tests2/', '-I..'])
-
-        #then we are checking that when CompilerArgs already have a build container list, that the deduplication is taking the correct one
-        a += ['-I.', '-I./tests2/']
-        self.assertEqual(a, ['-I.', '-I./tests2/', '-I./tests/', '-I..'])
-
-    def test_compiler_args_class_d(self):
-        d = mesonbuild.compilers.DCompiler([], 'fake', MachineChoice.HOST, 'info', 'arch', False, None)
-        # check include order is kept when deduplicating
-        a = d.compiler_args(['-Ifirst', '-Isecond', '-Ithird'])
-        a += ['-Ifirst']
-        self.assertEqual(a, ['-Ifirst', '-Isecond', '-Ithird'])
-
-    def test_compiler_args_class(self):
-        cc = mesonbuild.compilers.CCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock())
-        # Test that empty initialization works
-        a = cc.compiler_args()
-        self.assertEqual(a, [])
-        # Test that list initialization works
-        a = cc.compiler_args(['-I.', '-I..'])
-        self.assertEqual(a, ['-I.', '-I..'])
-        # Test that there is no de-dup on initialization
-        self.assertEqual(cc.compiler_args(['-I.', '-I.']), ['-I.', '-I.'])
-
-        ## Test that appending works
-        a.append('-I..')
-        self.assertEqual(a, ['-I..', '-I.'])
-        a.append('-O3')
-        self.assertEqual(a, ['-I..', '-I.', '-O3'])
-
-        ## Test that in-place addition works
-        a += ['-O2', '-O2']
-        self.assertEqual(a, ['-I..', '-I.', '-O3', '-O2', '-O2'])
-        # Test that removal works
-        a.remove('-O2')
-        self.assertEqual(a, ['-I..', '-I.', '-O3', '-O2'])
-        # Test that de-dup happens on addition
-        a += ['-Ifoo', '-Ifoo']
-        self.assertEqual(a, ['-Ifoo', '-I..', '-I.', '-O3', '-O2'])
-
-        # .extend() is just +=, so we don't test it
-
-        ## Test that addition works
-        # Test that adding a list with just one old arg works and yields the same array
-        a = a + ['-Ifoo']
-        self.assertEqual(a, ['-Ifoo', '-I..', '-I.', '-O3', '-O2'])
-        # Test that adding a list with one arg new and one old works
-        a = a + ['-Ifoo', '-Ibaz']
-        self.assertEqual(a, ['-Ifoo', '-Ibaz', '-I..', '-I.', '-O3', '-O2'])
-        # Test that adding args that must be prepended and appended works
-        a = a + ['-Ibar', '-Wall']
-        self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-O3', '-O2', '-Wall'])
-
-        ## Test that reflected addition works
-        # Test that adding to a list with just one old arg works and yields the same array
-        a = ['-Ifoo'] + a
-        self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-O3', '-O2', '-Wall'])
-        # Test that adding to a list with just one new arg that is not pre-pended works
-        a = ['-Werror'] + a
-        self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Werror', '-O3', '-O2', '-Wall'])
-        # Test that adding to a list with two new args preserves the order
-        a = ['-Ldir', '-Lbah'] + a
-        self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall'])
-        # Test that adding to a list with old args does nothing
-        a = ['-Ibar', '-Ibaz', '-Ifoo'] + a
-        self.assertEqual(a, ['-Ibar', '-Ifoo', '-Ibaz', '-I..', '-I.', '-Ldir', '-Lbah', '-Werror', '-O3', '-O2', '-Wall'])
-
-        ## Test that adding libraries works
-        l = cc.compiler_args(['-Lfoodir', '-lfoo'])
-        self.assertEqual(l, ['-Lfoodir', '-lfoo'])
-        # Adding a library and a libpath appends both correctly
-        l += ['-Lbardir', '-lbar']
-        self.assertEqual(l, ['-Lbardir', '-Lfoodir', '-lfoo', '-lbar'])
-        # Adding the same library again does nothing
-        l += ['-lbar']
-        self.assertEqual(l, ['-Lbardir', '-Lfoodir', '-lfoo', '-lbar'])
-
-        ## Test that 'direct' append and extend works
-        l = cc.compiler_args(['-Lfoodir', '-lfoo'])
-        self.assertEqual(l, ['-Lfoodir', '-lfoo'])
-        # Direct-adding a library and a libpath appends both correctly
-        l.extend_direct(['-Lbardir', '-lbar'])
-        self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar'])
-        # Direct-adding the same library again still adds it
-        l.append_direct('-lbar')
-        self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar', '-lbar'])
-        # Direct-adding with absolute path deduplicates
-        l.append_direct('/libbaz.a')
-        self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a'])
-        # Adding libbaz again does nothing
-        l.append_direct('/libbaz.a')
-        self.assertEqual(l, ['-Lfoodir', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a'])
-
-    def test_compiler_args_class_gnuld(self):
-        ## Test --start/end-group
-        linker = mesonbuild.linkers.GnuDynamicLinker([], MachineChoice.HOST, 'fake', '-Wl,', [])
-        gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
-        ## Ensure that the fake compiler is never called by overriding the relevant function
-        gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
-        ## Test that 'direct' append and extend works
-        l = gcc.compiler_args(['-Lfoodir', '-lfoo'])
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group'])
-        # Direct-adding a library and a libpath appends both correctly
-        l.extend_direct(['-Lbardir', '-lbar'])
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-Wl,--end-group'])
-        # Direct-adding the same library again still adds it
-        l.append_direct('-lbar')
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '-Wl,--end-group'])
-        # Direct-adding with absolute path deduplicates
-        l.append_direct('/libbaz.a')
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--end-group'])
-        # Adding libbaz again does nothing
-        l.append_direct('/libbaz.a')
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--end-group'])
-        # Adding a non-library argument doesn't include it in the group
-        l += ['-Lfoo', '-Wl,--export-dynamic']
-        self.assertEqual(l.to_native(copy=True), ['-Lfoo', '-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--end-group', '-Wl,--export-dynamic'])
-        # -Wl,-lfoo is detected as a library and gets added to the group
-        l.append('-Wl,-ldl')
-        self.assertEqual(l.to_native(copy=True), ['-Lfoo', '-Lfoodir', '-Wl,--start-group', '-lfoo', '-Lbardir', '-lbar', '-lbar', '/libbaz.a', '-Wl,--export-dynamic', '-Wl,-ldl', '-Wl,--end-group'])
-
-    def test_compiler_args_remove_system(self):
-        ## Test --start/end-group
-        linker = mesonbuild.linkers.GnuDynamicLinker([], MachineChoice.HOST, 'fake', '-Wl,', [])
-        gcc = mesonbuild.compilers.GnuCCompiler([], 'fake', False, MachineChoice.HOST, mock.Mock(), linker=linker)
-        ## Ensure that the fake compiler is never called by overriding the relevant function
-        gcc.get_default_include_dirs = lambda: ['/usr/include', '/usr/share/include', '/usr/local/include']
-        ## Test that 'direct' append and extend works
-        l = gcc.compiler_args(['-Lfoodir', '-lfoo'])
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group'])
-        ## Test that to_native removes all system includes
-        l += ['-isystem/usr/include', '-isystem=/usr/share/include', '-DSOMETHING_IMPORTANT=1', '-isystem', '/usr/local/include']
-        self.assertEqual(l.to_native(copy=True), ['-Lfoodir', '-Wl,--start-group', '-lfoo', '-Wl,--end-group', '-DSOMETHING_IMPORTANT=1'])
-
-    def test_string_templates_substitution(self):
-        dictfunc = mesonbuild.mesonlib.get_filenames_templates_dict
-        substfunc = mesonbuild.mesonlib.substitute_values
-        ME = mesonbuild.mesonlib.MesonException
-
-        # Identity
-        self.assertEqual(dictfunc([], []), {})
-
-        # One input, no outputs
-        inputs = ['bar/foo.c.in']
-        outputs = []
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0],
-             '@PLAINNAME@': 'foo.c.in', '@BASENAME@': 'foo.c'}
-        # Check dictionary
-        self.assertEqual(ret, d)
-        # Check substitutions
-        cmd = ['some', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), cmd)
-        cmd = ['@INPUT@.out', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), [inputs[0] + '.out'] + cmd[1:])
-        cmd = ['@INPUT0@.out', '@PLAINNAME@.ok', 'strings']
-        self.assertEqual(substfunc(cmd, d),
-                         [inputs[0] + '.out'] + [d['@PLAINNAME@'] + '.ok'] + cmd[2:])
-        cmd = ['@INPUT@', '@BASENAME@.hah', 'strings']
-        self.assertEqual(substfunc(cmd, d),
-                         inputs + [d['@BASENAME@'] + '.hah'] + cmd[2:])
-        cmd = ['@OUTPUT@']
-        self.assertRaises(ME, substfunc, cmd, d)
-
-        # One input, one output
-        inputs = ['bar/foo.c.in']
-        outputs = ['out.c']
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0],
-             '@PLAINNAME@': 'foo.c.in', '@BASENAME@': 'foo.c',
-             '@OUTPUT@': outputs, '@OUTPUT0@': outputs[0], '@OUTDIR@': '.'}
-        # Check dictionary
-        self.assertEqual(ret, d)
-        # Check substitutions
-        cmd = ['some', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), cmd)
-        cmd = ['@INPUT@.out', '@OUTPUT@', 'strings']
-        self.assertEqual(substfunc(cmd, d),
-                         [inputs[0] + '.out'] + outputs + cmd[2:])
-        cmd = ['@INPUT0@.out', '@PLAINNAME@.ok', '@OUTPUT0@']
-        self.assertEqual(substfunc(cmd, d),
-                         [inputs[0] + '.out', d['@PLAINNAME@'] + '.ok'] + outputs)
-        cmd = ['@INPUT@', '@BASENAME@.hah', 'strings']
-        self.assertEqual(substfunc(cmd, d),
-                         inputs + [d['@BASENAME@'] + '.hah'] + cmd[2:])
-
-        # One input, one output with a subdir
-        outputs = ['dir/out.c']
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0],
-             '@PLAINNAME@': 'foo.c.in', '@BASENAME@': 'foo.c',
-             '@OUTPUT@': outputs, '@OUTPUT0@': outputs[0], '@OUTDIR@': 'dir'}
-        # Check dictionary
-        self.assertEqual(ret, d)
-
-        # Two inputs, no outputs
-        inputs = ['bar/foo.c.in', 'baz/foo.c.in']
-        outputs = []
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0], '@INPUT1@': inputs[1]}
-        # Check dictionary
-        self.assertEqual(ret, d)
-        # Check substitutions
-        cmd = ['some', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), cmd)
-        cmd = ['@INPUT@', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), inputs + cmd[1:])
-        cmd = ['@INPUT0@.out', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), [inputs[0] + '.out'] + cmd[1:])
-        cmd = ['@INPUT0@.out', '@INPUT1@.ok', 'strings']
-        self.assertEqual(substfunc(cmd, d), [inputs[0] + '.out', inputs[1] + '.ok'] + cmd[2:])
-        cmd = ['@INPUT0@', '@INPUT1@', 'strings']
-        self.assertEqual(substfunc(cmd, d), inputs + cmd[2:])
-        # Many inputs, can't use @INPUT@ like this
-        cmd = ['@INPUT@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Not enough inputs
-        cmd = ['@INPUT2@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Too many inputs
-        cmd = ['@PLAINNAME@']
-        self.assertRaises(ME, substfunc, cmd, d)
-        cmd = ['@BASENAME@']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # No outputs
-        cmd = ['@OUTPUT@']
-        self.assertRaises(ME, substfunc, cmd, d)
-        cmd = ['@OUTPUT0@']
-        self.assertRaises(ME, substfunc, cmd, d)
-        cmd = ['@OUTDIR@']
-        self.assertRaises(ME, substfunc, cmd, d)
-
-        # Two inputs, one output
-        outputs = ['dir/out.c']
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0], '@INPUT1@': inputs[1],
-             '@OUTPUT@': outputs, '@OUTPUT0@': outputs[0], '@OUTDIR@': 'dir'}
-        # Check dictionary
-        self.assertEqual(ret, d)
-        # Check substitutions
-        cmd = ['some', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), cmd)
-        cmd = ['@OUTPUT@', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), outputs + cmd[1:])
-        cmd = ['@OUTPUT@.out', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), [outputs[0] + '.out'] + cmd[1:])
-        cmd = ['@OUTPUT0@.out', '@INPUT1@.ok', 'strings']
-        self.assertEqual(substfunc(cmd, d), [outputs[0] + '.out', inputs[1] + '.ok'] + cmd[2:])
-        # Many inputs, can't use @INPUT@ like this
-        cmd = ['@INPUT@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Not enough inputs
-        cmd = ['@INPUT2@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Not enough outputs
-        cmd = ['@OUTPUT2@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-
-        # Two inputs, two outputs
-        outputs = ['dir/out.c', 'dir/out2.c']
-        ret = dictfunc(inputs, outputs)
-        d = {'@INPUT@': inputs, '@INPUT0@': inputs[0], '@INPUT1@': inputs[1],
-             '@OUTPUT@': outputs, '@OUTPUT0@': outputs[0], '@OUTPUT1@': outputs[1],
-             '@OUTDIR@': 'dir'}
-        # Check dictionary
-        self.assertEqual(ret, d)
-        # Check substitutions
-        cmd = ['some', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), cmd)
-        cmd = ['@OUTPUT@', 'ordinary', 'strings']
-        self.assertEqual(substfunc(cmd, d), outputs + cmd[1:])
-        cmd = ['@OUTPUT0@', '@OUTPUT1@', 'strings']
-        self.assertEqual(substfunc(cmd, d), outputs + cmd[2:])
-        cmd = ['@OUTPUT0@.out', '@INPUT1@.ok', '@OUTDIR@']
-        self.assertEqual(substfunc(cmd, d), [outputs[0] + '.out', inputs[1] + '.ok', 'dir'])
-        # Many inputs, can't use @INPUT@ like this
-        cmd = ['@INPUT@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Not enough inputs
-        cmd = ['@INPUT2@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Not enough outputs
-        cmd = ['@OUTPUT2@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-        # Many outputs, can't use @OUTPUT@ like this
-        cmd = ['@OUTPUT@.out', 'ordinary', 'strings']
-        self.assertRaises(ME, substfunc, cmd, d)
-
-    def test_needs_exe_wrapper_override(self):
-        config = ConfigParser()
-        config['binaries'] = {
-            'c': '\'/usr/bin/gcc\'',
-        }
-        config['host_machine'] = {
-            'system': '\'linux\'',
-            'cpu_family': '\'arm\'',
-            'cpu': '\'armv7\'',
-            'endian': '\'little\'',
-        }
-        # Can not be used as context manager because we need to
-        # open it a second time and this is not possible on
-        # Windows.
-        configfile = tempfile.NamedTemporaryFile(mode='w+', delete=False)
-        configfilename = configfile.name
-        config.write(configfile)
-        configfile.flush()
-        configfile.close()
-        opts = get_fake_options()
-        opts.cross_file = (configfilename,)
-        env = get_fake_env(opts=opts)
-        detected_value = env.need_exe_wrapper()
-        os.unlink(configfilename)
-
-        desired_value = not detected_value
-        config['properties'] = {
-            'needs_exe_wrapper': 'true' if desired_value else 'false'
-        }
-
-        configfile = tempfile.NamedTemporaryFile(mode='w+', delete=False)
-        configfilename = configfile.name
-        config.write(configfile)
-        configfile.close()
-        opts = get_fake_options()
-        opts.cross_file = (configfilename,)
-        env = get_fake_env(opts=opts)
-        forced_value = env.need_exe_wrapper()
-        os.unlink(configfilename)
-
-        self.assertEqual(forced_value, desired_value)
-
-    def test_listify(self):
-        listify = mesonbuild.mesonlib.listify
-        # Test sanity
-        self.assertEqual([1], listify(1))
-        self.assertEqual([], listify([]))
-        self.assertEqual([1], listify([1]))
-        # Test flattening
-        self.assertEqual([1, 2, 3], listify([1, [2, 3]]))
-        self.assertEqual([1, 2, 3], listify([1, [2, [3]]]))
-        self.assertEqual([1, [2, [3]]], listify([1, [2, [3]]], flatten=False))
-        # Test flattening and unholdering
-        holder1 = ObjectHolder(1)
-        self.assertEqual([holder1], listify(holder1))
-        self.assertEqual([holder1], listify([holder1]))
-        self.assertEqual([holder1, 2], listify([holder1, 2]))
-        self.assertEqual([holder1, 2, 3], listify([holder1, 2, [3]]))
-
-    def test_unholder(self):
-        unholder = mesonbuild.mesonlib.unholder
-
-        holder1 = ObjectHolder(1)
-        holder3 = ObjectHolder(3)
-        holders = [holder1, holder3]
-
-        self.assertEqual(1, unholder(holder1))
-        self.assertEqual([1], unholder([holder1]))
-        self.assertEqual([1, 3], unholder(holders))
-
-    def test_extract_as_list(self):
-        extract = mesonbuild.mesonlib.extract_as_list
-        # Test sanity
-        kwargs = {'sources': [1, 2, 3]}
-        self.assertEqual([1, 2, 3], extract(kwargs, 'sources'))
-        self.assertEqual(kwargs, {'sources': [1, 2, 3]})
-        self.assertEqual([1, 2, 3], extract(kwargs, 'sources', pop=True))
-        self.assertEqual(kwargs, {})
-
-        # Test unholding
-        holder3 = ObjectHolder(3)
-        kwargs = {'sources': [1, 2, holder3]}
-        self.assertEqual(kwargs, {'sources': [1, 2, holder3]})
-
-        # flatten nested lists
-        kwargs = {'sources': [1, [2, [3]]]}
-        self.assertEqual([1, 2, 3], extract(kwargs, 'sources'))
-
-    def test_pkgconfig_module(self):
-        dummystate = mock.Mock()
-        dummystate.subproject = 'dummy'
-        _mock = mock.Mock(spec=mesonbuild.dependencies.ExternalDependency)
-        _mock.pcdep = mock.Mock()
-        _mock.pcdep.name = "some_name"
-        _mock.version_reqs = []
-        _mock = mock.Mock(held_object=_mock)
-
-        # pkgconfig dependency as lib
-        deps = mesonbuild.modules.pkgconfig.DependenciesHelper(dummystate, "thislib")
-        deps.add_pub_libs([_mock])
-        self.assertEqual(deps.format_reqs(deps.pub_reqs), "some_name")
-
-        # pkgconfig dependency as requires
-        deps = mesonbuild.modules.pkgconfig.DependenciesHelper(dummystate, "thislib")
-        deps.add_pub_reqs([_mock])
-        self.assertEqual(deps.format_reqs(deps.pub_reqs), "some_name")
-
-    def _test_all_naming(self, cc, env, patterns, platform):
-        shr = patterns[platform]['shared']
-        stc = patterns[platform]['static']
-        shrstc = shr + tuple([x for x in stc if x not in shr])
-        stcshr = stc + tuple([x for x in shr if x not in stc])
-        p = cc.get_library_naming(env, LibType.SHARED)
-        self.assertEqual(p, shr)
-        p = cc.get_library_naming(env, LibType.STATIC)
-        self.assertEqual(p, stc)
-        p = cc.get_library_naming(env, LibType.PREFER_STATIC)
-        self.assertEqual(p, stcshr)
-        p = cc.get_library_naming(env, LibType.PREFER_SHARED)
-        self.assertEqual(p, shrstc)
-        # Test find library by mocking up openbsd
-        if platform != 'openbsd':
-            return
-        with tempfile.TemporaryDirectory() as tmpdir:
-            with open(os.path.join(tmpdir, 'libfoo.so.6.0'), 'w') as f:
-                f.write('')
-            with open(os.path.join(tmpdir, 'libfoo.so.5.0'), 'w') as f:
-                f.write('')
-            with open(os.path.join(tmpdir, 'libfoo.so.54.0'), 'w') as f:
-                f.write('')
-            with open(os.path.join(tmpdir, 'libfoo.so.66a.0b'), 'w') as f:
-                f.write('')
-            with open(os.path.join(tmpdir, 'libfoo.so.70.0.so.1'), 'w') as f:
-                f.write('')
-            found = cc.find_library_real('foo', env, [tmpdir], '', LibType.PREFER_SHARED)
-            self.assertEqual(os.path.basename(found[0]), 'libfoo.so.54.0')
-
-    def test_find_library_patterns(self):
-        '''
-        Unit test for the library search patterns used by find_library()
-        '''
-        unix_static = ('lib{}.a', '{}.a')
-        msvc_static = ('lib{}.a', 'lib{}.lib', '{}.a', '{}.lib')
-        # This is the priority list of pattern matching for library searching
-        patterns = {'openbsd': {'shared': ('lib{}.so', '{}.so', 'lib{}.so.[0-9]*.[0-9]*', '{}.so.[0-9]*.[0-9]*'),
-                                'static': unix_static},
-                    'linux': {'shared': ('lib{}.so', '{}.so'),
-                              'static': unix_static},
-                    'darwin': {'shared': ('lib{}.dylib', 'lib{}.so', '{}.dylib', '{}.so'),
-                               'static': unix_static},
-                    'cygwin': {'shared': ('cyg{}.dll', 'cyg{}.dll.a', 'lib{}.dll',
-                                          'lib{}.dll.a', '{}.dll', '{}.dll.a'),
-                               'static': ('cyg{}.a',) + unix_static},
-                    'windows-msvc': {'shared': ('lib{}.lib', '{}.lib'),
-                                     'static': msvc_static},
-                    'windows-mingw': {'shared': ('lib{}.dll.a', 'lib{}.lib', 'lib{}.dll',
-                                                 '{}.dll.a', '{}.lib', '{}.dll'),
-                                      'static': msvc_static}}
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if is_osx():
-            self._test_all_naming(cc, env, patterns, 'darwin')
-        elif is_cygwin():
-            self._test_all_naming(cc, env, patterns, 'cygwin')
-        elif is_windows():
-            if cc.get_argument_syntax() == 'msvc':
-                self._test_all_naming(cc, env, patterns, 'windows-msvc')
-            else:
-                self._test_all_naming(cc, env, patterns, 'windows-mingw')
-        elif is_openbsd():
-            self._test_all_naming(cc, env, patterns, 'openbsd')
-        else:
-            self._test_all_naming(cc, env, patterns, 'linux')
-            env.machines.host.system = 'openbsd'
-            self._test_all_naming(cc, env, patterns, 'openbsd')
-            env.machines.host.system = 'darwin'
-            self._test_all_naming(cc, env, patterns, 'darwin')
-            env.machines.host.system = 'cygwin'
-            self._test_all_naming(cc, env, patterns, 'cygwin')
-            env.machines.host.system = 'windows'
-            self._test_all_naming(cc, env, patterns, 'windows-mingw')
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_parse_libs(self):
-        '''
-        Unit test for parsing of pkg-config output to search for libraries
-
-        https://github.com/mesonbuild/meson/issues/3951
-        '''
-        def create_static_lib(name):
-            if not is_osx():
-                name.open('w').close()
-                return
-            src = name.with_suffix('.c')
-            out = name.with_suffix('.o')
-            with src.open('w') as f:
-                f.write('int meson_foobar (void) { return 0; }')
-            subprocess.check_call(['clang', '-c', str(src), '-o', str(out)])
-            subprocess.check_call(['ar', 'csr', str(name), str(out)])
-
-        with tempfile.TemporaryDirectory() as tmpdir:
-            pkgbin = ExternalProgram('pkg-config', command=['pkg-config'], silent=True)
-            env = get_fake_env()
-            compiler = env.detect_c_compiler(MachineChoice.HOST)
-            env.coredata.compilers.host = {'c': compiler}
-            env.coredata.compiler_options.host['c']['link_args'] = FakeCompilerOptions()
-            p1 = Path(tmpdir) / '1'
-            p2 = Path(tmpdir) / '2'
-            p1.mkdir()
-            p2.mkdir()
-            # libfoo.a is in one prefix
-            create_static_lib(p1 / 'libfoo.a')
-            # libbar.a is in both prefixes
-            create_static_lib(p1 / 'libbar.a')
-            create_static_lib(p2 / 'libbar.a')
-            # Ensure that we never statically link to these
-            create_static_lib(p1 / 'libpthread.a')
-            create_static_lib(p1 / 'libm.a')
-            create_static_lib(p1 / 'libc.a')
-            create_static_lib(p1 / 'libdl.a')
-            create_static_lib(p1 / 'librt.a')
-
-            def fake_call_pkgbin(self, args, env=None):
-                if '--libs' not in args:
-                    return 0, '', ''
-                if args[0] == 'foo':
-                    return 0, '-L{} -lfoo -L{} -lbar'.format(p2.as_posix(), p1.as_posix()), ''
-                if args[0] == 'bar':
-                    return 0, '-L{} -lbar'.format(p2.as_posix()), ''
-                if args[0] == 'internal':
-                    return 0, '-L{} -lpthread -lm -lc -lrt -ldl'.format(p1.as_posix()), ''
-
-            old_call = PkgConfigDependency._call_pkgbin
-            old_check = PkgConfigDependency.check_pkgconfig
-            PkgConfigDependency._call_pkgbin = fake_call_pkgbin
-            PkgConfigDependency.check_pkgconfig = lambda x, _: pkgbin
-            # Test begins
-            try:
-                kwargs = {'required': True, 'silent': True}
-                foo_dep = PkgConfigDependency('foo', env, kwargs)
-                self.assertEqual(foo_dep.get_link_args(),
-                                 [(p1 / 'libfoo.a').as_posix(), (p2 / 'libbar.a').as_posix()])
-                bar_dep = PkgConfigDependency('bar', env, kwargs)
-                self.assertEqual(bar_dep.get_link_args(), [(p2 / 'libbar.a').as_posix()])
-                internal_dep = PkgConfigDependency('internal', env, kwargs)
-                if compiler.get_argument_syntax() == 'msvc':
-                    self.assertEqual(internal_dep.get_link_args(), [])
-                else:
-                    link_args = internal_dep.get_link_args()
-                    for link_arg in link_args:
-                        for lib in ('pthread', 'm', 'c', 'dl', 'rt'):
-                            self.assertNotIn('lib{}.a'.format(lib), link_arg, msg=link_args)
-            finally:
-                # Test ends
-                PkgConfigDependency._call_pkgbin = old_call
-                PkgConfigDependency.check_pkgconfig = old_check
-                # Reset dependency class to ensure that in-process configure doesn't mess up
-                PkgConfigDependency.pkgbin_cache = {}
-                PkgConfigDependency.class_pkgbin = PerMachine(None, None)
-
-    def test_version_compare(self):
-        comparefunc = mesonbuild.mesonlib.version_compare_many
-        for (a, b, result) in [
-                ('0.99.beta19', '>= 0.99.beta14', True),
-        ]:
-            self.assertEqual(comparefunc(a, b)[0], result)
-
-        for (a, b, op) in [
-                # examples from https://fedoraproject.org/wiki/Archive:Tools/RPM/VersionComparison
-                ("1.0010", "1.9", operator.gt),
-                ("1.05", "1.5", operator.eq),
-                ("1.0", "1", operator.gt),
-                ("2.50", "2.5", operator.gt),
-                ("fc4", "fc.4", operator.eq),
-                ("FC5", "fc4", operator.lt),
-                ("2a", "2.0", operator.lt),
-                ("1.0", "1.fc4", operator.gt),
-                ("3.0.0_fc", "3.0.0.fc", operator.eq),
-                # from RPM tests
-                ("1.0", "1.0", operator.eq),
-                ("1.0", "2.0", operator.lt),
-                ("2.0", "1.0", operator.gt),
-                ("2.0.1", "2.0.1", operator.eq),
-                ("2.0", "2.0.1", operator.lt),
-                ("2.0.1", "2.0", operator.gt),
-                ("2.0.1a", "2.0.1a", operator.eq),
-                ("2.0.1a", "2.0.1", operator.gt),
-                ("2.0.1", "2.0.1a", operator.lt),
-                ("5.5p1", "5.5p1", operator.eq),
-                ("5.5p1", "5.5p2", operator.lt),
-                ("5.5p2", "5.5p1", operator.gt),
-                ("5.5p10", "5.5p10", operator.eq),
-                ("5.5p1", "5.5p10", operator.lt),
-                ("5.5p10", "5.5p1", operator.gt),
-                ("10xyz", "10.1xyz", operator.lt),
-                ("10.1xyz", "10xyz", operator.gt),
-                ("xyz10", "xyz10", operator.eq),
-                ("xyz10", "xyz10.1", operator.lt),
-                ("xyz10.1", "xyz10", operator.gt),
-                ("xyz.4", "xyz.4", operator.eq),
-                ("xyz.4", "8", operator.lt),
-                ("8", "xyz.4", operator.gt),
-                ("xyz.4", "2", operator.lt),
-                ("2", "xyz.4", operator.gt),
-                ("5.5p2", "5.6p1", operator.lt),
-                ("5.6p1", "5.5p2", operator.gt),
-                ("5.6p1", "6.5p1", operator.lt),
-                ("6.5p1", "5.6p1", operator.gt),
-                ("6.0.rc1", "6.0", operator.gt),
-                ("6.0", "6.0.rc1", operator.lt),
-                ("10b2", "10a1", operator.gt),
-                ("10a2", "10b2", operator.lt),
-                ("1.0aa", "1.0aa", operator.eq),
-                ("1.0a", "1.0aa", operator.lt),
-                ("1.0aa", "1.0a", operator.gt),
-                ("10.0001", "10.0001", operator.eq),
-                ("10.0001", "10.1", operator.eq),
-                ("10.1", "10.0001", operator.eq),
-                ("10.0001", "10.0039", operator.lt),
-                ("10.0039", "10.0001", operator.gt),
-                ("4.999.9", "5.0", operator.lt),
-                ("5.0", "4.999.9", operator.gt),
-                ("20101121", "20101121", operator.eq),
-                ("20101121", "20101122", operator.lt),
-                ("20101122", "20101121", operator.gt),
-                ("2_0", "2_0", operator.eq),
-                ("2.0", "2_0", operator.eq),
-                ("2_0", "2.0", operator.eq),
-                ("a", "a", operator.eq),
-                ("a+", "a+", operator.eq),
-                ("a+", "a_", operator.eq),
-                ("a_", "a+", operator.eq),
-                ("+a", "+a", operator.eq),
-                ("+a", "_a", operator.eq),
-                ("_a", "+a", operator.eq),
-                ("+_", "+_", operator.eq),
-                ("_+", "+_", operator.eq),
-                ("_+", "_+", operator.eq),
-                ("+", "_", operator.eq),
-                ("_", "+", operator.eq),
-                # other tests
-                ('0.99.beta19', '0.99.beta14', operator.gt),
-                ("1.0.0", "2.0.0", operator.lt),
-                (".0.0", "2.0.0", operator.lt),
-                ("alpha", "beta", operator.lt),
-                ("1.0", "1.0.0", operator.lt),
-                ("2.456", "2.1000", operator.lt),
-                ("2.1000", "3.111", operator.lt),
-                ("2.001", "2.1", operator.eq),
-                ("2.34", "2.34", operator.eq),
-                ("6.1.2", "6.3.8", operator.lt),
-                ("1.7.3.0", "2.0.0", operator.lt),
-                ("2.24.51", "2.25", operator.lt),
-                ("2.1.5+20120813+gitdcbe778", "2.1.5", operator.gt),
-                ("3.4.1", "3.4b1", operator.gt),
-                ("041206", "200090325", operator.lt),
-                ("0.6.2+git20130413", "0.6.2", operator.gt),
-                ("2.6.0+bzr6602", "2.6.0", operator.gt),
-                ("2.6.0", "2.6b2", operator.gt),
-                ("2.6.0+bzr6602", "2.6b2x", operator.gt),
-                ("0.6.7+20150214+git3a710f9", "0.6.7", operator.gt),
-                ("15.8b", "15.8.0.1", operator.lt),
-                ("1.2rc1", "1.2.0", operator.lt),
-        ]:
-            ver_a = Version(a)
-            ver_b = Version(b)
-            if op is operator.eq:
-                for o, name in [(op, 'eq'), (operator.ge, 'ge'), (operator.le, 'le')]:
-                    self.assertTrue(o(ver_a, ver_b), '{} {} {}'.format(ver_a, name, ver_b))
-            if op is operator.lt:
-                for o, name in [(op, 'lt'), (operator.le, 'le'), (operator.ne, 'ne')]:
-                    self.assertTrue(o(ver_a, ver_b), '{} {} {}'.format(ver_a, name, ver_b))
-                for o, name in [(operator.gt, 'gt'), (operator.ge, 'ge'), (operator.eq, 'eq')]:
-                    self.assertFalse(o(ver_a, ver_b), '{} {} {}'.format(ver_a, name, ver_b))
-            if op is operator.gt:
-                for o, name in [(op, 'gt'), (operator.ge, 'ge'), (operator.ne, 'ne')]:
-                    self.assertTrue(o(ver_a, ver_b), '{} {} {}'.format(ver_a, name, ver_b))
-                for o, name in [(operator.lt, 'lt'), (operator.le, 'le'), (operator.eq, 'eq')]:
-                    self.assertFalse(o(ver_a, ver_b), '{} {} {}'.format(ver_a, name, ver_b))
-
-    def test_msvc_toolset_version(self):
-        '''
-        Ensure that the toolset version returns the correct value for this MSVC
-        '''
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_argument_syntax() != 'msvc':
-            raise unittest.SkipTest('Test only applies to MSVC-like compilers')
-        toolset_ver = cc.get_toolset_version()
-        self.assertIsNotNone(toolset_ver)
-        # Visual Studio 2015 and older versions do not define VCToolsVersion
-        # TODO: ICL doesn't set this in the VSC2015 profile either
-        if cc.id == 'msvc' and int(''.join(cc.version.split('.')[0:2])) < 1910:
-            return
-        if 'VCToolsVersion' in os.environ:
-            vctools_ver = os.environ['VCToolsVersion']
-        else:
-            self.assertIn('VCINSTALLDIR', os.environ)
-            # See https://devblogs.microsoft.com/cppblog/finding-the-visual-c-compiler-tools-in-visual-studio-2017/
-            vctools_ver = (Path(os.environ['VCINSTALLDIR']) / 'Auxiliary' / 'Build' / 'Microsoft.VCToolsVersion.default.txt').read_text()
-        self.assertTrue(vctools_ver.startswith(toolset_ver),
-                        msg='{!r} does not start with {!r}'.format(vctools_ver, toolset_ver))
-
-    def test_split_args(self):
-        split_args = mesonbuild.mesonlib.split_args
-        join_args = mesonbuild.mesonlib.join_args
-        if is_windows():
-            test_data = [
-                # examples from https://docs.microsoft.com/en-us/cpp/c-language/parsing-c-command-line-arguments
-                (r'"a b c" d e', ['a b c', 'd', 'e'], True),
-                (r'"ab\"c" "\\" d', ['ab"c', '\\', 'd'], False),
-                (r'a\\\b d"e f"g h', [r'a\\\b', 'de fg', 'h'], False),
-                (r'a\\\"b c d', [r'a\"b', 'c', 'd'], False),
-                (r'a\\\\"b c" d e', [r'a\\b c', 'd', 'e'], False),
-                # other basics
-                (r'""', [''], True),
-                (r'a b c d "" e', ['a', 'b', 'c', 'd', '', 'e'], True),
-                (r"'a b c' d e", ["'a", 'b', "c'", 'd', 'e'], True),
-                (r"'a&b&c' d e", ["'a&b&c'", 'd', 'e'], True),
-                (r"a & b & c d e", ['a', '&', 'b', '&', 'c', 'd', 'e'], True),
-                (r"'a & b & c d e'", ["'a", '&', 'b', '&', 'c', 'd', "e'"], True),
-                ('a  b\nc\rd \n\re', ['a', 'b', 'c', 'd', 'e'], False),
-                # more illustrative tests
-                (r'cl test.cpp /O1 /Fe:test.exe', ['cl', 'test.cpp', '/O1', '/Fe:test.exe'], True),
-                (r'cl "test.cpp /O1 /Fe:test.exe"', ['cl', 'test.cpp /O1 /Fe:test.exe'], True),
-                (r'cl /DNAME=\"Bob\" test.cpp', ['cl', '/DNAME="Bob"', 'test.cpp'], False),
-                (r'cl "/DNAME=\"Bob\"" test.cpp', ['cl', '/DNAME="Bob"', 'test.cpp'], True),
-                (r'cl /DNAME=\"Bob, Alice\" test.cpp', ['cl', '/DNAME="Bob,', 'Alice"', 'test.cpp'], False),
-                (r'cl "/DNAME=\"Bob, Alice\"" test.cpp', ['cl', '/DNAME="Bob, Alice"', 'test.cpp'], True),
-                (r'cl C:\path\with\backslashes.cpp', ['cl', r'C:\path\with\backslashes.cpp'], True),
-                (r'cl C:\\path\\with\\double\\backslashes.cpp', ['cl', r'C:\\path\\with\\double\\backslashes.cpp'], True),
-                (r'cl "C:\\path\\with\\double\\backslashes.cpp"', ['cl', r'C:\\path\\with\\double\\backslashes.cpp'], False),
-                (r'cl C:\path with spaces\test.cpp', ['cl', r'C:\path', 'with', r'spaces\test.cpp'], False),
-                (r'cl "C:\path with spaces\test.cpp"', ['cl', r'C:\path with spaces\test.cpp'], True),
-                (r'cl /DPATH="C:\path\with\backslashes test.cpp', ['cl', r'/DPATH=C:\path\with\backslashes test.cpp'], False),
-                (r'cl /DPATH=\"C:\\ends\\with\\backslashes\\\" test.cpp', ['cl', r'/DPATH="C:\\ends\\with\\backslashes\"', 'test.cpp'], False),
-                (r'cl /DPATH="C:\\ends\\with\\backslashes\\" test.cpp', ['cl', '/DPATH=C:\\\\ends\\\\with\\\\backslashes\\', 'test.cpp'], False),
-                (r'cl "/DNAME=\"C:\\ends\\with\\backslashes\\\"" test.cpp', ['cl', r'/DNAME="C:\\ends\\with\\backslashes\"', 'test.cpp'], True),
-                (r'cl "/DNAME=\"C:\\ends\\with\\backslashes\\\\"" test.cpp', ['cl', r'/DNAME="C:\\ends\\with\\backslashes\\ test.cpp'], False),
-                (r'cl "/DNAME=\"C:\\ends\\with\\backslashes\\\\\"" test.cpp', ['cl', r'/DNAME="C:\\ends\\with\\backslashes\\"', 'test.cpp'], True),
-            ]
-        else:
-            test_data = [
-                (r"'a b c' d e", ['a b c', 'd', 'e'], True),
-                (r"a/b/c d e", ['a/b/c', 'd', 'e'], True),
-                (r"a\b\c d e", [r'abc', 'd', 'e'], False),
-                (r"a\\b\\c d e", [r'a\b\c', 'd', 'e'], False),
-                (r'"a b c" d e', ['a b c', 'd', 'e'], False),
-                (r'"a\\b\\c\\" d e', ['a\\b\\c\\', 'd', 'e'], False),
-                (r"'a\b\c\' d e", ['a\\b\\c\\', 'd', 'e'], True),
-                (r"'a&b&c' d e", ['a&b&c', 'd', 'e'], True),
-                (r"a & b & c d e", ['a', '&', 'b', '&', 'c', 'd', 'e'], False),
-                (r"'a & b & c d e'", ['a & b & c d e'], True),
-                (r"abd'e f'g h", [r'abde fg', 'h'], False),
-                ('a  b\nc\rd \n\re', ['a', 'b', 'c', 'd', 'e'], False),
-
-                ('g++ -DNAME="Bob" test.cpp', ['g++', '-DNAME=Bob', 'test.cpp'], False),
-                ("g++ '-DNAME=\"Bob\"' test.cpp", ['g++', '-DNAME="Bob"', 'test.cpp'], True),
-                ('g++ -DNAME="Bob, Alice" test.cpp', ['g++', '-DNAME=Bob, Alice', 'test.cpp'], False),
-                ("g++ '-DNAME=\"Bob, Alice\"' test.cpp", ['g++', '-DNAME="Bob, Alice"', 'test.cpp'], True),
-            ]
-
-        for (cmd, expected, roundtrip) in test_data:
-            self.assertEqual(split_args(cmd), expected)
-            if roundtrip:
-                self.assertEqual(join_args(expected), cmd)
-
-    def test_quote_arg(self):
-        split_args = mesonbuild.mesonlib.split_args
-        quote_arg = mesonbuild.mesonlib.quote_arg
-        if is_windows():
-            test_data = [
-                ('', '""'),
-                ('arg1', 'arg1'),
-                ('/option1', '/option1'),
-                ('/Ovalue', '/Ovalue'),
-                ('/OBob&Alice', '/OBob&Alice'),
-                ('/Ovalue with spaces', r'"/Ovalue with spaces"'),
-                (r'/O"value with spaces"', r'"/O\"value with spaces\""'),
-                (r'/OC:\path with spaces\test.exe', r'"/OC:\path with spaces\test.exe"'),
-                ('/LIBPATH:C:\\path with spaces\\ends\\with\\backslashes\\', r'"/LIBPATH:C:\path with spaces\ends\with\backslashes\\"'),
-                ('/LIBPATH:"C:\\path with spaces\\ends\\with\\backslashes\\\\"', r'"/LIBPATH:\"C:\path with spaces\ends\with\backslashes\\\\\""'),
-                (r'/DMSG="Alice said: \"Let\'s go\""', r'"/DMSG=\"Alice said: \\\"Let\'s go\\\"\""'),
-            ]
-        else:
-            test_data = [
-                ('arg1', 'arg1'),
-                ('--option1', '--option1'),
-                ('-O=value', '-O=value'),
-                ('-O=Bob&Alice', "'-O=Bob&Alice'"),
-                ('-O=value with spaces', "'-O=value with spaces'"),
-                ('-O="value with spaces"', '\'-O=\"value with spaces\"\''),
-                ('-O=/path with spaces/test', '\'-O=/path with spaces/test\''),
-                ('-DMSG="Alice said: \\"Let\'s go\\""', "'-DMSG=\"Alice said: \\\"Let'\"'\"'s go\\\"\"'"),
-            ]
-
-        for (arg, expected) in test_data:
-            self.assertEqual(quote_arg(arg), expected)
-            self.assertEqual(split_args(expected)[0], arg)
-
-    def test_depfile(self):
-        for (f, target, expdeps) in [
-                # empty, unknown target
-                ([''], 'unknown', set()),
-                # simple target & deps
-                (['meson/foo.o  : foo.c   foo.h'], 'meson/foo.o', set({'foo.c', 'foo.h'})),
-                (['meson/foo.o: foo.c foo.h'], 'foo.c', set()),
-                # get all deps
-                (['meson/foo.o: foo.c foo.h',
-                  'foo.c: gen.py'], 'meson/foo.o', set({'foo.c', 'foo.h', 'gen.py'})),
-                (['meson/foo.o: foo.c foo.h',
-                  'foo.c: gen.py'], 'foo.c', set({'gen.py'})),
-                # linue continuation, multiple targets
-                (['foo.o \\', 'foo.h: bar'], 'foo.h', set({'bar'})),
-                (['foo.o \\', 'foo.h: bar'], 'foo.o', set({'bar'})),
-                # \\ handling
-                (['foo: Program\\ F\\iles\\\\X'], 'foo', set({'Program Files\\X'})),
-                # $ handling
-                (['f$o.o: c/b'], 'f$o.o', set({'c/b'})),
-                (['f$$o.o: c/b'], 'f$o.o', set({'c/b'})),
-                # cycles
-                (['a: b', 'b: a'], 'a', set({'a', 'b'})),
-                (['a: b', 'b: a'], 'b', set({'a', 'b'})),
-        ]:
-            d = mesonbuild.depfile.DepFile(f)
-            deps = d.get_all_dependencies(target)
-            self.assertEqual(deps, expdeps)
-
-    def test_log_once(self):
-        f = io.StringIO()
-        with mock.patch('mesonbuild.mlog.log_file', f), \
-                mock.patch('mesonbuild.mlog._logged_once', set()):
-            mesonbuild.mlog.log_once('foo')
-            mesonbuild.mlog.log_once('foo')
-            actual = f.getvalue().strip()
-            self.assertEqual(actual, 'foo', actual)
-
-    def test_log_once_ansi(self):
-        f = io.StringIO()
-        with mock.patch('mesonbuild.mlog.log_file', f), \
-                mock.patch('mesonbuild.mlog._logged_once', set()):
-            mesonbuild.mlog.log_once(mesonbuild.mlog.bold('foo'))
-            mesonbuild.mlog.log_once(mesonbuild.mlog.bold('foo'))
-            actual = f.getvalue().strip()
-            self.assertEqual(actual.count('foo'), 1, actual)
-
-            mesonbuild.mlog.log_once('foo')
-            actual = f.getvalue().strip()
-            self.assertEqual(actual.count('foo'), 1, actual)
-
-            f.truncate()
-
-            mesonbuild.mlog.warning('bar', once=True)
-            mesonbuild.mlog.warning('bar', once=True)
-            actual = f.getvalue().strip()
-            self.assertEqual(actual.count('bar'), 1, actual)
-
-    def test_sort_libpaths(self):
-        sort_libpaths = mesonbuild.dependencies.base.sort_libpaths
-        self.assertEqual(sort_libpaths(
-            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'],
-            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
-            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
-        self.assertEqual(sort_libpaths(
-            ['/usr/local/lib', '/home/mesonuser/.local/lib', '/usr/lib'],
-            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
-            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
-        self.assertEqual(sort_libpaths(
-            ['/usr/lib', '/usr/local/lib', '/home/mesonuser/.local/lib'],
-            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/lib/pkgconfig']),
-            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
-        self.assertEqual(sort_libpaths(
-            ['/usr/lib', '/usr/local/lib', '/home/mesonuser/.local/lib'],
-            ['/home/mesonuser/.local/lib/pkgconfig', '/usr/local/libdata/pkgconfig']),
-            ['/home/mesonuser/.local/lib', '/usr/local/lib', '/usr/lib'])
-
-    def test_dependency_factory_order(self):
-        b = mesonbuild.dependencies.base
-        with tempfile.TemporaryDirectory() as tmpdir:
-            with chdir(tmpdir):
-                env = get_fake_env()
-
-                f = b.DependencyFactory(
-                    'test_dep',
-                    methods=[b.DependencyMethods.PKGCONFIG, b.DependencyMethods.CMAKE]
-                )
-                actual = [m() for m in f(env, MachineChoice.HOST, {'required': False})]
-                self.assertListEqual([m.type_name for m in actual], ['pkgconfig', 'cmake'])
-
-                f = b.DependencyFactory(
-                    'test_dep',
-                    methods=[b.DependencyMethods.CMAKE, b.DependencyMethods.PKGCONFIG]
-                )
-                actual = [m() for m in f(env, MachineChoice.HOST, {'required': False})]
-                self.assertListEqual([m.type_name for m in actual], ['cmake', 'pkgconfig'])
-
-    def test_validate_json(self) -> None:
-        """Validate the json schema for the test cases."""
-        try:
-            from jsonschema import validate, ValidationError
-        except ImportError:
-            if is_ci():
-                raise
-            raise unittest.SkipTest('Python jsonschema module not found.')
-
-        with Path('data/test.schema.json').open() as f:
-            schema = json.load(f)
-
-        errors = []  # type: T.Tuple[str, Exception]
-        for p in Path('test cases').glob('**/test.json'):
-            with p.open() as f:
-                try:
-                    validate(json.load(f), schema=schema)
-                except ValidationError as e:
-                    errors.append((p.resolve(), e))
-
-        for f, e in errors:
-            print('Failed to validate: "{}"'.format(f))
-            print(str(e))
-
-        self.assertFalse(errors)
-
-@unittest.skipIf(is_tarball(), 'Skipping because this is a tarball release')
-class DataTests(unittest.TestCase):
-
-    def test_snippets(self):
-        hashcounter = re.compile('^ *(#)+')
-        snippet_dir = Path('docs/markdown/snippets')
-        self.assertTrue(snippet_dir.is_dir())
-        for f in snippet_dir.glob('*'):
-            self.assertTrue(f.is_file())
-            if f.parts[-1].endswith('~'):
-                continue
-            if f.suffix == '.md':
-                in_code_block = False
-                with f.open() as snippet:
-                    for line in snippet:
-                        if line.startswith('    '):
-                            continue
-                        if line.startswith('```'):
-                            in_code_block = not in_code_block
-                        if in_code_block:
-                            continue
-                        m = re.match(hashcounter, line)
-                        if m:
-                            self.assertEqual(len(m.group(0)), 2, 'All headings in snippets must have two hash symbols: ' + f.name)
-                self.assertFalse(in_code_block, 'Unclosed code block.')
-            else:
-                if f.name != 'add_release_note_snippets_here':
-                    self.assertTrue(False, 'A file without .md suffix in snippets dir: ' + f.name)
-
-    def test_compiler_options_documented(self):
-        '''
-        Test that C and C++ compiler options and base options are documented in
-        Builtin-Options.md. Only tests the default compiler for the current
-        platform on the CI.
-        '''
-        md = None
-        with open('docs/markdown/Builtin-options.md', encoding='utf-8') as f:
-            md = f.read()
-        self.assertIsNotNone(md)
-        env = get_fake_env()
-        # FIXME: Support other compilers
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        cpp = env.detect_cpp_compiler(MachineChoice.HOST)
-        for comp in (cc, cpp):
-            for opt in comp.get_options().keys():
-                self.assertIn(opt, md)
-            for opt in comp.base_options:
-                self.assertIn(opt, md)
-        self.assertNotIn('b_unknown', md)
-
-    @staticmethod
-    def _get_section_content(name, sections, md):
-        for section in sections:
-            if section and section.group(1) == name:
-                try:
-                    next_section = next(sections)
-                    end = next_section.start()
-                except StopIteration:
-                    end = len(md)
-                # Extract the content for this section
-                return md[section.end():end]
-        raise RuntimeError('Could not find "{}" heading'.format(name))
-
-    def test_builtin_options_documented(self):
-        '''
-        Test that universal options and base options are documented in
-        Builtin-Options.md.
-        '''
-        from itertools import tee
-        md = None
-        with open('docs/markdown/Builtin-options.md', encoding='utf-8') as f:
-            md = f.read()
-        self.assertIsNotNone(md)
-
-        found_entries = set()
-        sections = re.finditer(r"^## (.+)$", md, re.MULTILINE)
-        # Extract the content for this section
-        content = self._get_section_content("Universal options", sections, md)
-        subsections = tee(re.finditer(r"^### (.+)$", content, re.MULTILINE))
-        subcontent1 = self._get_section_content("Directories", subsections[0], content)
-        subcontent2 = self._get_section_content("Core options", subsections[1], content)
-        for subcontent in (subcontent1, subcontent2):
-            # Find the option names
-            options = set()
-            # Match either a table row or a table heading separator: | ------ |
-            rows = re.finditer(r"^\|(?: (\w+) .* | *-+ *)\|", subcontent, re.MULTILINE)
-            # Skip the header of the first table
-            next(rows)
-            # Skip the heading separator of the first table
-            next(rows)
-            for m in rows:
-                value = m.group(1)
-                # End when the `buildtype` table starts
-                if value is None:
-                    break
-                options.add(value)
-            self.assertEqual(len(found_entries & options), 0)
-            found_entries |= options
-
-        self.assertEqual(found_entries, set([
-            *mesonbuild.coredata.builtin_options.keys(),
-            *mesonbuild.coredata.builtin_options_per_machine.keys()
-        ]))
-
-        # Check that `buildtype` table inside `Core options` matches how
-        # setting of builtin options behaves
-        #
-        # Find all tables inside this subsection
-        tables = re.finditer(r"^\| (\w+) .* \|\n\| *[-|\s]+ *\|$", subcontent2, re.MULTILINE)
-        # Get the table we want using the header of the first column
-        table = self._get_section_content('buildtype', tables, subcontent2)
-        # Get table row data
-        rows = re.finditer(r"^\|(?: (\w+)\s+\| (\w+)\s+\| (\w+) .* | *-+ *)\|", table, re.MULTILINE)
-        env = get_fake_env()
-        for m in rows:
-            buildtype, debug, opt = m.groups()
-            if debug == 'true':
-                debug = True
-            elif debug == 'false':
-                debug = False
-            else:
-                raise RuntimeError('Invalid debug value {!r} in row:\n{}'.format(debug, m.group()))
-            env.coredata.set_builtin_option('buildtype', buildtype)
-            self.assertEqual(env.coredata.builtins['buildtype'].value, buildtype)
-            self.assertEqual(env.coredata.builtins['optimization'].value, opt)
-            self.assertEqual(env.coredata.builtins['debug'].value, debug)
-
-    def test_cpu_families_documented(self):
-        with open("docs/markdown/Reference-tables.md", encoding='utf-8') as f:
-            md = f.read()
-        self.assertIsNotNone(md)
-
-        sections = re.finditer(r"^## (.+)$", md, re.MULTILINE)
-        content = self._get_section_content("CPU families", sections, md)
-        # Find the list entries
-        arches = [m.group(1) for m in re.finditer(r"^\| (\w+) +\|", content, re.MULTILINE)]
-        # Drop the header
-        arches = set(arches[1:])
-        self.assertEqual(arches, set(mesonbuild.environment.known_cpu_families))
-
-    def test_markdown_files_in_sitemap(self):
-        '''
-        Test that each markdown files in docs/markdown is referenced in sitemap.txt
-        '''
-        with open("docs/sitemap.txt", encoding='utf-8') as f:
-            md = f.read()
-        self.assertIsNotNone(md)
-        toc = list(m.group(1) for m in re.finditer(r"^\s*(\w.*)$", md, re.MULTILINE))
-        markdownfiles = [f.name for f in Path("docs/markdown").iterdir() if f.is_file() and f.suffix == '.md']
-        exceptions = ['_Sidebar.md']
-        for f in markdownfiles:
-            if f not in exceptions:
-                self.assertIn(f, toc)
-
-    def test_vim_syntax_highlighting(self):
-        '''
-        Ensure that vim syntax highlighting files were updated for new
-        functions in the global namespace in build files.
-        '''
-        env = get_fake_env()
-        interp = Interpreter(FakeBuild(env), mock=True)
-        with open('data/syntax-highlighting/vim/syntax/meson.vim') as f:
-            res = re.search(r'syn keyword mesonBuiltin(\s+\\\s\w+)+', f.read(), re.MULTILINE)
-            defined = set([a.strip() for a in res.group().split('\\')][1:])
-            self.assertEqual(defined, set(chain(interp.funcs.keys(), interp.builtin.keys())))
-
-    @unittest.skipIf(is_pull(), 'Skipping because this is a pull request')
-    def test_json_grammar_syntax_highlighting(self):
-        '''
-        Ensure that syntax highlighting JSON grammar written by TingPing was
-        updated for new functions in the global namespace in build files.
-        https://github.com/TingPing/language-meson/
-        '''
-        env = get_fake_env()
-        interp = Interpreter(FakeBuild(env), mock=True)
-        url = 'https://raw.githubusercontent.com/TingPing/language-meson/master/grammars/meson.json'
-        try:
-            # Use a timeout to avoid blocking forever in case the network is
-            # slow or unavailable in a weird way
-            r = urllib.request.urlopen(url, timeout=URLOPEN_TIMEOUT)
-        except urllib.error.URLError as e:
-            # Skip test when network is not available, such as during packaging
-            # by a distro or Flatpak
-            if not isinstance(e, urllib.error.HTTPError):
-                raise unittest.SkipTest('Network unavailable')
-            # Don't fail the test if github is down, but do fail if 4xx
-            if e.code >= 500:
-                raise unittest.SkipTest('Server error ' + str(e.code))
-            raise e
-        # On Python 3.5, we must decode bytes to string. Newer versions don't require that.
-        grammar = json.loads(r.read().decode('utf-8', 'surrogatepass'))
-        for each in grammar['patterns']:
-            if 'name' in each and each['name'] == 'support.function.builtin.meson':
-                # The string is of the form: (?x)\\b(func1|func2|...\n)\\b\\s*(?=\\() and
-                # we convert that to [func1, func2, ...] without using regex to parse regex
-                funcs = set(each['match'].split('\\b(')[1].split('\n')[0].split('|'))
-            if 'name' in each and each['name'] == 'support.variable.meson':
-                # \\b(builtin1|builtin2...)\\b
-                builtin = set(each['match'].split('\\b(')[1].split(')\\b')[0].split('|'))
-        self.assertEqual(builtin, set(interp.builtin.keys()))
-        self.assertEqual(funcs, set(interp.funcs.keys()))
-
-    def test_all_functions_defined_in_ast_interpreter(self):
-        '''
-        Ensure that the all functions defined in the Interpreter are also defined
-        in the AstInterpreter (and vice versa).
-        '''
-        env = get_fake_env()
-        interp = Interpreter(FakeBuild(env), mock=True)
-        astint = AstInterpreter('.', '', '')
-        self.assertEqual(set(interp.funcs.keys()), set(astint.funcs.keys()))
-
-    def test_mesondata_is_up_to_date(self):
-        from mesonbuild.mesondata import mesondata
-        err_msg = textwrap.dedent('''
-
-            ###########################################################
-            ###        mesonbuild.mesondata is not up-to-date       ###
-            ###  Please regenerate it by running tools/gen_data.py  ###
-            ###########################################################
-
-        ''')
-
-        root_dir = Path(__file__).resolve().parent
-        mesonbuild_dir = root_dir / 'mesonbuild'
-
-        data_dirs = mesonbuild_dir.glob('**/data')
-        data_files = []  # type: T.List[T.Tuple(str, str)]
-
-        for i in data_dirs:
-            for p in i.iterdir():
-                data_files += [(p.relative_to(mesonbuild_dir).as_posix(), hashlib.sha256(p.read_bytes()).hexdigest())]
-
-        from pprint import pprint
-        current_files = set(mesondata.keys())
-        scanned_files = set([x[0] for x in data_files])
-
-        self.assertSetEqual(current_files, scanned_files, err_msg + 'Data files were added or removed\n')
-        errors = []
-        for i in data_files:
-            if mesondata[i[0]].sha256sum != i[1]:
-                errors += [i[0]]
-
-        self.assertListEqual(errors, [], err_msg + 'Files were changed')
-
-class BasePlatformTests(unittest.TestCase):
-    prefix = '/usr'
-    libdir = 'lib'
-
-    def setUp(self):
-        super().setUp()
-        self.maxDiff = None
-        src_root = os.path.dirname(__file__)
-        src_root = os.path.join(os.getcwd(), src_root)
-        self.src_root = src_root
-        # Get the backend
-        # FIXME: Extract this from argv?
-        self.backend = getattr(Backend, os.environ.get('MESON_UNIT_TEST_BACKEND', 'ninja'))
-        self.meson_args = ['--backend=' + self.backend.name]
-        self.meson_native_file = None
-        self.meson_cross_file = None
-        self.meson_command = python_command + [get_meson_script()]
-        self.setup_command = self.meson_command + self.meson_args
-        self.mconf_command = self.meson_command + ['configure']
-        self.mintro_command = self.meson_command + ['introspect']
-        self.wrap_command = self.meson_command + ['wrap']
-        self.rewrite_command = self.meson_command + ['rewrite']
-        # Backend-specific build commands
-        self.build_command, self.clean_command, self.test_command, self.install_command, \
-            self.uninstall_command = get_backend_commands(self.backend)
-        # Test directories
-        self.common_test_dir = os.path.join(src_root, 'test cases/common')
-        self.vala_test_dir = os.path.join(src_root, 'test cases/vala')
-        self.framework_test_dir = os.path.join(src_root, 'test cases/frameworks')
-        self.unit_test_dir = os.path.join(src_root, 'test cases/unit')
-        self.rewrite_test_dir = os.path.join(src_root, 'test cases/rewrite')
-        self.linuxlike_test_dir = os.path.join(src_root, 'test cases/linuxlike')
-        # Misc stuff
-        self.orig_env = os.environ.copy()
-        if self.backend is Backend.ninja:
-            self.no_rebuild_stdout = ['ninja: no work to do.', 'samu: nothing to do']
-        else:
-            # VS doesn't have a stable output when no changes are done
-            # XCode backend is untested with unit tests, help welcome!
-            self.no_rebuild_stdout = ['UNKNOWN BACKEND {!r}'.format(self.backend.name)]
-
-        self.builddirs = []
-        self.new_builddir()
-
-    def change_builddir(self, newdir):
-        self.builddir = newdir
-        self.privatedir = os.path.join(self.builddir, 'meson-private')
-        self.logdir = os.path.join(self.builddir, 'meson-logs')
-        self.installdir = os.path.join(self.builddir, 'install')
-        self.distdir = os.path.join(self.builddir, 'meson-dist')
-        self.mtest_command = self.meson_command + ['test', '-C', self.builddir]
-        self.builddirs.append(self.builddir)
-
-    def new_builddir(self):
-        if not is_cygwin():
-            # Keep builddirs inside the source tree so that virus scanners
-            # don't complain
-            newdir = tempfile.mkdtemp(dir=os.getcwd())
-        else:
-            # But not on Cygwin because that breaks the umask tests. See:
-            # https://github.com/mesonbuild/meson/pull/5546#issuecomment-509666523
-            newdir = tempfile.mkdtemp()
-        # In case the directory is inside a symlinked directory, find the real
-        # path otherwise we might not find the srcdir from inside the builddir.
-        newdir = os.path.realpath(newdir)
-        self.change_builddir(newdir)
-
-    def _print_meson_log(self):
-        log = os.path.join(self.logdir, 'meson-log.txt')
-        if not os.path.isfile(log):
-            print("{!r} doesn't exist".format(log))
-            return
-        with open(log, 'r', encoding='utf-8') as f:
-            print(f.read())
-
-    def tearDown(self):
-        for path in self.builddirs:
-            try:
-                windows_proof_rmtree(path)
-            except FileNotFoundError:
-                pass
-        os.environ.clear()
-        os.environ.update(self.orig_env)
-        super().tearDown()
-
-    def _run(self, command, *, workdir=None, override_envvars=None):
-        '''
-        Run a command while printing the stdout and stderr to stdout,
-        and also return a copy of it
-        '''
-        # If this call hangs CI will just abort. It is very hard to distinguish
-        # between CI issue and test bug in that case. Set timeout and fail loud
-        # instead.
-        if override_envvars is None:
-            env = None
-        else:
-            env = os.environ.copy()
-            env.update(override_envvars)
-
-        p = subprocess.run(command, stdout=subprocess.PIPE,
-                           stderr=subprocess.STDOUT, env=env,
-                           universal_newlines=True, cwd=workdir, timeout=60 * 5)
-        print(p.stdout)
-        if p.returncode != 0:
-            if 'MESON_SKIP_TEST' in p.stdout:
-                raise unittest.SkipTest('Project requested skipping.')
-            raise subprocess.CalledProcessError(p.returncode, command, output=p.stdout)
-        return p.stdout
-
-    def init(self, srcdir, *,
-             extra_args=None,
-             default_args=True,
-             inprocess=False,
-             override_envvars=None,
-             workdir=None):
-        self.assertPathExists(srcdir)
-        if extra_args is None:
-            extra_args = []
-        if not isinstance(extra_args, list):
-            extra_args = [extra_args]
-        args = [srcdir, self.builddir]
-        if default_args:
-            args += ['--prefix', self.prefix]
-            if self.libdir:
-                args += ['--libdir', self.libdir]
-            if self.meson_native_file:
-                args += ['--native-file', self.meson_native_file]
-            if self.meson_cross_file:
-                args += ['--cross-file', self.meson_cross_file]
-        self.privatedir = os.path.join(self.builddir, 'meson-private')
-        if inprocess:
-            try:
-                if override_envvars is not None:
-                    old_envvars = os.environ.copy()
-                    os.environ.update(override_envvars)
-                (returncode, out, err) = run_configure_inprocess(self.meson_args + args + extra_args)
-                if override_envvars is not None:
-                    os.environ.clear()
-                    os.environ.update(old_envvars)
-                if 'MESON_SKIP_TEST' in out:
-                    raise unittest.SkipTest('Project requested skipping.')
-                if returncode != 0:
-                    self._print_meson_log()
-                    print('Stdout:\n')
-                    print(out)
-                    print('Stderr:\n')
-                    print(err)
-                    raise RuntimeError('Configure failed')
-            except Exception:
-                self._print_meson_log()
-                raise
-            finally:
-                # Close log file to satisfy Windows file locking
-                mesonbuild.mlog.shutdown()
-                mesonbuild.mlog.log_dir = None
-                mesonbuild.mlog.log_file = None
-        else:
-            try:
-                out = self._run(self.setup_command + args + extra_args, override_envvars=override_envvars, workdir=workdir)
-            except unittest.SkipTest:
-                raise unittest.SkipTest('Project requested skipping: ' + srcdir)
-            except Exception:
-                self._print_meson_log()
-                raise
-        return out
-
-    def build(self, target=None, *, extra_args=None, override_envvars=None):
-        if extra_args is None:
-            extra_args = []
-        # Add arguments for building the target (if specified),
-        # and using the build dir (if required, with VS)
-        args = get_builddir_target_args(self.backend, self.builddir, target)
-        return self._run(self.build_command + args + extra_args, workdir=self.builddir, override_envvars=override_envvars)
-
-    def clean(self, *, override_envvars=None):
-        dir_args = get_builddir_target_args(self.backend, self.builddir, None)
-        self._run(self.clean_command + dir_args, workdir=self.builddir, override_envvars=override_envvars)
-
-    def run_tests(self, *, inprocess=False, override_envvars=None):
-        if not inprocess:
-            self._run(self.test_command, workdir=self.builddir, override_envvars=override_envvars)
-        else:
-            if override_envvars is not None:
-                old_envvars = os.environ.copy()
-                os.environ.update(override_envvars)
-            try:
-                run_mtest_inprocess(['-C', self.builddir])
-            finally:
-                if override_envvars is not None:
-                    os.environ.clear()
-                    os.environ.update(old_envvars)
-
-    def install(self, *, use_destdir=True, override_envvars=None):
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('{!r} backend can\'t install files'.format(self.backend.name))
-        if use_destdir:
-            destdir = {'DESTDIR': self.installdir}
-            if override_envvars is None:
-                override_envvars = destdir
-            else:
-                override_envvars.update(destdir)
-        self._run(self.install_command, workdir=self.builddir, override_envvars=override_envvars)
-
-    def uninstall(self, *, override_envvars=None):
-        self._run(self.uninstall_command, workdir=self.builddir, override_envvars=override_envvars)
-
-    def run_target(self, target, *, override_envvars=None):
-        '''
-        Run a Ninja target while printing the stdout and stderr to stdout,
-        and also return a copy of it
-        '''
-        return self.build(target=target, override_envvars=override_envvars)
-
-    def setconf(self, arg, will_build=True):
-        if not isinstance(arg, list):
-            arg = [arg]
-        if will_build:
-            ensure_backend_detects_changes(self.backend)
-        self._run(self.mconf_command + arg + [self.builddir])
-
-    def wipe(self):
-        windows_proof_rmtree(self.builddir)
-
-    def utime(self, f):
-        ensure_backend_detects_changes(self.backend)
-        os.utime(f)
-
-    def get_compdb(self):
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Compiler db not available with {} backend'.format(self.backend.name))
-        try:
-            with open(os.path.join(self.builddir, 'compile_commands.json')) as ifile:
-                contents = json.load(ifile)
-        except FileNotFoundError:
-            raise unittest.SkipTest('Compiler db not found')
-        # If Ninja is using .rsp files, generate them, read their contents, and
-        # replace it as the command for all compile commands in the parsed json.
-        if len(contents) > 0 and contents[0]['command'].endswith('.rsp'):
-            # Pretend to build so that the rsp files are generated
-            self.build(extra_args=['-d', 'keeprsp', '-n'])
-            for each in contents:
-                # Extract the actual command from the rsp file
-                compiler, rsp = each['command'].split(' @')
-                rsp = os.path.join(self.builddir, rsp)
-                # Replace the command with its contents
-                with open(rsp, 'r', encoding='utf-8') as f:
-                    each['command'] = compiler + ' ' + f.read()
-        return contents
-
-    def get_meson_log(self):
-        with open(os.path.join(self.builddir, 'meson-logs', 'meson-log.txt')) as f:
-            return f.readlines()
-
-    def get_meson_log_compiler_checks(self):
-        '''
-        Fetch a list command-lines run by meson for compiler checks.
-        Each command-line is returned as a list of arguments.
-        '''
-        log = self.get_meson_log()
-        prefix = 'Command line:'
-        cmds = [l[len(prefix):].split() for l in log if l.startswith(prefix)]
-        return cmds
-
-    def get_meson_log_sanitychecks(self):
-        '''
-        Same as above, but for the sanity checks that were run
-        '''
-        log = self.get_meson_log()
-        prefix = 'Sanity check compiler command line:'
-        cmds = [l[len(prefix):].split() for l in log if l.startswith(prefix)]
-        return cmds
-
-    def introspect(self, args):
-        if isinstance(args, str):
-            args = [args]
-        out = subprocess.check_output(self.mintro_command + args + [self.builddir],
-                                      universal_newlines=True)
-        return json.loads(out)
-
-    def introspect_directory(self, directory, args):
-        if isinstance(args, str):
-            args = [args]
-        out = subprocess.check_output(self.mintro_command + args + [directory],
-                                      universal_newlines=True)
-        try:
-            obj = json.loads(out)
-        except Exception as e:
-            print(out)
-            raise e
-        return obj
-
-    def assertPathEqual(self, path1, path2):
-        '''
-        Handles a lot of platform-specific quirks related to paths such as
-        separator, case-sensitivity, etc.
-        '''
-        self.assertEqual(PurePath(path1), PurePath(path2))
-
-    def assertPathListEqual(self, pathlist1, pathlist2):
-        self.assertEqual(len(pathlist1), len(pathlist2))
-        worklist = list(zip(pathlist1, pathlist2))
-        for i in worklist:
-            if i[0] is None:
-                self.assertEqual(i[0], i[1])
-            else:
-                self.assertPathEqual(i[0], i[1])
-
-    def assertPathBasenameEqual(self, path, basename):
-        msg = '{!r} does not end with {!r}'.format(path, basename)
-        # We cannot use os.path.basename because it returns '' when the path
-        # ends with '/' for some silly reason. This is not how the UNIX utility
-        # `basename` works.
-        path_basename = PurePath(path).parts[-1]
-        self.assertEqual(PurePath(path_basename), PurePath(basename), msg)
-
-    def assertReconfiguredBuildIsNoop(self):
-        'Assert that we reconfigured and then there was nothing to do'
-        ret = self.build()
-        self.assertIn('The Meson build system', ret)
-        if self.backend is Backend.ninja:
-            for line in ret.split('\n'):
-                if line in self.no_rebuild_stdout:
-                    break
-            else:
-                raise AssertionError('build was reconfigured, but was not no-op')
-        elif self.backend is Backend.vs:
-            # Ensure that some target said that no rebuild was done
-            # XXX: Note CustomBuild did indeed rebuild, because of the regen checker!
-            self.assertIn('ClCompile:\n  All outputs are up-to-date.', ret)
-            self.assertIn('Link:\n  All outputs are up-to-date.', ret)
-            # Ensure that no targets were built
-            self.assertNotRegex(ret, re.compile('ClCompile:\n [^\n]*cl', flags=re.IGNORECASE))
-            self.assertNotRegex(ret, re.compile('Link:\n [^\n]*link', flags=re.IGNORECASE))
-        elif self.backend is Backend.xcode:
-            raise unittest.SkipTest('Please help us fix this test on the xcode backend')
-        else:
-            raise RuntimeError('Invalid backend: {!r}'.format(self.backend.name))
-
-    def assertBuildIsNoop(self):
-        ret = self.build()
-        if self.backend is Backend.ninja:
-            self.assertIn(ret.split('\n')[-2], self.no_rebuild_stdout)
-        elif self.backend is Backend.vs:
-            # Ensure that some target of each type said that no rebuild was done
-            # We always have at least one CustomBuild target for the regen checker
-            self.assertIn('CustomBuild:\n  All outputs are up-to-date.', ret)
-            self.assertIn('ClCompile:\n  All outputs are up-to-date.', ret)
-            self.assertIn('Link:\n  All outputs are up-to-date.', ret)
-            # Ensure that no targets were built
-            self.assertNotRegex(ret, re.compile('CustomBuild:\n [^\n]*cl', flags=re.IGNORECASE))
-            self.assertNotRegex(ret, re.compile('ClCompile:\n [^\n]*cl', flags=re.IGNORECASE))
-            self.assertNotRegex(ret, re.compile('Link:\n [^\n]*link', flags=re.IGNORECASE))
-        elif self.backend is Backend.xcode:
-            raise unittest.SkipTest('Please help us fix this test on the xcode backend')
-        else:
-            raise RuntimeError('Invalid backend: {!r}'.format(self.backend.name))
-
-    def assertRebuiltTarget(self, target):
-        ret = self.build()
-        if self.backend is Backend.ninja:
-            self.assertIn('Linking target {}'.format(target), ret)
-        elif self.backend is Backend.vs:
-            # Ensure that this target was rebuilt
-            linkre = re.compile('Link:\n [^\n]*link[^\n]*' + target, flags=re.IGNORECASE)
-            self.assertRegex(ret, linkre)
-        elif self.backend is Backend.xcode:
-            raise unittest.SkipTest('Please help us fix this test on the xcode backend')
-        else:
-            raise RuntimeError('Invalid backend: {!r}'.format(self.backend.name))
-
-    @staticmethod
-    def get_target_from_filename(filename):
-        base = os.path.splitext(filename)[0]
-        if base.startswith(('lib', 'cyg')):
-            return base[3:]
-        return base
-
-    def assertBuildRelinkedOnlyTarget(self, target):
-        ret = self.build()
-        if self.backend is Backend.ninja:
-            linked_targets = []
-            for line in ret.split('\n'):
-                if 'Linking target' in line:
-                    fname = line.rsplit('target ')[-1]
-                    linked_targets.append(self.get_target_from_filename(fname))
-            self.assertEqual(linked_targets, [target])
-        elif self.backend is Backend.vs:
-            # Ensure that this target was rebuilt
-            linkre = re.compile(r'Link:\n  [^\n]*link.exe[^\n]*/OUT:".\\([^"]*)"', flags=re.IGNORECASE)
-            matches = linkre.findall(ret)
-            self.assertEqual(len(matches), 1, msg=matches)
-            self.assertEqual(self.get_target_from_filename(matches[0]), target)
-        elif self.backend is Backend.xcode:
-            raise unittest.SkipTest('Please help us fix this test on the xcode backend')
-        else:
-            raise RuntimeError('Invalid backend: {!r}'.format(self.backend.name))
-
-    def assertPathExists(self, path):
-        m = 'Path {!r} should exist'.format(path)
-        self.assertTrue(os.path.exists(path), msg=m)
-
-    def assertPathDoesNotExist(self, path):
-        m = 'Path {!r} should not exist'.format(path)
-        self.assertFalse(os.path.exists(path), msg=m)
-
-
-class AllPlatformTests(BasePlatformTests):
-    '''
-    Tests that should run on all platforms
-    '''
-
-    def test_default_options_prefix(self):
-        '''
-        Tests that setting a prefix in default_options in project() works.
-        Can't be an ordinary test because we pass --prefix to meson there.
-        https://github.com/mesonbuild/meson/issues/1349
-        '''
-        testdir = os.path.join(self.common_test_dir, '90 default options')
-        self.init(testdir, default_args=False)
-        opts = self.introspect('--buildoptions')
-        for opt in opts:
-            if opt['name'] == 'prefix':
-                prefix = opt['value']
-        self.assertEqual(prefix, '/absoluteprefix')
-
-    def test_do_conf_file_preserve_newlines(self):
-
-        def conf_file(in_data, confdata):
-            with temp_filename() as fin:
-                with open(fin, 'wb') as fobj:
-                    fobj.write(in_data.encode('utf-8'))
-                with temp_filename() as fout:
-                    mesonbuild.mesonlib.do_conf_file(fin, fout, confdata, 'meson')
-                    with open(fout, 'rb') as fobj:
-                        return fobj.read().decode('utf-8')
-
-        confdata = {'VAR': ('foo', 'bar')}
-        self.assertEqual(conf_file('@VAR@\n@VAR@\n', confdata), 'foo\nfoo\n')
-        self.assertEqual(conf_file('@VAR@\r\n@VAR@\r\n', confdata), 'foo\r\nfoo\r\n')
-
-    def test_do_conf_file_by_format(self):
-        def conf_str(in_data, confdata, vformat):
-            (result, missing_variables, confdata_useless) = mesonbuild.mesonlib.do_conf_str(in_data, confdata, variable_format = vformat)
-            return '\n'.join(result)
-
-        def check_formats(confdata, result):
-            self.assertEqual(conf_str(['#mesondefine VAR'], confdata, 'meson'), result)
-            self.assertEqual(conf_str(['#cmakedefine VAR ${VAR}'], confdata, 'cmake'), result)
-            self.assertEqual(conf_str(['#cmakedefine VAR @VAR@'], confdata, 'cmake@'), result)
-
-        confdata = ConfigurationData()
-        # Key error as they do not exists
-        check_formats(confdata, '/* #undef VAR */\n')
-
-        # Check boolean
-        confdata.values = {'VAR': (False, 'description')}
-        check_formats(confdata, '#undef VAR\n')
-        confdata.values = {'VAR': (True, 'description')}
-        check_formats(confdata, '#define VAR\n')
-
-        # Check string
-        confdata.values = {'VAR': ('value', 'description')}
-        check_formats(confdata, '#define VAR value\n')
-
-        # Check integer
-        confdata.values = {'VAR': (10, 'description')}
-        check_formats(confdata, '#define VAR 10\n')
-
-        # Check multiple string with cmake formats
-        confdata.values = {'VAR': ('value', 'description')}
-        self.assertEqual(conf_str(['#cmakedefine VAR xxx @VAR@ yyy @VAR@'], confdata, 'cmake@'), '#define VAR xxx value yyy value\n')
-        self.assertEqual(conf_str(['#define VAR xxx @VAR@ yyy @VAR@'], confdata, 'cmake@'), '#define VAR xxx value yyy value')
-        self.assertEqual(conf_str(['#cmakedefine VAR xxx ${VAR} yyy ${VAR}'], confdata, 'cmake'), '#define VAR xxx value yyy value\n')
-        self.assertEqual(conf_str(['#define VAR xxx ${VAR} yyy ${VAR}'], confdata, 'cmake'), '#define VAR xxx value yyy value')
-
-        # Handles meson format exceptions
-        #   Unknown format
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#mesondefine VAR xxx'], confdata, 'unknown_format')
-        #   More than 2 params in mesondefine
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#mesondefine VAR xxx'], confdata, 'meson')
-        #   Mismatched line with format
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#cmakedefine VAR'], confdata, 'meson')
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#mesondefine VAR'], confdata, 'cmake')
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#mesondefine VAR'], confdata, 'cmake@')
-        #   Dict value in confdata
-        confdata.values = {'VAR': (['value'], 'description')}
-        self.assertRaises(mesonbuild.mesonlib.MesonException, conf_str, ['#mesondefine VAR'], confdata, 'meson')
-
-    def test_absolute_prefix_libdir(self):
-        '''
-        Tests that setting absolute paths for --prefix and --libdir work. Can't
-        be an ordinary test because these are set via the command-line.
-        https://github.com/mesonbuild/meson/issues/1341
-        https://github.com/mesonbuild/meson/issues/1345
-        '''
-        testdir = os.path.join(self.common_test_dir, '90 default options')
-        # on Windows, /someabs is *not* an absolute path
-        prefix = 'x:/someabs' if is_windows() else '/someabs'
-        libdir = 'libdir'
-        extra_args = ['--prefix=' + prefix,
-                      # This can just be a relative path, but we want to test
-                      # that passing this as an absolute path also works
-                      '--libdir=' + prefix + '/' + libdir]
-        self.init(testdir, extra_args=extra_args, default_args=False)
-        opts = self.introspect('--buildoptions')
-        for opt in opts:
-            if opt['name'] == 'prefix':
-                self.assertEqual(prefix, opt['value'])
-            elif opt['name'] == 'libdir':
-                self.assertEqual(libdir, opt['value'])
-
-    def test_libdir_must_be_inside_prefix(self):
-        '''
-        Tests that libdir is forced to be inside prefix no matter how it is set.
-        Must be a unit test for obvious reasons.
-        '''
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        # libdir being inside prefix is ok
-        if is_windows():
-            args = ['--prefix', 'x:/opt', '--libdir', 'x:/opt/lib32']
-        else:
-            args = ['--prefix', '/opt', '--libdir', '/opt/lib32']
-        self.init(testdir, extra_args=args)
-        self.wipe()
-        # libdir not being inside prefix is not ok
-        if is_windows():
-            args = ['--prefix', 'x:/usr', '--libdir', 'x:/opt/lib32']
-        else:
-            args = ['--prefix', '/usr', '--libdir', '/opt/lib32']
-        self.assertRaises(subprocess.CalledProcessError, self.init, testdir, extra_args=args)
-        self.wipe()
-        # libdir must be inside prefix even when set via mesonconf
-        self.init(testdir)
-        if is_windows():
-            self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=x:/opt', False)
-        else:
-            self.assertRaises(subprocess.CalledProcessError, self.setconf, '-Dlibdir=/opt', False)
-
-    def test_prefix_dependent_defaults(self):
-        '''
-        Tests that configured directory paths are set to prefix dependent
-        defaults.
-        '''
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        expected = {
-            '/opt': {'prefix': '/opt',
-                     'bindir': 'bin', 'datadir': 'share', 'includedir': 'include',
-                     'infodir': 'share/info',
-                     'libexecdir': 'libexec', 'localedir': 'share/locale',
-                     'localstatedir': 'var', 'mandir': 'share/man',
-                     'sbindir': 'sbin', 'sharedstatedir': 'com',
-                     'sysconfdir': 'etc'},
-            '/usr': {'prefix': '/usr',
-                     'bindir': 'bin', 'datadir': 'share', 'includedir': 'include',
-                     'infodir': 'share/info',
-                     'libexecdir': 'libexec', 'localedir': 'share/locale',
-                     'localstatedir': '/var', 'mandir': 'share/man',
-                     'sbindir': 'sbin', 'sharedstatedir': '/var/lib',
-                     'sysconfdir': '/etc'},
-            '/usr/local': {'prefix': '/usr/local',
-                           'bindir': 'bin', 'datadir': 'share',
-                           'includedir': 'include', 'infodir': 'share/info',
-                           'libexecdir': 'libexec',
-                           'localedir': 'share/locale',
-                           'localstatedir': '/var/local', 'mandir': 'share/man',
-                           'sbindir': 'sbin', 'sharedstatedir': '/var/local/lib',
-                           'sysconfdir': 'etc'},
-            # N.B. We don't check 'libdir' as it's platform dependent, see
-            # default_libdir():
-        }
-
-        if mesonbuild.mesonlib.default_prefix() == '/usr/local':
-            expected[None] = expected['/usr/local']
-
-        for prefix in expected:
-            args = []
-            if prefix:
-                args += ['--prefix', prefix]
-            self.init(testdir, extra_args=args, default_args=False)
-            opts = self.introspect('--buildoptions')
-            for opt in opts:
-                name = opt['name']
-                value = opt['value']
-                if name in expected[prefix]:
-                    self.assertEqual(value, expected[prefix][name])
-            self.wipe()
-
-    def test_default_options_prefix_dependent_defaults(self):
-        '''
-        Tests that setting a prefix in default_options in project() sets prefix
-        dependent defaults for other options, and that those defaults can
-        be overridden in default_options or by the command line.
-        '''
-        testdir = os.path.join(self.common_test_dir, '168 default options prefix dependent defaults')
-        expected = {
-            '':
-            {'prefix':         '/usr',
-             'sysconfdir':     '/etc',
-             'localstatedir':  '/var',
-             'sharedstatedir': '/sharedstate'},
-            '--prefix=/usr':
-            {'prefix':         '/usr',
-             'sysconfdir':     '/etc',
-             'localstatedir':  '/var',
-             'sharedstatedir': '/sharedstate'},
-            '--sharedstatedir=/var/state':
-            {'prefix':         '/usr',
-             'sysconfdir':     '/etc',
-             'localstatedir':  '/var',
-             'sharedstatedir': '/var/state'},
-            '--sharedstatedir=/var/state --prefix=/usr --sysconfdir=sysconf':
-            {'prefix':         '/usr',
-             'sysconfdir':     'sysconf',
-             'localstatedir':  '/var',
-             'sharedstatedir': '/var/state'},
-        }
-        for args in expected:
-            self.init(testdir, extra_args=args.split(), default_args=False)
-            opts = self.introspect('--buildoptions')
-            for opt in opts:
-                name = opt['name']
-                value = opt['value']
-                if name in expected[args]:
-                    self.assertEqual(value, expected[args][name])
-            self.wipe()
-
-    def test_clike_get_library_dirs(self):
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        for d in cc.get_library_dirs(env):
-            self.assertTrue(os.path.exists(d))
-            self.assertTrue(os.path.isdir(d))
-            self.assertTrue(os.path.isabs(d))
-
-    def test_static_library_overwrite(self):
-        '''
-        Tests that static libraries are never appended to, always overwritten.
-        Has to be a unit test because this involves building a project,
-        reconfiguring, and building it again so that `ar` is run twice on the
-        same static library.
-        https://github.com/mesonbuild/meson/issues/1355
-        '''
-        testdir = os.path.join(self.common_test_dir, '3 static')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        static_linker = env.detect_static_linker(cc)
-        if is_windows():
-            raise unittest.SkipTest('https://github.com/mesonbuild/meson/issues/1526')
-        if not isinstance(static_linker, mesonbuild.linkers.ArLinker):
-            raise unittest.SkipTest('static linker is not `ar`')
-        # Configure
-        self.init(testdir)
-        # Get name of static library
-        targets = self.introspect('--targets')
-        self.assertEqual(len(targets), 1)
-        libname = targets[0]['filename'][0]
-        # Build and get contents of static library
-        self.build()
-        before = self._run(['ar', 't', os.path.join(self.builddir, libname)]).split()
-        # Filter out non-object-file contents
-        before = [f for f in before if f.endswith(('.o', '.obj'))]
-        # Static library should contain only one object
-        self.assertEqual(len(before), 1, msg=before)
-        # Change the source to be built into the static library
-        self.setconf('-Dsource=libfile2.c')
-        self.build()
-        after = self._run(['ar', 't', os.path.join(self.builddir, libname)]).split()
-        # Filter out non-object-file contents
-        after = [f for f in after if f.endswith(('.o', '.obj'))]
-        # Static library should contain only one object
-        self.assertEqual(len(after), 1, msg=after)
-        # and the object must have changed
-        self.assertNotEqual(before, after)
-
-    def test_static_compile_order(self):
-        '''
-        Test that the order of files in a compiler command-line while compiling
-        and linking statically is deterministic. This can't be an ordinary test
-        case because we need to inspect the compiler database.
-        https://github.com/mesonbuild/meson/pull/951
-        '''
-        testdir = os.path.join(self.common_test_dir, '5 linkstatic')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        # Rules will get written out in this order
-        self.assertTrue(compdb[0]['file'].endswith("libfile.c"))
-        self.assertTrue(compdb[1]['file'].endswith("libfile2.c"))
-        self.assertTrue(compdb[2]['file'].endswith("libfile3.c"))
-        self.assertTrue(compdb[3]['file'].endswith("libfile4.c"))
-        # FIXME: We don't have access to the linker command
-
-    def test_run_target_files_path(self):
-        '''
-        Test that run_targets are run from the correct directory
-        https://github.com/mesonbuild/meson/issues/957
-        '''
-        testdir = os.path.join(self.common_test_dir, '54 run target')
-        self.init(testdir)
-        self.run_target('check_exists')
-
-    def test_install_introspection(self):
-        '''
-        Tests that the Meson introspection API exposes install filenames correctly
-        https://github.com/mesonbuild/meson/issues/829
-        '''
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('{!r} backend can\'t install files'.format(self.backend.name))
-        testdir = os.path.join(self.common_test_dir, '8 install')
-        self.init(testdir)
-        intro = self.introspect('--targets')
-        if intro[0]['type'] == 'executable':
-            intro = intro[::-1]
-        self.assertPathListEqual(intro[0]['install_filename'], ['/usr/lib/libstat.a'])
-        self.assertPathListEqual(intro[1]['install_filename'], ['/usr/bin/prog' + exe_suffix])
-
-    def test_install_subdir_introspection(self):
-        '''
-        Test that the Meson introspection API also contains subdir install information
-        https://github.com/mesonbuild/meson/issues/5556
-        '''
-        testdir = os.path.join(self.common_test_dir, '62 install subdir')
-        self.init(testdir)
-        intro = self.introspect('--installed')
-        expected = {
-            'sub2': 'share/sub2',
-            'subdir/sub1': 'share/sub1',
-            'subdir/sub_elided': 'share',
-            'sub1': 'share/sub1',
-            'sub/sub1': 'share/sub1',
-            'sub_elided': 'share',
-            'nested_elided/sub': 'share',
-        }
-
-        self.assertEqual(len(intro), len(expected))
-
-        # Convert expected to PurePath
-        expected_converted = {PurePath(os.path.join(testdir, key)): PurePath(os.path.join(self.prefix, val)) for key, val in expected.items()}
-        intro_converted = {PurePath(key): PurePath(val) for key, val in intro.items()}
-
-        for src, dst in expected_converted.items():
-            self.assertIn(src, intro_converted)
-            self.assertEqual(dst, intro_converted[src])
-
-    def test_install_introspection_multiple_outputs(self):
-        '''
-        Tests that the Meson introspection API exposes multiple install filenames correctly without crashing
-        https://github.com/mesonbuild/meson/pull/4555
-
-        Reverted to the first file only because of https://github.com/mesonbuild/meson/pull/4547#discussion_r244173438
-        TODO Change the format to a list officially in a followup PR
-        '''
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('{!r} backend can\'t install files'.format(self.backend.name))
-        testdir = os.path.join(self.common_test_dir, '144 custom target multiple outputs')
-        self.init(testdir)
-        intro = self.introspect('--targets')
-        if intro[0]['type'] == 'executable':
-            intro = intro[::-1]
-        self.assertPathListEqual(intro[0]['install_filename'], ['/usr/include/diff.h', '/usr/bin/diff.sh'])
-        self.assertPathListEqual(intro[1]['install_filename'], ['/opt/same.h', '/opt/same.sh'])
-        self.assertPathListEqual(intro[2]['install_filename'], ['/usr/include/first.h', None])
-        self.assertPathListEqual(intro[3]['install_filename'], [None, '/usr/bin/second.sh'])
-
-    def test_install_log_content(self):
-        '''
-        Tests that the install-log.txt is consistent with the installed files and directories.
-        Specifically checks that the log file only contains one entry per file/directory.
-        https://github.com/mesonbuild/meson/issues/4499
-        '''
-        testdir = os.path.join(self.common_test_dir, '62 install subdir')
-        self.init(testdir)
-        self.install()
-        installpath = Path(self.installdir)
-        # Find installed files and directories
-        expected = {installpath: 0}
-        for name in installpath.rglob('*'):
-            expected[name] = 0
-        # Find logged files and directories
-        with Path(self.builddir, 'meson-logs', 'install-log.txt').open() as f:
-            logged = list(map(lambda l: Path(l.strip()),
-                              filter(lambda l: not l.startswith('#'),
-                                     f.readlines())))
-        for name in logged:
-            self.assertTrue(name in expected, 'Log contains extra entry {}'.format(name))
-            expected[name] += 1
-
-        for name, count in expected.items():
-            self.assertGreater(count, 0, 'Log is missing entry for {}'.format(name))
-            self.assertLess(count, 2, 'Log has multiple entries for {}'.format(name))
-
-    def test_uninstall(self):
-        exename = os.path.join(self.installdir, 'usr/bin/prog' + exe_suffix)
-        testdir = os.path.join(self.common_test_dir, '8 install')
-        self.init(testdir)
-        self.assertPathDoesNotExist(exename)
-        self.install()
-        self.assertPathExists(exename)
-        self.uninstall()
-        self.assertPathDoesNotExist(exename)
-
-    def test_forcefallback(self):
-        testdir = os.path.join(self.unit_test_dir, '31 forcefallback')
-        self.init(testdir, extra_args=['--wrap-mode=forcefallback'])
-        self.build()
-        self.run_tests()
-
-    def test_force_fallback_for(self):
-        testdir = os.path.join(self.unit_test_dir, '31 forcefallback')
-        self.init(testdir, extra_args=['--force-fallback-for=zlib,foo'])
-        self.build()
-        self.run_tests()
-
-    def test_env_ops_dont_stack(self):
-        '''
-        Test that env ops prepend/append do not stack, and that this usage issues a warning
-        '''
-        testdir = os.path.join(self.unit_test_dir, '63 test env does not stack')
-        out = self.init(testdir)
-        self.assertRegex(out, r'WARNING: Overriding.*TEST_VAR_APPEND')
-        self.assertRegex(out, r'WARNING: Overriding.*TEST_VAR_PREPEND')
-        self.assertNotRegex(out, r'WARNING: Overriding.*TEST_VAR_SET')
-        self.run_tests()
-
-    def test_testsetups(self):
-        if not shutil.which('valgrind'):
-            raise unittest.SkipTest('Valgrind not installed.')
-        testdir = os.path.join(self.unit_test_dir, '2 testsetups')
-        self.init(testdir)
-        self.build()
-        # Run tests without setup
-        self.run_tests()
-        with open(os.path.join(self.logdir, 'testlog.txt')) as f:
-            basic_log = f.read()
-        # Run buggy test with setup that has env that will make it fail
-        self.assertRaises(subprocess.CalledProcessError,
-                          self._run, self.mtest_command + ['--setup=valgrind'])
-        with open(os.path.join(self.logdir, 'testlog-valgrind.txt')) as f:
-            vg_log = f.read()
-        self.assertFalse('TEST_ENV is set' in basic_log)
-        self.assertFalse('Memcheck' in basic_log)
-        self.assertTrue('TEST_ENV is set' in vg_log)
-        self.assertTrue('Memcheck' in vg_log)
-        # Run buggy test with setup without env that will pass
-        self._run(self.mtest_command + ['--setup=wrapper'])
-        # Setup with no properties works
-        self._run(self.mtest_command + ['--setup=empty'])
-        # Setup with only env works
-        self._run(self.mtest_command + ['--setup=onlyenv'])
-        self._run(self.mtest_command + ['--setup=onlyenv2'])
-        self._run(self.mtest_command + ['--setup=onlyenv3'])
-        # Setup with only a timeout works
-        self._run(self.mtest_command + ['--setup=timeout'])
-
-    def test_testsetup_selection(self):
-        testdir = os.path.join(self.unit_test_dir, '14 testsetup selection')
-        self.init(testdir)
-        self.build()
-
-        # Run tests without setup
-        self.run_tests()
-
-        self.assertRaises(subprocess.CalledProcessError, self._run, self.mtest_command + ['--setup=missingfromfoo'])
-        self._run(self.mtest_command + ['--setup=missingfromfoo', '--no-suite=foo:'])
-
-        self._run(self.mtest_command + ['--setup=worksforall'])
-        self._run(self.mtest_command + ['--setup=main:worksforall'])
-
-        self.assertRaises(subprocess.CalledProcessError, self._run,
-                          self.mtest_command + ['--setup=onlyinbar'])
-        self.assertRaises(subprocess.CalledProcessError, self._run,
-                          self.mtest_command + ['--setup=onlyinbar', '--no-suite=main:'])
-        self._run(self.mtest_command + ['--setup=onlyinbar', '--no-suite=main:', '--no-suite=foo:'])
-        self._run(self.mtest_command + ['--setup=bar:onlyinbar'])
-        self.assertRaises(subprocess.CalledProcessError, self._run,
-                          self.mtest_command + ['--setup=foo:onlyinbar'])
-        self.assertRaises(subprocess.CalledProcessError, self._run,
-                          self.mtest_command + ['--setup=main:onlyinbar'])
-
-    def test_testsetup_default(self):
-        testdir = os.path.join(self.unit_test_dir, '49 testsetup default')
-        self.init(testdir)
-        self.build()
-
-        # Run tests without --setup will cause the default setup to be used
-        self.run_tests()
-        with open(os.path.join(self.logdir, 'testlog.txt')) as f:
-            default_log = f.read()
-
-        # Run tests with explicitly using the same setup that is set as default
-        self._run(self.mtest_command + ['--setup=mydefault'])
-        with open(os.path.join(self.logdir, 'testlog-mydefault.txt')) as f:
-            mydefault_log = f.read()
-
-        # Run tests with another setup
-        self._run(self.mtest_command + ['--setup=other'])
-        with open(os.path.join(self.logdir, 'testlog-other.txt')) as f:
-            other_log = f.read()
-
-        self.assertTrue('ENV_A is 1' in default_log)
-        self.assertTrue('ENV_B is 2' in default_log)
-        self.assertTrue('ENV_C is 2' in default_log)
-
-        self.assertTrue('ENV_A is 1' in mydefault_log)
-        self.assertTrue('ENV_B is 2' in mydefault_log)
-        self.assertTrue('ENV_C is 2' in mydefault_log)
-
-        self.assertTrue('ENV_A is 1' in other_log)
-        self.assertTrue('ENV_B is 3' in other_log)
-        self.assertTrue('ENV_C is 2' in other_log)
-
-    def assertFailedTestCount(self, failure_count, command):
-        try:
-            self._run(command)
-            self.assertEqual(0, failure_count, 'Expected %d tests to fail.' % failure_count)
-        except subprocess.CalledProcessError as e:
-            self.assertEqual(e.returncode, failure_count)
-
-    def test_suite_selection(self):
-        testdir = os.path.join(self.unit_test_dir, '4 suite selection')
-        self.init(testdir)
-        self.build()
-
-        self.assertFailedTestCount(4, self.mtest_command)
-
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', ':success'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--suite', ':fail'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', ':success'])
-        self.assertFailedTestCount(1, self.mtest_command + ['--no-suite', ':fail'])
-
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'mainprj'])
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc'])
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail'])
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjmix'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'mainprj'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjfail'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjmix'])
-
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'mainprj:fail'])
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'mainprj:success'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'mainprj:fail'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'mainprj:success'])
-
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail:fail'])
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjfail:success'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjfail:fail'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjfail:success'])
-
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc:fail'])
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjsucc:success'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc:fail'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjsucc:success'])
-
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjmix:fail'])
-        self.assertFailedTestCount(0, self.mtest_command + ['--suite', 'subprjmix:success'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--no-suite', 'subprjmix:fail'])
-        self.assertFailedTestCount(4, self.mtest_command + ['--no-suite', 'subprjmix:success'])
-
-        self.assertFailedTestCount(2, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix:fail'])
-        self.assertFailedTestCount(3, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj'])
-        self.assertFailedTestCount(2, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj', '--no-suite', 'subprjmix:fail'])
-        self.assertFailedTestCount(1, self.mtest_command + ['--suite', 'subprjfail', '--suite', 'subprjmix', '--suite', 'mainprj', '--no-suite', 'subprjmix:fail', 'mainprj-failing_test'])
-
-        self.assertFailedTestCount(2, self.mtest_command + ['--no-suite', 'subprjfail:fail', '--no-suite', 'subprjmix:fail'])
-
-    def test_build_by_default(self):
-        testdir = os.path.join(self.common_test_dir, '133 build by default')
-        self.init(testdir)
-        self.build()
-        genfile1 = os.path.join(self.builddir, 'generated1.dat')
-        genfile2 = os.path.join(self.builddir, 'generated2.dat')
-        exe1 = os.path.join(self.builddir, 'fooprog' + exe_suffix)
-        exe2 = os.path.join(self.builddir, 'barprog' + exe_suffix)
-        self.assertPathExists(genfile1)
-        self.assertPathExists(genfile2)
-        self.assertPathDoesNotExist(exe1)
-        self.assertPathDoesNotExist(exe2)
-        self.build(target=('fooprog' + exe_suffix))
-        self.assertPathExists(exe1)
-        self.build(target=('barprog' + exe_suffix))
-        self.assertPathExists(exe2)
-
-    def test_internal_include_order(self):
-        if mesonbuild.environment.detect_msys2_arch() and ('MESON_RSP_THRESHOLD' in os.environ):
-            raise unittest.SkipTest('Test does not yet support gcc rsp files on msys2')
-
-        testdir = os.path.join(self.common_test_dir, '134 include order')
-        self.init(testdir)
-        execmd = fxecmd = None
-        for cmd in self.get_compdb():
-            if 'someexe' in cmd['command']:
-                execmd = cmd['command']
-                continue
-            if 'somefxe' in cmd['command']:
-                fxecmd = cmd['command']
-                continue
-        if not execmd or not fxecmd:
-            raise Exception('Could not find someexe and somfxe commands')
-        # Check include order for 'someexe'
-        incs = [a for a in split_args(execmd) if a.startswith("-I")]
-        self.assertEqual(len(incs), 9)
-        # Need to run the build so the private dir is created.
-        self.build()
-        pdirs = glob(os.path.join(self.builddir, 'sub4/someexe*.p'))
-        self.assertEqual(len(pdirs), 1)
-        privdir = pdirs[0][len(self.builddir)+1:]
-        self.assertPathEqual(incs[0], "-I" + privdir)
-        # target build subdir
-        self.assertPathEqual(incs[1], "-Isub4")
-        # target source subdir
-        self.assertPathBasenameEqual(incs[2], 'sub4')
-        # include paths added via per-target c_args: ['-I'...]
-        self.assertPathBasenameEqual(incs[3], 'sub3')
-        # target include_directories: build dir
-        self.assertPathEqual(incs[4], "-Isub2")
-        # target include_directories: source dir
-        self.assertPathBasenameEqual(incs[5], 'sub2')
-        # target internal dependency include_directories: build dir
-        self.assertPathEqual(incs[6], "-Isub1")
-        # target internal dependency include_directories: source dir
-        self.assertPathBasenameEqual(incs[7], 'sub1')
-        # custom target include dir
-        self.assertPathEqual(incs[8], '-Ictsub')
-        # Check include order for 'somefxe'
-        incs = [a for a in split_args(fxecmd) if a.startswith('-I')]
-        self.assertEqual(len(incs), 9)
-        # target private dir
-        pdirs = glob(os.path.join(self.builddir, 'somefxe*.p'))
-        self.assertEqual(len(pdirs), 1)
-        privdir = pdirs[0][len(self.builddir)+1:]
-        self.assertPathEqual(incs[0], '-I' + privdir)
-        # target build dir
-        self.assertPathEqual(incs[1], '-I.')
-        # target source dir
-        self.assertPathBasenameEqual(incs[2], os.path.basename(testdir))
-        # target internal dependency correct include_directories: build dir
-        self.assertPathEqual(incs[3], "-Isub4")
-        # target internal dependency correct include_directories: source dir
-        self.assertPathBasenameEqual(incs[4], 'sub4')
-        # target internal dependency dep include_directories: build dir
-        self.assertPathEqual(incs[5], "-Isub1")
-        # target internal dependency dep include_directories: source dir
-        self.assertPathBasenameEqual(incs[6], 'sub1')
-        # target internal dependency wrong include_directories: build dir
-        self.assertPathEqual(incs[7], "-Isub2")
-        # target internal dependency wrong include_directories: source dir
-        self.assertPathBasenameEqual(incs[8], 'sub2')
-
-    def test_compiler_detection(self):
-        '''
-        Test that automatic compiler detection and setting from the environment
-        both work just fine. This is needed because while running project tests
-        and other unit tests, we always read CC/CXX/etc from the environment.
-        '''
-        gnu = mesonbuild.compilers.GnuCompiler
-        clang = mesonbuild.compilers.ClangCompiler
-        intel = mesonbuild.compilers.IntelGnuLikeCompiler
-        msvc = (mesonbuild.compilers.VisualStudioCCompiler, mesonbuild.compilers.VisualStudioCPPCompiler)
-        clangcl = (mesonbuild.compilers.ClangClCCompiler, mesonbuild.compilers.ClangClCPPCompiler)
-        ar = mesonbuild.linkers.ArLinker
-        lib = mesonbuild.linkers.VisualStudioLinker
-        langs = [('c', 'CC'), ('cpp', 'CXX')]
-        if not is_windows() and platform.machine().lower() != 'e2k':
-            langs += [('objc', 'OBJC'), ('objcpp', 'OBJCXX')]
-        testdir = os.path.join(self.unit_test_dir, '5 compiler detection')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        for lang, evar in langs:
-            # Detect with evar and do sanity checks on that
-            if evar in os.environ:
-                ecc = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)
-                self.assertTrue(ecc.version)
-                elinker = env.detect_static_linker(ecc)
-                # Pop it so we don't use it for the next detection
-                evalue = os.environ.pop(evar)
-                # Very rough/strict heuristics. Would never work for actual
-                # compiler detection, but should be ok for the tests.
-                ebase = os.path.basename(evalue)
-                if ebase.startswith('g') or ebase.endswith(('-gcc', '-g++')):
-                    self.assertIsInstance(ecc, gnu)
-                    self.assertIsInstance(elinker, ar)
-                elif 'clang-cl' in ebase:
-                    self.assertIsInstance(ecc, clangcl)
-                    self.assertIsInstance(elinker, lib)
-                elif 'clang' in ebase:
-                    self.assertIsInstance(ecc, clang)
-                    self.assertIsInstance(elinker, ar)
-                elif ebase.startswith('ic'):
-                    self.assertIsInstance(ecc, intel)
-                    self.assertIsInstance(elinker, ar)
-                elif ebase.startswith('cl'):
-                    self.assertIsInstance(ecc, msvc)
-                    self.assertIsInstance(elinker, lib)
-                else:
-                    raise AssertionError('Unknown compiler {!r}'.format(evalue))
-                # Check that we actually used the evalue correctly as the compiler
-                self.assertEqual(ecc.get_exelist(), split_args(evalue))
-            # Do auto-detection of compiler based on platform, PATH, etc.
-            cc = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)
-            self.assertTrue(cc.version)
-            linker = env.detect_static_linker(cc)
-            # Check compiler type
-            if isinstance(cc, gnu):
-                self.assertIsInstance(linker, ar)
-                if is_osx():
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.AppleDynamicLinker)
-                elif is_sunos():
-                    self.assertIsInstance(cc.linker, (mesonbuild.linkers.SolarisDynamicLinker, mesonbuild.linkers.GnuLikeDynamicLinkerMixin))
-                else:
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.GnuLikeDynamicLinkerMixin)
-            if isinstance(cc, clangcl):
-                self.assertIsInstance(linker, lib)
-                self.assertIsInstance(cc.linker, mesonbuild.linkers.ClangClDynamicLinker)
-            if isinstance(cc, clang):
-                self.assertIsInstance(linker, ar)
-                if is_osx():
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.AppleDynamicLinker)
-                elif is_windows():
-                    # This is clang, not clang-cl
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.MSVCDynamicLinker)
-                else:
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.GnuLikeDynamicLinkerMixin)
-            if isinstance(cc, intel):
-                self.assertIsInstance(linker, ar)
-                if is_osx():
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.AppleDynamicLinker)
-                elif is_windows():
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.XilinkDynamicLinker)
-                else:
-                    self.assertIsInstance(cc.linker, mesonbuild.linkers.GnuDynamicLinker)
-            if isinstance(cc, msvc):
-                self.assertTrue(is_windows())
-                self.assertIsInstance(linker, lib)
-                self.assertEqual(cc.id, 'msvc')
-                self.assertTrue(hasattr(cc, 'is_64'))
-                self.assertIsInstance(cc.linker, mesonbuild.linkers.MSVCDynamicLinker)
-                # If we're on Windows CI, we know what the compiler will be
-                if 'arch' in os.environ:
-                    if os.environ['arch'] == 'x64':
-                        self.assertTrue(cc.is_64)
-                    else:
-                        self.assertFalse(cc.is_64)
-            # Set evar ourselves to a wrapper script that just calls the same
-            # exelist + some argument. This is meant to test that setting
-            # something like `ccache gcc -pipe` or `distcc ccache gcc` works.
-            wrapper = os.path.join(testdir, 'compiler wrapper.py')
-            wrappercc = python_command + [wrapper] + cc.get_exelist() + ['-DSOME_ARG']
-            wrappercc_s = ''
-            for w in wrappercc:
-                wrappercc_s += quote_arg(w) + ' '
-            os.environ[evar] = wrappercc_s
-            wcc = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)
-            # Check static linker too
-            wrapperlinker = python_command + [wrapper] + linker.get_exelist() + linker.get_always_args()
-            wrapperlinker_s = ''
-            for w in wrapperlinker:
-                wrapperlinker_s += quote_arg(w) + ' '
-            os.environ['AR'] = wrapperlinker_s
-            wlinker = env.detect_static_linker(wcc)
-            # Pop it so we don't use it for the next detection
-            evalue = os.environ.pop('AR')
-            # Must be the same type since it's a wrapper around the same exelist
-            self.assertIs(type(cc), type(wcc))
-            self.assertIs(type(linker), type(wlinker))
-            # Ensure that the exelist is correct
-            self.assertEqual(wcc.get_exelist(), wrappercc)
-            self.assertEqual(wlinker.get_exelist(), wrapperlinker)
-            # Ensure that the version detection worked correctly
-            self.assertEqual(cc.version, wcc.version)
-            if hasattr(cc, 'is_64'):
-                self.assertEqual(cc.is_64, wcc.is_64)
-
-    def test_always_prefer_c_compiler_for_asm(self):
-        testdir = os.path.join(self.common_test_dir, '137 c cpp and asm')
-        # Skip if building with MSVC
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        if env.detect_c_compiler(MachineChoice.HOST).get_id() == 'msvc':
-            raise unittest.SkipTest('MSVC can\'t compile assembly')
-        self.init(testdir)
-        commands = {'c-asm': {}, 'cpp-asm': {}, 'cpp-c-asm': {}, 'c-cpp-asm': {}}
-        for cmd in self.get_compdb():
-            # Get compiler
-            split = split_args(cmd['command'])
-            if split[0] == 'ccache':
-                compiler = split[1]
-            else:
-                compiler = split[0]
-            # Classify commands
-            if 'Ic-asm' in cmd['command']:
-                if cmd['file'].endswith('.S'):
-                    commands['c-asm']['asm'] = compiler
-                elif cmd['file'].endswith('.c'):
-                    commands['c-asm']['c'] = compiler
-                else:
-                    raise AssertionError('{!r} found in cpp-asm?'.format(cmd['command']))
-            elif 'Icpp-asm' in cmd['command']:
-                if cmd['file'].endswith('.S'):
-                    commands['cpp-asm']['asm'] = compiler
-                elif cmd['file'].endswith('.cpp'):
-                    commands['cpp-asm']['cpp'] = compiler
-                else:
-                    raise AssertionError('{!r} found in cpp-asm?'.format(cmd['command']))
-            elif 'Ic-cpp-asm' in cmd['command']:
-                if cmd['file'].endswith('.S'):
-                    commands['c-cpp-asm']['asm'] = compiler
-                elif cmd['file'].endswith('.c'):
-                    commands['c-cpp-asm']['c'] = compiler
-                elif cmd['file'].endswith('.cpp'):
-                    commands['c-cpp-asm']['cpp'] = compiler
-                else:
-                    raise AssertionError('{!r} found in c-cpp-asm?'.format(cmd['command']))
-            elif 'Icpp-c-asm' in cmd['command']:
-                if cmd['file'].endswith('.S'):
-                    commands['cpp-c-asm']['asm'] = compiler
-                elif cmd['file'].endswith('.c'):
-                    commands['cpp-c-asm']['c'] = compiler
-                elif cmd['file'].endswith('.cpp'):
-                    commands['cpp-c-asm']['cpp'] = compiler
-                else:
-                    raise AssertionError('{!r} found in cpp-c-asm?'.format(cmd['command']))
-            else:
-                raise AssertionError('Unknown command {!r} found'.format(cmd['command']))
-        # Check that .S files are always built with the C compiler
-        self.assertEqual(commands['c-asm']['asm'], commands['c-asm']['c'])
-        self.assertEqual(commands['c-asm']['asm'], commands['cpp-asm']['asm'])
-        self.assertEqual(commands['cpp-asm']['asm'], commands['c-cpp-asm']['c'])
-        self.assertEqual(commands['c-cpp-asm']['asm'], commands['c-cpp-asm']['c'])
-        self.assertEqual(commands['cpp-c-asm']['asm'], commands['cpp-c-asm']['c'])
-        self.assertNotEqual(commands['cpp-asm']['asm'], commands['cpp-asm']['cpp'])
-        self.assertNotEqual(commands['c-cpp-asm']['c'], commands['c-cpp-asm']['cpp'])
-        self.assertNotEqual(commands['cpp-c-asm']['c'], commands['cpp-c-asm']['cpp'])
-        # Check that the c-asm target is always linked with the C linker
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            contents = f.read()
-            m = re.search('build c-asm.*: c_LINKER', contents)
-        self.assertIsNotNone(m, msg=contents)
-
-    def test_preprocessor_checks_CPPFLAGS(self):
-        '''
-        Test that preprocessor compiler checks read CPPFLAGS and also CFLAGS but
-        not LDFLAGS.
-        '''
-        testdir = os.path.join(self.common_test_dir, '136 get define')
-        define = 'MESON_TEST_DEFINE_VALUE'
-        # NOTE: this list can't have \n, ' or "
-        # \n is never substituted by the GNU pre-processor via a -D define
-        # ' and " confuse split_args() even when they are escaped
-        # % and # confuse the MSVC preprocessor
-        # !, ^, *, and < confuse lcc preprocessor
-        value = 'spaces and fun@$&()-=_+{}[]:;>?,./~`'
-        for env_var in ['CPPFLAGS', 'CFLAGS']:
-            env = {}
-            env[env_var] = '-D{}="{}"'.format(define, value)
-            env['LDFLAGS'] = '-DMESON_FAIL_VALUE=cflags-read'.format(define)
-            self.init(testdir, extra_args=['-D{}={}'.format(define, value)], override_envvars=env)
-
-    def test_custom_target_exe_data_deterministic(self):
-        testdir = os.path.join(self.common_test_dir, '113 custom target capture')
-        self.init(testdir)
-        meson_exe_dat1 = glob(os.path.join(self.privatedir, 'meson_exe*.dat'))
-        self.wipe()
-        self.init(testdir)
-        meson_exe_dat2 = glob(os.path.join(self.privatedir, 'meson_exe*.dat'))
-        self.assertListEqual(meson_exe_dat1, meson_exe_dat2)
-
-    def test_noop_changes_cause_no_rebuilds(self):
-        '''
-        Test that no-op changes to the build files such as mtime do not cause
-        a rebuild of anything.
-        '''
-        testdir = os.path.join(self.common_test_dir, '6 linkshared')
-        self.init(testdir)
-        self.build()
-        # Immediately rebuilding should not do anything
-        self.assertBuildIsNoop()
-        # Changing mtime of meson.build should not rebuild anything
-        self.utime(os.path.join(testdir, 'meson.build'))
-        self.assertReconfiguredBuildIsNoop()
-        # Changing mtime of libefile.c should rebuild the library, but not relink the executable
-        self.utime(os.path.join(testdir, 'libfile.c'))
-        self.assertBuildRelinkedOnlyTarget('mylib')
-
-    def test_source_changes_cause_rebuild(self):
-        '''
-        Test that changes to sources and headers cause rebuilds, but not
-        changes to unused files (as determined by the dependency file) in the
-        input files list.
-        '''
-        testdir = os.path.join(self.common_test_dir, '20 header in file list')
-        self.init(testdir)
-        self.build()
-        # Immediately rebuilding should not do anything
-        self.assertBuildIsNoop()
-        # Changing mtime of header.h should rebuild everything
-        self.utime(os.path.join(testdir, 'header.h'))
-        self.assertBuildRelinkedOnlyTarget('prog')
-
-    def test_custom_target_changes_cause_rebuild(self):
-        '''
-        Test that in a custom target, changes to the input files, the
-        ExternalProgram, and any File objects on the command-line cause
-        a rebuild.
-        '''
-        testdir = os.path.join(self.common_test_dir, '60 custom header generator')
-        self.init(testdir)
-        self.build()
-        # Immediately rebuilding should not do anything
-        self.assertBuildIsNoop()
-        # Changing mtime of these should rebuild everything
-        for f in ('input.def', 'makeheader.py', 'somefile.txt'):
-            self.utime(os.path.join(testdir, f))
-            self.assertBuildRelinkedOnlyTarget('prog')
-
-    def test_source_generator_program_cause_rebuild(self):
-        '''
-        Test that changes to generator programs in the source tree cause
-        a rebuild.
-        '''
-        testdir = os.path.join(self.common_test_dir, '94 gen extra')
-        self.init(testdir)
-        self.build()
-        # Immediately rebuilding should not do anything
-        self.assertBuildIsNoop()
-        # Changing mtime of generator should rebuild the executable
-        self.utime(os.path.join(testdir, 'srcgen.py'))
-        self.assertRebuiltTarget('basic')
-
-    def test_static_library_lto(self):
-        '''
-        Test that static libraries can be built with LTO and linked to
-        executables. On Linux, this requires the use of gcc-ar.
-        https://github.com/mesonbuild/meson/issues/1646
-        '''
-        testdir = os.path.join(self.common_test_dir, '5 linkstatic')
-
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        if env.detect_c_compiler(MachineChoice.HOST).get_id() == 'clang' and is_windows():
-            raise unittest.SkipTest('LTO not (yet) supported by windows clang')
-
-        self.init(testdir, extra_args='-Db_lto=true')
-        self.build()
-        self.run_tests()
-
-    def test_dist_git(self):
-        if not shutil.which('git'):
-            raise unittest.SkipTest('Git not found')
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Dist is only supported with Ninja')
-
-        try:
-            self.dist_impl(_git_init)
-        except PermissionError:
-            # When run under Windows CI, something (virus scanner?)
-            # holds on to the git files so cleaning up the dir
-            # fails sometimes.
-            pass
-
-    def has_working_hg(self):
-        if not shutil.which('hg'):
-            return False
-        try:
-            # This check should not be necessary, but
-            # CI under macOS passes the above test even
-            # though Mercurial is not installed.
-            if subprocess.call(['hg', '--version'],
-                               stdout=subprocess.DEVNULL,
-                               stderr=subprocess.DEVNULL) != 0:
-                return False
-            return True
-        except FileNotFoundError:
-            return False
-
-
-    def test_dist_hg(self):
-        if not self.has_working_hg():
-            raise unittest.SkipTest('Mercurial not found or broken.')
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Dist is only supported with Ninja')
-
-        def hg_init(project_dir):
-            subprocess.check_call(['hg', 'init'], cwd=project_dir)
-            with open(os.path.join(project_dir, '.hg', 'hgrc'), 'w') as f:
-                print('[ui]', file=f)
-                print('username=Author Person <teh_coderz@example.com>', file=f)
-            subprocess.check_call(['hg', 'add', 'meson.build', 'distexe.c'], cwd=project_dir)
-            subprocess.check_call(['hg', 'commit', '-m', 'I am a project'], cwd=project_dir)
-
-        try:
-            self.dist_impl(hg_init, include_subprojects=False)
-        except PermissionError:
-            # When run under Windows CI, something (virus scanner?)
-            # holds on to the hg files so cleaning up the dir
-            # fails sometimes.
-            pass
-
-    def test_dist_git_script(self):
-        if not shutil.which('git'):
-            raise unittest.SkipTest('Git not found')
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Dist is only supported with Ninja')
-
-        try:
-            with tempfile.TemporaryDirectory() as tmpdir:
-                project_dir = os.path.join(tmpdir, 'a')
-                shutil.copytree(os.path.join(self.unit_test_dir, '35 dist script'),
-                                project_dir)
-                _git_init(project_dir)
-                self.init(project_dir)
-                self.build('dist')
-        except PermissionError:
-            # When run under Windows CI, something (virus scanner?)
-            # holds on to the git files so cleaning up the dir
-            # fails sometimes.
-            pass
-
-    def create_dummy_subproject(self, project_dir, name):
-        path = os.path.join(project_dir, 'subprojects', name)
-        os.makedirs(path)
-        with open(os.path.join(path, 'meson.build'), 'w') as ofile:
-            ofile.write("project('{}')".format(name))
-        return path
-
-    def dist_impl(self, vcs_init, include_subprojects=True):
-        # Create this on the fly because having rogue .git directories inside
-        # the source tree leads to all kinds of trouble.
-        with tempfile.TemporaryDirectory() as project_dir:
-            with open(os.path.join(project_dir, 'meson.build'), 'w') as ofile:
-                ofile.write('''project('disttest', 'c', version : '1.4.3')
-e = executable('distexe', 'distexe.c')
-test('dist test', e)
-subproject('vcssub', required : false)
-subproject('tarballsub', required : false)
-''')
-            with open(os.path.join(project_dir, 'distexe.c'), 'w') as ofile:
-                ofile.write('''#include<stdio.h>
-
-int main(int argc, char **argv) {
-    printf("I am a distribution test.\\n");
-    return 0;
-}
-''')
-            xz_distfile = os.path.join(self.distdir, 'disttest-1.4.3.tar.xz')
-            xz_checksumfile = xz_distfile + '.sha256sum'
-            zip_distfile = os.path.join(self.distdir, 'disttest-1.4.3.zip')
-            zip_checksumfile = zip_distfile + '.sha256sum'
-            vcs_init(project_dir)
-            if include_subprojects:
-                vcs_init(self.create_dummy_subproject(project_dir, 'vcssub'))
-                self.create_dummy_subproject(project_dir, 'tarballsub')
-                self.create_dummy_subproject(project_dir, 'unusedsub')
-            self.init(project_dir)
-            self.build('dist')
-            self.assertPathExists(xz_distfile)
-            self.assertPathExists(xz_checksumfile)
-            self.assertPathDoesNotExist(zip_distfile)
-            self.assertPathDoesNotExist(zip_checksumfile)
-            self._run(self.meson_command + ['dist', '--formats', 'zip'],
-                      workdir=self.builddir)
-            self.assertPathExists(zip_distfile)
-            self.assertPathExists(zip_checksumfile)
-
-            if include_subprojects:
-                z = zipfile.ZipFile(zip_distfile)
-                self.assertEqual(sorted(['disttest-1.4.3/',
-                                         'disttest-1.4.3/meson.build',
-                                         'disttest-1.4.3/distexe.c']),
-                                 sorted(z.namelist()))
-
-                self._run(self.meson_command + ['dist', '--formats', 'zip', '--include-subprojects'],
-                          workdir=self.builddir)
-                z = zipfile.ZipFile(zip_distfile)
-                self.assertEqual(sorted(['disttest-1.4.3/',
-                                         'disttest-1.4.3/subprojects/',
-                                         'disttest-1.4.3/meson.build',
-                                         'disttest-1.4.3/distexe.c',
-                                         'disttest-1.4.3/subprojects/tarballsub/',
-                                         'disttest-1.4.3/subprojects/vcssub/',
-                                         'disttest-1.4.3/subprojects/tarballsub/meson.build',
-                                         'disttest-1.4.3/subprojects/vcssub/meson.build']),
-                                 sorted(z.namelist()))
-
-    def test_rpath_uses_ORIGIN(self):
-        '''
-        Test that built targets use $ORIGIN in rpath, which ensures that they
-        are relocatable and ensures that builds are reproducible since the
-        build directory won't get embedded into the built binaries.
-        '''
-        if is_windows() or is_cygwin():
-            raise unittest.SkipTest('Windows PE/COFF binaries do not use RPATH')
-        testdir = os.path.join(self.common_test_dir, '42 library chain')
-        self.init(testdir)
-        self.build()
-        for each in ('prog', 'subdir/liblib1.so', ):
-            rpath = get_rpath(os.path.join(self.builddir, each))
-            self.assertTrue(rpath, 'Rpath could not be determined for {}.'.format(each))
-            if is_dragonflybsd():
-                # DragonflyBSD will prepend /usr/lib/gccVERSION to the rpath,
-                # so ignore that.
-                self.assertTrue(rpath.startswith('/usr/lib/gcc'))
-                rpaths = rpath.split(':')[1:]
-            else:
-                rpaths = rpath.split(':')
-            for path in rpaths:
-                self.assertTrue(path.startswith('$ORIGIN'), msg=(each, path))
-        # These two don't link to anything else, so they do not need an rpath entry.
-        for each in ('subdir/subdir2/liblib2.so', 'subdir/subdir3/liblib3.so'):
-            rpath = get_rpath(os.path.join(self.builddir, each))
-            if is_dragonflybsd():
-                # The rpath should be equal to /usr/lib/gccVERSION
-                self.assertTrue(rpath.startswith('/usr/lib/gcc'))
-                self.assertEqual(len(rpath.split(':')), 1)
-            else:
-                self.assertTrue(rpath is None)
-
-    def test_dash_d_dedup(self):
-        testdir = os.path.join(self.unit_test_dir, '9 d dedup')
-        self.init(testdir)
-        cmd = self.get_compdb()[0]['command']
-        self.assertTrue('-D FOO -D BAR' in cmd or
-                        '"-D" "FOO" "-D" "BAR"' in cmd or
-                        '/D FOO /D BAR' in cmd or
-                        '"/D" "FOO" "/D" "BAR"' in cmd)
-
-    def test_all_forbidden_targets_tested(self):
-        '''
-        Test that all forbidden targets are tested in the '154 reserved targets'
-        test. Needs to be a unit test because it accesses Meson internals.
-        '''
-        testdir = os.path.join(self.common_test_dir, '154 reserved targets')
-        targets = mesonbuild.coredata.forbidden_target_names
-        # We don't actually define a target with this name
-        targets.pop('build.ninja')
-        # Remove this to avoid multiple entries with the same name
-        # but different case.
-        targets.pop('PHONY')
-        for i in targets:
-            self.assertPathExists(os.path.join(testdir, i))
-
-    def detect_prebuild_env(self):
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        stlinker = env.detect_static_linker(cc)
-        if mesonbuild.mesonlib.is_windows():
-            object_suffix = 'obj'
-            shared_suffix = 'dll'
-        elif mesonbuild.mesonlib.is_cygwin():
-            object_suffix = 'o'
-            shared_suffix = 'dll'
-        elif mesonbuild.mesonlib.is_osx():
-            object_suffix = 'o'
-            shared_suffix = 'dylib'
-        else:
-            object_suffix = 'o'
-            shared_suffix = 'so'
-        return (cc, stlinker, object_suffix, shared_suffix)
-
-    def pbcompile(self, compiler, source, objectfile, extra_args=None):
-        cmd = compiler.get_exelist()
-        extra_args = extra_args or []
-        if compiler.get_argument_syntax() == 'msvc':
-            cmd += ['/nologo', '/Fo' + objectfile, '/c', source] + extra_args
-        else:
-            cmd += ['-c', source, '-o', objectfile] + extra_args
-        subprocess.check_call(cmd, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
-
-    def test_prebuilt_object(self):
-        (compiler, _, object_suffix, _) = self.detect_prebuild_env()
-        tdir = os.path.join(self.unit_test_dir, '15 prebuilt object')
-        source = os.path.join(tdir, 'source.c')
-        objectfile = os.path.join(tdir, 'prebuilt.' + object_suffix)
-        self.pbcompile(compiler, source, objectfile)
-        try:
-            self.init(tdir)
-            self.build()
-            self.run_tests()
-        finally:
-            os.unlink(objectfile)
-
-    def build_static_lib(self, compiler, linker, source, objectfile, outfile, extra_args=None):
-        if extra_args is None:
-            extra_args = []
-        if compiler.get_argument_syntax() == 'msvc':
-            link_cmd = ['lib', '/NOLOGO', '/OUT:' + outfile, objectfile]
-        else:
-            link_cmd = ['ar', 'csr', outfile, objectfile]
-        link_cmd = linker.get_exelist()
-        link_cmd += linker.get_always_args()
-        link_cmd += linker.get_std_link_args()
-        link_cmd += linker.get_output_args(outfile)
-        link_cmd += [objectfile]
-        self.pbcompile(compiler, source, objectfile, extra_args=extra_args)
-        try:
-            subprocess.check_call(link_cmd)
-        finally:
-            os.unlink(objectfile)
-
-    def test_prebuilt_static_lib(self):
-        (cc, stlinker, object_suffix, _) = self.detect_prebuild_env()
-        tdir = os.path.join(self.unit_test_dir, '16 prebuilt static')
-        source = os.path.join(tdir, 'libdir/best.c')
-        objectfile = os.path.join(tdir, 'libdir/best.' + object_suffix)
-        stlibfile = os.path.join(tdir, 'libdir/libbest.a')
-        self.build_static_lib(cc, stlinker, source, objectfile, stlibfile)
-        # Run the test
-        try:
-            self.init(tdir)
-            self.build()
-            self.run_tests()
-        finally:
-            os.unlink(stlibfile)
-
-    def build_shared_lib(self, compiler, source, objectfile, outfile, impfile, extra_args=None):
-        if extra_args is None:
-            extra_args = []
-        if compiler.get_argument_syntax() == 'msvc':
-            link_cmd = compiler.get_linker_exelist() + [
-                '/NOLOGO', '/DLL', '/DEBUG', '/IMPLIB:' + impfile,
-                '/OUT:' + outfile, objectfile]
-        else:
-            if not (compiler.info.is_windows() or compiler.info.is_cygwin() or compiler.info.is_darwin()):
-                extra_args += ['-fPIC']
-            link_cmd = compiler.get_exelist() + ['-shared', '-o', outfile, objectfile]
-            if not mesonbuild.mesonlib.is_osx():
-                link_cmd += ['-Wl,-soname=' + os.path.basename(outfile)]
-        self.pbcompile(compiler, source, objectfile, extra_args=extra_args)
-        try:
-            subprocess.check_call(link_cmd)
-        finally:
-            os.unlink(objectfile)
-
-    def test_prebuilt_shared_lib(self):
-        (cc, _, object_suffix, shared_suffix) = self.detect_prebuild_env()
-        tdir = os.path.join(self.unit_test_dir, '17 prebuilt shared')
-        source = os.path.join(tdir, 'alexandria.c')
-        objectfile = os.path.join(tdir, 'alexandria.' + object_suffix)
-        impfile = os.path.join(tdir, 'alexandria.lib')
-        if cc.get_argument_syntax() == 'msvc':
-            shlibfile = os.path.join(tdir, 'alexandria.' + shared_suffix)
-        elif is_cygwin():
-            shlibfile = os.path.join(tdir, 'cygalexandria.' + shared_suffix)
-        else:
-            shlibfile = os.path.join(tdir, 'libalexandria.' + shared_suffix)
-        self.build_shared_lib(cc, source, objectfile, shlibfile, impfile)
-        # Run the test
-        try:
-            self.init(tdir)
-            self.build()
-            self.run_tests()
-        finally:
-            os.unlink(shlibfile)
-            if mesonbuild.mesonlib.is_windows():
-                # Clean up all the garbage MSVC writes in the
-                # source tree.
-                for fname in glob(os.path.join(tdir, 'alexandria.*')):
-                    if os.path.splitext(fname)[1] not in ['.c', '.h']:
-                        os.unlink(fname)
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_static(self):
-        '''
-        Test that the we prefer static libraries when `static: true` is
-        passed to dependency() with pkg-config. Can't be an ordinary test
-        because we need to build libs and try to find them from meson.build
-
-        Also test that it's not a hard error to have unsatisfiable library deps
-        since system libraries -lm will never be found statically.
-        https://github.com/mesonbuild/meson/issues/2785
-        '''
-        (cc, stlinker, objext, shext) = self.detect_prebuild_env()
-        testdir = os.path.join(self.unit_test_dir, '18 pkgconfig static')
-        source = os.path.join(testdir, 'foo.c')
-        objectfile = os.path.join(testdir, 'foo.' + objext)
-        stlibfile = os.path.join(testdir, 'libfoo.a')
-        impfile = os.path.join(testdir, 'foo.lib')
-        if cc.get_argument_syntax() == 'msvc':
-            shlibfile = os.path.join(testdir, 'foo.' + shext)
-        elif is_cygwin():
-            shlibfile = os.path.join(testdir, 'cygfoo.' + shext)
-        else:
-            shlibfile = os.path.join(testdir, 'libfoo.' + shext)
-        # Build libs
-        self.build_static_lib(cc, stlinker, source, objectfile, stlibfile, extra_args=['-DFOO_STATIC'])
-        self.build_shared_lib(cc, source, objectfile, shlibfile, impfile)
-        # Run test
-        try:
-            self.init(testdir, override_envvars={'PKG_CONFIG_LIBDIR': self.builddir})
-            self.build()
-            self.run_tests()
-        finally:
-            os.unlink(stlibfile)
-            os.unlink(shlibfile)
-            if mesonbuild.mesonlib.is_windows():
-                # Clean up all the garbage MSVC writes in the
-                # source tree.
-                for fname in glob(os.path.join(testdir, 'foo.*')):
-                    if os.path.splitext(fname)[1] not in ['.c', '.h', '.in']:
-                        os.unlink(fname)
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_gen_escaping(self):
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen')
-        prefix = '/usr/with spaces'
-        libdir = 'lib'
-        self.init(testdir, extra_args=['--prefix=' + prefix,
-                                       '--libdir=' + libdir])
-        # Find foo dependency
-        os.environ['PKG_CONFIG_LIBDIR'] = self.privatedir
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        kwargs = {'required': True, 'silent': True}
-        foo_dep = PkgConfigDependency('libfoo', env, kwargs)
-        # Ensure link_args are properly quoted
-        libdir = PurePath(prefix) / PurePath(libdir)
-        link_args = ['-L' + libdir.as_posix(), '-lfoo']
-        self.assertEqual(foo_dep.get_link_args(), link_args)
-        # Ensure include args are properly quoted
-        incdir = PurePath(prefix) / PurePath('include')
-        cargs = ['-I' + incdir.as_posix(), '-DLIBFOO']
-        # pkg-config and pkgconf does not respect the same order
-        self.assertEqual(sorted(foo_dep.get_compile_args()), sorted(cargs))
-
-    def test_array_option_change(self):
-        def get_opt():
-            opts = self.introspect('--buildoptions')
-            for x in opts:
-                if x.get('name') == 'list':
-                    return x
-            raise Exception(opts)
-
-        expected = {
-            'name': 'list',
-            'description': 'list',
-            'section': 'user',
-            'type': 'array',
-            'value': ['foo', 'bar'],
-            'machine': 'any',
-        }
-        tdir = os.path.join(self.unit_test_dir, '19 array option')
-        self.init(tdir)
-        original = get_opt()
-        self.assertDictEqual(original, expected)
-
-        expected['value'] = ['oink', 'boink']
-        self.setconf('-Dlist=oink,boink')
-        changed = get_opt()
-        self.assertEqual(changed, expected)
-
-    def test_array_option_bad_change(self):
-        def get_opt():
-            opts = self.introspect('--buildoptions')
-            for x in opts:
-                if x.get('name') == 'list':
-                    return x
-            raise Exception(opts)
-
-        expected = {
-            'name': 'list',
-            'description': 'list',
-            'section': 'user',
-            'type': 'array',
-            'value': ['foo', 'bar'],
-            'machine': 'any',
-        }
-        tdir = os.path.join(self.unit_test_dir, '19 array option')
-        self.init(tdir)
-        original = get_opt()
-        self.assertDictEqual(original, expected)
-        with self.assertRaises(subprocess.CalledProcessError):
-            self.setconf('-Dlist=bad')
-        changed = get_opt()
-        self.assertDictEqual(changed, expected)
-
-    def test_array_option_empty_equivalents(self):
-        """Array options treat -Dopt=[] and -Dopt= as equivalent."""
-        def get_opt():
-            opts = self.introspect('--buildoptions')
-            for x in opts:
-                if x.get('name') == 'list':
-                    return x
-            raise Exception(opts)
-
-        expected = {
-            'name': 'list',
-            'description': 'list',
-            'section': 'user',
-            'type': 'array',
-            'value': [],
-            'machine': 'any',
-        }
-        tdir = os.path.join(self.unit_test_dir, '19 array option')
-        self.init(tdir, extra_args='-Dlist=')
-        original = get_opt()
-        self.assertDictEqual(original, expected)
-
-    def opt_has(self, name, value):
-        res = self.introspect('--buildoptions')
-        found = False
-        for i in res:
-            if i['name'] == name:
-                self.assertEqual(i['value'], value)
-                found = True
-                break
-        self.assertTrue(found, "Array option not found in introspect data.")
-
-    def test_free_stringarray_setting(self):
-        testdir = os.path.join(self.common_test_dir, '43 options')
-        self.init(testdir)
-        self.opt_has('free_array_opt', [])
-        self.setconf('-Dfree_array_opt=foo,bar', will_build=False)
-        self.opt_has('free_array_opt', ['foo', 'bar'])
-        self.setconf("-Dfree_array_opt=['a,b', 'c,d']", will_build=False)
-        self.opt_has('free_array_opt', ['a,b', 'c,d'])
-
-    def test_subproject_promotion(self):
-        testdir = os.path.join(self.unit_test_dir, '12 promote')
-        workdir = os.path.join(self.builddir, 'work')
-        shutil.copytree(testdir, workdir)
-        spdir = os.path.join(workdir, 'subprojects')
-        s3dir = os.path.join(spdir, 's3')
-        scommondir = os.path.join(spdir, 'scommon')
-        self.assertFalse(os.path.isdir(s3dir))
-        subprocess.check_call(self.wrap_command + ['promote', 's3'], cwd=workdir)
-        self.assertTrue(os.path.isdir(s3dir))
-        self.assertFalse(os.path.isdir(scommondir))
-        self.assertNotEqual(subprocess.call(self.wrap_command + ['promote', 'scommon'],
-                                            cwd=workdir,
-                                            stdout=subprocess.DEVNULL), 0)
-        self.assertNotEqual(subprocess.call(self.wrap_command + ['promote', 'invalid/path/to/scommon'],
-                                            cwd=workdir,
-                                            stderr=subprocess.DEVNULL), 0)
-        self.assertFalse(os.path.isdir(scommondir))
-        subprocess.check_call(self.wrap_command + ['promote', 'subprojects/s2/subprojects/scommon'], cwd=workdir)
-        self.assertTrue(os.path.isdir(scommondir))
-        promoted_wrap = os.path.join(spdir, 'athing.wrap')
-        self.assertFalse(os.path.isfile(promoted_wrap))
-        subprocess.check_call(self.wrap_command + ['promote', 'athing'], cwd=workdir)
-        self.assertTrue(os.path.isfile(promoted_wrap))
-        self.init(workdir)
-        self.build()
-
-    def test_subproject_promotion_wrap(self):
-        testdir = os.path.join(self.unit_test_dir, '44 promote wrap')
-        workdir = os.path.join(self.builddir, 'work')
-        shutil.copytree(testdir, workdir)
-        spdir = os.path.join(workdir, 'subprojects')
-
-        ambiguous_wrap = os.path.join(spdir, 'ambiguous.wrap')
-        self.assertNotEqual(subprocess.call(self.wrap_command + ['promote', 'ambiguous'],
-                                            cwd=workdir,
-                                            stdout=subprocess.DEVNULL), 0)
-        self.assertFalse(os.path.isfile(ambiguous_wrap))
-        subprocess.check_call(self.wrap_command + ['promote', 'subprojects/s2/subprojects/ambiguous.wrap'], cwd=workdir)
-        self.assertTrue(os.path.isfile(ambiguous_wrap))
-
-    def test_warning_location(self):
-        tdir = os.path.join(self.unit_test_dir, '22 warning location')
-        out = self.init(tdir)
-        for expected in [
-            r'meson.build:4: WARNING: Keyword argument "link_with" defined multiple times.',
-            r'sub' + os.path.sep + r'meson.build:3: WARNING: Keyword argument "link_with" defined multiple times.',
-            r'meson.build:6: WARNING: a warning of some sort',
-            r'sub' + os.path.sep + r'meson.build:4: WARNING: subdir warning',
-            r'meson.build:7: WARNING: Module unstable-simd has no backwards or forwards compatibility and might not exist in future releases.',
-            r"meson.build:11: WARNING: The variable(s) 'MISSING' in the input file 'conf.in' are not present in the given configuration data.",
-            r'meson.build:1: WARNING: Passed invalid keyword argument "invalid".',
-        ]:
-            self.assertRegex(out, re.escape(expected))
-
-        for wd in [
-            self.src_root,
-            self.builddir,
-            os.getcwd(),
-        ]:
-            self.new_builddir()
-            out = self.init(tdir, workdir=wd)
-            expected = os.path.join(relpath(tdir, self.src_root), 'meson.build')
-            relwd = relpath(self.src_root, wd)
-            if relwd != '.':
-                expected = os.path.join(relwd, expected)
-                expected = '\n' + expected + ':'
-            self.assertIn(expected, out)
-
-    def test_error_location_path(self):
-        '''Test locations in meson errors contain correct paths'''
-        # this list contains errors from all the different steps in the
-        # lexer/parser/interpreter we have tests for.
-        for (t, f) in [
-            ('10 out of bounds', 'meson.build'),
-            ('18 wrong plusassign', 'meson.build'),
-            ('61 bad option argument', 'meson_options.txt'),
-            ('102 subdir parse error', os.path.join('subdir', 'meson.build')),
-            ('103 invalid option file', 'meson_options.txt'),
-        ]:
-            tdir = os.path.join(self.src_root, 'test cases', 'failing', t)
-
-            for wd in [
-                self.src_root,
-                self.builddir,
-                os.getcwd(),
-            ]:
-                try:
-                    self.init(tdir, workdir=wd)
-                except subprocess.CalledProcessError as e:
-                    expected = os.path.join('test cases', 'failing', t, f)
-                    relwd = relpath(self.src_root, wd)
-                    if relwd != '.':
-                        expected = os.path.join(relwd, expected)
-                    expected = '\n' + expected + ':'
-                    self.assertIn(expected, e.output)
-                else:
-                    self.fail('configure unexpectedly succeeded')
-
-    def test_permitted_method_kwargs(self):
-        tdir = os.path.join(self.unit_test_dir, '25 non-permitted kwargs')
-        out = self.init(tdir)
-        for expected in [
-            r'WARNING: Passed invalid keyword argument "prefixxx".',
-            r'WARNING: Passed invalid keyword argument "argsxx".',
-            r'WARNING: Passed invalid keyword argument "invalidxx".',
-        ]:
-            self.assertRegex(out, re.escape(expected))
-
-    def test_templates(self):
-        ninja = detect_ninja()
-        if ninja is None:
-            raise unittest.SkipTest('This test currently requires ninja. Fix this once "meson build" works.')
-        langs = ['c']
-        env = get_fake_env()
-        try:
-            env.detect_cpp_compiler(MachineChoice.HOST)
-            langs.append('cpp')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_cs_compiler(MachineChoice.HOST)
-            langs.append('cs')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_d_compiler(MachineChoice.HOST)
-            langs.append('d')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_java_compiler(MachineChoice.HOST)
-            langs.append('java')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_cuda_compiler(MachineChoice.HOST)
-            langs.append('cuda')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_fortran_compiler(MachineChoice.HOST)
-            langs.append('fortran')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_objc_compiler(MachineChoice.HOST)
-            langs.append('objc')
-        except EnvironmentException:
-            pass
-        try:
-            env.detect_objcpp_compiler(MachineChoice.HOST)
-            langs.append('objcpp')
-        except EnvironmentException:
-            pass
-        # FIXME: omitting rust as Windows AppVeyor CI finds Rust but doesn't link correctly
-        if not is_windows():
-            try:
-                env.detect_rust_compiler(MachineChoice.HOST)
-                langs.append('rust')
-            except EnvironmentException:
-                pass
-
-        for lang in langs:
-            for target_type in ('executable', 'library'):
-                # test empty directory
-                with tempfile.TemporaryDirectory() as tmpdir:
-                    self._run(self.meson_command + ['init', '--language', lang, '--type', target_type],
-                              workdir=tmpdir)
-                    self._run(self.setup_command + ['--backend=ninja', 'builddir'],
-                              workdir=tmpdir)
-                    self._run(ninja,
-                              workdir=os.path.join(tmpdir, 'builddir'))
-            # test directory with existing code file
-            if lang in ('c', 'cpp', 'd'):
-                with tempfile.TemporaryDirectory() as tmpdir:
-                    with open(os.path.join(tmpdir, 'foo.' + lang), 'w') as f:
-                        f.write('int main(void) {}')
-                    self._run(self.meson_command + ['init', '-b'], workdir=tmpdir)
-            elif lang in ('java'):
-                with tempfile.TemporaryDirectory() as tmpdir:
-                    with open(os.path.join(tmpdir, 'Foo.' + lang), 'w') as f:
-                        f.write('public class Foo { public static void main() {} }')
-                    self._run(self.meson_command + ['init', '-b'], workdir=tmpdir)
-
-    def test_compiler_run_command(self):
-        '''
-        The test checks that the compiler object can be passed to
-        run_command().
-        '''
-        testdir = os.path.join(self.unit_test_dir, '24 compiler run_command')
-        self.init(testdir)
-
-    def test_identical_target_name_in_subproject_flat_layout(self):
-        '''
-        Test that identical targets in different subprojects do not collide
-        if layout is flat.
-        '''
-        testdir = os.path.join(self.common_test_dir, '177 identical target name in subproject flat layout')
-        self.init(testdir, extra_args=['--layout=flat'])
-        self.build()
-
-    def test_identical_target_name_in_subdir_flat_layout(self):
-        '''
-        Test that identical targets in different subdirs do not collide
-        if layout is flat.
-        '''
-        testdir = os.path.join(self.common_test_dir, '186 same target name flat layout')
-        self.init(testdir, extra_args=['--layout=flat'])
-        self.build()
-
-    def test_flock(self):
-        exception_raised = False
-        with tempfile.TemporaryDirectory() as tdir:
-            os.mkdir(os.path.join(tdir, 'meson-private'))
-            with BuildDirLock(tdir):
-                try:
-                    with BuildDirLock(tdir):
-                        pass
-                except MesonException:
-                    exception_raised = True
-        self.assertTrue(exception_raised, 'Double locking did not raise exception.')
-
-    @unittest.skipIf(is_osx(), 'Test not applicable to OSX')
-    def test_check_module_linking(self):
-        """
-        Test that link_with: a shared module issues a warning
-        https://github.com/mesonbuild/meson/issues/2865
-        (That an error is raised on OSX is exercised by test failing/78)
-        """
-        tdir = os.path.join(self.unit_test_dir, '30 shared_mod linking')
-        out = self.init(tdir)
-        msg = ('''WARNING: target links against shared modules. This is not
-recommended as it is not supported on some platforms''')
-        self.assertIn(msg, out)
-
-    def test_ndebug_if_release_disabled(self):
-        testdir = os.path.join(self.unit_test_dir, '28 ndebug if-release')
-        self.init(testdir, extra_args=['--buildtype=release', '-Db_ndebug=if-release'])
-        self.build()
-        exe = os.path.join(self.builddir, 'main')
-        self.assertEqual(b'NDEBUG=1', subprocess.check_output(exe).strip())
-
-    def test_ndebug_if_release_enabled(self):
-        testdir = os.path.join(self.unit_test_dir, '28 ndebug if-release')
-        self.init(testdir, extra_args=['--buildtype=debugoptimized', '-Db_ndebug=if-release'])
-        self.build()
-        exe = os.path.join(self.builddir, 'main')
-        self.assertEqual(b'NDEBUG=0', subprocess.check_output(exe).strip())
-
-    def test_guessed_linker_dependencies(self):
-        '''
-        Test that meson adds dependencies for libraries based on the final
-        linker command line.
-        '''
-        testdirbase = os.path.join(self.unit_test_dir, '29 guessed linker dependencies')
-        testdirlib = os.path.join(testdirbase, 'lib')
-
-        extra_args = None
-        libdir_flags = ['-L']
-        env = get_fake_env(testdirlib, self.builddir, self.prefix)
-        if env.detect_c_compiler(MachineChoice.HOST).get_id() in {'msvc', 'clang-cl', 'intel-cl'}:
-            # msvc-like compiler, also test it with msvc-specific flags
-            libdir_flags += ['/LIBPATH:', '-LIBPATH:']
-        else:
-            # static libraries are not linkable with -l with msvc because meson installs them
-            # as .a files which unix_args_to_native will not know as it expects libraries to use
-            # .lib as extension. For a DLL the import library is installed as .lib. Thus for msvc
-            # this tests needs to use shared libraries to test the path resolving logic in the
-            # dependency generation code path.
-            extra_args = ['--default-library', 'static']
-
-        initial_builddir = self.builddir
-        initial_installdir = self.installdir
-
-        for libdir_flag in libdir_flags:
-            # build library
-            self.new_builddir()
-            self.init(testdirlib, extra_args=extra_args)
-            self.build()
-            self.install()
-            libbuilddir = self.builddir
-            installdir = self.installdir
-            libdir = os.path.join(self.installdir, self.prefix.lstrip('/').lstrip('\\'), 'lib')
-
-            # build user of library
-            self.new_builddir()
-            # replace is needed because meson mangles platform paths passed via LDFLAGS
-            self.init(os.path.join(testdirbase, 'exe'),
-                      override_envvars={"LDFLAGS": '{}{}'.format(libdir_flag, libdir.replace('\\', '/'))})
-            self.build()
-            self.assertBuildIsNoop()
-
-            # rebuild library
-            exebuilddir = self.builddir
-            self.installdir = installdir
-            self.builddir = libbuilddir
-            # Microsoft's compiler is quite smart about touching import libs on changes,
-            # so ensure that there is actually a change in symbols.
-            self.setconf('-Dmore_exports=true')
-            self.build()
-            self.install()
-            # no ensure_backend_detects_changes needed because self.setconf did that already
-
-            # assert user of library will be rebuild
-            self.builddir = exebuilddir
-            self.assertRebuiltTarget('app')
-
-            # restore dirs for the next test case
-            self.installdir = initial_builddir
-            self.builddir = initial_installdir
-
-    def test_conflicting_d_dash_option(self):
-        testdir = os.path.join(self.unit_test_dir, '37 mixed command line args')
-        with self.assertRaises(subprocess.CalledProcessError) as e:
-            self.init(testdir, extra_args=['-Dbindir=foo', '--bindir=bar'])
-            # Just to ensure that we caught the correct error
-            self.assertIn('passed as both', e.stderr)
-
-    def _test_same_option_twice(self, arg, args):
-        testdir = os.path.join(self.unit_test_dir, '37 mixed command line args')
-        self.init(testdir, extra_args=args)
-        opts = self.introspect('--buildoptions')
-        for item in opts:
-            if item['name'] == arg:
-                self.assertEqual(item['value'], 'bar')
-                return
-        raise Exception('Missing {} value?'.format(arg))
-
-    def test_same_dash_option_twice(self):
-        self._test_same_option_twice('bindir', ['--bindir=foo', '--bindir=bar'])
-
-    def test_same_d_option_twice(self):
-        self._test_same_option_twice('bindir', ['-Dbindir=foo', '-Dbindir=bar'])
-
-    def test_same_project_d_option_twice(self):
-        self._test_same_option_twice('one', ['-Done=foo', '-Done=bar'])
-
-    def _test_same_option_twice_configure(self, arg, args):
-        testdir = os.path.join(self.unit_test_dir, '37 mixed command line args')
-        self.init(testdir)
-        self.setconf(args)
-        opts = self.introspect('--buildoptions')
-        for item in opts:
-            if item['name'] == arg:
-                self.assertEqual(item['value'], 'bar')
-                return
-        raise Exception('Missing {} value?'.format(arg))
-
-    def test_same_dash_option_twice_configure(self):
-        self._test_same_option_twice_configure(
-            'bindir', ['--bindir=foo', '--bindir=bar'])
-
-    def test_same_d_option_twice_configure(self):
-        self._test_same_option_twice_configure(
-            'bindir', ['-Dbindir=foo', '-Dbindir=bar'])
-
-    def test_same_project_d_option_twice_configure(self):
-        self._test_same_option_twice_configure(
-            'one', ['-Done=foo', '-Done=bar'])
-
-    def test_command_line(self):
-        testdir = os.path.join(self.unit_test_dir, '34 command line')
-
-        # Verify default values when passing no args that affect the
-        # configuration, and as a bonus, test that --profile-self works.
-        self.init(testdir, extra_args=['--profile-self'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['default_library'].value, 'static')
-        self.assertEqual(obj.builtins['warning_level'].value, '1')
-        self.assertEqual(obj.user_options['set_sub_opt'].value, True)
-        self.assertEqual(obj.user_options['subp:subp_opt'].value, 'default3')
-        self.wipe()
-
-        # warning_level is special, it's --warnlevel instead of --warning-level
-        # for historical reasons
-        self.init(testdir, extra_args=['--warnlevel=2'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '2')
-        self.setconf('--warnlevel=3')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '3')
-        self.wipe()
-
-        # But when using -D syntax, it should be 'warning_level'
-        self.init(testdir, extra_args=['-Dwarning_level=2'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '2')
-        self.setconf('-Dwarning_level=3')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '3')
-        self.wipe()
-
-        # Mixing --option and -Doption is forbidden
-        with self.assertRaises(subprocess.CalledProcessError) as cm:
-            self.init(testdir, extra_args=['--warnlevel=1', '-Dwarning_level=3'])
-        self.assertNotEqual(0, cm.exception.returncode)
-        self.assertIn('as both', cm.exception.output)
-        self.init(testdir)
-        with self.assertRaises(subprocess.CalledProcessError) as cm:
-            self.setconf(['--warnlevel=1', '-Dwarning_level=3'])
-        self.assertNotEqual(0, cm.exception.returncode)
-        self.assertIn('as both', cm.exception.output)
-        self.wipe()
-
-        # --default-library should override default value from project()
-        self.init(testdir, extra_args=['--default-library=both'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['default_library'].value, 'both')
-        self.setconf('--default-library=shared')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['default_library'].value, 'shared')
-        if self.backend is Backend.ninja:
-            # reconfigure target works only with ninja backend
-            self.build('reconfigure')
-            obj = mesonbuild.coredata.load(self.builddir)
-            self.assertEqual(obj.builtins['default_library'].value, 'shared')
-        self.wipe()
-
-        # Should warn on unknown options
-        out = self.init(testdir, extra_args=['-Dbad=1', '-Dfoo=2', '-Dwrong_link_args=foo'])
-        self.assertIn('Unknown options: "bad, foo, wrong_link_args"', out)
-        self.wipe()
-
-        # Should fail on malformed option
-        with self.assertRaises(subprocess.CalledProcessError) as cm:
-            self.init(testdir, extra_args=['-Dfoo'])
-        self.assertNotEqual(0, cm.exception.returncode)
-        self.assertIn('Option \'foo\' must have a value separated by equals sign.', cm.exception.output)
-        self.init(testdir)
-        with self.assertRaises(subprocess.CalledProcessError) as cm:
-            self.setconf('-Dfoo')
-        self.assertNotEqual(0, cm.exception.returncode)
-        self.assertIn('Option \'foo\' must have a value separated by equals sign.', cm.exception.output)
-        self.wipe()
-
-        # It is not an error to set wrong option for unknown subprojects or
-        # language because we don't have control on which one will be selected.
-        self.init(testdir, extra_args=['-Dc_wrong=1', '-Dwrong:bad=1', '-Db_wrong=1'])
-        self.wipe()
-
-        # Test we can set subproject option
-        self.init(testdir, extra_args=['-Dsubp:subp_opt=foo'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.user_options['subp:subp_opt'].value, 'foo')
-        self.wipe()
-
-        # c_args value should be parsed with split_args
-        self.init(testdir, extra_args=['-Dc_args=-Dfoo -Dbar "-Dthird=one two"'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.compiler_options.host['c']['args'].value, ['-Dfoo', '-Dbar', '-Dthird=one two'])
-
-        self.setconf('-Dc_args="foo bar" one two')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.compiler_options.host['c']['args'].value, ['foo bar', 'one', 'two'])
-        self.wipe()
-
-        self.init(testdir, extra_args=['-Dset_percent_opt=myoption%'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.user_options['set_percent_opt'].value, 'myoption%')
-        self.wipe()
-
-        # Setting a 2nd time the same option should override the first value
-        try:
-            self.init(testdir, extra_args=['--bindir=foo', '--bindir=bar',
-                                           '-Dbuildtype=plain', '-Dbuildtype=release',
-                                           '-Db_sanitize=address', '-Db_sanitize=thread',
-                                           '-Dc_args=-Dfoo', '-Dc_args=-Dbar'])
-            obj = mesonbuild.coredata.load(self.builddir)
-            self.assertEqual(obj.builtins['bindir'].value, 'bar')
-            self.assertEqual(obj.builtins['buildtype'].value, 'release')
-            self.assertEqual(obj.base_options['b_sanitize'].value, 'thread')
-            self.assertEqual(obj.compiler_options.host['c']['args'].value, ['-Dbar'])
-            self.setconf(['--bindir=bar', '--bindir=foo',
-                          '-Dbuildtype=release', '-Dbuildtype=plain',
-                          '-Db_sanitize=thread', '-Db_sanitize=address',
-                          '-Dc_args=-Dbar', '-Dc_args=-Dfoo'])
-            obj = mesonbuild.coredata.load(self.builddir)
-            self.assertEqual(obj.builtins['bindir'].value, 'foo')
-            self.assertEqual(obj.builtins['buildtype'].value, 'plain')
-            self.assertEqual(obj.base_options['b_sanitize'].value, 'address')
-            self.assertEqual(obj.compiler_options.host['c']['args'].value, ['-Dfoo'])
-            self.wipe()
-        except KeyError:
-            # Ignore KeyError, it happens on CI for compilers that does not
-            # support b_sanitize. We have to test with a base option because
-            # they used to fail this test with Meson 0.46 an earlier versions.
-            pass
-
-    def test_warning_level_0(self):
-        testdir = os.path.join(self.common_test_dir, '214 warning level 0')
-
-        # Verify default values when passing no args
-        self.init(testdir)
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '0')
-        self.wipe()
-
-        # verify we can override w/ --warnlevel
-        self.init(testdir, extra_args=['--warnlevel=1'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '1')
-        self.setconf('--warnlevel=0')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '0')
-        self.wipe()
-
-        # verify we can override w/ -Dwarning_level
-        self.init(testdir, extra_args=['-Dwarning_level=1'])
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '1')
-        self.setconf('-Dwarning_level=0')
-        obj = mesonbuild.coredata.load(self.builddir)
-        self.assertEqual(obj.builtins['warning_level'].value, '0')
-        self.wipe()
-
-    def test_feature_check_usage_subprojects(self):
-        testdir = os.path.join(self.unit_test_dir, '41 featurenew subprojects')
-        out = self.init(testdir)
-        # Parent project warns correctly
-        self.assertRegex(out, "WARNING: Project targeting '>=0.45'.*'0.47.0': dict")
-        # Subprojects warn correctly
-        self.assertRegex(out, r"\|WARNING: Project targeting '>=0.40'.*'0.44.0': disabler")
-        self.assertRegex(out, r"\|WARNING: Project targeting '!=0.40'.*'0.44.0': disabler")
-        # Subproject has a new-enough meson_version, no warning
-        self.assertNotRegex(out, "WARNING: Project targeting.*Python")
-        # Ensure a summary is printed in the subproject and the outer project
-        self.assertRegex(out, r"\|WARNING: Project specifies a minimum meson_version '>=0.40'")
-        self.assertRegex(out, r"\| \* 0.44.0: {'disabler'}")
-        self.assertRegex(out, "WARNING: Project specifies a minimum meson_version '>=0.45'")
-        self.assertRegex(out, " * 0.47.0: {'dict'}")
-
-    def test_configure_file_warnings(self):
-        testdir = os.path.join(self.common_test_dir, "14 configure file")
-        out = self.init(testdir)
-        self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
-        self.assertRegex(out, "WARNING:.*'FOO_BAR'.*nosubst-nocopy2.txt.in.*not present.*")
-        self.assertRegex(out, "WARNING:.*'empty'.*config.h.in.*not present.*")
-        self.assertRegex(out, "WARNING:.*empty configuration_data.*test.py.in")
-        # Warnings for configuration files that are overwritten.
-        self.assertRegex(out, "WARNING:.*\"double_output.txt\".*overwrites")
-        self.assertRegex(out, "WARNING:.*\"subdir.double_output2.txt\".*overwrites")
-        self.assertNotRegex(out, "WARNING:.*no_write_conflict.txt.*overwrites")
-        self.assertNotRegex(out, "WARNING:.*@BASENAME@.*overwrites")
-        self.assertRegex(out, "WARNING:.*\"sameafterbasename\".*overwrites")
-        # No warnings about empty configuration data objects passed to files with substitutions
-        self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy1.txt.in")
-        self.assertNotRegex(out, "WARNING:.*empty configuration_data.*nosubst-nocopy2.txt.in")
-        with open(os.path.join(self.builddir, 'nosubst-nocopy1.txt'), 'rb') as f:
-            self.assertEqual(f.read().strip(), b'/* #undef FOO_BAR */')
-        with open(os.path.join(self.builddir, 'nosubst-nocopy2.txt'), 'rb') as f:
-            self.assertEqual(f.read().strip(), b'')
-        self.assertRegex(out, r"DEPRECATION:.*\['array'\] is invalid.*dict")
-
-    def test_dirs(self):
-        with tempfile.TemporaryDirectory() as containing:
-            with tempfile.TemporaryDirectory(dir=containing) as srcdir:
-                mfile = os.path.join(srcdir, 'meson.build')
-                of = open(mfile, 'w')
-                of.write("project('foobar', 'c')\n")
-                of.close()
-                pc = subprocess.run(self.setup_command,
-                                    cwd=srcdir,
-                                    stdout=subprocess.PIPE,
-                                    stderr=subprocess.DEVNULL)
-                self.assertIn(b'Must specify at least one directory name', pc.stdout)
-                with tempfile.TemporaryDirectory(dir=srcdir) as builddir:
-                    subprocess.run(self.setup_command,
-                                   check=True,
-                                   cwd=builddir,
-                                   stdout=subprocess.DEVNULL,
-                                   stderr=subprocess.DEVNULL)
-
-    def get_opts_as_dict(self):
-        result = {}
-        for i in self.introspect('--buildoptions'):
-            result[i['name']] = i['value']
-        return result
-
-    def test_buildtype_setting(self):
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        self.init(testdir)
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['buildtype'], 'debug')
-        self.assertEqual(opts['debug'], True)
-        self.setconf('-Ddebug=false')
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['debug'], False)
-        self.assertEqual(opts['buildtype'], 'plain')
-        self.assertEqual(opts['optimization'], '0')
-
-        # Setting optimizations to 3 should cause buildtype
-        # to go to release mode.
-        self.setconf('-Doptimization=3')
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['buildtype'], 'release')
-        self.assertEqual(opts['debug'], False)
-        self.assertEqual(opts['optimization'], '3')
-
-        # Going to debug build type should reset debugging
-        # and optimization
-        self.setconf('-Dbuildtype=debug')
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['buildtype'], 'debug')
-        self.assertEqual(opts['debug'], True)
-        self.assertEqual(opts['optimization'], '0')
-
-        # Command-line parsing of buildtype settings should be the same as
-        # setting with `meson configure`.
-        #
-        # Setting buildtype should set optimization/debug
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Dbuildtype=debugoptimized'])
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['debug'], True)
-        self.assertEqual(opts['optimization'], '2')
-        self.assertEqual(opts['buildtype'], 'debugoptimized')
-        # Setting optimization/debug should set buildtype
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Doptimization=2', '-Ddebug=true'])
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['debug'], True)
-        self.assertEqual(opts['optimization'], '2')
-        self.assertEqual(opts['buildtype'], 'debugoptimized')
-        # Setting both buildtype and debug on the command-line should work, and
-        # should warn not to do that. Also test that --debug is parsed as -Ddebug=true
-        self.new_builddir()
-        out = self.init(testdir, extra_args=['-Dbuildtype=debugoptimized', '--debug'])
-        self.assertRegex(out, 'Recommend using either.*buildtype.*debug.*redundant')
-        opts = self.get_opts_as_dict()
-        self.assertEqual(opts['debug'], True)
-        self.assertEqual(opts['optimization'], '2')
-        self.assertEqual(opts['buildtype'], 'debugoptimized')
-
-    @skipIfNoPkgconfig
-    @unittest.skipIf(is_windows(), 'Help needed with fixing this test on windows')
-    def test_native_dep_pkgconfig(self):
-        testdir = os.path.join(self.unit_test_dir,
-                               '46 native dep pkgconfig var')
-        with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
-            crossfile.write(textwrap.dedent(
-                '''[binaries]
-                pkgconfig = '{0}'
-
-                [properties]
-
-                [host_machine]
-                system = 'linux'
-                cpu_family = 'arm'
-                cpu = 'armv7'
-                endian = 'little'
-                '''.format(os.path.join(testdir, 'cross_pkgconfig.py'))))
-            crossfile.flush()
-            self.meson_cross_file = crossfile.name
-
-        env = {'PKG_CONFIG_LIBDIR':  os.path.join(testdir,
-                                                  'native_pkgconfig')}
-        self.init(testdir, extra_args=['-Dstart_native=false'], override_envvars=env)
-        self.wipe()
-        self.init(testdir, extra_args=['-Dstart_native=true'], override_envvars=env)
-
-    @skipIfNoPkgconfig
-    @unittest.skipIf(is_windows(), 'Help needed with fixing this test on windows')
-    def test_pkg_config_libdir(self):
-        testdir = os.path.join(self.unit_test_dir,
-                               '46 native dep pkgconfig var')
-        with tempfile.NamedTemporaryFile(mode='w', delete=False) as crossfile:
-            crossfile.write(textwrap.dedent(
-                '''[binaries]
-                pkgconfig = 'pkg-config'
-
-                [properties]
-                pkg_config_libdir = ['{0}']
-
-                [host_machine]
-                system = 'linux'
-                cpu_family = 'arm'
-                cpu = 'armv7'
-                endian = 'little'
-                '''.format(os.path.join(testdir, 'cross_pkgconfig'))))
-            crossfile.flush()
-            self.meson_cross_file = crossfile.name
-
-        env = {'PKG_CONFIG_LIBDIR':  os.path.join(testdir,
-                                                  'native_pkgconfig')}
-        self.init(testdir, extra_args=['-Dstart_native=false'], override_envvars=env)
-        self.wipe()
-        self.init(testdir, extra_args=['-Dstart_native=true'], override_envvars=env)
-
-    def __reconfigure(self, change_minor=False):
-        # Set an older version to force a reconfigure from scratch
-        filename = os.path.join(self.privatedir, 'coredata.dat')
-        with open(filename, 'rb') as f:
-            obj = pickle.load(f)
-        if change_minor:
-            v = mesonbuild.coredata.version.split('.')
-            obj.version = '.'.join(v[0:2] + [str(int(v[2]) + 1)])
-        else:
-            obj.version = '0.47.0'
-        with open(filename, 'wb') as f:
-            pickle.dump(obj, f)
-
-    def test_reconfigure(self):
-        testdir = os.path.join(self.unit_test_dir, '48 reconfigure')
-        self.init(testdir, extra_args=['-Dopt1=val1'])
-        self.setconf('-Dopt2=val2')
-
-        self.__reconfigure()
-
-        out = self.init(testdir, extra_args=['--reconfigure', '-Dopt3=val3'])
-        self.assertRegex(out, 'Regenerating configuration from scratch')
-        self.assertRegex(out, 'opt1 val1')
-        self.assertRegex(out, 'opt2 val2')
-        self.assertRegex(out, 'opt3 val3')
-        self.assertRegex(out, 'opt4 default4')
-        self.build()
-        self.run_tests()
-
-        # Create a file in builddir and verify wipe command removes it
-        filename = os.path.join(self.builddir, 'something')
-        open(filename, 'w').close()
-        self.assertTrue(os.path.exists(filename))
-        out = self.init(testdir, extra_args=['--wipe', '-Dopt4=val4'])
-        self.assertFalse(os.path.exists(filename))
-        self.assertRegex(out, 'opt1 val1')
-        self.assertRegex(out, 'opt2 val2')
-        self.assertRegex(out, 'opt3 val3')
-        self.assertRegex(out, 'opt4 val4')
-        self.build()
-        self.run_tests()
-
-    def test_wipe_from_builddir(self):
-        testdir = os.path.join(self.common_test_dir, '161 custom target subdir depend files')
-        self.init(testdir)
-        self.__reconfigure()
-
-        with Path(self.builddir):
-            self.init(testdir, extra_args=['--wipe'])
-
-    def test_minor_version_does_not_reconfigure_wipe(self):
-        testdir = os.path.join(self.unit_test_dir, '48 reconfigure')
-        self.init(testdir, extra_args=['-Dopt1=val1'])
-        self.setconf('-Dopt2=val2')
-
-        self.__reconfigure(change_minor=True)
-
-        out = self.init(testdir, extra_args=['--reconfigure', '-Dopt3=val3'])
-        self.assertNotRegex(out, 'Regenerating configuration from scratch')
-        self.assertRegex(out, 'opt1 val1')
-        self.assertRegex(out, 'opt2 val2')
-        self.assertRegex(out, 'opt3 val3')
-        self.assertRegex(out, 'opt4 default4')
-        self.build()
-        self.run_tests()
-
-    def test_target_construct_id_from_path(self):
-        # This id is stable but not guessable.
-        # The test is supposed to prevent unintentional
-        # changes of target ID generation.
-        target_id = Target.construct_id_from_path('some/obscure/subdir',
-                                                  'target-id', '@suffix')
-        self.assertEqual('5e002d3@@target-id@suffix', target_id)
-        target_id = Target.construct_id_from_path('subproject/foo/subdir/bar',
-                                                  'target2-id', '@other')
-        self.assertEqual('81d46d1@@target2-id@other', target_id)
-
-    def test_introspect_projectinfo_without_configured_build(self):
-        testfile = os.path.join(self.common_test_dir, '35 run program', 'meson.build')
-        res = self.introspect_directory(testfile, '--projectinfo')
-        self.assertEqual(set(res['buildsystem_files']), set(['meson.build']))
-        self.assertEqual(res['version'], 'undefined')
-        self.assertEqual(res['descriptive_name'], 'run command')
-        self.assertEqual(res['subprojects'], [])
-
-        testfile = os.path.join(self.common_test_dir, '43 options', 'meson.build')
-        res = self.introspect_directory(testfile, '--projectinfo')
-        self.assertEqual(set(res['buildsystem_files']), set(['meson_options.txt', 'meson.build']))
-        self.assertEqual(res['version'], 'undefined')
-        self.assertEqual(res['descriptive_name'], 'options')
-        self.assertEqual(res['subprojects'], [])
-
-        testfile = os.path.join(self.common_test_dir, '46 subproject options', 'meson.build')
-        res = self.introspect_directory(testfile, '--projectinfo')
-        self.assertEqual(set(res['buildsystem_files']), set(['meson_options.txt', 'meson.build']))
-        self.assertEqual(res['version'], 'undefined')
-        self.assertEqual(res['descriptive_name'], 'suboptions')
-        self.assertEqual(len(res['subprojects']), 1)
-        subproject_files = set(f.replace('\\', '/') for f in res['subprojects'][0]['buildsystem_files'])
-        self.assertEqual(subproject_files, set(['subprojects/subproject/meson_options.txt', 'subprojects/subproject/meson.build']))
-        self.assertEqual(res['subprojects'][0]['name'], 'subproject')
-        self.assertEqual(res['subprojects'][0]['version'], 'undefined')
-        self.assertEqual(res['subprojects'][0]['descriptive_name'], 'subproject')
-
-    def test_introspect_projectinfo_subprojects(self):
-        testdir = os.path.join(self.common_test_dir, '102 subproject subdir')
-        self.init(testdir)
-        res = self.introspect('--projectinfo')
-        expected = {
-            'descriptive_name': 'proj',
-            'version': 'undefined',
-            'subproject_dir': 'subprojects',
-            'subprojects': [
-                {
-                    'descriptive_name': 'sub',
-                    'name': 'sub',
-                    'version': '1.0'
-                },
-                {
-                    'descriptive_name': 'sub_implicit',
-                    'name': 'sub_implicit',
-                    'version': '1.0',
-                },
-                {
-                    'descriptive_name': 'sub-novar',
-                    'name': 'sub_novar',
-                    'version': '1.0',
-                },
-            ]
-        }
-        res['subprojects'] = sorted(res['subprojects'], key=lambda i: i['name'])
-        self.assertDictEqual(expected, res)
-
-    def test_introspection_target_subproject(self):
-        testdir = os.path.join(self.common_test_dir, '45 subproject')
-        self.init(testdir)
-        res = self.introspect('--targets')
-
-        expected = {
-            'sublib': 'sublib',
-            'simpletest': 'sublib',
-            'user': None
-        }
-
-        for entry in res:
-            name = entry['name']
-            self.assertEqual(entry['subproject'], expected[name])
-
-    def test_introspect_projectinfo_subproject_dir(self):
-        testdir = os.path.join(self.common_test_dir, '78 custom subproject dir')
-        self.init(testdir)
-        res = self.introspect('--projectinfo')
-
-        self.assertEqual(res['subproject_dir'], 'custom_subproject_dir')
-
-    def test_introspect_projectinfo_subproject_dir_from_source(self):
-        testfile = os.path.join(self.common_test_dir, '78 custom subproject dir', 'meson.build')
-        res = self.introspect_directory(testfile, '--projectinfo')
-
-        self.assertEqual(res['subproject_dir'], 'custom_subproject_dir')
-
-    @skipIfNoExecutable('clang-format')
-    def test_clang_format(self):
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Clang-format is for now only supported on Ninja, not {}'.format(self.backend.name))
-        testdir = os.path.join(self.unit_test_dir, '54 clang-format')
-        testfile = os.path.join(testdir, 'prog.c')
-        badfile = os.path.join(testdir, 'prog_orig_c')
-        goodfile = os.path.join(testdir, 'prog_expected_c')
-        testheader = os.path.join(testdir, 'header.h')
-        badheader = os.path.join(testdir, 'header_orig_h')
-        goodheader = os.path.join(testdir, 'header_expected_h')
-        try:
-            shutil.copyfile(badfile, testfile)
-            shutil.copyfile(badheader, testheader)
-            self.init(testdir)
-            self.assertNotEqual(Path(testfile).read_text(),
-                                Path(goodfile).read_text())
-            self.assertNotEqual(Path(testheader).read_text(),
-                                Path(goodheader).read_text())
-            self.run_target('clang-format')
-            self.assertEqual(Path(testheader).read_text(),
-                             Path(goodheader).read_text())
-        finally:
-            if os.path.exists(testfile):
-                os.unlink(testfile)
-            if os.path.exists(testheader):
-                os.unlink(testheader)
-
-    @skipIfNoExecutable('clang-tidy')
-    def test_clang_tidy(self):
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Clang-tidy is for now only supported on Ninja, not {}'.format(self.backend.name))
-        if shutil.which('c++') is None:
-            raise unittest.SkipTest('Clang-tidy breaks when ccache is used and "c++" not in path.')
-        if is_osx():
-            raise unittest.SkipTest('Apple ships a broken clang-tidy that chokes on -pipe.')
-        testdir = os.path.join(self.unit_test_dir, '70 clang-tidy')
-        self.init(testdir, override_envvars={'CXX': 'c++'})
-        out = self.run_target('clang-tidy')
-        self.assertIn('cttest.cpp:4:20', out)
-
-    def test_identity_cross(self):
-        testdir = os.path.join(self.unit_test_dir, '71 cross')
-        # Do a build to generate a cross file where the host is this target
-        self.init(testdir, extra_args=['-Dgenerate=true'])
-        self.meson_cross_file = os.path.join(self.builddir, "crossfile")
-        self.assertTrue(os.path.exists(self.meson_cross_file))
-        # Now verify that this is detected as cross
-        self.new_builddir()
-        self.init(testdir)
-
-    def test_introspect_buildoptions_without_configured_build(self):
-        testdir = os.path.join(self.unit_test_dir, '59 introspect buildoptions')
-        testfile = os.path.join(testdir, 'meson.build')
-        res_nb = self.introspect_directory(testfile, ['--buildoptions'] + self.meson_args)
-        self.init(testdir, default_args=False)
-        res_wb = self.introspect('--buildoptions')
-        self.maxDiff = None
-        self.assertListEqual(res_nb, res_wb)
-
-    def test_meson_configure_from_source_does_not_crash(self):
-        testdir = os.path.join(self.unit_test_dir, '59 introspect buildoptions')
-        self._run(self.mconf_command + [testdir])
-
-    def test_introspect_json_dump(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        self.init(testdir)
-        infodir = os.path.join(self.builddir, 'meson-info')
-        self.assertPathExists(infodir)
-
-        def assertKeyTypes(key_type_list, obj):
-            for i in key_type_list:
-                self.assertIn(i[0], obj)
-                self.assertIsInstance(obj[i[0]], i[1])
-
-        root_keylist = [
-            ('benchmarks', list),
-            ('buildoptions', list),
-            ('buildsystem_files', list),
-            ('dependencies', list),
-            ('installed', dict),
-            ('projectinfo', dict),
-            ('targets', list),
-            ('tests', list),
-        ]
-
-        test_keylist = [
-            ('cmd', list),
-            ('env', dict),
-            ('name', str),
-            ('timeout', int),
-            ('suite', list),
-            ('is_parallel', bool),
-            ('protocol', str),
-        ]
-
-        buildoptions_keylist = [
-            ('name', str),
-            ('section', str),
-            ('type', str),
-            ('description', str),
-            ('machine', str),
-        ]
-
-        buildoptions_typelist = [
-            ('combo', str, [('choices', list)]),
-            ('string', str, []),
-            ('boolean', bool, []),
-            ('integer', int, []),
-            ('array', list, []),
-        ]
-
-        buildoptions_sections = ['core', 'backend', 'base', 'compiler', 'directory', 'user', 'test']
-        buildoptions_machines = ['any', 'build', 'host']
-
-        dependencies_typelist = [
-            ('name', str),
-            ('version', str),
-            ('compile_args', list),
-            ('link_args', list),
-        ]
-
-        targets_typelist = [
-            ('name', str),
-            ('id', str),
-            ('type', str),
-            ('defined_in', str),
-            ('filename', list),
-            ('build_by_default', bool),
-            ('target_sources', list),
-            ('installed', bool),
-        ]
-
-        targets_sources_typelist = [
-            ('language', str),
-            ('compiler', list),
-            ('parameters', list),
-            ('sources', list),
-            ('generated_sources', list),
-        ]
-
-        # First load all files
-        res = {}
-        for i in root_keylist:
-            curr = os.path.join(infodir, 'intro-{}.json'.format(i[0]))
-            self.assertPathExists(curr)
-            with open(curr, 'r') as fp:
-                res[i[0]] = json.load(fp)
-
-        assertKeyTypes(root_keylist, res)
-
-        # Check Tests and benchmarks
-        tests_to_find = ['test case 1', 'test case 2', 'benchmark 1']
-        for i in res['benchmarks'] + res['tests']:
-            assertKeyTypes(test_keylist, i)
-            if i['name'] in tests_to_find:
-                tests_to_find.remove(i['name'])
-        self.assertListEqual(tests_to_find, [])
-
-        # Check buildoptions
-        buildopts_to_find = {'cpp_std': 'c++11'}
-        for i in res['buildoptions']:
-            assertKeyTypes(buildoptions_keylist, i)
-            valid_type = False
-            for j in buildoptions_typelist:
-                if i['type'] == j[0]:
-                    self.assertIsInstance(i['value'], j[1])
-                    assertKeyTypes(j[2], i)
-                    valid_type = True
-                    break
-
-            self.assertIn(i['section'], buildoptions_sections)
-            self.assertIn(i['machine'], buildoptions_machines)
-            self.assertTrue(valid_type)
-            if i['name'] in buildopts_to_find:
-                self.assertEqual(i['value'], buildopts_to_find[i['name']])
-                buildopts_to_find.pop(i['name'], None)
-        self.assertDictEqual(buildopts_to_find, {})
-
-        # Check buildsystem_files
-        bs_files = ['meson.build', 'meson_options.txt', 'sharedlib/meson.build', 'staticlib/meson.build']
-        bs_files = [os.path.join(testdir, x) for x in bs_files]
-        self.assertPathListEqual(list(sorted(res['buildsystem_files'])), list(sorted(bs_files)))
-
-        # Check dependencies
-        dependencies_to_find = ['threads']
-        for i in res['dependencies']:
-            assertKeyTypes(dependencies_typelist, i)
-            if i['name'] in dependencies_to_find:
-                dependencies_to_find.remove(i['name'])
-        self.assertListEqual(dependencies_to_find, [])
-
-        # Check projectinfo
-        self.assertDictEqual(res['projectinfo'], {'version': '1.2.3', 'descriptive_name': 'introspection', 'subproject_dir': 'subprojects', 'subprojects': []})
-
-        # Check targets
-        targets_to_find = {
-            'sharedTestLib': ('shared library', True, False, 'sharedlib/meson.build'),
-            'staticTestLib': ('static library', True, False, 'staticlib/meson.build'),
-            'test1': ('executable', True, True, 'meson.build'),
-            'test2': ('executable', True, False, 'meson.build'),
-            'test3': ('executable', True, False, 'meson.build'),
-        }
-        for i in res['targets']:
-            assertKeyTypes(targets_typelist, i)
-            if i['name'] in targets_to_find:
-                tgt = targets_to_find[i['name']]
-                self.assertEqual(i['type'], tgt[0])
-                self.assertEqual(i['build_by_default'], tgt[1])
-                self.assertEqual(i['installed'], tgt[2])
-                self.assertPathEqual(i['defined_in'], os.path.join(testdir, tgt[3]))
-                targets_to_find.pop(i['name'], None)
-            for j in i['target_sources']:
-                assertKeyTypes(targets_sources_typelist, j)
-        self.assertDictEqual(targets_to_find, {})
-
-    def test_introspect_file_dump_equals_all(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        self.init(testdir)
-        res_all = self.introspect('--all')
-        res_file = {}
-
-        root_keylist = [
-            'benchmarks',
-            'buildoptions',
-            'buildsystem_files',
-            'dependencies',
-            'installed',
-            'projectinfo',
-            'targets',
-            'tests',
-        ]
-
-        infodir = os.path.join(self.builddir, 'meson-info')
-        self.assertPathExists(infodir)
-        for i in root_keylist:
-            curr = os.path.join(infodir, 'intro-{}.json'.format(i))
-            self.assertPathExists(curr)
-            with open(curr, 'r') as fp:
-                res_file[i] = json.load(fp)
-
-        self.assertEqual(res_all, res_file)
-
-    def test_introspect_meson_info(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        introfile = os.path.join(self.builddir, 'meson-info', 'meson-info.json')
-        self.init(testdir)
-        self.assertPathExists(introfile)
-        with open(introfile, 'r') as fp:
-            res1 = json.load(fp)
-
-        for i in ['meson_version', 'directories', 'introspection', 'build_files_updated', 'error']:
-            self.assertIn(i, res1)
-
-        self.assertEqual(res1['error'], False)
-        self.assertEqual(res1['build_files_updated'], True)
-
-    def test_introspect_config_update(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        introfile = os.path.join(self.builddir, 'meson-info', 'intro-buildoptions.json')
-        self.init(testdir)
-        self.assertPathExists(introfile)
-        with open(introfile, 'r') as fp:
-            res1 = json.load(fp)
-
-        self.setconf('-Dcpp_std=c++14')
-        self.setconf('-Dbuildtype=release')
-
-        for idx, i in enumerate(res1):
-            if i['name'] == 'cpp_std':
-                res1[idx]['value'] = 'c++14'
-            if i['name'] == 'build.cpp_std':
-                res1[idx]['value'] = 'c++14'
-            if i['name'] == 'buildtype':
-                res1[idx]['value'] = 'release'
-            if i['name'] == 'optimization':
-                res1[idx]['value'] = '3'
-            if i['name'] == 'debug':
-                res1[idx]['value'] = False
-
-        with open(introfile, 'r') as fp:
-            res2 = json.load(fp)
-
-        self.assertListEqual(res1, res2)
-
-    def test_introspect_targets_from_source(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        testfile = os.path.join(testdir, 'meson.build')
-        introfile = os.path.join(self.builddir, 'meson-info', 'intro-targets.json')
-        self.init(testdir)
-        self.assertPathExists(introfile)
-        with open(introfile, 'r') as fp:
-            res_wb = json.load(fp)
-
-        res_nb = self.introspect_directory(testfile, ['--targets'] + self.meson_args)
-
-        # Account for differences in output
-        for i in res_wb:
-            i['filename'] = [os.path.relpath(x, self.builddir) for x in i['filename']]
-            if 'install_filename' in i:
-                del i['install_filename']
-
-            sources = []
-            for j in i['target_sources']:
-                sources += j['sources']
-            i['target_sources'] = [{
-                'language': 'unknown',
-                'compiler': [],
-                'parameters': [],
-                'sources': sources,
-                'generated_sources': []
-            }]
-
-        self.maxDiff = None
-        self.assertListEqual(res_nb, res_wb)
-
-    def test_introspect_ast_source(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        testfile = os.path.join(testdir, 'meson.build')
-        res_nb = self.introspect_directory(testfile, ['--ast'] + self.meson_args)
-
-        node_counter = {}
-
-        def accept_node(json_node):
-            self.assertIsInstance(json_node, dict)
-            for i in ['lineno', 'colno', 'end_lineno', 'end_colno']:
-                self.assertIn(i, json_node)
-                self.assertIsInstance(json_node[i], int)
-            self.assertIn('node', json_node)
-            n = json_node['node']
-            self.assertIsInstance(n, str)
-            self.assertIn(n, nodes)
-            if n not in node_counter:
-                node_counter[n] = 0
-            node_counter[n] = node_counter[n] + 1
-            for nodeDesc in nodes[n]:
-                key = nodeDesc[0]
-                func = nodeDesc[1]
-                self.assertIn(key, json_node)
-                if func is None:
-                    tp = nodeDesc[2]
-                    self.assertIsInstance(json_node[key], tp)
-                    continue
-                func(json_node[key])
-
-        def accept_node_list(node_list):
-            self.assertIsInstance(node_list, list)
-            for i in node_list:
-                accept_node(i)
-
-        def accept_kwargs(kwargs):
-            self.assertIsInstance(kwargs, list)
-            for i in kwargs:
-                self.assertIn('key', i)
-                self.assertIn('val', i)
-                accept_node(i['key'])
-                accept_node(i['val'])
-
-        nodes = {
-            'BooleanNode': [('value', None, bool)],
-            'IdNode': [('value', None, str)],
-            'NumberNode': [('value', None, int)],
-            'StringNode': [('value', None, str)],
-            'ContinueNode': [],
-            'BreakNode': [],
-            'ArgumentNode': [('positional', accept_node_list), ('kwargs', accept_kwargs)],
-            'ArrayNode': [('args', accept_node)],
-            'DictNode': [('args', accept_node)],
-            'EmptyNode': [],
-            'OrNode': [('left', accept_node), ('right', accept_node)],
-            'AndNode': [('left', accept_node), ('right', accept_node)],
-            'ComparisonNode': [('left', accept_node), ('right', accept_node), ('ctype', None, str)],
-            'ArithmeticNode': [('left', accept_node), ('right', accept_node), ('op', None, str)],
-            'NotNode': [('right', accept_node)],
-            'CodeBlockNode': [('lines', accept_node_list)],
-            'IndexNode': [('object', accept_node), ('index', accept_node)],
-            'MethodNode': [('object', accept_node), ('args', accept_node), ('name', None, str)],
-            'FunctionNode': [('args', accept_node), ('name', None, str)],
-            'AssignmentNode': [('value', accept_node), ('var_name', None, str)],
-            'PlusAssignmentNode': [('value', accept_node), ('var_name', None, str)],
-            'ForeachClauseNode': [('items', accept_node), ('block', accept_node), ('varnames', None, list)],
-            'IfClauseNode': [('ifs', accept_node_list), ('else', accept_node)],
-            'IfNode': [('condition', accept_node), ('block', accept_node)],
-            'UMinusNode': [('right', accept_node)],
-            'TernaryNode': [('condition', accept_node), ('true', accept_node), ('false', accept_node)],
-        }
-
-        accept_node(res_nb)
-
-        for n, c in [('ContinueNode', 2), ('BreakNode', 1), ('NotNode', 3)]:
-            self.assertIn(n, node_counter)
-            self.assertEqual(node_counter[n], c)
-
-    def test_introspect_dependencies_from_source(self):
-        testdir = os.path.join(self.unit_test_dir, '57 introspection')
-        testfile = os.path.join(testdir, 'meson.build')
-        res_nb = self.introspect_directory(testfile, ['--scan-dependencies'] + self.meson_args)
-        expected = [
-            {
-                'name': 'threads',
-                'required': True,
-                'version': [],
-                'has_fallback': False,
-                'conditional': False
-            },
-            {
-                'name': 'zlib',
-                'required': False,
-                'version': [],
-                'has_fallback': False,
-                'conditional': False
-            },
-            {
-                'name': 'bugDep1',
-                'required': True,
-                'version': [],
-                'has_fallback': False,
-                'conditional': False
-            },
-            {
-                'name': 'somethingthatdoesnotexist',
-                'required': True,
-                'version': ['>=1.2.3'],
-                'has_fallback': False,
-                'conditional': True
-            },
-            {
-                'name': 'look_i_have_a_fallback',
-                'required': True,
-                'version': ['>=1.0.0', '<=99.9.9'],
-                'has_fallback': True,
-                'conditional': True
-            }
-        ]
-        self.maxDiff = None
-        self.assertListEqual(res_nb, expected)
-
-    def test_unstable_coredata(self):
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        self.init(testdir)
-        # just test that the command does not fail (e.g. because it throws an exception)
-        self._run([*self.meson_command, 'unstable-coredata', self.builddir])
-
-    @skip_if_no_cmake
-    def test_cmake_prefix_path(self):
-        testdir = os.path.join(self.unit_test_dir, '64 cmake_prefix_path')
-        self.init(testdir, extra_args=['-Dcmake_prefix_path=' + os.path.join(testdir, 'prefix')])
-
-    @skip_if_no_cmake
-    def test_cmake_parser(self):
-        testdir = os.path.join(self.unit_test_dir, '65 cmake parser')
-        self.init(testdir, extra_args=['-Dcmake_prefix_path=' + os.path.join(testdir, 'prefix')])
-
-    def test_alias_target(self):
-        if self.backend is Backend.vs:
-            # FIXME: This unit test is broken with vs backend, needs investigation
-            raise unittest.SkipTest('Skipping alias_target test with {} backend'.format(self.backend.name))
-        testdir = os.path.join(self.unit_test_dir, '66 alias target')
-        self.init(testdir)
-        self.build()
-        self.assertPathDoesNotExist(os.path.join(self.builddir, 'prog' + exe_suffix))
-        self.assertPathDoesNotExist(os.path.join(self.builddir, 'hello.txt'))
-        self.run_target('build-all')
-        self.assertPathExists(os.path.join(self.builddir, 'prog' + exe_suffix))
-        self.assertPathExists(os.path.join(self.builddir, 'hello.txt'))
-
-    def test_configure(self):
-        testdir = os.path.join(self.common_test_dir, '2 cpp')
-        self.init(testdir)
-        self._run(self.mconf_command + [self.builddir])
-
-    def test_summary(self):
-        testdir = os.path.join(self.unit_test_dir, '73 summary')
-        out = self.init(testdir)
-        expected = textwrap.dedent(r'''
-            Some Subproject 2.0
-
-                 string: bar
-                integer: 1
-                boolean: True
-
-            My Project 1.0
-
-              Configuration
-                   Some boolean: False
-                Another boolean: True
-                    Some string: Hello World
-                         A list: string
-                                 1
-                                 True
-                     empty list:
-                       A number: 1
-                            yes: YES
-                             no: NO
-                      coma list: a, b, c
-
-              Subprojects
-                            sub: YES
-                           sub2: NO Problem encountered: This subproject failed
-            ''')
-        expected_lines = expected.split('\n')[1:]
-        out_start = out.find(expected_lines[0])
-        out_lines = out[out_start:].split('\n')[:len(expected_lines)]
-        if sys.version_info < (3, 7, 0):
-            # Dictionary order is not stable in Python <3.7, so sort the lines
-            # while comparing
-            self.assertEqual(sorted(expected_lines), sorted(out_lines))
-        else:
-            self.assertEqual(expected_lines, out_lines)
-
-    def test_meson_compile(self):
-        """Test the meson compile command."""
-
-        def get_exe_name(basename: str) -> str:
-            if is_windows():
-                return '{}.exe'.format(basename)
-            else:
-                return basename
-
-        def get_shared_lib_name(basename: str) -> str:
-            if mesonbuild.environment.detect_msys2_arch():
-                return 'lib{}.dll'.format(basename)
-            elif is_windows():
-                return '{}.dll'.format(basename)
-            elif is_cygwin():
-                return 'cyg{}.dll'.format(basename)
-            elif is_osx():
-                return 'lib{}.dylib'.format(basename)
-            else:
-                return 'lib{}.so'.format(basename)
-
-        def get_static_lib_name(basename: str) -> str:
-            return 'lib{}.a'.format(basename)
-
-        # Base case (no targets or additional arguments)
-
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        self.init(testdir)
-
-        self._run([*self.meson_command, 'compile', '-C', self.builddir])
-        self.assertPathExists(os.path.join(self.builddir, get_exe_name('trivialprog')))
-
-        # `--clean`
-
-        self._run([*self.meson_command, 'compile', '-C', self.builddir, '--clean'])
-        self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('trivialprog')))
-
-        # Target specified in a project with unique names
-
-        testdir = os.path.join(self.common_test_dir, '6 linkshared')
-        self.init(testdir, extra_args=['--wipe'])
-        # Multiple targets and target type specified
-        self._run([*self.meson_command, 'compile', '-C', self.builddir, 'mylib', 'mycpplib:shared_library'])
-        # Check that we have a shared lib, but not an executable, i.e. check that target actually worked
-        self.assertPathExists(os.path.join(self.builddir, get_shared_lib_name('mylib')))
-        self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('prog')))
-        self.assertPathExists(os.path.join(self.builddir, get_shared_lib_name('mycpplib')))
-        self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('cppprog')))
-
-        # Target specified in a project with non unique names
-
-        testdir = os.path.join(self.common_test_dir, '190 same target name')
-        self.init(testdir, extra_args=['--wipe'])
-        self._run([*self.meson_command, 'compile', '-C', self.builddir, './foo'])
-        self.assertPathExists(os.path.join(self.builddir, get_static_lib_name('foo')))
-        self._run([*self.meson_command, 'compile', '-C', self.builddir, 'sub/foo'])
-        self.assertPathExists(os.path.join(self.builddir, 'sub', get_static_lib_name('foo')))
-
-        # run_target
-
-        testdir = os.path.join(self.common_test_dir, '54 run target')
-        self.init(testdir, extra_args=['--wipe'])
-        out = self._run([*self.meson_command, 'compile', '-C', self.builddir, 'py3hi'])
-        self.assertIn('I am Python3.', out)
-
-        # `--$BACKEND-args`
-
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        if self.backend is Backend.ninja:
-            self.init(testdir, extra_args=['--wipe'])
-            # Dry run - should not create a program
-            self._run([*self.meson_command, 'compile', '-C', self.builddir, '--ninja-args=-n'])
-            self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('trivialprog')))
-        elif self.backend is Backend.vs:
-            self.init(testdir, extra_args=['--wipe'])
-            self._run([*self.meson_command, 'compile', '-C', self.builddir])
-            # Explicitly clean the target through msbuild interface
-            self._run([*self.meson_command, 'compile', '-C', self.builddir, '--vs-args=-t:{}:Clean'.format(re.sub(r'[\%\$\@\;\.\(\)\']', '_', get_exe_name('trivialprog')))])
-            self.assertPathDoesNotExist(os.path.join(self.builddir, get_exe_name('trivialprog')))
-
-    def test_spurious_reconfigure_built_dep_file(self):
-        testdir = os.path.join(self.unit_test_dir, '75 dep files')
-
-        # Regression test: Spurious reconfigure was happening when build
-        # directory is inside source directory.
-        # See https://gitlab.freedesktop.org/gstreamer/gst-build/-/issues/85.
-        srcdir = os.path.join(self.builddir, 'srctree')
-        shutil.copytree(testdir, srcdir)
-        builddir = os.path.join(srcdir, '_build')
-        self.change_builddir(builddir)
-
-        self.init(srcdir)
-        self.build()
-
-        # During first configure the file did not exist so no dependency should
-        # have been set. A rebuild should not trigger a reconfigure.
-        self.clean()
-        out = self.build()
-        self.assertNotIn('Project configured', out)
-
-        self.init(srcdir, extra_args=['--reconfigure'])
-
-        # During the reconfigure the file did exist, but is inside build
-        # directory, so no dependency should have been set. A rebuild should not
-        # trigger a reconfigure.
-        self.clean()
-        out = self.build()
-        self.assertNotIn('Project configured', out)
-
-    def _test_junit(self, case: str) -> None:
-        try:
-            import lxml.etree as et
-        except ImportError:
-            raise unittest.SkipTest('lxml required, but not found.')
-
-        schema = et.XMLSchema(et.parse(str(Path(__file__).parent / 'data' / 'schema.xsd')))
-
-        self.init(case)
-        self.run_tests()
-
-        junit = et.parse(str(Path(self.builddir) / 'meson-logs' / 'testlog.junit.xml'))
-        try:
-            schema.assertValid(junit)
-        except et.DocumentInvalid as e:
-            self.fail(e.error_log)
-
-    def test_junit_valid_tap(self):
-        self._test_junit(os.path.join(self.common_test_dir, '213 tap tests'))
-
-    def test_junit_valid_exitcode(self):
-        self._test_junit(os.path.join(self.common_test_dir, '44 test args'))
-
-    def test_junit_valid_gtest(self):
-        self._test_junit(os.path.join(self.framework_test_dir, '2 gtest'))
-
-    def test_link_language_linker(self):
-        # TODO: there should be some way to query how we're linking things
-        # without resorting to reading the ninja.build file
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('This test reads the ninja file')
-
-        testdir = os.path.join(self.common_test_dir, '232 link language')
-        self.init(testdir)
-
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            contents = f.read()
-
-        self.assertRegex(contents, r'build main(\.exe)?.*: c_LINKER')
-        self.assertRegex(contents, r'build (lib|cyg)?mylib.*: c_LINKER')
-
-    def test_commands_documented(self):
-        '''
-        Test that all listed meson commands are documented in Commands.md.
-        '''
-
-        # The docs directory is not in release tarballs.
-        if not os.path.isdir('docs'):
-            raise unittest.SkipTest('Doc directory does not exist.')
-        doc_path = 'docs/markdown_dynamic/Commands.md'
-
-        md = None
-        with open(doc_path, encoding='utf-8') as f:
-            md = f.read()
-        self.assertIsNotNone(md)
-
-        ## Get command sections
-
-        section_pattern = re.compile(r'^### (.+)$', re.MULTILINE)
-        md_command_section_matches = [i for i in section_pattern.finditer(md)]
-        md_command_sections = dict()
-        for i, s in enumerate(md_command_section_matches):
-            section_end = len(md) if i == len(md_command_section_matches) - 1 else md_command_section_matches[i + 1].start()
-            md_command_sections[s.group(1)] = (s.start(), section_end)
-
-        ## Validate commands
-
-        md_commands = set(k for k,v in md_command_sections.items())
-
-        help_output = self._run(self.meson_command + ['--help'])
-        help_commands = set(c.strip() for c in re.findall(r'usage:(?:.+)?{((?:[a-z]+,*)+?)}', help_output, re.MULTILINE|re.DOTALL)[0].split(','))
-
-        self.assertEqual(md_commands | {'help'}, help_commands, 'Doc file: `{}`'.format(doc_path))
-
-        ## Validate that each section has proper placeholders
-
-        def get_data_pattern(command):
-            return re.compile(
-                r'^```[\r\n]'
-                r'{{ cmd_help\[\'' + command + r'\'\]\[\'usage\'\] }}[\r\n]'
-                r'^```[\r\n]'
-                r'.*?'
-                r'^```[\r\n]'
-                r'{{ cmd_help\[\'' + command + r'\'\]\[\'arguments\'\] }}[\r\n]'
-                r'^```',
-                flags = re.MULTILINE|re.DOTALL)
-
-        for command in md_commands:
-            m = get_data_pattern(command).search(md, pos=md_command_sections[command][0], endpos=md_command_sections[command][1])
-            self.assertIsNotNone(m, 'Command `{}` is missing placeholders for dynamic data. Doc file: `{}`'.format(command, doc_path))
-
-    def _check_coverage_files(self, types=('text', 'xml', 'html')):
-        covdir = Path(self.builddir) / 'meson-logs'
-        files = []
-        if 'text' in types:
-            files.append('coverage.txt')
-        if 'xml' in types:
-            files.append('coverage.xml')
-        if 'html' in types:
-            files.append('coveragereport/index.html')
-        for f in files:
-            self.assertTrue((covdir / f).is_file(), msg='{} is not a file'.format(f))
-
-    def test_coverage(self):
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
-        gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
-        if not gcovr_exe:
-            raise unittest.SkipTest('gcovr not found, or too old')
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_id() == 'clang':
-            if not mesonbuild.environment.detect_llvm_cov():
-                raise unittest.SkipTest('llvm-cov not found')
-        if cc.get_id() == 'msvc':
-            raise unittest.SkipTest('Test only applies to non-MSVC compilers')
-        self.init(testdir, extra_args=['-Db_coverage=true'])
-        self.build()
-        self.run_tests()
-        self.run_target('coverage')
-        self._check_coverage_files()
-
-    def test_coverage_complex(self):
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
-        gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
-        if not gcovr_exe:
-            raise unittest.SkipTest('gcovr not found, or too old')
-        testdir = os.path.join(self.common_test_dir, '109 generatorcustom')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_id() == 'clang':
-            if not mesonbuild.environment.detect_llvm_cov():
-                raise unittest.SkipTest('llvm-cov not found')
-        if cc.get_id() == 'msvc':
-            raise unittest.SkipTest('Test only applies to non-MSVC compilers')
-        self.init(testdir, extra_args=['-Db_coverage=true'])
-        self.build()
-        self.run_tests()
-        self.run_target('coverage')
-        self._check_coverage_files()
-
-    def test_coverage_html(self):
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
-        gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
-        if not gcovr_exe:
-            raise unittest.SkipTest('gcovr not found, or too old')
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_id() == 'clang':
-            if not mesonbuild.environment.detect_llvm_cov():
-                raise unittest.SkipTest('llvm-cov not found')
-        if cc.get_id() == 'msvc':
-            raise unittest.SkipTest('Test only applies to non-MSVC compilers')
-        self.init(testdir, extra_args=['-Db_coverage=true'])
-        self.build()
-        self.run_tests()
-        self.run_target('coverage-html')
-        self._check_coverage_files(['html'])
-
-    def test_coverage_text(self):
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
-        gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
-        if not gcovr_exe:
-            raise unittest.SkipTest('gcovr not found, or too old')
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_id() == 'clang':
-            if not mesonbuild.environment.detect_llvm_cov():
-                raise unittest.SkipTest('llvm-cov not found')
-        if cc.get_id() == 'msvc':
-            raise unittest.SkipTest('Test only applies to non-MSVC compilers')
-        self.init(testdir, extra_args=['-Db_coverage=true'])
-        self.build()
-        self.run_tests()
-        self.run_target('coverage-text')
-        self._check_coverage_files(['text'])
-
-    def test_coverage_xml(self):
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with coverage on MSYS2')
-        gcovr_exe, gcovr_new_rootdir = mesonbuild.environment.detect_gcovr()
-        if not gcovr_exe:
-            raise unittest.SkipTest('gcovr not found, or too old')
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_id() == 'clang':
-            if not mesonbuild.environment.detect_llvm_cov():
-                raise unittest.SkipTest('llvm-cov not found')
-        if cc.get_id() == 'msvc':
-            raise unittest.SkipTest('Test only applies to non-MSVC compilers')
-        self.init(testdir, extra_args=['-Db_coverage=true'])
-        self.build()
-        self.run_tests()
-        self.run_target('coverage-xml')
-        self._check_coverage_files(['xml'])
-
-    def test_cross_file_constants(self):
-        with temp_filename() as crossfile1, temp_filename() as crossfile2:
-            with open(crossfile1, 'w') as f:
-                f.write(textwrap.dedent(
-                    '''
-                    [constants]
-                    compiler = 'gcc'
-                    '''))
-            with open(crossfile2, 'w') as f:
-                f.write(textwrap.dedent(
-                    '''
-                    [constants]
-                    toolchain = '/toolchain/'
-                    common_flags = ['--sysroot=' + toolchain / 'sysroot']
-
-                    [properties]
-                    c_args = common_flags + ['-DSOMETHING']
-                    cpp_args = c_args + ['-DSOMETHING_ELSE']
-
-                    [binaries]
-                    c = toolchain / compiler
-                    '''))
-
-            values = mesonbuild.coredata.parse_machine_files([crossfile1, crossfile2])
-            self.assertEqual(values['binaries']['c'], '/toolchain/gcc')
-            self.assertEqual(values['properties']['c_args'],
-                             ['--sysroot=/toolchain/sysroot', '-DSOMETHING'])
-            self.assertEqual(values['properties']['cpp_args'],
-                             ['--sysroot=/toolchain/sysroot', '-DSOMETHING', '-DSOMETHING_ELSE'])
-
-    @unittest.skipIf(is_windows(), 'Directory cleanup fails for some reason')
-    def test_wrap_git(self):
-        with tempfile.TemporaryDirectory() as tmpdir:
-            srcdir = os.path.join(tmpdir, 'src')
-            shutil.copytree(os.path.join(self.unit_test_dir, '78 wrap-git'), srcdir)
-            upstream = os.path.join(srcdir, 'subprojects', 'wrap_git_upstream')
-            upstream_uri = Path(upstream).as_uri()
-            _git_init(upstream)
-            with open(os.path.join(srcdir, 'subprojects', 'wrap_git.wrap'), 'w') as f:
-                f.write(textwrap.dedent('''
-                  [wrap-git]
-                  url = {}
-                  patch_directory = wrap_git_builddef
-                  revision = master
-                '''.format(upstream_uri)))
-            self.init(srcdir)
-            self.build()
-            self.run_tests()
-
-    def test_multi_output_custom_target_no_warning(self):
-        testdir = os.path.join(self.common_test_dir, '235 custom_target source')
-
-        out = self.init(testdir)
-        self.assertNotRegex(out, 'WARNING:.*Using the first one.')
-        self.build()
-        self.run_tests()
-
-class FailureTests(BasePlatformTests):
-    '''
-    Tests that test failure conditions. Build files here should be dynamically
-    generated and static tests should go into `test cases/failing*`.
-    This is useful because there can be many ways in which a particular
-    function can fail, and creating failing tests for all of them is tedious
-    and slows down testing.
-    '''
-    dnf = "[Dd]ependency.*not found(:.*)?"
-    nopkg = '[Pp]kg-config.*not found'
-
-    def setUp(self):
-        super().setUp()
-        self.srcdir = os.path.realpath(tempfile.mkdtemp())
-        self.mbuild = os.path.join(self.srcdir, 'meson.build')
-        self.moptions = os.path.join(self.srcdir, 'meson_options.txt')
-
-    def tearDown(self):
-        super().tearDown()
-        windows_proof_rmtree(self.srcdir)
-
-    def assertMesonRaises(self, contents, match, *,
-                          extra_args=None,
-                          langs=None,
-                          meson_version=None,
-                          options=None,
-                          override_envvars=None):
-        '''
-        Assert that running meson configure on the specified @contents raises
-        a error message matching regex @match.
-        '''
-        if langs is None:
-            langs = []
-        with open(self.mbuild, 'w') as f:
-            f.write("project('failure test', 'c', 'cpp'")
-            if meson_version:
-                f.write(", meson_version: '{}'".format(meson_version))
-            f.write(")\n")
-            for lang in langs:
-                f.write("add_languages('{}', required : false)\n".format(lang))
-            f.write(contents)
-        if options is not None:
-            with open(self.moptions, 'w') as f:
-                f.write(options)
-        o = {'MESON_FORCE_BACKTRACE': '1'}
-        if override_envvars is None:
-            override_envvars = o
-        else:
-            override_envvars.update(o)
-        # Force tracebacks so we can detect them properly
-        with self.assertRaisesRegex(MesonException, match, msg=contents):
-            # Must run in-process or we'll get a generic CalledProcessError
-            self.init(self.srcdir, extra_args=extra_args,
-                      inprocess=True,
-                      override_envvars = override_envvars)
-
-    def obtainMesonOutput(self, contents, match, extra_args, langs, meson_version=None):
-        if langs is None:
-            langs = []
-        with open(self.mbuild, 'w') as f:
-            f.write("project('output test', 'c', 'cpp'")
-            if meson_version:
-                f.write(", meson_version: '{}'".format(meson_version))
-            f.write(")\n")
-            for lang in langs:
-                f.write("add_languages('{}', required : false)\n".format(lang))
-            f.write(contents)
-        # Run in-process for speed and consistency with assertMesonRaises
-        return self.init(self.srcdir, extra_args=extra_args, inprocess=True)
-
-    def assertMesonOutputs(self, contents, match, extra_args=None, langs=None, meson_version=None):
-        '''
-        Assert that running meson configure on the specified @contents outputs
-        something that matches regex @match.
-        '''
-        out = self.obtainMesonOutput(contents, match, extra_args, langs, meson_version)
-        self.assertRegex(out, match)
-
-    def assertMesonDoesNotOutput(self, contents, match, extra_args=None, langs=None, meson_version=None):
-        '''
-        Assert that running meson configure on the specified @contents does not output
-        something that matches regex @match.
-        '''
-        out = self.obtainMesonOutput(contents, match, extra_args, langs, meson_version)
-        self.assertNotRegex(out, match)
-
-    @skipIfNoPkgconfig
-    def test_dependency(self):
-        if subprocess.call(['pkg-config', '--exists', 'zlib']) != 0:
-            raise unittest.SkipTest('zlib not found with pkg-config')
-        a = (("dependency('zlib', method : 'fail')", "'fail' is invalid"),
-             ("dependency('zlib', static : '1')", "[Ss]tatic.*boolean"),
-             ("dependency('zlib', version : 1)", "Item must be a list or one of <class 'str'>"),
-             ("dependency('zlib', required : 1)", "[Rr]equired.*boolean"),
-             ("dependency('zlib', method : 1)", "[Mm]ethod.*string"),
-             ("dependency('zlibfail')", self.dnf),)
-        for contents, match in a:
-            self.assertMesonRaises(contents, match)
-
-    def test_apple_frameworks_dependency(self):
-        if not is_osx():
-            raise unittest.SkipTest('only run on macOS')
-        self.assertMesonRaises("dependency('appleframeworks')",
-                               "requires at least one module")
-
-    def test_extraframework_dependency_method(self):
-        code = "dependency('python', method : 'extraframework')"
-        if not is_osx():
-            self.assertMesonRaises(code, self.dnf)
-        else:
-            # Python2 framework is always available on macOS
-            self.assertMesonOutputs(code, '[Dd]ependency.*python.*found.*YES')
-
-    def test_sdl2_notfound_dependency(self):
-        # Want to test failure, so skip if available
-        if shutil.which('sdl2-config'):
-            raise unittest.SkipTest('sdl2-config found')
-        self.assertMesonRaises("dependency('sdl2', method : 'sdlconfig')", self.dnf)
-        if shutil.which('pkg-config'):
-            self.assertMesonRaises("dependency('sdl2', method : 'pkg-config')", self.dnf)
-        with no_pkgconfig():
-            # Look for pkg-config, cache it, then
-            # Use cached pkg-config without erroring out, then
-            # Use cached pkg-config to error out
-            code = "dependency('foobarrr', method : 'pkg-config', required : false)\n" \
-                "dependency('foobarrr2', method : 'pkg-config', required : false)\n" \
-                "dependency('sdl2', method : 'pkg-config')"
-            self.assertMesonRaises(code, self.nopkg)
-
-    def test_gnustep_notfound_dependency(self):
-        # Want to test failure, so skip if available
-        if shutil.which('gnustep-config'):
-            raise unittest.SkipTest('gnustep-config found')
-        self.assertMesonRaises("dependency('gnustep')",
-                               "(requires a Objc compiler|{})".format(self.dnf),
-                               langs = ['objc'])
-
-    def test_wx_notfound_dependency(self):
-        # Want to test failure, so skip if available
-        if shutil.which('wx-config-3.0') or shutil.which('wx-config') or shutil.which('wx-config-gtk3'):
-            raise unittest.SkipTest('wx-config, wx-config-3.0 or wx-config-gtk3 found')
-        self.assertMesonRaises("dependency('wxwidgets')", self.dnf)
-        self.assertMesonOutputs("dependency('wxwidgets', required : false)",
-                                "Run-time dependency .*WxWidgets.* found: .*NO.*")
-
-    def test_wx_dependency(self):
-        if not shutil.which('wx-config-3.0') and not shutil.which('wx-config') and not shutil.which('wx-config-gtk3'):
-            raise unittest.SkipTest('Neither wx-config, wx-config-3.0 nor wx-config-gtk3 found')
-        self.assertMesonRaises("dependency('wxwidgets', modules : 1)",
-                               "module argument is not a string")
-
-    def test_llvm_dependency(self):
-        self.assertMesonRaises("dependency('llvm', modules : 'fail')",
-                               "(required.*fail|{})".format(self.dnf))
-
-    def test_boost_notfound_dependency(self):
-        # Can be run even if Boost is found or not
-        self.assertMesonRaises("dependency('boost', modules : 1)",
-                               "module.*not a string")
-        self.assertMesonRaises("dependency('boost', modules : 'fail')",
-                               "(fail.*not found|{})".format(self.dnf))
-
-    def test_boost_BOOST_ROOT_dependency(self):
-        # Test BOOST_ROOT; can be run even if Boost is found or not
-        self.assertMesonRaises("dependency('boost')",
-                               "(BOOST_ROOT.*absolute|{})".format(self.dnf),
-                               override_envvars = {'BOOST_ROOT': 'relative/path'})
-
-    def test_dependency_invalid_method(self):
-        code = '''zlib_dep = dependency('zlib', required : false)
-        zlib_dep.get_configtool_variable('foo')
-        '''
-        self.assertMesonRaises(code, ".* is not a config-tool dependency")
-        code = '''zlib_dep = dependency('zlib', required : false)
-        dep = declare_dependency(dependencies : zlib_dep)
-        dep.get_pkgconfig_variable('foo')
-        '''
-        self.assertMesonRaises(code, "Method.*pkgconfig.*is invalid.*internal")
-        code = '''zlib_dep = dependency('zlib', required : false)
-        dep = declare_dependency(dependencies : zlib_dep)
-        dep.get_configtool_variable('foo')
-        '''
-        self.assertMesonRaises(code, "Method.*configtool.*is invalid.*internal")
-
-    def test_objc_cpp_detection(self):
-        '''
-        Test that when we can't detect objc or objcpp, we fail gracefully.
-        '''
-        env = get_fake_env()
-        try:
-            env.detect_objc_compiler(MachineChoice.HOST)
-            env.detect_objcpp_compiler(MachineChoice.HOST)
-        except EnvironmentException:
-            code = "add_languages('objc')\nadd_languages('objcpp')"
-            self.assertMesonRaises(code, "Unknown compiler")
-            return
-        raise unittest.SkipTest("objc and objcpp found, can't test detection failure")
-
-    def test_subproject_variables(self):
-        '''
-        Test that:
-        1. The correct message is outputted when a not-required dep is not
-           found and the fallback subproject is also not found.
-        2. A not-required fallback dependency is not found because the
-           subproject failed to parse.
-        3. A not-found not-required dep with a fallback subproject outputs the
-           correct message when the fallback subproject is found but the
-           variable inside it is not.
-        4. A fallback dependency is found from the subproject parsed in (3)
-        5. The correct message is outputted when the .wrap file is missing for
-           a sub-subproject.
-        '''
-        tdir = os.path.join(self.unit_test_dir, '20 subproj dep variables')
-        out = self.init(tdir, inprocess=True)
-        self.assertRegex(out, r"Subproject directory not found and .*nosubproj.wrap.* file not found")
-        self.assertRegex(out, r'Function does not take positional arguments.')
-        self.assertRegex(out, r'WARNING:.* Dependency .*subsubproject.* not found but it is available in a sub-subproject.')
-        self.assertRegex(out, r'Subproject directory not found and .*subsubproject.wrap.* file not found')
-        self.assertRegex(out, r'Dependency .*zlibproxy.* from subproject .*subprojects.*somesubproj.* found: .*YES.*')
-
-    def test_exception_exit_status(self):
-        '''
-        Test exit status on python exception
-        '''
-        tdir = os.path.join(self.unit_test_dir, '21 exit status')
-        with self.assertRaises(subprocess.CalledProcessError) as cm:
-            self.init(tdir, inprocess=False, override_envvars = {'MESON_UNIT_TEST': '1'})
-        self.assertEqual(cm.exception.returncode, 2)
-        self.wipe()
-
-    def test_dict_requires_key_value_pairs(self):
-        self.assertMesonRaises("dict = {3, 'foo': 'bar'}",
-                               'Only key:value pairs are valid in dict construction.')
-        self.assertMesonRaises("{'foo': 'bar', 3}",
-                               'Only key:value pairs are valid in dict construction.')
-
-    def test_dict_forbids_duplicate_keys(self):
-        self.assertMesonRaises("dict = {'a': 41, 'a': 42}",
-                               'Duplicate dictionary key: a.*')
-
-    def test_dict_forbids_integer_key(self):
-        self.assertMesonRaises("dict = {3: 'foo'}",
-                               'Key must be a string.*')
-
-    def test_using_too_recent_feature(self):
-        # Here we use a dict, which was introduced in 0.47.0
-        self.assertMesonOutputs("dict = {}",
-                                ".*WARNING.*Project targeting.*but.*",
-                                meson_version='>= 0.46.0')
-
-    def test_using_recent_feature(self):
-        # Same as above, except the meson version is now appropriate
-        self.assertMesonDoesNotOutput("dict = {}",
-                                      ".*WARNING.*Project targeting.*but.*",
-                                      meson_version='>= 0.47')
-
-    def test_using_too_recent_feature_dependency(self):
-        self.assertMesonOutputs("dependency('pcap', required: false)",
-                                ".*WARNING.*Project targeting.*but.*",
-                                meson_version='>= 0.41.0')
-
-    def test_vcs_tag_featurenew_build_always_stale(self):
-        'https://github.com/mesonbuild/meson/issues/3904'
-        vcs_tag = '''version_data = configuration_data()
-        version_data.set('PROJVER', '@VCS_TAG@')
-        vf = configure_file(output : 'version.h.in', configuration: version_data)
-        f = vcs_tag(input : vf, output : 'version.h')
-        '''
-        msg = '.*WARNING:.*feature.*build_always_stale.*custom_target.*'
-        self.assertMesonDoesNotOutput(vcs_tag, msg, meson_version='>=0.43')
-
-    def test_missing_subproject_not_required_and_required(self):
-        self.assertMesonRaises("sub1 = subproject('not-found-subproject', required: false)\n" +
-                               "sub2 = subproject('not-found-subproject', required: true)",
-                               """.*Subproject "subprojects/not-found-subproject" required but not found.*""")
-
-    def test_get_variable_on_not_found_project(self):
-        self.assertMesonRaises("sub1 = subproject('not-found-subproject', required: false)\n" +
-                               "sub1.get_variable('naaa')",
-                               """Subproject "subprojects/not-found-subproject" disabled can't get_variable on it.""")
-
-    def test_version_checked_before_parsing_options(self):
-        '''
-        https://github.com/mesonbuild/meson/issues/5281
-        '''
-        options = "option('some-option', type: 'foo', value: '')"
-        match = 'Meson version is.*but project requires >=2000'
-        self.assertMesonRaises("", match, meson_version='>=2000', options=options)
-
-    def test_assert_default_message(self):
-        self.assertMesonRaises("k1 = 'a'\n" +
-                               "assert({\n" +
-                               "  k1: 1,\n" +
-                               "}['a'] == 2)\n",
-                               r"Assert failed: {k1 : 1}\['a'\] == 2")
-
-    def test_wrap_nofallback(self):
-        self.assertMesonRaises("dependency('notfound', fallback : ['foo', 'foo_dep'])",
-                               r"Dependency \'notfound\' not found and fallback is disabled",
-                               extra_args=['--wrap-mode=nofallback'])
-
-    def test_message(self):
-        self.assertMesonOutputs("message('Array:', ['a', 'b'])",
-                                r"Message:.* Array: \['a', 'b'\]")
-
-    def test_warning(self):
-        self.assertMesonOutputs("warning('Array:', ['a', 'b'])",
-                                r"WARNING:.* Array: \['a', 'b'\]")
-
-    def test_override_dependency_twice(self):
-        self.assertMesonRaises("meson.override_dependency('foo', declare_dependency())\n" +
-                               "meson.override_dependency('foo', declare_dependency())",
-                               """Tried to override dependency 'foo' which has already been resolved or overridden""")
-
-    @unittest.skipIf(is_windows(), 'zlib is not available on Windows')
-    def test_override_resolved_dependency(self):
-        self.assertMesonRaises("dependency('zlib')\n" +
-                               "meson.override_dependency('zlib', declare_dependency())",
-                               """Tried to override dependency 'zlib' which has already been resolved or overridden""")
-
-@unittest.skipUnless(is_windows() or is_cygwin(), "requires Windows (or Windows via Cygwin)")
-class WindowsTests(BasePlatformTests):
-    '''
-    Tests that should run on Cygwin, MinGW, and MSVC
-    '''
-
-    def setUp(self):
-        super().setUp()
-        self.platform_test_dir = os.path.join(self.src_root, 'test cases/windows')
-
-    @unittest.skipIf(is_cygwin(), 'Test only applicable to Windows')
-    def test_find_program(self):
-        '''
-        Test that Windows-specific edge-cases in find_program are functioning
-        correctly. Cannot be an ordinary test because it involves manipulating
-        PATH to point to a directory with Python scripts.
-        '''
-        testdir = os.path.join(self.platform_test_dir, '8 find program')
-        # Find `cmd` and `cmd.exe`
-        prog1 = ExternalProgram('cmd')
-        self.assertTrue(prog1.found(), msg='cmd not found')
-        prog2 = ExternalProgram('cmd.exe')
-        self.assertTrue(prog2.found(), msg='cmd.exe not found')
-        self.assertPathEqual(prog1.get_path(), prog2.get_path())
-        # Find cmd.exe with args without searching
-        prog = ExternalProgram('cmd', command=['cmd', '/C'])
-        self.assertTrue(prog.found(), msg='cmd not found with args')
-        self.assertPathEqual(prog.get_command()[0], 'cmd')
-        # Find cmd with an absolute path that's missing the extension
-        cmd_path = prog2.get_path()[:-4]
-        prog = ExternalProgram(cmd_path)
-        self.assertTrue(prog.found(), msg='{!r} not found'.format(cmd_path))
-        # Finding a script with no extension inside a directory works
-        prog = ExternalProgram(os.path.join(testdir, 'test-script'))
-        self.assertTrue(prog.found(), msg='test-script not found')
-        # Finding a script with an extension inside a directory works
-        prog = ExternalProgram(os.path.join(testdir, 'test-script-ext.py'))
-        self.assertTrue(prog.found(), msg='test-script-ext.py not found')
-        # Finding a script in PATH
-        os.environ['PATH'] += os.pathsep + testdir
-        # If `.PY` is in PATHEXT, scripts can be found as programs
-        if '.PY' in [ext.upper() for ext in os.environ['PATHEXT'].split(';')]:
-            # Finding a script in PATH w/o extension works and adds the interpreter
-            prog = ExternalProgram('test-script-ext')
-            self.assertTrue(prog.found(), msg='test-script-ext not found in PATH')
-            self.assertPathEqual(prog.get_command()[0], python_command[0])
-            self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py')
-        # Finding a script in PATH with extension works and adds the interpreter
-        prog = ExternalProgram('test-script-ext.py')
-        self.assertTrue(prog.found(), msg='test-script-ext.py not found in PATH')
-        self.assertPathEqual(prog.get_command()[0], python_command[0])
-        self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py')
-        # Using a script with an extension directly via command= works and adds the interpreter
-        prog = ExternalProgram('test-script-ext.py', command=[os.path.join(testdir, 'test-script-ext.py'), '--help'])
-        self.assertTrue(prog.found(), msg='test-script-ext.py with full path not picked up via command=')
-        self.assertPathEqual(prog.get_command()[0], python_command[0])
-        self.assertPathEqual(prog.get_command()[2], '--help')
-        self.assertPathBasenameEqual(prog.get_path(), 'test-script-ext.py')
-        # Using a script without an extension directly via command= works and adds the interpreter
-        prog = ExternalProgram('test-script', command=[os.path.join(testdir, 'test-script'), '--help'])
-        self.assertTrue(prog.found(), msg='test-script with full path not picked up via command=')
-        self.assertPathEqual(prog.get_command()[0], python_command[0])
-        self.assertPathEqual(prog.get_command()[2], '--help')
-        self.assertPathBasenameEqual(prog.get_path(), 'test-script')
-        # Ensure that WindowsApps gets removed from PATH
-        path = os.environ['PATH']
-        if 'WindowsApps' not in path:
-            username = os.environ['USERNAME']
-            appstore_dir = r'C:\Users\{}\AppData\Local\Microsoft\WindowsApps'.format(username)
-            path = os.pathsep + appstore_dir
-        path = ExternalProgram._windows_sanitize_path(path)
-        self.assertNotIn('WindowsApps', path)
-
-    def test_ignore_libs(self):
-        '''
-        Test that find_library on libs that are to be ignored returns an empty
-        array of arguments. Must be a unit test because we cannot inspect
-        ExternalLibraryHolder from build files.
-        '''
-        testdir = os.path.join(self.platform_test_dir, '1 basic')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_argument_syntax() != 'msvc':
-            raise unittest.SkipTest('Not using MSVC')
-        # To force people to update this test, and also test
-        self.assertEqual(set(cc.ignore_libs), {'c', 'm', 'pthread', 'dl', 'rt', 'execinfo'})
-        for l in cc.ignore_libs:
-            self.assertEqual(cc.find_library(l, env, []), [])
-
-    def test_rc_depends_files(self):
-        testdir = os.path.join(self.platform_test_dir, '5 resources')
-
-        # resource compiler depfile generation is not yet implemented for msvc
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        depfile_works = env.detect_c_compiler(MachineChoice.HOST).get_id() not in {'msvc', 'clang-cl', 'intel-cl'}
-
-        self.init(testdir)
-        self.build()
-        # Immediately rebuilding should not do anything
-        self.assertBuildIsNoop()
-        # Test compile_resources(depend_file:)
-        # Changing mtime of sample.ico should rebuild prog
-        self.utime(os.path.join(testdir, 'res', 'sample.ico'))
-        self.assertRebuiltTarget('prog')
-        # Test depfile generation by compile_resources
-        # Changing mtime of resource.h should rebuild myres.rc and then prog
-        if depfile_works:
-            self.utime(os.path.join(testdir, 'inc', 'resource', 'resource.h'))
-            self.assertRebuiltTarget('prog')
-        self.wipe()
-
-        if depfile_works:
-            testdir = os.path.join(self.platform_test_dir, '12 resources with custom targets')
-            self.init(testdir)
-            self.build()
-            # Immediately rebuilding should not do anything
-            self.assertBuildIsNoop()
-            # Changing mtime of resource.h should rebuild myres_1.rc and then prog_1
-            self.utime(os.path.join(testdir, 'res', 'resource.h'))
-            self.assertRebuiltTarget('prog_1')
-
-    def test_msvc_cpp17(self):
-        testdir = os.path.join(self.unit_test_dir, '45 vscpp17')
-
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_argument_syntax() != 'msvc':
-            raise unittest.SkipTest('Test only applies to MSVC-like compilers')
-
-        try:
-            self.init(testdir)
-        except subprocess.CalledProcessError:
-            # According to Python docs, output is only stored when
-            # using check_output. We don't use it, so we can't check
-            # that the output is correct (i.e. that it failed due
-            # to the right reason).
-            return
-        self.build()
-
-    def test_install_pdb_introspection(self):
-        testdir = os.path.join(self.platform_test_dir, '1 basic')
-
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.get_argument_syntax() != 'msvc':
-            raise unittest.SkipTest('Test only applies to MSVC-like compilers')
-
-        self.init(testdir)
-        installed = self.introspect('--installed')
-        files = [os.path.basename(path) for path in installed.values()]
-
-        self.assertTrue('prog.pdb' in files)
-
-    def _check_ld(self, name: str, lang: str, expected: str) -> None:
-        if not shutil.which(name):
-            raise unittest.SkipTest('Could not find {}.'.format(name))
-        envvars = [mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]]
-
-        # Also test a deprecated variable if there is one.
-        if envvars[0] in mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP:
-            envvars.append(
-                mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP[envvars[0]])
-
-        for envvar in envvars:
-            with mock.patch.dict(os.environ, {envvar: name}):
-                env = get_fake_env()
-                try:
-                    comp = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)
-                except EnvironmentException:
-                    raise unittest.SkipTest('Could not find a compiler for {}'.format(lang))
-                self.assertEqual(comp.linker.id, expected)
-
-    def test_link_environment_variable_lld_link(self):
-        env = get_fake_env()
-        comp = getattr(env, 'detect_c_compiler')(MachineChoice.HOST)
-        if isinstance(comp, mesonbuild.compilers.GnuLikeCompiler):
-            raise unittest.SkipTest('GCC cannot be used with link compatible linkers.')
-        self._check_ld('lld-link', 'c', 'lld-link')
-
-    def test_link_environment_variable_link(self):
-        env = get_fake_env()
-        comp = getattr(env, 'detect_c_compiler')(MachineChoice.HOST)
-        if isinstance(comp, mesonbuild.compilers.GnuLikeCompiler):
-            raise unittest.SkipTest('GCC cannot be used with link compatible linkers.')
-        self._check_ld('link', 'c', 'link')
-
-    def test_link_environment_variable_optlink(self):
-        env = get_fake_env()
-        comp = getattr(env, 'detect_c_compiler')(MachineChoice.HOST)
-        if isinstance(comp, mesonbuild.compilers.GnuLikeCompiler):
-            raise unittest.SkipTest('GCC cannot be used with link compatible linkers.')
-        self._check_ld('optlink', 'c', 'optlink')
-
-    @skip_if_not_language('rust')
-    def test_link_environment_variable_rust(self):
-        self._check_ld('link', 'rust', 'link')
-
-    @skip_if_not_language('d')
-    def test_link_environment_variable_d(self):
-        env = get_fake_env()
-        comp = getattr(env, 'detect_d_compiler')(MachineChoice.HOST)
-        if comp.id == 'dmd':
-            raise unittest.SkipTest('meson cannot reliably make DMD use a different linker.')
-        self._check_ld('lld-link', 'd', 'lld-link')
-
-    def test_pefile_checksum(self):
-        try:
-            import pefile
-        except ImportError:
-            if is_ci():
-                raise
-            raise unittest.SkipTest('pefile module not found')
-        testdir = os.path.join(self.common_test_dir, '6 linkshared')
-        self.init(testdir, extra_args=['--buildtype=release'])
-        self.build()
-        # Test that binaries have a non-zero checksum
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        cc_id = cc.get_id()
-        ld_id = cc.get_linker_id()
-        dll = glob(os.path.join(self.builddir, '*mycpplib.dll'))[0]
-        exe = os.path.join(self.builddir, 'cppprog.exe')
-        for f in (dll, exe):
-            pe = pefile.PE(f)
-            msg = 'PE file: {!r}, compiler: {!r}, linker: {!r}'.format(f, cc_id, ld_id)
-            if cc_id == 'clang-cl':
-                # Latest clang-cl tested (7.0) does not write checksums out
-                self.assertFalse(pe.verify_checksum(), msg=msg)
-            else:
-                # Verify that a valid checksum was written by all other compilers
-                self.assertTrue(pe.verify_checksum(), msg=msg)
-
-    def test_qt5dependency_vscrt(self):
-        '''
-        Test that qt5 dependencies use the debug module suffix when b_vscrt is
-        set to 'mdd'
-        '''
-        # Verify that the `b_vscrt` option is available
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if 'b_vscrt' not in cc.base_options:
-            raise unittest.SkipTest('Compiler does not support setting the VS CRT')
-        # Verify that qmake is for Qt5
-        if not shutil.which('qmake-qt5'):
-            if not shutil.which('qmake') and not is_ci():
-                raise unittest.SkipTest('QMake not found')
-            output = subprocess.getoutput('qmake --version')
-            if 'Qt version 5' not in output and not is_ci():
-                raise unittest.SkipTest('Qmake found, but it is not for Qt 5.')
-        # Setup with /MDd
-        testdir = os.path.join(self.framework_test_dir, '4 qt')
-        self.init(testdir, extra_args=['-Db_vscrt=mdd'])
-        # Verify that we're linking to the debug versions of Qt DLLs
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            contents = f.read()
-            m = re.search('build qt5core.exe: cpp_LINKER.*Qt5Cored.lib', contents)
-        self.assertIsNotNone(m, msg=contents)
-
-    def test_compiler_checks_vscrt(self):
-        '''
-        Test that the correct VS CRT is used when running compiler checks
-        '''
-        # Verify that the `b_vscrt` option is available
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if 'b_vscrt' not in cc.base_options:
-            raise unittest.SkipTest('Compiler does not support setting the VS CRT')
-
-        def sanitycheck_vscrt(vscrt):
-            checks = self.get_meson_log_sanitychecks()
-            self.assertTrue(len(checks) > 0)
-            for check in checks:
-                self.assertIn(vscrt, check)
-
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        self.init(testdir)
-        sanitycheck_vscrt('/MDd')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Dbuildtype=debugoptimized'])
-        sanitycheck_vscrt('/MD')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Dbuildtype=release'])
-        sanitycheck_vscrt('/MD')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Db_vscrt=md'])
-        sanitycheck_vscrt('/MD')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Db_vscrt=mdd'])
-        sanitycheck_vscrt('/MDd')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Db_vscrt=mt'])
-        sanitycheck_vscrt('/MT')
-
-        self.new_builddir()
-        self.init(testdir, extra_args=['-Db_vscrt=mtd'])
-        sanitycheck_vscrt('/MTd')
-
-
-@unittest.skipUnless(is_osx(), "requires Darwin")
-class DarwinTests(BasePlatformTests):
-    '''
-    Tests that should run on macOS
-    '''
-
-    def setUp(self):
-        super().setUp()
-        self.platform_test_dir = os.path.join(self.src_root, 'test cases/osx')
-
-    def test_apple_bitcode(self):
-        '''
-        Test that -fembed-bitcode is correctly added while compiling and
-        -bitcode_bundle is added while linking when b_bitcode is true and not
-        when it is false.  This can't be an ordinary test case because we need
-        to inspect the compiler database.
-        '''
-        testdir = os.path.join(self.platform_test_dir, '7 bitcode')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        if cc.id != 'clang':
-            raise unittest.SkipTest('Not using Clang on OSX')
-        # Try with bitcode enabled
-        out = self.init(testdir, extra_args='-Db_bitcode=true')
-        # Warning was printed
-        self.assertRegex(out, 'WARNING:.*b_bitcode')
-        # Compiler options were added
-        for compdb in self.get_compdb():
-            if 'module' in compdb['file']:
-                self.assertNotIn('-fembed-bitcode', compdb['command'])
-            else:
-                self.assertIn('-fembed-bitcode', compdb['command'])
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        # Linker options were added
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            contents = f.read()
-            m = re.search('LINK_ARGS =.*-bitcode_bundle', contents)
-        self.assertIsNotNone(m, msg=contents)
-        # Try with bitcode disabled
-        self.setconf('-Db_bitcode=false')
-        # Regenerate build
-        self.build()
-        for compdb in self.get_compdb():
-            self.assertNotIn('-fembed-bitcode', compdb['command'])
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            contents = f.read()
-            m = re.search('LINK_ARGS =.*-bitcode_bundle', contents)
-        self.assertIsNone(m, msg=contents)
-
-    def test_apple_bitcode_modules(self):
-        '''
-        Same as above, just for shared_module()
-        '''
-        testdir = os.path.join(self.common_test_dir, '152 shared module resolving symbol in executable')
-        # Ensure that it builds even with bitcode enabled
-        self.init(testdir, extra_args='-Db_bitcode=true')
-        self.build()
-        self.run_tests()
-
-    def _get_darwin_versions(self, fname):
-        fname = os.path.join(self.builddir, fname)
-        out = subprocess.check_output(['otool', '-L', fname], universal_newlines=True)
-        m = re.match(r'.*version (.*), current version (.*)\)', out.split('\n')[1])
-        self.assertIsNotNone(m, msg=out)
-        return m.groups()
-
-    @skipIfNoPkgconfig
-    def test_library_versioning(self):
-        '''
-        Ensure that compatibility_version and current_version are set correctly
-        '''
-        testdir = os.path.join(self.platform_test_dir, '2 library versions')
-        self.init(testdir)
-        self.build()
-        targets = {}
-        for t in self.introspect('--targets'):
-            targets[t['name']] = t['filename'][0] if isinstance(t['filename'], list) else t['filename']
-        self.assertEqual(self._get_darwin_versions(targets['some']), ('7.0.0', '7.0.0'))
-        self.assertEqual(self._get_darwin_versions(targets['noversion']), ('0.0.0', '0.0.0'))
-        self.assertEqual(self._get_darwin_versions(targets['onlyversion']), ('1.0.0', '1.0.0'))
-        self.assertEqual(self._get_darwin_versions(targets['onlysoversion']), ('5.0.0', '5.0.0'))
-        self.assertEqual(self._get_darwin_versions(targets['intver']), ('2.0.0', '2.0.0'))
-        self.assertEqual(self._get_darwin_versions(targets['stringver']), ('2.3.0', '2.3.0'))
-        self.assertEqual(self._get_darwin_versions(targets['stringlistver']), ('2.4.0', '2.4.0'))
-        self.assertEqual(self._get_darwin_versions(targets['intstringver']), ('1111.0.0', '2.5.0'))
-        self.assertEqual(self._get_darwin_versions(targets['stringlistvers']), ('2.6.0', '2.6.1'))
-
-    def test_duplicate_rpath(self):
-        testdir = os.path.join(self.unit_test_dir, '10 build_rpath')
-        # We purposely pass a duplicate rpath to Meson, in order
-        # to ascertain that Meson does not call install_name_tool
-        # with duplicate -delete_rpath arguments, which would
-        # lead to erroring out on installation
-        env = {"LDFLAGS": "-Wl,-rpath,/foo/bar"}
-        self.init(testdir, override_envvars=env)
-        self.build()
-        self.install()
-
-    def test_removing_unused_linker_args(self):
-        testdir = os.path.join(self.common_test_dir, '108 has arg')
-        env = {'CFLAGS': '-L/tmp -L /var/tmp -headerpad_max_install_names -Wl,-export_dynamic -framework Foundation'}
-        self.init(testdir, override_envvars=env)
-
-
-@unittest.skipUnless(not is_windows(), "requires something Unix-like")
-class LinuxlikeTests(BasePlatformTests):
-    '''
-    Tests that should run on Linux, macOS, and *BSD
-    '''
-
-    def test_basic_soname(self):
-        '''
-        Test that the soname is set correctly for shared libraries. This can't
-        be an ordinary test case because we need to run `readelf` and actually
-        check the soname.
-        https://github.com/mesonbuild/meson/issues/785
-        '''
-        testdir = os.path.join(self.common_test_dir, '4 shared')
-        self.init(testdir)
-        self.build()
-        lib1 = os.path.join(self.builddir, 'libmylib.so')
-        soname = get_soname(lib1)
-        self.assertEqual(soname, 'libmylib.so')
-
-    def test_custom_soname(self):
-        '''
-        Test that the soname is set correctly for shared libraries when
-        a custom prefix and/or suffix is used. This can't be an ordinary test
-        case because we need to run `readelf` and actually check the soname.
-        https://github.com/mesonbuild/meson/issues/785
-        '''
-        testdir = os.path.join(self.common_test_dir, '25 library versions')
-        self.init(testdir)
-        self.build()
-        lib1 = os.path.join(self.builddir, 'prefixsomelib.suffix')
-        soname = get_soname(lib1)
-        self.assertEqual(soname, 'prefixsomelib.suffix')
-
-    def test_pic(self):
-        '''
-        Test that -fPIC is correctly added to static libraries when b_staticpic
-        is true and not when it is false. This can't be an ordinary test case
-        because we need to inspect the compiler database.
-        '''
-        if is_windows() or is_cygwin() or is_osx():
-            raise unittest.SkipTest('PIC not relevant')
-
-        testdir = os.path.join(self.common_test_dir, '3 static')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        self.assertIn('-fPIC', compdb[0]['command'])
-        self.setconf('-Db_staticpic=false')
-        # Regenerate build
-        self.build()
-        compdb = self.get_compdb()
-        self.assertNotIn('-fPIC', compdb[0]['command'])
-
-    def test_pkgconfig_gen(self):
-        '''
-        Test that generated pkg-config files can be found and have the correct
-        version and link args. This can't be an ordinary test case because we
-        need to run pkg-config outside of a Meson build file.
-        https://github.com/mesonbuild/meson/issues/889
-        '''
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen')
-        self.init(testdir)
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        kwargs = {'required': True, 'silent': True}
-        os.environ['PKG_CONFIG_LIBDIR'] = self.privatedir
-        foo_dep = PkgConfigDependency('libfoo', env, kwargs)
-        self.assertTrue(foo_dep.found())
-        self.assertEqual(foo_dep.get_version(), '1.0')
-        self.assertIn('-lfoo', foo_dep.get_link_args())
-        self.assertEqual(foo_dep.get_pkgconfig_variable('foo', {}), 'bar')
-        self.assertPathEqual(foo_dep.get_pkgconfig_variable('datadir', {}), '/usr/data')
-
-        libhello_nolib = PkgConfigDependency('libhello_nolib', env, kwargs)
-        self.assertTrue(libhello_nolib.found())
-        self.assertEqual(libhello_nolib.get_link_args(), [])
-        self.assertEqual(libhello_nolib.get_compile_args(), [])
-
-    def test_pkgconfig_gen_deps(self):
-        '''
-        Test that generated pkg-config files correctly handle dependencies
-        '''
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen')
-        self.init(testdir)
-        privatedir1 = self.privatedir
-
-        self.new_builddir()
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen', 'dependencies')
-        self.init(testdir, override_envvars={'PKG_CONFIG_LIBDIR': privatedir1})
-        privatedir2 = self.privatedir
-
-        os.environ
-        env = {
-            'PKG_CONFIG_LIBDIR': os.pathsep.join([privatedir1, privatedir2]),
-            'PKG_CONFIG_SYSTEM_LIBRARY_PATH': '/usr/lib',
-        }
-        self._run(['pkg-config', 'dependency-test', '--validate'], override_envvars=env)
-
-        # pkg-config strips some duplicated flags so we have to parse the
-        # generated file ourself.
-        expected = {
-            'Requires': 'libexposed',
-            'Requires.private': 'libfoo >= 1.0',
-            'Libs': '-L${libdir} -llibmain -pthread -lcustom',
-            'Libs.private': '-lcustom2 -L${libdir} -llibinternal',
-            'Cflags': '-I${includedir} -pthread -DCUSTOM',
-        }
-        if is_osx() or is_haiku():
-            expected['Cflags'] = expected['Cflags'].replace('-pthread ', '')
-        with open(os.path.join(privatedir2, 'dependency-test.pc')) as f:
-            matched_lines = 0
-            for line in f:
-                parts = line.split(':', 1)
-                if parts[0] in expected:
-                    key = parts[0]
-                    val = parts[1].strip()
-                    expected_val = expected[key]
-                    self.assertEqual(expected_val, val)
-                    matched_lines += 1
-            self.assertEqual(len(expected), matched_lines)
-
-        cmd = ['pkg-config', 'requires-test']
-        out = self._run(cmd + ['--print-requires'], override_envvars=env).strip().split('\n')
-        if not is_openbsd():
-            self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
-        else:
-            self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
-
-        cmd = ['pkg-config', 'requires-private-test']
-        out = self._run(cmd + ['--print-requires-private'], override_envvars=env).strip().split('\n')
-        if not is_openbsd():
-            self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo >= 1.0', 'libhello']))
-        else:
-            self.assertEqual(sorted(out), sorted(['libexposed', 'libfoo>=1.0', 'libhello']))
-
-        cmd = ['pkg-config', 'pub-lib-order']
-        out = self._run(cmd + ['--libs'], override_envvars=env).strip().split()
-        self.assertEqual(out, ['-llibmain2', '-llibinternal'])
-
-    def test_pkgconfig_uninstalled(self):
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen')
-        self.init(testdir)
-        self.build()
-
-        os.environ['PKG_CONFIG_LIBDIR'] = os.path.join(self.builddir, 'meson-uninstalled')
-        if is_cygwin():
-            os.environ['PATH'] += os.pathsep + self.builddir
-
-        self.new_builddir()
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen', 'dependencies')
-        self.init(testdir)
-        self.build()
-        self.run_tests()
-
-    def test_pkg_unfound(self):
-        testdir = os.path.join(self.unit_test_dir, '23 unfound pkgconfig')
-        self.init(testdir)
-        with open(os.path.join(self.privatedir, 'somename.pc')) as f:
-            pcfile = f.read()
-        self.assertFalse('blub_blob_blib' in pcfile)
-
-    def test_vala_c_warnings(self):
-        '''
-        Test that no warnings are emitted for C code generated by Vala. This
-        can't be an ordinary test case because we need to inspect the compiler
-        database.
-        https://github.com/mesonbuild/meson/issues/864
-        '''
-        if not shutil.which('valac'):
-            raise unittest.SkipTest('valac not installed.')
-        testdir = os.path.join(self.vala_test_dir, '5 target glib')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        vala_command = None
-        c_command = None
-        for each in compdb:
-            if each['file'].endswith('GLib.Thread.c'):
-                vala_command = each['command']
-            elif each['file'].endswith('GLib.Thread.vala'):
-                continue
-            elif each['file'].endswith('retcode.c'):
-                c_command = each['command']
-            else:
-                m = 'Unknown file {!r} in vala_c_warnings test'.format(each['file'])
-                raise AssertionError(m)
-        self.assertIsNotNone(vala_command)
-        self.assertIsNotNone(c_command)
-        # -w suppresses all warnings, should be there in Vala but not in C
-        self.assertIn(" -w ", vala_command)
-        self.assertNotIn(" -w ", c_command)
-        # -Wall enables all warnings, should be there in C but not in Vala
-        self.assertNotIn(" -Wall ", vala_command)
-        self.assertIn(" -Wall ", c_command)
-        # -Werror converts warnings to errors, should always be there since it's
-        # injected by an unrelated piece of code and the project has werror=true
-        self.assertIn(" -Werror ", vala_command)
-        self.assertIn(" -Werror ", c_command)
-
-    @skipIfNoPkgconfig
-    def test_qtdependency_pkgconfig_detection(self):
-        '''
-        Test that qt4 and qt5 detection with pkgconfig works.
-        '''
-        # Verify Qt4 or Qt5 can be found with pkg-config
-        qt4 = subprocess.call(['pkg-config', '--exists', 'QtCore'])
-        qt5 = subprocess.call(['pkg-config', '--exists', 'Qt5Core'])
-        testdir = os.path.join(self.framework_test_dir, '4 qt')
-        self.init(testdir, extra_args=['-Dmethod=pkg-config'])
-        # Confirm that the dependency was found with pkg-config
-        mesonlog = self.get_meson_log()
-        if qt4 == 0:
-            self.assertRegex('\n'.join(mesonlog),
-                             r'Run-time dependency qt4 \(modules: Core\) found: YES 4.* \(pkg-config\)\n')
-        if qt5 == 0:
-            self.assertRegex('\n'.join(mesonlog),
-                             r'Run-time dependency qt5 \(modules: Core\) found: YES 5.* \(pkg-config\)\n')
-
-    @skip_if_not_base_option('b_sanitize')
-    def test_generate_gir_with_address_sanitizer(self):
-        if is_cygwin():
-            raise unittest.SkipTest('asan not available on Cygwin')
-        if is_openbsd():
-            raise unittest.SkipTest('-fsanitize=address is not supported on OpenBSD')
-
-        testdir = os.path.join(self.framework_test_dir, '7 gnome')
-        self.init(testdir, extra_args=['-Db_sanitize=address', '-Db_lundef=false'])
-        self.build()
-
-    def test_qt5dependency_qmake_detection(self):
-        '''
-        Test that qt5 detection with qmake works. This can't be an ordinary
-        test case because it involves setting the environment.
-        '''
-        # Verify that qmake is for Qt5
-        if not shutil.which('qmake-qt5'):
-            if not shutil.which('qmake'):
-                raise unittest.SkipTest('QMake not found')
-            output = subprocess.getoutput('qmake --version')
-            if 'Qt version 5' not in output:
-                raise unittest.SkipTest('Qmake found, but it is not for Qt 5.')
-        # Disable pkg-config codepath and force searching with qmake/qmake-qt5
-        testdir = os.path.join(self.framework_test_dir, '4 qt')
-        self.init(testdir, extra_args=['-Dmethod=qmake'])
-        # Confirm that the dependency was found with qmake
-        mesonlog = self.get_meson_log()
-        self.assertRegex('\n'.join(mesonlog),
-                         r'Run-time dependency qt5 \(modules: Core\) found: YES .* \((qmake|qmake-qt5)\)\n')
-
-    def glob_sofiles_without_privdir(self, g):
-        files = glob(g)
-        return [f for f in files if not f.endswith('.p')]
-
-    def _test_soname_impl(self, libpath, install):
-        if is_cygwin() or is_osx():
-            raise unittest.SkipTest('Test only applicable to ELF and linuxlike sonames')
-
-        testdir = os.path.join(self.unit_test_dir, '1 soname')
-        self.init(testdir)
-        self.build()
-        if install:
-            self.install()
-
-        # File without aliases set.
-        nover = os.path.join(libpath, 'libnover.so')
-        self.assertPathExists(nover)
-        self.assertFalse(os.path.islink(nover))
-        self.assertEqual(get_soname(nover), 'libnover.so')
-        self.assertEqual(len(self.glob_sofiles_without_privdir(nover[:-3] + '*')), 1)
-
-        # File with version set
-        verset = os.path.join(libpath, 'libverset.so')
-        self.assertPathExists(verset + '.4.5.6')
-        self.assertEqual(os.readlink(verset), 'libverset.so.4')
-        self.assertEqual(get_soname(verset), 'libverset.so.4')
-        self.assertEqual(len(self.glob_sofiles_without_privdir(verset[:-3] + '*')), 3)
-
-        # File with soversion set
-        soverset = os.path.join(libpath, 'libsoverset.so')
-        self.assertPathExists(soverset + '.1.2.3')
-        self.assertEqual(os.readlink(soverset), 'libsoverset.so.1.2.3')
-        self.assertEqual(get_soname(soverset), 'libsoverset.so.1.2.3')
-        self.assertEqual(len(self.glob_sofiles_without_privdir(soverset[:-3] + '*')), 2)
-
-        # File with version and soversion set to same values
-        settosame = os.path.join(libpath, 'libsettosame.so')
-        self.assertPathExists(settosame + '.7.8.9')
-        self.assertEqual(os.readlink(settosame), 'libsettosame.so.7.8.9')
-        self.assertEqual(get_soname(settosame), 'libsettosame.so.7.8.9')
-        self.assertEqual(len(self.glob_sofiles_without_privdir(settosame[:-3] + '*')), 2)
-
-        # File with version and soversion set to different values
-        bothset = os.path.join(libpath, 'libbothset.so')
-        self.assertPathExists(bothset + '.1.2.3')
-        self.assertEqual(os.readlink(bothset), 'libbothset.so.1.2.3')
-        self.assertEqual(os.readlink(bothset + '.1.2.3'), 'libbothset.so.4.5.6')
-        self.assertEqual(get_soname(bothset), 'libbothset.so.1.2.3')
-        self.assertEqual(len(self.glob_sofiles_without_privdir(bothset[:-3] + '*')), 3)
-
-    def test_soname(self):
-        self._test_soname_impl(self.builddir, False)
-
-    def test_installed_soname(self):
-        libdir = self.installdir + os.path.join(self.prefix, self.libdir)
-        self._test_soname_impl(libdir, True)
-
-    def test_compiler_check_flags_order(self):
-        '''
-        Test that compiler check flags override all other flags. This can't be
-        an ordinary test case because it needs the environment to be set.
-        '''
-        testdir = os.path.join(self.common_test_dir, '39 has function')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cpp = env.detect_cpp_compiler(MachineChoice.HOST)
-        Oflag = '-O3'
-        OflagCPP = Oflag
-        if cpp.get_id() in ('clang', 'gcc'):
-            # prevent developers from adding "int main(int argc, char **argv)"
-            # to small Meson checks unless these parameters are actually used
-            OflagCPP += ' -Werror=unused-parameter'
-        env = {'CFLAGS': Oflag,
-               'CXXFLAGS': OflagCPP}
-        self.init(testdir, override_envvars=env)
-        cmds = self.get_meson_log_compiler_checks()
-        for cmd in cmds:
-            if cmd[0] == 'ccache':
-                cmd = cmd[1:]
-            # Verify that -I flags from the `args` kwarg are first
-            # This is set in the '39 has function' test case
-            self.assertEqual(cmd[1], '-I/tmp')
-            # Verify that -O3 set via the environment is overridden by -O0
-            Oargs = [arg for arg in cmd if arg.startswith('-O')]
-            self.assertEqual(Oargs, [Oflag, '-O0'])
-
-    def _test_stds_impl(self, testdir, compiler, p: str):
-        has_cpp17 = (compiler.get_id() not in {'clang', 'gcc'} or
-                     compiler.get_id() == 'clang' and _clang_at_least(compiler, '>=5.0.0', '>=9.1') or
-                     compiler.get_id() == 'gcc' and version_compare(compiler.version, '>=5.0.0'))
-        has_cpp2a_c17 = (compiler.get_id() not in {'clang', 'gcc'} or
-                         compiler.get_id() == 'clang' and _clang_at_least(compiler, '>=6.0.0', '>=10.0') or
-                         compiler.get_id() == 'gcc' and version_compare(compiler.version, '>=8.0.0'))
-        has_c18 = (compiler.get_id() not in {'clang', 'gcc'} or
-                   compiler.get_id() == 'clang' and _clang_at_least(compiler, '>=8.0.0', '>=11.0') or
-                   compiler.get_id() == 'gcc' and version_compare(compiler.version, '>=8.0.0'))
-        # Check that all the listed -std=xxx options for this compiler work just fine when used
-        # https://en.wikipedia.org/wiki/Xcode#Latest_versions
-        # https://www.gnu.org/software/gcc/projects/cxx-status.html
-        for v in compiler.get_options()['std'].choices:
-            lang_std = p + '_std'
-            # we do it like this to handle gnu++17,c++17 and gnu17,c17 cleanly
-            # thus, C++ first
-            if '++17' in v and not has_cpp17:
-                continue
-            elif '++2a' in v and not has_cpp2a_c17:  # https://en.cppreference.com/w/cpp/compiler_support
-                continue
-            # now C
-            elif '17' in v and not has_cpp2a_c17:
-                continue
-            elif '18' in v and not has_c18:
-                continue
-            std_opt = '{}={}'.format(lang_std, v)
-            self.init(testdir, extra_args=['-D' + std_opt])
-            cmd = self.get_compdb()[0]['command']
-            # c++03 and gnu++03 are not understood by ICC, don't try to look for them
-            skiplist = frozenset([
-                ('intel', 'c++03'),
-                ('intel', 'gnu++03')])
-            if v != 'none' and not (compiler.get_id(), v) in skiplist:
-                cmd_std = " -std={} ".format(v)
-                self.assertIn(cmd_std, cmd)
-            try:
-                self.build()
-            except Exception:
-                print('{} was {!r}'.format(lang_std, v))
-                raise
-            self.wipe()
-        # Check that an invalid std option in CFLAGS/CPPFLAGS fails
-        # Needed because by default ICC ignores invalid options
-        cmd_std = '-std=FAIL'
-        if p == 'c':
-            env_flag_name = 'CFLAGS'
-        elif p == 'cpp':
-            env_flag_name = 'CXXFLAGS'
-        else:
-            raise NotImplementedError('Language {} not defined.'.format(p))
-        env = {}
-        env[env_flag_name] = cmd_std
-        with self.assertRaises((subprocess.CalledProcessError, mesonbuild.mesonlib.EnvironmentException),
-                               msg='C compiler should have failed with -std=FAIL'):
-            self.init(testdir, override_envvars = env)
-            # ICC won't fail in the above because additional flags are needed to
-            # make unknown -std=... options errors.
-            self.build()
-
-    def test_compiler_c_stds(self):
-        '''
-        Test that C stds specified for this compiler can all be used. Can't be
-        an ordinary test because it requires passing options to meson.
-        '''
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        self._test_stds_impl(testdir, cc, 'c')
-
-    def test_compiler_cpp_stds(self):
-        '''
-        Test that C++ stds specified for this compiler can all be used. Can't
-        be an ordinary test because it requires passing options to meson.
-        '''
-        testdir = os.path.join(self.common_test_dir, '2 cpp')
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        cpp = env.detect_cpp_compiler(MachineChoice.HOST)
-        self._test_stds_impl(testdir, cpp, 'cpp')
-
-    def test_unity_subproj(self):
-        testdir = os.path.join(self.common_test_dir, '45 subproject')
-        self.init(testdir, extra_args='--unity=subprojects')
-        pdirs = glob(os.path.join(self.builddir, 'subprojects/sublib/simpletest*.p'))
-        self.assertEqual(len(pdirs), 1)
-        self.assertPathExists(os.path.join(pdirs[0], 'simpletest-unity0.c'))
-        sdirs = glob(os.path.join(self.builddir, 'subprojects/sublib/*sublib*.p'))
-        self.assertEqual(len(sdirs), 1)
-        self.assertPathExists(os.path.join(sdirs[0], 'sublib-unity0.c'))
-        self.assertPathDoesNotExist(os.path.join(self.builddir, 'user@exe/user-unity.c'))
-        self.build()
-
-    def test_installed_modes(self):
-        '''
-        Test that files installed by these tests have the correct permissions.
-        Can't be an ordinary test because our installed_files.txt is very basic.
-        '''
-        # Test file modes
-        testdir = os.path.join(self.common_test_dir, '12 data')
-        self.init(testdir)
-        self.install()
-
-        f = os.path.join(self.installdir, 'etc', 'etcfile.dat')
-        found_mode = stat.filemode(os.stat(f).st_mode)
-        want_mode = 'rw------T'
-        self.assertEqual(want_mode, found_mode[1:])
-
-        f = os.path.join(self.installdir, 'usr', 'bin', 'runscript.sh')
-        statf = os.stat(f)
-        found_mode = stat.filemode(statf.st_mode)
-        want_mode = 'rwxr-sr-x'
-        self.assertEqual(want_mode, found_mode[1:])
-        if os.getuid() == 0:
-            # The chown failed nonfatally if we're not root
-            self.assertEqual(0, statf.st_uid)
-            self.assertEqual(0, statf.st_gid)
-
-        f = os.path.join(self.installdir, 'usr', 'share', 'progname',
-                         'fileobject_datafile.dat')
-        orig = os.path.join(testdir, 'fileobject_datafile.dat')
-        statf = os.stat(f)
-        statorig = os.stat(orig)
-        found_mode = stat.filemode(statf.st_mode)
-        orig_mode = stat.filemode(statorig.st_mode)
-        self.assertEqual(orig_mode[1:], found_mode[1:])
-        self.assertEqual(os.getuid(), statf.st_uid)
-        if os.getuid() == 0:
-            # The chown failed nonfatally if we're not root
-            self.assertEqual(0, statf.st_gid)
-
-        self.wipe()
-        # Test directory modes
-        testdir = os.path.join(self.common_test_dir, '62 install subdir')
-        self.init(testdir)
-        self.install()
-
-        f = os.path.join(self.installdir, 'usr', 'share', 'sub1', 'second.dat')
-        statf = os.stat(f)
-        found_mode = stat.filemode(statf.st_mode)
-        want_mode = 'rwxr-x--t'
-        self.assertEqual(want_mode, found_mode[1:])
-        if os.getuid() == 0:
-            # The chown failed nonfatally if we're not root
-            self.assertEqual(0, statf.st_uid)
-
-    def test_installed_modes_extended(self):
-        '''
-        Test that files are installed with correct permissions using install_mode.
-        '''
-        testdir = os.path.join(self.common_test_dir, '195 install_mode')
-        self.init(testdir)
-        self.build()
-        self.install()
-
-        for fsobj, want_mode in [
-                ('bin', 'drwxr-x---'),
-                ('bin/runscript.sh', '-rwxr-sr-x'),
-                ('bin/trivialprog', '-rwxr-sr-x'),
-                ('include', 'drwxr-x---'),
-                ('include/config.h', '-rw-rwSr--'),
-                ('include/rootdir.h', '-r--r--r-T'),
-                ('lib', 'drwxr-x---'),
-                ('lib/libstat.a', '-rw---Sr--'),
-                ('share', 'drwxr-x---'),
-                ('share/man', 'drwxr-x---'),
-                ('share/man/man1', 'drwxr-x---'),
-                ('share/man/man1/foo.1', '-r--r--r-T'),
-                ('share/sub1', 'drwxr-x---'),
-                ('share/sub1/second.dat', '-rwxr-x--t'),
-                ('subdir', 'drwxr-x---'),
-                ('subdir/data.dat', '-rw-rwSr--'),
-        ]:
-            f = os.path.join(self.installdir, 'usr', *fsobj.split('/'))
-            found_mode = stat.filemode(os.stat(f).st_mode)
-            self.assertEqual(want_mode, found_mode,
-                             msg=('Expected file %s to have mode %s but found %s instead.' %
-                                  (fsobj, want_mode, found_mode)))
-        # Ensure that introspect --installed works on all types of files
-        # FIXME: also verify the files list
-        self.introspect('--installed')
-
-    def test_install_umask(self):
-        '''
-        Test that files are installed with correct permissions using default
-        install umask of 022, regardless of the umask at time the worktree
-        was checked out or the build was executed.
-        '''
-        # Copy source tree to a temporary directory and change permissions
-        # there to simulate a checkout with umask 002.
-        orig_testdir = os.path.join(self.unit_test_dir, '26 install umask')
-        # Create a new testdir under tmpdir.
-        tmpdir = os.path.realpath(tempfile.mkdtemp())
-        self.addCleanup(windows_proof_rmtree, tmpdir)
-        testdir = os.path.join(tmpdir, '26 install umask')
-        # Copy the tree using shutil.copyfile, which will use the current umask
-        # instead of preserving permissions of the old tree.
-        save_umask = os.umask(0o002)
-        self.addCleanup(os.umask, save_umask)
-        shutil.copytree(orig_testdir, testdir, copy_function=shutil.copyfile)
-        # Preserve the executable status of subdir/sayhello though.
-        os.chmod(os.path.join(testdir, 'subdir', 'sayhello'), 0o775)
-        self.init(testdir)
-        # Run the build under a 027 umask now.
-        os.umask(0o027)
-        self.build()
-        # And keep umask 027 for the install step too.
-        self.install()
-
-        for executable in [
-                'bin/prog',
-                'share/subdir/sayhello',
-        ]:
-            f = os.path.join(self.installdir, 'usr', *executable.split('/'))
-            found_mode = stat.filemode(os.stat(f).st_mode)
-            want_mode = '-rwxr-xr-x'
-            self.assertEqual(want_mode, found_mode,
-                             msg=('Expected file %s to have mode %s but found %s instead.' %
-                                  (executable, want_mode, found_mode)))
-
-        for directory in [
-                'usr',
-                'usr/bin',
-                'usr/include',
-                'usr/share',
-                'usr/share/man',
-                'usr/share/man/man1',
-                'usr/share/subdir',
-        ]:
-            f = os.path.join(self.installdir, *directory.split('/'))
-            found_mode = stat.filemode(os.stat(f).st_mode)
-            want_mode = 'drwxr-xr-x'
-            self.assertEqual(want_mode, found_mode,
-                             msg=('Expected directory %s to have mode %s but found %s instead.' %
-                                  (directory, want_mode, found_mode)))
-
-        for datafile in [
-                'include/sample.h',
-                'share/datafile.cat',
-                'share/file.dat',
-                'share/man/man1/prog.1',
-                'share/subdir/datafile.dog',
-        ]:
-            f = os.path.join(self.installdir, 'usr', *datafile.split('/'))
-            found_mode = stat.filemode(os.stat(f).st_mode)
-            want_mode = '-rw-r--r--'
-            self.assertEqual(want_mode, found_mode,
-                             msg=('Expected file %s to have mode %s but found %s instead.' %
-                                  (datafile, want_mode, found_mode)))
-
-    def test_cpp_std_override(self):
-        testdir = os.path.join(self.unit_test_dir, '6 std override')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        # Don't try to use -std=c++03 as a check for the
-        # presence of a compiler flag, as ICC does not
-        # support it.
-        for i in compdb:
-            if 'prog98' in i['file']:
-                c98_comp = i['command']
-            if 'prog11' in i['file']:
-                c11_comp = i['command']
-            if 'progp' in i['file']:
-                plain_comp = i['command']
-        self.assertNotEqual(len(plain_comp), 0)
-        self.assertIn('-std=c++98', c98_comp)
-        self.assertNotIn('-std=c++11', c98_comp)
-        self.assertIn('-std=c++11', c11_comp)
-        self.assertNotIn('-std=c++98', c11_comp)
-        self.assertNotIn('-std=c++98', plain_comp)
-        self.assertNotIn('-std=c++11', plain_comp)
-        # Now werror
-        self.assertIn('-Werror', plain_comp)
-        self.assertNotIn('-Werror', c98_comp)
-
-    def test_run_installed(self):
-        if is_cygwin() or is_osx():
-            raise unittest.SkipTest('LD_LIBRARY_PATH and RPATH not applicable')
-
-        testdir = os.path.join(self.unit_test_dir, '7 run installed')
-        self.init(testdir)
-        self.build()
-        self.install()
-        installed_exe = os.path.join(self.installdir, 'usr/bin/prog')
-        installed_libdir = os.path.join(self.installdir, 'usr/foo')
-        installed_lib = os.path.join(installed_libdir, 'libfoo.so')
-        self.assertTrue(os.path.isfile(installed_exe))
-        self.assertTrue(os.path.isdir(installed_libdir))
-        self.assertTrue(os.path.isfile(installed_lib))
-        # Must fail when run without LD_LIBRARY_PATH to ensure that
-        # rpath has been properly stripped rather than pointing to the builddir.
-        self.assertNotEqual(subprocess.call(installed_exe, stderr=subprocess.DEVNULL), 0)
-        # When LD_LIBRARY_PATH is set it should start working.
-        # For some reason setting LD_LIBRARY_PATH in os.environ fails
-        # when all tests are run (but works when only this test is run),
-        # but doing this explicitly works.
-        env = os.environ.copy()
-        env['LD_LIBRARY_PATH'] = ':'.join([installed_libdir, env.get('LD_LIBRARY_PATH', '')])
-        self.assertEqual(subprocess.call(installed_exe, env=env), 0)
-        # Ensure that introspect --installed works
-        installed = self.introspect('--installed')
-        for v in installed.values():
-            self.assertTrue('prog' in v or 'foo' in v)
-
-    @skipIfNoPkgconfig
-    def test_order_of_l_arguments(self):
-        testdir = os.path.join(self.unit_test_dir, '8 -L -l order')
-        self.init(testdir, override_envvars={'PKG_CONFIG_PATH': testdir})
-        # NOTE: .pc file has -Lfoo -lfoo -Lbar -lbar but pkg-config reorders
-        # the flags before returning them to -Lfoo -Lbar -lfoo -lbar
-        # but pkgconf seems to not do that. Sigh. Support both.
-        expected_order = [('-L/me/first', '-lfoo1'),
-                          ('-L/me/second', '-lfoo2'),
-                          ('-L/me/first', '-L/me/second'),
-                          ('-lfoo1', '-lfoo2'),
-                          ('-L/me/second', '-L/me/third'),
-                          ('-L/me/third', '-L/me/fourth',),
-                          ('-L/me/third', '-lfoo3'),
-                          ('-L/me/fourth', '-lfoo4'),
-                          ('-lfoo3', '-lfoo4'),
-                          ]
-        with open(os.path.join(self.builddir, 'build.ninja')) as ifile:
-            for line in ifile:
-                if expected_order[0][0] in line:
-                    for first, second in expected_order:
-                        self.assertLess(line.index(first), line.index(second))
-                    return
-        raise RuntimeError('Linker entries not found in the Ninja file.')
-
-    def test_introspect_dependencies(self):
-        '''
-        Tests that mesonintrospect --dependencies returns expected output.
-        '''
-        testdir = os.path.join(self.framework_test_dir, '7 gnome')
-        self.init(testdir)
-        glib_found = False
-        gobject_found = False
-        deps = self.introspect('--dependencies')
-        self.assertIsInstance(deps, list)
-        for dep in deps:
-            self.assertIsInstance(dep, dict)
-            self.assertIn('name', dep)
-            self.assertIn('compile_args', dep)
-            self.assertIn('link_args', dep)
-            if dep['name'] == 'glib-2.0':
-                glib_found = True
-            elif dep['name'] == 'gobject-2.0':
-                gobject_found = True
-        self.assertTrue(glib_found)
-        self.assertTrue(gobject_found)
-        if subprocess.call(['pkg-config', '--exists', 'glib-2.0 >= 2.56.2']) != 0:
-            raise unittest.SkipTest('glib >= 2.56.2 needed for the rest')
-        targets = self.introspect('--targets')
-        docbook_target = None
-        for t in targets:
-            if t['name'] == 'generated-gdbus-docbook':
-                docbook_target = t
-                break
-        self.assertIsInstance(docbook_target, dict)
-        self.assertEqual(os.path.basename(t['filename'][0]), 'generated-gdbus-doc-' + os.path.basename(t['target_sources'][0]['sources'][0]))
-
-    def test_introspect_installed(self):
-        testdir = os.path.join(self.linuxlike_test_dir, '7 library versions')
-        self.init(testdir)
-
-        install = self.introspect('--installed')
-        install = {os.path.basename(k): v for k, v in install.items()}
-        print(install)
-        if is_osx():
-            the_truth = {
-                'libmodule.dylib': '/usr/lib/libmodule.dylib',
-                'libnoversion.dylib': '/usr/lib/libnoversion.dylib',
-                'libonlysoversion.5.dylib': '/usr/lib/libonlysoversion.5.dylib',
-                'libonlysoversion.dylib': '/usr/lib/libonlysoversion.dylib',
-                'libonlyversion.1.dylib': '/usr/lib/libonlyversion.1.dylib',
-                'libonlyversion.dylib': '/usr/lib/libonlyversion.dylib',
-                'libsome.0.dylib': '/usr/lib/libsome.0.dylib',
-                'libsome.dylib': '/usr/lib/libsome.dylib',
-            }
-            the_truth_2 = {'/usr/lib/libsome.dylib',
-                           '/usr/lib/libsome.0.dylib',
-            }
-        else:
-            the_truth = {
-                'libmodule.so': '/usr/lib/libmodule.so',
-                'libnoversion.so': '/usr/lib/libnoversion.so',
-                'libonlysoversion.so': '/usr/lib/libonlysoversion.so',
-                'libonlysoversion.so.5': '/usr/lib/libonlysoversion.so.5',
-                'libonlyversion.so': '/usr/lib/libonlyversion.so',
-                'libonlyversion.so.1': '/usr/lib/libonlyversion.so.1',
-                'libonlyversion.so.1.4.5': '/usr/lib/libonlyversion.so.1.4.5',
-                'libsome.so': '/usr/lib/libsome.so',
-                'libsome.so.0': '/usr/lib/libsome.so.0',
-                'libsome.so.1.2.3': '/usr/lib/libsome.so.1.2.3',
-            }
-            the_truth_2 = {'/usr/lib/libsome.so',
-                           '/usr/lib/libsome.so.0',
-                           '/usr/lib/libsome.so.1.2.3'}
-        self.assertDictEqual(install, the_truth)
-
-        targets = self.introspect('--targets')
-        for t in targets:
-            if t['name'] != 'some':
-                continue
-            self.assertSetEqual(the_truth_2, set(t['install_filename']))
-
-    def test_build_rpath(self):
-        if is_cygwin():
-            raise unittest.SkipTest('Windows PE/COFF binaries do not use RPATH')
-        testdir = os.path.join(self.unit_test_dir, '10 build_rpath')
-        self.init(testdir)
-        self.build()
-        # C program RPATH
-        build_rpath = get_rpath(os.path.join(self.builddir, 'prog'))
-        self.assertEqual(build_rpath, '$ORIGIN/sub:/foo/bar')
-        self.install()
-        install_rpath = get_rpath(os.path.join(self.installdir, 'usr/bin/prog'))
-        self.assertEqual(install_rpath, '/baz')
-        # C++ program RPATH
-        build_rpath = get_rpath(os.path.join(self.builddir, 'progcxx'))
-        self.assertEqual(build_rpath, '$ORIGIN/sub:/foo/bar')
-        self.install()
-        install_rpath = get_rpath(os.path.join(self.installdir, 'usr/bin/progcxx'))
-        self.assertEqual(install_rpath, 'baz')
-
-    def test_global_rpath(self):
-        if is_cygwin():
-            raise unittest.SkipTest('Windows PE/COFF binaries do not use RPATH')
-        if is_osx():
-            raise unittest.SkipTest('Global RPATHs via LDFLAGS not yet supported on MacOS (does anybody need it?)')
-
-        testdir = os.path.join(self.unit_test_dir, '77 global-rpath')
-        oldinstalldir = self.installdir
-
-        # Build and install an external library without DESTDIR.
-        # The external library generates a .pc file without an rpath.
-        yonder_dir = os.path.join(testdir, 'yonder')
-        yonder_prefix = os.path.join(oldinstalldir, 'yonder')
-        yonder_libdir = os.path.join(yonder_prefix, self.libdir)
-        self.prefix = yonder_prefix
-        self.installdir = yonder_prefix
-        self.init(yonder_dir)
-        self.build()
-        self.install(use_destdir=False)
-
-        # Since rpath has multiple valid formats we need to
-        # test that they are all properly used.
-        rpath_formats = [
-            ('-Wl,-rpath=', False),
-            ('-Wl,-rpath,', False),
-            ('-Wl,--just-symbols=', True),
-            ('-Wl,--just-symbols,', True),
-            ('-Wl,-R', False),
-            ('-Wl,-R,', False)
-        ]
-        for rpath_format, exception in rpath_formats:
-            # Build an app that uses that installed library.
-            # Supply the rpath to the installed library via LDFLAGS
-            # (as systems like buildroot and guix are wont to do)
-            # and verify install preserves that rpath.
-            self.new_builddir()
-            env = {'LDFLAGS': rpath_format + yonder_libdir,
-                   'PKG_CONFIG_PATH': os.path.join(yonder_libdir, 'pkgconfig')}
-            if exception:
-                with self.assertRaises(subprocess.CalledProcessError):
-                    self.init(testdir, override_envvars=env)
-                break
-            self.init(testdir, override_envvars=env)
-            self.build()
-            self.install(use_destdir=False)
-            got_rpath = get_rpath(os.path.join(yonder_prefix, 'bin/rpathified'))
-            self.assertEqual(got_rpath, yonder_libdir, rpath_format)
-
-    @skip_if_not_base_option('b_sanitize')
-    def test_pch_with_address_sanitizer(self):
-        if is_cygwin():
-            raise unittest.SkipTest('asan not available on Cygwin')
-        if is_openbsd():
-            raise unittest.SkipTest('-fsanitize=address is not supported on OpenBSD')
-
-        testdir = os.path.join(self.common_test_dir, '13 pch')
-        self.init(testdir, extra_args=['-Db_sanitize=address', '-Db_lundef=false'])
-        self.build()
-        compdb = self.get_compdb()
-        for i in compdb:
-            self.assertIn("-fsanitize=address", i["command"])
-
-    def test_cross_find_program(self):
-        testdir = os.path.join(self.unit_test_dir, '11 cross prog')
-        crossfile = tempfile.NamedTemporaryFile(mode='w')
-        print(os.path.join(testdir, 'some_cross_tool.py'))
-        crossfile.write(textwrap.dedent('''\
-            [binaries]
-            c = '/usr/bin/{1}'
-            ar = '/usr/bin/ar'
-            strip = '/usr/bin/ar'
-            sometool.py = ['{0}']
-            someothertool.py = '{0}'
-
-            [properties]
-
-            [host_machine]
-            system = 'linux'
-            cpu_family = 'arm'
-            cpu = 'armv7' # Not sure if correct.
-            endian = 'little'
-            ''').format(os.path.join(testdir, 'some_cross_tool.py'),
-                        'gcc' if is_sunos() else 'cc'))
-        crossfile.flush()
-        self.meson_cross_file = crossfile.name
-        self.init(testdir)
-
-    def test_reconfigure(self):
-        testdir = os.path.join(self.unit_test_dir, '13 reconfigure')
-        self.init(testdir, extra_args=['-Db_coverage=true'], default_args=False)
-        self.build('reconfigure')
-
-    def test_vala_generated_source_buildir_inside_source_tree(self):
-        '''
-        Test that valac outputs generated C files in the expected location when
-        the builddir is a subdir of the source tree.
-        '''
-        if not shutil.which('valac'):
-            raise unittest.SkipTest('valac not installed.')
-
-        testdir = os.path.join(self.vala_test_dir, '8 generated sources')
-        newdir = os.path.join(self.builddir, 'srctree')
-        shutil.copytree(testdir, newdir)
-        testdir = newdir
-        # New builddir
-        builddir = os.path.join(testdir, 'subdir/_build')
-        os.makedirs(builddir, exist_ok=True)
-        self.change_builddir(builddir)
-        self.init(testdir)
-        self.build()
-
-    def test_old_gnome_module_codepaths(self):
-        '''
-        A lot of code in the GNOME module is conditional on the version of the
-        glib tools that are installed, and breakages in the old code can slip
-        by once the CI has a newer glib version. So we force the GNOME module
-        to pretend that it's running on an ancient glib so the fallback code is
-        also tested.
-        '''
-        testdir = os.path.join(self.framework_test_dir, '7 gnome')
-        mesonbuild.modules.gnome.native_glib_version = '2.20'
-        env = {'MESON_UNIT_TEST_PRETEND_GLIB_OLD': "1"}
-        try:
-            self.init(testdir,
-                      inprocess=True,
-                      override_envvars=env)
-            self.build(override_envvars=env)
-        finally:
-            mesonbuild.modules.gnome.native_glib_version = None
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_usage(self):
-        testdir1 = os.path.join(self.unit_test_dir, '27 pkgconfig usage/dependency')
-        testdir2 = os.path.join(self.unit_test_dir, '27 pkgconfig usage/dependee')
-        if subprocess.call(['pkg-config', '--cflags', 'glib-2.0'],
-                           stdout=subprocess.DEVNULL,
-                           stderr=subprocess.DEVNULL) != 0:
-            raise unittest.SkipTest('Glib 2.0 dependency not available.')
-        with tempfile.TemporaryDirectory() as tempdirname:
-            self.init(testdir1, extra_args=['--prefix=' + tempdirname, '--libdir=lib'], default_args=False)
-            self.install(use_destdir=False)
-            shutil.rmtree(self.builddir)
-            os.mkdir(self.builddir)
-            pkg_dir = os.path.join(tempdirname, 'lib/pkgconfig')
-            self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'libpkgdep.pc')))
-            lib_dir = os.path.join(tempdirname, 'lib')
-            myenv = os.environ.copy()
-            myenv['PKG_CONFIG_PATH'] = pkg_dir
-            # Private internal libraries must not leak out.
-            pkg_out = subprocess.check_output(['pkg-config', '--static', '--libs', 'libpkgdep'], env=myenv)
-            self.assertFalse(b'libpkgdep-int' in pkg_out, 'Internal library leaked out.')
-            # Dependencies must not leak to cflags when building only a shared library.
-            pkg_out = subprocess.check_output(['pkg-config', '--cflags', 'libpkgdep'], env=myenv)
-            self.assertFalse(b'glib' in pkg_out, 'Internal dependency leaked to headers.')
-            # Test that the result is usable.
-            self.init(testdir2, override_envvars=myenv)
-            self.build(override_envvars=myenv)
-            myenv = os.environ.copy()
-            myenv['LD_LIBRARY_PATH'] = ':'.join([lib_dir, myenv.get('LD_LIBRARY_PATH', '')])
-            if is_cygwin():
-                bin_dir = os.path.join(tempdirname, 'bin')
-                myenv['PATH'] = bin_dir + os.pathsep + myenv['PATH']
-            self.assertTrue(os.path.isdir(lib_dir))
-            test_exe = os.path.join(self.builddir, 'pkguser')
-            self.assertTrue(os.path.isfile(test_exe))
-            subprocess.check_call(test_exe, env=myenv)
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_relative_paths(self):
-        testdir = os.path.join(self.unit_test_dir, '62 pkgconfig relative paths')
-        pkg_dir = os.path.join(testdir, 'pkgconfig')
-        self.assertTrue(os.path.exists(os.path.join(pkg_dir, 'librelativepath.pc')))
-
-        env = get_fake_env(testdir, self.builddir, self.prefix)
-        env.coredata.set_options({'pkg_config_path': pkg_dir}, subproject='')
-        kwargs = {'required': True, 'silent': True}
-        relative_path_dep = PkgConfigDependency('librelativepath', env, kwargs)
-        self.assertTrue(relative_path_dep.found())
-
-        # Ensure link_args are properly quoted
-        libpath = Path(self.builddir) / '../relativepath/lib'
-        link_args = ['-L' + libpath.as_posix(), '-lrelativepath']
-        self.assertEqual(relative_path_dep.get_link_args(), link_args)
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_internal_libraries(self):
-        '''
-        '''
-        with tempfile.TemporaryDirectory() as tempdirname:
-            # build library
-            testdirbase = os.path.join(self.unit_test_dir, '32 pkgconfig use libraries')
-            testdirlib = os.path.join(testdirbase, 'lib')
-            self.init(testdirlib, extra_args=['--prefix=' + tempdirname,
-                                              '--libdir=lib',
-                                              '--default-library=static'], default_args=False)
-            self.build()
-            self.install(use_destdir=False)
-
-            # build user of library
-            pkg_dir = os.path.join(tempdirname, 'lib/pkgconfig')
-            self.new_builddir()
-            self.init(os.path.join(testdirbase, 'app'),
-                      override_envvars={'PKG_CONFIG_PATH': pkg_dir})
-            self.build()
-
-    @skipIfNoPkgconfig
-    def test_static_archive_stripping(self):
-        '''
-        Check that Meson produces valid static archives with --strip enabled
-        '''
-        with tempfile.TemporaryDirectory() as tempdirname:
-            testdirbase = os.path.join(self.unit_test_dir, '67 static archive stripping')
-
-            # build lib
-            self.new_builddir()
-            testdirlib = os.path.join(testdirbase, 'lib')
-            testlibprefix = os.path.join(tempdirname, 'libprefix')
-            self.init(testdirlib, extra_args=['--prefix=' + testlibprefix,
-                                              '--libdir=lib',
-                                              '--default-library=static',
-                                              '--buildtype=debug',
-                                              '--strip'], default_args=False)
-            self.build()
-            self.install(use_destdir=False)
-
-            # build executable (uses lib, fails if static archive has been stripped incorrectly)
-            pkg_dir = os.path.join(testlibprefix, 'lib/pkgconfig')
-            self.new_builddir()
-            self.init(os.path.join(testdirbase, 'app'),
-                      override_envvars={'PKG_CONFIG_PATH': pkg_dir})
-            self.build()
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_formatting(self):
-        testdir = os.path.join(self.unit_test_dir, '38 pkgconfig format')
-        self.init(testdir)
-        myenv = os.environ.copy()
-        myenv['PKG_CONFIG_PATH'] = self.privatedir
-        stdo = subprocess.check_output(['pkg-config', '--libs-only-l', 'libsomething'], env=myenv)
-        deps = [b'-lgobject-2.0', b'-lgio-2.0', b'-lglib-2.0', b'-lsomething']
-        if is_windows() or is_cygwin() or is_osx() or is_openbsd():
-            # On Windows, libintl is a separate library
-            deps.append(b'-lintl')
-        self.assertEqual(set(deps), set(stdo.split()))
-
-    @skipIfNoPkgconfig
-    @skip_if_not_language('cs')
-    def test_pkgconfig_csharp_library(self):
-        testdir = os.path.join(self.unit_test_dir, '50 pkgconfig csharp library')
-        self.init(testdir)
-        myenv = os.environ.copy()
-        myenv['PKG_CONFIG_PATH'] = self.privatedir
-        stdo = subprocess.check_output(['pkg-config', '--libs', 'libsomething'], env=myenv)
-
-        self.assertEqual("-r/usr/lib/libsomething.dll", str(stdo.decode('ascii')).strip())
-
-    @skipIfNoPkgconfig
-    def test_pkgconfig_link_order(self):
-        '''
-        Test that libraries are listed before their dependencies.
-        '''
-        testdir = os.path.join(self.unit_test_dir, '53 pkgconfig static link order')
-        self.init(testdir)
-        myenv = os.environ.copy()
-        myenv['PKG_CONFIG_PATH'] = self.privatedir
-        stdo = subprocess.check_output(['pkg-config', '--libs', 'libsomething'], env=myenv)
-        deps = stdo.split()
-        self.assertTrue(deps.index(b'-lsomething') < deps.index(b'-ldependency'))
-
-    def test_deterministic_dep_order(self):
-        '''
-        Test that the dependencies are always listed in a deterministic order.
-        '''
-        testdir = os.path.join(self.unit_test_dir, '43 dep order')
-        self.init(testdir)
-        with open(os.path.join(self.builddir, 'build.ninja')) as bfile:
-            for line in bfile:
-                if 'build myexe:' in line or 'build myexe.exe:' in line:
-                    self.assertIn('liblib1.a liblib2.a', line)
-                    return
-        raise RuntimeError('Could not find the build rule')
-
-    def test_deterministic_rpath_order(self):
-        '''
-        Test that the rpaths are always listed in a deterministic order.
-        '''
-        if is_cygwin():
-            raise unittest.SkipTest('rpath are not used on Cygwin')
-        testdir = os.path.join(self.unit_test_dir, '42 rpath order')
-        self.init(testdir)
-        if is_osx():
-            rpathre = re.compile(r'-rpath,.*/subprojects/sub1.*-rpath,.*/subprojects/sub2')
-        else:
-            rpathre = re.compile(r'-rpath,\$\$ORIGIN/subprojects/sub1:\$\$ORIGIN/subprojects/sub2')
-        with open(os.path.join(self.builddir, 'build.ninja')) as bfile:
-            for line in bfile:
-                if '-rpath' in line:
-                    self.assertRegex(line, rpathre)
-                    return
-        raise RuntimeError('Could not find the rpath')
-
-    def test_override_with_exe_dep(self):
-        '''
-        Test that we produce the correct dependencies when a program is overridden with an executable.
-        '''
-        testdir = os.path.join(self.common_test_dir, '201 override with exe')
-        self.init(testdir)
-        with open(os.path.join(self.builddir, 'build.ninja')) as bfile:
-            for line in bfile:
-                if 'main1.c:' in line or 'main2.c:' in line:
-                    self.assertIn('| subprojects/sub/foobar', line)
-
-    @skipIfNoPkgconfig
-    def test_usage_external_library(self):
-        '''
-        Test that uninstalled usage of an external library (from the system or
-        PkgConfigDependency) works. On macOS, this workflow works out of the
-        box. On Linux, BSDs, Windows, etc, you need to set extra arguments such
-        as LD_LIBRARY_PATH, etc, so this test is skipped.
-
-        The system library is found with cc.find_library() and pkg-config deps.
-        '''
-        oldprefix = self.prefix
-        # Install external library so we can find it
-        testdir = os.path.join(self.unit_test_dir, '40 external, internal library rpath', 'external library')
-        # install into installdir without using DESTDIR
-        installdir = self.installdir
-        self.prefix = installdir
-        self.init(testdir)
-        self.prefix = oldprefix
-        self.build()
-        self.install(use_destdir=False)
-        ## New builddir for the consumer
-        self.new_builddir()
-        env = {'LIBRARY_PATH': os.path.join(installdir, self.libdir),
-               'PKG_CONFIG_PATH': os.path.join(installdir, self.libdir, 'pkgconfig')}
-        testdir = os.path.join(self.unit_test_dir, '40 external, internal library rpath', 'built library')
-        # install into installdir without using DESTDIR
-        self.prefix = self.installdir
-        self.init(testdir, override_envvars=env)
-        self.prefix = oldprefix
-        self.build(override_envvars=env)
-        # test uninstalled
-        self.run_tests(override_envvars=env)
-        if not (is_osx() or is_linux()):
-            return
-        # test running after installation
-        self.install(use_destdir=False)
-        prog = os.path.join(self.installdir, 'bin', 'prog')
-        self._run([prog])
-        if not is_osx():
-            # Rest of the workflow only works on macOS
-            return
-        out = self._run(['otool', '-L', prog])
-        self.assertNotIn('@rpath', out)
-        ## New builddir for testing that DESTDIR is not added to install_name
-        self.new_builddir()
-        # install into installdir with DESTDIR
-        self.init(testdir, override_envvars=env)
-        self.build(override_envvars=env)
-        # test running after installation
-        self.install(override_envvars=env)
-        prog = self.installdir + os.path.join(self.prefix, 'bin', 'prog')
-        lib = self.installdir + os.path.join(self.prefix, 'lib', 'libbar_built.dylib')
-        for f in prog, lib:
-            out = self._run(['otool', '-L', f])
-            # Ensure that the otool output does not contain self.installdir
-            self.assertNotRegex(out, self.installdir + '.*dylib ')
-
-    @skipIfNoPkgconfig
-    def test_usage_pkgconfig_prefixes(self):
-        '''
-        Build and install two external libraries, to different prefixes,
-        then build and install a client program that finds them via pkgconfig,
-        and verify the installed client program runs.
-        '''
-        oldinstalldir = self.installdir
-
-        # Build and install both external libraries without DESTDIR
-        val1dir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'val1')
-        val1prefix = os.path.join(oldinstalldir, 'val1')
-        self.prefix = val1prefix
-        self.installdir = val1prefix
-        self.init(val1dir)
-        self.build()
-        self.install(use_destdir=False)
-        self.new_builddir()
-
-        env1 = {}
-        env1['PKG_CONFIG_PATH'] = os.path.join(val1prefix, self.libdir, 'pkgconfig')
-        val2dir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'val2')
-        val2prefix = os.path.join(oldinstalldir, 'val2')
-        self.prefix = val2prefix
-        self.installdir = val2prefix
-        self.init(val2dir, override_envvars=env1)
-        self.build()
-        self.install(use_destdir=False)
-        self.new_builddir()
-
-        # Build, install, and run the client program
-        env2 = {}
-        env2['PKG_CONFIG_PATH'] = os.path.join(val2prefix, self.libdir, 'pkgconfig')
-        testdir = os.path.join(self.unit_test_dir, '76 pkgconfig prefixes', 'client')
-        testprefix = os.path.join(oldinstalldir, 'client')
-        self.prefix = testprefix
-        self.installdir = testprefix
-        self.init(testdir, override_envvars=env2)
-        self.build()
-        self.install(use_destdir=False)
-        prog = os.path.join(self.installdir, 'bin', 'client')
-        env3 = {}
-        if is_cygwin():
-            env3['PATH'] = os.path.join(val1prefix, 'bin') + \
-                os.pathsep + \
-                os.path.join(val2prefix, 'bin') + \
-                os.pathsep + os.environ['PATH']
-        out = self._run([prog], override_envvars=env3).strip()
-        # Expected output is val1 + val2 = 3
-        self.assertEqual(out, '3')
-
-    def install_subdir_invalid_symlinks(self, testdir, subdir_path):
-        '''
-        Test that installation of broken symlinks works fine.
-        https://github.com/mesonbuild/meson/issues/3914
-        '''
-        testdir = os.path.join(self.common_test_dir, testdir)
-        subdir = os.path.join(testdir, subdir_path)
-        with chdir(subdir):
-            # Can't distribute broken symlinks in the source tree because it breaks
-            # the creation of zipapps. Create it dynamically and run the test by
-            # hand.
-            src = '../../nonexistent.txt'
-            os.symlink(src, 'invalid-symlink.txt')
-            try:
-                self.init(testdir)
-                self.build()
-                self.install()
-                install_path = subdir_path.split(os.path.sep)[-1]
-                link = os.path.join(self.installdir, 'usr', 'share', install_path, 'invalid-symlink.txt')
-                self.assertTrue(os.path.islink(link), msg=link)
-                self.assertEqual(src, os.readlink(link))
-                self.assertFalse(os.path.isfile(link), msg=link)
-            finally:
-                os.remove(os.path.join(subdir, 'invalid-symlink.txt'))
-
-    def test_install_subdir_symlinks(self):
-        self.install_subdir_invalid_symlinks('62 install subdir', os.path.join('sub', 'sub1'))
-
-    def test_install_subdir_symlinks_with_default_umask(self):
-        self.install_subdir_invalid_symlinks('195 install_mode', 'sub2')
-
-    def test_install_subdir_symlinks_with_default_umask_and_mode(self):
-        self.install_subdir_invalid_symlinks('195 install_mode', 'sub1')
-
-    @skipIfNoPkgconfigDep('gmodule-2.0')
-    def test_ldflag_dedup(self):
-        testdir = os.path.join(self.unit_test_dir, '52 ldflagdedup')
-        if is_cygwin() or is_osx():
-            raise unittest.SkipTest('Not applicable on Cygwin or OSX.')
-        env = get_fake_env()
-        cc = env.detect_c_compiler(MachineChoice.HOST)
-        linker = cc.linker
-        if not linker.export_dynamic_args(env):
-            raise unittest.SkipTest('Not applicable for linkers without --export-dynamic')
-        self.init(testdir)
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        max_count = 0
-        search_term = '-Wl,--export-dynamic'
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            for line in f:
-                max_count = max(max_count, line.count(search_term))
-        self.assertEqual(max_count, 1, 'Export dynamic incorrectly deduplicated.')
-
-    def test_compiler_libs_static_dedup(self):
-        testdir = os.path.join(self.unit_test_dir, '56 dedup compiler libs')
-        self.init(testdir)
-        build_ninja = os.path.join(self.builddir, 'build.ninja')
-        with open(build_ninja, 'r', encoding='utf-8') as f:
-            lines = f.readlines()
-        for lib in ('-ldl', '-lm', '-lc', '-lrt'):
-            for line in lines:
-                if lib not in line:
-                    continue
-                # Assert that
-                self.assertEqual(len(line.split(lib)), 2, msg=(lib, line))
-
-    @skipIfNoPkgconfig
-    def test_noncross_options(self):
-        # C_std defined in project options must be in effect also when native compiling.
-        testdir = os.path.join(self.unit_test_dir, '51 noncross options')
-        self.init(testdir, extra_args=['-Dpkg_config_path=' + testdir])
-        compdb = self.get_compdb()
-        self.assertEqual(len(compdb), 2)
-        self.assertRegex(compdb[0]['command'], '-std=c99')
-        self.assertRegex(compdb[1]['command'], '-std=c99')
-        self.build()
-
-    def test_identity_cross(self):
-        testdir = os.path.join(self.unit_test_dir, '61 identity cross')
-
-        nativefile = tempfile.NamedTemporaryFile(mode='w')
-        nativefile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'build_wrapper.py')))
-        nativefile.flush()
-        self.meson_native_file = nativefile.name
-
-        crossfile = tempfile.NamedTemporaryFile(mode='w')
-        crossfile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'host_wrapper.py')))
-        crossfile.flush()
-        self.meson_cross_file = crossfile.name
-
-        # TODO should someday be explicit about build platform only here
-        self.init(testdir)
-
-    def test_identity_cross_env(self):
-        testdir = os.path.join(self.unit_test_dir, '61 identity cross')
-        env = {
-            'CC_FOR_BUILD': '"' + os.path.join(testdir, 'build_wrapper.py') + '"',
-        }
-        crossfile = tempfile.NamedTemporaryFile(mode='w')
-        crossfile.write('''[binaries]
-c = ['{0}']
-'''.format(os.path.join(testdir, 'host_wrapper.py')))
-        crossfile.flush()
-        self.meson_cross_file = crossfile.name
-        # TODO should someday be explicit about build platform only here
-        self.init(testdir, override_envvars=env)
-
-    @skipIfNoPkgconfig
-    def test_static_link(self):
-        if is_cygwin():
-            raise unittest.SkipTest("Cygwin doesn't support LD_LIBRARY_PATH.")
-
-        # Build some libraries and install them
-        testdir = os.path.join(self.unit_test_dir, '68 static link/lib')
-        libdir = os.path.join(self.installdir, self.libdir)
-        oldprefix = self.prefix
-        self.prefix = self.installdir
-        self.init(testdir)
-        self.install(use_destdir=False)
-
-        # Test that installed libraries works
-        self.new_builddir()
-        self.prefix = oldprefix
-        meson_args = ['-Dc_link_args=-L{}'.format(libdir),
-                      '--fatal-meson-warnings']
-        testdir = os.path.join(self.unit_test_dir, '68 static link')
-        env = {'PKG_CONFIG_LIBDIR': os.path.join(libdir, 'pkgconfig')}
-        self.init(testdir, extra_args=meson_args, override_envvars=env)
-        self.build()
-        self.run_tests()
-
-    def _check_ld(self, check: str, name: str, lang: str, expected: str) -> None:
-        if is_sunos():
-            raise unittest.SkipTest('Solaris currently cannot override the linker.')
-        if not shutil.which(check):
-            raise unittest.SkipTest('Could not find {}.'.format(check))
-        envvars = [mesonbuild.envconfig.BinaryTable.evarMap['{}_ld'.format(lang)]]
-
-        # Also test a deprecated variable if there is one.
-        if envvars[0] in mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP:
-            envvars.append(
-                mesonbuild.envconfig.BinaryTable.DEPRECATION_MAP[envvars[0]])
-
-        for envvar in envvars:
-            with mock.patch.dict(os.environ, {envvar: name}):
-                env = get_fake_env()
-                comp = getattr(env, 'detect_{}_compiler'.format(lang))(MachineChoice.HOST)
-                if lang != 'rust' and comp.use_linker_args('bfd') == []:
-                    raise unittest.SkipTest(
-                        'Compiler {} does not support using alternative linkers'.format(comp.id))
-                self.assertEqual(comp.linker.id, expected)
-
-    def test_ld_environment_variable_bfd(self):
-        self._check_ld('ld.bfd', 'bfd', 'c', 'ld.bfd')
-
-    def test_ld_environment_variable_gold(self):
-        self._check_ld('ld.gold', 'gold', 'c', 'ld.gold')
-
-    def test_ld_environment_variable_lld(self):
-        self._check_ld('ld.lld', 'lld', 'c', 'ld.lld')
-
-    @skip_if_not_language('rust')
-    def test_ld_environment_variable_rust(self):
-        self._check_ld('ld.gold', 'gold', 'rust', 'ld.gold')
-
-    def test_ld_environment_variable_cpp(self):
-        self._check_ld('ld.gold', 'gold', 'cpp', 'ld.gold')
-
-    @skip_if_not_language('objc')
-    def test_ld_environment_variable_objc(self):
-        self._check_ld('ld.gold', 'gold', 'objc', 'ld.gold')
-
-    @skip_if_not_language('objcpp')
-    def test_ld_environment_variable_objcpp(self):
-        self._check_ld('ld.gold', 'gold', 'objcpp', 'ld.gold')
-
-    @skip_if_not_language('fortran')
-    def test_ld_environment_variable_fortran(self):
-        self._check_ld('ld.gold', 'gold', 'fortran', 'ld.gold')
-
-    @skip_if_not_language('d')
-    def test_ld_environment_variable_d(self):
-        # At least for me, ldc defaults to gold, and gdc defaults to bfd, so
-        # let's pick lld, which isn't the default for either (currently)
-        self._check_ld('ld.lld', 'lld', 'd', 'ld.lld')
-
-    def compute_sha256(self, filename):
-        with open(filename, 'rb') as f:
-            return hashlib.sha256(f.read()).hexdigest()
-
-    def test_wrap_with_file_url(self):
-        testdir = os.path.join(self.unit_test_dir, '74 wrap file url')
-        source_filename = os.path.join(testdir, 'subprojects', 'foo.tar.xz')
-        patch_filename = os.path.join(testdir, 'subprojects', 'foo-patch.tar.xz')
-        wrap_filename = os.path.join(testdir, 'subprojects', 'foo.wrap')
-        source_hash = self.compute_sha256(source_filename)
-        patch_hash = self.compute_sha256(patch_filename)
-        wrap = textwrap.dedent("""\
-            [wrap-file]
-            directory = foo
-
-            source_url = http://server.invalid/foo
-            source_fallback_url = file://{}
-            source_filename = foo.tar.xz
-            source_hash = {}
-
-            patch_url = http://server.invalid/foo
-            patch_fallback_url = file://{}
-            patch_filename = foo-patch.tar.xz
-            patch_hash = {}
-            """.format(source_filename, source_hash, patch_filename, patch_hash))
-        with open(wrap_filename, 'w') as f:
-            f.write(wrap)
-        self.init(testdir)
-        self.build()
-        self.run_tests()
-
-        windows_proof_rmtree(os.path.join(testdir, 'subprojects', 'packagecache'))
-        windows_proof_rmtree(os.path.join(testdir, 'subprojects', 'foo'))
-        os.unlink(wrap_filename)
-
-    def test_no_rpath_for_static(self):
-        testdir = os.path.join(self.common_test_dir, '5 linkstatic')
-        self.init(testdir)
-        self.build()
-        build_rpath = get_rpath(os.path.join(self.builddir, 'prog'))
-        self.assertIsNone(build_rpath)
-
-    def test_lookup_system_after_broken_fallback(self):
-        # Just to generate libfoo.pc so we can test system dependency lookup.
-        testdir = os.path.join(self.common_test_dir, '47 pkgconfig-gen')
-        self.init(testdir)
-        privatedir = self.privatedir
-
-        # Write test project where the first dependency() returns not-found
-        # because 'broken' subproject does not exit, but that should not prevent
-        # the 2nd dependency() to lookup on system.
-        self.new_builddir()
-        with tempfile.TemporaryDirectory() as d:
-            with open(os.path.join(d, 'meson.build'), 'w') as f:
-                f.write(textwrap.dedent('''\
-                    project('test')
-                    dependency('notfound', fallback: 'broken', required: false)
-                    dependency('libfoo', fallback: 'broken', required: true)
-                    '''))
-            self.init(d, override_envvars={'PKG_CONFIG_LIBDIR': privatedir})
-
-class BaseLinuxCrossTests(BasePlatformTests):
-    # Don't pass --libdir when cross-compiling. We have tests that
-    # check whether meson auto-detects it correctly.
-    libdir = None
-
-
-def should_run_cross_arm_tests():
-    return shutil.which('arm-linux-gnueabihf-gcc') and not platform.machine().lower().startswith('arm')
-
-@unittest.skipUnless(not is_windows() and should_run_cross_arm_tests(), "requires ability to cross compile to ARM")
-class LinuxCrossArmTests(BaseLinuxCrossTests):
-    '''
-    Tests that cross-compilation to Linux/ARM works
-    '''
-
-    def setUp(self):
-        super().setUp()
-        src_root = os.path.dirname(__file__)
-        self.meson_cross_file = os.path.join(src_root, 'cross', 'ubuntu-armhf.txt')
-
-    def test_cflags_cross_environment_pollution(self):
-        '''
-        Test that the CFLAGS environment variable does not pollute the cross
-        environment. This can't be an ordinary test case because we need to
-        inspect the compiler database.
-        '''
-        testdir = os.path.join(self.common_test_dir, '3 static')
-        self.init(testdir, override_envvars={'CFLAGS': '-DBUILD_ENVIRONMENT_ONLY'})
-        compdb = self.get_compdb()
-        self.assertNotIn('-DBUILD_ENVIRONMENT_ONLY', compdb[0]['command'])
-
-    def test_cross_file_overrides_always_args(self):
-        '''
-        Test that $lang_args in cross files always override get_always_args().
-        Needed for overriding the default -D_FILE_OFFSET_BITS=64 on some
-        architectures such as some Android versions and Raspbian.
-        https://github.com/mesonbuild/meson/issues/3049
-        https://github.com/mesonbuild/meson/issues/3089
-        '''
-        testdir = os.path.join(self.unit_test_dir, '33 cross file overrides always args')
-        self.meson_cross_file = os.path.join(testdir, 'ubuntu-armhf-overrides.txt')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        self.assertRegex(compdb[0]['command'], '-D_FILE_OFFSET_BITS=64.*-U_FILE_OFFSET_BITS')
-        self.build()
-
-    def test_cross_libdir(self):
-        # When cross compiling "libdir" should default to "lib"
-        # rather than "lib/x86_64-linux-gnu" or something like that.
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        self.init(testdir)
-        for i in self.introspect('--buildoptions'):
-            if i['name'] == 'libdir':
-                self.assertEqual(i['value'], 'lib')
-                return
-        self.assertTrue(False, 'Option libdir not in introspect data.')
-
-    def test_cross_libdir_subproject(self):
-        # Guard against a regression where calling "subproject"
-        # would reset the value of libdir to its default value.
-        testdir = os.path.join(self.unit_test_dir, '76 subdir libdir')
-        self.init(testdir, extra_args=['--libdir=fuf'])
-        for i in self.introspect('--buildoptions'):
-            if i['name'] == 'libdir':
-                self.assertEqual(i['value'], 'fuf')
-                return
-        self.assertTrue(False, 'Libdir specified on command line gets reset.')
-
-    def test_std_remains(self):
-        # C_std defined in project options must be in effect also when cross compiling.
-        testdir = os.path.join(self.unit_test_dir, '51 noncross options')
-        self.init(testdir)
-        compdb = self.get_compdb()
-        self.assertRegex(compdb[0]['command'], '-std=c99')
-        self.build()
-
-    @skipIfNoPkgconfig
-    def test_pkg_config_option(self):
-        if not shutil.which('arm-linux-gnueabihf-pkg-config'):
-            raise unittest.SkipTest('Cross-pkgconfig not found.')
-        testdir = os.path.join(self.unit_test_dir, '58 pkg_config_path option')
-        self.init(testdir, extra_args=[
-            '-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'),
-            '-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'),
-        ])
-
-
-def should_run_cross_mingw_tests():
-    return shutil.which('x86_64-w64-mingw32-gcc') and not (is_windows() or is_cygwin())
-
-@unittest.skipUnless(not is_windows() and should_run_cross_mingw_tests(), "requires ability to cross compile with MinGW")
-class LinuxCrossMingwTests(BaseLinuxCrossTests):
-    '''
-    Tests that cross-compilation to Windows/MinGW works
-    '''
-
-    def setUp(self):
-        super().setUp()
-        src_root = os.path.dirname(__file__)
-        self.meson_cross_file = os.path.join(src_root, 'cross', 'linux-mingw-w64-64bit.txt')
-
-    def test_exe_wrapper_behaviour(self):
-        '''
-        Test that an exe wrapper that isn't found doesn't cause compiler sanity
-        checks and compiler checks to fail, but causes configure to fail if it
-        requires running a cross-built executable (custom_target or run_target)
-        and causes the tests to be skipped if they are run.
-        '''
-        testdir = os.path.join(self.unit_test_dir, '36 exe_wrapper behaviour')
-        # Configures, builds, and tests fine by default
-        self.init(testdir)
-        self.build()
-        self.run_tests()
-        self.wipe()
-        os.mkdir(self.builddir)
-        # Change cross file to use a non-existing exe_wrapper and it should fail
-        self.meson_cross_file = os.path.join(testdir, 'broken-cross.txt')
-        # Force tracebacks so we can detect them properly
-        env = {'MESON_FORCE_BACKTRACE': '1'}
-        with self.assertRaisesRegex(MesonException, 'exe_wrapper.*target.*use-exe-wrapper'):
-            # Must run in-process or we'll get a generic CalledProcessError
-            self.init(testdir, extra_args='-Drun-target=false',
-                      inprocess=True,
-                      override_envvars=env)
-        with self.assertRaisesRegex(MesonException, 'exe_wrapper.*run target.*run-prog'):
-            # Must run in-process or we'll get a generic CalledProcessError
-            self.init(testdir, extra_args='-Dcustom-target=false',
-                      inprocess=True,
-                      override_envvars=env)
-        self.init(testdir, extra_args=['-Dcustom-target=false', '-Drun-target=false'],
-                  override_envvars=env)
-        self.build()
-        with self.assertRaisesRegex(MesonException, 'exe_wrapper.*PATH'):
-            # Must run in-process or we'll get a generic CalledProcessError
-            self.run_tests(inprocess=True, override_envvars=env)
-
-    @skipIfNoPkgconfig
-    def test_cross_pkg_config_option(self):
-        testdir = os.path.join(self.unit_test_dir, '58 pkg_config_path option')
-        self.init(testdir, extra_args=[
-            '-Dbuild.pkg_config_path=' + os.path.join(testdir, 'build_extra_path'),
-            '-Dpkg_config_path=' + os.path.join(testdir, 'host_extra_path'),
-        ])
-
-
-class PythonTests(BasePlatformTests):
-    '''
-    Tests that verify compilation of python extension modules
-    '''
-
-    def test_versions(self):
-        if self.backend is not Backend.ninja:
-            raise unittest.SkipTest('Skipping python tests with {} backend'.format(self.backend.name))
-
-        testdir = os.path.join(self.src_root, 'test cases', 'unit', '39 python extmodule')
-
-        # No python version specified, this will use meson's python
-        self.init(testdir)
-        self.build()
-        self.run_tests()
-        self.wipe()
-
-        # When specifying a known name, (python2 / python3) the module
-        # will also try 'python' as a fallback and use it if the major
-        # version matches
-        try:
-            self.init(testdir, extra_args=['-Dpython=python2'])
-            self.build()
-            self.run_tests()
-        except unittest.SkipTest:
-            # python2 is not necessarily installed on the test machine,
-            # if it is not, or the python headers can't be found, the test
-            # will raise MESON_SKIP_TEST, we could check beforehand what version
-            # of python is available, but it's a bit of a chicken and egg situation,
-            # as that is the job of the module, so we just ask for forgiveness rather
-            # than permission.
-            pass
-
-        self.wipe()
-
-        for py in ('pypy', 'pypy3'):
-            try:
-                self.init(testdir, extra_args=['-Dpython=%s' % py])
-            except unittest.SkipTest:
-                # Same as above, pypy2 and pypy3 are not expected to be present
-                # on the test system, the test project only raises in these cases
-                continue
-
-            # We have a pypy, this is expected to work
-            self.build()
-            self.run_tests()
-            self.wipe()
-
-        # The test is configured to error out with MESON_SKIP_TEST
-        # in case it could not find python
-        with self.assertRaises(unittest.SkipTest):
-            self.init(testdir, extra_args=['-Dpython=not-python'])
-        self.wipe()
-
-        # While dir is an external command on both Windows and Linux,
-        # it certainly isn't python
-        with self.assertRaises(unittest.SkipTest):
-            self.init(testdir, extra_args=['-Dpython=dir'])
-        self.wipe()
-
-
-class RewriterTests(BasePlatformTests):
-    def setUp(self):
-        super().setUp()
-        self.maxDiff = None
-
-    def prime(self, dirname):
-        copy_tree(os.path.join(self.rewrite_test_dir, dirname), self.builddir)
-
-    def rewrite_raw(self, directory, args):
-        if isinstance(args, str):
-            args = [args]
-        command = self.rewrite_command + ['--verbose', '--skip', '--sourcedir', directory] + args
-        p = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
-                           universal_newlines=True, timeout=60)
-        print('STDOUT:')
-        print(p.stdout)
-        print('STDERR:')
-        print(p.stderr)
-        if p.returncode != 0:
-            if 'MESON_SKIP_TEST' in p.stdout:
-                raise unittest.SkipTest('Project requested skipping.')
-            raise subprocess.CalledProcessError(p.returncode, command, output=p.stdout)
-        if not p.stderr:
-            return {}
-        return json.loads(p.stderr)
-
-    def rewrite(self, directory, args):
-        if isinstance(args, str):
-            args = [args]
-        return self.rewrite_raw(directory, ['command'] + args)
-
-    def test_target_source_list(self):
-        self.prime('1 basic')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'target': {
-                'trivialprog0@exe': {'name': 'trivialprog0', 'sources': ['main.cpp', 'fileA.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog1@exe': {'name': 'trivialprog1', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog2@exe': {'name': 'trivialprog2', 'sources': ['fileB.cpp', 'fileC.cpp']},
-                'trivialprog3@exe': {'name': 'trivialprog3', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog4@exe': {'name': 'trivialprog4', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog5@exe': {'name': 'trivialprog5', 'sources': ['main.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog6@exe': {'name': 'trivialprog6', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog7@exe': {'name': 'trivialprog7', 'sources': ['fileB.cpp', 'fileC.cpp', 'main.cpp', 'fileA.cpp']},
-                'trivialprog8@exe': {'name': 'trivialprog8', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog9@exe': {'name': 'trivialprog9', 'sources': ['main.cpp', 'fileA.cpp']},
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_target_add_sources(self):
-        self.prime('1 basic')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'addSrc.json'))
-        expected = {
-            'target': {
-                'trivialprog0@exe': {'name': 'trivialprog0', 'sources': ['a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp', 'a7.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog1@exe': {'name': 'trivialprog1', 'sources': ['a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp']},
-                'trivialprog2@exe': {'name': 'trivialprog2', 'sources': ['a7.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog3@exe': {'name': 'trivialprog3', 'sources': ['a5.cpp', 'fileA.cpp', 'main.cpp']},
-                'trivialprog4@exe': {'name': 'trivialprog4', 'sources': ['a5.cpp', 'main.cpp', 'fileA.cpp']},
-                'trivialprog5@exe': {'name': 'trivialprog5', 'sources': ['a3.cpp', 'main.cpp', 'a7.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog6@exe': {'name': 'trivialprog6', 'sources': ['main.cpp', 'fileA.cpp', 'a4.cpp']},
-                'trivialprog7@exe': {'name': 'trivialprog7', 'sources': ['fileB.cpp', 'fileC.cpp', 'a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp']},
-                'trivialprog8@exe': {'name': 'trivialprog8', 'sources': ['a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp']},
-                'trivialprog9@exe': {'name': 'trivialprog9', 'sources': ['a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp']},
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-        # Check the written file
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        self.assertDictEqual(out, expected)
-
-    def test_target_add_sources_abs(self):
-        self.prime('1 basic')
-        abs_src = [os.path.join(self.builddir, x) for x in ['a1.cpp', 'a2.cpp', 'a6.cpp']]
-        add = json.dumps([{"type": "target", "target": "trivialprog1", "operation": "src_add", "sources": abs_src}])
-        inf = json.dumps([{"type": "target", "target": "trivialprog1", "operation": "info"}])
-        self.rewrite(self.builddir, add)
-        out = self.rewrite(self.builddir, inf)
-        expected = {'target': {'trivialprog1@exe': {'name': 'trivialprog1', 'sources': ['a1.cpp', 'a2.cpp', 'a6.cpp', 'fileA.cpp', 'main.cpp']}}}
-        self.assertDictEqual(out, expected)
-
-    def test_target_remove_sources(self):
-        self.prime('1 basic')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'rmSrc.json'))
-        expected = {
-            'target': {
-                'trivialprog0@exe': {'name': 'trivialprog0', 'sources': ['main.cpp', 'fileC.cpp']},
-                'trivialprog1@exe': {'name': 'trivialprog1', 'sources': ['main.cpp']},
-                'trivialprog2@exe': {'name': 'trivialprog2', 'sources': ['fileC.cpp']},
-                'trivialprog3@exe': {'name': 'trivialprog3', 'sources': ['main.cpp']},
-                'trivialprog4@exe': {'name': 'trivialprog4', 'sources': ['main.cpp']},
-                'trivialprog5@exe': {'name': 'trivialprog5', 'sources': ['main.cpp', 'fileC.cpp']},
-                'trivialprog6@exe': {'name': 'trivialprog6', 'sources': ['main.cpp']},
-                'trivialprog7@exe': {'name': 'trivialprog7', 'sources': ['fileC.cpp', 'main.cpp']},
-                'trivialprog8@exe': {'name': 'trivialprog8', 'sources': ['main.cpp']},
-                'trivialprog9@exe': {'name': 'trivialprog9', 'sources': ['main.cpp']},
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-        # Check the written file
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        self.assertDictEqual(out, expected)
-
-    def test_target_subdir(self):
-        self.prime('2 subdirs')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'addSrc.json'))
-        expected = {'name': 'something', 'sources': ['first.c', 'second.c', 'third.c']}
-        self.assertDictEqual(list(out['target'].values())[0], expected)
-
-        # Check the written file
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        self.assertDictEqual(list(out['target'].values())[0], expected)
-
-    def test_target_remove(self):
-        self.prime('1 basic')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'rmTgt.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-
-        expected = {
-            'target': {
-                'trivialprog2@exe': {'name': 'trivialprog2', 'sources': ['fileB.cpp', 'fileC.cpp']},
-                'trivialprog3@exe': {'name': 'trivialprog3', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog4@exe': {'name': 'trivialprog4', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog5@exe': {'name': 'trivialprog5', 'sources': ['main.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog6@exe': {'name': 'trivialprog6', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog7@exe': {'name': 'trivialprog7', 'sources': ['fileB.cpp', 'fileC.cpp', 'main.cpp', 'fileA.cpp']},
-                'trivialprog8@exe': {'name': 'trivialprog8', 'sources': ['main.cpp', 'fileA.cpp']},
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_tatrget_add(self):
-        self.prime('1 basic')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'addTgt.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-
-        expected = {
-            'target': {
-                'trivialprog0@exe': {'name': 'trivialprog0', 'sources': ['main.cpp', 'fileA.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog1@exe': {'name': 'trivialprog1', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog2@exe': {'name': 'trivialprog2', 'sources': ['fileB.cpp', 'fileC.cpp']},
-                'trivialprog3@exe': {'name': 'trivialprog3', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog4@exe': {'name': 'trivialprog4', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog5@exe': {'name': 'trivialprog5', 'sources': ['main.cpp', 'fileB.cpp', 'fileC.cpp']},
-                'trivialprog6@exe': {'name': 'trivialprog6', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog7@exe': {'name': 'trivialprog7', 'sources': ['fileB.cpp', 'fileC.cpp', 'main.cpp', 'fileA.cpp']},
-                'trivialprog8@exe': {'name': 'trivialprog8', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog9@exe': {'name': 'trivialprog9', 'sources': ['main.cpp', 'fileA.cpp']},
-                'trivialprog10@sha': {'name': 'trivialprog10', 'sources': ['new1.cpp', 'new2.cpp']},
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_target_remove_subdir(self):
-        self.prime('2 subdirs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'rmTgt.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        self.assertDictEqual(out, {})
-
-    def test_target_add_subdir(self):
-        self.prime('2 subdirs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'addTgt.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {'name': 'something', 'sources': ['first.c', 'second.c']}
-        self.assertDictEqual(out['target']['94b671c@@something@exe'], expected)
-
-    def test_target_source_sorting(self):
-        self.prime('5 sorting')
-        add_json = json.dumps([{'type': 'target', 'target': 'exe1', 'operation': 'src_add', 'sources': ['a666.c']}])
-        inf_json = json.dumps([{'type': 'target', 'target': 'exe1', 'operation': 'info'}])
-        out = self.rewrite(self.builddir, add_json)
-        out = self.rewrite(self.builddir, inf_json)
-        expected = {
-            'target': {
-                'exe1@exe': {
-                    'name': 'exe1',
-                    'sources': [
-                        'aaa/a/a1.c',
-                        'aaa/b/b1.c',
-                        'aaa/b/b2.c',
-                        'aaa/f1.c',
-                        'aaa/f2.c',
-                        'aaa/f3.c',
-                        'bbb/a/b1.c',
-                        'bbb/b/b2.c',
-                        'bbb/c1/b5.c',
-                        'bbb/c2/b7.c',
-                        'bbb/c10/b6.c',
-                        'bbb/a4.c',
-                        'bbb/b3.c',
-                        'bbb/b4.c',
-                        'bbb/b5.c',
-                        'a1.c',
-                        'a2.c',
-                        'a3.c',
-                        'a10.c',
-                        'a20.c',
-                        'a30.c',
-                        'a100.c',
-                        'a101.c',
-                        'a110.c',
-                        'a210.c',
-                        'a666.c',
-                        'b1.c',
-                        'c2.c'
-                    ]
-                }
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_target_same_name_skip(self):
-        self.prime('4 same name targets')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'addSrc.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {'name': 'myExe', 'sources': ['main.cpp']}
-        self.assertEqual(len(out['target']), 2)
-        for val in out['target'].values():
-            self.assertDictEqual(expected, val)
-
-    def test_kwargs_info(self):
-        self.prime('3 kwargs')
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1'},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_kwargs_set(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'set.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.2', 'meson_version': '0.50.0', 'license': ['GPL', 'MIT']},
-                'target#tgt1': {'build_by_default': False, 'build_rpath': '/usr/local', 'dependencies': 'dep1'},
-                'dependency#dep1': {'required': True, 'method': 'cmake'}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_kwargs_add(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'add.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1', 'license': ['GPL', 'MIT', 'BSD']},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_kwargs_remove(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'remove.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1', 'license': 'GPL'},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_kwargs_remove_regex(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'remove_regex.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1', 'default_options': ['buildtype=release', 'debug=true']},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_kwargs_delete(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'delete.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {},
-                'target#tgt1': {},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_default_options_set(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'defopts_set.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1', 'default_options': ['buildtype=release', 'debug=True', 'cpp_std=c++11']},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-    def test_default_options_delete(self):
-        self.prime('3 kwargs')
-        self.rewrite(self.builddir, os.path.join(self.builddir, 'defopts_delete.json'))
-        out = self.rewrite(self.builddir, os.path.join(self.builddir, 'info.json'))
-        expected = {
-            'kwargs': {
-                'project#/': {'version': '0.0.1', 'default_options': ['cpp_std=c++14', 'debug=true']},
-                'target#tgt1': {'build_by_default': True},
-                'dependency#dep1': {'required': False}
-            }
-        }
-        self.assertDictEqual(out, expected)
-
-class NativeFileTests(BasePlatformTests):
-
-    def setUp(self):
-        super().setUp()
-        self.testcase = os.path.join(self.unit_test_dir, '47 native file binary')
-        self.current_config = 0
-        self.current_wrapper = 0
-
-    def helper_create_native_file(self, values):
-        """Create a config file as a temporary file.
-
-        values should be a nested dictionary structure of {section: {key:
-        value}}
-        """
-        filename = os.path.join(self.builddir, 'generated{}.config'.format(self.current_config))
-        self.current_config += 1
-        with open(filename, 'wt') as f:
-            for section, entries in values.items():
-                f.write('[{}]\n'.format(section))
-                for k, v in entries.items():
-                    f.write("{}='{}'\n".format(k, v))
-        return filename
-
-    def helper_create_binary_wrapper(self, binary, dir_=None, extra_args=None, **kwargs):
-        """Creates a wrapper around a binary that overrides specific values."""
-        filename = os.path.join(dir_ or self.builddir, 'binary_wrapper{}.py'.format(self.current_wrapper))
-        extra_args = extra_args or {}
-        self.current_wrapper += 1
-        if is_haiku():
-            chbang = '#!/bin/env python3'
-        else:
-            chbang = '#!/usr/bin/env python3'
-
-        with open(filename, 'wt') as f:
-            f.write(textwrap.dedent('''\
-                {}
-                import argparse
-                import subprocess
-                import sys
-
-                def main():
-                    parser = argparse.ArgumentParser()
-                '''.format(chbang)))
-            for name in chain(extra_args, kwargs):
-                f.write('    parser.add_argument("-{0}", "--{0}", action="store_true")\n'.format(name))
-            f.write('    args, extra_args = parser.parse_known_args()\n')
-            for name, value in chain(extra_args.items(), kwargs.items()):
-                f.write('    if args.{}:\n'.format(name))
-                f.write('        print("{}", file=sys.{})\n'.format(value, kwargs.get('outfile', 'stdout')))
-                f.write('        sys.exit(0)\n')
-            f.write(textwrap.dedent('''
-                    ret = subprocess.run(
-                        ["{}"] + extra_args,
-                        stdout=subprocess.PIPE,
-                        stderr=subprocess.PIPE)
-                    print(ret.stdout.decode('utf-8'))
-                    print(ret.stderr.decode('utf-8'), file=sys.stderr)
-                    sys.exit(ret.returncode)
-
-                if __name__ == '__main__':
-                    main()
-                '''.format(binary)))
-
-        if not is_windows():
-            os.chmod(filename, 0o755)
-            return filename
-
-        # On windows we need yet another level of indirection, as cmd cannot
-        # invoke python files itself, so instead we generate a .bat file, which
-        # invokes our python wrapper
-        batfile = os.path.join(self.builddir, 'binary_wrapper{}.bat'.format(self.current_wrapper))
-        with open(batfile, 'wt') as f:
-            f.write(r'@{} {} %*'.format(sys.executable, filename))
-        return batfile
-
-    def helper_for_compiler(self, lang, cb, for_machine = MachineChoice.HOST):
-        """Helper for generating tests for overriding compilers for langaugages
-        with more than one implementation, such as C, C++, ObjC, ObjC++, and D.
-        """
-        env = get_fake_env()
-        getter = getattr(env, 'detect_{}_compiler'.format(lang))
-        getter = functools.partial(getter, for_machine)
-        cc = getter()
-        binary, newid = cb(cc)
-        env.binaries[for_machine].binaries[lang] = binary
-        compiler = getter()
-        self.assertEqual(compiler.id, newid)
-
-    def test_multiple_native_files_override(self):
-        wrapper = self.helper_create_binary_wrapper('bash', version='foo')
-        config = self.helper_create_native_file({'binaries': {'bash': wrapper}})
-        wrapper = self.helper_create_binary_wrapper('bash', version='12345')
-        config2 = self.helper_create_native_file({'binaries': {'bash': wrapper}})
-        self.init(self.testcase, extra_args=[
-            '--native-file', config, '--native-file', config2,
-            '-Dcase=find_program'])
-
-    # This test hangs on cygwin.
-    @unittest.skipIf(os.name != 'posix' or is_cygwin(), 'Uses fifos, which are not available on non Unix OSes.')
-    def test_native_file_is_pipe(self):
-        fifo = os.path.join(self.builddir, 'native.file')
-        os.mkfifo(fifo)
-        with tempfile.TemporaryDirectory() as d:
-            wrapper = self.helper_create_binary_wrapper('bash', d, version='12345')
-
-            def filler():
-                with open(fifo, 'w') as f:
-                    f.write('[binaries]\n')
-                    f.write("bash = '{}'\n".format(wrapper))
-
-            thread = threading.Thread(target=filler)
-            thread.start()
-
-            self.init(self.testcase, extra_args=['--native-file', fifo, '-Dcase=find_program'])
-
-            thread.join()
-            os.unlink(fifo)
-
-            self.init(self.testcase, extra_args=['--wipe'])
-
-    def test_multiple_native_files(self):
-        wrapper = self.helper_create_binary_wrapper('bash', version='12345')
-        config = self.helper_create_native_file({'binaries': {'bash': wrapper}})
-        wrapper = self.helper_create_binary_wrapper('python')
-        config2 = self.helper_create_native_file({'binaries': {'python': wrapper}})
-        self.init(self.testcase, extra_args=[
-            '--native-file', config, '--native-file', config2,
-            '-Dcase=find_program'])
-
-    def _simple_test(self, case, binary, entry=None):
-        wrapper = self.helper_create_binary_wrapper(binary, version='12345')
-        config = self.helper_create_native_file({'binaries': {entry or binary: wrapper}})
-        self.init(self.testcase, extra_args=['--native-file', config, '-Dcase={}'.format(case)])
-
-    def test_find_program(self):
-        self._simple_test('find_program', 'bash')
-
-    def test_config_tool_dep(self):
-        # Do the skip at this level to avoid screwing up the cache
-        if mesonbuild.environment.detect_msys2_arch():
-            raise unittest.SkipTest('Skipped due to problems with LLVM on MSYS2')
-        if not shutil.which('llvm-config'):
-            raise unittest.SkipTest('No llvm-installed, cannot test')
-        self._simple_test('config_dep', 'llvm-config')
-
-    def test_python3_module(self):
-        self._simple_test('python3', 'python3')
-
-    def test_python_module(self):
-        if is_windows():
-            # Bat adds extra crap to stdout, so the version check logic in the
-            # python module breaks. This is fine on other OSes because they
-            # don't need the extra indirection.
-            raise unittest.SkipTest('bat indirection breaks internal sanity checks.')
-        elif is_osx():
-            binary = 'python'
-        else:
-            binary = 'python2'
-
-            # We not have python2, check for it
-            for v in ['2', '2.7', '-2.7']:
-                rc = subprocess.call(['pkg-config', '--cflags', 'python{}'.format(v)],
-                                     stdout=subprocess.DEVNULL,
-                                     stderr=subprocess.DEVNULL)
-                if rc == 0:
-                    break
-            else:
-                raise unittest.SkipTest('Not running Python 2 tests because dev packages not installed.')
-        self._simple_test('python', binary, entry='python')
-
-    @unittest.skipIf(is_windows(), 'Setting up multiple compilers on windows is hard')
-    @skip_if_env_set('CC')
-    def test_c_compiler(self):
-        def cb(comp):
-            if comp.id == 'gcc':
-                if not shutil.which('clang'):
-                    raise unittest.SkipTest('Only one compiler found, cannot test.')
-                return 'clang', 'clang'
-            if not is_real_gnu_compiler(shutil.which('gcc')):
-                raise unittest.SkipTest('Only one compiler found, cannot test.')
-            return 'gcc', 'gcc'
-        self.helper_for_compiler('c', cb)
-
-    @unittest.skipIf(is_windows(), 'Setting up multiple compilers on windows is hard')
-    @skip_if_env_set('CXX')
-    def test_cpp_compiler(self):
-        def cb(comp):
-            if comp.id == 'gcc':
-                if not shutil.which('clang++'):
-                    raise unittest.SkipTest('Only one compiler found, cannot test.')
-                return 'clang++', 'clang'
-            if not is_real_gnu_compiler(shutil.which('g++')):
-                raise unittest.SkipTest('Only one compiler found, cannot test.')
-            return 'g++', 'gcc'
-        self.helper_for_compiler('cpp', cb)
-
-    @skip_if_not_language('objc')
-    @skip_if_env_set('OBJC')
-    def test_objc_compiler(self):
-        def cb(comp):
-            if comp.id == 'gcc':
-                if not shutil.which('clang'):
-                    raise unittest.SkipTest('Only one compiler found, cannot test.')
-                return 'clang', 'clang'
-            if not is_real_gnu_compiler(shutil.which('gcc')):
-                raise unittest.SkipTest('Only one compiler found, cannot test.')
-            return 'gcc', 'gcc'
-        self.helper_for_compiler('objc', cb)
-
-    @skip_if_not_language('objcpp')
-    @skip_if_env_set('OBJCXX')
-    def test_objcpp_compiler(self):
-        def cb(comp):
-            if comp.id == 'gcc':
-                if not shutil.which('clang++'):
-                    raise unittest.SkipTest('Only one compiler found, cannot test.')
-                return 'clang++', 'clang'
-            if not is_real_gnu_compiler(shutil.which('g++')):
-                raise unittest.SkipTest('Only one compiler found, cannot test.')
-            return 'g++', 'gcc'
-        self.helper_for_compiler('objcpp', cb)
-
-    @skip_if_not_language('d')
-    @skip_if_env_set('DC')
-    def test_d_compiler(self):
-        def cb(comp):
-            if comp.id == 'dmd':
-                if shutil.which('ldc'):
-                    return 'ldc', 'ldc'
-                elif shutil.which('gdc'):
-                    return 'gdc', 'gdc'
-                else:
-                    raise unittest.SkipTest('No alternative dlang compiler found.')
-            if shutil.which('dmd'):
-                return 'dmd', 'dmd'
-            raise unittest.SkipTest('No alternative dlang compiler found.')
-        self.helper_for_compiler('d', cb)
-
-    @skip_if_not_language('cs')
-    @skip_if_env_set('CSC')
-    def test_cs_compiler(self):
-        def cb(comp):
-            if comp.id == 'csc':
-                if not shutil.which('mcs'):
-                    raise unittest.SkipTest('No alternate C# implementation.')
-                return 'mcs', 'mcs'
-            if not shutil.which('csc'):
-                raise unittest.SkipTest('No alternate C# implementation.')
-            return 'csc', 'csc'
-        self.helper_for_compiler('cs', cb)
-
-    @skip_if_not_language('fortran')
-    @skip_if_env_set('FC')
-    def test_fortran_compiler(self):
-        def cb(comp):
-            if comp.id == 'lcc':
-                if shutil.which('lfortran'):
-                    return 'lfortran', 'lcc'
-                raise unittest.SkipTest('No alternate Fortran implementation.')
-            elif comp.id == 'gcc':
-                if shutil.which('ifort'):
-                    # There is an ICC for windows (windows build, linux host),
-                    # but we don't support that ATM so lets not worry about it.
-                    if is_windows():
-                        return 'ifort', 'intel-cl'
-                    return 'ifort', 'intel'
-                elif shutil.which('flang'):
-                    return 'flang', 'flang'
-                elif shutil.which('pgfortran'):
-                    return 'pgfortran', 'pgi'
-                # XXX: there are several other fortran compilers meson
-                # supports, but I don't have any of them to test with
-                raise unittest.SkipTest('No alternate Fortran implementation.')
-            if not shutil.which('gfortran'):
-                raise unittest.SkipTest('No alternate Fortran implementation.')
-            return 'gfortran', 'gcc'
-        self.helper_for_compiler('fortran', cb)
-
-    def _single_implementation_compiler(self, lang, binary, version_str, version):
-        """Helper for languages with a single (supported) implementation.
-
-        Builds a wrapper around the compiler to override the version.
-        """
-        wrapper = self.helper_create_binary_wrapper(binary, version=version_str)
-        env = get_fake_env()
-        getter = getattr(env, 'detect_{}_compiler'.format(lang))
-        getter = functools.partial(getter, MachineChoice.HOST)
-        env.binaries.host.binaries[lang] = wrapper
-        compiler = getter()
-        self.assertEqual(compiler.version, version)
-
-    @skip_if_not_language('vala')
-    @skip_if_env_set('VALAC')
-    def test_vala_compiler(self):
-        self._single_implementation_compiler(
-            'vala', 'valac', 'Vala 1.2345', '1.2345')
-
-    @skip_if_not_language('rust')
-    @skip_if_env_set('RUSTC')
-    def test_rust_compiler(self):
-        self._single_implementation_compiler(
-            'rust', 'rustc', 'rustc 1.2345', '1.2345')
-
-    @skip_if_not_language('java')
-    def test_java_compiler(self):
-        self._single_implementation_compiler(
-            'java', 'javac', 'javac 9.99.77', '9.99.77')
-
-    @skip_if_not_language('swift')
-    def test_swift_compiler(self):
-        wrapper = self.helper_create_binary_wrapper(
-            'swiftc', version='Swift 1.2345', outfile='stderr',
-            extra_args={'Xlinker': 'macosx_version. PROJECT:ld - 1.2.3'})
-        env = get_fake_env()
-        env.binaries.host.binaries['swift'] = wrapper
-        compiler = env.detect_swift_compiler(MachineChoice.HOST)
-        self.assertEqual(compiler.version, '1.2345')
-
-    def test_native_file_dirs(self):
-        testcase = os.path.join(self.unit_test_dir, '60 native file override')
-        self.init(testcase, default_args=False,
-                  extra_args=['--native-file', os.path.join(testcase, 'nativefile')])
-
-    def test_native_file_dirs_overriden(self):
-        testcase = os.path.join(self.unit_test_dir, '60 native file override')
-        self.init(testcase, default_args=False,
-                  extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
-                              '-Ddef_libdir=liblib', '-Dlibdir=liblib'])
-
-    def test_compile_sys_path(self):
-        """Compiling with a native file stored in a system path works.
-
-        There was a bug which caused the paths to be stored incorrectly and
-        would result in ninja invoking meson in an infinite loop. This tests
-        for that by actually invoking ninja.
-        """
-        testcase = os.path.join(self.common_test_dir, '1 trivial')
-
-        # It really doesn't matter what's in the native file, just that it exists
-        config = self.helper_create_native_file({'binaries': {'bash': 'false'}})
-
-        self.init(testcase, extra_args=['--native-file', config])
-        self.build()
-
-
-class CrossFileTests(BasePlatformTests):
-
-    """Tests for cross file functionality not directly related to
-    cross compiling.
-
-    This is mainly aimed to testing overrides from cross files.
-    """
-
-    def _cross_file_generator(self, *, needs_exe_wrapper: bool = False,
-                              exe_wrapper: T.Optional[T.List[str]] = None) -> str:
-        if is_windows():
-            raise unittest.SkipTest('Cannot run this test on non-mingw/non-cygwin windows')
-        if is_sunos():
-            cc = 'gcc'
-        else:
-            cc = 'cc'
-
-        return textwrap.dedent("""\
-            [binaries]
-            c = '/usr/bin/{}'
-            ar = '/usr/bin/ar'
-            strip = '/usr/bin/ar'
-            {}
-
-            [properties]
-            needs_exe_wrapper = {}
-
-            [host_machine]
-            system = 'linux'
-            cpu_family = 'x86'
-            cpu = 'i686'
-            endian = 'little'
-            """.format(cc,
-                       'exe_wrapper = {}'.format(str(exe_wrapper)) if exe_wrapper is not None else '',
-                       needs_exe_wrapper))
-
-    def _stub_exe_wrapper(self) -> str:
-        return textwrap.dedent('''\
-            #!/usr/bin/env python3
-            import subprocess
-            import sys
-
-            sys.exit(subprocess.run(sys.argv[1:]).returncode)
-            ''')
-
-    def test_needs_exe_wrapper_true(self):
-        testdir = os.path.join(self.unit_test_dir, '72 cross test passed')
-        with tempfile.TemporaryDirectory() as d:
-            p = Path(d) / 'crossfile'
-            with p.open('wt') as f:
-                f.write(self._cross_file_generator(needs_exe_wrapper=True))
-            self.init(testdir, extra_args=['--cross-file=' + str(p)])
-            out = self.run_target('test')
-            self.assertRegex(out, r'Skipped:\s*1\s*\n')
-
-    def test_needs_exe_wrapper_false(self):
-        testdir = os.path.join(self.unit_test_dir, '72 cross test passed')
-        with tempfile.TemporaryDirectory() as d:
-            p = Path(d) / 'crossfile'
-            with p.open('wt') as f:
-                f.write(self._cross_file_generator(needs_exe_wrapper=False))
-            self.init(testdir, extra_args=['--cross-file=' + str(p)])
-            out = self.run_target('test')
-            self.assertNotRegex(out, r'Skipped:\s*1\n')
-
-    def test_needs_exe_wrapper_true_wrapper(self):
-        testdir = os.path.join(self.unit_test_dir, '72 cross test passed')
-        with tempfile.TemporaryDirectory() as d:
-            s = Path(d) / 'wrapper.py'
-            with s.open('wt') as f:
-                f.write(self._stub_exe_wrapper())
-            s.chmod(0o774)
-            p = Path(d) / 'crossfile'
-            with p.open('wt') as f:
-                f.write(self._cross_file_generator(
-                    needs_exe_wrapper=True,
-                    exe_wrapper=[str(s)]))
-
-            self.init(testdir, extra_args=['--cross-file=' + str(p), '-Dexpect=true'])
-            out = self.run_target('test')
-            self.assertRegex(out, r'Ok:\s*3\s*\n')
-
-    def test_cross_exe_passed_no_wrapper(self):
-        testdir = os.path.join(self.unit_test_dir, '72 cross test passed')
-        with tempfile.TemporaryDirectory() as d:
-            p = Path(d) / 'crossfile'
-            with p.open('wt') as f:
-                f.write(self._cross_file_generator(needs_exe_wrapper=True))
-
-            self.init(testdir, extra_args=['--cross-file=' + str(p)])
-            self.build()
-            out = self.run_target('test')
-            self.assertRegex(out, r'Skipped:\s*1\s*\n')
-
-    # The test uses mocking and thus requires that the current process is the
-    # one to run the Meson steps. If we are using an external test executable
-    # (most commonly in Debian autopkgtests) then the mocking won't work.
-    @unittest.skipIf('MESON_EXE' in os.environ, 'MESON_EXE is defined, can not use mocking.')
-    def test_cross_file_system_paths(self):
-        if is_windows():
-            raise unittest.SkipTest('system crossfile paths not defined for Windows (yet)')
-
-        testdir = os.path.join(self.common_test_dir, '1 trivial')
-        cross_content = self._cross_file_generator()
-        with tempfile.TemporaryDirectory() as d:
-            dir_ = os.path.join(d, 'meson', 'cross')
-            os.makedirs(dir_)
-            with tempfile.NamedTemporaryFile('w', dir=dir_, delete=False) as f:
-                f.write(cross_content)
-            name = os.path.basename(f.name)
-
-            with mock.patch.dict(os.environ, {'XDG_DATA_HOME': d}):
-                self.init(testdir, extra_args=['--cross-file=' + name], inprocess=True)
-                self.wipe()
-
-            with mock.patch.dict(os.environ, {'XDG_DATA_DIRS': d}):
-                os.environ.pop('XDG_DATA_HOME', None)
-                self.init(testdir, extra_args=['--cross-file=' + name], inprocess=True)
-                self.wipe()
-
-        with tempfile.TemporaryDirectory() as d:
-            dir_ = os.path.join(d, '.local', 'share', 'meson', 'cross')
-            os.makedirs(dir_)
-            with tempfile.NamedTemporaryFile('w', dir=dir_, delete=False) as f:
-                f.write(cross_content)
-            name = os.path.basename(f.name)
-
-            # If XDG_DATA_HOME is set in the environment running the
-            # tests this test will fail, os mock the environment, pop
-            # it, then test
-            with mock.patch.dict(os.environ):
-                os.environ.pop('XDG_DATA_HOME', None)
-                with mock.patch('mesonbuild.coredata.os.path.expanduser', lambda x: x.replace('~', d)):
-                    self.init(testdir, extra_args=['--cross-file=' + name], inprocess=True)
-                    self.wipe()
-
-    def test_cross_file_dirs(self):
-        testcase = os.path.join(self.unit_test_dir, '60 native file override')
-        self.init(testcase, default_args=False,
-                  extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
-                              '--cross-file', os.path.join(testcase, 'crossfile'),
-                              '-Ddef_bindir=binbar',
-                              '-Ddef_datadir=databar',
-                              '-Ddef_includedir=includebar',
-                              '-Ddef_infodir=infobar',
-                              '-Ddef_libdir=libbar',
-                              '-Ddef_libexecdir=libexecbar',
-                              '-Ddef_localedir=localebar',
-                              '-Ddef_localstatedir=localstatebar',
-                              '-Ddef_mandir=manbar',
-                              '-Ddef_sbindir=sbinbar',
-                              '-Ddef_sharedstatedir=sharedstatebar',
-                              '-Ddef_sysconfdir=sysconfbar'])
-
-    def test_cross_file_dirs_overriden(self):
-        testcase = os.path.join(self.unit_test_dir, '60 native file override')
-        self.init(testcase, default_args=False,
-                  extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
-                              '--cross-file', os.path.join(testcase, 'crossfile'),
-                              '-Ddef_libdir=liblib', '-Dlibdir=liblib',
-                              '-Ddef_bindir=binbar',
-                              '-Ddef_datadir=databar',
-                              '-Ddef_includedir=includebar',
-                              '-Ddef_infodir=infobar',
-                              '-Ddef_libexecdir=libexecbar',
-                              '-Ddef_localedir=localebar',
-                              '-Ddef_localstatedir=localstatebar',
-                              '-Ddef_mandir=manbar',
-                              '-Ddef_sbindir=sbinbar',
-                              '-Ddef_sharedstatedir=sharedstatebar',
-                              '-Ddef_sysconfdir=sysconfbar'])
-
-    def test_cross_file_dirs_chain(self):
-        # crossfile2 overrides crossfile overrides nativefile
-        testcase = os.path.join(self.unit_test_dir, '60 native file override')
-        self.init(testcase, default_args=False,
-                  extra_args=['--native-file', os.path.join(testcase, 'nativefile'),
-                              '--cross-file', os.path.join(testcase, 'crossfile'),
-                              '--cross-file', os.path.join(testcase, 'crossfile2'),
-                              '-Ddef_bindir=binbar2',
-                              '-Ddef_datadir=databar',
-                              '-Ddef_includedir=includebar',
-                              '-Ddef_infodir=infobar',
-                              '-Ddef_libdir=libbar',
-                              '-Ddef_libexecdir=libexecbar',
-                              '-Ddef_localedir=localebar',
-                              '-Ddef_localstatedir=localstatebar',
-                              '-Ddef_mandir=manbar',
-                              '-Ddef_sbindir=sbinbar',
-                              '-Ddef_sharedstatedir=sharedstatebar',
-                              '-Ddef_sysconfdir=sysconfbar'])
-
-class TAPParserTests(unittest.TestCase):
-    def assert_test(self, events, **kwargs):
-        if 'explanation' not in kwargs:
-            kwargs['explanation'] = None
-        self.assertEqual(next(events), TAPParser.Test(**kwargs))
-
-    def assert_plan(self, events, **kwargs):
-        if 'skipped' not in kwargs:
-            kwargs['skipped'] = False
-        if 'explanation' not in kwargs:
-            kwargs['explanation'] = None
-        self.assertEqual(next(events), TAPParser.Plan(**kwargs))
-
-    def assert_version(self, events, **kwargs):
-        self.assertEqual(next(events), TAPParser.Version(**kwargs))
-
-    def assert_error(self, events):
-        self.assertEqual(type(next(events)), TAPParser.Error)
-
-    def assert_bailout(self, events, **kwargs):
-        self.assertEqual(next(events), TAPParser.Bailout(**kwargs))
-
-    def assert_last(self, events):
-        with self.assertRaises(StopIteration):
-            next(events)
-
-    def parse_tap(self, s):
-        parser = TAPParser(io.StringIO(s))
-        return iter(parser.parse())
-
-    def parse_tap_v13(self, s):
-        events = self.parse_tap('TAP version 13\n' + s)
-        self.assert_version(events, version=13)
-        return events
-
-    def test_empty(self):
-        events = self.parse_tap('')
-        self.assert_last(events)
-
-    def test_empty_plan(self):
-        events = self.parse_tap('1..0')
-        self.assert_plan(events, count=0, late=False, skipped=True)
-        self.assert_last(events)
-
-    def test_plan_directive(self):
-        events = self.parse_tap('1..0 # skipped for some reason')
-        self.assert_plan(events, count=0, late=False, skipped=True,
-                         explanation='for some reason')
-        self.assert_last(events)
-
-        events = self.parse_tap('1..1 # skipped for some reason\nok 1')
-        self.assert_error(events)
-        self.assert_plan(events, count=1, late=False, skipped=True,
-                         explanation='for some reason')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-        events = self.parse_tap('1..1 # todo not supported here\nok 1')
-        self.assert_error(events)
-        self.assert_plan(events, count=1, late=False, skipped=False,
-                         explanation='not supported here')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_one_test_ok(self):
-        events = self.parse_tap('ok')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_one_test_with_number(self):
-        events = self.parse_tap('ok 1')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_one_test_with_name(self):
-        events = self.parse_tap('ok 1 abc')
-        self.assert_test(events, number=1, name='abc', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_one_test_not_ok(self):
-        events = self.parse_tap('not ok')
-        self.assert_test(events, number=1, name='', result=TestResult.FAIL)
-        self.assert_last(events)
-
-    def test_one_test_todo(self):
-        events = self.parse_tap('not ok 1 abc # TODO')
-        self.assert_test(events, number=1, name='abc', result=TestResult.EXPECTEDFAIL)
-        self.assert_last(events)
-
-        events = self.parse_tap('ok 1 abc # TODO')
-        self.assert_test(events, number=1, name='abc', result=TestResult.UNEXPECTEDPASS)
-        self.assert_last(events)
-
-    def test_one_test_skip(self):
-        events = self.parse_tap('ok 1 abc # SKIP')
-        self.assert_test(events, number=1, name='abc', result=TestResult.SKIP)
-        self.assert_last(events)
-
-    def test_one_test_skip_failure(self):
-        events = self.parse_tap('not ok 1 abc # SKIP')
-        self.assert_test(events, number=1, name='abc', result=TestResult.FAIL)
-        self.assert_last(events)
-
-    def test_many_early_plan(self):
-        events = self.parse_tap('1..4\nok 1\nnot ok 2\nok 3\nnot ok 4')
-        self.assert_plan(events, count=4, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_test(events, number=3, name='', result=TestResult.OK)
-        self.assert_test(events, number=4, name='', result=TestResult.FAIL)
-        self.assert_last(events)
-
-    def test_many_late_plan(self):
-        events = self.parse_tap('ok 1\nnot ok 2\nok 3\nnot ok 4\n1..4')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_test(events, number=3, name='', result=TestResult.OK)
-        self.assert_test(events, number=4, name='', result=TestResult.FAIL)
-        self.assert_plan(events, count=4, late=True)
-        self.assert_last(events)
-
-    def test_directive_case(self):
-        events = self.parse_tap('ok 1 abc # skip')
-        self.assert_test(events, number=1, name='abc', result=TestResult.SKIP)
-        self.assert_last(events)
-
-        events = self.parse_tap('ok 1 abc # ToDo')
-        self.assert_test(events, number=1, name='abc', result=TestResult.UNEXPECTEDPASS)
-        self.assert_last(events)
-
-    def test_directive_explanation(self):
-        events = self.parse_tap('ok 1 abc # skip why')
-        self.assert_test(events, number=1, name='abc', result=TestResult.SKIP,
-                         explanation='why')
-        self.assert_last(events)
-
-        events = self.parse_tap('ok 1 abc # ToDo Because')
-        self.assert_test(events, number=1, name='abc', result=TestResult.UNEXPECTEDPASS,
-                         explanation='Because')
-        self.assert_last(events)
-
-    def test_one_test_early_plan(self):
-        events = self.parse_tap('1..1\nok')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_one_test_late_plan(self):
-        events = self.parse_tap('ok\n1..1')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_plan(events, count=1, late=True)
-        self.assert_last(events)
-
-    def test_out_of_order(self):
-        events = self.parse_tap('ok 2')
-        self.assert_error(events)
-        self.assert_test(events, number=2, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_middle_plan(self):
-        events = self.parse_tap('ok 1\n1..2\nok 2')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_plan(events, count=2, late=True)
-        self.assert_error(events)
-        self.assert_test(events, number=2, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_too_many_plans(self):
-        events = self.parse_tap('1..1\n1..2\nok 1')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_error(events)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_too_many(self):
-        events = self.parse_tap('ok 1\nnot ok 2\n1..1')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_plan(events, count=1, late=True)
-        self.assert_error(events)
-        self.assert_last(events)
-
-        events = self.parse_tap('1..1\nok 1\nnot ok 2')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_error(events)
-        self.assert_last(events)
-
-    def test_too_few(self):
-        events = self.parse_tap('ok 1\nnot ok 2\n1..3')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_plan(events, count=3, late=True)
-        self.assert_error(events)
-        self.assert_last(events)
-
-        events = self.parse_tap('1..3\nok 1\nnot ok 2')
-        self.assert_plan(events, count=3, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_error(events)
-        self.assert_last(events)
-
-    def test_too_few_bailout(self):
-        events = self.parse_tap('1..3\nok 1\nnot ok 2\nBail out! no third test')
-        self.assert_plan(events, count=3, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_bailout(events, message='no third test')
-        self.assert_last(events)
-
-    def test_diagnostics(self):
-        events = self.parse_tap('1..1\n# ignored\nok 1')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-        events = self.parse_tap('# ignored\n1..1\nok 1\n# ignored too')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-        events = self.parse_tap('# ignored\nok 1\n1..1\n# ignored too')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_plan(events, count=1, late=True)
-        self.assert_last(events)
-
-    def test_empty_line(self):
-        events = self.parse_tap('1..1\n\nok 1')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_unexpected(self):
-        events = self.parse_tap('1..1\ninvalid\nok 1')
-        self.assert_plan(events, count=1, late=False)
-        self.assert_error(events)
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-    def test_version(self):
-        events = self.parse_tap('TAP version 13\n')
-        self.assert_version(events, version=13)
-        self.assert_last(events)
-
-        events = self.parse_tap('TAP version 12\n')
-        self.assert_error(events)
-        self.assert_last(events)
-
-        events = self.parse_tap('1..0\nTAP version 13\n')
-        self.assert_plan(events, count=0, late=False, skipped=True)
-        self.assert_error(events)
-        self.assert_last(events)
-
-    def test_yaml(self):
-        events = self.parse_tap_v13('ok\n ---\n foo: abc\n  bar: def\n ...\nok 2')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_test(events, number=2, name='', result=TestResult.OK)
-        self.assert_last(events)
-
-        events = self.parse_tap_v13('ok\n ---\n foo: abc\n  bar: def')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_error(events)
-        self.assert_last(events)
-
-        events = self.parse_tap_v13('ok 1\n ---\n foo: abc\n  bar: def\nnot ok 2')
-        self.assert_test(events, number=1, name='', result=TestResult.OK)
-        self.assert_error(events)
-        self.assert_test(events, number=2, name='', result=TestResult.FAIL)
-        self.assert_last(events)
-
-
-def _clang_at_least(compiler, minver: str, apple_minver: str) -> bool:
-    """
-    check that Clang compiler is at least a specified version, whether AppleClang or regular Clang
-
-    Parameters
-    ----------
-    compiler:
-        Meson compiler object
-    minver: str
-        Clang minimum version
-    apple_minver: str
-        AppleCLang minimum version
-
-    Returns
-    -------
-    at_least: bool
-        Clang is at least the specified version
-    """
-    if isinstance(compiler, (mesonbuild.compilers.AppleClangCCompiler,
-                             mesonbuild.compilers.AppleClangCPPCompiler)):
-        return version_compare(compiler.version, apple_minver)
-    return version_compare(compiler.version, minver)
-
-
-def unset_envs():
-    # For unit tests we must fully control all command lines
-    # so that there are no unexpected changes coming from the
-    # environment, for example when doing a package build.
-    varnames = ['CPPFLAGS', 'LDFLAGS'] + list(mesonbuild.compilers.compilers.cflags_mapping.values())
-    for v in varnames:
-        if v in os.environ:
-            del os.environ[v]
-
-def convert_args(argv):
-    # If we got passed a list of tests, pass it on
-    pytest_args = ['-v'] if '-v' in argv else []
-    test_list = []
-    for arg in argv:
-        if arg.startswith('-'):
-            if arg in ('-f', '--failfast'):
-                arg = '--exitfirst'
-            pytest_args.append(arg)
-            continue
-        # ClassName.test_name => 'ClassName and test_name'
-        if '.' in arg:
-            arg = ' and '.join(arg.split('.'))
-        test_list.append(arg)
-    if test_list:
-        pytest_args += ['-k', ' or '.join(test_list)]
-    return pytest_args
-
-def main():
-    unset_envs()
-    try:
-        import pytest # noqa: F401
-        # Need pytest-xdist for `-n` arg
-        import xdist # noqa: F401
-        pytest_args = ['-n', 'auto', './run_unittests.py']
-        pytest_args += convert_args(sys.argv[1:])
-        return subprocess.run(python_command + ['-m', 'pytest'] + pytest_args).returncode
-    except ImportError:
-        print('pytest-xdist not found, using unittest instead')
-    # All attempts at locating pytest failed, fall back to plain unittest.
-    cases = ['InternalTests', 'DataTests', 'AllPlatformTests', 'FailureTests',
-             'PythonTests', 'NativeFileTests', 'RewriterTests', 'CrossFileTests',
-             'TAPParserTests',
-
-             'LinuxlikeTests', 'LinuxCrossArmTests', 'LinuxCrossMingwTests',
-             'WindowsTests', 'DarwinTests']
-
-    return unittest.main(defaultTest=cases, buffer=True)
-
-if __name__ == '__main__':
-    print('Meson build system', mesonbuild.coredata.version, 'Unit Tests')
-    raise SystemExit(main())
diff --git a/meson/setup.cfg b/meson/setup.cfg
deleted file mode 100644 (file)
index f3ed75e..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-[metadata]
-description = A high performance build system
-author = Jussi Pakkanen
-author_email = jpakkane@gmail.com
-url = https://mesonbuild.com
-keywords =
-  meson
-  mesonbuild
-  build system
-  cmake
-license = Apache License, Version 2.0
-license_file = COPYING
-classifiers =
-  Development Status :: 5 - Production/Stable
-  Environment :: Console
-  Intended Audience :: Developers
-  License :: OSI Approved :: Apache Software License
-  Natural Language :: English
-  Operating System :: MacOS :: MacOS X
-  Operating System :: Microsoft :: Windows
-  Operating System :: POSIX :: BSD
-  Operating System :: POSIX :: Linux
-  Programming Language :: Python :: 3 :: Only
-  Programming Language :: Python :: 3.5
-  Programming Language :: Python :: 3.6
-  Programming Language :: Python :: 3.7
-  Programming Language :: Python :: 3.8
-  Topic :: Software Development :: Build Tools
-long_description = Meson is a cross-platform build system designed to be both as fast and as user friendly as possible. It supports many languages and compilers, including GCC, Clang, PGI, Intel, and Visual Studio. Its build definitions are written in a simple non-Turing complete DSL.
-
-[options]
-python_requires = >= 3.5.2
-setup_requires =
-  setuptools
-
-[options.extras_require]
-progress =
-  tqdm
-
-[tool:pytest]
-python_classes =
diff --git a/meson/setup.py b/meson/setup.py
deleted file mode 100644 (file)
index 145f19c..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2016 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-
-if sys.version_info < (3, 5, 2):
-    raise SystemExit('ERROR: Tried to install Meson with an unsupported Python version: \n{}'
-                     '\nMeson requires Python 3.5.2 or greater'.format(sys.version))
-
-from mesonbuild.coredata import version
-from setuptools import setup
-
-# On windows, will create Scripts/meson.exe and Scripts/meson-script.py
-# Other platforms will create bin/meson
-entries = {'console_scripts': ['meson=mesonbuild.mesonmain:main']}
-packages = ['mesonbuild',
-            'mesonbuild.ast',
-            'mesonbuild.backend',
-            'mesonbuild.cmake',
-            'mesonbuild.compilers',
-            'mesonbuild.compilers.mixins',
-            'mesonbuild.dependencies',
-            'mesonbuild.modules',
-            'mesonbuild.scripts',
-            'mesonbuild.templates',
-            'mesonbuild.wrap']
-data_files = []
-if sys.platform != 'win32':
-    # Only useful on UNIX-like systems
-    data_files = [('share/man/man1', ['man/meson.1']),
-                  ('share/polkit-1/actions', ['data/com.mesonbuild.install.policy'])]
-
-if __name__ == '__main__':
-    setup(name='meson',
-          version=version,
-          packages=packages,
-          entry_points=entries,
-          data_files=data_files,)
diff --git a/meson/sider.yml b/meson/sider.yml
deleted file mode 100644 (file)
index 5c56196..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-linter:
-  flake8:
-    version: 3
-    plugins:
-      - flake8-blind-except
-      - flake8-builtins
-      - flake8-bugbear
diff --git a/meson/skip_ci.py b/meson/skip_ci.py
deleted file mode 100755 (executable)
index 5e0a7aa..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-#!/usr/bin/env python3
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-from __future__ import print_function
-
-import argparse
-import os
-import subprocess
-import sys
-import traceback
-
-
-def check_pr(is_pr_env):
-    if is_pr_env not in os.environ:
-        print('This is not pull request: {} is not set'.format(is_pr_env))
-        sys.exit()
-    elif os.environ[is_pr_env] == 'false':
-        print('This is not pull request: {} is false'.format(is_pr_env))
-        sys.exit()
-
-
-def get_base_branch(base_env):
-    if base_env not in os.environ:
-        print('Unable to determine base branch: {} is not set'.format(base_env))
-        sys.exit()
-    return os.environ[base_env]
-
-
-def get_git_files(base):
-    diff = subprocess.check_output(['git', 'diff', '--name-only', base + '...HEAD'])
-    return diff.strip().split(b'\n')
-
-
-def is_documentation(filename):
-    return filename.startswith(b'docs/')
-
-
-def main():
-    try:
-        parser = argparse.ArgumentParser(description='CI Skipper')
-        parser.add_argument('--base-branch-env', required=True,
-                            help='Branch push is targeted to')
-        parser.add_argument('--is-pull-env', required=True,
-                            help='Variable set if it is a PR')
-        parser.add_argument('--base-branch-origin', action='store_true',
-                            help='Base branch reference is only in origin remote')
-        args = parser.parse_args()
-        check_pr(args.is_pull_env)
-        base = get_base_branch(args.base_branch_env)
-        if args.base_branch_origin:
-            base = 'origin/' + base
-        if all(is_documentation(f) for f in get_git_files(base)):
-            print("Don't run CI for documentation-only changes, add '[skip ci]' to commit title.")
-            print('See http://mesonbuild.com/Contributing.html#skipping-integration-tests')
-            sys.exit(1)
-    except Exception:
-        # If this script fails we want build to proceed.
-        # Failure likely means some corner case we did not consider or bug.
-        # Either case this should not prevent CI from running if it is needed,
-        # and we tolerate it if it is run where it is not required.
-        traceback.print_exc()
-        print('There is a BUG in skip_ci.py, exiting.')
-        sys.exit()
-
-if __name__ == '__main__':
-    main()
diff --git a/meson/tools/ac_converter.py b/meson/tools/ac_converter.py
deleted file mode 100755 (executable)
index 075eae6..0000000
+++ /dev/null
@@ -1,453 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2015 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-help_message = """Usage: {} <config.h.meson>
-
-This script reads config.h.meson, looks for header
-checks and writes the corresponding meson declaration.
-
-Copy config.h.in to config.h.meson, replace #undef
-with #mesondefine and run this. We can't do this automatically
-because some configure scripts have #undef statements
-that are unrelated to configure checks.
-"""
-
-import sys
-
-
-# Add stuff here as it is encountered.
-function_data = \
-    {'HAVE_FEENABLEEXCEPT': ('feenableexcept', 'fenv.h'),
-     'HAVE_FECLEAREXCEPT': ('feclearexcept', 'fenv.h'),
-     'HAVE_FEDISABLEEXCEPT': ('fedisableexcept', 'fenv.h'),
-     'HAVE_MMAP': ('mmap', 'sys/mman.h'),
-     'HAVE_GETPAGESIZE': ('getpagesize', 'unistd.h'),
-     'HAVE_GETISAX': ('getisax', 'sys/auxv.h'),
-     'HAVE_GETTIMEOFDAY': ('gettimeofday', 'sys/time.h'),
-     'HAVE_MPROTECT': ('mprotect', 'sys/mman.h'),
-     'HAVE_POSIX_MEMALIGN': ('posix_memalign', 'stdlib.h'),
-     'HAVE_SIGACTION': ('sigaction', 'signal.h'),
-     'HAVE_ALARM': ('alarm', 'unistd.h'),
-     'HAVE_CTIME_R': ('ctime_r', 'time.h'),
-     'HAVE_DRAND48': ('drand48', 'stdlib.h'),
-     'HAVE_FLOCKFILE': ('flockfile', 'stdio.h'),
-     'HAVE_FORK': ('fork', 'unistd.h'),
-     'HAVE_FUNLOCKFILE': ('funlockfile', 'stdio.h'),
-     'HAVE_GETLINE': ('getline', 'stdio.h'),
-     'HAVE_LINK': ('link', 'unistd.h'),
-     'HAVE_RAISE': ('raise', 'signal.h'),
-     'HAVE_STRNDUP': ('strndup', 'string.h'),
-     'HAVE_SCHED_GETAFFINITY': ('sched_getaffinity', 'sched.h'),
-     'HAVE_WAITPID': ('waitpid', 'sys/wait.h'),
-     'HAVE_XRENDERCREATECONICALGRADIENT': ('XRenderCreateConicalGradient', 'xcb/render.h'),
-     'HAVE_XRENDERCREATELINEARGRADIENT': ('XRenderCreateLinearGradient', 'xcb/render.h'),
-     'HAVE_XRENDERCREATERADIALGRADIENT': ('XRenderCreateRadialGradient', 'xcb/render.h'),
-     'HAVE_XRENDERCREATESOLIDFILL': ('XRenderCreateSolidFill', 'xcb/render.h'),
-     'HAVE_DCGETTEXT': ('dcgettext', 'libintl.h'),
-     'HAVE_ENDMNTENT': ('endmntent', 'mntent.h'),
-     'HAVE_ENDSERVENT': ('endservent', 'netdb.h'),
-     'HAVE_EVENTFD': ('eventfd', 'sys/eventfd.h'),
-     'HAVE_FALLOCATE': ('fallocate', 'fcntl.h'),
-     'HAVE_FCHMOD': ('fchmod', 'sys/stat.h'),
-     'HAVE_FCHOWN': ('fchown', 'unistd.h'),
-     'HAVE_FDWALK': ('fdwalk', 'stdlib.h'),
-     'HAVE_FSYNC': ('fsync', 'unistd.h'),
-     'HAVE_GETC_UNLOCKED': ('getc_unlocked', 'stdio.h'),
-     'HAVE_GETFSSTAT': ('getfsstat', 'sys/mount.h'),
-     'HAVE_GETMNTENT_R': ('getmntent_r', 'mntent.h'),
-     'HAVE_GETPROTOBYNAME_R': ('getprotobyname_r', 'netdb.h'),
-     'HAVE_GETRESUID': ('getresuid', 'unistd.h'),
-     'HAVE_GETVFSSTAT': ('getvfsstat', 'sys/statvfs.h'),
-     'HAVE_GMTIME_R': ('gmtime_r', 'time.h'),
-     'HAVE_HASMNTOPT': ('hasmntopt', 'mntent.h'),
-     'HAVE_IF_INDEXTONAME': ('if_indextoname', 'net/if.h'),
-     'HAVE_IF_NAMETOINDEX': ('if_nametoindex', 'net/if.h'),
-     'HAVE_INOTIFY_INIT1': ('inotify_init1', 'sys/inotify.h'),
-     'HAVE_ISSETUGID': ('issetugid', 'unistd.h'),
-     'HAVE_KEVENT': ('kevent', 'sys/event.h'),
-     'HAVE_KQUEUE': ('kqueue', 'sys/event.h'),
-     'HAVE_LCHMOD': ('lchmod', 'sys/stat.h'),
-     'HAVE_LCHOWN': ('lchown', 'unistd.h'),
-     'HAVE_LSTAT': ('lstat', 'sys/stat.h'),
-     'HAVE_MEMCPY': ('memcpy', 'string.h'),
-     'HAVE_MEMALIGN': ('memalign', 'stdlib.h'),
-     'HAVE_MEMMEM': ('memmem', 'string.h'),
-     'HAVE_NEWLOCALE': ('newlocale', 'locale.h'),
-     'HAVE_PIPE2': ('pipe2', 'fcntl.h'),
-     'HAVE_POLL': ('poll', 'poll.h'),
-     'HAVE_PRLIMIT': ('prlimit', 'sys/resource.h'),
-     'HAVE_PTHREAD_ATTR_SETSTACKSIZE': ('pthread_attr_setstacksize', 'pthread.h'),
-     'HAVE_PTHREAD_CONDATTR_SETCLOCK': ('pthread_condattr_setclock', 'pthread.h'),
-     'HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE_NP': ('pthread_cond_timedwait_relative_np', 'pthread.h'),
-     'HAVE_READLINK': ('readlink', 'unistd.h'),
-     'HAVE_RES_INIT': ('res_init', 'resolv.h'),
-     'HAVE_SENDMMSG': ('sendmmsg', 'sys/socket.h'),
-     'HAVE_SOCKET': ('socket', 'sys/socket.h'),
-     'HAVE_GETENV': ('getenv', 'stdlib.h'),
-     'HAVE_SETENV': ('setenv', 'stdlib.h'),
-     'HAVE_PUTENV': ('putenv', 'stdlib.h'),
-     'HAVE_UNSETENV': ('unsetenv', 'stdlib.h'),
-     'HAVE_SETMNTENT': ('setmntent', 'mntent.h'),
-     'HAVE_SNPRINTF': ('snprintf', 'stdio.h'),
-     'HAVE_SPLICE': ('splice', 'fcntl.h'),
-     'HAVE_STATFS': ('statfs', 'mount.h'),
-     'HAVE_STATVFS': ('statvfs', 'sys/statvfs.h'),
-     'HAVE_STPCOPY': ('stpcopy', 'string.h'),
-     'HAVE_STRCASECMP': ('strcasecmp', 'strings.h'),
-     'HAVE_STRLCPY': ('strlcpy', 'string.h'),
-     'HAVE_STRNCASECMP': ('strncasecmp', 'strings.h'),
-     'HAVE_STRSIGNAL': ('strsignal', 'signal.h'),
-     'HAVE_STRTOD_L': ('strtod_l', 'stdlib.h'),
-     'HAVE_STRTOLL_L': ('strtoll_l', 'stdlib.h'),
-     'HAVE_STRTOULL_L': ('strtoull_l', 'stdlib.h'),
-     'HAVE_SYMLINK': ('symlink', 'unistd.h'),
-     'HAVE_SYSCTLBYNAME': ('sysctlbyname', 'sys/sysctl.h'),
-     'HAVE_TIMEGM': ('timegm', 'time.h'),
-     'HAVE_USELOCALE': ('uselocale', 'xlocale.h'),
-     'HAVE_UTIMES': ('utimes', 'sys/time.h'),
-     'HAVE_VALLOC': ('valloc', 'stdlib.h'),
-     'HAVE_VASPRINTF': ('vasprintf', 'stdio.h'),
-     'HAVE_VSNPRINTF': ('vsnprintf', 'stdio.h'),
-     'HAVE_BCOPY': ('bcopy', 'strings.h'),
-     'HAVE_STRERROR': ('strerror', 'string.h'),
-     'HAVE_MEMMOVE': ('memmove', 'string.h'),
-     'HAVE_STRTOIMAX': ('strtoimax', 'inttypes.h'),
-     'HAVE_STRTOLL': ('strtoll', 'stdlib.h'),
-     'HAVE_STRTOQ': ('strtoq', 'stdlib.h'),
-     'HAVE_ACCEPT4': ('accept4', 'sys/socket.h'),
-     'HAVE_CHMOD': ('chmod', 'sys/stat.h'),
-     'HAVE_CHOWN': ('chown', 'unistd.h'),
-     'HAVE_FSTAT': ('fstat', 'sys/stat.h'),
-     'HAVE_GETADDRINFO': ('getaddrinfo', 'netdb.h'),
-     'HAVE_GETGRGID_R': ('getgrgid_r', 'grp.h'),
-     'HAVE_GETGRNAM_R': ('getgrnam_r', 'grp.h'),
-     'HAVE_GETGROUPS': ('getgroups', 'grp.h'),
-     'HAVE_GETOPT_LONG': ('getopt_long', 'getopt.h'),
-     'HAVE_GETPWNAM_R': ('getpwnam', 'pwd.h'),
-     'HAVE_GETPWUID_R': ('getpwuid_r', 'pwd.h'),
-     'HAVE_GETUID': ('getuid', 'unistd.h'),
-     'HAVE_LRINTF': ('lrintf', 'math.h'),
-     'HAVE_DECL_ISNAN': ('isnan', 'math.h'),
-     'HAVE_DECL_ISINF': ('isinf', 'math.h'),
-     'HAVE_ROUND': ('round', 'math.h'),
-     'HAVE_NEARBYINT': ('nearbyint', 'math.h'),
-     'HAVE_RINT': ('rint', 'math.h'),
-     'HAVE_MKFIFO': ('mkfifo', 'sys/stat.h'),
-     'HAVE_MLOCK': ('mlock', 'sys/mman.h'),
-     'HAVE_NANOSLEEP': ('nanosleep', 'time.h'),
-     'HAVE_PIPE': ('pipe', 'unistd.h'),
-     'HAVE_PPOLL': ('ppoll', 'poll.h'),
-     'HAVE_REGEXEC': ('regexec', 'regex.h'),
-     'HAVE_SETEGID': ('setegid', 'unistd.h'),
-     'HAVE_SETEUID': ('seteuid', 'unistd.h'),
-     'HAVE_SETPGID': ('setpgid', 'unistd.h'),
-     'HAVE_SETREGID': ('setregid', 'unistd.h'),
-     'HAVE_SETRESGID': ('setresgid', 'unistd.h'),
-     'HAVE_SETRESUID': ('setresuid', 'unistd.h'),
-     'HAVE_SHM_OPEN': ('shm_open', 'fcntl.h'),
-     'HAVE_SLEEP': ('sleep', 'unistd.h'),
-     'HAVE_STRERROR_R': ('strerror_r', 'string.h'),
-     'HAVE_STRTOF': ('strtof', 'stdlib.h'),
-     'HAVE_SYSCONF': ('sysconf', 'unistd.h'),
-     'HAVE_USLEEP': ('usleep', 'unistd.h'),
-     'HAVE_VFORK': ('vfork', 'unistd.h'),
-     'HAVE_MALLOC': ('malloc', 'stdlib.h'),
-     'HAVE_CALLOC': ('calloc', 'stdlib.h'),
-     'HAVE_REALLOC': ('realloc', 'stdlib.h'),
-     'HAVE_FREE': ('free', 'stdlib.h'),
-     'HAVE_ALLOCA': ('alloca', 'alloca.h'),
-     'HAVE_QSORT': ('qsort', 'stdlib.h'),
-     'HAVE_ABS': ('abs', 'stdlib.h'),
-     'HAVE_MEMSET': ('memset', 'string.h'),
-     'HAVE_MEMCMP': ('memcmp', 'string.h'),
-     'HAVE_STRLEN': ('strlen', 'string.h'),
-     'HAVE_STRLCAT': ('strlcat', 'string.h'),
-     'HAVE_STRDUP': ('strdup', 'string.h'),
-     'HAVE__STRREV': ('_strrev', 'string.h'),
-     'HAVE__STRUPR': ('_strupr', 'string.h'),
-     'HAVE__STRLWR': ('_strlwr', 'string.h'),
-     'HAVE_INDEX': ('index', 'strings.h'),
-     'HAVE_RINDEX': ('rindex', 'strings.h'),
-     'HAVE_STRCHR': ('strchr', 'string.h'),
-     'HAVE_STRRCHR': ('strrchr', 'string.h'),
-     'HAVE_STRSTR': ('strstr', 'string.h'),
-     'HAVE_STRTOL': ('strtol', 'stdlib.h'),
-     'HAVE_STRTOUL': ('strtoul', 'stdlib.h'),
-     'HAVE_STRTOULL': ('strtoull', 'stdlib.h'),
-     'HAVE_STRTOD': ('strtod', 'stdlib.h'),
-     'HAVE_ATOI': ('atoi', 'stdlib.h'),
-     'HAVE_ATOF': ('atof', 'stdlib.h'),
-     'HAVE_STRCMP': ('strcmp', 'string.h'),
-     'HAVE_STRNCMP': ('strncmp', 'string.h'),
-     'HAVE_VSSCANF': ('vsscanf', 'stdio.h'),
-     'HAVE_CHROOT': ('chroot', 'unistd.h'),
-     'HAVE_CLOCK': ('clock', 'time.h'),
-     'HAVE_CLOCK_GETRES': ('clock_getres', 'time.h'),
-     'HAVE_CLOCK_GETTIME': ('clock_gettime', 'time.h'),
-     'HAVE_CLOCK_SETTIME': ('clock_settime', 'time.h'),
-     'HAVE_CONFSTR': ('confstr', 'time.h'),
-     'HAVE_CTERMID': ('ctermid', 'stdio.h'),
-     'HAVE_DIRFD': ('dirfd', 'dirent.h'),
-     'HAVE_DLOPEN': ('dlopen', 'dlfcn.h'),
-     'HAVE_DUP2': ('dup2', 'unistd.h'),
-     'HAVE_DUP3': ('dup3', 'unistd.h'),
-     'HAVE_EPOLL_CREATE1': ('epoll_create1', 'sys/epoll.h'),
-     'HAVE_ERF': ('erf', 'math.h'),
-     'HAVE_ERFC': ('erfc', 'math.h'),
-     'HAVE_EXECV': ('execv', 'unistd.h'),
-     'HAVE_FACCESSAT': ('faccessat', 'unistd.h'),
-     'HAVE_FCHDIR': ('fchdir', 'unistd.h'),
-     'HAVE_FCHMODAT': ('fchmodat', 'sys/stat.h'),
-     'HAVE_FDATASYNC': ('fdatasync', 'unistd.h'),
-     'HAVE_FDOPENDIR': ('fdopendir', 'dirent.h'),
-     'HAVE_FEXECVE': ('fexecve', 'unistd.h'),
-     'HAVE_FLOCK': ('flock', 'sys/file.h'),
-     'HAVE_FORKPTY': ('forkpty', 'pty.h'),
-     'HAVE_FPATHCONF': ('fpathconf', 'unistd.h'),
-     'HAVE_FSTATAT': ('fstatat', 'unistd.h'),
-     'HAVE_FSTATVFS': ('fstatvfs', 'sys/statvfs.h'),
-     'HAVE_FTELLO': ('ftello', 'stdio.h'),
-     'HAVE_FTIME': ('ftime', 'sys/timeb.h'),
-     'HAVE_FTRUNCATE': ('ftruncate', 'unistd.h'),
-     'HAVE_FUTIMENS': ('futimens', 'sys/stat.h'),
-     'HAVE_FUTIMES': ('futimes', 'sys/time.h'),
-     'HAVE_GAI_STRERROR': ('gai_strerror', 'netdb.h'),
-     'HAVE_GETGROUPLIST': ('getgrouplist', 'grp.h'),
-     'HAVE_GETHOSTBYNAME': ('gethostbyname', 'netdb.h'),
-     'HAVE_GETHOSTBYNAME_R': ('gethostbyname_r', 'netdb.h'),
-     'HAVE_GETITIMER': ('getitimer', 'sys/time.h'),
-     'HAVE_GETLOADAVG': ('getloadavg', 'stdlib.h'),
-     'HAVE_GETLOGIN': ('getlogin', 'unistd.h'),
-     'HAVE_GETNAMEINFO': ('getnameinfo', 'netdb.h'),
-     'HAVE_GETPEERNAME': ('getpeername', 'sys/socket.h'),
-     'HAVE_GETPGID': ('getpgid', 'unistd.h'),
-     'HAVE_GETPGRP': ('getpgrp', 'unistd.h'),
-     'HAVE_GETPID': ('getpid', 'unistd.h'),
-     'HAVE_GETPRIORITY': ('getpriority', 'sys/resource.h'),
-     'HAVE_GETPWENT': ('getpwent', 'pwd.h'),
-     'HAVE_GETRANDOM': ('getrandom', 'linux/random.h'),
-     'HAVE_GETRESGID': ('getresgid', 'unistd.h'),
-     'HAVE_GETSID': ('getsid', 'unistd.h'),
-     'HAVE_GETSPENT': ('getspent', 'shadow.h'),
-     'HAVE_GETSPNAM': ('getspnam', 'shadow.h'),
-     'HAVE_GETWD': ('getwd', 'unistd.h'),
-     'HAVE_HSTRERROR': ('hstrerror', 'netdb.h'),
-     'HAVE_HTOLE64': ('htole64', 'endian.h'),
-     'HAVE_IF_NAMEINDEX': ('if_nameindex', 'net/if.h'),
-     'HAVE_INET_ATON': ('inet_aton', 'arpa/inet.h'),
-     'HAVE_INET_PTON': ('inet_pton', 'arpa/inet.h'),
-     'HAVE_INITGROUPS': ('initgroups', 'grp.h'),
-     'HAVE_KILL': ('kill', 'signal.h'),
-     'HAVE_KILLPG': ('killpg', 'signal.h'),
-     'HAVE_LINKAT': ('linkat', 'unistd.h'),
-     'HAVE_LOCKF': ('lockf', 'unistd.h'),
-     'HAVE_LUTIMES': ('lutimes', 'sys/time.h'),
-     'HAVE_MAKEDEV': ('makedev', 'sys/sysmacros.h'),
-     'HAVE_MBRTOWC': ('mbrtowc', 'wchar.h'),
-     'HAVE_MEMRCHR': ('memrchr', 'string.h'),
-     'HAVE_MKDIRAT': ('mkdirat', 'sys/stat.h'),
-     'HAVE_MKFIFOAT': ('mkfifoat', 'sys/stat.h'),
-     'HAVE_MKNOD': ('mknod', 'unistd.h'),
-     'HAVE_MKNODAT': ('mknodat', 'unistd.h'),
-     'HAVE_MKTIME': ('mktime', 'unistd.h'),
-     'HAVE_MKREMAP': ('mkremap', 'sys/mman.h'),
-     'HAVE_NICE': ('nice', 'unistd.h'),
-     'HAVE_OPENAT': ('openat', 'fcntl.h'),
-     'HAVE_OPENPTY': ('openpty', 'pty.h'),
-     'HAVE_PATHCONF': ('pathconf', 'unistd.h'),
-     'HAVE_PAUSE': ('pause', 'unistd.h'),
-     'HAVE_PREAD': ('pread', 'unistd.h'),
-     'HAVE_PTHREAD_KILL': ('pthread_kill', 'signal.h'),
-     'HAVE_PTHREAD_SIGMASK': ('pthread_sigmask', 'signal.h'),
-     'HAVE_PWRITE': ('pwrite', 'unistd.h'),
-     'HAVE_READLINKAT': ('readlinkat', 'unistd.h'),
-     'HAVE_READV': ('readv', 'sys/uio.h'),
-     'HAVE_RENAMEAT': ('renamat', 'stdio.h'),
-     'HAVE_SCHED_GET_PRIORITY_MAX': ('sched_get_priority_max', 'sched.h'),
-     'HAVE_SCHED_RR_GET_INTERVAL': ('sched_rr_get_interval', 'sched.h'),
-     'HAVE_SCHED_SETAFFINITY': ('sched_setaffinity', 'sched.h'),
-     'HAVE_SCHED_SETPARAM': ('sched_setparam', 'sched.h'),
-     'HAVE_SCHED_SETSCHEDULER': ('sched_setscheduler', 'sched.h'),
-     'HAVE_SELECT': ('select', 'sys/select.h'),
-     'HAVE_SEM_GETVALUE': ('sem_getvalue', 'semaphore.h'),
-     'HAVE_SEM_OPEN': ('sem_open', 'semaphore.h'),
-     'HAVE_SEM_TIMEDWAIT': ('sem_timedwait', 'semaphore.h'),
-     'HAVE_SEM_UNLINK': ('sem_unlink', 'semaphore.h'),
-     'HAVE_SENDFILE': ('sendfile', 'sys/sendfile.h'),
-     'HAVE_SETGID': ('setgid', 'unistd.h'),
-     'HAVE_SETGROUPS': ('setgroups', 'grp.h'),
-     'HAVE_SETHOSTNAME': ('sethostname', 'unistd.h'),
-     'HAVE_SETITIMER': ('setitimer', 'sys/time.h'),
-     'HAVE_SETLOCALE': ('setlocale', 'locale.h'),
-     'HAVE_SETPGRP': ('setpgrp', 'unistd.h'),
-     'HAVE_SETPRIORITY': ('setpriority', 'sys/resource.h'),
-     'HAVE_SETREUID': ('setreuid', 'unistd.h'),
-     'HAVE_SETSID': ('setsid', 'unistd.h'),
-     'HAVE_SETUID': ('setuid', 'unistd.h'),
-     'HAVE_SETVBUF': ('setvbuf', 'unistd.h'),
-     'HAVE_SIGALTSTACK': ('sigaltstack', 'signal.h'),
-     'HAVE_SIGINTERRUPT': ('siginterrupt', 'signal.h'),
-     'HAVE_SIGPENDING': ('sigpending', 'signal.h'),
-     'HAVE_SIGRELSE': ('sigrelse', 'signal.h'),
-     'HAVE_SIGTIMEDWAIT': ('sigtimedwait', 'signal.h'),
-     'HAVE_SIGWAIT': ('sigwait', 'signal.h'),
-     'HAVE_SIGWAITINFO': ('sigwaitinfo', 'signal.h'),
-     'HAVE_SOCKETPAIR': ('socketpair', 'sys/socket.h'),
-     'HAVE_STRFTIME': ('strftime', 'time.h'),
-     'HAVE_SYMLINKAT': ('symlinkat', 'unistd.h'),
-     'HAVE_SYNC': ('sync', 'unistd.h'),
-     'HAVE_TCGETPGRP': ('tcgetpgrp', 'unistd.h'),
-     'HAVE_TCSETPGRP': ('tcsetpgrp', 'unistd.h'),
-     'HAVE_TEMPNAM': ('tempnam', 'stdio.h'),
-     'HAVE_TIMES': ('times', 'sys/times.h'),
-     'HAVE_TEMPFILE': ('tempfile', 'stdio.h'),
-     'HAVE_TMPNAM': ('tmpnam', 'stdio.h'),
-     'HAVE_TMPNAM_R': ('tmpnam_r', 'stdio.h'),
-     'HAVE_TRUNCATE': ('truncate', 'unistd.h'),
-     'HAVE_TZNAME': ('tzname', 'time.h'),
-     'HAVE_UNAME': ('uname', 'sys/utsname.h'),
-     'HAVE_UNLINKAT': ('unlinkat', 'unistd.h'),
-     'HAVE_UTIMENSAT': ('utimensat', 'sys/stat.h'),
-     'HAVE_WAIT3': ('wait3', 'sys/wait.h'),
-     'HAVE_WAIT4': ('wait4', 'sys/wait.h'),
-     'HAVE_WAITID': ('waitid', 'sys/wait.h'),
-     'HAVE_WRITEV': ('writev', 'sys/uio.h'),
-     'HAVE_WMEMCMP': ('wmemcmp', 'wchar.h'),
-     'HAVE_ATAN': ('atan', 'math.h'),
-     'HAVE_ATAN2': ('atan2', 'math.h'),
-     'HAVE_ACOS': ('acos', 'math.h'),
-     'HAVE_ACOSH': ('acosh', 'math.h'),
-     'HAVE_ASIN': ('asin', 'math.h'),
-     'HAVE_ASINH': ('asinh', 'math.h'),
-     'HAVE_ATANH': ('atanh', 'math.h'),
-     'HAVE_CEIL': ('ceil', 'math.h'),
-     'HAVE_COPYSIGN': ('copysign', 'math.h'),
-     'HAVE_COS': ('cos', 'math.h'),
-     'HAVE_COSH': ('cosh', 'math.h'),
-     'HAVE_COSF': ('cosf', 'math.h'),
-     'HAVE_EXPM1': ('expm1', 'math.h'),
-     'HAVE_FABS': ('fabs', 'math.h'),
-     'HAVE_FINITE': ('finite', 'math.h'),
-     'HAVE_FLOOR': ('floor', 'math.h'),
-     'HAVE_GAMMA': ('gamma', 'math.h'),
-     'HAVE_HYPOT': ('hypot', 'math.h'),
-     'HAVE_ISINF': ('isinf', 'math.h'),
-     'HAVE_LOG': ('log', 'math.h'),
-     'HAVE_LOG1P': ('log1p', 'math.h'),
-     'HAVE_LOG2': ('log2', 'math.h'),
-     'HAVE_LGAMMA': ('lgamma', 'math.h'),
-     'HAVE_POW': ('pow', 'math.h'),
-     'HAVE_SCALBN': ('scalbn', 'math.h'),
-     'HAVE_SIN': ('sin', 'math.h'),
-     'HAVE_SINF': ('sinf', 'math.h'),
-     'HAVE_SINH': ('sinh', 'math.h'),
-     'HAVE_SQRT': ('sqrt', 'math.h'),
-     'HAVE_TGAMMA': ('tgamma', 'math.h'),
-     'HAVE_FSEEKO': ('fseeko', 'stdio.h'),
-     'HAVE_FSEEKO64': ('fseeko64', 'stdio.h'),
-     'HAVE_SETJMP': ('setjmp', 'setjmp.h'),
-     'HAVE_PTHREAD_SETNAME_NP': ('pthread_setname_np', 'pthread.h'),
-     'HAVE_PTHREAD_SET_NAME_NP': ('pthread_set_name_np', 'pthread.h'),
-     }
-
-headers = []
-functions = []
-sizes = []
-
-if len(sys.argv) != 2:
-    print(help_message.format(sys.argv[0]))
-    sys.exit(0)
-
-with open(sys.argv[1]) as f:
-    for line in f:
-        line = line.strip()
-        arr = line.split()
-
-        # Check for headers.
-        if line.startswith('#mesondefine') and line.endswith('_H'):
-            token = line.split()[1]
-            tarr = token.split('_')[1:-1]
-            tarr = [x.lower() for x in tarr]
-            hname = '/'.join(tarr) + '.h'
-            headers.append((token, hname))
-
-        # Check for functions.
-        try:
-            token = arr[1]
-            if token in function_data:
-                fdata = function_data[token]
-                functions.append([token, fdata[0], fdata[1]])
-            elif token.startswith('HAVE_') and not token.endswith('_H'):
-                functions.append([token])
-        except Exception:
-            pass
-
-        # Check for sizeof tests.
-        if len(arr) != 2:
-            continue
-        elem = arr[1]
-        if elem.startswith('SIZEOF_'):
-            typename = elem.split('_', 1)[1] \
-                .replace('_P', '*') \
-                .replace('_', ' ') \
-                .lower() \
-                .replace('size t', 'size_t')
-            sizes.append((elem, typename))
-
-print('''cc = meson.get_compiler('c')
-cdata = configuration_data()''')
-
-# Convert header checks.
-
-print('check_headers = [')
-for token, hname in headers:
-    print("  ['{}', '{}'],".format(token, hname))
-print(']\n')
-
-print('''foreach h : check_headers
-  if cc.has_header(h.get(1))
-    cdata.set(h.get(0), 1)
-  endif
-endforeach
-''')
-
-# Convert function checks.
-
-print('check_functions = [')
-for tok in functions:
-    if len(tok) == 3:
-        tokstr, fdata0, fdata1 = tok
-        print("  ['{}', '{}', '#include<{}>'],".format(tokstr, fdata0, fdata1))
-    else:
-        print('# check token', tok)
-print(']\n')
-
-print('''foreach f : check_functions
-  if cc.has_function(f.get(1), prefix : f.get(2))
-    cdata.set(f.get(0), 1)
-  endif
-endforeach
-''')
-
-# Convert sizeof checks.
-
-for elem, typename in sizes:
-    print("cdata.set('{}', cc.sizeof('{}'))".format(elem, typename))
-
-print('''
-configure_file(input : 'config.h.meson',
-  output : 'config.h',
-  configuration : cdata)''')
diff --git a/meson/tools/boost_names.py b/meson/tools/boost_names.py
deleted file mode 100755 (executable)
index b66c6cc..0000000
+++ /dev/null
@@ -1,300 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2017 Niklas Claesson
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""This is two implementations for how to get module names from the boost
-sources.  One relies on json metadata files in the sources, the other relies on
-the folder names.
-
-Run the tool in the boost directory and append the stdout to the misc.py:
-
-boost/$ path/to/meson/tools/boost_names.py >> path/to/meson/dependencies/misc.py
-"""
-
-import sys
-import json
-import re
-import textwrap
-import functools
-import typing as T
-from pathlib import Path
-
-lib_dir = Path('libs')
-jamroot = Path('Jamroot')
-
-not_modules = ['config', 'disjoint_sets', 'headers']
-
-export_modules = False
-
-
-@functools.total_ordering
-class BoostLibrary():
-    def __init__(self, name: str, shared: T.List[str], static: T.List[str], single: T.List[str], multi: T.List[str]):
-        self.name = name
-        self.shared = sorted(set(shared))
-        self.static = sorted(set(static))
-        self.single = sorted(set(single))
-        self.multi = sorted(set(multi))
-
-    def __lt__(self, other: T.Any) -> T.Union[bool, 'NotImplemented']:
-        if isinstance(other, BoostLibrary):
-            return self.name < other.name
-        return NotImplemented
-
-    def __eq__(self, other: T.Any) -> T.Union[bool, 'NotImplemented']:
-        if isinstance(other, BoostLibrary):
-            return self.name == other.name
-        elif isinstance(other, str):
-            return self.name == other
-        return NotImplemented
-
-    def __hash__(self) -> int:
-        return hash(self.name)
-
-@functools.total_ordering
-class BoostModule():
-    def __init__(self, name: str, key: str, desc: str, libs: T.List[BoostLibrary]):
-        self.name = name
-        self.key = key
-        self.desc = desc
-        self.libs = libs
-
-    def __lt__(self, other: T.Any) -> T.Union[bool, 'NotImplemented']:
-        if isinstance(other, BoostModule):
-            return self.key < other.key
-        return NotImplemented
-
-
-def get_boost_version() -> T.Optional[str]:
-    raw = jamroot.read_text()
-    m = re.search(r'BOOST_VERSION\s*:\s*([0-9\.]+)\s*;', raw)
-    if m:
-        return m.group(1)
-    return None
-
-
-def get_libraries(jamfile: Path) -> T.List[BoostLibrary]:
-    # Extract libraries from the boost Jamfiles. This includes:
-    #  - library name
-    #  - compiler flags
-
-    libs: T.List[BoostLibrary] = []
-    raw = jamfile.read_text()
-    raw = re.sub(r'#.*\n', '\n', raw)  # Remove comments
-    raw = re.sub(r'\s+', ' ', raw)     # Force single space
-    raw = re.sub(r'}', ';', raw)       # Cheat code blocks by converting } to ;
-
-    cmds = raw.split(';')              # Commands always terminate with a ; (I hope)
-    cmds = [x.strip() for x in cmds]   # Some cleanup
-
-    project_usage_requirements: T.List[str] = []
-
-    # "Parse" the relevant sections
-    for i in cmds:
-        parts = i.split(' ')
-        parts = [x for x in parts if x not in ['']]
-        if not parts:
-            continue
-
-        # Parse project
-        if parts[0] in ['project']:
-            attributes: T.Dict[str, T.List[str]] = {}
-            curr: T.Optional[str] = None
-
-            for j in parts:
-                if j == ':':
-                    curr = None
-                elif curr is None:
-                    curr = j
-                else:
-                    if curr not in attributes:
-                        attributes[curr] = []
-                    attributes[curr] += [j]
-
-            if 'usage-requirements' in attributes:
-                project_usage_requirements = attributes['usage-requirements']
-
-        # Parse libraries
-        elif parts[0] in ['lib', 'boost-lib']:
-            assert len(parts) >= 2
-
-            # Get and check the library name
-            lname = parts[1]
-            if parts[0] == 'boost-lib':
-                lname = f'boost_{lname}'
-            if not lname.startswith('boost_'):
-                continue
-
-            # Count `:` to only select the 'usage-requirements'
-            # See https://boostorg.github.io/build/manual/master/index.html#bbv2.main-target-rule-syntax
-            colon_counter = 0
-            usage_requirements: T.List[str] = []
-            for j in parts:
-                if j == ':':
-                    colon_counter += 1
-                elif colon_counter >= 4:
-                    usage_requirements += [j]
-
-            # Get shared / static defines
-            shared: T.List[str] = []
-            static: T.List[str] = []
-            single: T.List[str] = []
-            multi: T.List[str] = []
-            for j in usage_requirements + project_usage_requirements:
-                m1 = re.match(r'<link>shared:<define>(.*)', j)
-                m2 = re.match(r'<link>static:<define>(.*)', j)
-                m3 = re.match(r'<threading>single:<define>(.*)', j)
-                m4 = re.match(r'<threading>multi:<define>(.*)', j)
-
-                if m1:
-                    shared += [f'-D{m1.group(1)}']
-                if m2:
-                    static += [f'-D{m2.group(1)}']
-                if m3:
-                    single +=[f'-D{m3.group(1)}']
-                if m4:
-                    multi += [f'-D{m4.group(1)}']
-
-            libs += [BoostLibrary(lname, shared, static, single, multi)]
-
-    return libs
-
-
-def process_lib_dir(ldir: Path) -> T.List[BoostModule]:
-    meta_file = ldir / 'meta' / 'libraries.json'
-    bjam_file = ldir / 'build' / 'Jamfile.v2'
-    if not meta_file.exists():
-        print(f'WARNING: Meta file {meta_file} does not exist')
-        return []
-
-    # Extract libs
-    libs: T.List[BoostLibrary] = []
-    if bjam_file.exists():
-        libs = get_libraries(bjam_file)
-
-    # Extract metadata
-    data = json.loads(meta_file.read_text())
-    if not isinstance(data, list):
-        data = [data]
-
-    modules: T.List[BoostModule] = []
-    for i in data:
-        modules += [BoostModule(i['name'], i['key'], i['description'], libs)]
-
-    return modules
-
-
-def get_modules() -> T.List[BoostModule]:
-    modules: T.List[BoostModule] = []
-    for i in lib_dir.iterdir():
-        if not i.is_dir() or i.name in not_modules:
-            continue
-
-        # numeric has sub libs
-        subdirs = i / 'sublibs'
-        metadir = i / 'meta'
-        if subdirs.exists() and not metadir.exists():
-            for j in i.iterdir():
-                if not j.is_dir():
-                    continue
-                modules += process_lib_dir(j)
-        else:
-            modules += process_lib_dir(i)
-
-    return modules
-
-
-def main() -> int:
-    if not lib_dir.is_dir() or not jamroot.exists():
-        print("ERROR: script must be run in boost source directory")
-        return 1
-
-    vers = get_boost_version()
-    modules = get_modules()
-    modules = sorted(modules)
-    libraries = [x for y in modules for x in y.libs]
-    libraries = sorted(set(libraries))
-
-    print(textwrap.dedent(f'''\
-        ####      ---- BEGIN GENERATED ----      ####
-        #                                           #
-        # Generated with tools/boost_names.py:
-        #  - boost version:   {vers}
-        #  - modules found:   {len(modules)}
-        #  - libraries found: {len(libraries)}
-        #
-
-        class BoostLibrary():
-            def __init__(self, name: str, shared: T.List[str], static: T.List[str], single: T.List[str], multi: T.List[str]):
-                self.name = name
-                self.shared = shared
-                self.static = static
-                self.single = single
-                self.multi = multi
-
-        class BoostModule():
-            def __init__(self, name: str, key: str, desc: str, libs: T.List[str]):
-                self.name = name
-                self.key = key
-                self.desc = desc
-                self.libs = libs
-
-
-        # dict of all know libraries with additional compile options
-        boost_libraries = {{\
-    '''))
-
-    for i in libraries:
-        print(textwrap.indent(textwrap.dedent(f"""\
-            '{i.name}': BoostLibrary(
-                name='{i.name}',
-                shared={i.shared},
-                static={i.static},
-                single={i.single},
-                multi={i.multi},
-            ),\
-        """), '    '))
-
-    if export_modules:
-        print(textwrap.dedent(f'''\
-            }}
-
-
-            # dict of all modules with metadata
-            boost_modules = {{\
-        '''))
-
-        for mod in modules:
-            desc_excaped = re.sub(r"'", "\\'", mod.desc)
-            print(textwrap.indent(textwrap.dedent(f"""\
-                '{mod.key}': BoostModule(
-                    name='{mod.name}',
-                    key='{mod.key}',
-                    desc='{desc_excaped}',
-                    libs={[x.name for x in mod.libs]},
-                ),\
-            """), '    '))
-
-    print(textwrap.dedent(f'''\
-        }}
-
-        #                                           #
-        ####       ---- END GENERATED ----       ####\
-    '''))
-
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/meson/tools/build_website.py b/meson/tools/build_website.py
deleted file mode 100755 (executable)
index 5486b69..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-#!/usr/bin/env python3
-
-import os, sys, subprocess, shutil
-
-assert(os.getcwd() == '/home/jpakkane')
-
-from glob import glob
-
-def purge(fname):
-    if not os.path.exists(fname):
-        return
-    if os.path.isdir(fname):
-        shutil.rmtree(fname)
-    os.unlink(fname)
-
-def update():
-    webdir = 'mesonweb'
-    repodir = 'mesonwebbuild'
-    docdir = os.path.join(repodir, 'docs')
-    builddir = os.path.join(docdir, 'builddir')
-    htmldir = os.path.join(builddir, 'Meson documentation-doc/html')
-#    subprocess.check_call(['git', 'pull'], cwd=webdir)
-    subprocess.check_call(['git', 'fetch', '-a'], cwd=repodir)
-    subprocess.check_call(['git', 'reset', '--hard', 'origin/master'],
-                          cwd=repodir)
-    if os.path.isdir(htmldir):
-        shutil.rmtree(htmldir)
-    if os.path.isdir(builddir):
-        shutil.rmtree(builddir)
-    env = os.environ.copy()
-    env['PATH'] = env['PATH'] + ':/home/jpakkane/.local/bin'
-    subprocess.check_call(['../meson.py', '.', 'builddir'], cwd=docdir, env=env)
-    subprocess.check_call(['ninja'], cwd=builddir)
-    old_files = glob(os.path.join(webdir, '*'))
-    for f in old_files:
-        base = f[len(webdir)+1:]
-        if base == 'CNAME' or base == 'favicon.png':
-            continue
-        subprocess.check_call(['git', 'rm', '-rf', base], cwd=webdir)
-    assert(os.path.isdir(webdir))
-    new_entries = glob(os.path.join(htmldir, '*'))
-    for e in new_entries:
-        shutil.move(e, webdir)
-    subprocess.check_call('git add *', shell=True, cwd=webdir)
-    subprocess.check_call(['git', 'commit', '-a', '-m', 'Bleep. Bloop. I am a bot.'],
-                          cwd=webdir)
-    subprocess.check_call(['git', 'push'], cwd=webdir)
-    shutil.rmtree(builddir)
-
-if __name__ == '__main__':
-    update()
diff --git a/meson/tools/cmake2meson.py b/meson/tools/cmake2meson.py
deleted file mode 100755 (executable)
index 05acd8f..0000000
+++ /dev/null
@@ -1,329 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2014 Jussi Pakkanen
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import typing as T
-from pathlib import Path
-import sys
-import re
-import argparse
-
-
-class Token:
-    def __init__(self, tid: str, value: str):
-        self.tid = tid
-        self.value = value
-        self.lineno = 0
-        self.colno = 0
-
-class Statement:
-    def __init__(self, name: str, args: list):
-        self.name = name.lower()
-        self.args = args
-
-class Lexer:
-    def __init__(self):
-        self.token_specification = [
-            # Need to be sorted longest to shortest.
-            ('ignore', re.compile(r'[ \t]')),
-            ('string', re.compile(r'"([^\\]|(\\.))*?"', re.M)),
-            ('varexp', re.compile(r'\${[-_0-9a-z/A-Z.]+}')),
-            ('id', re.compile('''[,-><${}=+_0-9a-z/A-Z|@.*]+''')),
-            ('eol', re.compile(r'\n')),
-            ('comment', re.compile(r'#.*')),
-            ('lparen', re.compile(r'\(')),
-            ('rparen', re.compile(r'\)')),
-        ]
-
-    def lex(self, code: str) -> T.Iterator[Token]:
-        lineno = 1
-        line_start = 0
-        loc = 0
-        col = 0
-        while loc < len(code):
-            matched = False
-            for (tid, reg) in self.token_specification:
-                mo = reg.match(code, loc)
-                if mo:
-                    col = mo.start() - line_start
-                    matched = True
-                    loc = mo.end()
-                    match_text = mo.group()
-                    if tid == 'ignore':
-                        continue
-                    if tid == 'comment':
-                        yield(Token('comment', match_text))
-                    elif tid == 'lparen':
-                        yield(Token('lparen', '('))
-                    elif tid == 'rparen':
-                        yield(Token('rparen', ')'))
-                    elif tid == 'string':
-                        yield(Token('string', match_text[1:-1]))
-                    elif tid == 'id':
-                        yield(Token('id', match_text))
-                    elif tid == 'eol':
-                        # yield('eol')
-                        lineno += 1
-                        col = 1
-                        line_start = mo.end()
-                    elif tid == 'varexp':
-                        yield(Token('varexp', match_text[2:-1]))
-                    else:
-                        raise ValueError('lex: unknown element {}'.format(tid))
-                    break
-            if not matched:
-                raise ValueError('Lexer got confused line %d column %d' % (lineno, col))
-
-class Parser:
-    def __init__(self, code: str):
-        self.stream = Lexer().lex(code)
-        self.getsym()
-
-    def getsym(self):
-        try:
-            self.current = next(self.stream)
-        except StopIteration:
-            self.current = Token('eof', '')
-
-    def accept(self, s: str) -> bool:
-        if self.current.tid == s:
-            self.getsym()
-            return True
-        return False
-
-    def expect(self, s: str) -> bool:
-        if self.accept(s):
-            return True
-        raise ValueError('Expecting %s got %s.' % (s, self.current.tid), self.current.lineno, self.current.colno)
-
-    def statement(self) -> Statement:
-        cur = self.current
-        if self.accept('comment'):
-            return Statement('_', [cur.value])
-        self.accept('id')
-        self.expect('lparen')
-        args = self.arguments()
-        self.expect('rparen')
-        return Statement(cur.value, args)
-
-    def arguments(self) -> list:
-        args = []
-        if self.accept('lparen'):
-            args.append(self.arguments())
-            self.expect('rparen')
-        arg = self.current
-        if self.accept('comment'):
-            rest = self.arguments()
-            args += rest
-        elif self.accept('string') \
-                or self.accept('varexp') \
-                or self.accept('id'):
-            args.append(arg)
-            rest = self.arguments()
-            args += rest
-        return args
-
-    def parse(self) -> T.Iterator[Statement]:
-        while not self.accept('eof'):
-            yield(self.statement())
-
-def token_or_group(arg):
-    if isinstance(arg, Token):
-        return ' ' + arg.value
-    elif isinstance(arg, list):
-        line = ' ('
-        for a in arg:
-            line += ' ' + token_or_group(a)
-        line += ' )'
-        return line
-
-class Converter:
-    ignored_funcs = {'cmake_minimum_required': True,
-                     'enable_testing': True,
-                     'include': True}
-
-    def __init__(self, cmake_root: str):
-        self.cmake_root = Path(cmake_root).expanduser()
-        self.indent_unit = '  '
-        self.indent_level = 0
-        self.options = []  # type: T.List[tuple]
-
-    def convert_args(self, args: T.List[Token], as_array: bool = True) -> str:
-        res = []
-        if as_array:
-            start = '['
-            end = ']'
-        else:
-            start = ''
-            end = ''
-        for i in args:
-            if i.tid == 'id':
-                res.append("'%s'" % i.value)
-            elif i.tid == 'varexp':
-                res.append('%s' % i.value.lower())
-            elif i.tid == 'string':
-                res.append("'%s'" % i.value)
-            else:
-                raise ValueError('Unknown arg type {}'.format(i.tid))
-        if len(res) > 1:
-            return start + ', '.join(res) + end
-        if len(res) == 1:
-            return res[0]
-        return ''
-
-    def write_entry(self, outfile: T.TextIO, t: Statement):
-        if t.name in Converter.ignored_funcs:
-            return
-        preincrement = 0
-        postincrement = 0
-        if t.name == '_':
-            line = t.args[0]
-        elif t.name == 'add_subdirectory':
-            line = "subdir('" + t.args[0].value + "')"
-        elif t.name == 'pkg_search_module' or t.name == 'pkg_search_modules':
-            varname = t.args[0].value.lower()
-            mods = ["dependency('%s')" % i.value for i in t.args[1:]]
-            if len(mods) == 1:
-                line = '%s = %s' % (varname, mods[0])
-            else:
-                line = '%s = [%s]' % (varname, ', '.join(["'%s'" % i for i in mods]))
-        elif t.name == 'find_package':
-            line = "%s_dep = dependency('%s')" % (t.args[0].value, t.args[0].value)
-        elif t.name == 'find_library':
-            line = "%s = find_library('%s')" % (t.args[0].value.lower(), t.args[0].value)
-        elif t.name == 'add_executable':
-            line = '%s_exe = executable(%s)' % (t.args[0].value, self.convert_args(t.args, False))
-        elif t.name == 'add_library':
-            if t.args[1].value == 'SHARED':
-                libcmd = 'shared_library'
-                args = [t.args[0]] + t.args[2:]
-            elif t.args[1].value == 'STATIC':
-                libcmd = 'static_library'
-                args = [t.args[0]] + t.args[2:]
-            else:
-                libcmd = 'library'
-                args = t.args
-            line = '%s_lib = %s(%s)' % (t.args[0].value, libcmd, self.convert_args(args, False))
-        elif t.name == 'add_test':
-            line = 'test(%s)' % self.convert_args(t.args, False)
-        elif t.name == 'option':
-            optname = t.args[0].value
-            description = t.args[1].value
-            if len(t.args) > 2:
-                default = t.args[2].value
-            else:
-                default = None
-            self.options.append((optname, description, default))
-            return
-        elif t.name == 'project':
-            pname = t.args[0].value
-            args = [pname]
-            for l in t.args[1:]:
-                l = l.value.lower()
-                if l == 'cxx':
-                    l = 'cpp'
-                args.append(l)
-            args = ["'%s'" % i for i in args]
-            line = 'project(' + ', '.join(args) + ", default_options : ['default_library=static'])"
-        elif t.name == 'set':
-            varname = t.args[0].value.lower()
-            line = '%s = %s\n' % (varname, self.convert_args(t.args[1:]))
-        elif t.name == 'if':
-            postincrement = 1
-            try:
-                line = 'if %s' % self.convert_args(t.args, False)
-            except AttributeError:  # complex if statements
-                line = t.name
-                for arg in t.args:
-                    line += token_or_group(arg)
-        elif t.name == 'elseif':
-            preincrement = -1
-            postincrement = 1
-            try:
-                line = 'elif %s' % self.convert_args(t.args, False)
-            except AttributeError:  # complex if statements
-                line = t.name
-                for arg in t.args:
-                    line += token_or_group(arg)
-        elif t.name == 'else':
-            preincrement = -1
-            postincrement = 1
-            line = 'else'
-        elif t.name == 'endif':
-            preincrement = -1
-            line = 'endif'
-        else:
-            line = '''# %s(%s)''' % (t.name, self.convert_args(t.args))
-        self.indent_level += preincrement
-        indent = self.indent_level * self.indent_unit
-        outfile.write(indent)
-        outfile.write(line)
-        if not(line.endswith('\n')):
-            outfile.write('\n')
-        self.indent_level += postincrement
-
-    def convert(self, subdir: Path = None):
-        if not subdir:
-            subdir = self.cmake_root
-        cfile = Path(subdir).expanduser() / 'CMakeLists.txt'
-        try:
-            with cfile.open() as f:
-                cmakecode = f.read()
-        except FileNotFoundError:
-            print('\nWarning: No CMakeLists.txt in', subdir, '\n', file=sys.stderr)
-            return
-        p = Parser(cmakecode)
-        with (subdir / 'meson.build').open('w') as outfile:
-            for t in p.parse():
-                if t.name == 'add_subdirectory':
-                    # print('\nRecursing to subdir',
-                    #       self.cmake_root / t.args[0].value,
-                    #       '\n')
-                    self.convert(subdir / t.args[0].value)
-                    # print('\nReturning to', self.cmake_root, '\n')
-                self.write_entry(outfile, t)
-        if subdir == self.cmake_root and len(self.options) > 0:
-            self.write_options()
-
-    def write_options(self):
-        filename = self.cmake_root / 'meson_options.txt'
-        with filename.open('w') as optfile:
-            for o in self.options:
-                (optname, description, default) = o
-                if default is None:
-                    typestr = ''
-                    defaultstr = ''
-                else:
-                    if default == 'OFF':
-                        typestr = ' type : \'boolean\','
-                        default = 'false'
-                    elif default == 'ON':
-                        default = 'true'
-                        typestr = ' type : \'boolean\','
-                    else:
-                        typestr = ' type : \'string\','
-                    defaultstr = ' value : %s,' % default
-                line = "option(%r,%s%s description : '%s')\n" % (optname,
-                                                                 typestr,
-                                                                 defaultstr,
-                                                                 description)
-                optfile.write(line)
-
-if __name__ == '__main__':
-    p = argparse.ArgumentParser(description='Convert CMakeLists.txt to meson.build and meson_options.txt')
-    p.add_argument('cmake_root', help='CMake project root (where top-level CMakeLists.txt is)')
-    P = p.parse_args()
-
-    Converter(P.cmake_root).convert()
diff --git a/meson/tools/copy_files.py b/meson/tools/copy_files.py
deleted file mode 100644 (file)
index 39eaa0a..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env python3
-
-
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''
-Copy files
-'''
-
-import argparse
-import shutil
-import typing as T
-from pathlib import Path
-
-PathLike = T.Union[Path,str]
-
-def copy_files(files: T.List[str], input_dir: PathLike, output_dir: PathLike) -> None:
-    if not input_dir:
-        raise ValueError(f'Input directory value is not set')
-    if not output_dir:
-        raise ValueError(f'Output directory value is not set')
-    
-    input_dir = Path(input_dir).resolve()
-    output_dir = Path(output_dir).resolve()
-    output_dir.mkdir(parents=True, exist_ok=True)
-    
-    for f in files:
-        if (input_dir/f).is_dir():
-            shutil.copytree(input_dir/f, output_dir/f)
-        else:
-            shutil.copy2(input_dir/f, output_dir/f)
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description='Copy files')
-    parser.add_argument('files', metavar='FILE', nargs='*')
-    parser.add_argument('-C', dest='input_dir', required=True)
-    parser.add_argument('--output-dir', required=True)
-    
-    args = parser.parse_args()
-
-    copy_files(files=args.files,
-               input_dir=args.input_dir,
-               output_dir=args.output_dir)
diff --git a/meson/tools/dircondenser.py b/meson/tools/dircondenser.py
deleted file mode 100755 (executable)
index 0e28bec..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#!/usr/bin/env python3
-
-
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''Renames test case directories using Git from this:
-
-1 something
-3 other
-3 foo
-3 bar
-
-to this:
-
-1 something
-2 other
-3 foo
-4 bar
-
-This directory must be run from source root as it touches run_unittests.py.
-'''
-
-import typing as T
-import os
-import sys
-import subprocess
-
-from glob import glob
-
-def get_entries() -> T.List[T.Tuple[int, str]]:
-    entries = []
-    for e in glob('*'):
-        if not os.path.isdir(e):
-            raise SystemExit('Current directory must not contain any files.')
-        (number, rest) = e.split(' ', 1)
-        try:
-            numstr = int(number)
-        except ValueError:
-            raise SystemExit('Dir name {} does not start with a number.'.format(e))
-        entries.append((numstr, rest))
-    entries.sort()
-    return entries
-
-def replace_source(sourcefile: str, replacements: T.List[T.Tuple[str, str]]):
-    with open(sourcefile, 'r') as f:
-        contents = f.read()
-    for old_name, new_name in replacements:
-        contents = contents.replace(old_name, new_name)
-    with open(sourcefile, 'w') as f:
-        f.write(contents)
-
-def condense(dirname: str):
-    curdir = os.getcwd()
-    os.chdir(dirname)
-    entries = get_entries()
-    replacements = []
-    for _i, e in enumerate(entries):
-        i = _i + 1
-        if e[0] != i:
-            old_name = str(e[0]) + ' ' + e[1]
-            new_name = str(i) + ' ' + e[1]
-            #print('git mv "%s" "%s"' % (old_name, new_name))
-            subprocess.check_call(['git', 'mv', old_name, new_name])
-            replacements.append((old_name, new_name))
-            # update any appearances of old_name in expected stdout in test.json
-            json = os.path.join(new_name, 'test.json')
-            if os.path.isfile(json):
-                replace_source(json, [(old_name, new_name)])
-    os.chdir(curdir)
-    replace_source('run_unittests.py', replacements)
-    replace_source('run_project_tests.py', replacements)
-
-if __name__ == '__main__':
-    if len(sys.argv) != 1:
-        raise SystemExit('This script takes no arguments.')
-    for d in glob('test cases/*'):
-        condense(d)
diff --git a/meson/tools/gen_data.py b/meson/tools/gen_data.py
deleted file mode 100755 (executable)
index 2cc05a4..0000000
+++ /dev/null
@@ -1,139 +0,0 @@
-#!/usr/bin/env python3
-
-# Copyright 2020 Daniel Mensinger
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-import sys
-import hashlib
-import textwrap
-import re
-from pathlib import Path
-from datetime import datetime
-import typing as T
-
-class DataFile:
-    file_counter = 0
-
-    def __init__(self, path: Path, root: Path):
-        self.path = path
-        self.id = self.path.relative_to(root)
-        self.data_str = f'file_{DataFile.file_counter}_data_' + re.sub('[^a-zA-Z0-9]', '_', self.path.name)
-        DataFile.file_counter += 1
-
-        b = self.path.read_bytes()
-        self.data = b.decode()
-        self.sha256sum = hashlib.sha256(b).hexdigest()
-
-    def __repr__(self) -> str:
-        return f'<{type(self).__name__}: [{self.sha256sum}] {self.id}>'
-
-def main() -> int:
-    root_dir = Path(__file__).resolve().parents[1]
-    mesonbuild_dir = root_dir / 'mesonbuild'
-    out_file = mesonbuild_dir / 'mesondata.py'
-
-    data_dirs = mesonbuild_dir.glob('**/data')
-
-    data_files: T.List[DataFile] = []
-
-    for d in data_dirs:
-        for p in d.iterdir():
-            data_files += [DataFile(p, mesonbuild_dir)]
-
-    print(f'Found {len(data_files)} data files')
-
-    # Generate the data script
-    data = ''
-
-    data += textwrap.dedent(f'''\
-        # Copyright {datetime.today().year} The Meson development team
-
-        # Licensed under the Apache License, Version 2.0 (the "License");
-        # you may not use this file except in compliance with the License.
-        # You may obtain a copy of the License at
-
-        #     http://www.apache.org/licenses/LICENSE-2.0
-
-        # Unless required by applicable law or agreed to in writing, software
-        # distributed under the License is distributed on an "AS IS" BASIS,
-        # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-        # See the License for the specific language governing permissions and
-        # limitations under the License.
-
-
-        ####
-        ####  WARNING: This is an automatically generated file! Do not edit!
-        ####           Generated by {Path(__file__).resolve().relative_to(root_dir)}
-        ####
-
-
-        from pathlib import Path
-        import typing as T
-
-        if T.TYPE_CHECKING:
-            from .environment import Environment
-
-        ######################
-        # BEGIN Data section #
-        ######################
-
-    ''')
-
-    for i in data_files:
-        data += f"{i.data_str} = '''\\\n{i.data}'''\n\n"
-
-    data += textwrap.dedent(f'''
-        ####################
-        # END Data section #
-        ####################
-
-        class DataFile:
-            def __init__(self, path: Path, sha256sum: str, data: str) -> None:
-                self.path = path
-                self.sha256sum = sha256sum
-                self.data = data
-
-            def write_once(self, path: Path) -> None:
-                if not path.exists():
-                    path.write_text(self.data)
-
-            def write_to_private(self, env: 'Environment') -> Path:
-                out_file = Path(env.scratch_dir) / 'data' / self.path.name
-                out_file.parent.mkdir(exist_ok=True)
-                self.write_once(out_file)
-                return out_file
-
-
-        mesondata = {{
-    ''')
-
-    for i in data_files:
-        data += textwrap.indent(textwrap.dedent(f"""\
-            '{i.id}': DataFile(
-                Path('{i.id}'),
-                '{i.sha256sum}',
-                {i.data_str},
-            ),
-        """), '    ')
-
-    data += textwrap.dedent('''\
-        }
-    ''')
-
-    print(f'Updating {out_file}')
-    out_file.write_text(data)
-    return 0
-
-if __name__ == '__main__':
-    sys.exit(main())
diff --git a/meson/tools/regenerate_docs.py b/meson/tools/regenerate_docs.py
deleted file mode 100755 (executable)
index d443570..0000000
+++ /dev/null
@@ -1,150 +0,0 @@
-#!/usr/bin/env python3
-
-
-# Copyright 2018 The Meson development team
-
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-
-#     http://www.apache.org/licenses/LICENSE-2.0
-
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-'''
-Regenerate markdown docs by using `meson.py` from the root dir
-'''
-
-import argparse
-import jinja2
-import os
-import re
-import subprocess
-import sys
-import textwrap
-import typing as T
-from pathlib import Path
-
-PathLike = T.Union[Path,str]
-
-def _get_meson_output(root_dir: Path, args: T.List):
-    env = os.environ.copy()
-    env['COLUMNS'] = '80'
-    return subprocess.run([str(sys.executable), str(root_dir/'meson.py')] + args, check=True, capture_output=True, text=True, env=env).stdout.strip()
-
-def get_commands_data(root_dir: Path):
-    usage_start_pattern = re.compile(r'^usage: ', re.MULTILINE)
-    positional_start_pattern = re.compile(r'^positional arguments:[\t ]*[\r\n]+', re.MULTILINE)
-    options_start_pattern = re.compile(r'^optional arguments:[\t ]*[\r\n]+', re.MULTILINE)
-    commands_start_pattern = re.compile(r'^[A-Za-z ]*[Cc]ommands:[\t ]*[\r\n]+', re.MULTILINE)
-
-    def get_next_start(iterators, end):
-        return next((i.start() for i in iterators if i), end)
-
-    def normalize_text(text):
-        # clean up formatting
-        out = text
-        out = re.sub(r'\r\n', r'\r', out, flags=re.MULTILINE) # replace newlines with a linux EOL
-        out = re.sub(r'^ +$', '', out, flags=re.MULTILINE) # remove trailing whitespace
-        out = re.sub(r'(?:^\n+|\n+$)', '', out) # remove trailing empty lines
-        return out
-
-    def parse_cmd(cmd):
-        cmd_len = len(cmd)
-        usage = usage_start_pattern.search(cmd)
-        positionals = positional_start_pattern.search(cmd)
-        options = options_start_pattern.search(cmd)
-        commands = commands_start_pattern.search(cmd)
-
-        arguments_start = get_next_start([positionals, options, commands], None)
-        assert arguments_start
-
-        # replace `usage:` with `$` and dedent
-        dedent_size = (usage.end() - usage.start()) - len('$ ')
-        usage_text = textwrap.dedent(f'{dedent_size * " "}$ {normalize_text(cmd[usage.end():arguments_start])}')
-
-        return {
-            'usage': usage_text,
-            'arguments': normalize_text(cmd[arguments_start:cmd_len]),
-        }
-
-    def clean_dir_arguments(text):
-        # Remove platform specific defaults
-        args = [
-            'prefix',
-            'bindir',
-            'datadir',
-            'includedir',
-            'infodir',
-            'libdir',
-            'libexecdir',
-            'localedir',
-            'localstatedir',
-            'mandir',
-            'sbindir',
-            'sharedstatedir',
-            'sysconfdir'
-        ]
-        out = text
-        for a in args:
-            out = re.sub(r'(--' + a + r' .+?)\s+\(default:.+?\)(\.)?', r'\1\2', out, flags=re.MULTILINE|re.DOTALL)
-        return out
-
-    output = _get_meson_output(root_dir, ['--help'])
-    commands = set(c.strip() for c in re.findall(r'usage:(?:.+)?{((?:[a-z]+,*)+?)}', output, re.MULTILINE|re.DOTALL)[0].split(','))
-    commands.remove('help')
-
-    cmd_data = dict()
-
-    for cmd in commands:
-        cmd_output = _get_meson_output(root_dir, [cmd, '--help'])
-        cmd_data[cmd] = parse_cmd(cmd_output)
-        if cmd in ['setup', 'configure']:
-            cmd_data[cmd]['arguments'] = clean_dir_arguments(cmd_data[cmd]['arguments'])
-
-    return cmd_data
-
-def regenerate_commands(root_dir: Path, output_dir: Path) -> None:
-    with open(root_dir/'docs'/'markdown_dynamic'/'Commands.md') as f:
-        template = f.read()
-
-    cmd_data = get_commands_data(root_dir)
-
-    t = jinja2.Template(template, undefined=jinja2.StrictUndefined, keep_trailing_newline=True)
-    content = t.render(cmd_help=cmd_data)
-
-    output_file = output_dir/'Commands.md'
-    with open(output_file, 'w') as f:
-        f.write(content)
-
-    print(f'`{output_file}` was regenerated')
-
-def regenerate_docs(output_dir: PathLike,
-                    dummy_output_file: T.Optional[PathLike]) -> None:
-    if not output_dir:
-        raise ValueError(f'Output directory value is not set')
-        
-    output_dir = Path(output_dir).resolve()
-    output_dir.mkdir(parents=True, exist_ok=True)
-
-    root_dir = Path(__file__).resolve().parent.parent
-
-    regenerate_commands(root_dir, output_dir)
-
-    if dummy_output_file:
-        with open(output_dir/dummy_output_file, 'w') as f:
-            f.write('dummy file for custom_target output')
-
-if __name__ == '__main__':
-    parser = argparse.ArgumentParser(description='Generate meson docs')
-    parser.add_argument('--output-dir', required=True)
-    parser.add_argument('--dummy-output-file', type=str)
-    
-    args = parser.parse_args()
-
-    regenerate_docs(output_dir=args.output_dir,
-                    dummy_output_file=args.dummy_output_file)
index de74b45823aacb17bbaf3bffff7ad1acacf888b2..8592d999ea06dec1df0ac40b828572eb2198bd5d 100755 (executable)
@@ -56,7 +56,6 @@ cd %blddir
        --localstatedir=%_localstatedir \
        --docdir=%_docdir \
        --firmwarepath=%_datadir/%name \
-       --python=%_bindir/python3 \
        --extra-cflags="%{optflags}" \
        --without-default-devices \
        --disable-auth-pam \