koreader-from-src: mupdf: populate more directly

This commit is contained in:
Colin 2024-03-22 19:54:13 +00:00
parent 8d45aad534
commit 373388c5b8
2 changed files with 21 additions and 9 deletions

View File

@ -153,6 +153,15 @@ let
hash = "sha256-P/3MMMGYDqD9NmkYvw/thKpUNa3wNOSlBBjANHSonAg=";
};
mupdf-src-ko = fetchFromGitHub {
owner = "ArtifexSoftware";
repo = "mupdf";
name = "mupdf"; # where to unpack this in `srcs`
fetchSubmodules = true; # specifically for jbig2dec, mujs, openjpeg
rev = "1.13.0";
hash = "sha256-pQejRon9fO9A1mhz3oLjBr1j4HveDLcQIWjR1/Rpy5Q=";
};
nanosvg-headers-ko = symlinkJoin {
# koreader's heavily-patched mupdf is dependent on a koreader-specific `stb_image_write` extension to nanosvg.
# nanosvg is used as a header-only library, so just patch that extension straight into the src.
@ -357,6 +366,7 @@ let
LUA_RAPIDJSON_ROCK="${rockspecFor "rapidjson"}" \
LUA_SPORE_ROCK="${rockspecFor "lua-spore"}" \
MINIZIP_DIR="$NIX_BUILD_TOP/minizip" \
MUPDF_DIR="$NIX_BUILD_TOP/mupdf" \
NANOSVG_HEADERS="${nanosvg-headers-ko}" \
NANOSVG_INCLUDE_DIR="${nanosvg-headers-ko}" \
OPENSSL_LIB="${lib.getLib openssl}/lib/libssl.so" \
@ -436,6 +446,7 @@ stdenv.mkDerivation rec {
lodepng-src-ko
lunasvg-src-ko
minizip-src-ko
mupdf-src-ko
tesseract-src-ko
] ++ (lib.mapAttrsToList
(name: src: fetchgit (
@ -489,7 +500,7 @@ stdenv.mkDerivation rec {
--replace-fail ' -rm ' ' # -rm'
# make some sources writable (only the `sourceRoot` is writable by default)
chmod -R u+w "$NIX_BUILD_TOP"/{fbink,kobo-usbms,leptonica,libk2pdfopt,lodepng,lunasvg,minizip,tesseract}
chmod -R u+w "$NIX_BUILD_TOP"/{fbink,kobo-usbms,leptonica,libk2pdfopt,lodepng,lunasvg,minizip,mupdf,tesseract}
# lots of places in Makefile.third (incorrectly) assume lib paths are relative to CURDIR,
# so link /nix into CURDIR to allow them to work anyway
@ -560,6 +571,7 @@ stdenv.mkDerivation rec {
skip_download lodepng
skip_download lunasvg
skip_download minizip
skip_download mupdf
# outDir should match OUTPUT_DIR in koreader-base
outDir="$NIX_BUILD_TOP/koreader/base/build/${stdenv.hostPlatform.config}"
@ -605,7 +617,7 @@ stdenv.mkDerivation rec {
passthru = {
# exposed for debugging
inherit luajit52 luaEnv nanosvg-headers-ko rockspecFor;
inherit luajit52 luaEnv mupdf-src-ko nanosvg-headers-ko rockspecFor;
inherit (overlayedLuaPkgs luaEnv.pkgs)
luajson
htmlparser

View File

@ -241,13 +241,13 @@ in
# source.hash = "sha256-P/3MMMGYDqD9NmkYvw/thKpUNa3wNOSlBBjANHSonAg=";
# # package = libAndDev minizip; # weird #include incompatibilities... maybe resolvable (looks like this is actually minizip-ng! but from 2015 and slightly patched; used as a lib for mupdf).
# };
mupdf = {
source.url = "https://github.com/ArtifexSoftware/mupdf.git";
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
};
# mupdf = {
# source.url = "https://github.com/ArtifexSoftware/mupdf.git";
# 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";
# source.rev = "93ce879dc4c04a3ef1758428ec80083c38610b1f";