From e34085729f51c033f9d145f354bfd97c1190cf3a Mon Sep 17 00:00:00 2001 From: Hyunjee Kim Date: Wed, 4 Dec 2019 14:54:51 +0900 Subject: [PATCH] Imported Upstream version 0.52.1 Change-Id: I947278112a9a79da1c1bae37ae1e30a79fcb8fd5 Signed-off-by: Hyunjee Kim --- PKG-INFO | 4 +- man/meson.1 | 2 +- meson.egg-info/PKG-INFO | 4 +- meson.egg-info/SOURCES.txt | 17 +++-- mesonbuild/backend/backends.py | 3 +- mesonbuild/cmake/interpreter.py | 49 ++++++++++-- mesonbuild/compilers/c.py | 7 ++ mesonbuild/compilers/cpp.py | 6 ++ mesonbuild/compilers/d.py | 17 ++++- mesonbuild/compilers/mixins/gnu.py | 11 ++- mesonbuild/compilers/mixins/islinker.py | 11 ++- mesonbuild/coredata.py | 2 +- mesonbuild/dependencies/base.py | 87 ++++++---------------- mesonbuild/environment.py | 26 +++++-- mesonbuild/interpreter.py | 4 + mesonbuild/interpreterbase.py | 13 ++-- mesonbuild/linkers.py | 13 +--- mesonbuild/mintro.py | 6 +- mesonbuild/modules/hotdoc.py | 22 +++++- mesonbuild/msubprojects.py | 4 + mesonbuild/wrap/wrap.py | 14 ++-- run_unittests.py | 47 +----------- test cases/cmake/13 system includes/main.cpp | 10 +++ test cases/cmake/13 system includes/meson.build | 14 ++++ .../subprojects/cmMod/CMakeLists.txt | 15 ++++ .../13 system includes/subprojects/cmMod/cmMod.cpp | 12 +++ .../13 system includes/subprojects/cmMod/cmMod.hpp | 13 ++++ .../subprojects/cmMod/sysInc/triggerWarn.hpp | 14 ++++ test cases/common/163 disabler/meson.build | 47 ++++++++++++ test cases/unit/67 rpath-link secondary/app/app.c | 4 - .../unit/67 rpath-link secondary/app/meson.build | 5 -- .../unit/67 rpath-link secondary/libA/liba.c | 1 - .../unit/67 rpath-link secondary/libA/liba.h | 1 - .../unit/67 rpath-link secondary/libA/meson.build | 14 ---- .../unit/67 rpath-link secondary/libB/libb.c | 3 - .../unit/67 rpath-link secondary/libB/libb.h | 1 - .../unit/67 rpath-link secondary/libB/meson.build | 16 ---- test cases/unit/69 static link/lib/func17.c | 4 + test cases/unit/69 static link/lib/func18.c | 6 ++ test cases/unit/69 static link/lib/func19.c | 7 ++ test cases/unit/69 static link/lib/meson.build | 12 +++ 41 files changed, 355 insertions(+), 213 deletions(-) create mode 100644 test cases/cmake/13 system includes/main.cpp create mode 100644 test cases/cmake/13 system includes/meson.build create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp create mode 100644 test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp delete mode 100644 test cases/unit/67 rpath-link secondary/app/app.c delete mode 100644 test cases/unit/67 rpath-link secondary/app/meson.build delete mode 100644 test cases/unit/67 rpath-link secondary/libA/liba.c delete mode 100644 test cases/unit/67 rpath-link secondary/libA/liba.h delete mode 100644 test cases/unit/67 rpath-link secondary/libA/meson.build delete mode 100644 test cases/unit/67 rpath-link secondary/libB/libb.c delete mode 100644 test cases/unit/67 rpath-link secondary/libB/libb.h delete mode 100644 test cases/unit/67 rpath-link secondary/libB/meson.build create mode 100644 test cases/unit/69 static link/lib/func17.c create mode 100644 test cases/unit/69 static link/lib/func18.c create mode 100644 test cases/unit/69 static link/lib/func19.c diff --git a/PKG-INFO b/PKG-INFO index 7be0f5b..b944e3b 100644 --- a/PKG-INFO +++ b/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: meson -Version: 0.52.0 +Version: 0.52.1 Summary: A high performance build system Home-page: https://mesonbuild.com Author: Jussi Pakkanen @@ -24,5 +24,5 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Build Tools -Requires-Python: >= 3.5.2 +Requires-Python: >=3.5.2 Provides-Extra: progress diff --git a/man/meson.1 b/man/meson.1 index b80568e..12a2989 100644 --- a/man/meson.1 +++ b/man/meson.1 @@ -1,4 +1,4 @@ -.TH MESON "1" "October 2019" "meson 0.52.0" "User Commands" +.TH MESON "1" "November 2019" "meson 0.52.1" "User Commands" .SH NAME meson - a high productivity build system .SH DESCRIPTION diff --git a/meson.egg-info/PKG-INFO b/meson.egg-info/PKG-INFO index 7be0f5b..b944e3b 100644 --- a/meson.egg-info/PKG-INFO +++ b/meson.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 2.1 Name: meson -Version: 0.52.0 +Version: 0.52.1 Summary: A high performance build system Home-page: https://mesonbuild.com Author: Jussi Pakkanen @@ -24,5 +24,5 @@ Classifier: Programming Language :: Python :: 3.6 Classifier: Programming Language :: Python :: 3.7 Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Software Development :: Build Tools -Requires-Python: >= 3.5.2 +Requires-Python: >=3.5.2 Provides-Extra: progress diff --git a/meson.egg-info/SOURCES.txt b/meson.egg-info/SOURCES.txt index 9ab936d..cef1122 100644 --- a/meson.egg-info/SOURCES.txt +++ b/meson.egg-info/SOURCES.txt @@ -229,6 +229,12 @@ test cases/cmake/12 generator expressions/main.cpp test cases/cmake/12 generator expressions/meson.build test cases/cmake/12 generator expressions/subprojects/cmMod/CMakeLists.txt test cases/cmake/12 generator expressions/subprojects/cmMod/include/cmMod.hpp +test cases/cmake/13 system includes/main.cpp +test cases/cmake/13 system includes/meson.build +test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt +test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp +test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp +test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp test cases/cmake/2 advanced/installed_files.txt test cases/cmake/2 advanced/main.cpp test cases/cmake/2 advanced/meson.build @@ -2529,14 +2535,6 @@ test cases/unit/65 cmake parser/meson.build test cases/unit/65 cmake parser/prefix/lib/cmake/mesontest/mesontest-config.cmake test cases/unit/66 alias target/main.c test cases/unit/66 alias target/meson.build -test cases/unit/67 rpath-link secondary/app/app.c -test cases/unit/67 rpath-link secondary/app/meson.build -test cases/unit/67 rpath-link secondary/libA/liba.c -test cases/unit/67 rpath-link secondary/libA/liba.h -test cases/unit/67 rpath-link secondary/libA/meson.build -test cases/unit/67 rpath-link secondary/libB/libb.c -test cases/unit/67 rpath-link secondary/libB/libb.h -test cases/unit/67 rpath-link secondary/libB/meson.build test cases/unit/68 static archive stripping/app/appA.c test cases/unit/68 static archive stripping/app/appB.c test cases/unit/68 static archive stripping/app/meson.build @@ -2558,6 +2556,9 @@ test cases/unit/69 static link/lib/func12.c test cases/unit/69 static link/lib/func14.c test cases/unit/69 static link/lib/func15.c test cases/unit/69 static link/lib/func16.c +test cases/unit/69 static link/lib/func17.c +test cases/unit/69 static link/lib/func18.c +test cases/unit/69 static link/lib/func19.c test cases/unit/69 static link/lib/func2.c test cases/unit/69 static link/lib/func3.c test cases/unit/69 static link/lib/func4.c diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index 4d3f5d9..e9e1829 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -281,7 +281,8 @@ class Backend: os.path.join('dummyprefixdir', fromdir)) def flatten_object_list(self, target, proj_dir_to_build_root=''): - return self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root) + obj_list = self._flatten_object_list(target, target.get_objects(), proj_dir_to_build_root) + return list(dict.fromkeys(obj_list)) def _flatten_object_list(self, target, objects, proj_dir_to_build_root): obj_list = [] diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index 09ac7c6..c51f99e 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -49,6 +49,20 @@ if TYPE_CHECKING: from ..build import Build from ..backend.backends import Backend +# Disable all warnings automaticall enabled with --trace and friends +# See https://cmake.org/cmake/help/latest/variable/CMAKE_POLICY_WARNING_CMPNNNN.html +disable_policy_warnings = [ + 'CMP0025', + 'CMP0047', + 'CMP0056', + 'CMP0060', + 'CMP0065', + 'CMP0066', + 'CMP0067', + 'CMP0082', + 'CMP0089', +] + backend_generator_map = { 'ninja': 'Ninja', 'xcode': 'Xcode', @@ -82,9 +96,11 @@ target_type_requires_trace = ['INTERFACE_LIBRARY'] skip_targets = ['UTILITY'] blacklist_compiler_flags = [ - '/W1', '/W2', '/W3', '/W4', '/Wall', + '-Wall', '-Wextra', '-Weverything', '-Werror', '-Wpedantic', '-pedantic', '-w', + '/W1', '/W2', '/W3', '/W4', '/Wall', '/WX', '/w', '/O1', '/O2', '/Ob', '/Od', '/Og', '/Oi', '/Os', '/Ot', '/Ox', '/Oy', '/Ob0', - '/RTC1', '/RTCc', '/RTCs', '/RTCu' + '/RTC1', '/RTCc', '/RTCs', '/RTCu', + '/Z7', '/Zi', '/ZI', ] blacklist_link_flags = [ @@ -493,6 +509,8 @@ class CMakeInterpreter: generator = backend_generator_map[self.backend_name] cmake_args = cmake_exe.get_command() + trace_args = ['--trace', '--trace-expand', '--no-warn-unused-cli'] + cmcmp_args = ['-DCMAKE_POLICY_WARNING_{}=OFF'.format(x) for x in disable_policy_warnings] # Map meson compiler to CMake variables for lang, comp in self.env.coredata.compilers[for_machine].items(): @@ -509,7 +527,6 @@ class CMakeInterpreter: cmake_args += ['-DCMAKE_LINKER={}'.format(comp.get_linker_exelist()[0])] cmake_args += ['-G', generator] cmake_args += ['-DCMAKE_INSTALL_PREFIX={}'.format(self.install_prefix)] - cmake_args += ['--trace', '--trace-expand'] cmake_args += extra_cmake_options # Run CMake @@ -517,11 +534,16 @@ class CMakeInterpreter: with mlog.nested(): mlog.log('Configuring the build directory with', mlog.bold('CMake'), 'version', mlog.cyan(cmake_exe.version())) mlog.log(mlog.bold('Running:'), ' '.join(cmake_args)) + mlog.log(mlog.bold(' - build directory: '), self.build_dir) + mlog.log(mlog.bold(' - source directory: '), self.src_dir) + mlog.log(mlog.bold(' - trace args: '), ' '.join(trace_args)) + mlog.log(mlog.bold(' - disabled policy warnings:'), '[{}]'.format(', '.join(disable_policy_warnings))) mlog.log() os.makedirs(self.build_dir, exist_ok=True) os_env = os.environ.copy() os_env['LC_ALL'] = 'C' - proc = Popen(cmake_args + [self.src_dir], stdout=PIPE, stderr=PIPE, cwd=self.build_dir, env=os_env) + final_command = cmake_args + trace_args + cmcmp_args + [self.src_dir] + proc = Popen(final_command, stdout=PIPE, stderr=PIPE, cwd=self.build_dir, env=os_env) def print_stdout(): while True: @@ -534,8 +556,23 @@ class CMakeInterpreter: t = Thread(target=print_stdout) t.start() - self.raw_trace = proc.stderr.read() - self.raw_trace = self.raw_trace.decode('utf-8') + # Read stderr line by line and log non trace lines + self.raw_trace = '' + tline_start_reg = re.compile(r'^\s*(.*\.(cmake|txt))\(([0-9]+)\):\s*(\w+)\(.*$') + inside_multiline_trace = False + while True: + line = proc.stderr.readline() + if not line: + break + line = line.decode('utf-8') + if tline_start_reg.match(line): + self.raw_trace += line + inside_multiline_trace = not line.endswith(' )\n') + elif inside_multiline_trace: + self.raw_trace += line + else: + mlog.warning(line.strip('\n')) + proc.stderr.close() proc.wait() diff --git a/mesonbuild/compilers/c.py b/mesonbuild/compilers/c.py index 1ec9146..bcc3941 100644 --- a/mesonbuild/compilers/c.py +++ b/mesonbuild/compilers/c.py @@ -127,6 +127,13 @@ class EmscriptenCCompiler(LinkerEnvVarsMixin, BasicLinkerIsCompilerMixin, ClangC def get_soname_args(self, *args, **kwargs): raise MesonException('Emscripten does not support shared libraries.') + def get_allow_undefined_link_args(self) -> typing.List[str]: + return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'] + + def get_linker_output_args(self, output: str) -> typing.List[str]: + return ['-o', output] + + class ArmclangCCompiler(ArmclangCompiler, CCompiler): def __init__(self, exelist, version, compiler_type, for_machine: MachineChoice, is_cross, exe_wrapper=None, **kwargs): CCompiler.__init__(self, exelist, version, for_machine, is_cross, exe_wrapper, **kwargs) diff --git a/mesonbuild/compilers/cpp.py b/mesonbuild/compilers/cpp.py index f93db3e..084e45f 100644 --- a/mesonbuild/compilers/cpp.py +++ b/mesonbuild/compilers/cpp.py @@ -204,6 +204,12 @@ class EmscriptenCPPCompiler(LinkerEnvVarsMixin, BasicLinkerIsCompilerMixin, Clan def get_soname_args(self, *args, **kwargs): raise MesonException('Emscripten does not support shared libraries.') + def get_allow_undefined_link_args(self) -> typing.List[str]: + return ['-s', 'ERROR_ON_UNDEFINED_SYMBOLS=0'] + + def get_linker_output_args(self, output: str) -> typing.List[str]: + return ['-o', output] + class ArmclangCPPCompiler(ArmclangCompiler, CPPCompiler): def __init__(self, exelist, version, compiler_type, for_machine: MachineChoice, is_cross, exe_wrapper=None, **kwargs): diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index 346f18e..aa39030 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -390,7 +390,16 @@ class DmdLikeCompilerMixin: def get_soname_args(self, *args, **kwargs) -> typing.List[str]: # LDC and DMD actually do use a linker, but they proxy all of that with # their own arguments - return Compiler.get_soname_args(self, *args, **kwargs) + soargs = [] + for arg in Compiler.get_soname_args(self, *args, **kwargs): + soargs.append('-L=' + arg) + return soargs + + def get_allow_undefined_link_args(self) -> typing.List[str]: + args = [] + for arg in self.linker.get_allow_undefined_args(): + args.append('-L=' + arg) + return args class DCompiler(Compiler): @@ -631,6 +640,9 @@ class GnuDCompiler(DCompiler, GnuCompiler): return parameter_list + def get_allow_undefined_link_args(self) -> typing.List[str]: + return self.linker.get_allow_undefined_args() + class LLVMDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompilerMixin, DCompiler): def __init__(self, exelist, version, for_machine: MachineChoice, arch, **kwargs): @@ -659,6 +671,9 @@ class LLVMDCompiler(DmdLikeCompilerMixin, LinkerEnvVarsMixin, BasicLinkerIsCompi def get_pic_args(self): return ['-relocation-model=pic'] + def get_std_shared_lib_link_args(self): + return ['-shared'] + def get_crt_link_args(self, crt_val, buildtype): return self.get_crt_args(crt_val, buildtype) diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index f4ce5b9..faebdd5 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -86,8 +86,15 @@ gnu_color_args = { @functools.lru_cache(maxsize=None) def gnulike_default_include_dirs(compiler: typing.Tuple[str], lang: str) -> typing.List[str]: - if lang == 'cpp': - lang = 'c++' + lang_map = { + 'c': 'c', + 'cpp': 'c++', + 'objc': 'objective-c', + 'objcpp': 'objective-c++' + } + if lang not in lang_map: + return [] + lang = lang_map[lang] env = os.environ.copy() env["LC_ALL"] = 'C' cmd = list(compiler) + ['-x{}'.format(lang), '-E', '-v', '-'] diff --git a/mesonbuild/compilers/mixins/islinker.py b/mesonbuild/compilers/mixins/islinker.py index dca20d0..d38f718 100644 --- a/mesonbuild/compilers/mixins/islinker.py +++ b/mesonbuild/compilers/mixins/islinker.py @@ -90,7 +90,7 @@ class BasicLinkerIsCompilerMixin: raise mesonlib.EnvironmentException( 'Linker {} does not support link_whole'.format(self.id)) - def get_allow_undefined_args(self) -> typing.List[str]: + def get_allow_undefined_link_args(self) -> typing.List[str]: raise mesonlib.EnvironmentException( 'Linker {} does not support allow undefined'.format(self.id)) @@ -121,3 +121,12 @@ class BasicLinkerIsCompilerMixin: rpath_paths: str, build_rpath: str, install_rpath: str) -> typing.List[str]: return [] + + def get_linker_debug_crt_args(self) -> typing.List[str]: + return [] + + def get_asneeded_args(self) -> typing.List[str]: + return [] + + def get_buildtype_linker_args(self, buildtype: str) -> typing.List[str]: + return [] diff --git a/mesonbuild/coredata.py b/mesonbuild/coredata.py index 9627bec..afb74c5 100644 --- a/mesonbuild/coredata.py +++ b/mesonbuild/coredata.py @@ -38,7 +38,7 @@ if typing.TYPE_CHECKING: OptionDictType = typing.Dict[str, 'UserOption[Any]'] -version = '0.52.0' +version = '0.52.1' backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'vs2019', 'xcode'] default_yielding = False diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index 3c55a56..35f0175 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -33,7 +33,6 @@ from .. import mesonlib from ..compilers import clib_langs from ..environment import BinaryTable, Environment, MachineInfo from ..cmake import CMakeExecutor, CMakeTraceParser, CMakeException -from ..linkers import GnuLikeDynamicLinkerMixin from ..mesonlib import MachineChoice, MesonException, OrderedSet, PerMachine from ..mesonlib import Popen_safe, version_compare_many, version_compare, listify, stringlistify, extract_as_list, split_args from ..mesonlib import Version, LibType @@ -645,16 +644,19 @@ class PkgConfigDependency(ExternalDependency): mlog.debug('Determining dependency {!r} with pkg-config executable ' '{!r}'.format(name, self.pkgbin.get_path())) - ret, self.version = self._call_pkgbin(['--modversion', name]) + ret, self.version, _ = self._call_pkgbin(['--modversion', name]) if ret != 0: return + self.is_found = True + try: # Fetch cargs to be used while using this dependency self._set_cargs() # Fetch the libraries and library paths needed for using this self._set_libs() except DependencyException as e: + mlog.debug("pkg-config error with '%s': %s" % (name, e)) if self.required: raise else: @@ -663,8 +665,6 @@ class PkgConfigDependency(ExternalDependency): self.is_found = False self.reason = e - self.is_found = True - def __repr__(self): s = '<{0} {1}: {2} {3}>' return s.format(self.__class__.__name__, self.name, self.is_found, @@ -672,11 +672,11 @@ class PkgConfigDependency(ExternalDependency): def _call_pkgbin_real(self, args, env): cmd = self.pkgbin.get_command() + args - p, out = Popen_safe(cmd, env=env)[0:2] - rc, out = p.returncode, out.strip() + p, out, err = Popen_safe(cmd, env=env) + rc, out, err = p.returncode, out.strip(), err.strip() call = ' '.join(cmd) mlog.debug("Called `{}` -> {}\n{}".format(call, rc, out)) - return rc, out + return rc, out, err def _call_pkgbin(self, args, env=None): # Always copy the environment since we're going to modify it @@ -741,24 +741,22 @@ class PkgConfigDependency(ExternalDependency): # so don't allow pkg-config to suppress -I flags for system paths env = os.environ.copy() env['PKG_CONFIG_ALLOW_SYSTEM_CFLAGS'] = '1' - ret, out = self._call_pkgbin(['--cflags', self.name], env=env) + ret, out, err = self._call_pkgbin(['--cflags', self.name], env=env) if ret != 0: - raise DependencyException('Could not generate cargs for %s:\n\n%s' % - (self.name, out)) + raise DependencyException('Could not generate cargs for %s:\n%s\n' % + (self.name, err)) self.compile_args = self._convert_mingw_paths(self._split_args(out)) - def _search_libs(self, out, out_raw, out_all): + def _search_libs(self, out, out_raw): ''' @out: PKG_CONFIG_ALLOW_SYSTEM_LIBS=1 pkg-config --libs @out_raw: pkg-config --libs - @out_all: pkg-config --libs --static We always look for the file ourselves instead of depending on the compiler to find it with -lfoo or foo.lib (if possible) because: 1. We want to be able to select static or shared 2. We need the full path of the library to calculate RPATH values 3. De-dup of libraries is easier when we have absolute paths - 4. We need to find the directories in which secondary dependencies reside Libraries that are provided by the toolchain or are not found by find_library() will be added with -L -l pairs. @@ -792,18 +790,6 @@ class PkgConfigDependency(ExternalDependency): continue if arg.startswith('-L') and arg[2:] not in prefix_libpaths: system_libpaths.add(arg[2:]) - # collect all secondary library paths - secondary_libpaths = OrderedSet() - all_args = self._convert_mingw_paths(shlex.split(out_all)) - for arg in all_args: - if arg.startswith('-L') and not arg.startswith(('-L-l', '-L-L')): - path = arg[2:] - if not os.path.isabs(path): - # Resolve the path as a compiler in the build directory would - path = os.path.join(self.env.get_build_dir(), path) - if path not in prefix_libpaths and path not in system_libpaths: - secondary_libpaths.add(path) - # Use this re-ordered path list for library resolution libpaths = list(prefix_libpaths) + list(system_libpaths) # Track -lfoo libraries to avoid duplicate work @@ -811,12 +797,8 @@ class PkgConfigDependency(ExternalDependency): # Track not-found libraries to know whether to add library paths libs_notfound = [] libtype = LibType.STATIC if self.static else LibType.PREFER_SHARED - # Generate link arguments for this library, by - # first appending secondary link arguments for ld + # Generate link arguments for this library link_args = [] - if self.clib_compiler and self.clib_compiler.linker and isinstance(self.clib_compiler.linker, GnuLikeDynamicLinkerMixin): - link_args = ['-Wl,-rpath-link,' + p for p in secondary_libpaths] - for lib in full_args: if lib.startswith(('-L-l', '-L-L')): # These are D language arguments, add them as-is @@ -886,45 +868,22 @@ class PkgConfigDependency(ExternalDependency): libcmd = [self.name, '--libs'] if self.static: libcmd.append('--static') - # We need to find *all* secondary dependencies of a library - # - # Say we have libA.so, located in /non/standard/dir1/, and - # libB.so, located in /non/standard/dir2/, which links to - # libA.so. Now when linking exeC to libB.so, the linker will - # walk the complete symbol tree to determine that all undefined - # symbols can be resolved. Because libA.so lives in a directory - # not known to the linker by default, you will get errors like - # - # ld: warning: libA.so, needed by /non/standard/dir2/libB.so, - # not found (try using -rpath or -rpath-link) - # ld: /non/standard/dir2/libB.so: undefined reference to `foo()' - # - # To solve this, we load the -L paths of *all* dependencies, by - # relying on --static to provide us with a complete picture. All - # -L paths that are found via a --static lookup but that are not - # contained in the normal lookup have to originate from secondary - # dependencies. See also: - # http://www.kaizou.org/2015/01/linux-libraries/ - libcmd_all = [self.name, '--libs', '--static'] # Force pkg-config to output -L fields even if they are system # paths so we can do manual searching with cc.find_library() later. env = os.environ.copy() env['PKG_CONFIG_ALLOW_SYSTEM_LIBS'] = '1' - ret, out = self._call_pkgbin(libcmd, env=env) + ret, out, err = self._call_pkgbin(libcmd, env=env) if ret != 0: - raise DependencyException('Could not generate libs for %s:\n\n%s' % - (self.name, out)) + raise DependencyException('Could not generate libs for %s:\n%s\n' % + (self.name, err)) # Also get the 'raw' output without -Lfoo system paths for adding -L # args with -lfoo when a library can't be found, and also in # gnome.generate_gir + gnome.gtkdoc which need -L -l arguments. - ret, out_raw = self._call_pkgbin(libcmd) + ret, out_raw, err_raw = self._call_pkgbin(libcmd) if ret != 0: raise DependencyException('Could not generate libs for %s:\n\n%s' % (self.name, out_raw)) - ret, out_all = self._call_pkgbin(libcmd_all) - if ret != 0: - mlog.warning('Could not determine complete list of dependencies for %s' % self.name) - self.link_args, self.raw_link_args = self._search_libs(out, out_raw, out_all) + self.link_args, self.raw_link_args = self._search_libs(out, out_raw) def get_pkgconfig_variable(self, variable_name, kwargs): options = ['--variable=' + variable_name, self.name] @@ -939,19 +898,19 @@ class PkgConfigDependency(ExternalDependency): options = ['--define-variable=' + '='.join(definition)] + options - ret, out = self._call_pkgbin(options) + ret, out, err = self._call_pkgbin(options) variable = '' if ret != 0: if self.required: - raise DependencyException('dependency %s not found.' % - (self.name)) + raise DependencyException('dependency %s not found:\n%s\n' % + (self.name, err)) else: variable = out.strip() # pkg-config doesn't distinguish between empty and non-existent variables # use the variable list to check for variable existence if not variable: - ret, out = self._call_pkgbin(['--print-variables', self.name]) + ret, out, _ = self._call_pkgbin(['--print-variables', self.name]) if not re.search(r'^' + variable_name + r'$', out, re.MULTILINE): if 'default' in kwargs: variable = kwargs['default'] @@ -1114,8 +1073,8 @@ class CMakeDependency(ExternalDependency): pref_path = self.env.coredata.builtins_per_machine[self.for_machine]['cmake_prefix_path'].value if 'CMAKE_PREFIX_PATH' in os.environ: - env_pref_path = os.environ['CMAKE_PREFIX_PATH'].split(':') - env_pref_path = [x for x in env_pref_path if x] # Filter out enpty strings + env_pref_path = os.environ['CMAKE_PREFIX_PATH'].split(os.pathsep) + env_pref_path = [x for x in env_pref_path if x] # Filter out empty strings if not pref_path: pref_path = [] pref_path += env_pref_path diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 03c6568..4ee18d2 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -999,13 +999,13 @@ class Environment: linker = PGIDynamicLinker(compiler, for_machine, 'pgi', cls.LINKER_PREFIX, version=version) return cls(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, linker=linker) if '(ICC)' in out: + cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler if self.machines[for_machine].is_darwin(): compiler_type = CompilerType.ICC_OSX l = XildAppleDynamicLinker(compiler, for_machine, 'xild', '-Wl,', version=version) else: compiler_type = CompilerType.ICC_STANDARD l = XildLinuxDynamicLinker(compiler, for_machine, 'xild', '-Wl,', version=version) - cls = IntelCCompiler if lang == 'c' else IntelCPPCompiler return cls(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, full_version=full_version, linker=l) if 'ARM' in out: compiler_type = CompilerType.ARM_WIN @@ -1324,12 +1324,15 @@ class Environment: # LDC seems to require a file m = self.machines[for_machine] if m.is_windows() or m.is_cygwin(): - # Getting LDC on windows to give useful linker output when not - # doing real work is painfully hard. It ships with a verison of - # lld-link, so just assume that we're going to use lld-link - # with it. - _, o, _ = Popen_safe(['lld-link.exe', '--version']) - linker = ClangClDynamicLinker(for_machine, version=search_version(o)) + if is_msvc: + linker = MSVCDynamicLinker(for_machine, version=version) + else: + # Getting LDC on windows to give useful linker output when not + # doing real work is painfully hard. It ships with a verison of + # lld-link, so just assume that we're going to use lld-link + # with it. + _, o, _ = Popen_safe(['lld-link.exe', '--version']) + linker = ClangClDynamicLinker(for_machine, version=search_version(o)) else: with tempfile.NamedTemporaryFile(suffix='.d') as f: linker = self._guess_nix_linker( @@ -1344,7 +1347,14 @@ class Environment: # DMD seems to require a file m = self.machines[for_machine] if m.is_windows() or m.is_cygwin(): - linker = OptlinkDynamicLinker(for_machine, version=full_version) + if is_msvc: + linker = MSVCDynamicLinker(for_machine, version=version) + elif arch == 'x86': + linker = OptlinkDynamicLinker(for_machine, version=full_version) + else: + # DMD ships with lld-link + _, o, _ = Popen_safe(['lld-link.exe', '--version']) + linker = ClangClDynamicLinker(for_machine, version=search_version(o)) else: with tempfile.NamedTemporaryFile(suffix='.d') as f: linker = self._guess_nix_linker( diff --git a/mesonbuild/interpreter.py b/mesonbuild/interpreter.py index 1d76a1d..d4f02c0 100644 --- a/mesonbuild/interpreter.py +++ b/mesonbuild/interpreter.py @@ -1557,6 +1557,10 @@ class CompilerHolder(InterpreterObject): search_dirs = mesonlib.stringlistify(kwargs.get('dirs', [])) search_dirs = [Path(d).expanduser() for d in search_dirs] for d in search_dirs: + if mesonlib.is_windows() and d.root.startswith('\\'): + # a Unix-path starting with `/` that is not absolute on Windows. + # discard without failing for end-user ease of cross-platform directory arrays + continue if not d.is_absolute(): raise InvalidCode('Search directory {} is not an absolute path.'.format(d)) search_dirs = list(map(str, search_dirs)) diff --git a/mesonbuild/interpreterbase.py b/mesonbuild/interpreterbase.py index 082515c..a502692 100644 --- a/mesonbuild/interpreterbase.py +++ b/mesonbuild/interpreterbase.py @@ -500,6 +500,8 @@ class InterpreterBase: def evaluate_notstatement(self, cur): v = self.evaluate_statement(cur.value) + if is_disabler(v): + return v if not isinstance(v, bool): raise InterpreterException('Argument to "not" is not a boolean.') return not v @@ -680,8 +682,6 @@ The result of this is undefined and will become a hard error in a future Meson r if len(node.varnames) != 1: raise InvalidArguments('Foreach on array does not unpack') varname = node.varnames[0].value - if is_disabler(items): - return items for item in items: self.set_variable(varname, item) try: @@ -693,8 +693,6 @@ The result of this is undefined and will become a hard error in a future Meson r elif isinstance(items, dict): if len(node.varnames) != 2: raise InvalidArguments('Foreach on dict unpacks key and value') - if is_disabler(items): - return items for key, value in items.items(): self.set_variable(node.varnames[0].value, key) self.set_variable(node.varnames[1].value, value) @@ -805,8 +803,11 @@ The result of this is undefined and will become a hard error in a future Meson r (args, kwargs) = self.reduce_arguments(args) # Special case. This is the only thing you can do with a disabler # object. Every other use immediately returns the disabler object. - if isinstance(obj, Disabler) and method_name == 'found': - return False + if isinstance(obj, Disabler): + if method_name == 'found': + return False + else: + return Disabler() if is_disabled(args, kwargs): return Disabler() if method_name == 'extract_objects': diff --git a/mesonbuild/linkers.py b/mesonbuild/linkers.py index c5c9813..e9bc8d2 100644 --- a/mesonbuild/linkers.py +++ b/mesonbuild/linkers.py @@ -412,7 +412,7 @@ class PosixDynamicLinkerMixin: return ['-shared'] def get_search_args(self, dirname: str) -> typing.List[str]: - return ['-L', dirname] + return ['-L' + dirname] class GnuLikeDynamicLinkerMixin: @@ -930,7 +930,7 @@ class OptlinkDynamicLinker(VisualStudioLikeLinkerMixin, DynamicLinker): def get_allow_undefined_args(self) -> typing.List[str]: return [] -class CudaLinker(DynamicLinker): +class CudaLinker(PosixDynamicLinkerMixin, DynamicLinker): """Cuda linker (nvlink)""" @staticmethod def parse_version(): @@ -964,12 +964,6 @@ class CudaLinker(DynamicLinker): from .compilers import CudaCompiler return CudaCompiler.LINKER_PREFIX - def get_output_args(self, outname: str) -> typing.List[str]: - return ['-o', outname] - - def get_search_args(self, dirname: str) -> typing.List[str]: - return ['-L', dirname] - def fatal_warnings(self) -> typing.List[str]: return ['--warning-as-error'] @@ -980,6 +974,3 @@ class CudaLinker(DynamicLinker): suffix: str, soversion: str, darwin_versions: typing.Tuple[str, str], is_shared_module: bool) -> typing.List[str]: return [] - - def get_std_shared_lib_args(self) -> typing.List[str]: - return ['-shared'] diff --git a/mesonbuild/mintro.py b/mesonbuild/mintro.py index 49eef0a..5e05574 100644 --- a/mesonbuild/mintro.py +++ b/mesonbuild/mintro.py @@ -398,9 +398,9 @@ def run(options): infofile = get_meson_info_file(infodir) if not os.path.isdir(datadir) or not os.path.isdir(infodir) or not os.path.isfile(infofile): - print('Current directory is not a meson build directory.' - 'Please specify a valid build dir or change the working directory to it.' - 'It is also possible that the build directory was generated with an old' + print('Current directory is not a meson build directory.\n' + 'Please specify a valid build dir or change the working directory to it.\n' + 'It is also possible that the build directory was generated with an old\n' 'meson version. Please regenerate it in this case.') return 1 diff --git a/mesonbuild/modules/hotdoc.py b/mesonbuild/modules/hotdoc.py index 02e07a9..bf4386f 100644 --- a/mesonbuild/modules/hotdoc.py +++ b/mesonbuild/modules/hotdoc.py @@ -81,12 +81,28 @@ class HotdocTargetBuilder: elif isinstance(value, list): # Do not do anything on empty lists if value: + # https://bugs.python.org/issue9334 (from 2010 :( ) + # The syntax with nargs=+ is inherently ambiguous + # A workaround for this case is to simply prefix with a space + # every value starting with a dash + escaped_value = [] + for e in value: + if isinstance(e, str) and e.startswith('-'): + escaped_value += [' %s' % e] + else: + escaped_value += [e] if option: - self.cmd.extend([option] + value) + self.cmd.extend([option] + escaped_value) else: - self.cmd.extend(value) + self.cmd.extend(escaped_value) else: - self.cmd.extend([option, value]) + # argparse gets confused if value(s) start with a dash. + # When an option expects a single value, the unambiguous way + # to specify it is with = + if isinstance(value, str): + self.cmd.extend(['%s=%s' % (option, value)]) + else: + self.cmd.extend([option, value]) def check_extra_arg_type(self, arg, value): value = getattr(value, 'held_object', value) diff --git a/mesonbuild/msubprojects.py b/mesonbuild/msubprojects.py index bc6a6ce..eeeb9c6 100755 --- a/mesonbuild/msubprojects.py +++ b/mesonbuild/msubprojects.py @@ -41,6 +41,10 @@ def update_file(wrap, repo_dir, options): def git(cmd, workingdir): return subprocess.check_output(['git', '-C', workingdir] + cmd, + # Redirect stdin to DEVNULL otherwise git + # messes up the console and ANSI colors stop + # working on Windows. + stdin=subprocess.DEVNULL, stderr=subprocess.STDOUT).decode() def git_show(repo_dir): diff --git a/mesonbuild/wrap/wrap.py b/mesonbuild/wrap/wrap.py index 8b19b6d..ebf9f9e 100644 --- a/mesonbuild/wrap/wrap.py +++ b/mesonbuild/wrap/wrap.py @@ -227,7 +227,11 @@ class Resolver: def get_git(self): revno = self.wrap.get('revision') - is_shallow = self.wrap.values.get('depth', '') != '' + is_shallow = False + depth_option = [] # type: typing.List[str] + if self.wrap.values.get('depth', '') != '': + is_shallow = True + depth_option = ['--depth', self.wrap.values.get('depth')] # for some reason git only allows commit ids to be shallowly fetched by fetch not with clone if is_shallow and self.is_git_full_commit_id(revno): # git doesn't support directly cloning shallowly for commits, @@ -236,12 +240,12 @@ class Resolver: subprocess.check_call(['git', 'remote', 'add', 'origin', self.wrap.get('url')], cwd=self.dirname) revno = self.wrap.get('revision') - subprocess.check_call(['git', 'fetch', '--depth', self.wrap.values.get('depth'), 'origin', revno], + subprocess.check_call(['git', 'fetch', *depth_option, 'origin', revno], cwd=self.dirname) subprocess.check_call(['git', 'checkout', revno], cwd=self.dirname) if self.wrap.values.get('clone-recursive', '').lower() == 'true': subprocess.check_call(['git', 'submodule', 'update', - '--init', '--checkout', '--recursive', '--depth', self.wrap.values.get('depth')], + '--init', '--checkout', '--recursive', *depth_option], cwd=self.dirname) push_url = self.wrap.values.get('push-url') if push_url: @@ -257,13 +261,13 @@ class Resolver: subprocess.check_call(['git', 'fetch', self.wrap.get('url'), revno], cwd=self.dirname) subprocess.check_call(['git', 'checkout', revno], cwd=self.dirname) else: - subprocess.check_call(['git', 'clone', '--depth', self.wrap.values.get('depth'), + subprocess.check_call(['git', 'clone', *depth_option, '--branch', revno, self.wrap.get('url'), self.directory], cwd=self.subdir_root) if self.wrap.values.get('clone-recursive', '').lower() == 'true': subprocess.check_call(['git', 'submodule', 'update', - '--init', '--checkout', '--recursive', '--depth', self.wrap.values.get('depth')], + '--init', '--checkout', '--recursive', *depth_option], cwd=self.dirname) push_url = self.wrap.values.get('push-url') if push_url: diff --git a/run_unittests.py b/run_unittests.py index bfd7a54..27ba32f 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -860,13 +860,13 @@ class InternalTests(unittest.TestCase): def fake_call_pkgbin(self, args, env=None): if '--libs' not in args: - return 0, '' + return 0, '', '' if args[0] == 'foo': - return 0, '-L{} -lfoo -L{} -lbar'.format(p2.as_posix(), p1.as_posix()) + return 0, '-L{} -lfoo -L{} -lbar'.format(p2.as_posix(), p1.as_posix()), '' if args[0] == 'bar': - return 0, '-L{} -lbar'.format(p2.as_posix()) + return 0, '-L{} -lbar'.format(p2.as_posix()), '' if args[0] == 'internal': - return 0, '-L{} -lpthread -lm -lc -lrt -ldl'.format(p1.as_posix()) + return 0, '-L{} -lpthread -lm -lc -lrt -ldl'.format(p1.as_posix()), '' old_call = PkgConfigDependency._call_pkgbin old_check = PkgConfigDependency.check_pkgconfig @@ -5380,45 +5380,6 @@ class LinuxlikeTests(BasePlatformTests): self.build() @skipIfNoPkgconfig - def test_pkgconfig_secondary_dependencies(self): - ''' - Check that Meson gets -Wl,-rpath-link right for secondary dependencies - - This test requires at least two libraries, as -Wl,-rpath-link is only - required for dependencies of dependencies (i.e. secondary dependencies). - ''' - with tempfile.TemporaryDirectory() as tempdirname: - testdirbase = os.path.join(self.unit_test_dir, '67 rpath-link secondary') - - # build libA - testdirlibA = os.path.join(testdirbase, 'libA') - testlibAprefix = os.path.join(tempdirname, 'libAprefix') - self.init(testdirlibA, extra_args=['--prefix=' + testlibAprefix, - '--libdir=lib', - '--default-library=shared'], default_args=False) - self.build() - self.install(use_destdir=False) - - # build libB (uses libA) - pkg_dir = [os.path.join(testlibAprefix, 'lib/pkgconfig')] - self.new_builddir() - testdirlibB = os.path.join(testdirbase, 'libB') - testlibBprefix = os.path.join(tempdirname, 'libBprefix') - self.init(testdirlibB, extra_args=['--prefix=' + testlibBprefix, - '--libdir=lib', - '--default-library=shared'], default_args=False, - override_envvars={'PKG_CONFIG_PATH': ':'.join(pkg_dir)}) - self.build() - self.install(use_destdir=False) - - # build executable (uses libB, secondary dependency on libA) - pkg_dir.append(os.path.join(testlibBprefix, 'lib/pkgconfig')) - self.new_builddir() - self.init(os.path.join(testdirbase, 'app'), - override_envvars={'PKG_CONFIG_PATH': ':'.join(pkg_dir)}) - self.build() - - @skipIfNoPkgconfig def test_static_archive_stripping(self): ''' Check that Meson produces valid static archives with --strip enabled diff --git a/test cases/cmake/13 system includes/main.cpp b/test cases/cmake/13 system includes/main.cpp new file mode 100644 index 0000000..315c0f7 --- /dev/null +++ b/test cases/cmake/13 system includes/main.cpp @@ -0,0 +1,10 @@ +#include +#include + +using namespace std; + +int main() { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/13 system includes/meson.build b/test cases/cmake/13 system includes/meson.build new file mode 100644 index 0000000..db25a42 --- /dev/null +++ b/test cases/cmake/13 system includes/meson.build @@ -0,0 +1,14 @@ +project( + 'meson_cmake_system_include_bug', ['c', 'cpp'], + default_options: [ + 'warning_level=3', + #'werror=true', # TODO implement system includes + ], +) + +cm = import('cmake') +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib') + +exe1 = executable('main1', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..a6b0ba4 --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib) + +target_compile_options(cmModLib PRIVATE "-Wall" "-Werror") +target_include_directories(cmModLib SYSTEM PRIVATE "sysInc") diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..1eaf0cf --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,12 @@ +#include "cmMod.hpp" +#include "triggerWarn.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World " + to_string(bar(World)); +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp new file mode 100644 index 0000000..52f576b --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/cmMod.hpp @@ -0,0 +1,13 @@ +#pragma once + +#include +#include "cmmodlib_export.h" + +class CMMODLIB_EXPORT cmModClass { + private: + std::string str; + public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp new file mode 100644 index 0000000..3b00f2d --- /dev/null +++ b/test cases/cmake/13 system includes/subprojects/cmMod/sysInc/triggerWarn.hpp @@ -0,0 +1,14 @@ +#pragma once + +enum Foo { + Hello, + World +}; + +inline int bar( Foo foo ) { + switch(foo) { + case Hello: return 0; + // Warn because of missung case for World + } + return 1; +} diff --git a/test cases/common/163 disabler/meson.build b/test cases/common/163 disabler/meson.build index 5eb24ba..5554f14 100644 --- a/test cases/common/163 disabler/meson.build +++ b/test cases/common/163 disabler/meson.build @@ -2,6 +2,9 @@ project('dolphin option', 'c') d = disabler() +full_path = d.full_path() +assert(is_disabler(full_path), 'Method call is not a disabler') + d2 = dependency(d) d3 = (d == d2) d4 = d + 0 @@ -76,3 +79,47 @@ else has_not_changed = true endif assert(has_not_changed, 'App has changed.') + +if_is_disabled = true +if disabler() + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if condition" must skip both blocks') + +if not disabler() + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if not condition" must skip both blocks') + +if disabler() == 1 + if_is_disabled = false +else + if_is_disabled = false +endif +assert(if_is_disabled, 'Disabler in "if a==b" must skip both blocks') + +loops = 0 +disablers = 0 +foreach i : [true, disabler(), true] + loops += 1 + if is_disabler(i) + disablers += 1 + endif +endforeach +assert(loops == 3, 'Disabler in foreach array') +assert(disablers == 1, 'Disabler in foreach array') + +loops = 0 +disablers = 0 +foreach k, i : {'a': true, 'b': disabler(), 'c': true} + loops += 1 + if is_disabler(i) + disablers += 1 + endif +endforeach +assert(loops == 3, 'Disabler in foreach dict') +assert(disablers == 1, 'Disabler in foreach dict') diff --git a/test cases/unit/67 rpath-link secondary/app/app.c b/test cases/unit/67 rpath-link secondary/app/app.c deleted file mode 100644 index f33b1a9..0000000 --- a/test cases/unit/67 rpath-link secondary/app/app.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -#include - -int main() { printf("The answer is: %d\n", libB_func()); } diff --git a/test cases/unit/67 rpath-link secondary/app/meson.build b/test cases/unit/67 rpath-link secondary/app/meson.build deleted file mode 100644 index 3d85a32..0000000 --- a/test cases/unit/67 rpath-link secondary/app/meson.build +++ /dev/null @@ -1,5 +0,0 @@ -project('app', ['c']) - -b = dependency('test-b') - -executable('app', 'app.c', dependencies : [b]) diff --git a/test cases/unit/67 rpath-link secondary/libA/liba.c b/test cases/unit/67 rpath-link secondary/libA/liba.c deleted file mode 100644 index 620a994..0000000 --- a/test cases/unit/67 rpath-link secondary/libA/liba.c +++ /dev/null @@ -1 +0,0 @@ -int libA_func() { return 42; } diff --git a/test cases/unit/67 rpath-link secondary/libA/liba.h b/test cases/unit/67 rpath-link secondary/libA/liba.h deleted file mode 100644 index ed4fa7d..0000000 --- a/test cases/unit/67 rpath-link secondary/libA/liba.h +++ /dev/null @@ -1 +0,0 @@ -int libA_func(); diff --git a/test cases/unit/67 rpath-link secondary/libA/meson.build b/test cases/unit/67 rpath-link secondary/libA/meson.build deleted file mode 100644 index 383bed0..0000000 --- a/test cases/unit/67 rpath-link secondary/libA/meson.build +++ /dev/null @@ -1,14 +0,0 @@ -project('lib', ['c']) - -a = library('test-a', 'liba.c', install: true) - -install_headers(files('liba.h')) - -import('pkgconfig').generate( - a, - version: '0.0', - description: 'test library', - filebase: 'test-a', - name: 'test library', - subdirs: ['.'] -) diff --git a/test cases/unit/67 rpath-link secondary/libB/libb.c b/test cases/unit/67 rpath-link secondary/libB/libb.c deleted file mode 100644 index d097066..0000000 --- a/test cases/unit/67 rpath-link secondary/libB/libb.c +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int libB_func() { return libA_func(); } diff --git a/test cases/unit/67 rpath-link secondary/libB/libb.h b/test cases/unit/67 rpath-link secondary/libB/libb.h deleted file mode 100644 index c5de0c2..0000000 --- a/test cases/unit/67 rpath-link secondary/libB/libb.h +++ /dev/null @@ -1 +0,0 @@ -int libB_func(); diff --git a/test cases/unit/67 rpath-link secondary/libB/meson.build b/test cases/unit/67 rpath-link secondary/libB/meson.build deleted file mode 100644 index 3bfd0d2..0000000 --- a/test cases/unit/67 rpath-link secondary/libB/meson.build +++ /dev/null @@ -1,16 +0,0 @@ -project('lib', ['c']) - -libA_dep = dependency('test-a') - -b = library('test-b', 'libb.c', install: true, dependencies : libA_dep) - -install_headers(files('libb.h')) - -import('pkgconfig').generate( - b, - version: '0.0', - description: 'test library', - filebase: 'test-b', - name: 'test library', - subdirs: ['.'] -) diff --git a/test cases/unit/69 static link/lib/func17.c b/test cases/unit/69 static link/lib/func17.c new file mode 100644 index 0000000..d1d8ec4 --- /dev/null +++ b/test cases/unit/69 static link/lib/func17.c @@ -0,0 +1,4 @@ +int func17() +{ + return 1; +} diff --git a/test cases/unit/69 static link/lib/func18.c b/test cases/unit/69 static link/lib/func18.c new file mode 100644 index 0000000..c149085 --- /dev/null +++ b/test cases/unit/69 static link/lib/func18.c @@ -0,0 +1,6 @@ +int func17(); + +int func18() +{ + return func17() + 1; +} diff --git a/test cases/unit/69 static link/lib/func19.c b/test cases/unit/69 static link/lib/func19.c new file mode 100644 index 0000000..69120e4 --- /dev/null +++ b/test cases/unit/69 static link/lib/func19.c @@ -0,0 +1,7 @@ +int func17(); +int func18(); + +int func19() +{ + return func17() + func18(); +} diff --git a/test cases/unit/69 static link/lib/meson.build b/test cases/unit/69 static link/lib/meson.build index 5f04aab..8f95fc4 100644 --- a/test cases/unit/69 static link/lib/meson.build +++ b/test cases/unit/69 static link/lib/meson.build @@ -66,3 +66,15 @@ libfunc15 = static_library('func15', 'func15.c', libfunc16 = static_library('func16', 'func16.c', link_with : libfunc15, install : true) + +# Verify func17.c.o gets included only once into libfunc19, otherwise +# func19-shared would failed with duplicated symbol. +libfunc17 = static_library('func17', 'func17.c', + install : false) +libfunc18 = static_library('func18', 'func18.c', + link_with : libfunc17, + install : false) +libfunc19 = static_library('func19', 'func19.c', + link_whole : [libfunc17, libfunc18], + install : false) +shared_library('func19-shared', link_whole : [libfunc19]) -- 2.7.4