diff --git a/pkgs/applications/window-managers/owl/default.nix b/pkgs/applications/window-managers/owl/default.nix index 2bef1b024b3e..812e65830b33 100644 --- a/pkgs/applications/window-managers/owl/default.nix +++ b/pkgs/applications/window-managers/owl/default.nix @@ -9,8 +9,6 @@ , darwin }: -assert wayland.withLibraries; - let stdenv = clangStdenv; in diff --git a/pkgs/development/libraries/wayland/default.nix b/pkgs/development/libraries/wayland/default.nix index 5a78a5c993ef..8398dce70790 100644 --- a/pkgs/development/libraries/wayland/default.nix +++ b/pkgs/development/libraries/wayland/default.nix @@ -5,13 +5,10 @@ , pkg-config , ninja , wayland-scanner -, expat -, libxml2 -, withLibraries ? stdenv.isLinux || stdenv.isDarwin , withTests ? stdenv.isLinux , libffi , epoll-shim -, withDocumentation ? withLibraries && stdenv.hostPlatform == stdenv.buildPlatform +, withDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform , graphviz-nox , doxygen , libxslt @@ -23,15 +20,6 @@ , testers }: -# Documentation is only built when building libraries. -assert withDocumentation -> withLibraries; - -# Tests are only built when building libraries. -assert withTests -> withLibraries; - -let - isCross = stdenv.buildPlatform != stdenv.hostPlatform; -in stdenv.mkDerivation (finalAttrs: { pname = "wayland"; version = "1.23.0"; @@ -53,13 +41,13 @@ stdenv.mkDerivation (finalAttrs: { sed -i '/os-wrappers-test/d' tests/meson.build ''; - outputs = [ "out" "bin" "dev" ] ++ lib.optionals withDocumentation [ "doc" "man" ]; + outputs = [ "out" "dev" ] ++ lib.optionals withDocumentation [ "doc" "man" ]; separateDebugInfo = true; mesonFlags = [ - "-Ddocumentation=${lib.boolToString withDocumentation}" - "-Dlibraries=${lib.boolToString withLibraries}" - "-Dtests=${lib.boolToString withTests}" + (lib.mesonBool "documentation" withDocumentation) + (lib.mesonBool "tests" withTests) + (lib.mesonBool "scanner" false) # wayland-scanner is a separate derivation ]; depsBuildBuild = [ @@ -70,7 +58,6 @@ stdenv.mkDerivation (finalAttrs: { meson pkg-config ninja - ] ++ lib.optionals isCross [ wayland-scanner ] ++ lib.optionals withDocumentation [ (graphviz-nox.override { pango = null; }) # To avoid an infinite recursion @@ -83,11 +70,8 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ - expat - libxml2 - ] ++ lib.optionals withLibraries [ libffi - ] ++ lib.optionals (withLibraries && !stdenv.hostPlatform.isLinux) [ + ] ++ lib.optionals (!stdenv.hostPlatform.isLinux) [ epoll-shim ] ++ lib.optionals withDocumentation [ docbook_xsl @@ -95,20 +79,7 @@ stdenv.mkDerivation (finalAttrs: { docbook_xml_dtd_42 ]; - postFixup = '' - # The pkg-config file is required for cross-compilation: - mkdir -p $bin/lib/pkgconfig/ - cat < $bin/lib/pkgconfig/wayland-scanner.pc - wayland_scanner=$bin/bin/wayland-scanner - - Name: Wayland Scanner - Description: Wayland scanner - Version: ${finalAttrs.version} - EOF - ''; - passthru = { - inherit withLibraries; tests.pkg-config = testers.hasPkgConfigModules { package = finalAttrs.finalPackage; }; @@ -130,8 +101,6 @@ stdenv.mkDerivation (finalAttrs: { platforms = platforms.unix; maintainers = with maintainers; [ primeos codyopel qyliss ]; pkgConfigModules = [ - "wayland-scanner" - ] ++ lib.optionals withLibraries [ "wayland-client" "wayland-cursor" "wayland-egl" diff --git a/pkgs/development/libraries/wayland/protocols.nix b/pkgs/development/libraries/wayland/protocols.nix index ca1e84b1c609..a341fed9e6be 100644 --- a/pkgs/development/libraries/wayland/protocols.nix +++ b/pkgs/development/libraries/wayland/protocols.nix @@ -8,8 +8,9 @@ stdenv.mkDerivation rec { pname = "wayland-protocols"; version = "1.36"; + doCheck = stdenv.hostPlatform == stdenv.buildPlatform && # https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/48 - doCheck = stdenv.hostPlatform == stdenv.buildPlatform && stdenv.hostPlatform.linker == "bfd" && wayland.withLibraries; + stdenv.hostPlatform.linker == "bfd" && lib.meta.availableOn stdenv.hostPlatform wayland; src = fetchurl { url = "https://gitlab.freedesktop.org/wayland/${pname}/-/releases/${version}/downloads/${pname}-${version}.tar.xz"; @@ -22,7 +23,8 @@ stdenv.mkDerivation rec { depsBuildBuild = [ pkg-config ]; nativeBuildInputs = [ meson ninja wayland-scanner ]; - nativeCheckInputs = [ python3 wayland ]; + nativeCheckInputs = [ python3 ]; + checkInputs = [ wayland ]; mesonFlags = [ "-Dtests=${lib.boolToString doCheck}" ]; diff --git a/pkgs/development/libraries/wayland/scanner.nix b/pkgs/development/libraries/wayland/scanner.nix new file mode 100644 index 000000000000..946b73468c57 --- /dev/null +++ b/pkgs/development/libraries/wayland/scanner.nix @@ -0,0 +1,48 @@ +{ + lib, + stdenv, + wayland, + meson, + pkg-config, + ninja, + wayland-scanner, + expat, + libxml2, +}: + +stdenv.mkDerivation { + pname = "wayland-scanner"; + inherit (wayland) version src; + + outputs = [ + "out" + "bin" + "dev" + ]; + separateDebugInfo = true; + + mesonFlags = [ + (lib.mesonBool "documentation" false) + (lib.mesonBool "libraries" false) + (lib.mesonBool "tests" false) + ]; + + depsBuildBuild = [ pkg-config ]; + + nativeBuildInputs = [ + meson + pkg-config + ninja + ] ++ lib.optional (stdenv.hostPlatform != stdenv.buildPlatform) wayland-scanner; + + buildInputs = [ + expat + libxml2 + ]; + + meta = with lib; { + inherit (wayland.meta) homepage license maintainers; + description = "C code generator for Wayland protocol XML files"; + platforms = platforms.unix; + }; +} diff --git a/pkgs/development/python-modules/pywayland/default.nix b/pkgs/development/python-modules/pywayland/default.nix index f07d855fd615..4dc2fb89330d 100644 --- a/pkgs/development/python-modules/pywayland/default.nix +++ b/pkgs/development/python-modules/pywayland/default.nix @@ -21,7 +21,7 @@ buildPythonPackage rec { }; depsBuildBuild = [ pkg-config ]; - nativeBuildInputs = [ pkg-config wayland-scanner ]; + nativeBuildInputs = [ wayland-scanner ]; propagatedNativeBuildInputs = [ cffi ]; buildInputs = [ wayland ]; propagatedBuildInputs = [ cffi ]; diff --git a/pkgs/tools/graphics/mesa-demos/default.nix b/pkgs/tools/graphics/mesa-demos/default.nix index 3bbc20bc4cad..dca8bf0950c7 100644 --- a/pkgs/tools/graphics/mesa-demos/default.nix +++ b/pkgs/tools/graphics/mesa-demos/default.nix @@ -28,8 +28,6 @@ stdenv.mkDerivation rec { sha256 = "sha256-MEaj0mp7BRr3690lel8jv+sWDK1u2VIynN/x6fHtSWs="; }; - strictDeps = true; - depsBuildBuild = [ pkg-config ]; @@ -57,9 +55,10 @@ stdenv.mkDerivation rec { ]; mesonFlags = [ - "-Dwith-system-data-files=true" - "-Dgles1=disabled" - "-Dosmesa=disabled" + "-Degl=${if stdenv.isDarwin then "disabled" else "auto"}" + (lib.mesonEnable "libdrm" (stdenv.isLinux)) + (lib.mesonEnable "osmesa" (mesa ? osmesa)) + (lib.mesonEnable "wayland" (lib.meta.availableOn stdenv.hostPlatform wayland)) ]; meta = with lib; { diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index dbad110c06ac..4b8c4a636183 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -24271,7 +24271,7 @@ with pkgs; wavpack = callPackage ../development/libraries/wavpack { }; wayland = darwin.apple_sdk_11_0.callPackage ../development/libraries/wayland { }; - wayland-scanner = wayland.bin; + wayland-scanner = callPackage ../development/libraries/wayland/scanner.nix { }; wayland-protocols = callPackage ../development/libraries/wayland/protocols.nix { };