From de3f4fe9005f7814ef61bc75b25c0f69a0ba1e53 Mon Sep 17 00:00:00 2001 From: Michael Weiss Date: Tue, 4 Feb 2020 22:16:04 +0100 Subject: [PATCH] wayland: Fix the cross-compilation with Meson The build sandbox provides only wayland-scanner and not the library and the wayland-egl symbols check test must use nm prefixed with the target triplet. --- pkgs/development/libraries/wayland/default.nix | 15 +++++++++++---- .../wayland/fix-wayland-cross-compilation.patch | 14 ++++++++++++++ 2 files changed, 25 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix index db476da55a1..ef88e690067 100644 --- a/pkgs/development/libraries/wayland/default.nix +++ b/pkgs/development/libraries/wayland/default.nix @@ -8,7 +8,9 @@ # Require the optional to be enabled until upstream fixes or removes the configure flag assert expat != null; -stdenv.mkDerivation rec { +let + isCross = stdenv.buildPlatform != stdenv.hostPlatform; +in stdenv.mkDerivation rec { pname = "wayland"; version = "1.18.0"; @@ -21,15 +23,20 @@ stdenv.mkDerivation rec { mesonFlags = [ "-Ddocumentation=${lib.boolToString withDocumentation}" ]; + patches = lib.optional isCross ./fix-wayland-cross-compilation.patch; + postPatch = lib.optionalString withDocumentation '' patchShebangs doc/doxygen/gen-doxygen.py + '' + lib.optionalString isCross '' + substituteInPlace egl/meson.build --replace \ + "find_program('nm').path()" \ + "find_program('${stdenv.cc.targetPrefix}nm').path()" ''; nativeBuildInputs = [ meson pkgconfig ninja - ] ++ lib.optionals (stdenv.buildPlatform != stdenv.hostPlatform) [ - # for wayland-scanner during build - wayland + ] ++ lib.optionals isCross [ + wayland # For wayland-scanner during the build ] ++ lib.optionals withDocumentation [ (graphviz-nox.override { pango = null; }) # To avoid an infinite recursion doxygen libxslt xmlto python3 docbook_xml_dtd_45 diff --git a/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch b/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch new file mode 100644 index 00000000000..77639acb653 --- /dev/null +++ b/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch @@ -0,0 +1,14 @@ +diff --git a/src/meson.build b/src/meson.build +index 3e8c9bf..75241cb 100644 +--- a/src/meson.build ++++ b/src/meson.build +@@ -55,8 +55,7 @@ pkgconfig.generate( + ) + + if meson.is_cross_build() +- scanner_dep = dependency('wayland-scanner', native: true, version: '>=1.14.0') +- wayland_scanner_for_build = find_program(scanner_dep.get_pkgconfig_variable('wayland_scanner')) ++ wayland_scanner_for_build = find_program('wayland-scanner', native: true, version: '>=1.14.0') + else + wayland_scanner_for_build = wayland_scanner + endif