Try to build libressl as static lib for android

This commit is contained in:
zorn 2023-12-09 19:47:58 +10:00
parent be38a65c26
commit 392d40e6d0
3 changed files with 36 additions and 17 deletions

View File

@ -247,7 +247,7 @@ endif
include Makefile.common
SOURCES_C += $(DYNARMICSOURCES_C)
SOURCES_C += $(DYNARMICSOURCES_C) $(FAAD2SOURCES_C) $(LIBRESSLSOURCES_C)
SOURCES_CXX += $(DYNARMICSOURCES_CXX)
CPPFILES = $(filter %.cpp,$(SOURCES_CXX))

View File

@ -146,8 +146,11 @@ CXXFLAGS += -DCRYPTOPP_DISABLE_ASM -DCRYPTOPP_DISABLE_SSSE3 -DCRYPTOPP_DISABLE_S
ifeq ($(HAVE_DYNARMIC), 1)
DEFINES += -DHAVE_DYNARMIC
DYNARMICINCFLAGS := -I$(EXTERNALS_DIR)/dynarmic/src/dynarmic \
DYNARMICINCFLAGS := -I$(EXTERNALS_DIR)/dynarmic/src \
-I$(EXTERNALS_DIR)/dynarmic/src/dynarmic \
-I$(EXTERNALS_DIR)/dynarmic/externals/mcl/include \
-I$(EXTERNALS_DIR)/dynarmic/externals/oaknut/include \
-I$(EXTERNALS_DIR)/dynarmic/externals/robin-map/include \
-I$(EXTERNALS_DIR)/dynarmic/externals/zycore/include \
-I$(EXTERNALS_DIR)/dynarmic/externals/zydis/include \
-I$(EXTERNALS_DIR)/dynarmic/externals/zydis/src \
@ -301,7 +304,8 @@ DYNARMICSOURCES_CXX += $(EXTERNALS_DIR)/dynarmic/externals/mcl/src/assert.cpp \
DYNARMICSOURCES_CXX += $(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/exception_handler_generic.cpp
endif
else ifeq ($(ARCH), aarch64)
DYNARMICSOURCES_CXX += $(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/a32_interface.cpp \
DYNARMICSOURCES_CXX += $(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/a32_address_space.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/a32_interface.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/a32_jitstate.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/abi.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/emit_arm64.cpp \
@ -310,10 +314,10 @@ DYNARMICSOURCES_CXX += $(EXTERNALS_DIR)/dynarmic/externals/mcl/src/assert.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/emit_arm64_floating_point.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/emit_arm64_packed.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/emit_arm64_saturation.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/exception_handler_posix.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/arm64/reg_alloc.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/block_range_information.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/exception_handler_generic.cpp
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/exception_handler_generic.cpp \
$(EXTERNALS_DIR)/dynarmic/src/dynarmic/backend/exception_handler_posix.cpp
else
$(error Bad architecture used with dynarmic: $(ARCH))
endif
@ -343,8 +347,8 @@ endif
FAAD2_VERSION := '"$(shell cat $(EXTERNALS_DIR)/faad2/faad2/properties.json | grep 'PACKAGE_VERSION' | cut -d'"' -f4)"'
FAAD2FLAGS := -DLC_ONLY_DECODER -DDISABLE_SBR -DPACKAGE_VERSION=$(FAAD2_VERSION) \
-DAPPLY_DRC -DHAVE_INTTYPES_H=1 -DHAVE_MEMCPY=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DSTDC_HEADERS=1 \
-I$(EXTERNALS_DIR)/faad2/faad2/libfaad
SOURCES_C += $(EXTERNALS_DIR)/faad2/faad2/libfaad/bits.c \
-I$(EXTERNALS_DIR)/faad2/faad2/include -I$(EXTERNALS_DIR)/faad2/faad2/libfaad
FAAD2SOURCES_C += $(EXTERNALS_DIR)/faad2/faad2/libfaad/bits.c \
$(EXTERNALS_DIR)/faad2/faad2/libfaad/cfft.c \
$(EXTERNALS_DIR)/faad2/faad2/libfaad/common.c \
$(EXTERNALS_DIR)/faad2/faad2/libfaad/decoder.c \
@ -411,6 +415,7 @@ endif
# Externals - libressl
LIBRESSLFLAGS += -I$(EXTERNALS_DIR)/libressl/include/compat \
-I$(EXTERNALS_DIR)/libressl/include \
-I$(EXTERNALS_DIR)/libressl/crypto \
-I$(EXTERNALS_DIR)/libressl/crypto/asn1 \
-I$(EXTERNALS_DIR)/libressl/crypto/bio \
@ -431,30 +436,30 @@ LIBRESSLFLAGS += -I$(EXTERNALS_DIR)/libressl/include/compat \
-I$(EXTERNALS_DIR)/libressl/crypto/rsa \
-I$(EXTERNALS_DIR)/libressl/crypto/sha \
-I$(EXTERNALS_DIR)/libressl/crypto/x509 \
-DOPENSSL_NO_HW_PADLOCK -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= \
-DLIBRESSL_INTERNAL -DOPENSSL_NO_HW_PADLOCK -D__BEGIN_HIDDEN_DECLS= -D__END_HIDDEN_DECLS= \
-DLIBRESSL_CRYPTO_INTERNAL -DHAVE_ENDIAN_H -DOPENSSL_NO_ASM
ifeq ($(ARCH), x86_64)
LIBRESSLFLAGS += -I$(EXTERNALS_DIR)/libressl/crypto/bn/arch/amd64 -DLIBRESSL_INTERNAL
LIBRESSLFLAGS += -I$(EXTERNALS_DIR)/libressl/crypto/bn/arch/amd64
else ifeq ($(ARCH), aarch64)
LIBRESSLFLAGS += -I$(EXTERNALS_DIR)/libressl/crypto/bn/arch/aarch64
else
$(error Bad architecture used with libressl: $(ARCH))
endif
ifeq ($(platform), win)
SOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/compat/crypto_lock_win.c \
LIBRESSLSOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/compat/crypto_lock_win.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/getprogname_windows.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/posix_win.c \
$(EXTERNALS_DIR)/libressl/crypto/bio/b_win.c \
$(EXTERNALS_DIR)/libressl/crypto/bio/bss_log.c \
$(EXTERNALS_DIR)/libressl/crypto/ui/ui_openssl_win.c
else ifeq ($(platform), unix)
SOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/crypto_lock.c \
LIBRESSLSOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/crypto_lock.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/getprogname_unimpl.c \
$(EXTERNALS_DIR)/libressl/crypto/bio/b_posix.c \
$(EXTERNALS_DIR)/libressl/crypto/bio/bss_log.c \
$(EXTERNALS_DIR)/libressl/crypto/ui/ui_openssl.c
endif
SOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/compat/freezero.c \
LIBRESSLSOURCES_C += $(EXTERNALS_DIR)/libressl/crypto/compat/freezero.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/recallocarray.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/strtonum.c \
$(EXTERNALS_DIR)/libressl/crypto/compat/syslog_r.c \

View File

@ -8,23 +8,37 @@ $(shell make -C .. shaders)
# Build the dynarmic module as a static library
include $(CLEAR_VARS)
LOCAL_MODULE := dynarmic
HAVE_DYNARMIC := 1
HAVE_LIBRETRO_VFS := 0
ARCH := aarch64
include ../Makefile.common
LOCAL_CPPFLAGS := $(DYNARMICINCFLAGS) \
-I$(EXTERNALS_DIR)/dynarmic/include \
-I$(EXTERNALS_DIR)/dynarmic/src/frontend/A32 \
-I$(EXTERNALS_DIR)/boost
LOCAL_SRC_FILES := $(DYNARMICSOURCES_CXX)
include $(BUILD_STATIC_LIBRARY)
# Build the faad2 module as a static library
include $(CLEAR_VARS)
LOCAL_MODULE := faad2
ARCH := aarch64
include ../Makefile.common
LOCAL_CFLAGS := $(FAAD2FLAGS)
LOCAL_SRC_FILES := $(FAAD2SOURCES_C)
include $(BUILD_STATIC_LIBRARY)
# Build the libressl module as a static library
include $(CLEAR_VARS)
LOCAL_MODULE := ssl
ARCH := aarch64
include ../Makefile.common
LOCAL_CFLAGS := $(LIBRESSLFLAGS)
LOCAL_SRC_FILES := $(LIBRESSLSOURCES_C)
include $(BUILD_STATIC_LIBRARY)
# Build the final shared library
include $(CLEAR_VARS)
@ -64,7 +78,7 @@ INCFLAGS += -I$(SRC_DIR)/audio_core/hle -I$(EXTERNALS_DIR)/android-ifaddrs
LOCAL_SRC_FILES := $(ANDROID_SOURCES) $(SOURCES_CXX) $(SOURCES_C)
LOCAL_CPPFLAGS := -Wall -Wno-unused-local-typedef -std=c++20 -D__LIBRETRO__ \$(fpic) $(DEFINES) $(CUSTOM_DEF) $(ANDROID_INCLUDES) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(ANDROID_INCLUDES)
LOCAL_CFLAGS := -D__LIBRETRO__ $(fpic) $(DEFINES) $(CUSTOM_DEF) $(INCFLAGS) $(INCFLAGS_PLATFORM) $(ANDROID_INCLUDES) $(CFLAGS)
LOCAL_STATIC_LIBRARIES += dynarmic cpufeatures
LOCAL_STATIC_LIBRARIES += dynarmic faad ssl cpufeatures
LOCAL_LDLIBS := -llog -lmediandk
include $(BUILD_SHARED_LIBRARY)