From 162c0c3e6100461b5ed59144e6a69c179dfde84a Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 27 May 2020 16:07:58 +0000 Subject: [PATCH 1/3] mkDerivation: Don't need to specify pkg-config for meson any more Env var will work fine. --- pkgs/stdenv/generic/make-derivation.nix | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix index 09879451d8e4..993ae68e9e81 100644 --- a/pkgs/stdenv/generic/make-derivation.nix +++ b/pkgs/stdenv/generic/make-derivation.nix @@ -262,7 +262,7 @@ in rec { else if isx86_32 then "x86" else if isx86_64 then "x86_64" else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits; - crossFile = builtins.toFile "cross-file.conf" ('' + crossFile = builtins.toFile "cross-file.conf" '' [properties] needs_exe_wrapper = true @@ -271,13 +271,7 @@ in rec { cpu_family = '${cpuFamily stdenv.targetPlatform}' cpu = '${stdenv.targetPlatform.parsed.cpu.name}' endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"} - '' - # TODO should have target prefix too, issue #86077 - + '' - - [binaries] - pkgconfig = 'pkg-config' - ''); + ''; in [ "--cross-file=${crossFile}" ] ++ mesonFlags; } // lib.optionalAttrs (attrs.enableParallelBuilding or false) { enableParallelChecking = attrs.enableParallelChecking or true; From f005272623abfb9eb470b0317a9d18250daa3526 Mon Sep 17 00:00:00 2001 From: John Ericson Date: Wed, 27 May 2020 17:12:43 +0000 Subject: [PATCH 2/3] wayland: Simplify cross build Now that we have a pkg-config wrapper, we can get build-time deps via pkg-config. --- pkgs/development/libraries/wayland/default.nix | 7 ++++--- .../wayland/fix-wayland-cross-compilation.patch | 14 -------------- 2 files changed, 4 insertions(+), 17 deletions(-) delete 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 e3b2941e8eee..402177b899c3 100644 --- a/pkgs/development/libraries/wayland/default.nix +++ b/pkgs/development/libraries/wayland/default.nix @@ -23,16 +23,17 @@ in 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()" ''; + depsBuildBuild = [ + pkgconfig + ]; + nativeBuildInputs = [ meson pkgconfig ninja ] ++ lib.optionals isCross [ diff --git a/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch b/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch deleted file mode 100644 index 77639acb6530..000000000000 --- a/pkgs/development/libraries/wayland/fix-wayland-cross-compilation.patch +++ /dev/null @@ -1,14 +0,0 @@ -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 From 62e6d73a09870174a891d2a8d29a38e62b05efd5 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Wed, 27 May 2020 17:41:25 +0300 Subject: [PATCH 3/3] mesa: Fix cross build --- pkgs/development/libraries/mesa/default.nix | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 7eb18dd31c1b..aa70e9e5a549 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, fetchpatch +{ stdenv, lib, fetchurl, fetchpatch, buildPackages , pkgconfig, intltool, ninja, meson , file, flex, bison, expat, libdrm, xorg, wayland, wayland-protocols, openssl , llvmPackages, libffi, libomxil-bellagio, libva-minimal @@ -73,6 +73,12 @@ stdenv.mkDerivation { }) ]; + postPatch = '' + substituteInPlace meson.build --replace \ + "find_program('pkg-config')" \ + "find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')" + ''; + outputs = [ "out" "dev" "drivers" "osmesa" ]; # TODO: Figure out how to enable opencl without having a runtime dependency on clang @@ -112,10 +118,14 @@ stdenv.mkDerivation { ++ lib.optionals stdenv.isLinux [ libomxil-bellagio libva-minimal ] ++ lib.optional withValgrind valgrind-light; + depsBuildBuild = [ pkgconfig ]; + nativeBuildInputs = [ pkgconfig meson ninja intltool bison flex file python3Packages.python python3Packages.Mako + ] ++ lib.optionals (elem "wayland" eglPlatforms) [ + wayland # For wayland-scanner during the build ]; propagatedBuildInputs = with xorg; [