From 97182f0bcbe0ebbecf1d320f1f079228273fd1e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Llu=C3=ADs=20Batlle=20i=20Rossell?=
 <viric@vicerveza.homeunix.net>
Date: Mon, 28 Mar 2011 16:08:17 +0000
Subject: [PATCH] Making SDL_gfx and SDL_image find the SDL headers, by a
 postInstall patch. They expected to sit in the same directory as the SDL
 headers.

svn path=/nixpkgs/trunk/; revision=26574
---
 pkgs/development/libraries/SDL_gfx/default.nix   |  7 ++++++-
 pkgs/development/libraries/SDL_image/default.nix | 10 +++++++++-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/pkgs/development/libraries/SDL_gfx/default.nix b/pkgs/development/libraries/SDL_gfx/default.nix
index aabbd8f89419..1090a99915f9 100644
--- a/pkgs/development/libraries/SDL_gfx/default.nix
+++ b/pkgs/development/libraries/SDL_gfx/default.nix
@@ -12,7 +12,12 @@ stdenv.mkDerivation rec {
 
   configureFlags = "--disable-mmx";
 
-  postInstall = "ln -s $out/include/SDL/*.h $out/include/";
+  postInstall = ''
+    sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
+      $out/include/SDL/*.h
+    
+    ln -s $out/include/SDL/*.h $out/include/;
+  '';
 
   meta = {
     description = "SDL graphics drawing primitives and support functions";
diff --git a/pkgs/development/libraries/SDL_image/default.nix b/pkgs/development/libraries/SDL_image/default.nix
index eafe10d05279..21461cc42595 100644
--- a/pkgs/development/libraries/SDL_image/default.nix
+++ b/pkgs/development/libraries/SDL_image/default.nix
@@ -13,7 +13,15 @@ stdenv.mkDerivation rec {
 
   buildInputs = [SDL libpng libjpeg libtiff libungif libXpm];
 
-  postInstall = "ln -sv $out/include/SDL/SDL_image.h $out/include/";
+  postInstall = ''
+    sed -i -e 's,"SDL.h",<SDL/SDL.h>,' \
+    -e 's,"SDL_version.h",<SDL/SDL_version.h>,' \
+    -e 's,"begin_code.h",<SDL/begin_code.h>,' \
+    -e 's,"close_code.h",<SDL/close_code.h>,' \
+      $out/include/SDL/SDL_image.h
+
+    ln -sv $out/include/SDL/SDL_image.h $out/include/
+  '';
 
   meta = {
     description = "SDL image library";