summaryrefslogtreecommitdiff
path: root/mesonbuild/environment.py
Commit message (Collapse)AuthorAgeFilesLines
* Don't use -fPIC on Cygwin, eitherJon Turney2017-04-061-1/+2
| | | | | | | Identify Cygwin-targetted gcc as sui generis (don't use -fPIC, but don't link with standard Windows libraries, either) Update tests appropriately
* Use CPPFLAGS for pre-processor compiler checksNirbheek Chauhan2017-04-041-3/+3
| | | | | | Also don't add CFLAGS twice for links() checks Includes a test for this.
* Use shlex.split() to split CFLAGS/LDFLAGS/etcNirbheek Chauhan2017-04-041-3/+4
| | | | | This allows people to use spaces in the environment variables as long as they use the correct quoting.
* compilers: Rename 'get_define' to 'get_builtin_define'Nirbheek Chauhan2017-04-041-4/+4
| | | | | We will use `get_define` to implement a function that fetches the values of defines from headers.
* Detect 'ccache' in evars and cross-info filesNirbheek Chauhan2017-03-251-4/+18
| | | | | | Then, only use it if it's actually available. Closes https://github.com/mesonbuild/meson/issues/1471
* Use cross stripper when cross compiling and allow overriding native strip ↵Jussi Pakkanen2017-02-271-0/+4
| | | | executable. Closes #1414.
* Fix undefined variables in ObjC/C++ detectionNirbheek Chauhan2017-02-261-6/+8
| | | | Pointed out by Mike Sinkovsky
* Detect GCC type on macOS for ObjC/C++ tooNirbheek Chauhan2017-02-211-2/+4
| | | | | | | These compilers are available in MinGW and can be built on macOS. More interestingly, `gcc` is a wrapper around `clang` on macOS, so we will detect the compiler type incorrectly on macOS without this.
* Support passing of options to compilers and linkersNirbheek Chauhan2017-02-211-4/+2
| | | | | | | | If you pass options, the last element in the array won't be the compiler basename, so just check if the basename is in the exelist somewhere. Includes a test.
* Use the same function for detection of C and C++ compilersNirbheek Chauhan2017-02-211-46/+16
| | | | | The mechanism is identical which means there's a high likelihood of unintended divergence. In fact, a slight divergence was already there.
* Fix static linker exelist in cross-info and environmentNirbheek Chauhan2017-02-211-9/+11
| | | | | | | | https://github.com/mesonbuild/meson/pull/1406 had an incomplete fix for this. The test case caught it. Note: this still doesn't test that setting it in the cross-info works, but it's the same codepath as via the environment so it should be ok.
* Fix compiler exelist in cross-info and the environmentNirbheek Chauhan2017-02-211-2/+2
| | | | | | | | https://github.com/mesonbuild/meson/pull/1406 had an incomplete fix for this. The test case caught it. Note: this still doesn't test that setting it in the cross-info works, but it's the same codepath as via the environment so it should be ok.
* environment: Use shlex.split() to get AR from the envNirbheek Chauhan2017-02-211-1/+1
| | | | That way if the path has spaces, it won't get messed up.
* Detect (non-Apple) clang as objc/c++ compilerHase Bastian2017-02-211-0/+4
| | | | See https://github.com/mesonbuild/meson/pull/1388
* Factor out common code in compiler detectionNirbheek Chauhan2017-02-211-117/+65
| | | | | This was being duplicated across C/C++/ObjC/ObjC++/Fortran and hence was behaving slightly differently in each.
* Fix the rest of them.Jussi Pakkanen2017-02-191-18/+20
|
* Fix compiler detection + cross when envvar not set.Jussi Pakkanen2017-02-191-21/+23
|
* Merge pull request #1396 from fabio-porcedda/cross-ccacheJussi Pakkanen2017-02-191-5/+8
|\ | | | | cross_file: add support for "ccache"
| * detect_c_compiler(): support extra commands and arguments in the stringFabio Porcedda2017-02-171-4/+6
| | | | | | | | | | | | | | | | | | | | - Hanlde correctly a multi command string in evironment variable, e.g.: CC="ccache gcc" meson - Handle correctly a list for the cross-file option, e.g: [binaries] c = ['ccache', '/usr/local/bin/mips-linuc-gcc'] This commit fixes #1392.
| * detect_c_compiler(): use shlex.split() instead of str.split() for envFabio Porcedda2017-02-171-1/+2
| | | | | | | | | | Use shlex.split() for splitting the env var instead of str.split() to handle quoting and spaces in paths.
* | Detect x86/amd64 from the compilers because system info may be incorrect.Jussi Pakkanen2017-02-121-0/+21
|/
* cleanup: Remove redundant parenthesesMike Sinkovsky2017-01-181-5/+5
|
* cleanup: Unused local variablesMike Sinkovsky2017-01-181-1/+0
|
* style: [E1**] IndentationMike Sinkovsky2017-01-111-1/+1
|
* style: [E301] expected 1 blank line, found 0Mike Sinkovsky2017-01-111-0/+1
|
* Created a Python 3 module for simpler building of Python extension modules.Jussi Pakkanen2017-01-091-0/+8
|
* We only need Ninja 1.5.x for the core codeNirbheek Chauhan2017-01-091-3/+3
| | | | | | | This change helps us run on older distros such as Ubuntu LTS which is very lazy in updating even non-core and stable packages such as Ninja. Ninja 1.6.x is only needed for running the tests.
* ICC 17.0.0 working for Linux and Ninja Backend.Philipp Geier2017-01-041-0/+8
| | | | | | | | | | | Added IntelCompiler, IntelCCompiler and IntelCCompiler. environments.py has been changed to detect icc and icpc. ninjabackend changed for proper pch generation. ICC 17.0.0 does not support C++13 (that's why default arguments tests fails). Test 25 object extraction fails due to some unescaped whitespaces. Some test with vala fail because of successful build, although they should fail, as warning do not exit with failure.
* fix for cross-builds targeting macosxMike Sinkovsky2017-01-021-1/+1
|
* style: fix E128 violationsIgor Gnatenko2017-01-011-3/+6
| | | | | | E128: continuation line under-indented for visual indent Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* style: fix E225 violationsIgor Gnatenko2017-01-011-1/+1
| | | | | | E225: missing whitespace around operator Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* Fix space before :.Jussi Pakkanen2016-12-311-1/+1
|
* Merge pull request #1233 from mesonbuild/wip/ignatenko/code-styleJussi Pakkanen2016-12-211-2/+2
|\ | | | | Trivial cleanups in code
| * tree-wide: use proper 'not in' notationIgor Gnatenko2016-12-191-2/+2
| | | | | | | | | | | | Let's be more pythonic and 'not is' seems really weird. Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
* | Fix several more lint errorsNirbheek Chauhan2016-12-201-11/+7
|/ | | | | | | | | | | | | | | | | | | Found by Igor Gnatenko ************* Module mesonbuild.interpreter E:1232,33: No value for argument 'interp' in constructor call (no-value-for-parameter) ************* Module mesonbuild.dependencies E: 68, 4: An attribute defined in mesonbuild.dependencies line 39 hides this method (method-hidden) ************* Module mesonbuild.environment E: 26, 0: class already defined line 19 (function-redefined) E: 68,18: Undefined variable 'InterpreterException' (undefined-variable) E:641,39: Undefined variable 'want_cross' (undefined-variable) E:850,94: Undefined variable 'varname' (undefined-variable) E:854,94: Undefined variable 'varname' (undefined-variable) E:860,102: Undefined variable 'varname' (undefined-variable) E:863,94: Undefined variable 'varname' (undefined-variable) ************* Module mesonbuild.modules.gnome E:438,26: Undefined variable 'compilers' (undefined-variable)
* Fix PGI Fortran compiler detection.Jussi Pakkanen2016-12-181-1/+1
|
* unity builds: Assembly and LLVM IR are incompatibleNirbheek Chauhan2016-12-111-0/+3
| | | | | | | 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.
* compilers: Implement support for LLVM IR compilationNirbheek Chauhan2016-12-111-0/+3
| | | | | | | | | | | | | 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
* Use universal_newlines=True for all Popen callsNirbheek Chauhan2016-12-111-54/+15
| | | | | | | | | | | 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
* Always catch PermissionError while looking for NinjaNirbheek Chauhan2016-11-261-1/+2
| | | | | | Also convert a few other generic `except Exception`s to be more specific Closes #1088
* Removed Valgrind from core.Jussi Pakkanen2016-11-181-6/+0
|
* environment: Use GNU defines to get version of c, c++, objc and fortranPaulo Antonio Alvarez2016-11-111-0/+4
| | | | | | | According to https://gcc.gnu.org/onlinedocs/cpp/Common-Predefined-Macros.html, the macros used to get the version are always defined for those languages, so use them to get the version.
* environment: Static method to get gcc version from compiler definesPaulo Antonio Alvarez2016-11-111-0/+7
| | | | | | The method takes a dictionary with defines names as keys and the defines values as values. From it, we assemble the gcc version, using 0 as a default value if the define we want is not defined.
* The regex to detect version numbers needs to be a bit more complex. Closes #967.Jussi Pakkanen2016-11-021-61/+32
|
* Directly pass the compiler to get_args_from_envvarsNirbheek Chauhan2016-10-261-4/+8
| | | | | | 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.
* Use argv[0] to internally relaunch meson.pyEmanuele Aina2016-10-081-6/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* environment: Add support for MinGW/GCC to detect_windows_arch()Nirbheek Chauhan2016-09-271-3/+2
|
* compilers: Make GCC detection more robust on all platformsNirbheek Chauhan2016-09-271-37/+65
| | | | | | | 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.
* Treat 32-bit compiles on 64-bit Windows as nativeNirbheek Chauhan2016-09-261-9/+75
| | | | | | | | | | | | | | | 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.
* Flatten isinstance calls. (#715)Elliott Sales de Andrade2016-08-271-1/+1
| | | | That is, isinstance(x, y) or isinstance(x, z) can be flattened with a tuple to isinstance(x, (y, z)).