mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-09-29 03:10:19 +00:00
various: switch dart builders to source based pdfium
Assisted-by: Codex, gpt-5.4 xhigh
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
pdfium-binaries,
|
||||
pdfium,
|
||||
}:
|
||||
|
||||
{ version, src, ... }:
|
||||
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
|
||||
|
||||
postPatch = lib.optionalString (lib.versionAtLeast version "0.2.0") ''
|
||||
substitute ${./build.dart} hook/build.dart \
|
||||
--replace-fail "@pdfium-binaries@" "${pdfium-binaries}"
|
||||
--replace-fail "@pdfium-binaries@" "${lib.getLib pdfium}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
pdfium-binaries,
|
||||
pdfium,
|
||||
}:
|
||||
|
||||
{ version, src, ... }:
|
||||
@@ -13,7 +13,8 @@ stdenv.mkDerivation {
|
||||
|
||||
postPatch = lib.optionalString (lib.versionOlder version "0.2.0") ''
|
||||
substituteInPlace linux/CMakeLists.txt \
|
||||
--replace-fail "\''${PDFIUM_DIR}/\''${PDFIUM_RELEASE}" "${pdfium-binaries}"
|
||||
--replace-fail "set(PDFIUM_RELEASE_DIR \''${PDFIUM_DIR}/\''${PDFIUM_RELEASE})" "set(PDFIUM_RELEASE_DIR ${lib.getLib pdfium})" \
|
||||
--replace-fail "file(COPY \''${PDFIUM_RELEASE_DIR}/include DESTINATION \''${PDFIUM_LIBS_DIR})" "file(COPY ${lib.getDev pdfium}/include DESTINATION \''${PDFIUM_LIBS_DIR})"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
pdfium-binaries,
|
||||
pdfium,
|
||||
}:
|
||||
|
||||
{ version, src, ... }:
|
||||
@@ -13,7 +13,7 @@ stdenv.mkDerivation {
|
||||
|
||||
postPatch = lib.optionalString (lib.versionOlder version "2.2.9") ''
|
||||
substituteInPlace linux/CMakeLists.txt \
|
||||
--replace-fail "\''${PDFIUM_DIR}/\''${PDFIUM_RELEASE}" "${pdfium-binaries}"
|
||||
--replace-fail "\''${PDFIUM_DIR}/\''${PDFIUM_RELEASE}" "${pdfium}"
|
||||
'';
|
||||
|
||||
installPhase = ''
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
pdfium-binaries,
|
||||
pdfium,
|
||||
replaceVars,
|
||||
}:
|
||||
|
||||
@@ -17,7 +18,8 @@ stdenv.mkDerivation rec {
|
||||
|
||||
patches = [
|
||||
(replaceVars ./printing.patch {
|
||||
inherit pdfium-binaries;
|
||||
pdfiumLib = lib.getLib pdfium;
|
||||
pdfiumDev = lib.getDev pdfium;
|
||||
})
|
||||
];
|
||||
|
||||
|
||||
@@ -1,17 +1,16 @@
|
||||
--- old/linux/CMakeLists.txt 2024-07-16 18:45:19.000000000 +0800
|
||||
+++ new/linux/CMakeLists.txt 2024-10-01 01:49:05.544910894 +0800
|
||||
@@ -16,6 +16,7 @@
|
||||
--- a/linux/CMakeLists.txt
|
||||
+++ b/linux/CMakeLists.txt
|
||||
@@ -14,6 +14,9 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
set(PROJECT_NAME "printing")
|
||||
project(${PROJECT_NAME} LANGUAGES CXX)
|
||||
+
|
||||
+set(PDFIUM_LIB_DIR @pdfiumLib@)
|
||||
+set(PDFIUM_INCLUDE_DIR @pdfiumDev@/include/public)
|
||||
|
||||
+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()
|
||||
|
||||
@@ -31,15 +34,12 @@
|
||||
-# Download pdfium
|
||||
-include(../windows/DownloadProject.cmake)
|
||||
-download_project(PROJ
|
||||
@@ -24,22 +23,11 @@
|
||||
set(PLUGIN_NAME "printing_plugin")
|
||||
|
||||
-include(${pdfium_SOURCE_DIR}/PDFiumConfig.cmake)
|
||||
+include(${PDFIUM_DIR}/PDFiumConfig.cmake)
|
||||
+set(PDFium_LIBRARY "${PDFIUM_LIB_DIR}/lib/libpdfium.so")
|
||||
+add_library(pdfium SHARED IMPORTED)
|
||||
+set_target_properties(pdfium PROPERTIES
|
||||
+ IMPORTED_LOCATION "${PDFium_LIBRARY}"
|
||||
+ INTERFACE_INCLUDE_DIRECTORIES "${PDFIUM_INCLUDE_DIR}")
|
||||
|
||||
# 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)
|
||||
|
||||
Reference in New Issue
Block a user