diff --git a/emulators/Makefile b/emulators/Makefile index 7fe9ffa19859..7b04d6696c73 100644 --- a/emulators/Makefile +++ b/emulators/Makefile @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.347 2022/12/15 11:48:59 nia Exp $ +# $NetBSD: Makefile,v 1.348 2023/05/20 12:47:47 thorpej Exp $ # COMMENT= Emulators for other machines and systems @@ -143,6 +143,7 @@ SUBDIR+= lrmi SUBDIR+= m1 SUBDIR+= makeppf SUBDIR+= mame +SUBDIR+= marduk SUBDIR+= mednafen SUBDIR+= mednaffe SUBDIR+= melonds diff --git a/emulators/marduk/DESCR b/emulators/marduk/DESCR new file mode 100644 index 000000000000..be73de83ec6a --- /dev/null +++ b/emulators/marduk/DESCR @@ -0,0 +1,3 @@ +Marduk is an attempt to emulate the obscure Canadian NABU Personal Computer. +It has quickly grown from a barely functional emulator to a fairly complete +(if bare-bones) and reasonably portable program. diff --git a/emulators/marduk/Makefile b/emulators/marduk/Makefile new file mode 100644 index 000000000000..bf5b371ed8b5 --- /dev/null +++ b/emulators/marduk/Makefile @@ -0,0 +1,41 @@ +# $NetBSD: Makefile,v 1.1 2023/05/20 12:47:47 thorpej Exp $ + +# The author has not yet created any tags, but this is what it reports +# as its version. +MARDUK_VERSION= 0.26e + +DISTNAME= marduk-${MARDUK_VERSION} +CATEGORIES= devel +MASTER_SITES= ${MASTER_SITE_GITHUB:=buricco/} +GITHUB_TAG= 7cf954b7f9681daafa7240f49b7860f6f2107898 + +MAINTAINER= thorpej@NetBSD.org +HOMEPAGE= https://github.com/buricco/marduk +COMMENT= Portable emulator of the NABU Personal Computer +LICENSE= mit + +USE_TOOLS+= pkg-config + +MARDUK_ROMDIR= share/marduk + +INSTALLATION_DIRS= bin ${MARDUK_ROMDIR} + +.include "../../mk/bsd.prefs.mk" + +CPPFLAGS+= -DROM_PATHSPEC="\"${PREFIX}/${MARDUK_ROMDIR}\"" +CFLAGS+= ${CPPFLAGS} # Makefile ignores CPPFLAGS + +do-build: + cd ${WRKSRC} && ${MAKE} CFLAGS=${CFLAGS:Q} + +do-install: + ${INSTALL_PROGRAM} ${WRKSRC}/marduk ${DESTDIR}${PREFIX}/bin + ${INSTALL_DATA} ${WRKSRC}/opennabu.bin \ + ${DESTDIR}${PREFIX}/${MARDUK_ROMDIR} + +.if ${OPSYS} != "Darwin" +.include "../../x11/gtk3/buildlink3.mk" +.endif + +.include "../../devel/SDL2/buildlink3.mk" +.include "../../mk/bsd.pkg.mk" diff --git a/emulators/marduk/PLIST b/emulators/marduk/PLIST new file mode 100644 index 000000000000..2bb338e3bb66 --- /dev/null +++ b/emulators/marduk/PLIST @@ -0,0 +1,3 @@ +@comment $NetBSD: PLIST,v 1.1 2023/05/20 12:47:47 thorpej Exp $ +bin/marduk +share/marduk/opennabu.bin diff --git a/emulators/marduk/distinfo b/emulators/marduk/distinfo new file mode 100644 index 000000000000..d8529cde563e --- /dev/null +++ b/emulators/marduk/distinfo @@ -0,0 +1,8 @@ +$NetBSD: distinfo,v 1.1 2023/05/20 12:47:47 thorpej Exp $ + +BLAKE2s (marduk-0.26e-7cf954b7f9681daafa7240f49b7860f6f2107898.tar.gz) = 175b7a8ad33282e6a34d6cc3db3166173f2639ee74eeaca6c7fcf2a02365a5a3 +SHA512 (marduk-0.26e-7cf954b7f9681daafa7240f49b7860f6f2107898.tar.gz) = abb364821abb457fe3eeedb975c812b170f5e41ab0bbc19b4184a055097c620c90f208ed49df5d801ec7f2d3557eabf61cf54e118145c1ca5b80cabd9744eb8b +Size (marduk-0.26e-7cf954b7f9681daafa7240f49b7860f6f2107898.tar.gz) = 48799 bytes +SHA1 (patch-Makefile) = 0e667cb949fbfe782e090786e34e7fd18fcabf07 +SHA1 (patch-disk.c) = a56d1cc888464545b2eb1819f3fa7294c3fb006c +SHA1 (patch-main.c) = e45240edf8b625ea47ad164a660a1b501f109054 diff --git a/emulators/marduk/patches/patch-Makefile b/emulators/marduk/patches/patch-Makefile new file mode 100644 index 000000000000..186b3994ce46 --- /dev/null +++ b/emulators/marduk/patches/patch-Makefile @@ -0,0 +1,31 @@ +$NetBSD: patch-Makefile,v 1.1 2023/05/20 12:47:47 thorpej Exp $ + +Use SDL2 and GTK+-3.0 Cflags / Libs only when building files that need them. + +--- Makefile.orig 2023-05-20 12:24:50.772165900 +0000 ++++ Makefile 2023-05-20 12:37:55.337663884 +0000 +@@ -21,13 +21,10 @@ + # This should also work with Windows, using MinGW, if you do LIBS="-lws2_32" + # Build with CFLAGS=-DDEBUG for CPU trace (will be better integrated later) + +-CFLAGS := $(CFLAGS) `sdl2-config --cflags` `pkg-config gtk+-3.0 --cflags` +-LIBS := $(LIBS) `sdl2-config --libs` `pkg-config gtk+-3.0 --libs` +- + all: marduk + + marduk: dasm80.o disk.o emu2149.o main.o modem.o tms9918.o tms_util.o z80.o +- $(CC) $(CFLAGS) -o marduk dasm80.o disk.o emu2149.o main.o modem.o tms9918.o tms_util.o z80.o $(LIBS) ++ $(CC) $(CFLAGS) -o marduk dasm80.o disk.o emu2149.o main.o modem.o tms9918.o tms_util.o z80.o `sdl2-config --libs` `pkg-config gtk+-3.0 --libs` + + dasm80.o: dasm80.c z80.h + $(CC) $(CFLAGS) -c -o dasm80.o dasm80.c +@@ -39,7 +36,8 @@ emu2149.o: emu2149.c emu2149.h + $(CC) $(CFLAGS) -c -o emu2149.o emu2149.c + + main.o: main.c emu2149.h disk.h modem.h tms9918.h tms_util.h z80.h +- $(CC) $(CFLAGS) -c -o main.o main.c ++ $(CC) $(CFLAGS) `sdl2-config --cflags` `pkg-config gtk+-3.0 --cflags` \ ++ -c -o main.o main.c + + modem.o: modem.c modem.h + $(CC) $(CFLAGS) -c -o modem.o modem.c diff --git a/emulators/marduk/patches/patch-disk.c b/emulators/marduk/patches/patch-disk.c new file mode 100644 index 000000000000..de32a301dfc2 --- /dev/null +++ b/emulators/marduk/patches/patch-disk.c @@ -0,0 +1,21 @@ +$NetBSD: patch-disk.c,v 1.1 2023/05/20 12:47:47 thorpej Exp $ + +Add missing return values from disksys_init() and disksys_deinit(). + +--- disk.c.orig 2023-05-19 20:40:28 ++++ disk.c 2023-05-19 20:40:43 +@@ -305,6 +305,7 @@ int disksys_init (void) + diag_printf ("Initializing disk system\n"); + disksys_light=0; + mode=tick=subtick=0; ++ return 0; + } + + int disksys_deinit (void) +@@ -314,5 +315,6 @@ int disksys_deinit (void) + disktype[0]=disktype[1]=DISK_NONE; + diag_printf ("Shutting down disk system\n"); + disksys_light=0; ++ return 0; + } + diff --git a/emulators/marduk/patches/patch-main.c b/emulators/marduk/patches/patch-main.c new file mode 100644 index 000000000000..4af405d369ee --- /dev/null +++ b/emulators/marduk/patches/patch-main.c @@ -0,0 +1,20 @@ +$NetBSD: patch-main.c,v 1.1 2023/05/20 12:47:47 thorpej Exp $ + +Add a path prefix to the default boot ROM path until a more comprehensive +solution is implemented upstream. + +--- main.c.orig 2023-05-13 00:28:06 ++++ main.c 2023-05-20 00:04:49 +@@ -1714,7 +1714,11 @@ int main(int argc, char **argv) + * Default ROM is now OpenNabu (opennabu.bin). + * You can use actual Nabu firmware with the -4, -8 and -B switches. + */ +- bios = OPENNABU; ++ bios = ++#ifdef ROM_PATHSPEC ++ ROM_PATHSPEC "/" ++#endif ++ OPENNABU; + while (-1 != (e = getopt(argc, argv, "48B:jJS:P:Np:a:b:x:"))) + { + switch (e)