Merge pull request #321724 from matteo-pacini/tinyfugue-fix

tinyfugue: darwin support
This commit is contained in:
Aleksana 2024-06-28 20:54:23 +08:00 committed by GitHub
commit cd6200b6af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 44 additions and 7 deletions

View File

@ -0,0 +1,27 @@
diff --git a/src/malloc.h b/src/malloc.h
index cc4d3bf..bbf78cd 100644
--- a/src/malloc.h
+++ b/src/malloc.h
@@ -34,6 +34,10 @@ extern int low_memory_warning;
# define realloc(ptr, size) mrealloc(NULL, ptr, size)
# define free(ptr) mfree(NULL, ptr)
#else
+#ifdef __APPLE__
+ #include <stdlib.h>
+ #include <sys/types.h>
+#endif
# define mmalloc(md, size) malloc(size)
# define mcalloc(md, size) calloc(size)
# define mrealloc(md, ptr, size) realloc(ptr, size)
diff --git a/src/tfio.c b/src/tfio.c
index 2cd2103..8640f2b 100644
--- a/src/tfio.c
+++ b/src/tfio.c
@@ -70,6 +70,7 @@ static void fileputs(const char *str, FILE *fp);
static void filenputs(const char *str, int n, FILE *fp);
static void queueputline(conString *line, TFILE *file);
+extern void main_loop(void);
void init_tfio(void)
{

View File

@ -1,6 +1,11 @@
{ lib, stdenv, fetchurl, ncurses, zlib
, openssl ? null
, sslSupport ? true
{
lib,
stdenv,
fetchurl,
ncurses,
zlib,
openssl,
sslSupport ? true,
}:
assert sslSupport -> openssl != null;
@ -24,11 +29,16 @@ stdenv.mkDerivation rec {
sha256 = "12fra2fdwqj6ilv9wdkc33rkj343rdcf5jyff4yiwywlrwaa2l1p";
};
patches = [
./001-darwin-fixes.patch
];
configureFlags = optional (!sslSupport) "--disable-ssl";
buildInputs =
[ ncurses zlib ]
++ optional sslSupport openssl;
buildInputs = [
ncurses
zlib
] ++ optional sslSupport openssl;
# Workaround build failure on -fno-common toolchains like upstream
# gcc-10. Otherwise build fails as:
@ -45,7 +55,7 @@ stdenv.mkDerivation rec {
with any type of text MUD.
'';
license = licenses.gpl2;
platforms = platforms.linux;
platforms = platforms.linux ++ platforms.darwin;
maintainers = [ maintainers.KibaFox ];
};
}