diff options
41 files changed, 157 insertions, 80 deletions
diff --git a/data/macros.meson b/data/macros.meson index e55f7a2..b31f77e 100644 --- a/data/macros.meson +++ b/data/macros.meson @@ -33,4 +33,9 @@ %ninja_install -C %{_vpath_builddir} %meson_test \ - %ninja_test -C %{_vpath_builddir} + %ninja_test -C %{_vpath_builddir} || \ + { rc=$?; \ + echo "-----BEGIN TESTLOG-----"; \ + cat %{_vpath_builddir}/meson-logs/testlog.txt; \ + echo "-----END TESTLOG-----"; \ + exit $rc; } diff --git a/docs/markdown/Comparisons.md b/docs/markdown/Comparisons.md index 3c526ad..dcfefa9 100644 --- a/docs/markdown/Comparisons.md +++ b/docs/markdown/Comparisons.md @@ -2,7 +2,7 @@ title: Comparisons ... -# Comparing Meson with other build systems # +# 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 @@ -11,37 +11,37 @@ 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 ## +## GNU Autotools -### Pros ### +### Pros Excellent support for legacy Unix platforms, large selection of existing modules. -### Cons ### +### 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 ## +## CMake -### Pros ### +### Pros Great support for multiple backends (Visual Studio, XCode, etc). -### Cons ### +### Cons The scripting language is cumbersome to work with. Some simple things are more complicated than necessary. -## SCons ## +## SCons -### Pros ### +### Pros Full power of Python available for defining your build. -### Cons ### +### Cons Slow. Requires you to pass your configuration settings on every invocation. That is, if you do `scons OPT1 OPT2` and then just @@ -61,9 +61,9 @@ 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 ## +## Meson -### Pros ### +### Pros The fastest build system [see measurements](Performance-comparison.md), user friendly, designed to @@ -71,7 +71,7 @@ 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 ### +### 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 diff --git a/docs/markdown/Configuring-a-build-directory.md b/docs/markdown/Configuring-a-build-directory.md index edf3d97..774addf 100644 --- a/docs/markdown/Configuring-a-build-directory.md +++ b/docs/markdown/Configuring-a-build-directory.md @@ -9,11 +9,11 @@ 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 `mesonconf` script. You may also use the +The main tool for this is the `meson configure` command. You may also use the `mesongui` graphical application if you want. However this document describes the use of the command line client. -You invoke `mesonconf` by giving it the location of your build dir. If +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. @@ -56,7 +56,7 @@ 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. - mesonconf -Dprefix=/tmp/testroot + meson configure -Dprefix=/tmp/testroot Then you would run your build command (usually `ninja`), which would cause Meson to detect that the build setup has changed and do all the diff --git a/docs/markdown/Custom-build-targets.md b/docs/markdown/Custom-build-targets.md index 8bd31db..30a16e3 100644 --- a/docs/markdown/Custom-build-targets.md +++ b/docs/markdown/Custom-build-targets.md @@ -27,7 +27,7 @@ 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. -## Details on compiler invocations ## +## 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 diff --git a/docs/markdown/Dependencies.md b/docs/markdown/Dependencies.md index c46334c..c3f007f 100644 --- a/docs/markdown/Dependencies.md +++ b/docs/markdown/Dependencies.md @@ -47,7 +47,7 @@ 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. -## Boost ## +## 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 @@ -76,7 +76,7 @@ environment variables. You can set the argument `threading` to `single` to use boost libraries that has been compiled for single-threaded use instead. -## GTest and GMock ## +## 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 @@ -84,7 +84,7 @@ 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. -## MPI ## +## MPI MPI is supported for C, C++ and Fortran. Because dependencies are language-specific, you must specify the requested language using the @@ -100,7 +100,7 @@ are not in your path, they can be specified by setting the standard environment variables `MPICC`, `MPICXX`, `MPIFC`, `MPIF90`, or `MPIF77`, during configuration. -## Qt5 ## +## Qt5 Meson has native Qt5 support. Its usage is best demonstrated with an example. diff --git a/docs/markdown/Design-rationale.md b/docs/markdown/Design-rationale.md index 269f688..7cf67a4 100644 --- a/docs/markdown/Design-rationale.md +++ b/docs/markdown/Design-rationale.md @@ -67,7 +67,7 @@ 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### +### 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 @@ -76,7 +76,7 @@ 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### +### 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 @@ -85,7 +85,7 @@ 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### +### 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 @@ -94,7 +94,7 @@ 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### +### 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 @@ -102,10 +102,10 @@ 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### +### 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 +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 @@ -113,20 +113,20 @@ 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### +### 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### +### 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### +### 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 diff --git a/docs/markdown/FAQ.md b/docs/markdown/FAQ.md index 2023c7e..441cd69 100644 --- a/docs/markdown/FAQ.md +++ b/docs/markdown/FAQ.md @@ -98,7 +98,7 @@ The only reason why one would use Make instead of Ninja is working on a platform 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? ## +## 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?* diff --git a/docs/markdown/Generating-sources.md b/docs/markdown/Generating-sources.md index c5e338d..ae1302b 100644 --- a/docs/markdown/Generating-sources.md +++ b/docs/markdown/Generating-sources.md @@ -31,7 +31,7 @@ gen_src = custom_target('gen-output', '--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. +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. diff --git a/docs/markdown/IDE-integration.md b/docs/markdown/IDE-integration.md index d2a3e9c..f7939dd 100644 --- a/docs/markdown/IDE-integration.md +++ b/docs/markdown/IDE-integration.md @@ -34,7 +34,7 @@ The next thing to display is the list of options that can be set. These include mesonintrospect.py --buildoptions -To set the options, use the `mesonconf.py` binary. +To set the options, use the `meson configure` command. Compilation and unit tests are done as usual by running the `ninja` and `ninja test` commands. A JSON formatted result log can be found in `workspace/project/builddir/meson-logs/testlog.json`. diff --git a/docs/markdown/Installing.md b/docs/markdown/Installing.md index 3454d49..2663ff4 100644 --- a/docs/markdown/Installing.md +++ b/docs/markdown/Installing.md @@ -44,7 +44,7 @@ giving an absolute install path. install_data(sources : 'foo.dat', install_dir : '/etc') # -> /etc/foo.dat ``` -## Custom install behavior ## +## 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. @@ -65,7 +65,7 @@ meson.add_install_script('myscript.sh') The argument is the name of the script file relative to the current subdirectory. -## DESTDIR support ## +## 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: diff --git a/docs/markdown/Module-reference.md b/docs/markdown/Module-reference.md index 80e3b8f..60be7bd 100644 --- a/docs/markdown/Module-reference.md +++ b/docs/markdown/Module-reference.md @@ -17,4 +17,4 @@ change in arbitrary ways between releases. The modules might also be removed without warning in future releases. * [SIMD](Simd-module.md) -
\ No newline at end of file + diff --git a/docs/markdown/Precompiled-headers.md b/docs/markdown/Precompiled-headers.md index 22fd762..57b2923 100644 --- a/docs/markdown/Precompiled-headers.md +++ b/docs/markdown/Precompiled-headers.md @@ -40,7 +40,7 @@ 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 `mesonconf`. You can +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 diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 14097ed..42d02e1 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -206,7 +206,7 @@ following. [`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. + 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. @@ -871,7 +871,7 @@ 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 - `mesonconf`. For example to set the default project type you would + `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 @@ -1452,7 +1452,7 @@ are immutable, all operations return their results as a new string. - `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 +- `strip()` removes whitespace at the beginning and end of the string *(added 0.43.0)* optionally can take one positional string argument, and all characters in that string will be stripped @@ -1525,7 +1525,7 @@ A build target is either an [executable](#executable), 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. +- `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. @@ -1574,7 +1574,7 @@ cause a syntax error. 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 +- `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. diff --git a/docs/markdown/Release-notes-for-0.43.0.md b/docs/markdown/Release-notes-for-0.43.0.md index c6734f0..3f981e8 100644 --- a/docs/markdown/Release-notes-for-0.43.0.md +++ b/docs/markdown/Release-notes-for-0.43.0.md @@ -19,7 +19,7 @@ found. Generators can now be configured to capture the standard output. See `test cases/common/98 gen extra/meson.build` for an example. -# Can index CustomTaget objects +# 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 @@ -88,12 +88,12 @@ now simply do: ```meson warning_flags = [ ... ] -flags = cc.get_supported_flags(warning_flags) +flags = cc.get_supported_arguments(warning_flags) ``` # Better support for shared libraries in non-system paths -Meson has had support for prebuilt object files and static libraries. +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 diff --git a/docs/markdown/Syntax.md b/docs/markdown/Syntax.md index 02db228..eaf24cf 100644 --- a/docs/markdown/Syntax.md +++ b/docs/markdown/Syntax.md @@ -45,7 +45,7 @@ Strings can be converted to a number like this: ```meson string_var = '42' -num = var1.to_int() +num = string_var.to_int() ``` Booleans diff --git a/docs/markdown/Users.md b/docs/markdown/Users.md index 46c2654..c27c516 100644 --- a/docs/markdown/Users.md +++ b/docs/markdown/Users.md @@ -9,7 +9,7 @@ If you have a project that uses Meson that you want to add to this list, let us - [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) - [Budgie Desktop](https://github.com/budgie-desktop/budgie-desktop), a desktop environment built on GNOME technologies - - [casync](https://github.com/systemd/casync), + - [casync](https://github.com/systemd/casync), Content-Addressable Data Synchronization Tool - [Emeus](https://github.com/ebassi/emeus), Constraint based layout manager for GTK+ - [Frida](https://www.frida.re/), a dynamic binary instrumentation toolkit - [GLib](https://git.gnome.org/browse/glib/), cross-platform C library used by GTK+ and GStreamer (not the default yet) @@ -43,4 +43,4 @@ If you have a project that uses Meson that you want to add to this list, let us - [Wayland and Weston](https://lists.freedesktop.org/archives/wayland-devel/2016-November/031984.html), a next generation display server (not merged yet) - [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 +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/docs/markdown/Using-multiple-build-directories.md b/docs/markdown/Using-multiple-build-directories.md index c07b39c..2455640 100644 --- a/docs/markdown/Using-multiple-build-directories.md +++ b/docs/markdown/Using-multiple-build-directories.md @@ -8,7 +8,7 @@ Secondly this makes it very easy to clean your projects: just delete the build s The true benefit comes from somewhere else, though. -## Multiple build directories for the same source tree ## +## 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. @@ -36,7 +36,7 @@ The cross compilation file sets up Wine so that not only can you compile your ap To compile any of these build types, just cd into the corresponding build directory and run `ninja` 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 ## +## 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. diff --git a/docs/markdown/Vala.md b/docs/markdown/Vala.md index e183bb0..c5d2b79 100644 --- a/docs/markdown/Vala.md +++ b/docs/markdown/Vala.md @@ -26,9 +26,9 @@ When dealing with libraries that are not providing Vala bindings, a `--vapidir` ```meson project('vala app', 'c', 'vala') -add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], +add_project_arguments(['--vapidir', join_paths(meson.current_source_dir(), 'vapi')], language: 'vala') - + glib_dep = dependency('glib-2.0') gobject_dep = dependency('gobject-2.0') foo_dep = dependency('foo') # 'foo.vapi' will be resolved in './vapi/foo.vapi' @@ -36,7 +36,7 @@ foo_dep = dependency('foo') # 'foo.vapi' will be resolved in './vapi/foo.vapi' executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, foo_dep]) ``` -In this case, make sure that the VAPI name corresponds to the pkg-config file. +In this case, make sure that the VAPI name corresponds to the pkg-config file. If no pkg-config file is provided, you must use `find_library`. Using`declare_dependency` is cleaner because it does not require passing both dependency objects to the target. @@ -63,9 +63,9 @@ executable('app', 'app.vala', dependencies: [glib_dep, gobject_dep, posix_dep]) If a library target is used, Meson automatically outputs the C header and the VAPI. They can be renamed by setting the `vala_header` and `vala_vapi` arguments respectively. In this case, the second and third elements of the `install_dir` array indicate the destination with `true` to indicate default directories (i.e. `include` and `share/vala/vapi`). ```meson -foo_lib = library('foo', 'foo.vala', +foo_lib = library('foo', 'foo.vala', vala_header: 'foo.h', - vala_vapi: 'foo-1.0.vapi', + vala_vapi: 'foo-1.0.vapi', dependencies: [glib_dep, gobject_dep], install: true, install_dir: [true, true, true]) @@ -78,8 +78,8 @@ To generate GObject Introspection metadata, the `vala_gir` option has to be set The fourth element in the `install_dir` array indicate where the GIR file will be installed. The `true` value tells Meson to use the default directory (i.e. `share/gir-1.0`). ```meson -foo_lib = library('foo', 'foo.vala', - vala_gir: 'Foo-1.0.gir', +foo_lib = library('foo', 'foo.vala', + vala_gir: 'Foo-1.0.gir', dependencies: [glib_dep, gobject_dep], install: true, install_dir: [true, true, true, true]) diff --git a/docs/markdown/Wrap-review-guidelines.md b/docs/markdown/Wrap-review-guidelines.md index 39acadc..512353c 100644 --- a/docs/markdown/Wrap-review-guidelines.md +++ b/docs/markdown/Wrap-review-guidelines.md @@ -7,7 +7,7 @@ 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. -## Checklist ## +## Checklist Reviewer: copy-paste this to MR discussion box and tick all boxes that apply. diff --git a/docs/markdown/howtox.md b/docs/markdown/howtox.md index 2dd5ddf..c4aa9c5 100644 --- a/docs/markdown/howtox.md +++ b/docs/markdown/howtox.md @@ -97,12 +97,12 @@ $ ninja coverage-html (or coverage-xml) The coverage report can be found in the meson-logs subdirectory. -## Add some optimization to debug builds ## +## 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 -$ mesonconf -Dc_args=-Og +$ meson configure -Dc_args=-Og ``` This causes all subsequent builds to use this command line argument. @@ -139,7 +139,7 @@ Then we need to run the program with some representative input. This step depend Once that is done we change the compiler flags to use the generated information and rebuild. ```console -$ mesonconf -Db_pgo=use +$ meson configure -Db_pgo=use $ ninja ``` diff --git a/man/meson.1 b/man/meson.1 index 1f60a7c..04b56de 100644 --- a/man/meson.1 +++ b/man/meson.1 @@ -63,8 +63,9 @@ print command line help .SH The configure command -Mesonconf provides a way to configure a Meson -project from the command line. Its usage is simple. +.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 @@ -74,8 +75,9 @@ project from the command line. Its usage is simple. If build directory is omitted, the current directory is used instead. -If no parameters are set, mesonconf will print the value of all build -options to the console. +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. diff --git a/man/mesonintrospect.1 b/man/mesonintrospect.1 index d4101de..c32767c 100644 --- a/man/mesonintrospect.1 +++ b/man/mesonintrospect.1 @@ -1,4 +1,4 @@ -.TH MESONCONF "1" "October 2017" "mesonintrospect 0.43.0" "User Commands" +.TH MESONINTROSPECT "1" "October 2017" "mesonintrospect 0.43.0" "User Commands" .SH NAME mesonintrospect - a tool to extract information about a Meson build .SH DESCRIPTION diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 0d9742d..9913a0b 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -640,3 +640,14 @@ def find_external_dependency(name, env, kwargs): raise pkg_exc mlog.log('Dependency', mlog.bold(name), 'found:', mlog.red('NO')) return pkgdep + + +def strip_system_libdirs(environment, 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()} + return [l for l in link_args if l not in exclude] diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index b0e54c6..308ae55 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -23,6 +23,7 @@ from .. import mlog from .. import mesonlib from ..mesonlib import version_compare, Popen_safe, stringlistify, extract_as_list from .base import DependencyException, ExternalDependency, PkgConfigDependency +from .base import strip_system_libdirs class GTestDependency(ExternalDependency): def __init__(self, environment, kwargs): @@ -172,8 +173,7 @@ class LLVMDependency(ExternalDependency): [self.llvmconfig, '--libs', '--ldflags'])[:2] if p.returncode != 0: raise DependencyException('Could not generate libs for LLVM.') - self.link_args = shlex.split(out) - + self.link_args = strip_system_libdirs(environment, shlex.split(out)) p, out = Popen_safe([self.llvmconfig, '--cppflags'])[:2] if p.returncode != 0: raise DependencyException('Could not generate includedir for LLVM.') diff --git a/mesonbuild/dependencies/misc.py b/mesonbuild/dependencies/misc.py index e00897d..562a341 100644 --- a/mesonbuild/dependencies/misc.py +++ b/mesonbuild/dependencies/misc.py @@ -814,6 +814,7 @@ BOOST_LIBS = [ 'boost_math_c99f', 'boost_math_c99l', 'boost_mpi', + 'boost_program_options', 'boost_random', 'boost_regex', 'boost_serialization', diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 2f33a03..a746cab 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -887,6 +887,24 @@ class Environment: def get_datadir(self): return self.coredata.get_builtin_option('datadir') + def get_compiler_system_dirs(self): + for comp in self.coredata.compilers.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 get_args_from_envvars(compiler): """ diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index f4bc11f..e385a88 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1373,6 +1373,9 @@ class Interpreter(InterpreterBase): self.coredata = self.environment.get_coredata() self.backend = backend self.subproject = subproject + # 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') self.load_root_meson_file() @@ -1660,6 +1663,8 @@ class Interpreter(InterpreterBase): return self.do_subproject(dirname, kwargs) def do_subproject(self, dirname, kwargs): + if '/' in dirname or '\\' in dirname: + raise InterpreterException('Subproject name must not contain a path separator.') if dirname in self.subproject_stack: fullstack = self.subproject_stack + [dirname] incpath = ' => '.join(fullstack) @@ -2785,7 +2790,6 @@ different subdirectory. super().run() mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets)))) - # Check that the indicated file is within the same subproject # as we currently are. This is to stop people doing # nasty things like: @@ -2816,7 +2820,7 @@ different subdirectory. if num_sps > 1: raise InterpreterException('Sandbox violation: Tried to grab file %s from a nested subproject.' % segments[-1]) sproj_name = segments[segments.index(self.subproject_dir) + 1] - if sproj_name != self.subproject: + if sproj_name != self.subproject_directory_name: raise InterpreterException('Sandbox violation: Tried to grab file %s from a different subproject.' % segments[-1]) def source_strings_to_files(self, sources): diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py index a754b32..31b24c8 100644 --- a/mesonbuild/modules/gnome.py +++ b/mesonbuild/modules/gnome.py @@ -832,7 +832,7 @@ This will become a hard error in the future.''') args = [] for i in new_args: if expend_file_state and isinstance(i, mesonlib.File): - i = os.path.join(expend_file_state.environment.get_build_dir(), i.subdir, i.fname) + i = i.absolute_path(expend_file_state.environment.get_source_dir(), expend_file_state.environment.get_build_dir()) elif not isinstance(i, str): raise MesonException(kwarg_name + ' values must be strings.') args.append(i) diff --git a/mesonbuild/modules/pkgconfig.py b/mesonbuild/modules/pkgconfig.py index aaed820..8383a3a 100644 --- a/mesonbuild/modules/pkgconfig.py +++ b/mesonbuild/modules/pkgconfig.py @@ -80,9 +80,11 @@ class PkgConfigModule(ExtensionModule): yield l else: install_dir = l.get_custom_install_dir()[0] - if install_dir: + if install_dir is False: + continue + if isinstance(install_dir, str): yield '-L${prefix}/%s ' % install_dir - else: + else: # install_dir is True yield '-L${libdir}' lname = self._get_lname(l, msg, pcfile) # If using a custom suffix, the compiler may not be able to diff --git a/mesonbuild/scripts/regen_checker.py b/mesonbuild/scripts/regen_checker.py index 4125f40..53c5428 100644 --- a/mesonbuild/scripts/regen_checker.py +++ b/mesonbuild/scripts/regen_checker.py @@ -32,9 +32,11 @@ def need_regen(regeninfo, regen_timestamp): return False def regen(regeninfo, mesonscript, backend): - cmd = [sys.executable, - mesonscript, - '--internal', + if sys.executable.lower().endswith('meson.exe'): + cmd_exe = [sys.executable] + else: + cmd_exe = [sys.executable, mesonscript] + cmd = cmd_exe + ['--internal', 'regenerate', regeninfo.build_dir, regeninfo.source_dir, diff --git a/msi/createmsi.py b/msi/createmsi.py index c045a3e..7f165d8 100755 --- a/msi/createmsi.py +++ b/msi/createmsi.py @@ -43,6 +43,9 @@ class PackageGenerator: self.main_xml = 'meson.wxs' self.main_o = 'meson.wixobj' self.bytesize = 32 if '32' in platform.architecture()[0] else 64 + # rely on the environment variable since python architecture may not be the same as system architecture + if 'PROGRAMFILES(X86)' in os.environ: + self.bytesize = 64 self.final_output = 'meson-%s-%d.msi' % (self.version, self.bytesize) self.staging_dirs = ['dist', 'dist2'] if self.bytesize == 64: @@ -50,7 +53,7 @@ class PackageGenerator: self.redist_path = 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\14.11.25325\\MergeModules\\Microsoft_VC141_CRT_x64.msm' else: self.progfile_dir = 'ProgramFilesFolder' - self.redist_path = 'c:\\Program Files\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\14.11.25325\\MergeModules\\Microsoft_VC141_CRT_x86.msm' + self.redist_path = 'C:\\Program Files\\Microsoft Visual Studio\\2017\\Community\\VC\\Redist\\MSVC\\14.11.25325\\MergeModules\\Microsoft_VC141_CRT_x86.msm' self.component_num = 0 self.feature_properties = { self.staging_dirs[0]: { diff --git a/test cases/common/162 wrap file should not failed/meson.build b/test cases/common/162 wrap file should not failed/meson.build new file mode 100644 index 0000000..64d8d1f --- /dev/null +++ b/test cases/common/162 wrap file should not failed/meson.build @@ -0,0 +1,3 @@ +project('mainproj', 'c') + +subproject('zlib') diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8-8-wrap.zip @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz new file mode 100644 index 0000000..421376d --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/packagecache/zlib-1.2.8.tar.gz @@ -0,0 +1 @@ +dummy diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c new file mode 100644 index 0000000..e69de29 --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/foo.c diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build new file mode 100644 index 0000000..8d8008e --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/zlib-1.2.8/meson.build @@ -0,0 +1,2 @@ +project('shared lib', 'c') +shared_library('foo', 'foo.c') diff --git a/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap new file mode 100644 index 0000000..6d5896f --- /dev/null +++ b/test cases/common/162 wrap file should not failed/subprojects/zlib.wrap @@ -0,0 +1,10 @@ +[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/test cases/frameworks/4 qt/meson.build b/test cases/frameworks/4 qt/meson.build index c6f108b..39be19f 100644 --- a/test cases/frameworks/4 qt/meson.build +++ b/test cases/frameworks/4 qt/meson.build @@ -77,7 +77,7 @@ foreach qt : ['qt4', 'qt5'] moc_headers : 'plugin/plugin.h', include_directories : plugin_includes ) - plugin = library('plugin', 'plugin/plugin.cpp', pluginpreprocess, + plugin = library(qt + 'plugin', 'plugin/plugin.cpp', pluginpreprocess, include_directories : plugin_includes, dependencies : qtcore) endif diff --git a/test cases/frameworks/4 qt/plugin/plugin.cpp b/test cases/frameworks/4 qt/plugin/plugin.cpp index eeae98d..2c013fe 100644 --- a/test cases/frameworks/4 qt/plugin/plugin.cpp +++ b/test cases/frameworks/4 qt/plugin/plugin.cpp @@ -5,3 +5,8 @@ QString plugin1::getResource() { return "hello world"; } + + +#if QT_VERSION < 0x050000 + Q_EXPORT_PLUGIN2(Plugin1, plugin1) +#endif
\ No newline at end of file diff --git a/test cases/frameworks/4 qt/plugin/plugin.h b/test cases/frameworks/4 qt/plugin/plugin.h index 1138f41..c8e14e4 100644 --- a/test cases/frameworks/4 qt/plugin/plugin.h +++ b/test cases/frameworks/4 qt/plugin/plugin.h @@ -5,7 +5,10 @@ class plugin1:public QObject,public PluginInterface { Q_OBJECT Q_INTERFACES(PluginInterface) +#if QT_VERSION >= 0x050000 Q_PLUGIN_METADATA(IID "demo.PluginInterface" FILE "plugin.json") +#endif + public: QString getResource() override; }; diff --git a/tools/boost_names.py b/tools/boost_names.py index 9ac16bb..f9f1f11 100755 --- a/tools/boost_names.py +++ b/tools/boost_names.py @@ -99,6 +99,10 @@ def get_library_names(jamfile): for matches in res: if ':' in matches.group(2): libs.append(matches.group(1)) + res = re.finditer(r'^boost-lib[\s]+([A-Za-z0-9_]+)([^;]*);', jam, re.MULTILINE | re.DOTALL) + for matches in res: + if ':' in matches.group(2): + libs.append('boost_{}'.format(matches.group(1))) return libs def exists(modules, module): |