2022-04-15 01:41:22 +00:00
|
|
|
{ lib
|
|
|
|
, stdenv
|
|
|
|
, installShellFiles
|
|
|
|
, fetchFromGitHub
|
2023-10-09 19:29:22 +00:00
|
|
|
, fetchurl
|
2022-08-21 13:32:41 +00:00
|
|
|
, freetype
|
2022-04-15 01:41:22 +00:00
|
|
|
, gumbo
|
|
|
|
, harfbuzz
|
|
|
|
, jbig2dec
|
2022-08-12 12:06:08 +00:00
|
|
|
, mujs
|
2022-04-15 01:41:22 +00:00
|
|
|
, mupdf
|
|
|
|
, openjpeg
|
|
|
|
, qt3d
|
|
|
|
, qtbase
|
|
|
|
, qmake
|
|
|
|
, wrapQtAppsHook
|
|
|
|
}:
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
2022-04-15 01:41:22 +00:00
|
|
|
pname = "sioyek";
|
2023-01-11 07:51:40 +00:00
|
|
|
version = "2.0.0";
|
2022-04-15 01:41:22 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "ahrm";
|
2022-09-09 14:08:57 +00:00
|
|
|
repo = "sioyek";
|
2023-01-11 07:51:40 +00:00
|
|
|
rev = "v${finalAttrs.version}";
|
|
|
|
sha256 = "sha256-GFZaTXJhoBB+rSe7Qk6H6FZJVXr3nO9XgM+LAbS4te4=";
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
|
|
|
|
2023-10-09 19:29:22 +00:00
|
|
|
patches = [
|
|
|
|
# Fixed compatibility with mupdf-0.23.0
|
|
|
|
# https://github.com/ahrm/sioyek/issues/804
|
|
|
|
(fetchurl {
|
|
|
|
url = "https://git.alpinelinux.org/aports/plain/community/sioyek/mupdf-0.23.0.patch?id=86e913eccf19b97a16f25d9b6cdf0f50232f1226";
|
|
|
|
hash = "sha256-sEqhpk7/h6g/fIhbu5LgpKKnbnIFLInrTP1k+/GhrXE=";
|
|
|
|
})
|
|
|
|
];
|
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
buildInputs = [
|
|
|
|
gumbo
|
|
|
|
harfbuzz
|
|
|
|
jbig2dec
|
|
|
|
mujs
|
|
|
|
mupdf
|
|
|
|
openjpeg
|
|
|
|
qt3d
|
|
|
|
qtbase
|
|
|
|
]
|
|
|
|
++ lib.optionals stdenv.isDarwin [ freetype ];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2022-09-09 14:08:57 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
installShellFiles
|
|
|
|
qmake
|
|
|
|
wrapQtAppsHook
|
|
|
|
];
|
2022-04-15 01:41:22 +00:00
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
qmakeFlags = lib.optionals stdenv.isDarwin [ "CONFIG+=non_portable" ];
|
|
|
|
|
2022-04-15 01:41:22 +00:00
|
|
|
postPatch = ''
|
2022-08-21 13:32:41 +00:00
|
|
|
substituteInPlace pdf_viewer_build_config.pro \
|
2023-11-16 04:20:00 +00:00
|
|
|
--replace "-lmupdf-threads" "-lgumbo -lharfbuzz -lfreetype -ljbig2dec -ljpeg -lopenjp2" \
|
|
|
|
--replace "-lmupdf-third" ""
|
2022-04-15 01:41:22 +00:00
|
|
|
substituteInPlace pdf_viewer/main.cpp \
|
|
|
|
--replace "/usr/share/sioyek" "$out/share" \
|
|
|
|
--replace "/etc/sioyek" "$out/etc"
|
|
|
|
'';
|
|
|
|
|
2022-08-21 13:32:41 +00:00
|
|
|
postInstall = if stdenv.isDarwin then ''
|
|
|
|
cp -r pdf_viewer/shaders sioyek.app/Contents/MacOS/shaders
|
|
|
|
cp pdf_viewer/prefs.config sioyek.app/Contents/MacOS/
|
|
|
|
cp pdf_viewer/prefs_user.config sioyek.app/Contents/MacOS/
|
|
|
|
cp pdf_viewer/keys.config sioyek.app/Contents/MacOS/
|
|
|
|
cp pdf_viewer/keys_user.config sioyek.app/Contents/MacOS/
|
|
|
|
cp tutorial.pdf sioyek.app/Contents/MacOS/
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
mkdir -p $out/Applications $out/bin
|
2022-08-21 13:32:41 +00:00
|
|
|
cp -r sioyek.app $out/Applications
|
2023-02-02 18:25:31 +00:00
|
|
|
ln -s $out/Applications/sioyek.app/Contents/MacOS/sioyek $out/bin/sioyek
|
2022-09-09 14:08:57 +00:00
|
|
|
'' else ''
|
2022-04-15 01:41:22 +00:00
|
|
|
install -Dm644 tutorial.pdf $out/share/tutorial.pdf
|
|
|
|
cp -r pdf_viewer/shaders $out/share/
|
|
|
|
install -Dm644 -t $out/etc/ pdf_viewer/{keys,prefs}.config
|
|
|
|
installManPage resources/sioyek.1
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
homepage = "https://sioyek.info/";
|
2022-09-09 14:08:57 +00:00
|
|
|
description = "A PDF viewer designed for research papers and technical books";
|
2023-01-11 07:51:40 +00:00
|
|
|
changelog = "https://github.com/ahrm/sioyek/releases/tag/v${finalAttrs.version}";
|
2022-04-15 01:41:22 +00:00
|
|
|
license = licenses.gpl3Only;
|
2022-09-09 14:08:57 +00:00
|
|
|
maintainers = with maintainers; [ podocarp ];
|
|
|
|
platforms = platforms.unix;
|
2022-04-15 01:41:22 +00:00
|
|
|
};
|
2022-09-09 14:08:57 +00:00
|
|
|
})
|