Commit Graph

871 Commits

Author SHA1 Message Date
Nirbheek Chauhan d5f7ba862b gnome.mkenums: Use absolute paths for all commandline args
Closes #973

test cases/vala/8 generated sources/ tests this.
2016-12-15 14:58:43 +05:30
Nirbheek Chauhan e6f48a03fc Allow all code to access module target classes
It is often useful to be able to check if a specific object is of a type
defined in a module. To that end, define all such targets in
modules/__init__.py so that everyone can refer to them without poking
into module-specific code.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan 79f6626867 Pass --gresources to valac for each compiled gresource
Without this, the user has to both compile the resource with
gnome.compile_resources, pass that to the target sources, and also
pass --gresources=/path/to/gres.xml to vala_args in the target.

With this, we will do that automatically.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan 807a53c6fc PkgConfigDependency.version_reqs must be a list
If it isn't, the --target-glib check in generate_vala_compile will
iterate over the version_reqs as a string and fail to add the
--target-glib argument.
2016-12-15 04:12:23 +05:30
Nirbheek Chauhan fc540b72a6 vala: Fix duplicate output detection
The same vapi or vala might be added multiple times. Don't freak out if
that happens. Only freak out if a vapi or vala generated source by the
same name and the output same path is added twice.

This should never happen anyway since we would refuse to create the
target in the first place in theory, but it might happen because of bugs
in generators and custom targets.

Closes #1084
2016-12-15 04:12:23 +05:30
Jussi Pakkanen de83e94b5a Merge pull request #1171 from centricular/fix-extracted-generated-prebuilt-object-targets-linking
Several fixes to how we handle objects in build targets
2016-12-13 12:22:11 +02:00
Jussi Pakkanen 07679f0330 Merge pull request #1184 from centricular/cc.prefixes_underscore
Add a new compiler function 'symbols_have_underscore_prefix'
2016-12-13 12:21:50 +02:00
Nirbheek Chauhan 2c83bd16fc Test targets with only generated and prebuilt objects 2016-12-13 09:37:48 +05:30
Nirbheek Chauhan 038b15a7b2 Add __repr__ for ExtractedObjects and better error for Vala libraries 2016-12-13 09:37:47 +05:30
Nirbheek Chauhan d766475176 Use the linker to determine if we are using MSVC
This is much more accurate since this is actually what determines what
file naming to use and whether there will be PDB debugging information
or not.

Closes #1169
2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 82a77609e8 Query the target itself for the dynamic linker
This greatly improves the logic for determining the linker. Previously,
we would completely break if a target contained only extracted objects
and we were using more than one compiler in our project.

This also fixes determination of the linker if our target only contains
generated objc++ sources, and other funky combinations.
2016-12-13 09:37:47 +05:30
Nirbheek Chauhan 0fc4ad2a0b Also use objects to populate target compilers
This avoids us having no compilers at all for targets that are composed
entirely of objects with no sources.

Now we will always have a compiler for a target even if it is composed
entirely of objects generated with custom targets unless it has
completely unknown sources.
2016-12-13 09:20:34 +05:30
Nirbheek Chauhan 7b3d00fee4 Use dict for self.build.compilers instead of list
Everywhere we use this object, we end up iterating over it and comparing
compiler.get_language() with something. Using a dict is the obvious
choice and simplifies a lot of code.
2016-12-13 09:20:34 +05:30
Nirbheek Chauhan 5240688f5c compilers: Fix output ext while compile-only on MSVC
When doing a compile-only self.compile() check, cl.exe expects an output
file of type *.obj, and passing it `output.exe` makes it write the
compiled object to `output.exe.obj`. Detect when we're doing
a compily-only check and change the suffix ourselves.

This is fine most of the time, but fails when you need to inspect the
compiled file manually.

Also store stdout/stderr on the returned object.
2016-12-13 09:17:06 +05:30
Nirbheek Chauhan 09f65b7a3c New compiler function 'symbols_have_underscore_prefix'
Check if the compiler prefixes an underscore to global symbols. 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.

C symbol mangling is platform and architecture dependent, and a helper
function is needed to detect it. Eg: Windows 32-bit prefixes underscore,
but 64-bit does not. Linux does not prefix an underscore but OS X does.
2016-12-13 09:17:06 +05:30
Elliott Sales de Andrade ec47db6c0c Add Compiler.has_multi_arguments method.
It allows checking if a compiler supports a multi-argument option.
2016-12-12 23:34:03 +02:00
Patrick Griffis c42167dc6f gnome.gtkdoc(): Include builddir variant of include dirs also
This avoids the need for users to constantly join paths themselves
as this is commonly included.
2016-12-12 21:01:49 +02:00
Jussi Pakkanen 5787a4b4fb Make Java compilation work with inner classes. Closes #1157. 2016-12-12 21:01:10 +02:00
Nirbheek Chauhan 70f39ee21e unity builds: Assembly and LLVM IR are incompatible
Can't just #include them and use them directly in unity builds. Inline
assembly is a thing, but it's not trivial and is deprecated with some
compilers. Just build them separately and link them in. Ideally the user
would then use LTO to ensure the same result.
2016-12-11 14:54:30 +05:30
Nirbheek Chauhan 04c1909a4d compilers: Implement support for LLVM IR compilation
Also C++ compilers can build .S assembly files. This wasn't noticed
earlier because most people were also using C compilers in their C++
projects and we would fall back to using the C compiler for building the
assembly files. Now we have a test for this.

This was trivial to add; except that we needed a new LLVM IR rule
because the compiler emits warnings if you pass any special arguments to
it such as include arguments or dependency arguments.

Closes #1089
2016-12-11 14:54:30 +05:30
Nirbheek Chauhan 60716fcd6d Use universal_newlines=True for all Popen calls
Instead of adding it everywhere manually, create a wrapper called
mesonlib.Popen_safe and use that everywhere that we call an executable
and extract its output.

This will also allow us to tweak it to do more/different things if
needed for some locales and/or systems.

Closes #1079
2016-12-11 01:59:58 +02:00
Nirbheek Chauhan be04aa2a0b has_function: Fix checking for builtins with includes
We were checking for builtins explicitly like this because the ordinary
checks don't work for builtins at all. We do exactly the same check as
Autoconf and it doesn't work with Autoconf either (Autoconf is broken!)

So now we check for it in two ways: if there's no #include in prefix, we
check if `__builtin_symbol` exists (has_function allows checking for
functions without providing includes). If there's a #include, we check
if `symbol` exists.

The old method was causing problems with some buggy toolchains such as
MSYS2 which define some builtins in the C library but don't expose them
via headers which meant that `__builtin_symbol` would be found even
though `symbol` is not available.

Doing this allows people to always get the correct answer as long as
they specify the includes that are required to find a function while
also not forcing people to always specify includes to find a function
which is cumbersome.

Closes #1083
2016-12-10 23:18:17 +02:00
Patrick Griffis c75b5886da gnome.gtkdoc(): Include -rpath for gtkdoc-scangobj
Without libtool it is our job to ensure local libraries are picked up.
2016-12-10 01:05:26 +02:00
Nirbheek Chauhan 2c5680d721 python3 dep: Check arch of libraries before using
On Windows, we can build with both 32-bit and 64-bit compilers, but the
Python is either 32-bit or 64-bit. Check the architecture of the found
Python libraries and don't use them if they don't match our
build_machine.

Also skip the tests if the Python 3 dependency is not found.
2016-12-10 00:58:50 +02:00
Jussi Pakkanen f62f730821 Merge pull request #1126 from mesonbuild/sharedmodule
Support for shared modules
2016-12-07 21:49:16 +02:00
Nirbheek Chauhan f5a9b3b249 Fix shared module support on Windows
Unlike Linux and OS X, when a library is loaded, all the symbols aren't
loaded into a single namespace. You must fetch the symbol by iterating over
all loaded modules.

So, we shouldn't use /FORCE:UNRESOLVED since that is not what modules do
on Windows. Instead, we now do exactly what GModule does on Windows.

Also use `void` for functions that take no arguments.
2016-12-07 05:44:34 +05:30
Jussi Pakkanen dc1f537fb3 Skip shared module test on VS because it fails for some reason nobody understands. 2016-12-07 00:30:28 +02:00
Jussi Pakkanen d1501e39d5 Merge pull request #1086 from Keruspe/master
Allow specifying some toolchain executables using env
2016-12-06 23:43:36 +02:00
Jussi Pakkanen c58da4ee52 Merge pull request #1151 from mesonbuild/tingping/gtk-doc
gnome: Various improvements to gtkdoc
2016-12-06 23:27:41 +02:00
Jussi Pakkanen 59fdb1b9ff Add unresolved symbol arg to link line in VS backends. For some
reason VS does not pick it up even though it is visible in the linker
option box.
2016-12-06 21:35:31 +02:00
Patrick Griffis e265887ac3 gnome.gtkdoc(): Add keyword to override the mode
I'm not entirely sure if you ever want to mix and match but
I can say that glib required none of them to be passed so
this allows for that.
2016-12-06 14:07:45 -05:00
Nirbheek Chauhan b9a7c0cf39 misc: Use relative imports everywhere
Using 'mesonbuild' as the module can cause it to use the
system-installed module and can also break if we rename the directory,
so avoid that by always using relative imports.
2016-12-07 00:24:17 +05:30
Nirbheek Chauhan 7b8f41ce31 Compiler checks can only accept external dependencies
This is already how it should've been, but:

a) The test for this was wrong since Dependency is a base class for all
dependencies and isinstance on an InternalDependency will also be true
b) Internal dependencies can't ever be used here anyway because compiler
checks are always run at configure time and internal dependencies are
only built after that.
2016-12-07 00:08:16 +05:30
Jussi Pakkanen 541dd92ef7 Merge pull request #1145 from AlexandreFoley/wrap-fix
build regeneration can update wrap-git and wrap-hg in some cases.
2016-12-06 20:31:24 +02:00
Patrick Griffis 155617e539 i18n: Improve language handling
- Fix LINGUAS changes not being picked up
- Fix multiple langs per line in LINGUAS
- Make empty languages acceptable

Fixes #1127
2016-12-06 20:29:20 +02:00
Jussi Pakkanen b28da68faf Expose project information with mesonintrospect. Closes #1118. 2016-12-06 20:27:59 +02:00
Nirbheek Chauhan c7a2664cb7 Better error when passing invalid objects to install_header
This will print the object type when you pass a generated file to
install_header instead of printing an assert.
2016-12-06 20:27:33 +02:00
Igor Gnatenko c9818c02ec add builtin support for localstatedir
Reported-by: Richard Hughes <richard@hughsie.com>
Closes: https://github.com/mesonbuild/meson/issues/1142
Signed-off-by: Igor Gnatenko <ignatenko@redhat.com>
2016-12-06 20:27:02 +02:00
Jussi Pakkanen 66ed54a94e Merge pull request #1144 from valum-framework/always-add-version-in-pkg-config
pkgconfig: 'Version' must be specified, even if it's empty
2016-12-06 20:26:30 +02:00
Patrick Griffis d764c7dc91 gnome.gtkdoc(): Add namespace keyword 2016-12-06 13:23:58 -05:00
Jussi Pakkanen 228a9035af Merge pull request #1103 from mesonbuild/rewriter
Beginnings of a rewriter
2016-12-06 20:22:04 +02:00
Alexandre Foley 27cd8c1e28 The “directory present and not empty” return condition was necessary for subproject to work without a wrap file. Put it back with that added condition that there mustn’t be a wrap file present for returning the package immediately. 2016-12-06 12:32:39 -05:00
Patrick Griffis a626d1a7bc gnome.gtkdoc(): Allow passing multiple source dirs
This is valid and used by glib for example.
2016-12-06 12:23:29 -05:00
Patrick Griffis 9b560c29b6 gnome.gtkdoc(): Fix including doc source dir in path 2016-12-06 10:58:18 -05:00
Alexandre Foley 61d5934e63 Added a few missing whitespace as noted by Ignatenkobrain. Replaced a comment by the piece of code it said was needed. 2016-12-06 09:45:20 -05:00
Guillaume Poirier-Morency ff55e848f6 pkgconfig: Raise an error if 'version' is not specified 2016-12-05 22:46:32 -05:00
Alexandre Foley 228adaa287 Wrap.py: Made it so using an already downloaded subproject is only for the wrap-file case. Git and Mercurial can update the repository if it the wrap is one.
Also did a bit of cleanup.
interpreter.py: There’s a catch all except clause at the line 1928, it didn’t give the user any information whatsoever about the exception it caught. Now it at least print it to the log as a warning.
2016-12-05 17:25:36 -05:00
Guillaume Poirier-Morency 6389e70c11 pkgconfig: 'Version' must be specified, even if it's empty 2016-12-05 11:23:04 -05:00
Marc-Antoine Perennou a70f39f815 allow overriding nm with NM
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-12-05 10:57:10 +01:00
Marc-Antoine Perennou 4d3cce1532 allow overriding readelf with READELF
Signed-off-by: Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
2016-12-05 10:57:10 +01:00