koreader-from-src: vendor zlib

This commit is contained in:
Colin 2023-07-19 10:15:07 +00:00
parent 29a4466750
commit cc50ad172c
3 changed files with 57 additions and 23 deletions

View File

@ -15,10 +15,11 @@
, luajit
, sdcv
, SDL2
, substituteAll
}:
let
luajit_lua52 = luajit.override { enable52Compat = true; };
thirdparty = import ./sources.nix;
sources = import ./sources.nix;
in
stdenv.mkDerivation rec {
pname = "koreader-from-src";
@ -38,7 +39,18 @@ stdenv.mkDerivation rec {
inherit (s) url rev hash name;
leaveDotGit = true; # maybe not needed, but we'd need another way to query the rev during build process below
deepClone = true; # probably not needed
}) thirdparty);
}) sources.thirdparty);
patches = [
(substituteAll (
{
src = ./vendor-external-projects.patch;
} // (lib.mapAttrs
(_proj: source: fetchurl source)
sources.externalProjects
)
))
];
sourceRoot = "koreader";
@ -103,7 +115,7 @@ stdenv.mkDerivation rec {
'' + builtins.concatStringsSep "\n" (builtins.map
(l: ''install_lib "${l.name}" "${l.rev}"'')
thirdparty
sources.thirdparty
) + ''
make TARGET=debian DEBIAN=1 INSTALL_DIR="$out" SHELL=sh VERBOSE=1

View File

@ -1,20 +1,29 @@
[
{
url = "https://github.com/LuaJIT/LuaJIT";
rev = "8635cbabf3094c4d8bd00578c7d812bea87bb2d3";
hash = "sha256-8ij/Zjss8Rz5fKL9LJuRiTQdoT9OVMNOY1a4D2hRcEU=";
name = "luajit";
}
{
url = "https://github.com/libjpeg-turbo/libjpeg-turbo.git";
rev = "3.0.0";
hash = "sha256-CEqlV/LzF5okvPwUDyqDBvL4bTGc6TYqfADHtRLPJb4=";
name = "libjpeg-turbo";
}
{
url = "https://gitlab.com/koreader/djvulibre.git";
rev = "6a1e5ba1c9ef81c205a4b270c3f121a1e106f4fc";
hash = "sha256-H0HWR+hpAYLGbBdY3BwxgKPUrWhrIsVMnoURdbn8iIE=";
name = "djvulibre";
}
]
{
thirdparty = [
{
url = "https://github.com/LuaJIT/LuaJIT";
rev = "8635cbabf3094c4d8bd00578c7d812bea87bb2d3";
hash = "sha256-8ij/Zjss8Rz5fKL9LJuRiTQdoT9OVMNOY1a4D2hRcEU=";
name = "luajit";
}
{
url = "https://github.com/libjpeg-turbo/libjpeg-turbo.git";
rev = "3.0.0";
hash = "sha256-CEqlV/LzF5okvPwUDyqDBvL4bTGc6TYqfADHtRLPJb4=";
name = "libjpeg-turbo";
}
{
url = "https://gitlab.com/koreader/djvulibre.git";
rev = "6a1e5ba1c9ef81c205a4b270c3f121a1e106f4fc";
hash = "sha256-H0HWR+hpAYLGbBdY3BwxgKPUrWhrIsVMnoURdbn8iIE=";
name = "djvulibre";
}
];
externalProjects = {
zlib = {
url = "http://gentoo.osuosl.org/distfiles/zlib-1.2.13.tar.xz";
hash = "sha256-0Uw44xOvw1qah2Da3yYEL1HqD10VSwYwox2gVAEH+5g=";
};
};
}

View File

@ -0,0 +1,13 @@
diff --git a/base/thirdparty/zlib/CMakeLists.txt b/base/thirdparty/zlib/CMakeLists.txt
index 2350186d..76a7c97d 100644
--- a/base/thirdparty/zlib/CMakeLists.txt
+++ b/base/thirdparty/zlib/CMakeLists.txt
@@ -52,7 +52,7 @@ set(ZLIB_MD5 "7d9fc1d78ae2fa3e84fe98b77d006c63")
ExternalProject_Add(
${PROJECT_NAME}
DOWNLOAD_DIR ${KO_DOWNLOAD_DIR}
- URL http://gentoo.osuosl.org/distfiles/zlib-${ZLIB_VER}.tar.xz
+ URL file://@zlib@
URL_MD5 ${ZLIB_MD5}
BUILD_IN_SOURCE 1
PATCH_COMMAND COMMAND ${PATCH_CMD1} COMMAND ${PATCH_CMD2} COMMAND ${PATCH_CMD3}