diff options
author | OPNA2608 <christoph.neidahl@gmail.com> | 2022-03-12 15:12:25 +0100 |
---|---|---|
committer | Peter Hoeg <peter@hoeg.com> | 2022-03-20 16:07:38 +0800 |
commit | ad3e1217955c26b394463b54ef59f1bcc98a37ef (patch) | |
tree | 28324b7117d84dbb528df93b79934894563e68ba /pkgs/development/libraries/SDL2 | |
parent | 3df8e35539fdf9ab60a4e294c5d74f7639ac1bd4 (diff) |
SDL2: Reinstate find-headers.patch
Diffstat (limited to 'pkgs/development/libraries/SDL2')
-rw-r--r-- | pkgs/development/libraries/SDL2/default.nix | 8 | ||||
-rw-r--r-- | pkgs/development/libraries/SDL2/find-headers.patch | 34 |
2 files changed, 42 insertions, 0 deletions
diff --git a/pkgs/development/libraries/SDL2/default.nix b/pkgs/development/libraries/SDL2/default.nix index d1086de3718de..d8d81492f9147 100644 --- a/pkgs/development/libraries/SDL2/default.nix +++ b/pkgs/development/libraries/SDL2/default.nix @@ -65,6 +65,14 @@ stdenv.mkDerivation rec { outputs = [ "out" "dev" ]; outputBin = "dev"; # sdl-config + patches = [ + # `sdl2-config --cflags` from Nixpkgs returns include path to just SDL2. + # On a normal distro this is enough for includes from all SDL2* packages to work, + # but on NixOS they're spread across different paths. + # This patch + the setup-hook will ensure that `sdl2-config --cflags` works correctly. + ./find-headers.patch + ]; + depsBuildBuild = [ pkg-config ]; nativeBuildInputs = [ pkg-config ] ++ optionals waylandSupport [ wayland ]; diff --git a/pkgs/development/libraries/SDL2/find-headers.patch b/pkgs/development/libraries/SDL2/find-headers.patch new file mode 100644 index 0000000000000..4792679deb117 --- /dev/null +++ b/pkgs/development/libraries/SDL2/find-headers.patch @@ -0,0 +1,34 @@ +diff --git a/sdl2-config.cmake.in b/sdl2-config.cmake.in +index c570511fa..ca694f595 100644 +--- a/sdl2-config.cmake.in ++++ b/sdl2-config.cmake.in +@@ -7,7 +7,8 @@ set(includedir "@includedir@") + set(SDL2_PREFIX "${prefix}") + set(SDL2_EXEC_PREFIX "${exec_prefix}") + set(SDL2_LIBDIR "${libdir}") +-set(SDL2_INCLUDE_DIRS "${includedir}/SDL2") ++set(SDL2_INCLUDE_DIRS "${includedir}/SDL2" $ENV{SDL2_PATH}) ++separate_arguments(SDL2_INCLUDE_DIRS) + set(SDL2_LIBRARIES "-L${SDL2_LIBDIR} @SDL_RLD_FLAGS@ @SDL_LIBS@") + string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES) + +diff --git a/sdl2-config.in b/sdl2-config.in +index 5a2aed292..7c55f0a28 100644 +--- a/sdl2-config.in ++++ b/sdl2-config.in +@@ -42,7 +42,11 @@ while test $# -gt 0; do + echo @SDL_VERSION@ + ;; + --cflags) +- echo -I@includedir@/SDL2 @SDL_CFLAGS@ ++ SDL_CFLAGS="" ++ for i in @includedir@/SDL2 $SDL2_PATH; do ++ SDL_CFLAGS="$SDL_CFLAGS -I$i" ++ done ++ echo $SDL_CFLAGS @SDL_CFLAGS@ + ;; + @ENABLE_SHARED_TRUE@ --libs) + @ENABLE_SHARED_TRUE@ echo -L@libdir@ @SDL_RLD_FLAGS@ @SDL_LIBS@ +-- +2.33.1 + |