From 0ee702c43936f4fb169b53916b3f3251ffcc5441 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:47:56 +0100 Subject: [PATCH 1/6] haskellPackages.sdl2-gfx: work around sdl2 pkg-config issue Ref https://github.com/NixOS/nixpkgs/issues/260863. --- pkgs/development/haskell-modules/configuration-common.nix | 4 ++++ .../haskell-modules/configuration-hackage2nix/broken.yaml | 1 - pkgs/development/haskell-modules/hackage-packages.nix | 2 -- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index ce0ff69bdf75..8044cc265679 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -2676,4 +2676,8 @@ self: super: { # Too strict bounds on base kewar = doJailbreak super.kewar; + + # Workaround for Cabal failing to find nonexistent SDL2 library?! + # https://github.com/NixOS/nixpkgs/issues/260863 + sdl2-gfx = overrideCabal { __propagatePkgConfigDepends = false; } super.sdl2-gfx; } // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml index d2ad1b3d80cb..9c56ae663e42 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml @@ -4800,7 +4800,6 @@ broken-packages: - sdl2-cairo-image # failure in job https://hydra.nixos.org/build/233210135 at 2023-09-02 - sdl2-compositor # failure in job https://hydra.nixos.org/build/233198910 at 2023-09-02 - sdl2-fps # failure in job https://hydra.nixos.org/build/233195346 at 2023-09-02 - - sdl2-gfx # failure in job https://hydra.nixos.org/build/233236795 at 2023-09-02 - sdl2-image # failure in job https://hydra.nixos.org/build/233216837 at 2023-09-02 - sdl2-mixer # failure in job https://hydra.nixos.org/build/233228951 at 2023-09-02 - sdl2-ttf # failure in job https://hydra.nixos.org/build/233238600 at 2023-09-02 diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index 0bdcbbee9393..58d8683c9dde 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -263572,9 +263572,7 @@ self: { executablePkgconfigDepends = [ SDL2 SDL2_gfx ]; description = "Haskell bindings to SDL2_gfx"; license = lib.licenses.mit; - hydraPlatforms = lib.platforms.none; mainProgram = "sdl2-gfx-example"; - broken = true; }) {inherit (pkgs) SDL2; inherit (pkgs) SDL2_gfx;}; "sdl2-image" = callPackage From 73c05bde44613703e901c835132dadec3efe38b4 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:48:41 +0100 Subject: [PATCH 2/6] harfbuzz: record provided pkg-config modules in meta This is verified using testers.hasPkgConfigModules which leads to a slight refactor of the expression. --- pkgs/development/libraries/harfbuzz/default.nix | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/pkgs/development/libraries/harfbuzz/default.nix b/pkgs/development/libraries/harfbuzz/default.nix index b1e09f7b82ed..88f373dd4afa 100644 --- a/pkgs/development/libraries/harfbuzz/default.nix +++ b/pkgs/development/libraries/harfbuzz/default.nix @@ -30,14 +30,15 @@ , gtk4 , mapnik , qt5 +, testers }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "harfbuzz${lib.optionalString withIcu "-icu"}"; version = "7.3.0"; src = fetchurl { - url = "https://github.com/harfbuzz/harfbuzz/releases/download/${version}/harfbuzz-${version}.tar.xz"; + url = "https://github.com/harfbuzz/harfbuzz/releases/download/${finalAttrs.version}/harfbuzz-${finalAttrs.version}.tar.xz"; hash = "sha256-IHcHiXSaybqEbfM5g9vaItuDbHDZ9dBQy5qlNHCUqPs="; }; @@ -103,6 +104,9 @@ stdenv.mkDerivation rec { passthru.tests = { inherit gimp gtk3 gtk4 mapnik; inherit (qt5) qtbase; + pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; }; meta = with lib; { @@ -112,5 +116,10 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.eelco ]; license = licenses.mit; platforms = platforms.unix; + pkgConfigModules = [ + "harfbuzz" + "harfbuzz-gobject" + "harfbuzz-subset" + ]; }; -} +}) From d32cb37277093e405e93e3cd69807a3a07873e80 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:51:57 +0100 Subject: [PATCH 3/6] sdl2: record provided pkg-config modules in meta This is verified using testers.hasPkgConfigModules which leads to a slight refactor of the expression. --- pkgs/development/libraries/SDL2/default.nix | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index 7b741b803de0..d74ab371bb14 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -49,19 +49,21 @@ , audiofile , libiconv , withStatic ? false +# passthru.tests +, testers }: # NOTE: When editing this expression see if the same change applies to # SDL expression too -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL2"; version = "2.28.3"; src = fetchFromGitHub { owner = "libsdl-org"; repo = "SDL"; - rev = "release-${version}"; + rev = "release-${finalAttrs.version}"; hash = "sha256-/kQ2IyvAfmZ+zIUt1WuEIeX0nYPGXDlAQk2qDsQnFFs="; }; dontDisableStatic = if withStatic then 1 else 0; @@ -96,7 +98,7 @@ stdenv.mkDerivation rec { ++ lib.optionals x11Support [ libX11 ]; propagatedBuildInputs = lib.optionals x11Support [ xorgproto ] - ++ dlopenPropagatedBuildInputs; + ++ finalAttrs.dlopenPropagatedBuildInputs; dlopenBuildInputs = lib.optionals alsaSupport [ alsa-lib audiofile ] ++ lib.optional dbusSupport dbus @@ -109,7 +111,7 @@ stdenv.mkDerivation rec { ++ lib.optionals drmSupport [ libdrm mesa ]; buildInputs = [ libiconv ] - ++ dlopenBuildInputs + ++ finalAttrs.dlopenBuildInputs ++ lib.optional ibusSupport ibus ++ lib.optionals waylandSupport [ wayland-protocols ] ++ lib.optionals stdenv.isDarwin [ AudioUnit Cocoa CoreAudio CoreServices ForceFeedback OpenGL ]; @@ -156,7 +158,7 @@ stdenv.mkDerivation rec { # list the symbols used in this way. postFixup = let - rpath = lib.makeLibraryPath (dlopenPropagatedBuildInputs ++ dlopenBuildInputs); + rpath = lib.makeLibraryPath (finalAttrs.dlopenPropagatedBuildInputs ++ finalAttrs.dlopenBuildInputs); in lib.optionalString (stdenv.hostPlatform.extensions.sharedLibrary == ".so") '' for lib in $out/lib/*.so* ; do @@ -171,6 +173,9 @@ stdenv.mkDerivation rec { passthru = { inherit openglSupport; updateScript = nix-update-script { extraArgs = ["--version-regex" "release-(.*)"]; }; + tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; }; meta = with lib; { @@ -180,5 +185,6 @@ stdenv.mkDerivation rec { license = licenses.zlib; platforms = platforms.all; maintainers = with maintainers; [ cpages ]; + pkgConfigModules = [ "sdl2" ]; }; -} +}) From e3235021ec0999f11112d86084a15ca7df4bf29e Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:55:04 +0100 Subject: [PATCH 4/6] SDL2_gfx: record provided pkg-config modules in meta This is verified using testers.hasPkgConfigModules which leads to a slight refactor of the expression. --- pkgs/development/libraries/SDL2_gfx/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/SDL2_gfx/default.nix b/pkgs/development/libraries/SDL2_gfx/default.nix index 3d599c39c05b..83b57b42c7cd 100644 --- a/pkgs/development/libraries/SDL2_gfx/default.nix +++ b/pkgs/development/libraries/SDL2_gfx/default.nix @@ -1,11 +1,11 @@ -{ lib, stdenv, darwin, fetchurl, pkg-config, SDL2 }: +{ lib, stdenv, darwin, fetchurl, pkg-config, SDL2, testers }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL2_gfx"; version = "1.0.4"; src = fetchurl { - url = "http://www.ferzkopp.net/Software/${pname}/${pname}-${version}.tar.gz"; + url = "http://www.ferzkopp.net/Software/${finalAttrs.pname}/${finalAttrs.pname}-${finalAttrs.version}.tar.gz"; sha256 = "0qk2ax7f7grlxb13ba0ll3zlm8780s7j8fmrhlpxzjgdvldf1q33"; }; @@ -17,6 +17,10 @@ stdenv.mkDerivation rec { configureFlags = [(if stdenv.hostPlatform.isx86 then "--enable-mmx" else "--disable-mmx")] ++ lib.optional stdenv.isDarwin "--disable-sdltest"; + passthru.tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + meta = with lib; { description = "SDL graphics drawing primitives and support functions"; @@ -42,5 +46,6 @@ stdenv.mkDerivation rec { license = licenses.zlib; maintainers = with maintainers; [ cpages ]; platforms = platforms.unix; + pkgConfigModules = [ "SDL2_gfx" ]; }; -} +}) From 4c56be2a7e100a5afe2c4b859740be96f5d5ea62 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:55:33 +0100 Subject: [PATCH 5/6] SDL2_ttf: record provided pkg-config modules in meta This is verified using testers.hasPkgConfigModules which leads to a slight refactor of the expression. --- pkgs/development/libraries/SDL2_ttf/default.nix | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pkgs/development/libraries/SDL2_ttf/default.nix b/pkgs/development/libraries/SDL2_ttf/default.nix index d2dd8d53929e..e46b9d9c537a 100644 --- a/pkgs/development/libraries/SDL2_ttf/default.nix +++ b/pkgs/development/libraries/SDL2_ttf/default.nix @@ -1,11 +1,11 @@ -{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2, freetype, harfbuzz, libGL }: +{ lib, stdenv, pkg-config, darwin, fetchurl, SDL2, freetype, harfbuzz, libGL, testers }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "SDL2_ttf"; version = "2.20.2"; src = fetchurl { - url = "https://www.libsdl.org/projects/SDL_ttf/release/${pname}-${version}.tar.gz"; + url = "https://www.libsdl.org/projects/SDL_ttf/release/${finalAttrs.pname}-${finalAttrs.version}.tar.gz"; sha256 = "sha256-ncce2TSHUhsQeixKnKa/Q/ti9r3dXCawVea5FBiiIFM="; }; @@ -18,10 +18,15 @@ stdenv.mkDerivation rec { ++ lib.optional (!stdenv.isDarwin) libGL ++ lib.optional stdenv.isDarwin darwin.libobjc; + passthru.tests.pkg-config = testers.hasPkgConfigModules { + package = finalAttrs.finalPackage; + }; + meta = with lib; { description = "Support for TrueType (.ttf) font files with Simple Directmedia Layer"; platforms = platforms.unix; license = licenses.zlib; homepage = "https://github.com/libsdl-org/SDL_ttf"; + pkgConfigModules = [ "SDL2_ttf" ]; }; -} +}) From c31f00657042dcb85e45777be4f3701032a4f2f5 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Sun, 5 Nov 2023 16:56:21 +0100 Subject: [PATCH 6/6] haskellPackages.sdl2-ttf: work around sdl2 pkg-config issue Ref https://github.com/NixOS/nixpkgs/issues/260863. --- pkgs/development/haskell-modules/configuration-common.nix | 3 ++- .../haskell-modules/configuration-hackage2nix/broken.yaml | 1 - pkgs/development/haskell-modules/hackage-packages.nix | 2 -- 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/pkgs/development/haskell-modules/configuration-common.nix b/pkgs/development/haskell-modules/configuration-common.nix index 8044cc265679..ba926f59412e 100644 --- a/pkgs/development/haskell-modules/configuration-common.nix +++ b/pkgs/development/haskell-modules/configuration-common.nix @@ -637,7 +637,6 @@ self: super: { saltine = dontCheck super.saltine; # https://github.com/tel/saltine/pull/56 scp-streams = dontCheck super.scp-streams; sdl2 = dontCheck super.sdl2; # the test suite needs an x server - sdl2-ttf = dontCheck super.sdl2-ttf; # as of version 0.2.1, the test suite requires user intervention separated = dontCheck super.separated; shadowsocks = dontCheck super.shadowsocks; shake-language-c = dontCheck super.shake-language-c; @@ -2680,4 +2679,6 @@ self: super: { # Workaround for Cabal failing to find nonexistent SDL2 library?! # https://github.com/NixOS/nixpkgs/issues/260863 sdl2-gfx = overrideCabal { __propagatePkgConfigDepends = false; } super.sdl2-gfx; + sdl2-ttf = overrideCabal { __onlyPropagateKnownPkgConfigModules = true; } super.sdl2-ttf; + } // import ./configuration-tensorflow.nix {inherit pkgs haskellLib;} self super diff --git a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml index 9c56ae663e42..24650b195a7d 100644 --- a/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml +++ b/pkgs/development/haskell-modules/configuration-hackage2nix/broken.yaml @@ -4802,7 +4802,6 @@ broken-packages: - sdl2-fps # failure in job https://hydra.nixos.org/build/233195346 at 2023-09-02 - sdl2-image # failure in job https://hydra.nixos.org/build/233216837 at 2023-09-02 - sdl2-mixer # failure in job https://hydra.nixos.org/build/233228951 at 2023-09-02 - - sdl2-ttf # failure in job https://hydra.nixos.org/build/233238600 at 2023-09-02 - sdp # failure in job https://hydra.nixos.org/build/233246702 at 2023-09-02 - seacat # failure in job https://hydra.nixos.org/build/233229959 at 2023-09-02 - seakale # failure in job https://hydra.nixos.org/build/233236200 at 2023-09-02 diff --git a/pkgs/development/haskell-modules/hackage-packages.nix b/pkgs/development/haskell-modules/hackage-packages.nix index 58d8683c9dde..65a47e4045f0 100644 --- a/pkgs/development/haskell-modules/hackage-packages.nix +++ b/pkgs/development/haskell-modules/hackage-packages.nix @@ -263666,8 +263666,6 @@ self: { description = "Bindings to SDL2_ttf"; license = lib.licenses.bsd3; badPlatforms = lib.platforms.darwin; - hydraPlatforms = lib.platforms.none; - broken = true; }) {inherit (pkgs) SDL2; inherit (pkgs) SDL2_ttf;}; "sdnv" = callPackage