Build our own zlib

This commit is contained in:
topjohnwu 2021-05-10 18:46:03 -07:00
parent 7df23ceb74
commit 5b37de8fe5
4 changed files with 31 additions and 3 deletions

5
.gitmodules vendored
View File

@ -6,7 +6,7 @@
url = https://github.com/topjohnwu/ndk-busybox.git url = https://github.com/topjohnwu/ndk-busybox.git
[submodule "dtc"] [submodule "dtc"]
path = native/jni/external/dtc path = native/jni/external/dtc
url = https://github.com/dgibson/dtc url = https://github.com/dgibson/dtc.git
[submodule "lz4"] [submodule "lz4"]
path = native/jni/external/lz4 path = native/jni/external/lz4
url = https://github.com/lz4/lz4.git url = https://github.com/lz4/lz4.git
@ -31,6 +31,9 @@
[submodule "libcxx"] [submodule "libcxx"]
path = native/jni/external/libcxx path = native/jni/external/libcxx
url = https://github.com/topjohnwu/libcxx.git url = https://github.com/topjohnwu/libcxx.git
[submodule "zlib"]
path = native/jni/external/zlib
url = https://android.googlesource.com/platform/external/zlib
[submodule "termux-elf-cleaner"] [submodule "termux-elf-cleaner"]
path = tools/termux-elf-cleaner path = tools/termux-elf-cleaner
url = https://github.com/termux/termux-elf-cleaner.git url = https://github.com/termux/termux-elf-cleaner.git

View File

@ -83,7 +83,7 @@ ifdef B_BOOT
include $(CLEAR_VARS) include $(CLEAR_VARS)
LOCAL_MODULE := magiskboot LOCAL_MODULE := magiskboot
LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils LOCAL_STATIC_LIBRARIES := libmincrypt liblzma liblz4 libbz2 libfdt libutils libz
LOCAL_C_INCLUDES := jni/include LOCAL_C_INCLUDES := jni/include
LOCAL_SRC_FILES := \ LOCAL_SRC_FILES := \
@ -97,7 +97,6 @@ LOCAL_SRC_FILES := \
magiskboot/pattern.cpp \ magiskboot/pattern.cpp \
utils/cpio.cpp utils/cpio.cpp
LOCAL_LDLIBS := -lz
LOCAL_LDFLAGS := -static LOCAL_LDFLAGS := -static
include $(BUILD_EXECUTABLE) include $(BUILD_EXECUTABLE)

View File

@ -371,6 +371,31 @@ LOCAL_SRC_FILES := \
xhook/libxhook/jni/xh_elf.c xhook/libxhook/jni/xh_elf.c
include $(BUILD_STATIC_LIBRARY) include $(BUILD_STATIC_LIBRARY)
# libz.a
include $(CLEAR_VARS)
LOCAL_MODULE:= libz
LOCAL_C_INCLUDES := $(LOCAL_PATH)/zlib
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_C_INCLUDES)
LOCAL_CFLAGS := -DHAVE_HIDDEN -DZLIB_CONST -Wall -Werror -Wno-unused -Wno-unused-parameter
LOCAL_SRC_FILES := \
zlib/adler32.c \
zlib/compress.c \
zlib/cpu_features.c \
zlib/crc32.c \
zlib/deflate.c \
zlib/gzclose.c \
zlib/gzlib.c \
zlib/gzread.c \
zlib/gzwrite.c \
zlib/infback.c \
zlib/inffast.c \
zlib/inflate.c \
zlib/inftrees.c \
zlib/trees.c \
zlib/uncompr.c \
zlib/zutil.c
include $(BUILD_STATIC_LIBRARY)
CWD := $(LOCAL_PATH) CWD := $(LOCAL_PATH)
include $(CWD)/systemproperties/Android.mk include $(CWD)/systemproperties/Android.mk
include $(CWD)/mincrypt/Android.mk include $(CWD)/mincrypt/Android.mk

1
native/jni/external/zlib vendored Submodule

@ -0,0 +1 @@
Subproject commit 3a0aa2b3df38ad6298f91c4d8afef708bb4f088e