bb: fix darwin / clang (#351820)
This commit is contained in:
commit
faf294a656
@ -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 <malloc.h>$/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";
|
||||
|
145
pkgs/applications/misc/bb/included-files-updates.diff
Normal file
145
pkgs/applications/misc/bb/included-files-updates.diff
Normal file
@ -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 <string.h>
|
||||
#include <stdlib.h>
|
||||
+#include <time.h>
|
||||
#include <ctype.h>
|
||||
#include <aalib.h>
|
||||
#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 <math.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
-#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#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 <math.h>
|
||||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
-#include <malloc.h>
|
||||
#include <stdlib.h>
|
||||
#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 <ctype.h>
|
||||
+#include <string.h>
|
||||
#include <unistd.h>
|
||||
#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 <string.h>
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#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 <string.h>
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#include <math.h>
|
||||
#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 <math.h>
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#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 <stdio.h>
|
||||
#include <string.h>
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#include <aalib.h>
|
||||
#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 <time.h>
|
||||
#endif
|
||||
/*HAVE_TIME_H*/
|
||||
-#include <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
-#ifndef _MAC
|
||||
-#include <malloc.h>
|
||||
-#endif
|
||||
#ifdef __BEOS__
|
||||
#include <OS.h>
|
||||
#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 <malloc.h>
|
||||
+#include <stdlib.h>
|
||||
#include <aalib.h>
|
||||
#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 <stdlib.h>
|
||||
#include <stdio.h>
|
||||
-#ifndef _MAC
|
||||
-#include <malloc.h>
|
||||
-#endif
|
||||
#ifdef __DJGPP__
|
||||
#include "aconfig.dos"
|
||||
#else
|
Loading…
Reference in New Issue
Block a user