koreader: 2023.10 -> 2024.01

This commit is contained in:
Colin 2024-02-04 02:51:27 +00:00
parent 4bd73ddca3
commit 4a96fa233a
5 changed files with 56 additions and 67 deletions

View File

@ -38,14 +38,14 @@
}:
let
sources = callPackage ./sources.nix { luajit = luajit52; };
version = "2023.10";
version = "2024.01";
src = fetchFromGitHub {
owner = "koreader";
repo = "koreader";
name = "koreader"; # needed because `srcs = ` in the outer derivation is a list
fetchSubmodules = true;
rev = "v${version}";
hash = "sha256-J8WNSkhPO0Y+m/h246w1GpowOVROOHVbmuDHFAniItk=";
hash = "sha256-0ftpMnu3vMwEj2cyzn01E1lCHpE3HtnjyytH3BuRBcU=";
};
# XXX: for some inscrutable reason, `enable52Compat` is *partially* broken, only when cross compiling.
# `table.unpack` is non-nil, but `table.pack` is nil.
@ -121,7 +121,7 @@ stdenv.mkDerivation rec {
patches = [
./debug.patch #< not needed to build, just helps debug packaging issues
./no_rm_build_dirs.patch
./lua-Spore-no-luajson.patch #< TODO: test this at runtime! we ship luajson, but just don't expose it via luarocks...
./lua-Spore-no-luajson.patch #< TODO: test this at runtime! we ship luajson, but just don't expose it via luarocks
(substituteAll (
{
src = ./vendor-external-projects.patch;

View File

@ -2,12 +2,11 @@ diff --git a/base/thirdparty/lua-Spore/CMakeLists.txt b/base/thirdparty/lua-Spor
index 15593193..31140257 100644
--- a/base/thirdparty/lua-Spore/CMakeLists.txt
+++ b/base/thirdparty/lua-Spore/CMakeLists.txt
@@ -29,7 +29,7 @@ set(BUILD_CMD ${ROCKS_CMD} make --tree=${OUTPUT_DIR}/rocks ${LUA_SPORE_ROCKSPEC}
set(BUILD_CMD ${BUILD_CMD} "CC=${CC}" "CFLAGS=${CFLAGS}" "LD=${LD}")
set(BUILD_CMD ${BUILD_CMD} "LUA_INCDIR=${LUA_INCDIR}" "LUA_LIBDIR=${LUA_LIBDIR}")
@@ -26,6 +26,7 @@ list(APPEND BUILD_CMD COMMAND ${ROCKS_CMD} make --tree=${OUTPUT_DIR}/rocks ${LUA_SPORE_ROCKSPEC})
list(APPEND BUILD_CMD "LUA_INCDIR=${LUA_INCDIR}" "LUA_LIBDIR=${LUA_LIBDIR}")
-set(PATCH_CMD sh -c "mkdir -p doc && ${ISED} \"s| 'luasocket|--'luasocket|g\" ${LUA_SPORE_ROCKSPEC}")
+set(PATCH_CMD sh -c "mkdir -p doc && ${ISED} \"s| 'luajson|--'luajson|g\" ${LUA_SPORE_ROCKSPEC} && ${ISED} \"s| 'luasocket|--'luasocket|g\" ${LUA_SPORE_ROCKSPEC}")
list(APPEND PATCH_CMD COMMAND mkdir -p doc)
+list(APPEND PATCH_CMD COMMAND ${ISED} "s| 'luajson|--&|g" ${LUA_SPORE_ROCKSPEC})
list(APPEND PATCH_CMD COMMAND ${ISED} "s| 'luasocket|--&|g" ${LUA_SPORE_ROCKSPEC})
ko_write_gitclone_script(
GIT_CLONE_SCRIPT_FILENAME

View File

@ -2,10 +2,10 @@ diff --git a/base/Makefile.third b/base/Makefile.third
index f6a80523..1080ab98 100644
--- a/base/Makefile.third
+++ b/base/Makefile.third
@@ -137,7 +137,6 @@ $(MUPDF_LIB) $(MUPDF_DIR)/include: $(JPEG_LIB) \
$(HARFBUZZ_LIB) $(HARFBUZZ_DIR)/include \
$(LIBWEBP_LIB) $(LIBWEBP_DIR)/include \
$(ZLIB) $(AES_LIB) $(THIRDPARTY_DIR)/mupdf/*.*
@@ -138,7 +138,6 @@ $(MUPDF_LIB): $(JPEG_LIB) \
$(LIBWEBP_LIB) \
$(ZLIB) $(AES_LIB) \
$(THIRDPARTY_DIR)/mupdf/*.*
- -rm -rf $(MUPDF_BUILD_DIR)
install -d $(MUPDF_BUILD_DIR)
cd $(MUPDF_BUILD_DIR) && \

View File

@ -39,13 +39,15 @@
, luajit
, minizip
, mupdf
, mupdf_1_17
, nanosvg
, openssh
, openssl
, openssl_1_1
, sdcv
, tesseract
, turbo
, utf8proc
, zeromq
, zeromq4
, zstd
, zsync
}:
@ -78,7 +80,7 @@ in
source.url = "https://gitlab.com/koreader/djvulibre.git";
source.rev = "6a1e5ba1c9ef81c205a4b270c3f121a1e106f4fc";
source.hash = "sha256-OWSbxdr93FH3ed0D+NSFWIah7VDTcL3LIGOciY+f4dk=";
# package = djvulibre;
# package = djvulibre; # "cp -fL /build/koreader/base/thirdparty/djvulibre/build/aarch64-unknown-linux-gnu/djvulibre-prefix/src/djvulibre/libdjvu/.libs/libdjvulibre.so.21 ..."
};
fbink = {
source.url = "https://github.com/NiLuJe/FBInk.git";
@ -108,12 +110,12 @@ in
source.url = "https://github.com/GNOME/glib.git";
source.rev = "2.58.3";
source.hash = "sha256-KmJXCJ6h2QhPyK1axk+Y9+yJzO0wnCczcogopxGShJc=";
package = libAndDev glib;
# package = libAndDev glib; # breaks sdcv build
};
harfbuzz = {
source.url = "https://github.com/harfbuzz/harfbuzz.git";
source.rev = "8.2.1";
source.hash = "sha256-1JgOXpObptt/IOkYj3Q9K170Yd5DIoBa20eoqY/iY6M=";
source.rev = "8.3.0";
source.hash = "sha256-sO0Kd2wAbMm+Auf7tXsDNal7hqND8iwkb0M/9WWt9sI=";
# package = harfbuzz;
package = libAndDev harfbuzz;
};
@ -131,15 +133,15 @@ in
};
libjpeg-turbo = {
source.url = "https://github.com/libjpeg-turbo/libjpeg-turbo.git";
source.rev = "3.0.0";
source.hash = "sha256-mIeSBP65+rWOCRS/33MPqGUpemBee2qR45CZ6H00Hak=";
source.rev = "3.0.1";
source.hash = "sha256-ofdecix4m0FA9gdyQh7zYn99SYBbH2+a7jfoZlsadoA=";
# package = libAndDev libjpeg_turbo;
};
libk2pdfopt = {
source.url = "https://github.com/koreader/libk2pdfopt.git";
source.rev = "60b82eeecf71d1776951da970fe8cd2cc5735ded";
source.hash = "sha256-9UcDr9e4GZCZ78moRs1ADAt4Xl7z3vR93KDexXEHvhw=";
# package = k2pdfopt; # nixpkgs version is NOT koreader's. koreader probably forked it; nixpkgs uses old, insecure mupdf 1.17.0
source.rev = "09f1e011a618c8ec06b4caa67079682119d2aaa7";
source.hash = "sha256-37sZ46dG6Z1Wk7NrhKAKl5j9r1bN6g01cd5Iyt/2coM=";
# package = k2pdfopt; # nixpkgs k2pdfopt does not compile (broken deps). also, uses old insecure mupdf 1.17 (oh well, koreader is even older)
};
libpng = {
source.url = "https://github.com/glennrp/libpng.git";
@ -163,7 +165,7 @@ in
source.url = "https://github.com/zeromq/libzmq";
source.rev = "883e95b22e0bffffa72312ea1fec76199afbe458";
source.hash = "sha256-R76EREtHsqcoKxKrgT8gfEf9pIWdLTBXvF9cDvjEf3E=";
# package = zeromq; # koreader expects v4, nixpkgs is v5
# package = zeromq4; # despite the name, it's libzmq.so.5 instead of libzmq.so.4
};
lj-wpaclient = {
source.url = "https://github.com/koreader/lj-wpaclient.git";
@ -186,8 +188,8 @@ in
};
luajit = {
source.url = "https://github.com/LuaJIT/LuaJIT";
source.rev = "656ecbcf8f669feb94e0d0ec4b4f59190bcd2e48";
source.hash = "sha256-KPZ1jaU9qu7CUg2eHxBNu2mrHD54+lNOCQB4sb1DPok=";
source.rev = "29b0b282f59ac533313199f4f7be79490b7eee51";
source.hash = "sha256-S57/NR+0hF1KTdn+cbVkJh3MTfklSwtZua1CYKduVlk=";
# package = luajit; #< could be fixed; follows a different install structure
};
lua-rapidjson = {
@ -236,6 +238,7 @@ in
source.rev = "tags/1.13.0";
source.hash = "sha256-pQejRon9fO9A1mhz3oLjBr1j4HveDLcQIWjR1/Rpy5Q=";
# package = libAndDev mupdf; # nixpkgs' mupdf is incompatible with koreader's `libwrap-mupdf`
# package = libAndDev mupdf_1_17; # does not compile
};
nanosvg = {
source.url = "https://github.com/memononen/nanosvg.git";
@ -254,7 +257,8 @@ in
source.url = "https://github.com/openssl/openssl.git";
source.rev = "OpenSSL_1_1_1u";
source.hash = "sha256-JOcUj4ovA6621+1k2HUsvhGX1B9BjvaMbCaSx680nSs=";
# package = openssl; # incompatible with nixpkgs version
# TODO: i think we can use nixpkgs openssl, just lift lib/* up to the root of the package directory
# package = lib.getLib openssl_1_1; # N.B.: requires building with `NIXPKGS_ALLOW_INSECURE=1 nix build --impure ...`
};
popen-noshell = {
source.url = "https://github.com/famzah/popen-noshell.git";
@ -262,13 +266,13 @@ in
source.hash = "sha256-JeBZMsg6ZUGSnyZ4eds4w63gM/L73EsAnLaHOPpL6iM=";
# package: not in nixpkgs
};
# sdcv = {
# # upstream is (temporarily?) acquiring this via `download_project` machinery
# source.url = "https://github.com/Dushistov/sdcv.git";
# source.rev = "v0.5.5"
# # source.rev = "6e36e7730caf07b6cd0bfa265cdf9b5e31e7acad";
# # source.hash = "sha256-pPaT9tB39dd+VyE21KSjMpON99KjOxQ8Hi8+ZgFsuUY=";
# };
sdcv = {
# upstream is (temporarily?) acquiring this via `download_project` machinery
source.url = "https://github.com/Dushistov/sdcv.git";
source.rev = "v0.5.5";
source.hash = "sha256-EyvljVXhOsdxIYOGTzD+T16nvW7/RNx3DuQ2OdhjXJ4=";
package = sdcv;
};
tesseract = {
source.url = "https://github.com/tesseract-ocr/tesseract.git";
source.rev = "60176fc5ae5e7f6bdef60c926a4b5ea03de2bfa7";
@ -283,8 +287,8 @@ in
};
utf8proc = {
source.url = "https://github.com/JuliaStrings/utf8proc.git";
source.rev = "v2.8.0";
source.hash = "sha256-/lSD78kj133rpcSAOh8T8XFW/Z0c3JKkGQM5Z6DcMtU=";
source.rev = "v2.9.0";
source.hash = "sha256-Sgh8vTbclUV+lFZdR29PtNUy8F+9L/OAXk647B+l2mg=";
# package = libAndDev utf8proc; # nixpkgs is v3, not v2; incompatible .so name. /build/koreader/base/thirdparty/utf8proc/build/aarch64-unknown-linux-gnu/utf8proc-prefix/src/utf8proc/libutf8proc.so.2
};
zstd = {
@ -310,10 +314,6 @@ in
url = "http://ftpmirror.gnu.org/gettext/gettext-0.21.tar.gz";
hash = "sha256-x30NoxAq7JwH9DZx5gYR6/+JqZbvFZSXzo5Z0HV4axI=";
};
libffi = {
url = "https://github.com/libffi/libffi/releases/download/v3.4.4/libffi-3.4.4.tar.gz";
hash = "sha256-1mxWrSWags8qnfxAizK/XaUjcVALhHRff7i2RXEt9nY=";
};
libiconv = {
url = "http://ftpmirror.gnu.org/libiconv/libiconv-1.15.tar.gz";
hash = "sha256-zPU2YgpFRY0muoOIepg7loJwAekqE4R7ReSSXMiRMXg=";
@ -333,8 +333,8 @@ in
hash = "sha256-SXfOulwAVNvmwvEUZBrO1DzjvytB6mS2o3LWuhKcsV0=";
};
sqlite = {
url = "https://www.sqlite.org/2023/sqlite-autoconf-3430200.tar.gz";
hash = "sha256-bUIrb2LE3iyoDWGGDjo/tpNVTS91uxqsp0PMxNb2CfA=";
url = "https://www.sqlite.org/2023/sqlite-autoconf-3440200.tar.gz";
hash = "sha256-HGcZoUi8Qc8PK7vjkm184/XKCdh48SRvzCB2exdbtAc=";
};
tar = {
url = "http://ftpmirror.gnu.org/tar/tar-1.34.tar.gz";

View File

@ -10,42 +10,31 @@ index 51fca147..7f593ecd 100644
+ URL file://@dropbear@
URL_MD5 c3912f7fcdcc57c99937e4a79480d2c2
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2} COMMAND
PATCH_COMMAND ${PATCH_CMD}
diff --git a/base/thirdparty/gettext/CMakeLists.txt b/base/thirdparty/gettext/CMakeLists.txt
index 0ba8c635..c1bc122c 100644
--- a/base/thirdparty/gettext/CMakeLists.txt
+++ b/base/thirdparty/gettext/CMakeLists.txt
@@ -38,7 +38,7 @@ set(GETTEXT_VER "0.21")
@@ -38,8 +38,7 @@ set(GETTEXT_VER "0.21")
include(ExternalProject)
ExternalProject_Add(
${PROJECT_NAME}
- URL http://ftpmirror.gnu.org/gettext/gettext-${GETTEXT_VER}.tar.gz
- http://ftp.gnu.org/pub/gnu/gettext/gettext-${GETTEXT_VER}.tar.gz
+ URL file://@gettext@
URL_MD5 28b1cd4c94a74428723ed966c38cf479
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
PATCH_COMMAND COMMAND ${PATCH_CMD}
diff --git a/base/thirdparty/libffi/CMakeLists.txt b/base/thirdparty/libffi/CMakeLists.txt
index 972c991b..4409b18a 100644
--- a/base/thirdparty/libffi/CMakeLists.txt
+++ b/base/thirdparty/libffi/CMakeLists.txt
@@ -24,7 +24,7 @@ set(LIBFFI_VER "3.4.4")
ExternalProject_Add(
${PROJECT_NAME}
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
- URL https://github.com/libffi/libffi/releases/download/v${LIBFFI_VER}/libffi-${LIBFFI_VER}.tar.gz
+ URL file://@libffi@
URL_MD5 0da1a5ed7786ac12dcbaf0d499d8a049
CONFIGURE_COMMAND ${CFG_CMD}
# skip the rest, we only need the header for glib
PATCH_COMMAND ${PATCH_CMD}
diff --git a/base/thirdparty/libiconv/CMakeLists.txt b/base/thirdparty/libiconv/CMakeLists.txt
index 6a45ddc7..c8cf2974 100644
--- a/base/thirdparty/libiconv/CMakeLists.txt
+++ b/base/thirdparty/libiconv/CMakeLists.txt
@@ -19,7 +19,7 @@ set(GETTEXT_VER "1.15")
@@ -19,8 +19,7 @@ set(GETTEXT_VER "1.15")
include(ExternalProject)
ExternalProject_Add(
libiconv
- URL http://ftpmirror.gnu.org/libiconv/libiconv-${GETTEXT_VER}.tar.gz
- http://ftp.gnu.org/pub/gnu/libiconv/libiconv-${GETTEXT_VER}.tar.gz
+ URL file://@libiconv@
URL_MD5 ace8b5f2db42f7b3b3057585e80d9808
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
@ -62,7 +51,7 @@ index b7345e61..c5859b68 100644
+ URL file://@lpeg@
URL_MD5 d342571886f1abcb7afe6a83d024d583
BUILD_IN_SOURCE 1
PATCH_COMMAND COMMAND ${PATCH_CMD}
PATCH_COMMAND ${PATCH_CMD}
diff --git a/base/thirdparty/sdcv/CMakeLists.txt b/base/thirdparty/sdcv/CMakeLists.txt
index f19d441f..54394e0a 100644
--- a/base/thirdparty/sdcv/CMakeLists.txt
@ -77,7 +66,7 @@ index f19d441f..54394e0a 100644
- ${SDCV_GIT_COMMIT}
- #DOWNLOAD_COMMAND ${CMAKE_COMMAND} -P ${GIT_CLONE_SCRIPT_FILENAME}
+ URL file://@sdcv@
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2}
PATCH_COMMAND ${PATCH_CMD}
)
diff --git a/base/thirdparty/sdl2/CMakeLists.txt b/base/thirdparty/sdl2/CMakeLists.txt
@ -91,7 +80,7 @@ index a963385c..6376cfe8 100644
- URL https://github.com/libsdl-org/SDL/releases/download/release-${SDL2_VER}/SDL2-${SDL2_VER}.tar.gz
+ URL file://@sdl2@
URL_MD5 ${SDL2_MD5}
PATCH_COMMAND COMMAND ${PATCH_CMD}
PATCH_COMMAND ${PATCH_CMD}
)
diff --git a/base/thirdparty/sqlite/CMakeLists.txt b/base/thirdparty/sqlite/CMakeLists.txt
index 0353b145..9de56105 100644
@ -103,22 +92,23 @@ index 0353b145..9de56105 100644
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
- URL https://www.sqlite.org/2023/sqlite-autoconf-${SQLITE_VER}.tar.gz
+ URL file://@sqlite@
URL_MD5 94fb06bfebc437762e489c355ae63716
URL_MD5 c02f40fd4f809ced95096250adc5764a
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ${CFG_CMD}
diff --git a/base/thirdparty/tar/CMakeLists.txt b/base/thirdparty/tar/CMakeLists.txt
index 9d0b82ca..1c1d4b8e 100644
--- a/base/thirdparty/tar/CMakeLists.txt
+++ b/base/thirdparty/tar/CMakeLists.txt
@@ -62,7 +62,7 @@ include(ExternalProject)
@@ -52,8 +52,7 @@ include(ExternalProject)
set(TAR_VER "1.34")
ExternalProject_Add(
${PROJECT_NAME}
- URL http://ftpmirror.gnu.org/tar/tar-${TAR_VER}.tar.gz
- http://ftp.gnu.org/pub/gnu/tar/tar-${TAR_VER}.tar.gz
+ URL file://@tar@
URL_MD5 9d5949e4c2d9665546ac65dafc0e726a
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2}
PATCH_COMMAND ${PATCH_CMD}
diff --git a/base/thirdparty/zlib/CMakeLists.txt b/base/thirdparty/zlib/CMakeLists.txt
index 2350186d..0ea1394d 100644
--- a/base/thirdparty/zlib/CMakeLists.txt
@ -131,4 +121,4 @@ index 2350186d..0ea1394d 100644
+ URL file://@zlib@
URL_MD5 ${ZLIB_MD5}
BUILD_IN_SOURCE 1
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2} COMMAND ${PATCH_CMD3}
PATCH_COMMAND ${PATCH_CMD}