Commit Graph

2977 Commits

Author SHA1 Message Date
Igor Gnatenko 380b362fa4 add support for $sbindir
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-18 00:01:23 +01:00
Nirbheek Chauhan 59b8f11e7e gnome: Re-use gobject-introspection-1.0 pkg-config dependency
Also don't use `dependencies` as a module name since it is commonly used
as a variable name too. Instead, directly import the classes that we use
from that module.
2016-12-17 17:53:52 +02:00
Thibault Saunier 5b5edd6b33 gettext: Respect the --subdir argument before the MESON_SUBDIR var
In the case of subproject we will properly setup the --subdir argument
but the MESON_SUBDIR is never adapted and will point to an empty string
leading to the following backtrace when building `gst-build`:

  msgfmt: error while opening "/home/thiblahute/devel/gstreamer/gst-build/af.po" for reading: No such file or directory
  Traceback (most recent call last):
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/meson.py", line 37, in <module>
      sys.exit(main())
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/meson.py", line 34, in main
      return mesonmain.run(launcher, sys.argv[1:])
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/mesonmain.py", line 248, in run
      sys.exit(run_script_command(args[1:]))
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/mesonmain.py", line 236, in run_script_command
      return cmdfunc(cmdargs)
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/scripts/gettext.py", line 111, in run
      if gen_gmo(src_sub, bld_sub, langs) != 0:
    File "/home/thiblahute/devel/gstreamer/gst-build/meson/mesonbuild/scripts/gettext.py", line 66, in gen_gmo
      '-o', os.path.join(bld_sub, l + '.gmo')])
    File "/usr/lib/python3.5/subprocess.py", line 581, in check_call
      raise CalledProcessError(retcode, cmd)
  subprocess.CalledProcessError: Command '['msgfmt', '/home/thiblahute/devel/gstreamer/gst-build/af.po', '-o', '/home/thiblahute/devel/gstreamer/gst-build/build/af.gmo']' returned non-zero exit status 1
  Failed to run install script: /usr/bin/python3 /home/thiblahute/devel/gstreamer/gst-build/meson/meson.py --internal gettext install --subdir=subprojects/gstreamer/po --localedir=share/locale --pkgname=gstreamer-1.0 --langs=af@@az@@be@@bg@@ca@@cs@@da@@de@@el@@en_GB@@eo@@es@@eu@@fi@@fr@@gl@@hr@@hu@@id@@it@@ja@@lt@@nb@@nl@@pl@@pt_BR@@ro@@ru@@rw@@sk@@sl@@sq@@sr@@sv@@tr@@uk@@vi@@zh_CN@@zh_TW
  FAILED: install
  '/usr/bin/python3' '/home/thiblahute/devel/gstreamer/gst-build/meson/meson.py' '--internal' 'install' '/home/thiblahute/devel/gstreamer/gst-build/build/meson-private/install.dat'
2016-12-17 14:21:27 +02:00
Nirbheek Chauhan 2b842de341 compilers: Ignore -pthread in link flags with MSVC
Sometimes .pc files add -pthread in Libs: instead of -lpthread, so
ignore that too when building with MSVC.
2016-12-17 12:56:01 +02:00
Jussi Pakkanen b389f43060 Revert "Merge pull request #1145 from AlexandreFoley/wrap-fix"
This reverts commit 541dd92ef7, reversing
changes made to 155617e539.
2016-12-15 22:33:25 +02:00
Jussi Pakkanen 21e475b64b Merge pull request #1194 from centricular/critical-bugfixes-vala
A bunch of bugfixes for Vala
2016-12-15 22:20:03 +02:00
Thibault Saunier 925f880e6b introspect: Allow listing all installed files 2016-12-15 22:19:43 +02:00
Igor Gnatenko b80f8b2dc2 rpm: use VPATH macro
This is more or less standardized way to have one variable which
will work for all buildsystems defined in redhat-rpm-config.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-15 20:45:01 +02:00
Nirbheek Chauhan ff8cdf86f4 tests/vala/14: Disable running of GTK+ test
There's no X on the Travis CI, so disable this for now.
2016-12-16 00:11:27 +05:30
Nirbheek Chauhan 5e5b3f00d8 modules: Cache programs found by find_program
This avoids printing several 'Found:' messages during configure, and
also avoids doing several searches for the same binary. This is already
done by the interpreter for `find_program` calls from build files.

Also move it to the module-wide __init__.py file so it can be used by
other modules as-needed.

Also use it for g-ir-scanner where it was missed in one place, also fix
exception name in the same place.
2016-12-16 00:04:38 +05:30
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 de0ce7f25c Add a test that uses hand-written vapi files
To use these, you just need to add the .vapi file to your target as
a source.

This test specifically tests that hand-written vapis referring to
C headers work.
2016-12-15 04:12:23 +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 330d9ba7fe Test target glib version and gresources in Vala
Test that the --target-glib= argument while compiling Vala files is set
properly by using a feature (GtkTemplate) that requires glib >=2.38.

At the same time, also test that the appropriate gresource arguments are
also set for Vala targets. For each gresource.xml that is compiled, we
must pass --gresources=path/to/gresource.xml to valac.
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
Sam Thursfield 627faa0d39 Add a testcase for 'Duplicate outputs' bug
With current Meson, this fails to configure with the following error:

    Duplicate output 'dependency-generated/enum-types.h' from
    'CustomTarget' 'enum-types.h'; conflicts with
    'dependency-generated/enum-types.h' from 'CustomTarget'
    'enum-types.h'
2016-12-15 04:12:23 +05:30
Igor Gnatenko 8c24fc7761 mailmap: add couple of aliases
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-14 14:37:16 +02:00
Igor Gnatenko 0121faf168 rpm: use __global_*flags
Using RPM's %{optflags} is definitely nice, but not enough. LDFLAGS
are not there, and idea of optflags is too generic. It is supposed
to work under CC and CXX, but apparently someone forgot that there
is difference between these two.

%__global_*flags is not part of RPM itself, it's coming within
redhat-rpm-config which makes our macros file not that portable,
but anyway we already have %__global_ldflags and %ninja_build and
no one complained.

Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-13 16:29:57 +02:00
Igor Gnatenko dcd3c21712 rpm: use meson's syntax to specify sourcedir and builddir
When user uses %meson -Denable_cool_feature=true current macro fails
because RPM adds flag after popd:
...
pushd x86_64-redhat-linux-gnu
  /usr/bin/meson ... $OLDPWD/.
popd -Denable_cool_feature

Since meson can accept $srcdir and $builddir arugments we don't have
this problem with pushd/popd. It also simplifies things a bit.

Reported-by: Richard Hughes <richard@hughsie.com>
References: https://bugzilla.redhat.com/show_bug.cgi?id=1401062
Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
2016-12-13 14:20:24 +02:00
Jussi Pakkanen b01d2c35b7 Only add build dir inlude directives if the corresponding dir exists. Closes #1185. 2016-12-13 14:19:34 +02:00
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 3fad3cbb81 Test extracting static objects into a shared library
This was previously broken and we didn't know it. See #1169
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 3e2d894f55 Add test for cc.symbols_have_underscore_prefix
Also add MSVC support while doing so. Doesn't test 32-bit Windows yet
because I can't figure out how to do manual setup for function calls on
Win32 which also does symbol mangling. But this is fine for now.
2016-12-13 09:17:06 +05:30
Nirbheek Chauhan 4967b2a5ea tests/common/124: Print an error when square fails
Otherwise we can't know why it failed and that makes it harder to debug.
2016-12-13 09:17:06 +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
Jussi Pakkanen e128d26b35 Merge pull request #1095 from centricular/llvm-ir-assembly
Implement support for LLVM IR compilation
2016-12-11 14:21:30 +02:00
Jussi Pakkanen f2b3ab826b If/elif fix so running just mesontest actually runs the tests after doing a rebuild. 2016-12-11 14:20:39 +02:00
Jussi Pakkanen 22aedda6d0 Use a big timeout when running gdb interactively and a typo fix. 2016-12-11 14:20:39 +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 38f6fee86d Test that g++ and Clang++ can compile assembly
When there's no C compiler available
2016-12-11 14:54:25 +05:30
Nirbheek Chauhan 0cd11747f1 Add a test for LLVM IR and ASM compilation 2016-12-11 14:52:24 +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 4ef495c596 Do not warn about non-utf8 locales on Windows. 2016-12-10 00:57:09 +02:00