Skip to content

Commit

Permalink
Update zsync2 (#1038)
Browse files Browse the repository at this point in the history
* Update zsync2 & FBInk for live status printing
* Rebase against zlib 1.2.11
* Workaround the actual issue that made us switch to zsync2 in the first place (which just happened to be masked by zsync2's range requests optimization). (Spoiler alert: ugly hack inside).
* Also fixes a dodgy EoF check in the process.
* Squish some more warnings
* Plug a bunch of memory leaks
* Update FBInk to allow it to more easily digest zsync2's output so we can print the output live.
* Update zsync2's logging to play nice w/ said FBInk hack :D.
  • Loading branch information
NiLuJe committed Feb 9, 2020
1 parent 0b0b8a7 commit 84f56d3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1,868 deletions.
6 changes: 3 additions & 3 deletions thirdparty/fbink/CMakeLists.txt
Expand Up @@ -30,8 +30,8 @@ else()
set(FBINK_TARGET "strip")
endif()

# Minimal, statically linked build, we don't care about extra fonts or image support
set(BUILD_CMD1 sh -c "${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} MINIMAL=1 OPENTYPE=1 CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ${FBINK_TARGET}")
# Minimal-ish, statically linked build, we don't care about image support
set(BUILD_CMD1 sh -c "${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} MINIMAL=1 FONTS=1 OPENTYPE=1 CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ${FBINK_TARGET}")
if(UTILS_TARGET)
set(BUILD_CMD2 sh -c "${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS} CFLAGS=\"${CFLAGS}\" LDFLAGS=\"${LDFLAGS}\" ${UTILS_TARGET}")
endif()
Expand All @@ -52,7 +52,7 @@ endif()
ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://github.com/NiLuJe/FBInk.git
tags/v1.21.0
e834ef69252189a90b78c1c927ac13cfb7c8d5aa
${SOURCE_DIR}
)

Expand Down
17 changes: 10 additions & 7 deletions thirdparty/zsync2/CMakeLists.txt
Expand Up @@ -46,35 +46,38 @@ list(APPEND CMAKE_ARGS "-DCURL_LIBRARY=curl")
list(APPEND CMAKE_ARGS "-DCURL_LIBRARIES=curl")
#list(APPEND CMAKE_ARGS "-DCURL_INCLUDE_DIRS=${CURL_DIR}/include")

# A few CLI cleanup:
# NOTE: We're currently using our own fork instead of upstream's (https://github.com/AppImage/zsync2):
## * Enable range requests optimizations on the CLI
## * Re-implement the -u flag for compatibility w/ the old zsync CLI
## * Minor CLI output cleanup
## * Squish all the warnings
## * Prevent passing a malformed referer URL
## * Don't print seven billion progress bars
## * Rebase against zsync master (c.f., rebase-zsync-libs branch)
# c.f., https://github.com/NiLuJe/zsync2
set(PATCH_CMD1 "${KO_PATCH} ${CMAKE_CURRENT_SOURCE_DIR}/zsync2-koreader-patchset-v9.patch")
## * Rebase against zlib 1.2.11 (c.f., rebase-zlib branch)
## * Workaround potential download loops, like what happened w/ the 2019.12 -> 2020.01 update.
## * Mangle logging to play nice w/ FBInk
## * Plug memory leaks
# c.f., https://github.com/NiLuJe/zsync2 for more details.

# Workaround various issues related to PocketBook's old TC using an awfully old GCC version
# Inspired by https://github.com/nlohmann/json/issues/136
if(DEFINED ENV{POCKETBOOK})
set(PATCH_CMD2 "${KO_PATCH} ${CMAKE_CURRENT_SOURCE_DIR}/zsync2-pocketbook-old-gcc.diff")
set(PATCH_CMD "${KO_PATCH} ${CMAKE_CURRENT_SOURCE_DIR}/zsync2-pocketbook-old-gcc.diff")
endif()

ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME
https://github.com/AppImage/zsync2.git
f41aed234cd790b5d78e420e3fbeb818f8667f58
https://github.com/NiLuJe/zsync2.git
7565c081d581706c6a7859cf41eec976811180b6
${SOURCE_DIR}
)

include(ExternalProject)
ExternalProject_Add(
zsync2
DOWNLOAD_COMMAND ${CMAKE_COMMAND} -P ${GIT_CLONE_SCRIPT_FILENAME}
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2}
PATCH_COMMAND COMMAND ${PATCH_CMD}
CMAKE_ARGS "${CMAKE_ARGS}"
CMAKE_GENERATOR "Unix Makefiles"
BUILD_COMMAND ${KO_MAKE_RECURSIVE} -j${PARALLEL_JOBS}
Expand Down

0 comments on commit 84f56d3

Please sign in to comment.