mindforger: 1.52.0 -> 2.0.0 (#314128)

This commit is contained in:
Jörg Thalheim
2024-12-27 22:27:43 +01:00
committed by GitHub
3 changed files with 75 additions and 63 deletions
@@ -1,37 +1,68 @@
{ lib
, stdenv
, cmark-gfm
, fetchurl
, fetchpatch
, cmake
, curl
, fetchFromGitHub
, hunspell
, pkg-config
, qmake
, qtbase
, qtwebengine
, wrapGAppsHook3
, wrapQtAppsHook
}:
stdenv.mkDerivation rec {
pname = "mindforger";
version = "1.52.0";
src = fetchurl {
url = "https://github.com/dvorka/mindforger/releases/download/${version}/mindforger_${version}.tgz";
sha256 = "1pghsw8kwvjhg3jpmjs0n892h2l0pm0cs6ymi8b23fwk0kfj67rd";
let
version = "2.0.0";
srcs = {
mindforger = fetchFromGitHub {
owner = "dvorka";
repo = "mindforger";
rev = version;
sha256 = "sha256-+8miV2xuQcaWGdWCEXPIg6EXjAHtgD9pX7Z8ZNhpMjA=";
};
cmark-gfm = fetchFromGitHub {
owner = "dvorka";
repo = "cmark";
rev = "4ca8688093228c599432a87d7bd945804c573d51";
sha256 = "sha256-0WiG8aot8mc0h1BKPgC924UKQrgunZvKKBy9bD7nhoQ=";
};
mindforger-repository = fetchFromGitHub {
owner = "dvorka";
repo = "mindforger-repository";
rev = "ec81a27e5de6408bbcd3f6d7733a7c6f3b52e433";
sha256 = "sha256-JGTP1He7G2Obmsav64Lf7BLHp8OTvPtg38VHsrEC36o=";
};
};
in stdenv.mkDerivation {
pname = "mindforger";
inherit version;
nativeBuildInputs = [ qmake wrapGAppsHook3 wrapQtAppsHook ];
buildInputs = [ qtbase qtwebengine cmark-gfm ];
src = srcs.mindforger;
nativeBuildInputs = [ cmake pkg-config qmake wrapGAppsHook3 wrapQtAppsHook ];
buildInputs = [ curl hunspell qtbase qtwebengine ];
# Disable the cmake hook (so we don't try to build MindForger with it), and
# build MindForger's internal fork of cmark-gfm ahead of MindForger itself.
#
# Moreover unpack the docs that are needed for the MacOS build.
postUnpack = ''
cp -TR ${srcs.cmark-gfm} $sourceRoot/deps/cmark-gfm
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
cp -TR ${srcs.mindforger-repository} $sourceRoot/doc
'';
dontUseCmakeConfigure = true;
preBuild = ''(
mkdir deps/cmark-gfm/build &&
cd deps/cmark-gfm/build &&
cmake -DCMARK_TESTS=OFF -DCMARK_SHARED=OFF .. &&
cmake --build . --parallel
)'';
doCheck = true;
patches = [
# this makes the package relocatable - removes hardcoded references to /usr
./paths.patch
# this fixes compilation with QtWebEngine - referencing a commit trying to upstream the change - see https://github.com/dvorka/mindforger/pull/1357
(fetchpatch {
url = "https://github.com/dvorka/mindforger/commit/d28e2bade0278af1b5249953202810540969026a.diff";
sha256 = "sha256-qHKQQNGSc3F9seaOHV0gzBQFFqcTXk91LpKrojjpAUw=";
})
./hunspell_pkgconfig.patch
];
postPatch = ''
@@ -62,7 +93,7 @@ stdenv.mkDerivation rec {
'';
homepage = "https://www.mindforger.com";
license = licenses.gpl2Plus;
platforms = platforms.all;
platforms = [ "aarch64-linux" "x86_64-linux" ];
maintainers = with maintainers; [ cyplo ];
mainProgram = "mindforger";
};
@@ -0,0 +1,23 @@
diff --git a/app/app.pro b/app/app.pro
index 89ff5c0b..9625ecd1 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -159,12 +159,13 @@ macx {
} else:unix {
# pkgconfig-based configuration does not work @ Ubuntu
- # CONFIG += link_pkgconfig
- # PKGCONFIG += hunspell
+ # but does on NixOS
+ CONFIG += link_pkgconfig
+ PKGCONFIG += hunspell
- # hardcoded paths are (unfortunately) more robust:
- INCLUDEPATH += /usr/include/hunspell
- LIBS += -lhunspell
+ # Where hardcoded paths are (unfortunately) more robust^W^W^W^Wannoying:
+ # INCLUDEPATH += /usr/include/hunspell
+ # LIBS += -lhunspell
HEADERS += \
./src/qt/spelling/dictionary_provider_hunspell.h \
@@ -1,42 +0,0 @@
diff --git a/app/app.pro b/app/app.pro
index 29f9d9e..15fd2ff 100644
--- a/app/app.pro
+++ b/app/app.pro
@@ -370,7 +370,7 @@ RESOURCES += \
# See http://doc.qt.io/qt-5/qmake-advanced-usage.html
binfile.files += mindforger
-binfile.path = /usr/bin/
+binfile.path = $$PREFIX/bin/
INSTALLS += binfile
# ########################################
diff --git a/mindforger.pro b/mindforger.pro
index bd4f21d..6bb2dbc 100644
--- a/mindforger.pro
+++ b/mindforger.pro
@@ -43,20 +43,20 @@ app.depends = lib
#IMPORTANT: binfile MUST be specified in app/app.pro (project next to/that builds binary)
docfiles.files += doc/*
-docfiles.path = /usr/share/doc/mindforger/
+docfiles.path = $$PREFIX/share/doc/mindforger/
INSTALLS += docfiles
manfiles.files += man/*
-manfiles.path = /usr/share/man/man1/
+manfiles.path = $$PREFIX/share/man/man1/
INSTALLS += manfiles
iconfiles.files += app/resources/icons/*
-iconfiles.path = /usr/share/icons/mindforger/
+iconfiles.path = $$PREFIX/share/icons/mindforger/
INSTALLS += iconfiles
# experiment w/ file
shortcutfiles.files += app/resources/gnome-shell/mindforger.desktop
-shortcutfiles.path = /usr/share/applications/
+shortcutfiles.path = $$PREFIX/share/applications/
INSTALLS += shortcutfiles
# eof