Commit Graph

188 Commits

Author SHA1 Message Date
Dylan Baker 83ad728e19 mesonlib: use collections.abc for abc types
The use of ABC classes (like MutableSet) is deprecated currently, in
python 3.8 the aliases in collections will be dropped and only the ones
in collections.abc will remain. collections.abc has existed since python
3.3, so there is no backwards compatibility risk.
2018-09-20 18:59:16 +03:00
Jon Turney 73b47e0025 Fix incorrect feature check warning
Fix the special handling of '>=0.nn' constraints in project(meson_version:)
for feature checks when the constraint version contains spaces
2018-09-16 00:46:50 +03:00
Jon Turney 1394cb9263 Correct version_compare_condition_with_min()
Correct version_compare_condition_with_min() for the case where no minimum
version is established by the version constraint.  Add a simple test.

Also fix test_feature_check_usage_subprojects by escaping regex
metacharacters.

if |condition| is '<', '<=' or '!=', the minimum version satisfying the
condition is 0, so the minimum version for a feature is never met.

if |condition| is '>=' or '==', the minimum version satisfying the condition
is the version compared with, so the minimum version for a feature must be
less than or equal to that.

if |condition| is '>', the minimum version satisfying the condition is
greater than the version compared with, so the minimum version for a feature
must be less than that

(it's this last condition that makes this function necessary, as in all
other cases we could establish a definite minimum version which we could
compare to see if it's less than or equal to the current version)
2018-09-12 15:38:00 +01:00
Jon Turney eb260f6141 Allow features added in 0.nn.0 to be used when version constraint is '>=0.nn' 2018-09-12 15:38:00 +01:00
Jon Turney da2c4ad3a8 Use the exact current version in obtainMesonOutput
Currently this trims '0.48.0.dev1' to '0.48.0', and then requires exactly
that version in the generated meson.build for the test.

Just use the exact version.

Also only use a 'project(meson_version:)' constraint in the generated
project if a version is specified

Also remove unused grab_leading_numbers
2018-09-12 15:37:52 +01:00
Jon Turney 4df39ca52f
Re-implement version_compare_condition_with_min likewise
Also remove unused version_compare_with_max
Also remove now unused make_same_len
2018-09-11 16:30:19 +01:00
Jon Turney 47d0a13482
Re-implement version_compare using RPM-style version comparison 2018-09-11 16:30:15 +01:00
Nirbheek Chauhan 6c8f81333a PkgConfigDependency: Fix library path search order
We were searching the library paths in the reverse order, which meant
that we'd pick libraries from the wrong prefix.

Closes https://github.com/mesonbuild/meson/issues/3951
2018-08-08 05:45:45 -07:00
Niklas Claesson c0c2455e3c Prints error message instead of backtrace on fail 2018-08-07 06:39:24 -07:00
George Koehler e0ed1ceae2 Refactor getting the host system of a cross compiler
Use mesonlib.for_windows or mesonlib.for_cygwin instead of
reimplementing them.

Add CrossBuildInfo.get_host_system to shorten the repeated the code in
the mesonlib.for_<platform> methods.
2018-08-07 04:19:35 -07:00
Jussi Pakkanen e75f6e4305
Merge pull request #3850 from mesonbuild/nirbheek/exe-wrapper-compiler-fallbacks
Be more permissive about not-found exe_wrapper
2018-07-31 19:33:06 +03:00
Nirbheek Chauhan 8cfb8fd02c
Fix searching of shared libraries on OpenBSD (#3851)
* get_library_naming: Use templates instead of suffix/prefix pairs

This commit does not change functionality, and merely sets the
groundwork for a more flexibly naming implementation.

* find_library: Fix manual searching on OpenBSD

On OpenBSD, shared libraries are called libfoo.so.X.Y where X is the
major version and Y is the minor version. We were assuming that it's
libfoo.so and not finding shared libraries at all while doing manual
searching, which meant we'd link statically instead.

See: https://www.openbsd.org/faq/ports/specialtopics.html#SharedLibs

Now we use file globbing to do searching, and pick the first one
that's a real file.

Closes https://github.com/mesonbuild/meson/issues/3844

* find_library: Fix priority of library search in OpenBSD

Also add unit tests for the library naming function so that it's
absolutely clear what the priority list of naming is.

Testing is done with mocking on Linux to ensure that local testing
is easy
2018-07-09 09:45:02 -07:00
Nirbheek Chauhan 416a00308f cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
2018-07-09 04:09:46 +05:30
Nirbheek Chauhan 2093d45a4e Print a more usable message when a subproject fails to configure
Instead of just printing the message in the exception, if it's
a MesonException, also print the file and the line number. If it's an
unknown exception, print the entire traceback so that we can pin-point
what the Meson bug causing it is.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 80392225a6 Raise a MesonException when substituting an invalid value
Avoids throwing a traceback. Also, warn when setting such a value.
2018-07-07 04:33:24 -07:00
Nirbheek Chauhan 602e58d398 configure_file: Don't optimize away substitutions
It's possible that the configuration data object has components added
conditionally, and that sometimes an empty configuration data object
is passed on purpose.

Instead, we do the substitution and also warn if no tokens were found
that could've been substituted.

Closes https://github.com/mesonbuild/meson/issues/3826
2018-07-04 00:25:01 +00:00
Nirbheek Chauhan a1d9adba09 FeatureNew: Make all checks subproject-specific
We now pass the current subproject to every FeatureNew and
FeatureDeprecated call. This requires a bunch of rework to:

1. Ensure that we have access to the subproject in the list of
   arguments when used as a decorator (see _get_callee_args).
2. Pass the subproject to .use() when it's called manually.
3. We also can't do feature checks for new features in
   meson_options.txt because that's parsed before we know the
   meson_version from project()
2018-07-02 19:52:53 +05:30
Salamandar df1970d3ad Various bug fixes for FeatureNew
* Use _get_callee_args to unwrap function call arguments, needed for
  module functions.

* Move some FeatureNewKwargs from build.py to interpreter.py

* Print a summary for featurenew only if conflicts were found. The
  summary now only prints conflicting features.

* Report and store featurenew/featuredeprecated only once

* Fix version comparison: use le/ge and resize arrays to not fail on
  '0.47.0>=0.47'

Closes https://github.com/mesonbuild/meson/issues/3660
2018-07-02 07:05:08 +00:00
Nirbheek Chauhan c9a89027ac run_command: Add new kwarg 'capture'
capture: false means we won't try to read the stdout at all.

Closes https://github.com/mesonbuild/meson/issues/3364
2018-06-18 10:51:46 +00:00
Sander Sweers 47785bf89b Add file encoding to configure_file
Input files can be in any file encoding, not just utf-8 or isolatin1. Meson
should not make assumptions here and allow for the user to specify the
encoding to use.
2018-06-09 18:17:48 +00:00
Marvin Scholz d777ffc040 Fix #mesondefine token error message formatting 2018-06-03 21:28:47 +03:00
Filipe Brandenburger df2f6a71e7 Make windows_proof_rmtree resilient to read-only files
Start the process by traversing the tree and adding the S_IWRITE and
S_IREAD bits to the file's mode (which are also preserved on Windows.)

This fixes windows_proof_rmtree's inability to remove read-only files,
which was uncovered in testing the new `install_mode` feature.

Tested: ./run_tests.py passes on Linux, appveyor CI on Windows passes.
2018-06-02 04:50:32 +00:00
Jussi Pakkanen bf2e21ec0e
Merge pull request #3486 from Salamandar/salamandar/meson_version_introspection
Add FeatureNew and FeatureDeprecated, to alert the user of bad meson_version
2018-06-01 22:53:06 +03:00
Nirbheek Chauhan 0a035dea6d Set the meson command to use when we know what it is
Instead of using fragile guessing to figure out how to invoke meson,
set the value when meson is run. Also rework how we pass of
meson_script_launcher to regenchecker.py -- it wasn't even being used

With this change, we only need to guess the meson path when running
the tests, and in that case:

1. If MESON_EXE is set in the env, we know how to run meson
   for project tests.
2. MESON_EXE is not set, which means we run the configure in-process
   for project tests and need to guess what meson to run, so either
   - meson.py is found next to run_tests.py, or
   - meson, meson.py, or meson.exe is in PATH

Otherwise, you can invoke meson in the following ways:

1. meson is installed, and mesonbuild is available in PYTHONPATH:
   - meson, meson.py, meson.exe from PATH
   - python3 -m mesonbuild.mesonmain
   - python3 /path/to/meson.py
   - meson is a shell wrapper to meson.real
2. meson is not installed, and is run from git:
   - Absolute path to meson.py
   - Relative path to meson.py
   - Symlink to meson.py

All these are tested in test_meson_commands.py, except meson.exe since
that involves building the meson msi and installing it.
2018-06-01 19:20:04 +00:00
Mathieu Duponchelle 14750b50ea configure_file: Add output_format kwarg (#3636)
* configure_file: Add output_format kwarg

* docs: Reference-manual.md output_format was added in 0.47 [skip ci]
2018-06-01 17:53:07 +00:00
Salamandar dd91f96867 Move target_version from coredata to mesonlib 2018-06-01 14:23:24 +02:00
Salamandar ae19fec952 Add version_compare_condition_with_{min,max} for specific comparison utils.
Split FeatureNew and FeatureDeprecated
Implement features report to be printed in some 'dev mode'
2018-06-01 14:23:24 +02:00
Nirbheek Chauhan f56b402a5b Revert "mesonlib: handle meson exe wrappers"
This reverts commit 0627e9d616.

Breaks installation: https://github.com/mesonbuild/meson/issues/3647

Will be restored once that can be fixed.
2018-05-31 15:40:10 +05:30
Martin Kelly 0627e9d616 mesonlib: handle meson exe wrappers
There are cases when it is useful to wrap the main meson executable with
a script that sets up environment variables, passes --cross-file, etc.
For example, in a Yocto SDK, we need to point to the right meson.cross
so that everything "just works", and we need to alter CC, CXX, etc. In
such cases, it can happen that the "meson" found in the path is actually
a wrapper script that invokes the real meson, which may be in another
location (e.g. "meson.real" or similar).

Currently, in such a situation, meson gets confused because it tries to
invoke itself using the "meson" executable (which points to the wrapper
script) instead of the actual meson (which may be called "meson.real" or
similar). In fact, the wrapper script is not necessarily even Python, so
the whole thing fails.

Fix this by using Python imports to directly find mesonmain.py instead
of trying to detect it heuristically. In addition to fixing the wrapper
issue, this should make the detection logic much more robust.
2018-05-30 18:29:16 +00:00
Nirbheek Chauhan cf5fe1d440 for_darwin: Also accept system='ios' in cross files 2018-05-21 23:19:38 +05:30
Jasper Lievisse Adriaanse 3729e127ff add linker flag to handle $ORIGIN on OpenBSD 2018-05-04 23:42:04 +00:00
Robin c2f062a02e Fix encoding bug on Windows 2018-04-14 21:56:24 +03:00
David Fort 6dea177774 add support for cmakedefine in configure_file()
The added format argument for configure_file allows to specify the kind of
file that is treated. It defaults to 'meson', but can also have the 'cmake'
or 'cmake@' value to treat config.h.in files in the cmake format with #cmakedefine
statements.
2018-04-08 22:00:45 +03:00
Jussi Pakkanen 58156ef7cf Grab a file lock on the build dir during modifications. 2018-03-20 22:28:37 +02:00
Nirbheek Chauhan d012b5b997 Create a helper for checking if a string has a path component
This is used in a number of places, and in some places it is incomplete.
Use a helper to ensure it's used properly.
2018-03-19 23:45:43 +02:00
Mathieu Duponchelle 9f7bdedc94 mesonlib: fix meson detection (again)
Starting from 8fc4244187, tests
failed on my system (python 3.6 arch) because
shutil.which('meson.py') returns 'meson.py', not './meson.py'.

Refactor that codepath by using os.path.isabs instead of
"m_dir == '.'", also remove the adjacent comment because
it doesn't make much sense.
2018-03-07 19:56:24 +02:00
Nirbheek Chauhan aeee01f639 rmtree: Don't retry when the file is not found
No need to pointlessly loop for several seconds in this case.
2018-02-20 00:19:11 +02:00
Nirbheek Chauhan 657d9f2b29 Support running out-of-tree tests against a meson in PATH
Closes https://github.com/mesonbuild/meson/issues/3015
2018-02-20 00:17:18 +02:00
Robert Bragg 6f510ca695 Don't version shared libraries for Android
Android's loader doesn't handle shared library versioning so this avoids
adding a suffix to the filename or soname for Android hosts.
2018-02-04 00:49:16 +02:00
Aleksey Filippov 2cf85ae16f Use os.path: basename() and dirname() instead of split()
According to Python documentation[1] dirname and basename
are defined as follows:
    os.path.dirname() = os.path.split()[0]
    os.path.basename() = os.path.split()[1]
For the purpose of better readability split() is replaced
by appropriate function if only one part of returned tuple
is used.

[1]: https://docs.python.org/3/library/os.path.html#os.path.split
2018-01-30 07:08:22 +11:00
Salamandar 93ba30751e dump_conf_header should rewrite file only if modified (just like do_conf_file) (#2952) 2018-01-30 06:33:38 +11:00
Jussi Pakkanen dfd368d405
Merge pull request #2803 from dcbaker/wip/freebsd-fixes
various BSD fixes
2018-01-09 22:08:00 +02:00
Jussi Pakkanen 392b3d8bc7
Merge pull request #2840 from alyst/fix_detect_location
Fix meson location detection from other meson tools
2018-01-07 19:27:19 +02:00
Dylan Baker 660dee1e10 LLVM: use DragonFly BSD workaround on FreeBSD as well 2018-01-06 13:49:34 -08:00
Dylan Baker 10a560a411 compilers: fix unittest "16 prebuilt shared" on dragonfly bsd 2018-01-06 13:49:34 -08:00
Jussi Pakkanen 0538009d30 Bump minimum supported Python from 3.4 to 3.5. 2018-01-04 21:29:02 +02:00
Alexey Stukalov da44a93daa normpath to bundled meson executable
add comments clarifying when the 1st method of finding meson.py may fail
2018-01-03 14:58:30 +01:00
Alexey Stukalov 8fc4244187 fix meson location detection if run by wraptool
teach detect_meson_py_location() that meson.py is not the
only one meson executable (there's wraptool + legacy scripts)
that could be installed to the PATH folder

fixes #2810
2018-01-03 14:58:09 +01:00
Benjamin Redelings c62078dae5 Add missing for_linux( ) function. 2018-01-01 22:42:49 -08:00
Jussi Pakkanen ff98407ade Dead code removal. 2017-12-21 21:06:17 +02:00
Jussi Pakkanen 164fb9a150 Also promote wrap files. 2017-12-17 21:19:22 +02:00
Jussi Pakkanen 5b9d79b902 Print instructions on how to promote subsubprojects. 2017-12-17 21:19:22 +02:00
Jussi Pakkanen 88756bfe95 Print UTF-8 warning only when actually encountering non-ascii filenames. 2017-12-14 23:49:12 +02:00
Dylan Baker fc547ad05e haiku: do not add pthread arguments
Haiku has pthreads, but they are part of the standard C library, and do
not need either special compiler or linker flags.
2017-12-07 09:35:12 -08:00
Jussi Pakkanen 112e6c1927
Merge pull request #2638 from jibsen/use-value-regex
Use regex to substitute template strings
2017-12-03 23:03:13 +02:00
Nirbheek Chauhan 91d8784a04 configure_file: Compare difference in binary mode
Otherwise Python will try to use string decode on the configured file
and fail if it contains characters that can't be mapped to the current
encoding.
2017-11-27 20:53:27 +02:00
Jussi Pakkanen 4ca1e8638c Fix running tests when there is a period in PATH. 2017-11-27 01:35:27 +02:00
Joergen Ibsen 91a0126590 Improve escaping in configuration files
Replace pairs of backslashes before '@' or '\@' with singles (allows
escaping the escape character). Do not consume next '@' after '\@'.
2017-11-26 13:21:21 +02:00
Jussi Pakkanen 247d632f37 Try harder to find meson.py. Closes #2672. 2017-11-23 20:48:44 +02:00
Joergen Ibsen f31142de88 Use regex to substitute template strings 2017-11-22 10:55:35 +01:00
Jussi Pakkanen d882b6fbd4
Merge pull request #2498 from mesonbuild/runpython
Add possibility to run Python scripts with current interpreter
2017-11-22 00:47:20 +02:00
Joergen Ibsen fdb48a3a0f Use re.sub instead of replace loop
This also prohibits recursive substitution.
2017-11-22 00:43:32 +02:00
Jussi Pakkanen 22adda1617 Review fixes. 2017-11-21 23:29:06 +02:00
Jussi Pakkanen 9d67e5030b Changed code to use detected executables rather than hardcoding sys.executable. 2017-11-20 23:08:17 +02:00
Nirbheek Chauhan d2a250412c compilers: Improve manual library searching
We can now specify the library type we want to search for, and whether
we want to prefer static libraries over shared ones or the other way
around. This functionality is not exposed to build files yet.
2017-11-11 23:06:48 +05:30
Nirbheek Chauhan bb0e18b738 Use listify and extract_as_list everywhere
They now flatten by default and unhold objects if required

Includes unit tests.
2017-10-01 22:27:48 +05:30
Nirbheek Chauhan 24e0774ace Always flatten in listify() since we always want that
All our kwargs take lists that must be flattened

Closes https://github.com/mesonbuild/meson/issues/2408
2017-10-01 12:18:57 +05:30
Jussi Pakkanen 898b723ee5 Merge pull request #2331 from mesonbuild/winencode
Do not use universal newlines on old Python versions.
2017-09-19 22:05:11 +03:00
Alexis Jeandet bf64cf569b Gnome, pkgconfig, Qt4, Qt5 and windows modules slightly refactored.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Alexis Jeandet 55975f852e Introduced extract_as_list.
Corrected code style and typo.

Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Alexis Jeandet 7549a39a17 Introduction of listify method. Test on build.py module to see benefits.
Signed-off-by: Alexis Jeandet <alexis.jeandet@member.fsf.org>
2017-09-18 22:21:22 +02:00
Jussi Pakkanen df18c1ac98 Do not use universal newlines on old Python versions. 2017-09-18 20:33:07 +03:00
Jérôme Duval 0b8db94065 Add is_haiku(), needed for run_tests.py. 2017-09-14 00:11:17 +03:00
Nirbheek Chauhan b3c70f495b interpreter: Always flatten when unholding arrays
Otherwise we might end up with wrapper holders in the Build object and
pickling will then fail, defeating the purpose of the holder objects.

Closes https://github.com/mesonbuild/meson/issues/2211
2017-09-11 23:50:12 +03:00
Michal Koutný e94a9c8fcf Allow version labels with trailing dots
Fixes #1586
2017-09-04 19:26:57 +03:00
Jussi Pakkanen 50fb7d37ab Make all functionality invokable via the main Meson binary,
which can be a Windows .exe file.
2017-08-18 12:08:20 +03:00
Christoph Reiter ceea746222 configure_file: warn in case a variable to subsitute is not present in the passed configuration. Fixes #2090 2017-07-21 20:11:50 +03:00
Jussi Pakkanen ad3dc937f1 Fix remaining Interpreter object leaks. 2017-07-01 02:10:02 +03:00
Jussi Pakkanen c11a4cb952 Make Interpreter object unpicklable as it was being pickled by accident in copies of kwargs. 2017-07-01 00:11:27 +03:00
Jussi Pakkanen effe4fb134 Create helper function for a rmtree that works reliably on Windows. 2017-05-21 21:47:24 +03:00
Dylan Baker e419198ff8 Flatten should always return a list
Currently if flatten() is passed a non-list object, it returns that
object. This is surprising behavior, and prone to causing serious and
numerous problems, since many objects implement the iterable interface,
and thus can be used in cases a list is expected, but with undesirable
results.
2017-05-11 09:57:38 -07:00
Jussi Pakkanen 69abca2a67 Merge pull request #1751 from centricular/fix-cached-deps
Fix caching of external dependencies of various types
2017-05-09 18:41:51 +03:00
Nirbheek Chauhan 8cf29bd288 Completely overhaul caching of external dependencies
The old caching was a mess of spaghetti code layered over pasta code.

The new code is well-commented, is clear about what it's trying to do,
and uses a blacklist of keyword arguments instead of a whitelist while
generating identifiers for dep caching which makes it much more robust
for future changes.

The only side-effect of forgetting about a new keyword argument would
be that the dependency would not be cached unless the values of that
keyword arguments were the same in the cached and new dependency.

There are also more tests which identify scenarios that were broken
earlier.
2017-05-09 14:24:48 +05:30
Dylan Baker 3a688dc4b7 Implement difference method for OrderedSet
This implementation is obvious rather than efficient, but it's efficient
enough for our uses I think. It uses `type(self)` to guarantee that it
works even in subclasses or if the name of the class changes.
2017-05-08 10:37:34 -07:00
Dylan Baker 93187797d6 Fix OrderedSet `__repr__` protocol for non-string objects
Prefer using `repr` on the keys to `str` since `repr` is guaranteed to
be implemented, and will return something "good enough"
2017-05-08 10:36:03 -07:00
Dylan Baker 6944d06116 Don't use dict.keys() to check membership
It's much faster to do 'if a in dict' instead of 'if a in dict.keys()',
since the latter constructs an iterator and walks that iterator and then
tests equality at each step, and the former does a single hash lookup.
2017-04-28 22:42:39 +03:00
Dylan Baker 4f7723649a Implement an actual set interface for the OrderedSet class. Closes #1670
This uses the ABC's in collections to implement an OrderedSet class.
Internally an OrderedDict is still wrapped so that the ordering is
maintained, this adds the full interface and behavior of an Set, but
with ordering by first insertion.
2017-04-28 17:25:13 +03:00
Jussi Pakkanen b951e60f06 Merge pull request #1548 from ssssam/sam/stable-ordering
Stable ordering of some commandlines generated by 'gnome' module
2017-04-13 23:59:48 +03:00
Michael Olbrich ca894a24fc Don't close fds when executing programs
Tools that execute meson might open file descriptors for the programs to
use. Such as a file descriptor for a logfile.
2017-04-13 08:43:54 +02:00
Jussi Pakkanen 1652dccea2 Merge pull request #1469 from centricular/install-secondary-outputs
Support multiple install dirs for built/custom targets
2017-04-09 21:57:46 +03:00
Jussi Pakkanen 761b28371a Merge pull request #1518 from centricular/mesonintrospect-evar
Export MESONINTROSPECT to postconf/install/run_command scripts
2017-04-08 21:25:25 +03:00
Jon Turney cbc5064a67 Don't use -fPIC on Cygwin, either
Identify Cygwin-targetted gcc as sui generis (don't use -fPIC, but don't
link with standard Windows libraries, either)

Update tests appropriately
2017-04-06 22:47:15 +01:00
Jussi Pakkanen 14579ed9c5 Merge pull request #1557 from pitti/fix/configure_data-files-input
Fix configure_data files input
2017-04-04 20:57:17 +03:00
Nirbheek Chauhan 57cb1f9aad Support multiple install dirs for built/custom targets
You can now pass a list of strings to the install_dir: kwarg to
build_target and custom_target.

Custom Targets:
===============
Allows you to specify the installation directory for each
corresponding output. For example:

    custom_target('different-install-dirs',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : ['somedir', 'otherdir])

This would install first.file to somedir and second.file to otherdir.

If only one install_dir is provided, all outputs are installed there
(same behaviour as before).

To only install some outputs, pass `false` for the outputs that you
don't want installed. For example:

    custom_target('only-install-second',
      output : ['first.file', 'second.file'],
      ...
      install : true,
      install_dir : [false, 'otherdir])

This would install second.file to otherdir and not install first.file.

Build Targets:
==============
With build_target() (which includes executable(), library(), etc),
usually there is only one primary output. However some types of
targets have multiple outputs.

For example, while generating Vala libraries, valac also generates
a header and a .vapi file both of which often need to be installed.
This allows you to specify installation directories for those too.

    # This will only install the library (same as before)
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true)

    # This will install the library, the header, and the vapi into the
    # respective directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : ['libdir', 'incdir', 'vapidir'])

    # This will install the library into the default libdir and
    # everything else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [true, 'incdir', 'vapidir'])

    # This will NOT install the library, and will install everything
    # else into the specified directories
    shared_library('somevalalib', 'somesource.vala',
      ...
      install : true,
      install_dir : [false, 'incdir', 'vapidir'])

true/false can also be used for secondary outputs in the same way.

Valac can also generate a GIR file for libraries when the `vala_gir:`
keyword argument is passed to library(). In that case, `install_dir:`
must be given a list with four elements, one for each output.

Includes tests for all these.

Closes https://github.com/mesonbuild/meson/issues/705
Closes https://github.com/mesonbuild/meson/issues/891
Closes https://github.com/mesonbuild/meson/issues/892
Closes https://github.com/mesonbuild/meson/issues/1178
Closes https://github.com/mesonbuild/meson/issues/1193
2017-04-04 14:59:13 +05:30
Philipp Ittershagen 64e8f2c7bf Refactor duplicate code in File
Increase readability using the File method self.relative_name() to factor out
some of the os.path.join(...) commands.
2017-04-03 21:08:59 +02:00
Sam Thursfield e0c5e40826 Add a cheap OrderedSet implementation
This just makes an OrderedDict look more like a set class. This results
in neater code than if we use OrderedDict to hold sets directly.

There is a "real" OrderedSet implementation available here, but it lacks
a clear license: https://code.activestate.com/recipes/576694/
2017-04-03 17:02:43 +01:00
Jussi Pakkanen 7b66ff8921 Create unity files with the VS backend. 2017-04-02 00:04:45 +03:00
Nirbheek Chauhan 27f5f0a963 Export MESONINTROSPECT to postconf/install/run_command scripts
Points to the `mesonintrospect.py` script corresponding to the
currently-running version of Meson.

Includes a test for all three methods of running scripts/commands.

Closes https://github.com/mesonbuild/meson/issues/1385
2017-03-28 00:55:01 +05:30
Nirbheek Chauhan 73b2ee08a8 Rewrite custom_target template string substitution
Factor it out into a function in mesonlib.py. This will allow us to
reuse it for generators and for configure_file(). The latter doesn't
implement this at all right now.

Also includes unit tests.
2017-02-20 23:32:03 +05:30
Nirbheek Chauhan bb491735a9 coredata: Use our own implementation of commonpath
os.path.commonpath was added in Python 3.5, so just write our own for
now. pathlib was added in Python 3.4, so this should be ok. We need to
use that instead of doing str.split() etc because Windows path handling
has a lot of exceptions and pathlib handles all that for us.

Also adds a unit test for this.
2017-01-30 03:19:31 +05:30