Skip to content

Commit 33f3517

Browse files
committed
recode makefile; add _IS_NEED_decompressor_ldef_replace_zlib;
1 parent 0d09620 commit 33f3517

File tree

5 files changed

+40
-33
lines changed

5 files changed

+40
-33
lines changed

CHANGELOG.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22

33
full changelog at: https://github.com/sisong/HDiffPatch/commits
44

5-
## [v4.8.0](https://github.com/sisong/HDiffPatch/tree/v4.8.0) - 2024-07-25
5+
## [v4.8.0](https://github.com/sisong/HDiffPatch/tree/v4.8.0) - 2024-07-26
66
### Added
7-
* cmdline hdiffz support option "-c-ldef-{1..12}", used libdeflate compressor; compatible with -c-zlib, faster or better than zlib;
7+
* cmdline hdiffz support option "-c-ldef-{1..12}"; used libdeflate compressor, compatible with -c-zlib, faster or better than zlib;
88
(hpatchz now default closed libdeflate decompressor)
99
* add plugin ldefCompressPlugin, pldefCompressPlugin, ldefDecompressPlugin;
1010
### Changed
@@ -62,7 +62,7 @@ if diffFile created by empty oldPath, then extract with default option `$selfExt
6262

6363
## [v4.3.0](https://github.com/sisong/HDiffPatch/tree/v4.3.0) - 2022-09-23
6464
### Changed
65-
* recode some patch error code: decompresser errors, file error, disk space full error, jni error
65+
* recode some patch error code: decompressor errors, file error, disk space full error, jni error
6666

6767
## [v4.2.0](https://github.com/sisong/HDiffPatch/tree/v4.2.0) - 2022-05-15
6868
### Added

Makefile

+13-9
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,12 @@ else
1111
endif
1212
# 0: not need lzma; 1: compile lzma source code; 2: used -llzma to link lzma lib;
1313
LZMA := 1
14+
# lzma decompressor used arm64 asm optimize?
1415
ARM64ASM := 0
15-
RISCV32 := 0
16+
# lzma only can used software CRC? (no hardware CRC)
17+
USE_CRC_EMU := 0
18+
# supported atomic uint64?
19+
ATOMIC_U64 := 1
1620
# 0: not need zstd; 1: compile zstd source code; 2: used -lzstd to link zstd lib;
1721
ZSTD := 1
1822
MD5 := 1
@@ -23,9 +27,9 @@ CL := 0
2327
M32 := 0
2428
# build for out min size
2529
MINS := 0
26-
# support VCDIFF?
30+
# need support VCDIFF?
2731
VCD := 1
28-
# support bsdiff&bspatch?
32+
# need support bsdiff&bspatch?
2933
BSD := 1
3034
ifeq ($(OS),Windows_NT) # mingw?
3135
CC := gcc
@@ -44,7 +48,7 @@ endif
4448
ifeq ($(LDEF),0)
4549
else
4650
ifeq ($(ZLIB),2)
47-
$(error error: libdeflate not support -lz! need zlib source code, set ZLIB=1 continue)
51+
$(error error: now libdeflate decompressor not support -lz! need zlib source code, set ZLIB=1 continue)
4852
else
4953
ifeq ($(ZLIB),0)
5054
$(warning warning: libdeflate can't support all of the deflate code, when no zlib source code)
@@ -238,8 +242,7 @@ DEF_FLAGS := \
238242
-D_IS_NEED_DEFAULT_CompressPlugin=0 \
239243
-D_IS_NEED_ALL_ChecksumPlugin=0 \
240244
-D_IS_NEED_DEFAULT_ChecksumPlugin=0
241-
ifeq ($(RISCV32),0)
242-
else
245+
ifeq ($(ATOMIC_U64),0)
243246
DEF_FLAGS += -D_IS_NO_ATOMIC_U64=1
244247
endif
245248
ifeq ($(M32),0)
@@ -321,9 +324,10 @@ else
321324
else
322325
DEF_FLAGS += -DZ7_LZMA_DEC_OPT
323326
endif
324-
ifeq ($(VCD),0)
325-
else
326-
DEF_FLAGS += -DUSE_CRC_EMU
327+
ifneq ($(VCD),0)
328+
ifneq ($(USE_CRC_EMU),0)
329+
DEF_FLAGS += -DUSE_CRC_EMU
330+
endif
327331
endif
328332
endif
329333
endif

builds/xcode_iOS_hpatchz/hpatchz.xcodeproj/project.pbxproj

+2-4
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,6 @@
510510
GCC_PREPROCESSOR_DEFINITIONS = (
511511
"DEBUG=1",
512512
Z7_ST,
513-
USE_CRC_EMU,
514513
ZSTD_STATIC_LINKING_ONLY,
515514
"ZSTD_HAVE_WEAK_SYMBOLS=0",
516515
"ZSTD_TRACE=0",
@@ -591,7 +590,6 @@
591590
GCC_PREPROCESSOR_DEFINITIONS = (
592591
NDEBUG,
593592
Z7_ST,
594-
USE_CRC_EMU,
595593
ZSTD_STATIC_LINKING_ONLY,
596594
"ZSTD_HAVE_WEAK_SYMBOLS=0",
597595
"ZSTD_TRACE=0",
@@ -657,7 +655,6 @@
657655
GCC_PREPROCESSOR_DEFINITIONS = (
658656
"DEBUG=1",
659657
Z7_ST,
660-
USE_CRC_EMU,
661658
ZSTD_STATIC_LINKING_ONLY,
662659
"ZSTD_HAVE_WEAK_SYMBOLS=0",
663660
"ZSTD_TRACE=0",
@@ -672,6 +669,7 @@
672669
_CompressPlugin_zstd,
673670
_CompressPlugn_7zXZ,
674671
Z7_LZMA_DEC_OPT,
672+
USE_CRC_EMU,
675673
"$(inherited)",
676674
);
677675
OTHER_LDFLAGS = "-ObjC";
@@ -688,7 +686,6 @@
688686
GCC_PREPROCESSOR_DEFINITIONS = (
689687
NDEBUG,
690688
Z7_ST,
691-
USE_CRC_EMU,
692689
ZSTD_STATIC_LINKING_ONLY,
693690
"ZSTD_HAVE_WEAK_SYMBOLS=0",
694691
"ZSTD_TRACE=0",
@@ -703,6 +700,7 @@
703700
_CompressPlugin_zstd,
704701
_CompressPlugn_7zXZ,
705702
Z7_LZMA_DEC_OPT,
703+
USE_CRC_EMU,
706704
);
707705
ONLY_ACTIVE_ARCH = YES;
708706
OTHER_LDFLAGS = "-ObjC";

hdiffz.cpp

+10-9
Original file line numberDiff line numberDiff line change
@@ -66,27 +66,30 @@
6666
#if (_IS_NEED_DEFAULT_CompressPlugin)
6767
//===== select needs decompress plugins or change to your plugin=====
6868
# define _CompressPlugin_zlib // memory requires less
69-
# define _CompressPlugin_ldef // faster or better compress than zlib / (now used ldef+zlib decompresser)
69+
# define _CompressPlugin_ldef // faster or better compress than zlib / (now used ldef+zlib decompressor)
7070
# define _CompressPlugin_bz2
7171
# define _CompressPlugin_lzma // better compresser
7272
# define _CompressPlugin_lzma2 // better compresser
73-
# define _CompressPlugin_zstd // better compresser / faster decompresser
73+
# define _CompressPlugin_zstd // better compresser / faster decompressor
7474
#if (_IS_NEED_VCDIFF)
7575
# define _CompressPlugin_7zXZ //only for VCDIFF, used lzma2
7676
#endif
7777

7878
#endif
7979
#if (_IS_NEED_ALL_CompressPlugin)
8080
//===== select needs decompress plugins or change to your plugin=====
81-
# define _CompressPlugin_lz4 // faster compresser / faster decompresser
82-
# define _CompressPlugin_lz4hc // compress slower & better than lz4 / (used lz4 decompresser)
83-
# define _CompressPlugin_brotli// better compresser / faster decompresser
81+
# define _CompressPlugin_lz4 // faster compresser / faster decompressor
82+
# define _CompressPlugin_lz4hc // compress slower & better than lz4 / (used lz4 decompressor)
83+
# define _CompressPlugin_brotli// better compresser / faster decompressor
8484
# define _CompressPlugin_lzham // better compresser / decompress faster than lzma2
8585
# define _CompressPlugin_tuz // slower compresser / decompress requires tiny code(.text) & ram
8686
#endif
8787
#ifdef _CompressPlugin_ldef
8888
# ifndef _CompressPlugin_ldef_is_use_zlib
89-
# define _CompressPlugin_ldef_is_use_zlib 1 //now ldef need zlib decompresser
89+
# define _CompressPlugin_ldef_is_use_zlib 1 //now ldef need zlib decompressor for any all of deflate code
90+
# endif
91+
# ifndef _IS_NEED_decompressor_ldef_replace_zlib
92+
# define _IS_NEED_decompressor_ldef_replace_zlib 0
9093
# endif
9194
#endif
9295

@@ -517,9 +520,7 @@ static hpatch_BOOL _getIsVcDiffFile(const char* diffFileName) {
517520
#define _try_rt_dec(dec) { if (dec.is_can_open(compressType)) return &dec; }
518521

519522
static hpatch_TDecompress* __find_decompressPlugin(const char* compressType){
520-
#if (0) //now closed ldef decompressor// ((defined(_CompressPlugin_ldef))&&_CompressPlugin_ldef_is_use_zlib)
521-
//NOTE: if _CompressPlugin_ldef_is_use_zlib==0, ldefDecompressPlugin can't support all of deflate encoding, only support for (p)ldefCompressPlugin!
522-
// if _CompressPlugin_ldef_is_use_zlib==1, ldefDecompressPlugin can support all of deflate encoding by zlib decompressor.
523+
#if ((defined(_CompressPlugin_ldef))&&_IS_NEED_decompressor_ldef_replace_zlib)
523524
_try_rt_dec(ldefDecompressPlugin);
524525
#else
525526
# ifdef _CompressPlugin_zlib

hpatchz.c

+12-8
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,14 @@
7878
#endif
7979
#if (_IS_NEED_DEFAULT_CompressPlugin)
8080
//===== select needs decompress plugins or change to your plugin=====
81-
# define _CompressPlugin_zlib
82-
//# define _CompressPlugin_ldef
81+
# ifndef _IS_NEED_decompressor_ldef_replace_zlib
82+
# define _IS_NEED_decompressor_ldef_replace_zlib 0
83+
# endif
84+
# if (_IS_NEED_decompressor_ldef_replace_zlib)
85+
# define _CompressPlugin_ldef //optimized zlib&ldef's deflate code decompress speed by libdeflate
86+
# else
87+
# define _CompressPlugin_zlib
88+
# endif
8389
# define _CompressPlugin_bz2
8490
# define _CompressPlugin_lzma
8591
# define _CompressPlugin_lzma2
@@ -97,10 +103,10 @@
97103
#endif
98104
#ifdef _CompressPlugin_ldef
99105
# ifndef _CompressPlugin_ldef_is_use_zlib
100-
# define _CompressPlugin_ldef_is_use_zlib 1 //now ldef need zlib decompresser
106+
# define _CompressPlugin_ldef_is_use_zlib 1 //now ldef need zlib decompressor for any all of deflate code
101107
# endif
102-
# if ((defined(_CompressPlugin_zlib))&&_CompressPlugin_ldef_is_use_zlib)
103-
# //undef _CompressPlugin_zlib
108+
# if (_IS_NEED_decompressor_ldef_replace_zlib&&(defined(_CompressPlugin_zlib)))
109+
# undef _CompressPlugin_zlib
104110
# endif
105111
#endif
106112

@@ -790,9 +796,7 @@ int hpatch_cmd_line(int argc, const char * argv[]){
790796
#define _try_rt_dec(dec) { if (dec.is_can_open(compressType)) return &dec; }
791797

792798
static const hpatch_TDecompress* __find_decompressPlugin(const char* compressType){
793-
#if (0) //now closed ldef decompressor// ((defined(_CompressPlugin_ldef))&&_CompressPlugin_ldef_is_use_zlib)
794-
//NOTE: if _CompressPlugin_ldef_is_use_zlib==0, ldefDecompressPlugin can't support all of deflate encoding, only support for (p)ldefCompressPlugin!
795-
// if _CompressPlugin_ldef_is_use_zlib==1, ldefDecompressPlugin can support all of deflate encoding by zlib decompressor.
799+
#if ((defined(_CompressPlugin_ldef))&&_IS_NEED_decompressor_ldef_replace_zlib)
796800
_try_rt_dec(ldefDecompressPlugin);
797801
#else
798802
# ifdef _CompressPlugin_zlib

0 commit comments

Comments
 (0)