Skip to content

Commit

Permalink
udate version; makefile & xcode & codeblocks ok;
Browse files Browse the repository at this point in the history
  • Loading branch information
housisong committed May 26, 2024
1 parent fe56cc8 commit 569a2e6
Show file tree
Hide file tree
Showing 16 changed files with 157 additions and 28 deletions.
42 changes: 39 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
DIR_DIFF := 1
MT := 1
ZLIB := 1
LDEF := 1
ZSTD := 1
HTTPS := 1

Expand All @@ -13,6 +14,9 @@ M32 := 0
# build for out min size
MINS := 0

LDEF_ARM := 0
LDEF_RISCV:= 0

HDP_OBJ := \
HDiffPatch/file_for_patch.o \
HDiffPatch/libHDiffPatch/HPatch/patch.o \
Expand Down Expand Up @@ -56,18 +60,43 @@ else
HDiffPatch/libhsync/sync_make/dir_sync_make.o
endif

LDEF_PATH := libdeflate
ifeq ($(LDEF),0)
else
# https://github.com/sisong/libdeflate
LDEF_OBJ := $(LDEF_PATH)/lib/crc32.o \
$(LDEF_PATH)/lib/deflate_decompress.o \
$(LDEF_PATH)/lib/utils.o
ifeq ($(LDEF_ARM),0)
ifeq ($(LDEF_RISCV),0)
LDEF_OBJ += $(LDEF_PATH)/lib/x86/cpu_features.o
else
endif
else
LDEF_OBJ += $(LDEF_PATH)/lib/arm/cpu_features.o
endif

CLIENT_OBJ += $(LDEF_OBJ)
MAKE_OBJ += $(LDEF_PATH)/lib/deflate_compress.o
endif

ZLIB_PATH := zlib
ifeq ($(ZLIB),0)
else # http:https://zlib.net https://github.com/sisong/zlib
CLIENT_OBJ += $(ZLIB_PATH)/adler32.o \
else
# http:https://zlib.net https://github.com/sisong/zlib
_ZLIB_OBJ := $(ZLIB_PATH)/adler32.o \
$(ZLIB_PATH)/crc32.o \
$(ZLIB_PATH)/inffast.o \
$(ZLIB_PATH)/inflate.o \
$(ZLIB_PATH)/inftrees.o \
$(ZLIB_PATH)/trees.o \
$(ZLIB_PATH)/zutil.o
MAKE_OBJ += $(ZLIB_PATH)/deflate.o
ifeq ($(LDEF),0)
CLIENT_OBJ += $(_ZLIB_OBJ)
else
MAKE_OBJ += $(_ZLIB_OBJ)
endif
MAKE_OBJ += $(ZLIB_PATH)/deflate.o
endif

ZSTD_PATH := zstd/lib
Expand Down Expand Up @@ -156,6 +185,13 @@ else
DEF_FLAGS += -D_CompressPlugin_zlib -I$(ZLIB_PATH)
DEF_FLAGS += -D_ChecksumPlugin_crc32
endif
ifeq ($(LDEF),0)
else
DEF_FLAGS += -D_CompressPlugin_ldef -I$(LDEF_PATH)
ifeq ($(ZLIB),0)
DEF_FLAGS += -D_ChecksumPlugin_crc32
endif
endif
ifeq ($(ZSTD),0)
else
DEF_FLAGS += -D_CompressPlugin_zstd
Expand Down
14 changes: 10 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [hsynz](https://github.com/sisong/hsynz)
[![release](https://img.shields.io/badge/release-v1.0.2-blue.svg)](https://github.com/sisong/hsynz/releases)
[![release](https://img.shields.io/badge/release-v1.1.0-blue.svg)](https://github.com/sisong/hsynz/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/hsynz/blob/main/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/hsynz/pulls)
[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/hsynz?color=green&label=%2Bissue%20welcome)](https://github.com/sisong/hsynz/issues)
Expand All @@ -9,7 +9,7 @@
english | [中文版](README_cn.md)

hsynz is a library for delta update using sync algorithm, like [zsync](http:https://zsync.moria.org.uk).
rsync over http(s); implement the sync algorithm on client side, and server side only need http(s) cdn. support compressor zstd & zlib, support large file & directory(folder), support muti-thread.
rsync over http(s); implement the sync algorithm on client side, and server side only need http(s) cdn. support compressor zstd & libdeflate & zlib, support large file & directory(folder), support muti-thread.


Recommended scenarios: Very large number of older versions or where older versions are not available (not saved or modified, etc.) so that all deltas cannot be calculated in advance.
Expand All @@ -28,7 +28,7 @@ Tip: You can also customise other communication methods for sync.
---
## Compare with [zsync](http:https://zsync.moria.org.uk)
* In addition to supporting source and target as files, support is also provided for directories(folders).
* In addition to supporting compressed release package by zlib; also supported zstd compressor, providing better compression ratio, i.e. smaller downloaded patch package.
* In addition to supporting compressed release package by zlib; also supported libdeflate & zstd compressor, providing better compression ratio, i.e. smaller downloaded patch package.
* The server-side make support multi-threaded parallel acceleration.
* The client-side diff speed has been optimized, and also support multi-threaded parallel acceleration.

Expand Down Expand Up @@ -82,7 +82,13 @@ options:
dictBits can 9--15, DEFAULT 15.
-c-gzip[-{1..9}[-dictBits]] DEFAULT level 9
dictBits can 9--15, DEFAULT 15.
compress by zlib, but out_hsynz_file is .gz file format.
compress by zlib, out_hsynz_file is .gz file format.
-c-ldef[-{1..12}[-dictBits]] DEFAULT level 12
dictBits can 9--15, DEFAULT 15.
compress by libdeflate, compatible with zlib's deflate encoding.
-c-lgzip[-{1..12}[-dictBits]] DEFAULT level 12
dictBits can 9--15, DEFAULT 15.
compress by libdeflate, out_hsynz_file is .gz file format.
-c-zstd[-{10..22}[-dictBits]] DEFAULT level 21
dictBits can 15--30, DEFAULT 24.
-C-checksumType
Expand Down
20 changes: 13 additions & 7 deletions README_cn.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# [hsynz](https://github.com/sisong/hsynz)
[![release](https://img.shields.io/badge/release-v1.0.2-blue.svg)](https://github.com/sisong/hsynz/releases)
[![release](https://img.shields.io/badge/release-v1.1.0-blue.svg)](https://github.com/sisong/hsynz/releases)
[![license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/sisong/hsynz/blob/main/LICENSE)
[![PRs Welcome](https://img.shields.io/badge/PRs-welcome-blue.svg)](https://github.com/sisong/hsynz/pulls)
[![+issue Welcome](https://img.shields.io/github/issues-raw/sisong/hsynz?color=green&label=%2Bissue%20welcome)](https://github.com/sisong/hsynz/issues)
Expand All @@ -9,7 +9,7 @@
中文版 | [english](README.md)

hsynz 是一个用使用同步算法来进行增量更新的库,类似于 [zsync](http:https://zsync.moria.org.uk)
通过http(s)实现rsync;在客户端实现同步算法,服务器端只需要提供http(s)的CDN。支持zstd和zlib压缩,支持大文件和目录(文件夹),支持多线程。
通过http(s)实现rsync;在客户端实现同步算法,服务器端只需要提供http(s)的CDN。支持zstd、libdeflate和zlib压缩,支持大文件和目录(文件夹),支持多线程。


适用的场景:旧版本数量非常多 或者 无法得到旧版本(没有保存或被修改等) 从而无法提前计算出全部的增量补丁,这时推荐使用hsynz同步分发技术。
Expand All @@ -28,7 +28,7 @@ hsync_http提供了一个支持http(s)的下载客户端demo,支持从提供ht
---
## 特性和 [zsync](http:https://zsync.moria.org.uk) 对比
* 除了支持源和目标为文件,还为文件夹(目录)提供了支持。
* 除了支持zlib压缩发布包;还支持zstd压缩,提供更好的压缩率,即下载的补丁包更小。
* 除了支持zlib压缩发布包;还支持libdeflate和zstd压缩,提供更好的压缩率,即下载的补丁包更小。
* 服务端make时提供了多线程并行加速的支持。
* 对客户端的diff速度进行了优化,并且提供了多线程并行加速的支持。

Expand Down Expand Up @@ -83,8 +83,14 @@ hsync_make: [options] newDataPath out_hsyni_file [out_hsynz_file]
压缩字典比特数dictBits可以为9到15, 默认为15。
-c-gzip[-{1..9}[-dictBits]] 默认级别 9
压缩字典比特数dictBits可以为9到15, 默认为15。
也同样使用zlib算法来压缩, 但out_hsynz_file输出文件将是一个标准的.gz格式文件。
使用zlib算法来压缩, out_hsynz_file输出文件将是一个标准的.gz格式文件。
(会比 -c-zlib 生成的文件稍大一点)
-c-ldef[-{1..12}[-dictBits]] 默认级别 12
压缩字典比特数dictBits可以为9到15, 默认为15。
使用libdeflate算法来压缩, 兼容zlib的deflate编码。
-c-lgzip[-{1..12}[-dictBits]] 默认级别 12
压缩字典比特数dictBits可以为9到15, 默认为15。
使用libdeflate算法来压缩, out_hsynz_file输出文件将是一个标准的.gz格式文件。
-c-zstd[-{10..22}[-dictBits]] 默认级别 21
压缩字典比特数dictBits 可以为15到30, 默认为24。
-C-checksumType
Expand Down Expand Up @@ -205,11 +211,11 @@ hsync_make: [options] newDataPath out_hsyni_file [out_hsynz_file]
客户端同步 diff&patch 时参数 `hsync_demo {old} {newi} {newz} {out_new}` (所有文件都在本地)
**hsynz p1** 运行 make 时没有压缩器,也没有压缩文件out_newz输出, 添加了参数 `-p-1`
**hsynz p8** 运行 make 时没有压缩器,也没有压缩文件out_newz输出, 添加了参数 `-p-8`
**hsynz p1 -zlib** 运行 make 时添加 `-p-1 -c-zlib-9` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p1 -zlib** 运行 make 时添加 `-p-1 -c-zlib-9` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p8 -zlib** 运行 make 时添加 `-p-8 -c-zlib-9` (运行 `hsync_demo` 时添加 `-p-8`)
**hsynz p1 -gzip** 运行 make 时添加 `-p-1 -c-gzip-9` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p1 -gzip** 运行 make 时添加 `-p-1 -c-gzip-9` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p8 -gzip** 运行 make 时添加 `-p-8 -c-gzip-9` (运行 `hsync_demo` 时添加 `-p-8`)
**hsynz p1 -zstd** 运行 make 时添加 `-p-1 -c-zstd-21-24` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p1 -zstd** 运行 make 时添加 `-p-1 -c-zstd-21-24` (运行 `hsync_demo` 时添加 `-p-1`)
**hsynz p8 -zstd** 运行 make 时添加 `-p-8 -c-zstd-21-24` (运行 `hsync_demo` 时添加 `-p-8`)

**测试平均结果**:
Expand Down
1 change: 1 addition & 0 deletions builds/codeblocks/hsync_demo.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
<Add option="-D_IS_USED_PTHREAD=1" />
<Add directory="../../xxHash/" />
<Add directory="../../minihttp/mbedtls/include" />
<Add directory="../../libdeflate" />
</Compiler>
<Linker>
<Add library="pthread" />
Expand Down
1 change: 1 addition & 0 deletions builds/codeblocks/hsync_http.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
<Add directory="../../xxHash/" />
<Add directory="../../minihttp/mbedtls/include" />
<Add directory="../../minihttp" />
<Add directory="../../libdeflate" />
</Compiler>
<Linker>
<Add library="pthread" />
Expand Down
4 changes: 4 additions & 0 deletions builds/codeblocks/hsync_make.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@
<Add directory="../../zstd/lib/compress" />
<Add directory="../../zstd/lib/decompress" />
<Add directory="../../zstd/lib/" />
<Add directory="../../libdeflate" />
</Compiler>
<Linker>
<Add library="pthread" />
Expand All @@ -83,6 +84,9 @@
<Unit filename="../../client_download_demo.cpp" />
<Unit filename="../../hsync_import_patch.cpp" />
<Unit filename="../../hsync_make.cpp" />
<Unit filename="../../libdeflate/lib/deflate_compress.c">
<Option compilerVar="CC" />
</Unit>
<Extensions>
<envvars />
<code_completion />
Expand Down
15 changes: 15 additions & 0 deletions builds/codeblocks/libHSyncClient.cbp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,21 @@
<Unit filename="../../HDiffPatch/libhsync/sync_client/sync_client.cpp" />
<Unit filename="../../HDiffPatch/libhsync/sync_client/sync_diff_data.cpp" />
<Unit filename="../../HDiffPatch/libhsync/sync_client/sync_info_client.cpp" />
<Unit filename="../../libdeflate/lib/crc32.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../libdeflate/lib/deflate_decompress.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../libdeflate/lib/utils.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../libdeflate/lib/x86/cpu_features.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../libdeflate/lib/zlib_decompress.c">
<Option compilerVar="CC" />
</Unit>
<Unit filename="../../minihttp/mbedtls/library/aes.c">
<Option compilerVar="CC" />
</Unit>
Expand Down
5 changes: 0 additions & 5 deletions builds/vc/libdeflate.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,11 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\..\libdeflate\lib\adler32.c" />
<ClCompile Include="..\..\libdeflate\lib\crc32.c" />
<ClCompile Include="..\..\libdeflate\lib\deflate_compress.c" />
<ClCompile Include="..\..\libdeflate\lib\deflate_decompress.c" />
<ClCompile Include="..\..\libdeflate\lib\gzip_compress.c" />
<ClCompile Include="..\..\libdeflate\lib\gzip_decompress.c" />
<ClCompile Include="..\..\libdeflate\lib\utils.c" />
<ClCompile Include="..\..\libdeflate\lib\x86\cpu_features.c" />
<ClCompile Include="..\..\libdeflate\lib\zlib_compress.c" />
<ClCompile Include="..\..\libdeflate\lib\zlib_decompress.c" />
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>17.0</VCProjectVersion>
Expand Down
9 changes: 8 additions & 1 deletion builds/xcode/hsync_demo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
D65892F02331D169003BB2F4 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 1030;
LastUpgradeCheck = 1310;
ORGANIZATIONNAME = sisong;
TargetAttributes = {
D65892F72331D169003BB2F4 = {
Expand All @@ -115,6 +115,7 @@
hasScannedForEncodings = 0;
knownRegions = (
en,
Base,
);
mainGroup = D65892EF2331D169003BB2F4;
productRefGroup = D65892F92331D169003BB2F4 /* Products */;
Expand Down Expand Up @@ -164,6 +165,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -194,6 +196,7 @@
../../zlib,
../../minihttp/mbedtls/include,
../../xxHash,
../../libdeflate,
);
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE;
Expand Down Expand Up @@ -228,6 +231,7 @@
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
Expand Down Expand Up @@ -257,6 +261,7 @@
../../zlib,
../../minihttp/mbedtls/include,
../../xxHash,
../../libdeflate,
);
MACOSX_DEPLOYMENT_TARGET = 10.9;
MTL_ENABLE_DEBUG_INFO = NO;
Expand All @@ -268,6 +273,7 @@
D65893002331D169003BB2F4 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand All @@ -276,6 +282,7 @@
D65893012331D169003BB2F4 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CODE_SIGN_IDENTITY = "-";
CODE_SIGN_STYLE = Automatic;
PRODUCT_NAME = "$(TARGET_NAME)";
};
Expand Down
Loading

0 comments on commit 569a2e6

Please sign in to comment.