shithub: choc

Download patch

ref: e13972ba77d29e118adff0c1cd0807f134a6bde8
parent: 2dcd88f26551d0364ce981466fe3e743e5edcda1
author: Jacob Moody <moody@posixcafe.org>
date: Sun Jan 29 05:01:36 EST 2023

close!

--- a/src/m_argv.c
+++ b/src/m_argv.c
@@ -21,7 +21,11 @@
 #include <stdlib.h>
 #include <string.h>
 
+#ifdef __plan9__
+#include "SDL.h"
+#else
 #include "SDL_stdinc.h"
+#endif
 
 #include "doomtype.h"
 #include "d_iwad.h"
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -26,7 +26,11 @@
 #include <assert.h>
 #include <locale.h>
 
+#ifdef __plan9__
+#include "SDL.h"
+#else
 #include "SDL_filesystem.h"
+#endif
 
 #include "config.h"
 
@@ -2045,11 +2049,16 @@
             // mitigate this, we replace the first non-digit,
             // non-minus character in the string with the current
             // locale's decimal separator before passing it to atof().
+            char dec;
+            #ifdef __plan9__
+            dec = '.';
+            #else
             struct lconv *lc = localeconv();
-            char dec, *str;
+            dec = lc->decimal_point[0];
+            #endif
+            char *str;
             int i = 0;
 
-            dec = lc->decimal_point[0];
             str = M_StringDuplicate(value);
 
             // Skip sign indicators.
--- a/src/m_misc.c
+++ b/src/m_misc.c
@@ -406,7 +406,11 @@
         // If we can't open because the file is a directory, the 
         // "file" exists at least!
 
+#ifdef __plan9__
+        return 0;
+#else
         return errno == EISDIR;
+#endif
     }
 }
 
--- /dev/null
+++ b/src/mkfile
@@ -1,0 +1,85 @@
+</$objtype/mkfile
+CFLAGS=-Fpw -I/sys/include/npe -I/sys/include/npe/SDL2 -D__plan9__ -I ../textscreen/ -I../opl -I../pcsound -D__${objtype}__ -p -D__plan9_keep_main__ -DPROGRAM_PREFIX="9" -DPACKAGE_STRING="" -DPACKAGE_NAME="9" -DPACKAGE_TARNAME="9.tar"
+
+TARG=\
+	doom\
+	heretic\
+	hexen\
+
+HFILES=\
+	i_system.h\
+	m_argv.h\
+	m_misc.h\
+
+CORE=\
+	i_main.$O\
+	i_system.$O\
+	m_argv.$O\
+	m_misc.$O\
+
+GAME=\
+	aes_prng.$O \
+	d_event.$O \
+	d_iwad.$O \
+	d_loop.$O \
+	d_mode.$O \
+	deh_str.$O \
+	gusconf.$O \
+	i_cdmus.$O \
+	i_endoom.$O \
+	i_glob.$O \
+#	i_input.$O \
+#	i_joystick.$O \
+#	i_musicpack.$O \
+#	i_oplmusic.$O \
+#	i_pcsound.$O \
+#	i_sdlmusic.$O \
+#	i_sdlsound.$O \
+#	i_sound.$O \
+#	i_timer.$O \
+#	i_video.$O \
+#	i_videohr.$O \
+	i_winmusic.$O \
+	midifallback.$O \
+	midifile.$O \
+	mus2mid.$O \
+	m_bbox.$O \
+	m_cheat.$O \
+	m_config.$O \
+	m_controls.$O \
+	m_fixed.$O \
+	net_client.$O \
+	net_common.$O \
+	net_dedicated.$O \
+	net_gui.$O \
+	net_io.$O \
+	net_loop.$O \
+	net_packet.$O \
+	net_petname.$O \
+	net_query.$O \
+#	net_sdl.$O \
+	net_server.$O \
+	net_structrw.$O \
+	sha1.$O \
+	memio.$O \
+	tables.$O \
+	v_diskicon.$O \
+	v_video.$O \
+	w_checksum.$O \
+	w_main.$O \
+	w_wad.$O \
+	w_file.$O \
+	w_file_stdc.$O \
+	w_file_posix.$O \
+	w_file_win32.$O \
+	w_merge.$O \
+
+def: $O.doom
+
+</sys/src/cmd/mkmany
+
+$O.doom: $CORE $GAME doom/libdoom.a $LIB
+	$LD $LDFLAGS -o $target $prereq
+
+doom/libdoom.a:
+	@{ cd doom && mk }