[gnome-games/wip/aplazas/blastem] flatpak: Use the upstream BlastEm core



commit 4a2599a2b260e3264501a1111a23bc9e7169fb16
Author: Adrien Plazas <kekun plazas laposte net>
Date:   Sun Jan 20 12:09:25 2019 +0100

    flatpak: Use the upstream BlastEm core
    
    It is more up-to-date than the Libretro fork.

 ...astem-Add-the-Libretro-installation-rules.patch | 41 ++++++++++++++
 .../blastem-Bundle-rom.db-as-a-resource.patch      | 64 ++++++++++++++++++++++
 flatpak/libretro-cores/libretro-blastem.json       | 21 +++++--
 3 files changed, 120 insertions(+), 6 deletions(-)
---
diff --git a/flatpak/libretro-cores/blastem-Add-the-Libretro-installation-rules.patch 
b/flatpak/libretro-cores/blastem-Add-the-Libretro-installation-rules.patch
new file mode 100644
index 00000000..8c1fda3e
--- /dev/null
+++ b/flatpak/libretro-cores/blastem-Add-the-Libretro-installation-rules.patch
@@ -0,0 +1,41 @@
+From b6ef46c0ad956fbd218b961eb4a686a09183f507 Mon Sep 17 00:00:00 2001
+From: Adrien Plazas <kekun plazas laposte net>
+Date: Mon, 11 Feb 2019 13:36:56 +0100
+Subject: [PATCH 1/2] Add the Libretro installation rules
+
+---
+ Makefile | 12 ++++++++++++
+ 1 file changed, 12 insertions(+)
+
+diff --git a/Makefile b/Makefile
+index 8a5b397..a421341 100644
+--- a/Makefile
++++ b/Makefile
+@@ -225,6 +225,12 @@ ifeq ($(MAKECMDGOALS),libblastem.so)
+ CFLAGS+= -fpic -DIS_LIB
+ endif
+ 
++# Libretro variables
++prefix := /usr
++libdir := $(prefix)/lib
++LIBRETRO_DIR := libretro
++TARGET := blastem_libretro.so
++
+ all : $(ALL)
+ 
+ libblastem.so : $(LIBOBJS)
+@@ -327,5 +333,11 @@ font.tiles : font.png
+ 
+ menu.bin : font_interlace_variable.tiles arrow.tiles cursor.tiles button.tiles font.tiles
+ 
++install_libretro:
++      install -D -m 755 libblastem.so $(DESTDIR)$(libdir)/$(LIBRETRO_DIR)/$(TARGET)
++
++uninstall_libretro:
++      rm $(DESTDIR)$(libdir)/$(LIBRETRO_DIR)/$(TARGET)
++
+ clean :
+       rm -rf $(ALL) trans ztestrun ztestgen *.o nuklear_ui/*.o zlib/*.o
+-- 
+2.20.1
+
diff --git a/flatpak/libretro-cores/blastem-Bundle-rom.db-as-a-resource.patch 
b/flatpak/libretro-cores/blastem-Bundle-rom.db-as-a-resource.patch
new file mode 100644
index 00000000..cf8ce2b8
--- /dev/null
+++ b/flatpak/libretro-cores/blastem-Bundle-rom.db-as-a-resource.patch
@@ -0,0 +1,64 @@
+From 0c823eb78531b6d6e9103dff953b27ee8ae33a68 Mon Sep 17 00:00:00 2001
+From: Adrien Plazas <kekun plazas laposte net>
+Date: Mon, 11 Feb 2019 13:34:36 +0100
+Subject: [PATCH 2/2] Bundle rom.db as a resource
+
+This lets BlastEm fall back to the bundled rom.db if the file isn't
+found.
+---
+ Makefile | 12 +++++++++++-
+ config.c |  4 ++++
+ 2 files changed, 15 insertions(+), 1 deletion(-)
+
+diff --git a/Makefile b/Makefile
+index a421341..6934a06 100644
+--- a/Makefile
++++ b/Makefile
+@@ -302,6 +302,16 @@ offsets : offsets.c z80_to_x86.h m68k_core.h
+ vos_prog_info : vos_prog_info.o vos_program_module.o
+       $(CC) -o vos_prog_info vos_prog_info.o vos_program_module.o
+ 
++romdb_resource.h : rom.db
++      echo "#ifndef ROMDB_RESOURCE_H_" > $@
++      echo "#define ROMDB_RESOURCE_H_" >> $@
++      echo "unsigned char romdb_resource[] = {" >> $@
++      hexdump -v -e '12/1 "0x%02X, " "\n"' $< | sed 's/ 0x  ,//g; s/.*/  &/' >> $@
++      echo "};" >> $@
++      echo "#endif //ROMDB_RESOURCE_H_" >> $@
++
++config.c : romdb_resource.h
++
+ %.o : %.S
+       $(CC) -c -o $@ $<
+ 
+@@ -340,4 +350,4 @@ uninstall_libretro:
+       rm $(DESTDIR)$(libdir)/$(LIBRETRO_DIR)/$(TARGET)
+ 
+ clean :
+-      rm -rf $(ALL) trans ztestrun ztestgen *.o nuklear_ui/*.o zlib/*.o
++      rm -rf $(ALL) trans ztestrun ztestgen romdb_resource.h *.o nuklear_ui/*.o zlib/*.o
+diff --git a/config.c b/config.c
+index 351bff7..1483fee 100644
+--- a/config.c
++++ b/config.c
+@@ -6,6 +6,7 @@
+ #include "tern.h"
+ #include "util.h"
+ #include "paths.h"
++#include "romdb_resource.h"
+ #include <stdio.h>
+ #include <stdlib.h>
+ #include <string.h>
+@@ -219,6 +220,9 @@ tern_node *parse_bundled_config(char *config_name)
+               confdata[confsize] = 0;
+               ret = parse_config(confdata);
+               free(confdata);
++      } else if (!strcmp("rom.db", config_name)) {
++              puts("ROM DB file not found, falling back to the bundled resource\n");
++              ret = parse_config(romdb_resource);
+       }
+ #ifdef CONFIG_PATH
+       }
+-- 
+2.20.1
+
diff --git a/flatpak/libretro-cores/libretro-blastem.json b/flatpak/libretro-cores/libretro-blastem.json
index a2c70f6a..488af600 100644
--- a/flatpak/libretro-cores/libretro-blastem.json
+++ b/flatpak/libretro-cores/libretro-blastem.json
@@ -5,10 +5,11 @@
                 "arm"
             ],
             "no-autogen": true,
-            "subdir": "libretro",
+            "install-rule": "install_libretro",
             "make-args": [
                 "prefix=/app",
-                "core_installdir=/app/lib/libretro"
+                "core_installdir=/app/lib/libretro",
+                "libblastem.so"
             ],
             "make-install-args": [
                 "prefix=/app",
@@ -21,13 +22,21 @@
             ],
             "sources": [
                 {
-                    "type": "git",
-                    "url": "https://github.com/libretro/blastem-libretro.git";
+                    "type": "archive",
+                    "url": "https://www.retrodev.com/repos/blastem/archive/ba3fb7a3be6b.tar.gz";,
+                    "sha256": "5c11eaaa385d82ef3796a7a8372398ab62ba7de7d9b3526b8bb161618f94c133"
+                },
+                {
+                    "type": "patch",
+                    "path": "blastem-Add-the-Libretro-installation-rules.patch"
+                },
+                {
+                    "type": "patch",
+                    "path": "blastem-Bundle-rom.db-as-a-resource.patch"
                 },
                 {
                     "type": "file",
-                    "path": "blastem.libretro",
-                    "dest-filename": "libretro/blastem.libretro"
+                    "path": "blastem.libretro"
                 }
             ]
         }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]