dart.printing: refactor (#388172)

This commit is contained in:
Pol Dellaiera
2025-03-28 21:59:00 +01:00
committed by GitHub
3 changed files with 11 additions and 77 deletions
-30
View File
@@ -7,9 +7,6 @@
yq,
_experimental-update-script-combinators,
gitUpdater,
pdfium-binaries,
stdenv,
replaceVars,
}:
flutter327.buildFlutterApplication rec {
@@ -27,33 +24,6 @@ flutter327.buildFlutterApplication rec {
sourceRoot = "${src.name}/app";
customSourceBuilders = {
# unofficial printing
printing =
{ version, src, ... }:
stdenv.mkDerivation rec {
pname = "printing";
inherit version src;
inherit (src) passthru;
patches = [
(replaceVars ./printing.patch {
inherit pdfium-binaries;
})
];
dontBuild = true;
installPhase = ''
runHook preInstall
cp -r . $out
runHook postInstall
'';
};
};
gitHashes = {
dart_leap = "sha256-eEyUqdVToybQoDwdmz47H0f3/5zRdJzmPv1d/5mTOgA=";
lw_file_system = "sha256-0LLSADBWq19liQLtJIJEuTEqmeyIWP61zRRjjpdV6SM=";
-45
View File
@@ -1,45 +0,0 @@
--- old/printing/linux/CMakeLists.txt 2024-07-16 18:45:19.000000000 +0800
+++ new/printing/linux/CMakeLists.txt 2024-10-01 01:49:05.544910894 +0800
@@ -16,6 +16,7 @@
set(PROJECT_NAME "printing")
project(${PROJECT_NAME} LANGUAGES CXX)
+set(PDFIUM_DIR @pdfium-binaries@)
set(PDFIUM_VERSION "5200" CACHE STRING "Version of pdfium used")
string(REPLACE "linux-" "" TARGET_ARCH ${FLUTTER_TARGET_PLATFORM})
set(PDFIUM_ARCH ${TARGET_ARCH} CACHE STRING "Architecture of pdfium used")
@@ -32,18 +33,11 @@
)
endif()
-# Download pdfium
-include(../windows/DownloadProject.cmake)
-download_project(PROJ
- pdfium
- URL
- ${PDFIUM_URL})
-
# This value is used when generating builds using this plugin, so it must not be
# changed
set(PLUGIN_NAME "printing_plugin")
-include(${pdfium_SOURCE_DIR}/PDFiumConfig.cmake)
+include(${PDFIUM_DIR}/PDFiumConfig.cmake)
# System-level dependencies.
find_package(PkgConfig REQUIRED)
@@ -67,7 +61,7 @@
target_link_libraries(${PLUGIN_NAME}
PRIVATE PkgConfig::GTK PkgConfig::GTKUnixPrint)
target_link_libraries(${PLUGIN_NAME} PRIVATE pdfium)
-get_filename_component(PDFium_lib_path "${PDFium_LIBRARY}" DIRECTORY)
+set(PDFium_lib_path "${PDFIUM_DIR}/lib")
set_target_properties(${PLUGIN_NAME}
PROPERTIES SKIP_BUILD_RPATH
FALSE
@@ -77,4 +71,4 @@
"$ORIGIN:${PDFium_lib_path}")
# List of absolute paths to libraries that should be bundled with the plugin
-set(printing_bundled_libraries "${PDFium_LIBRARY}" PARENT_SCOPE)
+set(printing_bundled_libraries "${PDFIUM_DIR}/lib/libpdfium.so" PARENT_SCOPE)
@@ -11,17 +11,26 @@ stdenv.mkDerivation rec {
inherit version src;
inherit (src) passthru;
prePatch = ''
if [ -d printing ]; then pushd printing; fi
'';
patches = [
(replaceVars ./printing.patch {
inherit pdfium-binaries;
})
];
postPatch = ''
popd || true
'';
dontBuild = true;
installPhase = ''
runHook preInstall
mkdir $out
cp -a ./* $out/
cp -r . $out
runHook postInstall
'';