about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/tools/build-managers/meson
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2020-01-11 23:37:02 +0000
committerAlyssa Ross <hi@alyssa.is>2020-01-11 23:41:30 +0000
commit6c557e3f1c28cf87e9fba232811d6875dd1399c1 (patch)
tree035a071d5d8980df6de0fa42e2ef8fc0cce7055e /nixpkgs/pkgs/development/tools/build-managers/meson
parentda7500bc026e937ac7fce7b50f67a0e1765737a7 (diff)
parente4134747f5666bcab8680aff67fa3b63384f9a0f (diff)
downloadnixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.gz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.bz2
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.lz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.xz
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.tar.zst
nixlib-6c557e3f1c28cf87e9fba232811d6875dd1399c1.zip
Merge commit 'e4134747f5666bcab8680aff67fa3b63384f9a0f'
Diffstat (limited to 'nixpkgs/pkgs/development/tools/build-managers/meson')
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/meson/default.nix42
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/meson/fix-objc-linking.patch22
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch47
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch6
-rw-r--r--nixpkgs/pkgs/development/tools/build-managers/meson/setup-hook.sh4
5 files changed, 60 insertions, 61 deletions
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix b/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix
index fad5bc9e630d..e4d4994a7814 100644
--- a/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix
+++ b/nixpkgs/pkgs/development/tools/build-managers/meson/default.nix
@@ -1,22 +1,30 @@
-{ lib, python3Packages, stdenv, writeTextDir, substituteAll, targetPackages }:
+{ lib
+, python3Packages
+, fetchpatch
+, stdenv
+, writeTextDir
+, substituteAll
+, targetPackages
+}:
 
 let
   # See https://mesonbuild.com/Reference-tables.html#cpu-families
   cpuFamilies = {
-    aarch64 = "aarch64";
-    armv6l  = "arm";
-    armv7l  = "arm";
-    i686    = "x86";
-    x86_64  = "x86_64";
+    aarch64  = "aarch64";
+    armv5tel = "arm";
+    armv6l   = "arm";
+    armv7l   = "arm";
+    i686     = "x86";
+    x86_64   = "x86_64";
   };
 in
 python3Packages.buildPythonApplication rec {
   pname = "meson";
-  version = "0.51.2";
+  version = "0.52.1";
 
   src = python3Packages.fetchPypi {
     inherit pname version;
-    sha256 = "0cqhkjbab1mbvxmbjvyfrbjfkm7bh436svqpjapca36c2k9h1vwr";
+    sha256 = "02fnrk1fjf3yiix0ak0m9vgbpl4h97fafii5pmw7phmvnlv9fyan";
   };
 
   postFixup = ''
@@ -54,14 +62,14 @@ python3Packages.buildPythonApplication rec {
       src = ./fix-rpath.patch;
       inherit (builtins) storeDir;
     })
-  ] ++ lib.optionals stdenv.isDarwin [
-    # We use custom Clang, which makes Meson think *not Apple*, while still
-    # relying on system linker. When it detects standard Clang, Meson will
-    # pass it `-Wl,-O1` flag but optimizations are not recognized by
-    # Mac linker.
-    # https://github.com/mesonbuild/meson/issues/4784
-    # Should be fixed in 0.52
-    ./fix-objc-linking.patch
+
+    # Fix detecting incorrect compiler in the store path hash.
+    # https://github.com/NixOS/nixpkgs/issues/73417#issuecomment-554077964
+    # https://github.com/mesonbuild/meson/pull/6185
+    (fetchpatch {
+      url = "https://github.com/mesonbuild/meson/commit/972ede1d14fdf17fe5bb8fb99be220f9395c2392.patch";
+      sha256 = "19bfsylhpy0b2xv3ks8ac9x3q6vvvyj1wjcy971v9d5f1455xhbb";
+    })
   ];
 
   setupHook = ./setup-hook.sh;
@@ -96,7 +104,7 @@ python3Packages.buildPythonApplication rec {
   isCross = stdenv.targetPlatform != stdenv.hostPlatform;
 
   meta = with lib; {
-    homepage = http://mesonbuild.com;
+    homepage = https://mesonbuild.com;
     description = "SCons-like build system that use python as a front-end language and Ninja as a building backend";
     license = licenses.asl20;
     maintainers = with maintainers; [ mbe rasendubi ];
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-objc-linking.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/fix-objc-linking.patch
deleted file mode 100644
index 996e0c3420e2..000000000000
--- a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-objc-linking.patch
+++ /dev/null
@@ -1,22 +0,0 @@
-diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py
-index dc8f099b..d8581fcf 100644
---- a/mesonbuild/environment.py
-+++ b/mesonbuild/environment.py
-@@ -944,7 +944,7 @@
-                 compiler_type = self.get_gnu_compiler_type(defines)
-                 version = self.get_gnu_version_from_defines(defines)
-                 return GnuObjCCompiler(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, defines)
--            if out.startswith('Apple LLVM') or out.startswith('Apple clang'):
-+            if out.startswith('Apple LLVM') or out.startswith('Apple clang') or self.machines.build.is_darwin():
-                 return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, for_machine, is_cross, exe_wrap)
-             if 'windows' in out:
-                 return ClangObjCCompiler(ccache + compiler, version, CompilerType.CLANG_MINGW, for_machine, is_cross, exe_wrap)
-@@ -974,7 +974,7 @@
-                 compiler_type = self.get_gnu_compiler_type(defines)
-                 version = self.get_gnu_version_from_defines(defines)
-                 return GnuObjCPPCompiler(ccache + compiler, version, compiler_type, for_machine, is_cross, exe_wrap, defines)
--            if out.startswith('Apple LLVM') or out.startswith('Apple clang'):
-+            if out.startswith('Apple LLVM') or out.startswith('Apple clang') or self.machines.build.is_darwin():
-                 return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_OSX, for_machine, is_cross, exe_wrap)
-             if 'windows' in out:
-                 return ClangObjCPPCompiler(ccache + compiler, version, CompilerType.CLANG_MINGW, for_machine, is_cross, exe_wrap)
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch
index 1a5f8cb89dce..6cf7afc2bdf3 100644
--- a/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch
+++ b/nixpkgs/pkgs/development/tools/build-managers/meson/fix-rpath.patch
@@ -1,21 +1,34 @@
---- a/mesonbuild/compilers/compilers.py
-+++ b/mesonbuild/compilers/compilers.py
-@@ -1202,8 +1202,10 @@
-             # In order to avoid relinking for RPATH removal, the binary needs to contain just
-             # enough space in the ELF header to hold the final installation RPATH.
-             paths = ':'.join(all_paths)
--            if len(paths) < len(install_rpath):
--                padding = 'X' * (len(install_rpath) - len(paths))
-+            store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), all_paths))
-+            extra_space_needed = len(install_rpath + (':' if install_rpath and store_paths else '') + store_paths) - len(paths)
-+            if extra_space_needed > 0:
-+                padding = 'X' * extra_space_needed
-                 if not paths:
-                     paths = padding
-                 else:
+--- a/mesonbuild/linkers.py
++++ b/mesonbuild/linkers.py
+@@ -527,8 +527,10 @@ class GnuLikeDynamicLinkerMixin:
+         # In order to avoid relinking for RPATH removal, the binary needs to contain just
+         # enough space in the ELF header to hold the final installation RPATH.
+         paths = ':'.join(all_paths)
+-        if len(paths) < len(install_rpath):
+-            padding = 'X' * (len(install_rpath) - len(paths))
++        store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), all_paths))
++        extra_space_needed = len(install_rpath + (':' if install_rpath and store_paths else '') + store_paths) - len(paths)
++        if extra_space_needed > 0:
++            padding = 'X' * extra_space_needed
+             if not paths:
+                 paths = padding
+             else:
+@@ -902,8 +904,10 @@ class SolarisDynamicLinker(PosixDynamicLinkerMixin, DynamicLinker):
+         # In order to avoid relinking for RPATH removal, the binary needs to contain just
+         # enough space in the ELF header to hold the final installation RPATH.
+         paths = ':'.join(all_paths)
+-        if len(paths) < len(install_rpath):
+-            padding = 'X' * (len(install_rpath) - len(paths))
++        store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), all_paths))
++        extra_space_needed = len(install_rpath + (':' if install_rpath and store_paths else '') + store_paths) - len(paths)
++        if extra_space_needed > 0:
++            padding = 'X' * extra_space_needed
+             if not paths:
+                 paths = padding
+             else:
 --- a/mesonbuild/scripts/depfixer.py
 +++ b/mesonbuild/scripts/depfixer.py
-@@ -303,6 +303,14 @@
+@@ -303,6 +303,14 @@ class Elf(DataSizes):
              return
          self.bf.seek(rp_off)
          old_rpath = self.read_str()
@@ -30,7 +43,7 @@
          if len(old_rpath) < len(new_rpath):
              sys.exit("New rpath must not be longer than the old one.")
          # The linker does read-only string deduplication. If there is a
-@@ -316,6 +324,10 @@
+@@ -316,6 +324,10 @@ class Elf(DataSizes):
          if not new_rpath:
              self.remove_rpath_entry(entrynum)
          else:
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch b/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch
index 7a33d4127fae..e59795486aa8 100644
--- a/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch
+++ b/nixpkgs/pkgs/development/tools/build-managers/meson/gir-fallback-path.patch
@@ -1,8 +1,8 @@
 --- a/mesonbuild/modules/gnome.py
 +++ b/mesonbuild/modules/gnome.py
-@@ -805,6 +805,13 @@
-         scan_command += self._scan_langs(state, [lc[0] for lc in langs_compilers])
-         scan_command += list(external_ldflags)
+@@ -801,6 +801,13 @@ class GnomeModule(ExtensionModule):
+             scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_source_dir(), self.interpreter.subproject_dir, state.subproject)]
+             scan_command += ['--sources-top-dirs', os.path.join(state.environment.get_build_dir(), self.interpreter.subproject_dir, state.subproject)]
  
 +        if len(set([girtarget.get_custom_install_dir()[0] for girtarget in girtargets])) > 1:
 +            raise MesonException('generate_gir tries to build multiple libraries with different install_dir at once: {}'.format(','.join([str(girtarget) for girtarget in girtargets])))
diff --git a/nixpkgs/pkgs/development/tools/build-managers/meson/setup-hook.sh b/nixpkgs/pkgs/development/tools/build-managers/meson/setup-hook.sh
index 6e8d94523e14..8d76ecdaf32b 100644
--- a/nixpkgs/pkgs/development/tools/build-managers/meson/setup-hook.sh
+++ b/nixpkgs/pkgs/development/tools/build-managers/meson/setup-hook.sh
@@ -1,7 +1,7 @@
 mesonConfigurePhase() {
     runHook preConfigure
 
-    if [ -z "$dontAddPrefix" ]; then
+    if [ -z "${dontAddPrefix-}" ]; then
         mesonFlags="--prefix=$prefix $mesonFlags"
     fi
 
@@ -36,7 +36,7 @@ mesonConfigurePhase() {
     runHook postConfigure
 }
 
-if [ -z "$dontUseMesonConfigure" -a -z "$configurePhase" ]; then
+if [ -z "${dontUseMesonConfigure-}" -a -z "${configurePhase-}" ]; then
     setOutputFlags=
     configurePhase=mesonConfigurePhase
 fi