From e7a65abd0b9aaa475ca6e96aa795b28d58c5baae Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 22 Mar 2024 18:53:23 +0000 Subject: [PATCH] koreader-from-src: libk2pdfopt: populate in a more direct manner --- pkgs/additional/koreader-from-src/default.nix | 16 ++++++++++++++-- pkgs/additional/koreader-from-src/sources.nix | 12 ++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/pkgs/additional/koreader-from-src/default.nix b/pkgs/additional/koreader-from-src/default.nix index c8d513f6d..a26d304b7 100644 --- a/pkgs/additional/koreader-from-src/default.nix +++ b/pkgs/additional/koreader-from-src/default.nix @@ -120,6 +120,14 @@ let hash = "sha256-SDXKam768xvZZvTbXe3sssvZyeLEEiY97Vrzx8hoc6g="; }; + libk2pdfopt-src-ko = fetchFromGitHub { + owner = "koreader"; + repo = "libk2pdfopt"; + name = "libk2pdfopt"; + rev = "09f1e011a618c8ec06b4caa67079682119d2aaa7"; + hash = "sha256-37sZ46dG6Z1Wk7NrhKAKl5j9r1bN6g01cd5Iyt/2coM="; + }; + 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. @@ -298,6 +306,7 @@ let JPEG_LIB_LINK_FLAG="-L ${lib.getLib libjpeg_turbo}/lib -l:libjpeg.so" \ JPEG_DIR="${lib.getDev libjpeg_turbo}" \ TURBOJPEG_LIB="${lib.getLib libjpeg_turbo}/lib/libturbojpeg.so" \ + K2PDFOPT_DIR="$NIX_BUILD_TOP/libk2pdfopt" \ KOBO_USBMS_DIR="$NIX_BUILD_TOP/kobo-usbms" \ LEPTONICA_DIR="$NIX_BUILD_TOP/leptonica" \ LIBICONV="${lib.getLib libiconvReal}/lib/libiconv.so" \ @@ -395,6 +404,7 @@ stdenv.mkDerivation rec { fbink-src-ko kobo-usbms-src-ko leptonica-src-ko + libk2pdfopt-src-ko tesseract-src-ko ] ++ (lib.mapAttrsToList (name: src: fetchgit ( @@ -448,7 +458,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,tesseract} + chmod -R u+w "$NIX_BUILD_TOP"/{fbink,kobo-usbms,leptonica,libk2pdfopt,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 @@ -503,7 +513,8 @@ stdenv.mkDerivation rec { } skip_download() { - sed -i 's/DOWNLOAD_COMMAND .*/DOWNLOAD_COMMAND ""/' "base/thirdparty/$1/CMakeLists.txt" + # sed -i 's/DOWNLOAD_COMMAND .*/DOWNLOAD_COMMAND ""/' "base/thirdparty/$1/CMakeLists.txt" + sed -i "s:DOWNLOAD_COMMAND .*:DOWNLOAD_COMMAND rm -fd $1 \\&\\& ln -s $NIX_BUILD_TOP/$1 .:" "base/thirdparty/$1/CMakeLists.txt" } ${builtins.concatStringsSep "\n" ( @@ -514,6 +525,7 @@ stdenv.mkDerivation rec { skip_download fbink skip_download kobo-usbms + skip_download libk2pdfopt # outDir should match OUTPUT_DIR in koreader-base outDir="$NIX_BUILD_TOP/koreader/base/build/${stdenv.hostPlatform.config}" diff --git a/pkgs/additional/koreader-from-src/sources.nix b/pkgs/additional/koreader-from-src/sources.nix index 9037a5353..8e2e97244 100644 --- a/pkgs/additional/koreader-from-src/sources.nix +++ b/pkgs/additional/koreader-from-src/sources.nix @@ -144,12 +144,12 @@ in # source.hash = "sha256-ofdecix4m0FA9gdyQh7zYn99SYBbH2+a7jfoZlsadoA="; # # package = libAndDev libjpeg_turbo; # }; - libk2pdfopt = { - source.url = "https://github.com/koreader/libk2pdfopt.git"; - 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) - }; + # libk2pdfopt = { + # source.url = "https://github.com/koreader/libk2pdfopt.git"; + # 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"; # source.rev = "v1.6.40";