Unverified Commit 2a64cf0e authored by Aleksana's avatar Aleksana Committed by GitHub
Browse files

butterfly: init at 2.2.1 (#345582)

parents cba7bbd9 260b34e1
Loading
Loading
Loading
Loading
+77 −0
Original line number Diff line number Diff line
{
  lib,
  fetchFromGitHub,
  flutter,
  stdenv,
  fetchzip,
}:
let
  pname = "butterfly";
  version = "2.2.1";
  src = fetchFromGitHub {
    owner = "LinwoodDev";
    repo = "Butterfly";
    rev = "v${version}";
    hash = "sha256-TV7C0v3y9G44Df/x1ST8D0c0QqNBuuhzPBMKUyf/iwo=";
  };
  pdfium-binaries = fetchzip {
    url = "https://github.com/bblanchon/pdfium-binaries/releases/download/chromium/5200/pdfium-linux-x64.tgz";
    hash = "sha256-AJop6gKjF/DPgItuPQsWpgngxiqVNeqBbhHZz3aQ1n0=";
    stripRoot = false;
  };
in
flutter.buildFlutterApplication {
  inherit pname version src;

  pubspecLock = lib.importJSON ./pubspec.lock.json;

  sourceRoot = "${src.name}/app";

  customSourceBuilders = {
    printing =
      { version, src, ... }:
      stdenv.mkDerivation rec {
        pname = "printing";
        inherit version src;
        inherit (src) passthru;
        patches = [ ./printing.patch ];
        installPhase = ''
          runHook preInstall
          mkdir $out
          cp -a ./* $out/
          runHook postInstall
        '';
      };
  };

  env.PDFIUM_DIR = "${pdfium-binaries}";

  gitHashes = {
    dart_leap = "sha256-eEyUqdVToybQoDwdmz47H0f3/5zRdJzmPv1d/5mTOgA=";
    lw_file_system = "sha256-CPBwaDTK57SKcaD4IzjIL4cWixEDK9sv3zCDeNfFpw0=";
    flutter_secure_storage_web = "sha256-ULYXcFjz9gKMjw1Q1KAmX2J7EcE8CbW0MN/EnwmaoQY=";
    networker = "sha256-8ol5YRim4dLpgR30DXbgHzq+VDk1sPLIi+AxUtwOls8=";
    lw_file_system_api = "sha256-OOLbqKLvgHUJf3LiiQoHJS6kngnWtHPhswM69sX5fwE=";
    lw_sysapi = "sha256-9hCAYB5tqYKQPHGa7+Zma6fE8Ei08RvyL9d65FMuI+I=";
    flex_color_scheme = "sha256-MYEiiltevfz0gDag3yS/ZjeVaJyl1JMS8zvgI0k4Y0k=";
    material_leap = "sha256-pQ+OvecHaav5QI+Hf7+DDcXYM3JMwogseMzce1ULveY=";
    networker_socket = "sha256-+h5FXqPhB6VJ269WPoqKk+/1cE+p7UbLvDwnXrJh+CE=";
    perfect_freehand = "sha256-dMJ8CyhoQWbBRvUQyzPc7vdAhCzcAl1X7CcaT3u6dWo=";
  };

  postInstall = ''
    cp -r linux/debian/usr/share $out/share
  '';

  meta = {
    description = "Powerful, minimalistic, cross-platform, opensource note-taking app";
    homepage = "https://github.com/LinwoodDev/Butterfly";
    mainProgram = "butterfly";
    license = with lib.licenses; [
      agpl3Plus
      cc-by-sa-40
    ];
    maintainers = with lib.maintainers; [ aucub ];
    platforms = [ "x86_64-linux" ];
  };
}
+45 −0
Original line number Diff line number Diff line
--- 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 @@
 set(PROJECT_NAME "printing")
 project(${PROJECT_NAME} LANGUAGES CXX)
 
+set(PDFIUM_DIR $ENV{PDFIUM_DIR})
 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)
+2050 −0

File added.

Preview size limit exceeded, changes collapsed.