2021-01-15 22:18:51 +00:00
|
|
|
{ lib, stdenv
|
2020-10-16 20:44:37 +00:00
|
|
|
, fetchurl
|
|
|
|
, makeWrapper
|
2023-05-24 13:37:59 +00:00
|
|
|
, fetchFromGitHub
|
2020-10-16 20:44:37 +00:00
|
|
|
, dpkg
|
2021-06-28 23:13:55 +00:00
|
|
|
, glib
|
|
|
|
, gnutar
|
2020-10-16 20:44:37 +00:00
|
|
|
, gtk3-x11
|
2021-06-28 23:13:55 +00:00
|
|
|
, luajit
|
|
|
|
, sdcv
|
2023-05-24 13:37:59 +00:00
|
|
|
, SDL2 }:
|
|
|
|
let
|
|
|
|
luajit_lua52 = luajit.override { enable52Compat = true; };
|
|
|
|
in
|
|
|
|
stdenv.mkDerivation rec {
|
2020-10-16 20:44:37 +00:00
|
|
|
pname = "koreader";
|
2024-07-01 15:47:52 +00:00
|
|
|
version = "2024.04";
|
2020-10-16 20:44:37 +00:00
|
|
|
|
2023-05-24 13:37:59 +00:00
|
|
|
|
|
|
|
src = if stdenv.isAarch64 then fetchurl {
|
|
|
|
url = "https://github.com/koreader/koreader/releases/download/v${version}/koreader-${version}-arm64.deb";
|
2024-07-01 15:47:52 +00:00
|
|
|
hash = "sha256-FwwB9slKOiYQ3eud2tiqov6yGNxmIicIe6nFpsH28Vk=";
|
2023-05-24 13:37:59 +00:00
|
|
|
} else fetchurl {
|
|
|
|
url = "https://github.com/koreader/koreader/releases/download/v${version}/koreader-${version}-amd64.deb";
|
2024-07-01 15:47:52 +00:00
|
|
|
hash = "sha256-hqJRZDZqzPNLK/8Bb+Oay70JqKAMKB0Epbbzeu5npLw=";
|
2023-05-24 13:37:59 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
src_repo = fetchFromGitHub {
|
|
|
|
repo = "koreader";
|
|
|
|
owner = "koreader";
|
|
|
|
rev = "v${version}";
|
|
|
|
fetchSubmodules = true;
|
2024-04-21 15:54:59 +00:00
|
|
|
sha256 = "sha256-gHn1xqBc7M9wkek1Ja1gry8TKIuUxQP8T45x3z2S4uc=";
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
sourceRoot = ".";
|
|
|
|
nativeBuildInputs = [ makeWrapper dpkg ];
|
2021-06-28 23:13:55 +00:00
|
|
|
buildInputs = [
|
|
|
|
glib
|
|
|
|
gnutar
|
|
|
|
gtk3-x11
|
2023-05-24 13:37:59 +00:00
|
|
|
luajit_lua52
|
2021-06-28 23:13:55 +00:00
|
|
|
sdcv
|
|
|
|
SDL2
|
|
|
|
];
|
2020-10-16 20:44:37 +00:00
|
|
|
unpackCmd = "dpkg-deb -x ${src} .";
|
|
|
|
|
|
|
|
dontConfigure = true;
|
|
|
|
dontBuild = true;
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
mkdir -p $out
|
|
|
|
cp -R usr/* $out/
|
2023-05-24 13:37:59 +00:00
|
|
|
ln -sf ${luajit_lua52}/bin/luajit $out/lib/koreader/luajit
|
2021-06-28 23:13:55 +00:00
|
|
|
ln -sf ${sdcv}/bin/sdcv $out/lib/koreader/sdcv
|
|
|
|
ln -sf ${gnutar}/bin/tar $out/lib/koreader/tar
|
2023-05-24 13:37:59 +00:00
|
|
|
find ${src_repo}/resources/fonts -type d -execdir cp -r '{}' $out/lib/koreader/fonts \;
|
|
|
|
find $out -xtype l -print -delete
|
2020-10-16 20:44:37 +00:00
|
|
|
wrapProgram $out/bin/koreader --prefix LD_LIBRARY_PATH : ${
|
2024-07-01 15:47:52 +00:00
|
|
|
lib.makeLibraryPath [ gtk3-x11 SDL2 glib stdenv.cc.cc.lib ]
|
2020-10-16 20:44:37 +00:00
|
|
|
}
|
|
|
|
'';
|
|
|
|
|
2021-01-15 22:18:51 +00:00
|
|
|
meta = with lib; {
|
2020-10-16 20:44:37 +00:00
|
|
|
homepage = "https://github.com/koreader/koreader";
|
2024-07-01 15:47:52 +00:00
|
|
|
changelog = "https://github.com/koreader/koreader/releases/tag/v${version}";
|
2020-10-16 20:44:37 +00:00
|
|
|
description =
|
|
|
|
"An ebook reader application supporting PDF, DjVu, EPUB, FB2 and many more formats, running on Cervantes, Kindle, Kobo, PocketBook and Android devices";
|
2024-04-21 15:54:59 +00:00
|
|
|
mainProgram = "koreader";
|
2022-06-26 10:26:21 +00:00
|
|
|
sourceProvenance = with sourceTypes; [ binaryNativeCode ];
|
2023-05-24 13:37:59 +00:00
|
|
|
platforms = [ "aarch64-linux" "x86_64-linux" ];
|
2021-01-05 17:05:55 +00:00
|
|
|
license = licenses.agpl3Only;
|
2020-12-29 15:07:52 +00:00
|
|
|
maintainers = with maintainers; [ contrun neonfuz];
|
2020-10-16 20:44:37 +00:00
|
|
|
};
|
|
|
|
}
|