diff --git a/pkgs/development/haskell-modules/configuration-darwin.nix b/pkgs/development/haskell-modules/configuration-darwin.nix index 6cf569c5c41..9ce12f7ff9c 100644 --- a/pkgs/development/haskell-modules/configuration-darwin.nix +++ b/pkgs/development/haskell-modules/configuration-darwin.nix @@ -206,6 +206,18 @@ self: super: { '' + (drv.postPatch or ""); }); + SDL-image = overrideCabal super.SDL-image (drv: { + # Prevent darwin-specific configuration code path being taken + # which doesn't work with nixpkgs' SDL libraries + postPatch = '' + substituteInPlace configure --replace xDarwin noDarwinSpecialCasing + '' + (drv.postPatch or ""); + patches = [ + # Work around SDL_main.h redefining main to SDL_main + ./patches/SDL-image-darwin-hsc.patch + ]; + }); + # Prevent darwin-specific configuration code path being taken which # doesn't work with nixpkgs' SDL libraries SDL-mixer = overrideCabal super.SDL-mixer (drv: { diff --git a/pkgs/development/haskell-modules/patches/SDL-image-darwin-hsc.patch b/pkgs/development/haskell-modules/patches/SDL-image-darwin-hsc.patch new file mode 100644 index 00000000000..74d7fca853f --- /dev/null +++ b/pkgs/development/haskell-modules/patches/SDL-image-darwin-hsc.patch @@ -0,0 +1,9 @@ +--- SDL-image-0.6.2.0/Graphics/UI/SDL/Image/Version.hsc.orig 2021-08-06 01:21:05.000000000 +0200 ++++ SDL-image-0.6.2.0/Graphics/UI/SDL/Image/Version.hsc 2021-08-06 01:21:56.000000000 +0200 +@@ -1,4 +1,6 @@ + #include "SDL_image.h" ++-- override SDL_main.h redefining main to SDL_main on darwin ++#define main main + module Graphics.UI.SDL.Image.Version + ( compiledFor + , linkedWith