about summary refs log tree commit diff
path: root/pkgs
diff options
context:
space:
mode:
authorMatthew Bauer <mjbauer95@gmail.com>2019-08-13 13:38:11 -0400
committerGitHub <noreply@github.com>2019-08-13 13:38:11 -0400
commit3ff9b6edecd0ddb04e08ee41c1cd2d8d6bd11570 (patch)
tree677a3f8f59777905e5def7e832d5241e8ddefa76 /pkgs
parentbab946b2164f92ffc0bba768e852e1a3ee4e3fe2 (diff)
parent396e3a6b3cf11578b1005fd6ad0513d6edaba46b (diff)
Merge pull request #65783 from Mic92/drm
libdrm: cross-compile fix
Diffstat (limited to 'pkgs')
-rw-r--r--pkgs/development/libraries/libdrm/cross-build-nm-path.patch48
-rw-r--r--pkgs/development/libraries/libdrm/default.nix6
2 files changed, 53 insertions, 1 deletions
diff --git a/pkgs/development/libraries/libdrm/cross-build-nm-path.patch b/pkgs/development/libraries/libdrm/cross-build-nm-path.patch
new file mode 100644
index 0000000000000..478534e65e51e
--- /dev/null
+++ b/pkgs/development/libraries/libdrm/cross-build-nm-path.patch
@@ -0,0 +1,48 @@
+From 9e05fece7918edce9c6aa5a1f1ea375108e5b2be Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= <joerg@thalheim.io>
+Date: Fri, 2 Aug 2019 10:26:37 +0100
+Subject: [PATCH] meson: support for custom nm path
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+When cross-compiling target toolchains i.e. binutils are often
+prefixed by its target architecture. This patch gives the user
+to option to specify the nm used during the build process.
+
+Signed-off-by: Jörg Thalheim <joerg@thalheim.io>
+---
+ meson.build       | 2 +-
+ meson_options.txt | 6 ++++++
+ 2 files changed, 7 insertions(+), 1 deletion(-)
+
+diff --git a/meson.build b/meson.build
+index e292554a..64607139 100644
+--- a/meson.build
++++ b/meson.build
+@@ -327,7 +327,7 @@ pkg.generate(
+ )
+ 
+ env_test = environment()
+-env_test.set('NM', find_program('nm').path())
++env_test.set('NM', find_program(get_option('nm-path')).path())
+ 
+ if with_libkms
+   subdir('libkms')
+diff --git a/meson_options.txt b/meson_options.txt
+index 8af33f1c..b4f46a52 100644
+--- a/meson_options.txt
++++ b/meson_options.txt
+@@ -141,3 +141,9 @@ option(
+   value : false,
+   description : 'Enable support for using udev instead of mknod.',
+ )
++option(
++  'nm-path',
++  type : 'string',
++  description : 'path to nm',
++  value : 'nm'
++)
+-- 
+2.22.0
+
diff --git a/pkgs/development/libraries/libdrm/default.nix b/pkgs/development/libraries/libdrm/default.nix
index bdc191fe8a38e..29d59659f90de 100644
--- a/pkgs/development/libraries/libdrm/default.nix
+++ b/pkgs/development/libraries/libdrm/default.nix
@@ -14,6 +14,8 @@ stdenv.mkDerivation rec {
   nativeBuildInputs = [ pkgconfig meson ninja ];
   buildInputs = [ libpthreadstubs libpciaccess valgrind-light ];
 
+  patches = [ ./cross-build-nm-path.patch ];
+
   postPatch = ''
     for a in */*-symbol-check ; do
       patchShebangs $a
@@ -21,7 +23,9 @@ stdenv.mkDerivation rec {
   '';
 
   mesonFlags =
-    [ "-Dinstall-test-programs=true" ]
+    [
+      "-Dnm-path=${stdenv.cc.targetPrefix}nm"
+      "-Dinstall-test-programs=true" ]
     ++ stdenv.lib.optionals (stdenv.isAarch32 || stdenv.isAarch64)
       [ "-Dtegra=true" "-Detnaviv=true" ]
     ++ stdenv.lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) "-Dintel=false"