Commit Graph

94 Commits

Author SHA1 Message Date
Jussi Pakkanen 69aa0091b1 The regex to detect version numbers needs to be a bit more complex. Closes #967. 2016-11-02 13:47:38 -07:00
Nirbheek Chauhan 3df75d696d Directly pass the compiler to get_args_from_envvars
Seems better to do this since the behaviour is compiler-specific. Would
be easier to extend this later too in case we want to do more
compiler-specific things.
2016-10-26 23:16:05 +05:30
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
Nirbheek Chauhan bcf20af62e environment: Add support for MinGW/GCC to detect_windows_arch() 2016-09-27 00:27:38 +05:30
Nirbheek Chauhan a001fa0fb6 compilers: Make GCC detection more robust on all platforms
Fixes https://github.com/mesonbuild/meson/issues/650

Also adds new has_define and get_define internal API for querying
pre-processor defines provided by GNU compilers.
2016-09-27 00:27:38 +05:30
Nirbheek Chauhan ac8c8c2ba8 Treat 32-bit compiles on 64-bit Windows as native
It's a terrible user experience to force people building 32-bit
applications on 64-bit Windows to use a cross-info file when every other
tool treats it as a 'native' compilation -- it satisfies all the
requirements for a native compile.

This commit also fixes the platform detection on Windows which would
cause the 'native cpu' to be detected as 32-bit if you installed 32-bit
Python on 64-bit Windows, or if you were building with a 32-bit
toolchain on 64-bit Windows.

Doesn't support MinGW yet -- the next commits will add that since the
changes required for that are more involved.
2016-09-26 19:48:46 +05:30
Elliott Sales de Andrade a2321b24f6 Flatten isinstance calls. (#715)
That is, isinstance(x, y) or isinstance(x, z) can be flattened with a
tuple to isinstance(x, (y, z)).
2016-08-27 15:47:29 +03:00
Matthias Klumpp b80bdf65df Simplify D compiler argument translation 2016-08-21 01:39:48 +02:00
Matthias Klumpp 56823272ab Implement D support
This patch adds support for the D programming language[1] to Meson.

The following compilers are supported:
* LDC
* GDC
* DMD

[1]: http://dlang.org/
2016-08-19 03:02:51 +02:00
Nirbheek Chauhan a5e01fa155 Only append compile flags to the link flags when appropriate
We should only append the compiler flags to the link flags when the
compiler is used as a wrapper around the linker during the link process
2016-08-12 15:34:59 +05:30
Nirbheek Chauhan 01b43e5f0a Print the CFLAGS/LDFLAGS/etc inherited from the environment
People can forget it and then wonder what's wrong. Just explicitly print
it.
2016-08-11 16:09:48 +05:30
Jussi Pakkanen 1d36f68629 Merge pull request #660 from mesonbuild/libdirfix
Fix library directory handling
2016-07-30 20:09:49 +03:00
Jussi Pakkanen 10ab88710b Determine lib paths on demand rather than up front because they might change during build file parsing. 2016-07-30 19:42:01 +03:00
Nirbheek Chauhan 018fa4b90f vs: Fix regen_checker by using the correct coredata mtime
After c01b183e5, the mtime of coredata.dat is always newer than all the
other build files, which made regen_checker think that they always had
to be regenerated. Now we set the mtime of the file to a value before
the build files are generated and that makes everything behave as it did
earlier.
2016-07-29 08:18:59 +05:30
Jussi Pakkanen b072d72f94 Properties is no longer mandatory in cross files so do not require it. 2016-07-20 22:53:26 +03:00
Nirbheek Chauhan 88aafd363e Normalize the path of a configured file to avoid dupes (#640) 2016-07-19 20:10:57 +03:00
Nirbheek Chauhan 69d9c2228d vs: Fix Meson invocation while doing regen (#646)
The Meson script is not always in $scriptdir/../../ -- for instance if
installed with pip on Windows, the scriptdir is in:

C:/Python35/Lib/site-packages/meson-0.33.0.dev1-py3.5.egg/mesonbuild/scripts

and the meson.py script is in:

C:/Python35/Scripts

So, let's save the path available as Environment().meson_script_file
into the coredata.dat private file and use that to invoke Meson when
doing regen.

Also, let's fetch the backend that was used from the coredata too
instead of hard-coding vs2010.

Both these were causing a hard failure while doing regen with msbuild or
visual studio.
2016-07-19 00:00:17 +03:00
Jussi Pakkanen 64919b1c74 Merge pull request #417 from nirbheek/dll-paths
Fix filenames and paths used in DLL shared library generation
2016-07-13 22:18:50 +03:00
Jussi Pakkanen c0057da133 Can get arbitrary data from cross file properties. 2016-07-02 00:00:03 +03:00
Nirbheek Chauhan 0143c32c7c Overhaul versioning and naming of libraries
This commit contains several changes to the naming and versioning of
shared and static libraries. The details are documented at:
https://github.com/mesonbuild/meson/pull/417

Here's a brief summary:

* The results of binary and compiler detection via environment functions
  are now cached so that they can be called repeatedly without
  performance penalty. This is necessary because every
  build.SharedLibrary object has to know whether the compiler is MSVC or
  not (output filenames depend on that), and so the compiler detection
  has to be called for each object instantiation.

* Linux shared libraries don't always have a library version. Sometimes
  only soversions are specified (and vice-versa), so support both.

* Don't use versioned filenames when generating DLLs, DLLs are never
  versioned using the suffix in the way that .so libraries are. Hence,
  they don't use "aliases". Only Linux shared libraries use those.

* OS X dylibs do not use filename aliases at all. They only use the
  soversion in the dylib name (libfoo.X.dylib), and that's it. If
  there's no soversion specified, the dylib is called libfoo.dylib.
  Further versioning in dylibs is supposed to be done with the
  -current_version argument to clang, but this is TBD.

  https://developer.apple.com/library/mac/documentation/DeveloperTools/Conceptual/DynamicLibraries/100-Articles/DynamicLibraryDesignGuidelines.html#//apple_ref/doc/uid/TP40002013-SW23

* Install DLLs into bindir and import libraries into libdir

* Static libraries are now always called libfoo.a, even with MSVC

* .lib import libraries are always generated when building with MSVC

* .dll.a import libraries are always generated when building with
  MinGW/GCC or MinGW/clang

* TODO: Use dlltool if available to generate .dll.a when .lib is
  generated and vice-versa.

* Library and executable suffix/prefixes are now always correctly
  overriden by the values of the 'name_prefix' and 'name_suffix' keyword
  arguments.
2016-07-01 20:50:47 +05:30
Noam Meltzer 3a2334be1b be more resilient for identifying gcc compilers 2016-06-16 20:52:03 +03:00
Jussi Pakkanen 8e734a8c9f Set Gnu fortran type based on platform. 2016-05-30 22:42:11 +03:00
Jussi Pakkanen df03f849a8 Merge pull request #542 from mesonbuild/ownstdlib
Build transparently with a custom standard library
2016-05-25 23:44:24 +03:00
Jussi Pakkanen afe7252476 Can specify a stdlib subproject that is used implicitly on all targets with said language. 2016-05-21 21:46:03 +03:00
Jussi Pakkanen 46ce7a9d4b Merge pull request #516 from centricular/cross-compile_32bit-x86_on_64bit-x86_exe-wrapper
Special-case the 32-bit executable on 64-bit x86 case while cross-compiling
2016-05-01 18:56:07 +03:00
Minijackson 8e94ddf625 Use module path when looking for meson scripts dir 2016-04-28 14:09:44 +02:00
Nirbheek Chauhan 2bdaa1f0c1 Separate out cpu_method to environment.py and add amd64 quirk 2016-04-15 00:25:35 +05:30
Nirbheek Chauhan c0765b0e8d Don't require an exe_wrapper when cross-compiling 32-bit on 64-bit
Almost all 64-bit x86 OSes can run 32-bit x86 binaries natively. Detect
that case and don't require an exe wrapper.
2016-04-15 00:25:34 +05:30
Nirbheek Chauhan 563b978bf2 On failure, print exceptions encountered while searching for compilers (#515) 2016-04-14 21:47:57 +03:00
Jussi Pakkanen cab5ce4fc0 Merge pull request #438 from trhd/testing_options
New options for controlling test output.
2016-04-06 23:10:20 +03:00
Nicolas Schneider eb69b268d4 Revert "Fix Windows. Again."
This reverts commit e522a9f268.
2016-04-05 22:03:57 +02:00
Jussi Pakkanen c7f68c38c6 Merge pull request #496 from mesonbuild/partest
Run tests in parallel
2016-04-04 23:14:45 +03:00
Jussi Pakkanen e0792295bc Whitespace fixing. 2016-04-03 18:00:41 +03:00
Jussi Pakkanen 6291fb4056 Put buildtype flags to vala compiles. 2016-04-03 16:44:18 +03:00
Jussi Pakkanen a42a4d7bf3 If should be elif. 2016-04-02 01:03:13 +03:00
Jussi Pakkanen e522a9f268 Fix Windows. Again. 2016-04-01 23:27:50 +03:00
Hemmo Nieminen 336904b553 Move MesonException from coredata to mesonlib. 2016-04-01 00:52:45 +03:00
Jussi Pakkanen d87eb7d290 Merge branch 'base_options'. 2016-03-20 22:04:24 +02:00
Jussi Pakkanen ae1f284ade Added base options to Clang compilers. 2016-03-18 00:36:39 +02:00
Nirbheek Chauhan 11f63105d0 New builtin option: libexecdir for installation of helper executables 2016-03-17 16:17:06 +05:30
Nicolas Schneider ac5ee0c414 dump coredata to file before calling backend.generate()
This ensures that all build files always have a later timestamp than
coredata.dat, which is used to check if the build files must be
regenerated.
2016-02-25 23:13:29 +01:00
Jussi Pakkanen d88223bd61 Do delayed argument setting properly this time. 2016-02-22 21:28:34 +02:00
Nirbheek Chauhan 21d471673a environment: When using MinGW-GCC, the import lib suffix is dll 2016-02-20 02:17:57 +05:30
Jussi Pakkanen 23b98cd6e6 Renamed meson package to mesonbuild so that we can have a script named meson in the same toplevel dir. 2016-01-16 17:35:29 +02:00