make: Enable Lightrec for GC/Wii
authorPaul Cercueil <paul@crapouillou.net>
Tue, 25 Jul 2023 10:27:50 +0000 (12:27 +0200)
committerPaul Cercueil <paul@crapouillou.net>
Tue, 25 Jul 2023 10:31:08 +0000 (12:31 +0200)
Add the missing sysconf() function so that the GC/Wii builds will link
properly against Lightrec and GNU Lightning.

Signed-off-by: Paul Cercueil <paul@crapouillou.net>
Makefile
Makefile.libretro
libpcsxcore/lightrec/sysconf.c [new file with mode: 0644]

index ee3a44f..470b9e8 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -102,6 +102,9 @@ ifeq ($(LIGHTREC_CUSTOM_MAP),1)
 LDLIBS += -lrt
 OBJS += $(LIGHTREC_CUSTOM_MAP_OBJ)
 endif
+ifeq ($(NEED_SYSCONF),1)
+OBJS += libpcsxcore/lightrec/sysconf.o
+endif
 ifeq ($(LIGHTREC_THREADED_COMPILER),1)
 OBJS += deps/lightrec/recompiler.o \
        deps/lightrec/reaper.o
index 5f43eea..e297bb6 100644 (file)
@@ -330,10 +330,10 @@ else ifneq (,$(filter $(platform),ngc wii wiiu))
        TARGET := $(TARGET_NAME)_libretro_$(platform).a
        ifeq ($(platform), ngc)
                CFLAGS += -DHW_DOL -mogc
-               DYNAREC := 0 # missing sysconf()
+               NEED_SYSCONF := 1
        else ifeq ($(platform), wii)
                CFLAGS += -DHW_RVL -mrvl
-               DYNAREC := 0 # missing sysconf()
+               NEED_SYSCONF := 1
        else ifeq ($(platform), wiiu)
                # -mwup was removed in newer devkitPPC versions
                CFLAGS += -DHW_WUP
diff --git a/libpcsxcore/lightrec/sysconf.c b/libpcsxcore/lightrec/sysconf.c
new file mode 100644 (file)
index 0000000..6d51bea
--- /dev/null
@@ -0,0 +1,13 @@
+#include <errno.h>
+#include <unistd.h>
+
+/* Implement the sysconf() symbol which is needed by GNU Lightning */
+long sysconf(int name)
+{
+       switch (name) {
+       case _SC_PAGE_SIZE:
+               return 4096;
+       default:
+               return -EINVAL;
+       }
+}