2021-01-11 08:54:33 +01:00
|
|
|
{ lib, stdenv
|
2020-05-05 09:08:27 +02:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2023-05-09 14:00:00 +02:00
|
|
|
, fetchFromGitHub
|
2020-05-05 09:08:27 +02:00
|
|
|
, dpkg
|
2021-06-22 17:53:15 +02:00
|
|
|
, glib
|
|
|
|
, gnutar
|
2020-05-05 09:08:27 +02:00
|
|
|
, gtk3-x11
|
2021-06-22 17:53:15 +02:00
|
|
|
, luajit
|
|
|
|
, sdcv
|
2023-05-09 14:00:00 +02:00
|
|
|
, SDL2 }:
|
2023-05-09 14:00:00 +02:00
|
|
|
let
|
|
|
|
luajit_lua52 = luajit.override { enable52Compat = true; };
|
|
|
|
in
|
2023-05-09 14:00:00 +02:00
|
|
|
stdenv.mkDerivation rec {
|
2020-05-05 09:08:27 +02:00
|
|
|
pname = "koreader";
|
2023-05-09 14:00:00 +02:00
|
|
|
version = "2023.04";
|
2020-05-05 09:08:27 +02:00
|
|
|
|
2023-05-14 21:39:16 +02:00
|
|
|
|
|
|
|
src = if stdenv.isAarch64 then fetchurl {
|
|
|
|
url = "https://github.com/koreader/koreader/releases/download/v${version}/koreader-${version}-arm64.deb";
|
|
|
|
sha256 = "sha256-uuspjno0750hQMIB5HEhbV63wCna2izKOHEGIg/X0bU=";
|
|
|
|
} else fetchurl {
|
|
|
|
url = "https://github.com/koreader/koreader/releases/download/v${version}/koreader-${version}-amd64.deb";
|
2023-05-09 14:00:00 +02:00
|
|
|
sha256 = "sha256-tRUeRB1+UcWT49dchN0YDvd0L5n1YRdtMSFc8yy6m5o=";
|
2020-05-05 09:08:27 +02:00
|
|
|
};
|
|
|
|
|
2023-05-09 14:00:00 +02:00
|
|
|
src_repo = fetchFromGitHub {
|
|
|
|
repo = "koreader";
|
|
|
|
owner = "koreader";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2023-05-09 14:00:00 +02:00
|
|
|
sha256 = "sha256-c3j6hs0W0H2jDg6JVfU6ov7r7kucbqrQqf9PAvYBcJ0=";
|
2023-05-09 14:00:00 +02:00
|
|
|
};
|
|
|
|
|
2020-05-05 09:08:27 +02:00
|
|
|
sourceRoot = ".";
|
|
|
|
nativeBuildInputs = [ makeWrapper dpkg ];
|
2021-06-22 17:53:15 +02:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
gnutar
|
|
|
|
gtk3-x11
|
2023-05-09 14:00:00 +02:00
|
|
|
luajit_lua52
|
2021-06-22 17:53:15 +02:00
|
|
|
sdcv
|
|
|
|
SDL2
|
|
|
|
];
|
2020-05-05 09:08:27 +02:00
|
|
|
unpackCmd = "dpkg-deb -x ${src} .";
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R usr/* $out/
|
2023-05-09 14:00:00 +02:00
|
|
|
ln -sf ${luajit_lua52}/bin/luajit $out/lib/koreader/luajit
|
2021-06-22 17:53:15 +02:00
|
|
|
ln -sf ${sdcv}/bin/sdcv $out/lib/koreader/sdcv
|
|
|
|
ln -sf ${gnutar}/bin/tar $out/lib/koreader/tar
|
2023-05-09 14:00:00 +02:00
|
|
|
find ${src_repo}/resources/fonts -type d -execdir cp -r '{}' $out/lib/koreader/fonts \;
|
|
|
|
find $out -xtype l -print -delete
|
2020-05-05 09:08:27 +02:00
|
|
|
wrapProgram $out/bin/koreader --prefix LD_LIBRARY_PATH : ${
|
2021-01-15 06:42:41 +01:00
|
|
|
lib.makeLibraryPath [ gtk3-x11 SDL2 glib ]
|
2020-05-05 09:08:27 +02:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2021-01-11 08:54:33 +01:00
|
|
|
meta = with lib; {
|
2020-05-05 09:08:27 +02:00
|
|
|
homepage = "https://github.com/koreader/koreader";
|
|
|
|
description =
|
|
|
|
"An ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats, running on Cervantes, Kindle, Kobo, PocketBook and Android devices";
|
2024-03-19 03:14:51 +01:00
|
|
|
mainProgram = "koreader";
|
2022-06-05 00:19:25 +02:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2023-05-15 04:27:32 +02:00
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
2020-12-30 22:28:26 +01:00
|
|
|
license = licenses.agpl3Only;
|
2020-12-28 20:56:29 +01:00
|
|
|
maintainers = with maintainers; [ contrun neonfuz];
|
2020-05-05 09:08:27 +02:00
|
|
|
};
|
|
|
|
}
|