SDL_compat: patch sdl-config to use setup-hook (#387357)
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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
|
||||
@@ -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
|
||||
|
||||
@@ -44,12 +44,6 @@ stdenv.mkDerivation rec {
|
||||
"SHAREWARE=${if buildShareware then "1" else "0"}"
|
||||
];
|
||||
|
||||
# when using SDL_compat instead of SDL1, SDL_mixer isn't correctly detected,
|
||||
# but there is no harm just specifying it
|
||||
env.NIX_CFLAGS_COMPILE = toString [
|
||||
"-I${lib.getDev SDL_mixer}/include/SDL"
|
||||
];
|
||||
|
||||
installPhase = ''
|
||||
runHook preInstall
|
||||
|
||||
|
||||
Reference in New Issue
Block a user