Imported Upstream version 0.48.1 39/197139/1 upstream/0.48.1
authorHyunjee Kim <hj0426.kim@samsung.com>
Thu, 10 Jan 2019 01:10:29 +0000 (10:10 +0900)
committerHyunjee Kim <hj0426.kim@samsung.com>
Thu, 10 Jan 2019 01:10:37 +0000 (10:10 +0900)
Change-Id: Ic14867633a3c8b3b8cc0988c126afb47df67f4e2
Signed-off-by: Hyunjee Kim <hj0426.kim@samsung.com>
19 files changed:
PKG-INFO
man/meson.1
meson.egg-info/PKG-INFO
meson.egg-info/SOURCES.txt
mesonbuild/backend/backends.py
mesonbuild/backend/ninjabackend.py
mesonbuild/compilers/c.py
mesonbuild/compilers/compilers.py
mesonbuild/coredata.py
mesonbuild/dependencies/dev.py
mesonbuild/environment.py
mesonbuild/mesonmain.py
mesonbuild/modules/hotdoc.py
mesonbuild/modules/i18n.py
mesonbuild/scripts/depfixer.py
test cases/frameworks/6 gettext/generated/desktopgenerator.py [new file with mode: 0644]
test cases/frameworks/6 gettext/generated/meson.build [new file with mode: 0644]
test cases/frameworks/6 gettext/generated/something.desktop.in.in [new file with mode: 0644]
test cases/frameworks/6 gettext/meson.build

index b12506f..7cf6b38 100644 (file)
--- a/PKG-INFO
+++ b/PKG-INFO
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: meson
-Version: 0.48.0
+Version: 0.48.1
 Summary: A high performance build system
 Home-page: http://mesonbuild.com
 Author: Jussi Pakkanen
index a171b0b..6d8f401 100644 (file)
@@ -1,4 +1,4 @@
-.TH MESON "1" "September 2018" "meson 0.48.0" "User Commands"
+.TH MESON "1" "October 2018" "meson 0.48.1" "User Commands"
 .SH NAME
 meson - a high productivity build system
 .SH DESCRIPTION
index b12506f..7cf6b38 100644 (file)
@@ -1,6 +1,6 @@
 Metadata-Version: 1.2
 Name: meson
-Version: 0.48.0
+Version: 0.48.1
 Summary: A high performance build system
 Home-page: http://mesonbuild.com
 Author: Jussi Pakkanen
index c1d7d3b..220b0da 100644 (file)
@@ -1565,6 +1565,9 @@ test cases/frameworks/6 gettext/data/test.desktop.in
 test cases/frameworks/6 gettext/data/test2.desktop.in
 test cases/frameworks/6 gettext/data2/meson.build
 test cases/frameworks/6 gettext/data2/test.desktop.in
+test cases/frameworks/6 gettext/generated/desktopgenerator.py
+test cases/frameworks/6 gettext/generated/meson.build
+test cases/frameworks/6 gettext/generated/something.desktop.in.in
 test cases/frameworks/6 gettext/po/LINGUAS
 test cases/frameworks/6 gettext/po/POTFILES
 test cases/frameworks/6 gettext/po/de.po
index 0e7e8e0..78c2877 100644 (file)
@@ -361,6 +361,7 @@ class Backend:
 
     @staticmethod
     def _libdir_is_system(libdir, compilers, env):
+        libdir = os.path.normpath(libdir)
         for cc in compilers.values():
             if libdir in cc.get_library_dirs(env):
                 return True
index 6b2a00a..b564311 100644 (file)
@@ -1944,6 +1944,8 @@ rule FORTRAN_DEP_HACK%s
             if not isinstance(i, (build.CustomTarget, build.CustomTargetIndex)):
                 continue
             idir = self.get_target_dir(i)
+            if not idir:
+                idir = '.'
             if idir not in custom_target_include_dirs:
                 custom_target_include_dirs.append(idir)
         incs = []
index 3ef18e8..7c6a43b 100644 (file)
@@ -124,6 +124,8 @@ class CCompiler(Compiler):
         if getattr(self, 'compiler_type', False) and self.compiler_type.is_osx_compiler:
             # Clang, GCC and ICC on macOS all use the same rpath arguments
             return self.build_osx_rpath_args(build_dir, rpath_paths, build_rpath)
+        elif self.compiler_type.is_windows_compiler:
+            return []
         return self.build_unix_rpath_args(build_dir, from_dir, rpath_paths, build_rpath, install_rpath)
 
     def get_dependency_gen_args(self, outtarget, outfile):
index a10f9ed..7db5822 100644 (file)
@@ -299,7 +299,7 @@ msvc_optimization_args = {'0': [],
                           'g': ['/O0'],
                           '1': ['/O1'],
                           '2': ['/O2'],
-                          '3': ['/O3'],
+                          '3': ['/O2'],
                           's': ['/O1'], # Implies /Os.
                           }
 
index a6f8aeb..cd9e123 100644 (file)
@@ -23,7 +23,7 @@ from .wrap import WrapMode
 import ast
 import argparse
 
-version = '0.48.0'
+version = '0.48.1'
 backendlist = ['ninja', 'vs', 'vs2010', 'vs2015', 'vs2017', 'xcode']
 
 default_yielding = False
index d8289c5..47beb4e 100644 (file)
@@ -16,6 +16,7 @@
 # development purposes, such as testing, debugging, etc..
 
 import functools
+import glob
 import os
 import re
 
@@ -27,6 +28,17 @@ from .base import (
 )
 
 
+def get_shared_library_suffix(environment, native):
+    """This is only gauranteed to work for languages that compile to machine
+    code, not for languages like C# that use a bytecode and always end in .dll
+    """
+    if mesonlib.for_windows(native, environment):
+        return '.dll'
+    elif mesonlib.for_darwin(native, environment):
+        return '.dylib'
+    return '.so'
+
+
 class GTestDependency(ExternalDependency):
     def __init__(self, environment, kwargs):
         super().__init__('gtest', environment, 'cpp', kwargs)
@@ -235,7 +247,7 @@ class LLVMDependency(ConfigToolDependency):
         self.compile_args = list(cargs.difference(self.__cpp_blacklist))
 
         if version_compare(self.version, '>= 3.9'):
-            self._set_new_link_args()
+            self._set_new_link_args(environment)
         else:
             self._set_old_link_args()
         self.link_args = strip_system_libdirs(environment, self.link_args)
@@ -258,18 +270,66 @@ class LLVMDependency(ConfigToolDependency):
                 new_args.append(arg)
         return new_args
 
-    def _set_new_link_args(self):
+    def __check_libfiles(self, shared):
+        """Use llvm-config's --libfiles to check if libraries exist."""
+        mode = '--link-shared' if shared else '--link-static'
+
+        # Set self.required to true to force an exception in get_config_value
+        # if the returncode != 0
+        restore = self.required
+        self.required = True
+
+        try:
+            # It doesn't matter what the stage is, the caller needs to catch
+            # the exception anyway.
+            self.link_args = self.get_config_value(['--libfiles', mode], '')
+        finally:
+            self.required = restore
+
+    def _set_new_link_args(self, environment):
         """How to set linker args for LLVM versions >= 3.9"""
-        if ((mesonlib.is_dragonflybsd() or mesonlib.is_freebsd()) and not
-                self.static and version_compare(self.version, '>= 4.0')):
-            # llvm-config on DragonFly BSD and FreeBSD for versions 4.0, 5.0,
-            # and 6.0 have an error when generating arguments for shared mode
-            # linking, even though libLLVM.so is installed, because for some
-            # reason the tool expects to find a .so for each static library.
-            # This works around that.
-            self.link_args = self.get_config_value(['--ldflags'], 'link_args')
-            self.link_args.append('-lLLVM')
-            return
+        mode = self.get_config_value(['--shared-mode'], 'link_args')[0]
+        if not self.static and mode == 'static':
+            # If llvm is configured with LLVM_BUILD_LLVM_DYLIB but not with
+            # LLVM_LINK_LLVM_DYLIB and not LLVM_BUILD_SHARED_LIBS (which
+            # upstreams doesn't recomend using), then llvm-config will lie to
+            # you about how to do shared-linking. It wants to link to a a bunch
+            # of individual shared libs (which don't exist because llvm wasn't
+            # built with LLVM_BUILD_SHARED_LIBS.
+            #
+            # Therefore, we'll try to get the libfiles, if the return code is 0
+            # or we get an empty list, then we'll try to build a working
+            # configuration by hand.
+            try:
+                self.__check_libfiles(True)
+            except DependencyException:
+                lib_ext = get_shared_library_suffix(environment, self.native)
+                libdir = self.get_config_value(['--libdir'], 'link_args')[0]
+                # Sort for reproducability
+                matches = sorted(glob.iglob(os.path.join(libdir, 'libLLVM*{}'.format(lib_ext))))
+                if not matches:
+                    if self.required:
+                        raise
+                    self.is_found = False
+                    return
+
+                self.link_args = self.get_config_value(['--ldflags'], 'link_args')
+                libname = os.path.basename(matches[0]).rstrip(lib_ext).lstrip('lib')
+                self.link_args.append('-l{}'.format(libname))
+                return
+        elif self.static and mode == 'shared':
+            # If, however LLVM_BUILD_SHARED_LIBS is true # (*cough* gentoo *cough*)
+            # then this is correct. Building with LLVM_BUILD_SHARED_LIBS has a side
+            # effect, it stops the generation of static archives. Therefore we need
+            # to check for that and error out on static if this is the case
+            try:
+                self.__check_libfiles(False)
+            except DependencyException:
+                if self.required:
+                    raise
+                self.is_found = False
+                return
+
         link_args = ['--link-static', '--system-libs'] if self.static else ['--link-shared']
         self.link_args = self.get_config_value(
             ['--libs', '--ldflags'] + link_args + list(self.required_modules),
index 9c969ad..6c27043 100644 (file)
@@ -374,7 +374,7 @@ class Environment:
 
     def get_build_command(self, unbuffered=False):
         cmd = mesonlib.meson_command[:]
-        if unbuffered and 'python' in cmd[0]:
+        if unbuffered and 'python' in os.path.basename(cmd[0]):
             cmd.insert(1, '-u')
         return cmd
 
index cd925e5..dfad2e7 100644 (file)
@@ -113,7 +113,7 @@ class MesonApp:
                       '\nIf build failures persist, manually wipe your build directory to clear any\n'
                       'stored system data.\n'
                       '\nTo change option values, run "meson configure" instead.')
-                sys.exit(1)
+                sys.exit(0)
         else:
             if reconfigure:
                 print('Directory does not contain a valid build tree:\n{}'.format(build_dir))
index e621938..1080160 100644 (file)
@@ -38,12 +38,13 @@ MIN_HOTDOC_VERSION = '0.8.100'
 
 
 class HotdocTargetBuilder:
-    def __init__(self, name, state, hotdoc, kwargs):
+    def __init__(self, name, state, hotdoc, interpreter, kwargs):
         self.hotdoc = hotdoc
         self.build_by_default = kwargs.pop('build_by_default', False)
         self.kwargs = kwargs
         self.name = name
         self.state = state
+        self.interpreter = interpreter
         self.include_paths = OrderedDict()
 
         self.builddir = state.environment.get_build_dir()
@@ -93,7 +94,7 @@ class HotdocTargetBuilder:
                 self.check_extra_arg_type(arg, v)
             return
 
-        valid_types = (str, bool, mesonlib.File, build.IncludeDirs)
+        valid_types = (str, bool, mesonlib.File, build.IncludeDirs, build.CustomTarget, build.BuildTarget)
         if not isinstance(value, valid_types):
             raise InvalidArguments('Argument "%s=%s" should be of type: %s.' % (
                 arg, value, [t.__name__ for t in valid_types]))
@@ -211,6 +212,9 @@ class HotdocTargetBuilder:
                     cmd.append(os.path.join(self.builddir, arg.get_curdir(), inc_dir))
 
                 continue
+            elif isinstance(arg, build.CustomTarget) or isinstance(arg, build.BuildTarget):
+                self._dependencies.append(arg)
+                arg = self.interpreter.backend.get_target_filename_abs(arg)
 
             cmd.append(arg)
 
@@ -384,7 +388,7 @@ class HotDocModule(ExtensionModule):
                                  ' required for the project name.')
 
         project_name = args[0]
-        builder = HotdocTargetBuilder(project_name, state, self.hotdoc, kwargs)
+        builder = HotdocTargetBuilder(project_name, state, self.hotdoc, self.interpreter, kwargs)
         target, install_script = builder.make_targets()
         targets = [HotdocTargetHolder(target, self.interpreter)]
         if install_script:
index 0fc052b..8b5e181 100644 (file)
@@ -82,17 +82,19 @@ class I18nModule(ExtensionModule):
         kwargs['command'] = command
 
         inputfile = kwargs['input']
-        if isinstance(inputfile, str):
-            inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
+        if hasattr(inputfile, 'held_object'):
+            ct = build.CustomTarget(kwargs['output'] + '_merge', state.subdir, state.subproject, kwargs)
+        else:
+            if isinstance(inputfile, str):
+                inputfile = mesonlib.File.from_source_file(state.environment.source_dir,
                                                        state.subdir, inputfile)
-        output = kwargs['output']
-        ifile_abs = inputfile.absolute_path(state.environment.source_dir,
-                                            state.environment.build_dir)
-        values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
-        outputs = mesonlib.substitute_values([output], values)
-        output = outputs[0]
-
-        ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
+            output = kwargs['output']
+            ifile_abs = inputfile.absolute_path(state.environment.source_dir,
+                                                state.environment.build_dir)
+            values = mesonlib.get_filenames_templates_dict([ifile_abs], None)
+            outputs = mesonlib.substitute_values([output], values)
+            output = outputs[0]
+            ct = build.CustomTarget(output + '_' + state.subdir + '_merge', state.subdir, state.subproject, kwargs)
         return ModuleReturnValue(ct, [ct])
 
     @FeatureNewKwargs('i18n.gettext', '0.37.0', ['preset'])
index d3d3028..f9d7692 100644 (file)
@@ -16,6 +16,8 @@
 import sys, struct
 import shutil, subprocess
 
+from ..mesonlib import OrderedSet
+
 SHT_STRTAB = 3
 DT_NEEDED = 1
 DT_RPATH = 15
@@ -374,7 +376,26 @@ def fix_darwin(fname, new_rpath, final_path, install_name_mappings):
     try:
         args = []
         if rpaths:
-            for rp in rpaths:
+            # TODO: fix this properly, not totally clear how
+            #
+            # removing rpaths from binaries on macOS has tons of
+            # weird edge cases. For instance, if the user provided
+            # a '-Wl,-rpath' argument in LDFLAGS that happens to
+            # coincide with an rpath generated from a dependency,
+            # this would cause installation failures, as meson would
+            # generate install_name_tool calls with two identical
+            # '-delete_rpath' arguments, which install_name_tool
+            # fails on. Because meson itself ensures that it never
+            # adds duplicate rpaths, duplicate rpaths necessarily
+            # come from user variables. The idea of using OrderedSet
+            # is to remove *at most one* duplicate RPATH entry. This
+            # is not optimal, as it only respects the user's choice
+            # partially: if they provided a non-duplicate '-Wl,-rpath'
+            # argument, it gets removed, if they provided a duplicate
+            # one, it remains in the final binary. A potentially optimal
+            # solution would split all user '-Wl,-rpath' arguments from
+            # LDFLAGS, and later add them back with '-add_rpath'.
+            for rp in OrderedSet(rpaths):
                 args += ['-delete_rpath', rp]
             subprocess.check_call(['install_name_tool', fname] + args,
                                   stdout=subprocess.DEVNULL,
@@ -392,7 +413,7 @@ def fix_darwin(fname, new_rpath, final_path, install_name_mappings):
             subprocess.check_call(['install_name_tool', fname] + args,
                                   stdout=subprocess.DEVNULL,
                                   stderr=subprocess.DEVNULL)
-    except Exception as e:
+    except Exception:
         raise
         sys.exit(0)
 
diff --git a/test cases/frameworks/6 gettext/generated/desktopgenerator.py b/test cases/frameworks/6 gettext/generated/desktopgenerator.py
new file mode 100644 (file)
index 0000000..150ed04
--- /dev/null
@@ -0,0 +1,9 @@
+#!/usr/bin/env python3
+
+import sys, shutil
+
+ifile = sys.argv[1]
+ofile = sys.argv[2]
+
+os.unlink(ofile)
+shutil.copy(ifile, ofile)
diff --git a/test cases/frameworks/6 gettext/generated/meson.build b/test cases/frameworks/6 gettext/generated/meson.build
new file mode 100644 (file)
index 0000000..02e61ba
--- /dev/null
@@ -0,0 +1,14 @@
+dgen = find_program('desktopgenerator.py')
+
+desktop_in_file = custom_target('something.desktop.in',
+  input : ['something.desktop.in.in'],
+  output : 'something.desktop.in',
+  command : [dgen, '@INPUT@', '@OUTPUT@'],
+)
+
+i18n.merge_file(
+  input : desktop_in_file,
+  output : 'something.desktop',
+  type : 'desktop',
+  po_dir : '../po',
+)
diff --git a/test cases/frameworks/6 gettext/generated/something.desktop.in.in b/test cases/frameworks/6 gettext/generated/something.desktop.in.in
new file mode 100644 (file)
index 0000000..e2094fd
--- /dev/null
@@ -0,0 +1,15 @@
+[Desktop Entry]
+Name=Something doer
+Comment=Do something
+# Translators: Search terms to find this application. Do NOT translate or localize the semicolons! The list MUST also end with a semicolon!
+Keywords=zip;tar;extract;unpack;
+TryExec=file-roller
+Exec=file-roller %U
+StartupNotify=true
+Terminal=false
+Type=Application
+# Translators: Do NOT translate or transliterate this text (this is an icon file name)!
+Icon=something
+Categories=GTK;GNOME;Utility
+X-GNOME-DocPath=file-roller/file-roller.xml
+X-GNOME-UsesNotifications=true
index 9b84856..09ef982 100644 (file)
@@ -15,3 +15,4 @@ subdir('po')
 subdir('src')
 subdir('data')
 subdir('data2')
+subdir('generated')