stirling-pdf: 2.8.0 -> 2.10.1 (#524498)

This commit is contained in:
Toma
2026-05-29 19:04:34 +00:00
committed by GitHub
4 changed files with 1458 additions and 901 deletions
+1395 -840
View File
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,33 @@
diff --git a/frontend/src-tauri/Cargo.lock b/frontend/src-tauri/Cargo.lock
index 87d5531..39b03ed 100644
--- a/frontend/src-tauri/Cargo.lock
+++ b/frontend/src-tauri/Cargo.lock
@@ -1966,7 +1966,7 @@ dependencies = [
"js-sys",
"log",
"wasm-bindgen",
- "windows-core 0.61.2",
+ "windows-core 0.62.2",
]
[[package]]
@@ -6041,6 +6041,19 @@ dependencies = [
"windows-core 0.61.2",
]
+[[package]]
+name = "windows-core"
+version = "0.61.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "c0fdd3ddb90610c7638aa2b3a3ab2904fb9e5cdbecc643ddb3647212781c4ae3"
+dependencies = [
+ "windows-implement",
+ "windows-interface",
+ "windows-link 0.1.3",
+ "windows-result 0.3.4",
+ "windows-strings 0.4.2",
+]
+
[[package]]
name = "windows-core"
version = "0.62.2"
@@ -1,22 +0,0 @@
diff --git a/frontend/src-tauri/stirling-pdf.desktop b/frontend/src-tauri/stirling-pdf.desktop
index 45db59c..8068696 100644
--- a/frontend/src-tauri/stirling-pdf.desktop
+++ b/frontend/src-tauri/stirling-pdf.desktop
@@ -3,13 +3,13 @@ Version=1.0
Type=Application
Name=Stirling-PDF
Comment=Locally hosted web application that allows you to perform various operations on PDF files
-Exec=/usr/bin/stirling-pdf
+Exec=stirling-pdf
Icon={{icon}}
Terminal=false
-MimeType=application/pdf;
+MimeType=application/pdf;x-scheme-handler/stirlingpdf;
Categories=Office;Graphics;Utility;
Actions=open-file;
[Desktop Action open-file]
Name=Open PDF File
-Exec=/usr/bin/stirling-pdf %F
\ No newline at end of file
+Exec=stirling-pdf %F
+30 -39
View File
@@ -7,6 +7,7 @@
cargo,
cargo-tauri,
go-task,
gradle_8,
makeBinaryWrapper,
nodejs,
@@ -36,23 +37,21 @@ let
in
stdenv.mkDerivation (finalAttrs: {
pname = "stirling-pdf" + lib.optionalString isDesktopVariant "-desktop";
version = "2.8.0";
version = "2.10.1";
src = fetchFromGitHub {
owner = "Stirling-Tools";
repo = "Stirling-PDF";
tag = "v${finalAttrs.version}";
hash = "sha256-5MZwwBT8Qi1kO+DAO/3JIm0/yAFtQLBo1UXDRZUjK7s=";
hash = "sha256-Qod8x8aB6qDxbRTE5rWUoqVka5kizfXJAWkKo5lhnFQ=";
};
patches = [
# remove timestamp from the header of a generated .properties file
./remove-props-file-timestamp.patch
# Note: only affects the desktop variant
# fix path to the stirling-pdf binary
# and add support for the stirlingpdf:// protocol
./fix-desktop-file.patch
# upstream probably forgot to commit the lockfile after a bump
./fix-cargo-lock.patch
];
npmRoot = "frontend";
@@ -61,7 +60,7 @@ stdenv.mkDerivation (finalAttrs: {
name = "${finalAttrs.pname}-${finalAttrs.version}-npm-deps";
inherit (finalAttrs) src patches;
postPatch = "cd ${finalAttrs.npmRoot}";
hash = "sha256-HyQok7Cd1kfWKCtaeHAhvZgxSvaKCk32bdJoNKj//rA=";
hash = "sha256-y+mviHatwhdIGCOKir1nnG/0Zm8oSoLKW345tU9upls=";
};
cargoRoot = "frontend/src-tauri";
@@ -75,7 +74,7 @@ stdenv.mkDerivation (finalAttrs: {
patches
cargoRoot
;
hash = "sha256-t6TBUsfOadn3KNLxva6iajlhg21dFqxgH962e1bIRLI=";
hash = "sha256-Tx6twcyFupNOzuXbW8uUulMJFObyPg/i2U0QnvyhIRQ=";
};
mitmCache = gradle.fetchDeps {
@@ -85,29 +84,20 @@ stdenv.mkDerivation (finalAttrs: {
__darwinAllowLocalNetworking = true;
# we'll trigger it manually in postBuild
dontTauriBuild = true;
env = {
PUPPETEER_SKIP_DOWNLOAD = "1";
# taken from here https://github.com/Stirling-Tools/Stirling-PDF/blob/main/.github/workflows/tauri-build.yml#L346-L348
VITE_SUPABASE_PUBLISHABLE_DEFAULT_KEY = "sb_publishable_UHz2SVRF5mvdrPHWkRteyA_yNlZTkYb";
VITE_SAAS_SERVER_URL = "https://app.stirlingpdf.com";
VITE_SAAS_BACKEND_API_URL = "https://api.stirlingpdf.com";
DISABLE_ADDITIONAL_FEATURES = "true";
};
# disable spotless because it tries to fetch files not in deps.json
# and also because it slows down the build process
gradleFlags = [
"-x"
"spotlessApply"
"-DDISABLE_ADDITIONAL_FEATURES=true"
"-PnoSpotless" # disable spotless because it tries to fetch files not in deps.json and also because it slows down the build process
]
++ lib.optionals buildWithFrontend [ "-PbuildWithFrontend=true" ];
doCheck = true;
nativeBuildInputs = [
go-task
gradle
jre # one of the tests also require that the `java` command is available on the command line
makeBinaryWrapper
@@ -133,14 +123,21 @@ stdenv.mkDerivation (finalAttrs: {
webkitgtk_4_1
];
postBuild = lib.optionalString isDesktopVariant ''
install -Dm644 ./app/core/build/libs/stirling-pdf-*.jar -t ./frontend/src-tauri/libs
mkdir -p ./frontend/src-tauri/runtime/
ln -s ${jre} ./frontend/src-tauri/runtime/jre
dontUseGradleBuild = isDesktopVariant; # we'll use the buildPhase from cargo-tauri-hook for the desktop app
# Unset these, since tauriBuildHook would recursively call them
unset preBuild postBuild
tauriBuildHook
# prepare the resources before building the desktop app
preBuild = lib.optionals isDesktopVariant ''
MODE=desktop task frontend:prepare
# this simulates what the desktop:jlink:jar would do
gradle bootJar
install -Dm644 ./app/core/build/libs/stirling-pdf-*.jar -t ./frontend/src-tauri/libs
# creates as minimal jre via jlink
task desktop:jlink:runtime
substituteInPlace frontend/src-tauri/stirling-pdf.desktop \
--replace-fail 'MimeType=application/pdf;' 'MimeType=application/pdf;x-scheme-handler/stirlingpdf;'
'';
# we use the installPhase from cargo-tauri-hook when we're building the desktop variant
@@ -154,17 +151,8 @@ stdenv.mkDerivation (finalAttrs: {
runHook postInstall
'';
# tauri installs the jre without preserving symlinks
# so we just symlink it again into the install location
# on darwin, we also create a wrapper for the binary inside the app bundle
postInstall = lib.optionalString isDesktopVariant ''
res_dir="$out/lib/Stirling-PDF/"
${lib.optionalString stdenv.hostPlatform.isDarwin ''
res_dir="$out/Applications/Stirling-PDF.app/Contents/Resources"
makeWrapper "$out/Applications/Stirling-PDF.app/Contents/MacOS/stirling-pdf" "$out/bin/stirling-pdf"
''}
rm -r "$res_dir/runtime/jre"
ln -s ${jre} "$res_dir/runtime/jre"
postInstall = lib.optionalString (isDesktopVariant && stdenv.hostPlatform.isDarwin) ''
makeWrapper "$out/Applications/Stirling-PDF.app/Contents/MacOS/stirling-pdf" "$out/bin/stirling-pdf"
'';
passthru = {
@@ -180,7 +168,10 @@ stdenv.mkDerivation (finalAttrs: {
homepage = "https://github.com/Stirling-Tools/Stirling-PDF";
license = lib.licenses.mit;
mainProgram = if isDesktopVariant then "stirling-pdf" else "Stirling-PDF";
maintainers = with lib.maintainers; [ tomasajt ];
maintainers = with lib.maintainers; [
tomasajt
staticdev
];
platforms = lib.platforms.linux ++ lib.platforms.darwin;
sourceProvenance = with lib.sourceTypes; [
fromSource