RetroArch/Makefile.rs90
Jesse Talavera-Greenberg aaad220836
Add Xdelta support for softpatching (#14706)
* Add xdelta in deps

* Include <assert.h> in xdelta3.h

- Otherwise the static_assert calls can fail

* Build xdelta3 in Makefile.common

* Add xdelta support to the softpatching infrastructure

- The patching itself isn't fully implemented yet

* Adjust how xdelta3.h checks the sizes of some types

- Now checks max values instead of relying on autotools

* First crack at xdelta softpatching support

- There may be undiscovered edge cases or bugs

* Add xdelta in deps

* Include <assert.h> in xdelta3.h

- Otherwise the static_assert calls can fail

* Build xdelta3 in Makefile.common

* Add xdelta support to the softpatching infrastructure

- The patching itself isn't fully implemented yet

* Adjust how xdelta3.h checks the sizes of some types

- Now checks max values instead of relying on autotools

* First crack at xdelta softpatching support

- There may be undiscovered edge cases or bugs

* Remove trailing commas from the enums I modified

- C89 doesn't allow them

* Remove stray whitespace

* Adjust SIZE macros in xdelta3.h

- Move them outside the XD3_USE_LARGEFILE64 block
- Add more SIZE declarations
- Make SIZEOF_UNSIGNED_LONG_LONG contingent on the presence of ULLONG_MAX

* Add some RARCH_DBG calls for xdelta patching

* Enable support for xdelta's secondary compressors

- Necessary for some patches

* Fix some format specifiers

* Remove unnecessary files from xdelta

* Include xdelta3.h with a relative path

* Add xdelta3 headers to HEADERS variable

* Gate Xdelta support behind HAVE_XDELTA

- HAVE_XDELTA is on by default
- HAVE_PATCH is still required for HAVE_XDELTA to be meaningful
- Support is mostly contingent on the availability of LZMA
- Anything modern should be okay
- Legacy platforms (e.g. DOS) may need to have Xdelta support disabled
- At least until some other solution can be found

* Disable HAVE_XDELTA on platforms where the build recently failed

- These come from looking at the failed builds on GitHub
- These are guesses, and may turn out to be wrong

* Fix a potential memory leak

- Whoops, looks like I need to call two cleanup functions
- xd3_close_stream exists separately from xd3_free_stream

* Split the --help printout for --xdelta into its own strlcat call

- GCC was complaining about #ifdefs within macro arguments being non-portable

* Fix some incorrect printf format specifiers

* Modify Xdelta to adhere to C89

- It's mostly using RetroArch's INLINE macro instead of the inline keyword
2022-12-19 01:10:04 +01:00

237 lines
5.5 KiB
Makefile

#########################
## Toolchain variables ##
#########################
# Alpha toolchain
TOOLCHAIN_DIR=/opt/rs90-toolchain
# All toolchain-related variables may be
# overridden via the command line
ifdef GCW0_CC
CC = $(GCW0_CC)
else
CC = $(TOOLCHAIN_DIR)/usr/bin/mipsel-rs90-linux-musl-gcc
endif
ifdef GCW0_CXX
CXX = $(GCW0_CXX)
else
CXX = $(TOOLCHAIN_DIR)/usr/bin/mipsel-rs90-linux-musl-g++
endif
ifdef GCW0_STRIP
STRIP = $(GCW0_STRIP)
else
STRIP = $(TOOLCHAIN_DIR)/usr/bin/mipsel-rs90-linux-musl-strip
endif
GCW0_SDL_CONFIG ?= $(TOOLCHAIN_DIR)/usr/mipsel-rs90-linux-musl/sysroot/usr/bin/sdl-config
GCW0_FREETYPE_CONFIG ?= $(TOOLCHAIN_DIR)/usr/mipsel-rs90-linux-musl/sysroot/usr/bin/freetype-config
GCW0_MK_SQUASH_FS ?= $(TOOLCHAIN_DIR)/usr/bin/mksquashfs
GCW0_INC_DIR ?= $(TOOLCHAIN_DIR)/usr/mipsel-rs90-linux-musl/sysroot/usr/include
GCW0_LIB_DIR ?= $(TOOLCHAIN_DIR)/usr/mipsel-rs90-linux-musl/sysroot/usr/lib
#########################
#########################
PACKAGE_NAME = retroarch
DEBUG ?= 0
RS90 = 1
DINGUX = 1
DINGUX_BETA = 1
HAVE_SCREENSHOTS = 0
HAVE_REWIND = 0
HAVE_7ZIP = 1
HAVE_AL = 0
HAVE_ALSA = 1
HAVE_DSP_FILTER = 1
HAVE_VIDEO_FILTER = 1
HAVE_STATIC_VIDEO_FILTERS = 1
HAVE_STATIC_AUDIO_FILTERS = 1
HAVE_FILTERS_BUILTIN = 1
HAVE_BUILTINMBEDTLS = 0
HAVE_BUILTINZLIB = 1
HAVE_C99 = 1
HAVE_CC = 1
HAVE_CC_RESAMPLER = 1
HAVE_CHD = 0
HAVE_COMMAND = 0
HAVE_CXX = 1
HAVE_DR_MP3 = 0
HAVE_DYNAMIC = 1
HAVE_EGL = 0
HAVE_FREETYPE = 0
HAVE_GDI = 0
HAVE_GETADDRINFO = 0
HAVE_GETOPT_LONG = 1
HAVE_GLSL = 0
HAVE_HID = 0
HAVE_IBXM = 0
HAVE_IMAGEVIEWER = 0
HAVE_LANGEXTRA = 0
HAVE_LIBRETRODB = 1
HAVE_MENU = 1
HAVE_MENU_COMMON = 1
HAVE_GFX_WIDGETS = 0
HAVE_MMAP = 1
HAVE_OPENDINGUX_FBDEV = 0
HAVE_OPENGL = 0
HAVE_OPENGL1 = 0
HAVE_OPENGLES = 0
HAVE_OPENGLES3 = 0
HAVE_OPENGL_CORE = 0
HAVE_OPENSSL = 0
HAVE_OVERLAY = 0
HAVE_RBMP = 1
HAVE_RJPEG = 1
HAVE_RPILED = 0
HAVE_RPNG = 1
HAVE_RUNAHEAD = 0
HAVE_SDL_DINGUX = 1
HAVE_SHADERPIPELINE = 0
HAVE_STB_FONT = 0
HAVE_STB_IMAGE = 0
HAVE_STB_VORBIS = 0
HAVE_STDIN_CMD = 0
HAVE_STRCASESTR = 1
HAVE_THREADS = 1
HAVE_UDEV = 1
HAVE_RGUI = 1
HAVE_MATERIALUI = 0
HAVE_XMB = 0
HAVE_OZONE = 0
HAVE_ZLIB = 1
HAVE_CONFIGFILE = 1
HAVE_PATCH = 1
HAVE_XDELTA = 0 # Disabled until we figure out how to include <lzma.h>
HAVE_CHEATS = 1
HAVE_CHEEVOS = 0
HAVE_LIBSHAKE = 0
HAVE_TINYALSA = 1
HAVE_NEAREST_RESAMPLER = 1
HAVE_CORE_INFO_CACHE = 1
OS = Linux
TARGET = retroarch
OPK_NAME = retroarch_rs90_odbeta.opk
OBJ :=
LINK := $(CXX)
DEF_FLAGS := -mplt -mno-shared
DEF_FLAGS += -ffunction-sections -fdata-sections
DEF_FLAGS += -I. -Ideps -Ideps/stb -DRS90=1 -DDINGUX=1 -DDINGUX_BETA=1 -MMD
DEF_FLAGS += -Wall -Wno-unused-variable
DEF_FLAGS += -std=gnu99 -D_GNU_SOURopendinguxCE -flto -lasound
LIBS := -ldl -lz -lrt -ludev -pthread
CFLAGS :=
CXXFLAGS := -fno-exceptions -fno-rtti -std=c++11 -D__STDC_CONSTANT_MACROS
ASFLAGS :=
LDFLAGS := -Wl,--gc-sections
INCLUDE_DIRS = -I$(GCW0_INC_DIR)
LIBRARY_DIRS = -L$(GCW0_LIB_DIR)
DEFINES := -DRARCH_INTERNAL -D_FILE_OFFSET_BITS=64 -UHAVE_STATIC_DUMMY
DEFINES += -DHAVE_C99=1 -DHAVE_CXX=1
DEFINES += -DHAVE_GETOPT_LONG=1 -DHAVE_STRCASESTR=1 -DHAVE_DYNAMIC=1
DEFINES += -DHAVE_FILTERS_BUILTIN
DEFINES += -DHAVE_UDEV=1
DEFINES += -DHAVE_ALSA
DEFINES += -DCC_RESAMPLER_PRECISION=0
SDL_DINGUX_CFLAGS := $(shell $(GCW0_SDL_CONFIG) --cflags)
SDL_DINGUX_LIBS := $(shell $(GCW0_SDL_CONFIG) --libs)
FREETYPE_CFLAGS := $(shell $(GCW0_FREETYPE_CONFIG) --cflags)
FREETYPE_LIBS := $(shell $(GCW0_FREETYPE_CONFIG) --libs)
MMAP_LIBS = -lc
OBJDIR_BASE := obj-unix
ifeq ($(DEBUG), 1)
OBJDIR := $(OBJDIR_BASE)/debug
DEF_FLAGS += -O0 -g -DDEBUG -D_DEBUG
else
OBJDIR := $(OBJDIR_BASE)/release
DEF_FLAGS += -Ofast -DNDEBUG
endif
include Makefile.common
DEF_FLAGS += $(INCLUDE_DIRS)
LDFLAGS += $(CFLAGS) $(CXXFLAGS) $(DEF_FLAGS)
CFLAGS += $(DEF_FLAGS)
CXXFLAGS += $(DEF_FLAGS)
HEADERS = $(wildcard */*/*.h) $(wildcard */*.h) $(wildcard *.h)
Q := @
RARCH_OBJ := $(addprefix $(OBJDIR)/,$(OBJ))
define DESKTOP_ENTRY
[Desktop Entry]
Name=RetroArch
Comment=Frontend for emulators, game engines
Exec=retroarch
Terminal=false
Type=Application
StartupNotify=true
Icon=retroarch
Categories=emulators;
X-OD-NeedsDownscaling=true
endef
export DESKTOP_ENTRY
all: $(TARGET) opk
-include $(RARCH_OBJ:.o=.d)
SYMBOL_MAP := -Wl,-Map=output.map
$(TARGET): $(RARCH_OBJ)
@$(if $(Q), $(shell echo echo LD $@),)
$(Q)$(LINK) -o $@ $(RARCH_OBJ) $(LIBS) $(LDFLAGS) $(LIBRARY_DIRS)
$(OBJDIR)/%.o: %.c
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CC $<),)
$(Q)$(CC) $(CPPFLAGS) $(CFLAGS) $(DEFINES) -c -o $@ $<
$(OBJDIR)/%.o: %.cpp
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo CXX $<),)
$(Q)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(DEFINES) -MMD -c -o $@ $<
$(OBJDIR)/%.o: %.m
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo OBJC $<),)
$(Q)$(CXX) $(OBJCFLAGS) $(DEFINES) -MMD -c -o $@ $<
$(OBJDIR)/%.o: %.S $(HEADERS)
@mkdir -p $(dir $@)
@$(if $(Q), $(shell echo echo AS $<),)
$(Q)$(CC) $(CFLAGS) $(ASFLAGS) $(DEFINES) -c -o $@ $<
clean:
rm -rf $(OBJDIR_BASE)
rm -f $(TARGET)
rm -f *.d
rm -rf $(OPK_NAME)
opk: $(TARGET)
echo "$$DESKTOP_ENTRY" > default.rs90.desktop
rm -f $(OPK_NAME)
cp media/ico_src/icon32.png retroarch.png
ifeq ($STRIP_BIN, 1)
$(STRIP) --strip-unneeded retroarch
endif
$(GCW0_MK_SQUASH_FS) retroarch default.rs90.desktop retroarch.png $(OPK_NAME) -all-root -no-xattrs -noappend -no-exports
rm -f default.rs90.desktop retroarch.png
.PHONY: all clean opk
print-%:
@echo '$*=$($*)'