Add openssl for android x86_64, and build that executable into the APK as well. Not used yet.

git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@4221 ed5197a5-7fde-0310-b194-c3ffbd925b24
This commit is contained in:
2023-03-14 03:17:01 +00:00
parent 37173cce4c
commit 2b0962f087
8087 changed files with 247012 additions and 18 deletions

View File

@ -5,7 +5,7 @@ MAKEFLAGS += --no-builtin-rules
PROJECT = tildefriends
BUILD_DIR ?= out
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease
BUILD_TYPES := debug release windebug winrelease androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64
UNAME_M := $(shell uname -m)
CFLAGS += \
@ -25,15 +25,22 @@ ANDROID_BUILD_TOOLS := $(ANDROID_SDK)/build-tools/29.0.3
ANDROID_PLATFORM := $(ANDROID_SDK)/platforms/android-23
ANDROID_NDK ?= /usr/lib/android-sdk/ndk-bundle
ANDROID_NDK_API_VERSION := 30
ANDROID_NDK_TARGET_TRIPLE := aarch64-linux-android
ANDROID_MIN_SDK_VERSION := 26
ANDROID_TARGETS := \
ANDROID_ARM64_TARGETS := \
out/androiddebug/tildefriends \
out/androidrelease/tildefriends
ANDROID_X86_64_TARGETS := \
out/androiddebug-x86_64/tildefriends \
out/androidrelease-x86_64/tildefriends
ANDROID_TARGETS := \
$(ANDROID_X86_64_TARGETS) \
$(ANDROID_ARM64_TARGETS)
$(info $(ANDROID_TARGETS))
debug windebug $(ANDROID_TARGETS): CFLAGS += -Og
debug release androidrelease: LDFLAGS += -rdynamic
debug release out/androidrelease/tildefriends out/androidrelease-x86_64/tildefriends: LDFLAGS += -rdynamic
$(ANDROID_TARGETS): CFLAGS += --sysroot $(ANDROID_SDK)/ndk-bundle/sysroot -fPIC
release winrelease: CFLAGS += -DNDEBUG -O3
windebug winrelease: CC = x86_64-w64-mingw32-gcc-win32
@ -47,18 +54,17 @@ windebug winrelease: LDFLAGS += \
-static \
-lm \
-Ldeps/openssl/mingw64/lib
$(ANDROID_X86_64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := x86_64-linux-android
$(ANDROID_ARM64_TARGETS): ANDROID_NDK_TARGET_TRIPLE := aarch64-linux-android
$(ANDROID_TARGETS): CC = $(ANDROID_NDK)/toolchains/llvm/prebuilt/linux-x86_64/bin/clang
$(ANDROID_TARGETS): AS = $(CC)
$(ANDROID_TARGETS): CFLAGS += \
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
-Ideps/openssl/android/arm64-v8a/usr/local/include \
-Wno-unknown-warning-option
$(ANDROID_TARGETS): LDFLAGS += \
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
-Ldeps/openssl/android/arm64-v8a/usr/local/lib \
-llog \
-lssl \
-lcrypto
$(ANDROID_ARM64_TARGETS): CFLAGS += -Ideps/openssl/android/arm64-v8a/usr/local/include
$(ANDROID_ARM64_TARGETS): LDFLAGS += -Ldeps/openssl/android/arm64-v8a/usr/local/lib
$(ANDROID_X86_64_TARGETS): CFLAGS += -Ideps/openssl/android/x86_64/usr/local/include
$(ANDROID_X86_64_TARGETS): LDFLAGS += -Ldeps/openssl/android/x86_64/usr/local/lib
ifeq ($(UNAME_M),x86_64)
debug: CFLAGS += -fsanitize=address -fsanitize=undefined -fno-common
@ -69,8 +75,8 @@ get_objs = \
$(foreach build_type,$(BUILD_TYPES),$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)))))) \
$(foreach build_type,debug release,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix))))) \
$(foreach build_type,windebug winrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_win))))) \
$(foreach build_type,androiddebug androidrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \
$(foreach build_type,androiddebug androidrelease,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix)))))
$(foreach build_type,androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_android))))) \
$(foreach build_type,androiddebug androidrelease androiddebug-x86_64 androidrelease-x86_64,$(addprefix $(BUILD_DIR)/$(build_type)/,$(addsuffix .o,$(basename $(value $(1)_unix)))))
APP_SOURCES := $(wildcard src/*.c)
APP_OBJS := $(call get_objs,APP_SOURCES)
@ -343,10 +349,12 @@ windebug winrelease: LDFLAGS += \
-lws2_32 \
-lcrypt32
$(ANDROID_TARGETS): LDFLAGS += \
-target $(ANDROID_NDK_TARGET_TRIPLE)$(ANDROID_NDK_API_VERSION) \
-fPIC \
-ldl \
-llog \
-lssl \
-lcrypto \
-fPIC
-lcrypto
unix: debug release
win: windebug winrelease
@ -418,13 +426,15 @@ PACKAGE_DIRS := \
RAW_FILES := $(shell find $(PACKAGE_DIRS) -type f)
out/TildeFriends.unsigned.apk: out/apk/classes.dex out/androiddebug/tildefriends $(RAW_FILES)
@mkdir -p $(dir $@) out/apk/lib/arm64-v8a/
out/TildeFriends.unsigned.apk: out/apk/classes.dex out/androiddebug/tildefriends out/androiddebug-x86_64/tildefriends $(RAW_FILES)
@mkdir -p $(dir $@) out/apk/lib/arm64-v8a/ out/apk/lib/x86_64/
@echo [aapt] $@
@cp out/androiddebug/tildefriends out/apk/lib/arm64-v8a/
@cp out/androiddebug-x86_64/tildefriends out/apk/lib/x86_64/
@/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk/lib/arm64-v8a/tildefriends
@/usr/lib/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin/llvm-strip out/apk/lib/x86_64/tildefriends
@$(ANDROID_BUILD_TOOLS)/aapt package -f -M src/android/AndroidManifest.xml -S src/android/res/ -I $(ANDROID_PLATFORM)/android.jar -F $@ out/apk/
@zip -u $@ -q -r $(PACKAGE_DIRS)
@zip -u $@ -q -9 -r $(PACKAGE_DIRS)
out/TildeFriends.apk: out/TildeFriends.unsigned.apk
@echo [apksigner] $(notdir $@)