From 5eaacbb9818771700d88c0e18a97be200b7b109e Mon Sep 17 00:00:00 2001
From: Nikolay Amiantov <ab@fmap.me>
Date: Sun, 28 Aug 2016 00:57:49 +0300
Subject: [PATCH] xsw: fix build

---
 pkgs/applications/misc/xsw/default.nix | 13 ++++++++++---
 1 file changed, 10 insertions(+), 3 deletions(-)

diff --git a/pkgs/applications/misc/xsw/default.nix b/pkgs/applications/misc/xsw/default.nix
index 57ea8fe19218..b3a57e1cef21 100644
--- a/pkgs/applications/misc/xsw/default.nix
+++ b/pkgs/applications/misc/xsw/default.nix
@@ -1,6 +1,9 @@
-{ stdenv, fetchFromGitHub, pkgconfig, autoconf, automake, SDL, SDL_image, SDL_ttf, SDL_gfx, flex, bison }:
+{ stdenv, lib, fetchFromGitHub, pkgconfig, SDL, SDL_image, SDL_ttf, SDL_gfx, flex, bison }:
 
-stdenv.mkDerivation rec {
+let
+  makeSDLFlags = map (p: "-I${lib.getDev p}/include/SDL");
+
+in stdenv.mkDerivation rec {
   name = "xsw-${version}";
   version = "0.1.2";
 
@@ -11,7 +14,11 @@ stdenv.mkDerivation rec {
     sha256 = "092vp61ngd2vscsvyisi7dv6qrk5m1i81gg19hyfl5qvjq5p0p8g";
   };
 
-  buildInputs = [ pkgconfig autoconf automake SDL SDL_image SDL_ttf SDL_gfx flex bison ];
+  nativeBuildInputs = [ SDL SDL_image SDL_ttf SDL_gfx flex bison ];
+
+  buildInputs = [ pkgconfig ];
+
+  NIX_CFLAGS_COMPILE = makeSDLFlags [ SDL SDL_image SDL_ttf SDL_gfx ];
 
   patches = [
     ./parse.patch # Fixes compilation error by avoiding redundant definitions.