diff options
-rw-r--r-- | docs/markdown/Reference-manual.md | 12 | ||||
-rw-r--r-- | docs/markdown/Subprojects.md | 29 | ||||
-rw-r--r-- | mesonbuild/backend/ninjabackend.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/c.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/compilers.py | 24 | ||||
-rw-r--r-- | mesonbuild/compilers/cs.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/d.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/fortran.py | 4 | ||||
-rw-r--r-- | mesonbuild/compilers/java.py | 2 | ||||
-rw-r--r-- | mesonbuild/interpreter.py | 6 | ||||
-rw-r--r-- | test cases/common/198 args flattening/meson.build | 6 |
11 files changed, 66 insertions, 27 deletions
diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 776703c..2498b98 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1636,6 +1636,12 @@ The following keyword arguments can be used: `sizeof`, `has_type`, `has_function`, `has_member`, `has_members`, `has_header_symbol`. +**Note:** These compiler checks do not use compiler arguments added with +`add_*_arguments()`, via `-Dlang_args` on the command-line, or through +`CFLAGS`/`LDFLAGS`, etc in the environment. Hence, you can trust that +the tests will be fully self-contained, and won't fail because of custom +flags added by other parts of the build file or by users. + Note that if you have a single prefix with all your dependencies, you might find it easier to append to the environment variables `C_INCLUDE_PATH` with GCC/Clang and `INCLUDE` with MSVC to expand the @@ -1882,9 +1888,9 @@ and has the following methods: - `found()` which returns whether the executable was found -- `path()` which returns an array pointing to the executable (this is - an array as opposed to a string because the program might be - `['python', 'foo.py']`, for example) +- `path()` which returns a string pointing to the script or executable + **NOTE:** You should not need to use this method. Passing the object + itself should work in all cases. F.ex.: `run_command(obj, arg1, arg2)` ### `environment` object diff --git a/docs/markdown/Subprojects.md b/docs/markdown/Subprojects.md index ad2aae2..80ed3e7 100644 --- a/docs/markdown/Subprojects.md +++ b/docs/markdown/Subprojects.md @@ -72,6 +72,35 @@ in the top level `subprojects` directory. Recursive use of subprojects is not allowed, though, so you can't have subproject `a` that uses subproject `b` and have `b` also use `a`. +# Command-line options + +The usage of subprojects can be controlled by users and distros with +the following command-line options: + +* **--wrap-mode=nodownload** + + Meson will not use the network to download any subprojects or + fetch any wrap information. Only pre-existing sources will be used. + This is useful (mostly for distros) when you want to only use the + sources provided by a software release, and want to manually handle + or provide missing dependencies. + +* **--wrap-mode=nofallback** + + Meson will not use subproject fallbacks for any dependency + declarations in the build files, and will only look for them in the + system. Note that this does not apply to unconditional subproject() + calls, and those are meant to be used for sources that cannot be + provided by the system, such as copylibs. + +* **--wrap-mode=forcefallback** + + Meson will not look at the system for any dependencies which have + subproject fallbacks available, and will *only* use subprojects for + them. This is useful when you want to test your fallback setup, or + want to specifically build against the library sources provided by + your subprojects. + # Obtaining subprojects Meson ships with a dependency system to automatically obtain diff --git a/mesonbuild/backend/ninjabackend.py b/mesonbuild/backend/ninjabackend.py index 1d8d011..ff28525 100644 --- a/mesonbuild/backend/ninjabackend.py +++ b/mesonbuild/backend/ninjabackend.py @@ -2398,7 +2398,7 @@ rule FORTRAN_DEP_HACK%s commands += linker.get_pic_args() # Add -Wl,-soname arguments on Linux, -install_name on OS X commands += linker.get_soname_args(target.prefix, target.name, target.suffix, - abspath, target.soversion, target.ltversion, + abspath, target.soversion, isinstance(target, build.SharedModule)) # This is only visited when building for Windows using either GCC or Visual Studio if target.vs_module_defs and hasattr(linker, 'gen_vs_module_defs_args'): diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index e811096..81c0229 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -91,7 +91,7 @@ class CCompiler(Compiler): # Almost every compiler uses this for disabling warnings return ['-w'] - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): return [] def split_shlib_to_parts(self, fname): diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 3d303c8..762e7c5 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -966,7 +966,7 @@ ICC_WIN = 2 GNU_LD_AS_NEEDED = '-Wl,--as-needed' APPLE_LD_AS_NEEDED = '-Wl,-dead_strip_dylibs' -def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): +def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module): if soversion is None: sostr = '' else: @@ -983,15 +983,7 @@ def get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, v if soversion is not None: install_name += '.' + soversion install_name += '.dylib' - args = ['-install_name', os.path.join('@rpath', install_name)] - if version and len(version.split('.')) == 3: - splitted = version.split('.') - major = int(splitted[0]) - minor = int(splitted[1]) - revision = int(splitted[2]) - args += ['-compatibility_version', '%d' % (major + minor + 1)] - args += ['-current_version', '%d.%d' % (major + minor + 1, revision)] - return args + return ['-install_name', os.path.join('@rpath', install_name)] else: raise RuntimeError('Not implemented yet.') @@ -1129,8 +1121,8 @@ class GnuCompiler: def split_shlib_to_parts(self, fname): return os.path.dirname(fname), fname - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): - return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion, version, is_shared_module) + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): + return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module) def get_std_shared_lib_link_args(self): return ['-shared'] @@ -1231,7 +1223,7 @@ class ClangCompiler: # so it might change semantics at any time. return ['-include-pch', os.path.join(pch_dir, self.get_pch_name(header))] - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): if self.clang_type == CLANG_STANDARD: gcc_type = GCC_STANDARD elif self.clang_type == CLANG_OSX: @@ -1240,7 +1232,7 @@ class ClangCompiler: gcc_type = GCC_MINGW else: raise MesonException('Unreachable code when converting clang type to gcc type.') - return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, version, is_shared_module) + return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module) def has_multi_arguments(self, args, env): myargs = ['-Werror=unknown-warning-option', '-Werror=unused-command-line-argument'] @@ -1323,7 +1315,7 @@ class IntelCompiler: def split_shlib_to_parts(self, fname): return os.path.dirname(fname), fname - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): if self.icc_type == ICC_STANDARD: gcc_type = GCC_STANDARD elif self.icc_type == ICC_OSX: @@ -1332,7 +1324,7 @@ class IntelCompiler: gcc_type = GCC_MINGW else: raise MesonException('Unreachable code when converting icc type to gcc type.') - return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, version, is_shared_module) + return get_gcc_soname_args(gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module) # TODO: centralise this policy more globally, instead # of fragmenting it into GnuCompiler and ClangCompiler diff --git a/mesonbuild/compilers/cs.py b/mesonbuild/compilers/cs.py index 581b458..f78e364 100644 --- a/mesonbuild/compilers/cs.py +++ b/mesonbuild/compilers/cs.py @@ -41,7 +41,7 @@ class CsCompiler(Compiler): def get_link_args(self, fname): return ['-r:' + fname] - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): return [] def get_werror_args(self): diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index b76bfba..474e1bd 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -89,9 +89,9 @@ class DCompiler(Compiler): def get_std_shared_lib_link_args(self): return ['-shared'] - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): # FIXME: Make this work for Windows, MacOS and cross-compiling - return get_gcc_soname_args(GCC_STANDARD, prefix, shlib_name, suffix, path, soversion, version, is_shared_module) + return get_gcc_soname_args(GCC_STANDARD, prefix, shlib_name, suffix, path, soversion, is_shared_module) def get_feature_args(self, kwargs, build_to_src): res = [] diff --git a/mesonbuild/compilers/fortran.py b/mesonbuild/compilers/fortran.py index 87fa702..4c9b6b5 100644 --- a/mesonbuild/compilers/fortran.py +++ b/mesonbuild/compilers/fortran.py @@ -94,8 +94,8 @@ end program prog def split_shlib_to_parts(self, fname): return os.path.dirname(fname), fname - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): - return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion, version, is_shared_module) + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): + return get_gcc_soname_args(self.gcc_type, prefix, shlib_name, suffix, path, soversion, is_shared_module) def get_dependency_gen_args(self, outtarget, outfile): # Disabled until this is fixed: diff --git a/mesonbuild/compilers/java.py b/mesonbuild/compilers/java.py index 1213d18..a8138d7 100644 --- a/mesonbuild/compilers/java.py +++ b/mesonbuild/compilers/java.py @@ -25,7 +25,7 @@ class JavaCompiler(Compiler): self.id = 'unknown' self.javarunner = 'java' - def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, version, is_shared_module): + def get_soname_args(self, prefix, shlib_name, suffix, path, soversion, is_shared_module): return [] def get_werror_args(self): diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 7324f67..828ab35 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -211,6 +211,12 @@ class ConfigurationDataHolder(MutableInterpreterObject, ObjectHolder): self.used = True def validate_args(self, args, kwargs): + if len(args) == 1 and isinstance(args[0], list) and len(args[0]) == 2: + mlog.log(mlog.red('DEPRECATION:'), + '''Passing a list as the single argument to configuration_data.set is deprecated. +This will become a hard error in the future''') + args = args[0] + if len(args) != 2: raise InterpreterException("Configuration set requires 2 arguments.") if self.used: diff --git a/test cases/common/198 args flattening/meson.build b/test cases/common/198 args flattening/meson.build index 1c7467d..6da2e8f 100644 --- a/test cases/common/198 args flattening/meson.build +++ b/test cases/common/198 args flattening/meson.build @@ -21,3 +21,9 @@ assert(arr == ['bar', 'baz'], 'configuration_data.get with array fallback is bro arr = meson.get_cross_property('does-not-exist', ['bar', 'baz']) assert(arr == ['bar', 'baz'], 'meson.get_cross_property with array fallback is broken') + +# Test deprecated behaviour + +conf.set(['foo', 'bar']) + +message(conf.get('foo')) |