mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-03-20 15:50:53 +00:00
Replace zlib with zlib-rs
This commit is contained in:
parent
675471a49e
commit
bd0e954fea
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -13,9 +13,6 @@
|
|||||||
[submodule "libcxx"]
|
[submodule "libcxx"]
|
||||||
path = native/src/external/libcxx
|
path = native/src/external/libcxx
|
||||||
url = https://github.com/topjohnwu/libcxx.git
|
url = https://github.com/topjohnwu/libcxx.git
|
||||||
[submodule "zlib"]
|
|
||||||
path = native/src/external/zlib
|
|
||||||
url = https://android.googlesource.com/platform/external/zlib
|
|
||||||
[submodule "zopfli"]
|
[submodule "zopfli"]
|
||||||
path = native/src/external/zopfli
|
path = native/src/external/zopfli
|
||||||
url = https://github.com/google/zopfli.git
|
url = https://github.com/google/zopfli.git
|
||||||
|
@ -89,7 +89,6 @@ LOCAL_STATIC_LIBRARIES := \
|
|||||||
liblzma \
|
liblzma \
|
||||||
liblz4 \
|
liblz4 \
|
||||||
libbz2 \
|
libbz2 \
|
||||||
libz \
|
|
||||||
libzopfli \
|
libzopfli \
|
||||||
libboot-rs
|
libboot-rs
|
||||||
|
|
||||||
|
16
native/src/Cargo.lock
generated
16
native/src/Cargo.lock
generated
@ -452,6 +452,15 @@ version = "0.2.170"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
checksum = "875b3680cb2f8f71bdcf9a30f38d48282f5d3c95cbf9b3fa57269bb5d5c06828"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libz-rs-sys"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "902bc563b5d65ad9bba616b490842ef0651066a1a1dc3ce1087113ffcb873c8d"
|
||||||
|
dependencies = [
|
||||||
|
"zlib-rs",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.26"
|
version = "0.4.26"
|
||||||
@ -489,6 +498,7 @@ dependencies = [
|
|||||||
"der",
|
"der",
|
||||||
"digest",
|
"digest",
|
||||||
"fdt",
|
"fdt",
|
||||||
|
"libz-rs-sys",
|
||||||
"num-traits",
|
"num-traits",
|
||||||
"p256",
|
"p256",
|
||||||
"p384",
|
"p384",
|
||||||
@ -1048,3 +1058,9 @@ dependencies = [
|
|||||||
"quote",
|
"quote",
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "zlib-rs"
|
||||||
|
version = "0.4.2"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "8b20717f0917c908dc63de2e44e97f1e6b126ca58d0e391cee86d504eb8fbd05"
|
||||||
|
@ -34,6 +34,7 @@ syn = "2"
|
|||||||
quote = "1"
|
quote = "1"
|
||||||
proc-macro2 = "1"
|
proc-macro2 = "1"
|
||||||
argh = { version = "0.1.13", default-features = false }
|
argh = { version = "0.1.13", default-features = false }
|
||||||
|
libz-rs-sys = { version = "0.4.2", default-features = false, features=["c-allocator"] }
|
||||||
|
|
||||||
# Pin version to prevent cargo update break builds
|
# Pin version to prevent cargo update break builds
|
||||||
block-buffer = "=0.11.0-rc.3"
|
block-buffer = "=0.11.0-rc.3"
|
||||||
|
@ -32,3 +32,4 @@ der = { workspace = true, features = ["derive", "pem"] }
|
|||||||
fdt = { workspace = true }
|
fdt = { workspace = true }
|
||||||
bytemuck = { workspace = true, features = ["derive", "min_const_generics"] }
|
bytemuck = { workspace = true, features = ["derive", "min_const_generics"] }
|
||||||
num-traits = { workspace = true }
|
num-traits = { workspace = true }
|
||||||
|
libz-rs-sys = { workspace = true }
|
||||||
|
@ -153,7 +153,7 @@ class zopfli_encoder : public chunk_out_stream {
|
|||||||
public:
|
public:
|
||||||
explicit zopfli_encoder(out_strm_ptr &&base) :
|
explicit zopfli_encoder(out_strm_ptr &&base) :
|
||||||
chunk_out_stream(std::move(base), ZOPFLI_MASTER_BLOCK_SIZE),
|
chunk_out_stream(std::move(base), ZOPFLI_MASTER_BLOCK_SIZE),
|
||||||
zo{}, out(nullptr), outsize(0), crc(crc32_z(0L, Z_NULL, 0)), in_total(0), bp(0) {
|
zo{}, out(nullptr), outsize(0), crc(crc32(0L, Z_NULL, 0)), in_total(0), bp(0) {
|
||||||
ZopfliInitOptions(&zo);
|
ZopfliInitOptions(&zo);
|
||||||
|
|
||||||
// This config is already better than gzip -9
|
// This config is already better than gzip -9
|
||||||
@ -198,7 +198,7 @@ protected:
|
|||||||
auto in = static_cast<const unsigned char *>(buf);
|
auto in = static_cast<const unsigned char *>(buf);
|
||||||
|
|
||||||
in_total += len;
|
in_total += len;
|
||||||
crc = crc32_z(crc, in, len);
|
crc = crc32(crc, in, len);
|
||||||
|
|
||||||
ZopfliDeflatePart(&zo, 2, final, in, 0, len, &bp, &out, &outsize);
|
ZopfliDeflatePart(&zo, 2, final, in, 0, len, &bp, &out, &outsize);
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
#![feature(iter_intersperse)]
|
#![feature(iter_intersperse)]
|
||||||
#![feature(try_blocks)]
|
#![feature(try_blocks)]
|
||||||
|
|
||||||
|
pub use libz_rs_sys::*;
|
||||||
pub use base;
|
pub use base;
|
||||||
use cpio::cpio_commands;
|
use cpio::cpio_commands;
|
||||||
use dtb::dtb_commands;
|
use dtb::dtb_commands;
|
||||||
|
27
native/src/external/Android.mk
vendored
27
native/src/external/Android.mk
vendored
@ -233,33 +233,6 @@ LOCAL_SRC_FILES := \
|
|||||||
lsplt/lsplt/src/main/jni/lsplt.cc
|
lsplt/lsplt/src/main/jni/lsplt.cc
|
||||||
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 -Wno-deprecated-non-prototype
|
|
||||||
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)
|
|
||||||
|
|
||||||
# libzopfli.a
|
# libzopfli.a
|
||||||
include $(CLEAR_VARS)
|
include $(CLEAR_VARS)
|
||||||
LOCAL_MODULE:= libzopfli
|
LOCAL_MODULE:= libzopfli
|
||||||
|
1
native/src/external/zlib
vendored
1
native/src/external/zlib
vendored
@ -1 +0,0 @@
|
|||||||
Subproject commit 3a0aa2b3df38ad6298f91c4d8afef708bb4f088e
|
|
Loading…
x
Reference in New Issue
Block a user