Commit 615f7034 authored by TomaSajt's avatar TomaSajt Committed by github-actions[bot]
Browse files

yacreader: fix darwin build

(cherry picked from commit 032bd9d0)
parent fe9e37d7
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
diff --git a/compressed_archive/unarr/unarr-wrapper.pri b/compressed_archive/unarr/unarr-wrapper.pri
index 0115267..5d3d6f5 100644
--- a/compressed_archive/unarr/unarr-wrapper.pri
+++ b/compressed_archive/unarr/unarr-wrapper.pri
@@ -6,7 +6,7 @@ HEADERS += $$PWD/extract_delegate.h \
 
 SOURCES += $$PWD/compressed_archive.cpp
 
-if(mingw|unix):!macx:!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) {
+if(mingw|unix):!contains(QT_CONFIG, no-pkg-config):packagesExist(libunarr) {
   message(Using system provided unarr installation found by pkg-config.)
   CONFIG += link_pkgconfig
   PKGCONFIG += libunarr
+53 −19
Original line number Diff line number Diff line
@@ -2,11 +2,10 @@
  lib,
  stdenv,
  fetchFromGitHub,
  libGLU,
  libunarr,
  libsForQt5,
  poppler,
  pkg-config,
  libunarr,
  libGLU,
}:

stdenv.mkDerivation rec {
@@ -15,29 +14,64 @@ stdenv.mkDerivation rec {

  src = fetchFromGitHub {
    owner = "YACReader";
    repo = pname;
    rev = version;
    sha256 = "sha256-5vCjr8WRwa7Q/84Itgg07K1CJKGnWA1z53et2IxxReE=";
    repo = "yacreader";
    tag = version;
    hash = "sha256-5vCjr8WRwa7Q/84Itgg07K1CJKGnWA1z53et2IxxReE=";
  };

  patches = [
    # make the unarr backend logic use pkg-config even on Darwin
    ./darwin-unarr-use-pkg-config.patch
  ];

  qmakeFlags = [
    # force unarr backend on all platforms
    "CONFIG+=unarr"
  ];

  nativeBuildInputs = [
    libsForQt5.qmake
    pkg-config
    libsForQt5.qttools # for translations
    libsForQt5.wrapQtAppsHook
    pkg-config
  ];
  buildInputs = [
    libunarr

  buildInputs =
    [
      libGLU
      libsForQt5.poppler
      libsForQt5.qtgraphicaleffects # imported, but not declared as a dependency
      libsForQt5.qtmultimedia
    libsForQt5.qtscript
  ];
  propagatedBuildInputs = [
      libsForQt5.qtquickcontrols2
    libsForQt5.qtgraphicaleffects
    libsForQt5.qtdeclarative
      libunarr
    ]
    ++ lib.optionals stdenv.hostPlatform.isDarwin [
      libsForQt5.qtmacextras # can be removed when using qt6
    ];

  # custom Darwin install instructions taken from the upsteam compileOSX.sh script
  installPhase = lib.optionalString stdenv.hostPlatform.isDarwin ''
    runHook preInstall

    mkdir -p "$out"/Applications

    cp -r YACReader/YACReader.app "$out"/Applications/
    cp -r YACReaderLibrary/YACReaderLibrary.app "$out"/Applications/
    cp -r YACReaderLibraryServer/YACReaderLibraryServer.app "$out"/Applications/

    cp -r release/server "$out"/Applications/YACReaderLibrary.app/Contents/MacOS/
    cp -r release/server "$out"/Applications/YACReaderLibraryServer.app/Contents/MacOS/
    cp -r release/languages "$out"/Applications/YACReader.app/Contents/MacOS/
    cp -r release/languages "$out"/Applications/YACReaderLibrary.app/Contents/MacOS/
    cp -r release/languages "$out"/Applications/YACReaderLibraryServer.app/Contents/MacOS/

    makeWrapper "$out"/Applications/YACReader.app/Contents/MacOS/YACReader "$out/bin/YACReader"
    makeWrapper "$out"/Applications/YACReaderLibrary.app/Contents/MacOS/YACReaderLibrary "$out/bin/YACReaderLibrary"
    makeWrapper "$out"/Applications/YACReaderLibraryServer.app/Contents/MacOS/YACReaderLibraryServer "$out/bin/YACReaderLibraryServer"

    runHook postInstall
  '';

  meta = {
    description = "Comic reader for cross-platform reading and managing your digital comic collection";
    homepage = "http://www.yacreader.com";