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; [ 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 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;