Commit Graph

2743 Commits

Author SHA1 Message Date
Nirbheek Chauhan 354c4bcaeb Test that warnings apply to C files in Vala targets 2016-10-14 19:13:21 +05:30
Nirbheek Chauhan b08c8c7b77 run_tests.py: Add support for tests that fail at build-time or test-time 2016-10-14 19:13:21 +05:30
Nirbheek Chauhan 5dcb8daaf3 vala tests: Test no-warnings code with werror in default_options
If the no-warnings code is working properly, -Werror will do nothing
because there's no warnings to error out with.
2016-10-14 19:13:21 +05:30
Nirbheek Chauhan 4332df01b8 Add no-warning args while building Vala C code
This is done by adding a new compiler method called 'no_warn_args' which
returns the argument(s) required for the compiler to emit no warnings
for that compilation.

This take care of not disabling warnings for C code compiled into the
BuildTarget. Also includes tests for ensuring all this.

https://github.com/mesonbuild/meson/issues/864
2016-10-14 19:13:21 +05:30
Thibault Saunier 77b379f5cf Try using already setup fallback subprojects before using native dependency
In the case the main project set a subproject for a dependency another
subprojects uses, that other subproject should rather use the first
subproject rather that using native dependency.

For example in gst-all we set all GStreamer modules as subprojects
and, gst-plugins-base is set after gstreamer core, and
we want gst-plugins-base to always use GStreamer core from the subproject
and not the possibly avalaible native one.
2016-10-14 11:25:16 +02:00
Thibault Saunier fcaf319e49 interpreter: Add a way to copy and environment object
It is really usefull when you have common variables defined
for all tests and then need to set some extra ones for each test
2016-10-14 11:25:16 +02:00
Thibault Saunier 7e2390f355 interpreter: Add a type_name method to DependencyHolder
And remove the InternalDependencyHolder class.

In some cases we need to know the type of dependency we are
dealing with. For example in GStreamer if the dependency
is not an internal one, then we need to get some env var
from pkg-config to know where to find some plugins necessary
to run some tests.
2016-10-14 11:25:15 +02:00
Sam Thursfield 25f13067c2 gnome: allow use of generated files with compile_resources()
This commit adds a 'dependencies' keyword to the
gnome.compile_resources() function, which allows your resource blob
to depend on files generated at build-time from custom_target() or
configure_file() targets.

My current use case for this is source data that gets processed with Gettext
translation tools before being compiled into the resource blob.

This feature only works with GLib version 2.48.2 and above. So the
compile_resources() function now detects GLib version and raises an
error if the version of GLib being used is too old.

The compile_resources() test case is now split into two, so that the
existing one can continue to run on systems with old GLib versions (such
as Ubuntu Xenial, which the automated tests on travisci.org use), but
where new enough GLib is available we also test generating gresource
content.

The existing warning about glib-compile-resources is now only printed
if GLib version is older than 2.50.0 because
<https://bugzilla.gnome.org/show_bug.cgi?id=745754> is fixed in the
2.50.0 release.
2016-10-13 21:18:14 +01:00
Sam Thursfield c1d2b65c73 Use stdout for success message instead of stderr in gresource test
This doesn't fix an issue, it's just good practice.
2016-10-13 21:18:01 +01:00
Jussi Pakkanen b6b8d561b8 Raise proper exception type and improve error messages. Closes #322. 2016-10-13 21:30:49 +03:00
Elliott Sales de Andrade 779788ad82 Split generator @BASENAME@ at the first extension. 2016-10-13 21:28:26 +03:00
Jussi Pakkanen abfc95e75a Merge pull request #899 from centricular/pkgconfig-allow-libfoo-name
pkgconfig: Handle library names starting with 'lib'
2016-10-13 21:27:35 +03:00
Jussi Pakkanen 1efcea9617 Renamed path_join to join_paths. 2016-10-13 20:53:45 +03:00
Nirbheek Chauhan c3db008d82 custom_target: Clarify error message 2016-10-13 00:21:33 +03:00
Nirbheek Chauhan 6ffae922cc Add a unittest for pkg-config file generation
This also tests that -lfoo is correctly added to libfoo.pc when the
library name is 'libfoo' and name_prefix is ''
2016-10-13 02:19:02 +05:30
Nirbheek Chauhan 5e384b8396 dependencies: Use a wrapper for calling pkg-config
Reduces duplicated code, and also use universal_newlines=True which
avoids having to decode the bytes output to string.

We mostly need this so we can pass the *current* process environment to
pkg-config which might've changed since the module was imported. Without
this, subprocess.Popen invokes pkg-config with a stale environment (used
in the unittest added later)
2016-10-13 02:18:24 +05:30
Nirbheek Chauhan 814f4909f9 pkgconfig: Handle library names starting with 'lib'
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 right.

Also, don't warn about anything on Windows

Fixes https://github.com/mesonbuild/meson/issues/889
2016-10-13 02:18:16 +05:30
Jussi Pakkanen 95a99682b0 Merge branch 'QuLogic-compiler-file-checks' 2016-10-12 23:26:30 +03:00
Jussi Pakkanen f194914b9f Merge pull request #896 from centricular/pkgconfig-check-prefix-suffix
pkgconfig: Warn if library has name_prefix/suffix set
2016-10-12 21:14:09 +03:00
Jussi Pakkanen cb21c72ac8 Merge pull request #897 from centricular/fix-unittest-intermittent-failure
Fix PIC unittest failure and make it more useful
2016-10-12 21:12:36 +03:00
Jussi Pakkanen 8faf0414ce Some fixes to unittest running. 2016-10-12 21:11:56 +03:00
Nirbheek Chauhan 674b520206 pkgconfig: Only warn for suffix if the filename doesn't start with lib 2016-10-12 21:22:54 +05:30
Nirbheek Chauhan 7307f6a5c8 unittests/pic: Actually test that setting b_staticpic works
The previous test was tautological for the second half because:

a) b_staticpic=true is the default
b) We weren't refetching the compdb
2016-10-12 20:49:19 +05:30
Nirbheek Chauhan 69ca8f5b54 meson.py: Always resolve full path to meson.py
There is no reason to not always do this. Without this, we end up with
a relative path to meson.py in build.ninja files when meson.py is
launched using subprocess.Popen and friends from the meson source root.

This was causing the unittests to intermittently fail when regen was
getting invoked by the pic test. Funnily enough, this only happened when
run via ./run_tests.py because __file__ was 'run_unittests.py' in that
(as opposed to './run_unittests.py') case which made
os.path.dirname(__file__) be '', and the os.path.split test in meson.py
thought that meson.py was invoked via PATH.
2016-10-12 20:25:03 +05:30
Nirbheek Chauhan d819914af0 pkgconfig: Warn if library has name_prefix/suffix set
GCC/Clang won't be able to find it via an -lfoo flag, so the pkg-config
file might be unusable.

Fixes https://github.com/mesonbuild/meson/issues/889
2016-10-12 13:40:08 +05:30
Igor Gnatenko a513bcfde6 allow libdir/includedir/etc. be absolute paths
In Fedora we don't care about prefix, we want to ensure that libdir
is /usr/lib64, localedir is /usr/share/locale, and cetera.

Additionally, we don't need to ensure that prefix is absolute as we
check it in main.

Fixes: cc19bf0f45 ("Move option validation in objects rather than doing it only in the conf script.")
Closes: https://github.com/mesonbuild/meson/issues/869
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-10-11 00:57:01 +03:00
Patrick Griffis 999669e850 setup.py: On Unix install scripts without .py suffix 2016-10-11 00:16:46 +03:00
Franz Zapata 4b5a0e5de7 Reintroduce Python Zipapp support
* Added `main` function as an entry point.
 * Created `__main__.py` to allow the creation of Zipapps without explicitly
   calling `meson:main`.
2016-10-10 23:41:40 +03:00
Jussi Pakkanen 60119753d6 Check contents of arguments inside project(). Closes #857. 2016-10-10 23:26:40 +03:00
Jussi Pakkanen 3a3db9fc5e Merge pull request #885 from centricular/fix-staticlib-pic-error
Warn if -fPIC is passed instead of pic to static libraries (instead of erroring out)
2016-10-10 21:30:20 +03:00
Jussi Pakkanen 28df8b800e Add an option to select if static libraries are built with -fPIC. 2016-10-10 21:28:28 +03:00
Nirbheek Chauhan 6a002a7bea tests/gnome: Add missing enums.h dep to enums2.c
Was causing intermittent test failures
2016-10-10 23:28:19 +05:30
Nirbheek Chauhan 2d0eb2cec5 Warn if -fPIC is passed instead of pic to static libraries
Also print the name of the static library that has PIC-related issues,
print more details in exceptions, and test for all this.
2016-10-10 23:28:19 +05:30
Jussi Pakkanen e2b3752f87 Show error log options in help. 2016-10-10 19:51:48 +03:00
Guillaume Poirier-Morency a0b04e730e Add a Vala test case for mixed sources 2016-10-10 19:50:51 +03:00
Jussi Pakkanen c2b852c9b3 Created path_join function. 2016-10-10 19:44:28 +03:00
Thibault Saunier 6eacca2024 dependencies: Fix traceback always setting 'variable'
if pkg-config return != 0 and the dep is not required, it will not be set
2016-10-10 19:41:43 +03:00
Jussi Pakkanen 3461e258f0 Merge pull request #875 from mesonbuild/ignatenko/macro
rpm: couple of improvements and fixes
2016-10-10 19:41:00 +03:00
Jussi Pakkanen 933ad618dc Merge pull request #795 from mesonbuild/unittest
Create a framework for unit tests.
2016-10-09 23:28:18 +03:00
Jussi Pakkanen f90bfa5245 Review fixes. 2016-10-09 14:41:47 -04:00
Igor Gnatenko 1e640955b6 fixup! fixup! rpm: couple of improvements and fixes 2016-10-08 17:15:02 +02:00
Igor Gnatenko b0fc370e72 fixup! rpm: couple of improvements and fixes 2016-10-08 17:13:37 +02:00
Igor Gnatenko 0d58ddd739 rpm: couple of improvements and fixes
* Don't hardcode /usr/bin, use %{_bindir}
* Implement %meson_build / %meson_install / %meson_test
* Automatic handling of out-of-tree builds

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-10-08 17:12:20 +02:00
Emanuele Aina 6c50253645 Use argv[0] to internally relaunch meson.py
When installing Meson, distutils may choose to put shim scripts in the
`PATH` that only set up the egg requirements before launching the real
`meson.py` contained in the egg.

This means that `__file__` points to the real `meson.py` file, but
launching it directly is doomed to fail as it's missing the metadata
contained in the shim to set up the path egg, resulting in errors when
trying to import the `mesonbuild` module.

A similar issue affects Meson when installed as a zipapp, with the
current code going great lengths to figure out how to relaunch itself.

Using `argv[0]` avoids these issues as it gives us the way the current
executable has been launched, so we are pretty much guaranteed that
using it will create another instance of the same executable. We only
need to resolve relative paths as the current working directory may
get changed before re-launching the script, and using `realpath()` for
that saves us the trouble of manually resolving links and getting caught
in endless loops.

This also mean that `meson_script_file` no longer necessarily point to a
absolute file, so rename it to `_launcher` which hopefully would be less
prone to inducing false assumptions.
2016-10-08 15:41:31 +02:00
Jussi Pakkanen f0fee2e542 Fix soname to work on OSX. 2016-10-08 14:34:24 +02:00
Jussi Pakkanen 3a002709f4 Pass cmd line args onwards. 2016-10-08 08:06:59 -04:00
Jussi Pakkanen b11a5b93cb Store all invocation output. Not shown to users yet. 2016-10-08 07:54:37 -04:00
Jussi Pakkanen c7936f6819 Run unittests. 2016-10-08 07:44:19 -04:00
Jussi Pakkanen 4dc798dc7e Check that soname matches the filename. Closes #785. 2016-10-08 07:34:39 -04:00
Jussi Pakkanen 9fdec2d23f Created a file to run unit test suite with. 2016-10-08 07:34:39 -04:00