Unverified Commit 35065f10 authored by Marcin Serwin's avatar Marcin Serwin
Browse files

SDL_compat: patch sdl-config to use setup-hook

The setup hook creating SDL_PATH variable was copied from the SDL1,
however, the necessary patch to `sdl-config.in` was not adapted making
the hook useless.
parent 5301358a
Loading
Loading
Loading
Loading
+26 −0
Original line number Diff line number Diff line
diff --git a/sdl-config.in b/sdl-config.in
index ce332b3..359d574 100755
--- a/sdl-config.in
+++ b/sdl-config.in
@@ -50,14 +50,18 @@ while test $# -gt 0; do
       echo @PROJECT_VERSION@
       ;;
     --cflags)
-      echo -I${includedir}/SDL @SDL_CFLAGS@
+      SDL_CFLAGS=""
+      for i in @includedir@/SDL $SDL_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@
+@ENABLE_SHARED_TRUE@      echo -L${libdir} @SDL_RLD_FLAGS@ @SDL_LIBS@ $SDL_LIB_PATH
 @ENABLE_SHARED_TRUE@      ;;
 @ENABLE_STATIC_TRUE@@ENABLE_SHARED_TRUE@    --static-libs)
 @ENABLE_STATIC_TRUE@@ENABLE_SHARED_FALSE@    --libs|--static-libs)
-@ENABLE_STATIC_TRUE@      echo -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@
+@ENABLE_STATIC_TRUE@      echo -L${libdir} @SDL_LIBS@ @SDL_STATIC_LIBS@ $SDL_LIB_PATH
 @ENABLE_STATIC_TRUE@      ;;
     *)
       echo "${usage}" 1>&2
+6 −2
Original line number Diff line number Diff line
@@ -48,14 +48,18 @@ stdenv.mkDerivation (finalAttrs: {

  enableParallelBuilding = true;

  setupHook = ./setup-hook.sh;

  postInstall = ''
    # allow as a drop in replacement for SDL
    # Can be removed after treewide switch from pkg-config to pkgconf
    ln -s $out/lib/pkgconfig/sdl12_compat.pc $out/lib/pkgconfig/sdl.pc
  '';

  # The setup hook scans paths of buildInputs to find SDL related packages and
  # adds their include and library paths to environment variables. The sdl-config
  # is patched to use these variables to produce correct flags for compiler.
  patches = [ ./find-headers.patch ];
  setupHook = ./setup-hook.sh;

  postFixup = ''
    for lib in $out/lib/*${stdenv.hostPlatform.extensions.sharedLibrary}* ; do
      if [[ -L "$lib" ]]; then