summary refs log tree commit diff
path: root/pkgs/development/tools/build-managers
diff options
context:
space:
mode:
authorTuomas Tynkkynen <tuomas@tuxera.com>2018-03-22 09:54:10 +0200
committerTuomas Tynkkynen <tuomas@tuxera.com>2018-03-22 09:54:10 +0200
commit809b0d26bd34fcf13a35025dacf731c0a3d13292 (patch)
tree96bf2739244a52d15556e1207bdfaf93d6353bee /pkgs/development/tools/build-managers
parentc9d3fc7cad4d243025f9a0e1b3eec9305863c06d (diff)
parentf7397f21ab841955eb277919f19035cbc336e88b (diff)
downloadnixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar.gz
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar.bz2
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar.lz
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar.xz
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.tar.zst
nixpkgs-809b0d26bd34fcf13a35025dacf731c0a3d13292.zip
Merge remote-tracking branch 'upstream/master' into staging
Diffstat (limited to 'pkgs/development/tools/build-managers')
-rw-r--r--pkgs/development/tools/build-managers/apache-ant/default.nix4
-rw-r--r--pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch25
-rw-r--r--pkgs/development/tools/build-managers/meson/default.nix22
-rw-r--r--pkgs/development/tools/build-managers/meson/fix-rpath.patch32
-rw-r--r--pkgs/development/tools/build-managers/meson/setup-hook.sh9
5 files changed, 85 insertions, 7 deletions
diff --git a/pkgs/development/tools/build-managers/apache-ant/default.nix b/pkgs/development/tools/build-managers/apache-ant/default.nix
index 8816a005ca0..b6c2702485b 100644
--- a/pkgs/development/tools/build-managers/apache-ant/default.nix
+++ b/pkgs/development/tools/build-managers/apache-ant/default.nix
@@ -1,6 +1,6 @@
 { fetchurl, stdenv, coreutils, makeWrapper }:
 
-let version = "1.9.6"; in
+let version = "1.10.2"; in
 
 stdenv.mkDerivation {
   name = "ant-${version}";
@@ -9,7 +9,7 @@ stdenv.mkDerivation {
 
   src = fetchurl {
     url = "mirror://apache/ant/binaries/apache-ant-${version}-bin.tar.bz2";
-    sha256 = "1cwd5vq175gyicw0hkm8idwa33zxwhf7xlxywaqxcqqdjql0jfx4";
+    sha256 = "0662qammjvibh9kgkxzadkayfn2r7iwnagbwaw28crqqclrb2rp1";
   };
 
   contrib = fetchurl {
diff --git a/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch b/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch
new file mode 100644
index 00000000000..b44289d74f5
--- /dev/null
+++ b/pkgs/development/tools/build-managers/meson/allow-dirs-outside-of-prefix.patch
@@ -0,0 +1,25 @@
+--- a/mesonbuild/coredata.py
++++ b/mesonbuild/coredata.py
+@@ -266,18 +266,13 @@
+         '''
+         if option.endswith('dir') and os.path.isabs(value) and \
+            option not in builtin_dir_noprefix_options:
+-            # Value must be a subdir of the prefix
+             # commonpath will always return a path in the native format, so we
+             # must use pathlib.PurePath to do the same conversion before
+             # comparing.
+-            if commonpath([value, prefix]) != str(PurePath(prefix)):
+-                m = 'The value of the {!r} option is {!r} which must be a ' \
+-                    'subdir of the prefix {!r}.\nNote that if you pass a ' \
+-                    'relative path, it is assumed to be a subdir of prefix.'
+-                raise MesonException(m.format(option, value, prefix))
+-            # Convert path to be relative to prefix
+-            skip = len(prefix) + 1
+-            value = value[skip:]
++            if commonpath([value, prefix]) == str(PurePath(prefix)):
++                # Convert path to be relative to prefix
++                skip = len(prefix) + 1
++                value = value[skip:]
+         return value
+ 
+     def init_builtins(self, options):
diff --git a/pkgs/development/tools/build-managers/meson/default.nix b/pkgs/development/tools/build-managers/meson/default.nix
index 27aa38cfa7e..47e57423632 100644
--- a/pkgs/development/tools/build-managers/meson/default.nix
+++ b/pkgs/development/tools/build-managers/meson/default.nix
@@ -1,4 +1,4 @@
-{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, m4 }: let
+{ lib, python3Packages, stdenv, targetPlatform, writeTextDir, substituteAll }: let
   targetPrefix = lib.optionalString stdenv.isCross
                    (targetPlatform.config + "-");
 in python3Packages.buildPythonApplication rec {
@@ -21,17 +21,29 @@ in python3Packages.buildPythonApplication rec {
   '';
 
   patches = [
+    # Upstream insists on not allowing bindir and other dir options
+    # outside of prefix for some reason:
+    # https://github.com/mesonbuild/meson/issues/2561
+    # We remove the check so multiple outputs can work sanely.
+    ./allow-dirs-outside-of-prefix.patch
+
     # Unlike libtool, vanilla Meson does not pass any information
     # about the path library will be installed to to g-ir-scanner,
     # breaking the GIR when path other than ${!outputLib}/lib is used.
     # We patch Meson to add a --fallback-library-path argument with
     # library install_dir to g-ir-scanner.
     ./gir-fallback-path.patch
-  ];
 
-  postPatch = ''
-    sed -i -e 's|e.fix_rpath(install_rpath)||' mesonbuild/scripts/meson_install.py
-  '';
+    # In common distributions, RPATH is only needed for internal libraries so
+    # meson removes everything else. With Nix, the locations of libraries
+    # are not as predictable, therefore we need to keep them in the RPATH.
+    # At the moment we are keeping the paths starting with /nix/store.
+    # https://github.com/NixOS/nixpkgs/issues/31222#issuecomment-365811634
+    (substituteAll {
+      src = ./fix-rpath.patch;
+      inherit (builtins) storeDir;
+    })
+  ];
 
   setupHook = ./setup-hook.sh;
 
diff --git a/pkgs/development/tools/build-managers/meson/fix-rpath.patch b/pkgs/development/tools/build-managers/meson/fix-rpath.patch
new file mode 100644
index 00000000000..e52428a7db2
--- /dev/null
+++ b/pkgs/development/tools/build-managers/meson/fix-rpath.patch
@@ -0,0 +1,32 @@
+--- a/mesonbuild/compilers/compilers.py
++++ b/mesonbuild/compilers/compilers.py
+@@ -846,8 +848,10 @@
+             if paths != '':
+                 paths += ':'
+             paths += build_rpath
+-        if len(paths) < len(install_rpath):
+-            padding = 'X' * (len(install_rpath) - len(paths))
++        store_paths = ':'.join(filter(lambda path: path.startswith('@storeDir@'), paths.split(':')))
++        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
+@@ -300,6 +300,14 @@
+             return
+         self.bf.seek(rp_off)
+         old_rpath = self.read_str()
++
++        if new_rpath:
++            new_rpath += b':'
++        else:
++            new_rpath = b''
++
++        new_rpath += b':'.join(filter(lambda path: path.startswith(b'@storeDir@'), old_rpath.split(b':')))
++
+         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
diff --git a/pkgs/development/tools/build-managers/meson/setup-hook.sh b/pkgs/development/tools/build-managers/meson/setup-hook.sh
index 341b1ff9e6e..36a7fe23ef5 100644
--- a/pkgs/development/tools/build-managers/meson/setup-hook.sh
+++ b/pkgs/development/tools/build-managers/meson/setup-hook.sh
@@ -10,6 +10,15 @@ mesonConfigurePhase() {
       crossMesonFlags="--cross-file=@crossFile@/cross-file.conf"
     fi
 
+    # See multiple-outputs.sh and meson’s coredata.py
+    mesonFlags="\
+        --libdir=${!outputLib}/lib --libexecdir=${!outputLib}/libexec \
+        --bindir=${!outputBin}/bin --sbindir=${!outputBin}/sbin \
+        --includedir=${!outputInclude}/include \
+        --mandir=${!outputMan}/share/man --infodir=${!outputInfo}/share/info \
+        --localedir=${!outputLib}/share/locale \
+        $mesonFlags"
+
     mesonFlags="${crossMesonFlags+$crossMesonFlags }--buildtype=${mesonBuildType:-release} $mesonFlags"
 
     echo "meson flags: $mesonFlags ${mesonFlagsArray[@]}"