diff --git a/pkgs/applications/misc/bb/default.nix b/pkgs/applications/misc/bb/default.nix index 16f4c0bd2d6f..1c7eedc56570 100644 --- a/pkgs/applications/misc/bb/default.nix +++ b/pkgs/applications/misc/bb/default.nix @@ -1,4 +1,4 @@ -{ stdenv, lib, fetchurl, darwin, aalib, ncurses, xorg, libmikmod }: +{ stdenv, lib, fetchurl, autoreconfHook, aalib, ncurses, xorg, libmikmod }: stdenv.mkDerivation rec { pname = "bb"; @@ -9,19 +9,24 @@ stdenv.mkDerivation rec { sha256 = "1i411glxh7g4pfg4gw826lpwngi89yrbmxac8jmnsfvrfb48hgbr"; }; + patches = [ + # add / update include files to get function prototypes + ./included-files-updates.diff + ]; + + nativeBuildInputs = [ autoreconfHook ]; + buildInputs = [ aalib ncurses libmikmod xorg.libXau xorg.libXdmcp xorg.libX11 - ] ++ lib.optional stdenv.hostPlatform.isDarwin darwin.apple_sdk.frameworks.CoreAudio; + ]; - postPatch = lib.optionalString stdenv.hostPlatform.isDarwin '' - sed -i -e '/^#include $/d' *.c + # regparm attribute is not supported by clang + postPatch = lib.optionalString stdenv.cc.isClang '' + substituteInPlace config.h \ + --replace-fail "__attribute__ ((regparm(n)))" "" ''; - # error: 'regparm' is not valid on this platform - env.NIX_CFLAGS_COMPILE = lib.optionalString (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isAarch64) - "-D__STRICT_ANSI__"; - meta = with lib; { homepage = "http://aa-project.sourceforge.net/bb"; description = "AA-lib demo"; diff --git a/pkgs/applications/misc/bb/included-files-updates.diff b/pkgs/applications/misc/bb/included-files-updates.diff new file mode 100644 index 000000000000..07fa331a96c0 --- /dev/null +++ b/pkgs/applications/misc/bb/included-files-updates.diff @@ -0,0 +1,145 @@ +diff --git a/bb.c b/bb.c +index 95850ef..6a7cc78 100644 +--- a/bb.c ++++ b/bb.c +@@ -23,6 +23,7 @@ + + #include + #include ++#include + #include + #include + #include "bb.h" +diff --git a/credits.c b/credits.c +index 8514579..b304d8c 100644 +--- a/credits.c ++++ b/credits.c +@@ -24,7 +24,6 @@ + #include + #include + #include +-#include + #include + #include "bb.h" + #define STAR 1 +diff --git a/credits2.c b/credits2.c +index 65d2431..9dcdf2d 100644 +--- a/credits2.c ++++ b/credits2.c +@@ -25,7 +25,6 @@ + #include + #include + #include +-#include + #include + #include "bb.h" + #define STATE (TIME-starttime) +diff --git a/main.c b/main.c +index ae852a7..c0648b4 100644 +--- a/main.c ++++ b/main.c +@@ -21,6 +21,8 @@ + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + ++#include ++#include + #include + #include "timers.h" + #include "bb.h" +diff --git a/messager.c b/messager.c +index 95cc410..5164577 100644 +--- a/messager.c ++++ b/messager.c +@@ -22,7 +22,7 @@ + */ + + #include +-#include ++#include + #include "bb.h" + + static int cursor_x, cursor_y; +diff --git a/scene5.c b/scene5.c +index 8d3c798..4a79258 100644 +--- a/scene5.c ++++ b/scene5.c +@@ -22,7 +22,7 @@ + */ + + #include +-#include ++#include + #include + #include "bb.h" + #include "tex.h" +diff --git a/scene8.c b/scene8.c +index 2bcba1e..72ea231 100644 +--- a/scene8.c ++++ b/scene8.c +@@ -22,7 +22,7 @@ + */ + + #include +-#include ++#include + #include "bb.h" + #define STATE1 (TIME-starttime1) + #define STATE (time-starttime) +diff --git a/textform.c b/textform.c +index 859d367..eb9d1cb 100644 +--- a/textform.c ++++ b/textform.c +@@ -1,6 +1,6 @@ + #include + #include +-#include ++#include + #include + #include "bb.h" + #define MAXLINES 10000 +diff --git a/timers.c b/timers.c +index ac822f7..6342c1b 100644 +--- a/timers.c ++++ b/timers.c +@@ -45,12 +45,9 @@ + #include + #endif + /*HAVE_TIME_H*/ +-#include ++#include + #include + #include +-#ifndef _MAC +-#include +-#endif + #ifdef __BEOS__ + #include + #endif +diff --git a/uncompfn.c b/uncompfn.c +index d8eaaea..bc707f8 100644 +--- a/uncompfn.c ++++ b/uncompfn.c +@@ -21,7 +21,7 @@ + * 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +-#include ++#include + #include + #include "bb.h" + +diff --git a/zoom.c b/zoom.c +index 7450095..4b37b2d 100644 +--- a/zoom.c ++++ b/zoom.c +@@ -31,9 +31,6 @@ + #else + #include + #include +-#ifndef _MAC +-#include +-#endif + #ifdef __DJGPP__ + #include "aconfig.dos" + #else