wayland-scanner: split from wayland

We've used a wayland-scanner = wayland.bin alias for ages, to make
packages clearer and allow them to be independently overridden.
Going the whole way into splitting them into separate packages is
useful because it means we can have different meta.platforms
attributes for libwayland and wayland-scanner.

There is no duplication in outputs between the two packages — they
don't install any files in common.

Since we're no longer pulling just one output into nativeBuildInputs
of packages using wayland-scanner, we can use upstream's
wayland-scanner.pc, which gets installed into the dev output, rather
than providing our own.
This commit is contained in:
Alyssa Ross
2024-08-12 21:16:04 +03:00
committed by Florian Klink
parent 2aa25051f7
commit 921bd99f8d
7 changed files with 64 additions and 48 deletions
@@ -9,8 +9,6 @@
, darwin , darwin
}: }:
assert wayland.withLibraries;
let let
stdenv = clangStdenv; stdenv = clangStdenv;
in in
+6 -37
View File
@@ -5,13 +5,10 @@
, pkg-config , pkg-config
, ninja , ninja
, wayland-scanner , wayland-scanner
, expat
, libxml2
, withLibraries ? stdenv.isLinux || stdenv.isDarwin
, withTests ? stdenv.isLinux , withTests ? stdenv.isLinux
, libffi , libffi
, epoll-shim , epoll-shim
, withDocumentation ? withLibraries && stdenv.hostPlatform == stdenv.buildPlatform , withDocumentation ? stdenv.hostPlatform == stdenv.buildPlatform
, graphviz-nox , graphviz-nox
, doxygen , doxygen
, libxslt , libxslt
@@ -23,15 +20,6 @@
, testers , 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: { stdenv.mkDerivation (finalAttrs: {
pname = "wayland"; pname = "wayland";
version = "1.23.0"; version = "1.23.0";
@@ -53,13 +41,13 @@ stdenv.mkDerivation (finalAttrs: {
sed -i '/os-wrappers-test/d' tests/meson.build 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; separateDebugInfo = true;
mesonFlags = [ mesonFlags = [
"-Ddocumentation=${lib.boolToString withDocumentation}" (lib.mesonBool "documentation" withDocumentation)
"-Dlibraries=${lib.boolToString withLibraries}" (lib.mesonBool "tests" withTests)
"-Dtests=${lib.boolToString withTests}" (lib.mesonBool "scanner" false) # wayland-scanner is a separate derivation
]; ];
depsBuildBuild = [ depsBuildBuild = [
@@ -70,7 +58,6 @@ stdenv.mkDerivation (finalAttrs: {
meson meson
pkg-config pkg-config
ninja ninja
] ++ lib.optionals isCross [
wayland-scanner wayland-scanner
] ++ lib.optionals withDocumentation [ ] ++ lib.optionals withDocumentation [
(graphviz-nox.override { pango = null; }) # To avoid an infinite recursion (graphviz-nox.override { pango = null; }) # To avoid an infinite recursion
@@ -83,11 +70,8 @@ stdenv.mkDerivation (finalAttrs: {
]; ];
buildInputs = [ buildInputs = [
expat
libxml2
] ++ lib.optionals withLibraries [
libffi libffi
] ++ lib.optionals (withLibraries && !stdenv.hostPlatform.isLinux) [ ] ++ lib.optionals (!stdenv.hostPlatform.isLinux) [
epoll-shim epoll-shim
] ++ lib.optionals withDocumentation [ ] ++ lib.optionals withDocumentation [
docbook_xsl docbook_xsl
@@ -95,20 +79,7 @@ stdenv.mkDerivation (finalAttrs: {
docbook_xml_dtd_42 docbook_xml_dtd_42
]; ];
postFixup = ''
# The pkg-config file is required for cross-compilation:
mkdir -p $bin/lib/pkgconfig/
cat <<EOF > $bin/lib/pkgconfig/wayland-scanner.pc
wayland_scanner=$bin/bin/wayland-scanner
Name: Wayland Scanner
Description: Wayland scanner
Version: ${finalAttrs.version}
EOF
'';
passthru = { passthru = {
inherit withLibraries;
tests.pkg-config = testers.hasPkgConfigModules { tests.pkg-config = testers.hasPkgConfigModules {
package = finalAttrs.finalPackage; package = finalAttrs.finalPackage;
}; };
@@ -130,8 +101,6 @@ stdenv.mkDerivation (finalAttrs: {
platforms = platforms.unix; platforms = platforms.unix;
maintainers = with maintainers; [ primeos codyopel qyliss ]; maintainers = with maintainers; [ primeos codyopel qyliss ];
pkgConfigModules = [ pkgConfigModules = [
"wayland-scanner"
] ++ lib.optionals withLibraries [
"wayland-client" "wayland-client"
"wayland-cursor" "wayland-cursor"
"wayland-egl" "wayland-egl"
@@ -8,8 +8,9 @@ stdenv.mkDerivation rec {
pname = "wayland-protocols"; pname = "wayland-protocols";
version = "1.36"; version = "1.36";
doCheck = stdenv.hostPlatform == stdenv.buildPlatform &&
# https://gitlab.freedesktop.org/wayland/wayland-protocols/-/issues/48 # 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 { src = fetchurl {
url = "https://gitlab.freedesktop.org/wayland/${pname}/-/releases/${version}/downloads/${pname}-${version}.tar.xz"; url = "https://gitlab.freedesktop.org/wayland/${pname}/-/releases/${version}/downloads/${pname}-${version}.tar.xz";
@@ -22,7 +23,8 @@ stdenv.mkDerivation rec {
depsBuildBuild = [ pkg-config ]; depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [ meson ninja wayland-scanner ]; nativeBuildInputs = [ meson ninja wayland-scanner ];
nativeCheckInputs = [ python3 wayland ]; nativeCheckInputs = [ python3 ];
checkInputs = [ wayland ];
mesonFlags = [ "-Dtests=${lib.boolToString doCheck}" ]; mesonFlags = [ "-Dtests=${lib.boolToString doCheck}" ];
@@ -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;
};
}
@@ -21,7 +21,7 @@ buildPythonPackage rec {
}; };
depsBuildBuild = [ pkg-config ]; depsBuildBuild = [ pkg-config ];
nativeBuildInputs = [ pkg-config wayland-scanner ]; nativeBuildInputs = [ wayland-scanner ];
propagatedNativeBuildInputs = [ cffi ]; propagatedNativeBuildInputs = [ cffi ];
buildInputs = [ wayland ]; buildInputs = [ wayland ];
propagatedBuildInputs = [ cffi ]; propagatedBuildInputs = [ cffi ];
+4 -5
View File
@@ -28,8 +28,6 @@ stdenv.mkDerivation rec {
sha256 = "sha256-MEaj0mp7BRr3690lel8jv+sWDK1u2VIynN/x6fHtSWs="; sha256 = "sha256-MEaj0mp7BRr3690lel8jv+sWDK1u2VIynN/x6fHtSWs=";
}; };
strictDeps = true;
depsBuildBuild = [ depsBuildBuild = [
pkg-config pkg-config
]; ];
@@ -57,9 +55,10 @@ stdenv.mkDerivation rec {
]; ];
mesonFlags = [ mesonFlags = [
"-Dwith-system-data-files=true" "-Degl=${if stdenv.isDarwin then "disabled" else "auto"}"
"-Dgles1=disabled" (lib.mesonEnable "libdrm" (stdenv.isLinux))
"-Dosmesa=disabled" (lib.mesonEnable "osmesa" (mesa ? osmesa))
(lib.mesonEnable "wayland" (lib.meta.availableOn stdenv.hostPlatform wayland))
]; ];
meta = with lib; { meta = with lib; {
+1 -1
View File
@@ -24271,7 +24271,7 @@ with pkgs;
wavpack = callPackage ../development/libraries/wavpack { }; wavpack = callPackage ../development/libraries/wavpack { };
wayland = darwin.apple_sdk_11_0.callPackage ../development/libraries/wayland { }; 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 { }; wayland-protocols = callPackage ../development/libraries/wayland/protocols.nix { };