about summary refs log tree commit diff
diff options
context:
space:
mode:
authorrewine <1758075541@qq.com>2022-08-24 23:44:58 +0800
committerrewine <1758075541@qq.com>2022-08-24 23:44:58 +0800
commitece2858b38acc214fe766e8edd7b895e54f4a8d8 (patch)
treea31c04e6401c64b5bfa04aa2d6d308d912cff004
parent68e8f8a80f649dc571896f5d0a68499626e19d20 (diff)
cutemarked-ng: init at unstable-2021-07-29
-rw-r--r--pkgs/applications/office/cutemarked-ng/0001-remove-dependency-on-vendored-library.patch95
-rw-r--r--pkgs/applications/office/cutemarked-ng/0002-use-pkgcofig-to-find-libraries.patch25
-rw-r--r--pkgs/applications/office/cutemarked-ng/default.nix57
-rw-r--r--pkgs/top-level/all-packages.nix2
4 files changed, 179 insertions, 0 deletions
diff --git a/pkgs/applications/office/cutemarked-ng/0001-remove-dependency-on-vendored-library.patch b/pkgs/applications/office/cutemarked-ng/0001-remove-dependency-on-vendored-library.patch
new file mode 100644
index 0000000000000..b42b7c3295c3e
--- /dev/null
+++ b/pkgs/applications/office/cutemarked-ng/0001-remove-dependency-on-vendored-library.patch
@@ -0,0 +1,95 @@
+From b9bf46966dd7931f9f33c30ed608a21d0e71e923 Mon Sep 17 00:00:00 2001
+From: rewine <lhongxu@outlook.com>
+Date: Tue, 19 Jul 2022 13:19:10 +0800
+Subject: [PATCH 1/2] remove dependency on vendored library
+
+---
+ CuteMarkEd.pro                |  4 +---
+ app-static/app-static.pro     | 11 ++---------
+ app/app.pro                   |  2 --
+ app/cutemarkdownhighlighter.h |  2 +-
+ 4 files changed, 4 insertions(+), 15 deletions(-)
+
+diff --git a/CuteMarkEd.pro b/CuteMarkEd.pro
+index 4ee92e3..0d247a4 100644
+--- a/CuteMarkEd.pro
++++ b/CuteMarkEd.pro
+@@ -9,12 +9,10 @@ TEMPLATE = subdirs
+ CONFIG += c++14
+ 
+ SUBDIRS = \
+-    3rdparty \
+     libs \
+     app-static \
+     app \
+-    fontawesomeicon \
+-    test
++    fontawesomeicon
+ 
+ # build order: 3rdparty -> libs -> app-static -> app & test
+ #libs.depends = 3rdparty
+diff --git a/app-static/app-static.pro b/app-static/app-static.pro
+index cd3c292..560b4fc 100644
+--- a/app-static/app-static.pro
++++ b/app-static/app-static.pro
+@@ -13,7 +13,6 @@ CONFIG += c++11
+ 
+ INCLUDEPATH += $$PWD
+ # MD4C library
+-INCLUDEPATH += $$PWD/../3rdparty/md4c/src
+ 
+ SOURCES += \
+     snippets/jsonsnippettranslator.cpp \
+@@ -34,10 +33,7 @@ SOURCES += \
+     revealviewsynchronizer.cpp \
+     htmlpreviewcontroller.cpp \
+     htmlviewsynchronizer.cpp \
+-    yamlheaderchecker.cpp \
+-    $$PWD/../3rdparty/md4c/src/md4c.c \
+-    $$PWD/../3rdparty/md4c/src/entity.c \
+-    $$PWD/../3rdparty/md4c/src/md4c-html.c
++    yamlheaderchecker.cpp
+ 
+ HEADERS += \
+     snippets/snippet.h \
+@@ -64,10 +60,7 @@ HEADERS += \
+     revealviewsynchronizer.h \
+     htmlpreviewcontroller.h \
+     htmlviewsynchronizer.h \
+-    yamlheaderchecker.h \
+-    $$PWD/../3rdparty/md4c/src/md4c.h \
+-    $$PWD/../3rdparty/md4c/src/entity.h \
+-    $$PWD/../3rdparty/md4c/src/md4c-html.h
++    yamlheaderchecker.h
+ 
+ 
+ #unix:!symbian {
+diff --git a/app/app.pro b/app/app.pro
+index 4827673..ab961cf 100644
+--- a/app/app.pro
++++ b/app/app.pro
+@@ -40,8 +40,6 @@ macx {
+ }
+ 
+ #qmarkdowntextedit
+-include(../3rdparty/qmarkdowntextedit/qmarkdowntextedit.pri)
+-include(../3rdparty/hunspell/hunspell.pri)
+ INCLUDEPATH += $$PWD
+ 
+ SOURCES += \
+diff --git a/app/cutemarkdownhighlighter.h b/app/cutemarkdownhighlighter.h
+index c99ab56..78f2be6 100644
+--- a/app/cutemarkdownhighlighter.h
++++ b/app/cutemarkdownhighlighter.h
+@@ -19,7 +19,7 @@
+ 
+ #include <QSyntaxHighlighter>
+ 
+-#include "../3rdparty/qmarkdowntextedit/markdownhighlighter.h"
++#include <QMarkdownTextedit/markdownhighlighter.h>
+ 
+ namespace hunspell {
+ class SpellChecker;
+-- 
+2.36.1
+
diff --git a/pkgs/applications/office/cutemarked-ng/0002-use-pkgcofig-to-find-libraries.patch b/pkgs/applications/office/cutemarked-ng/0002-use-pkgcofig-to-find-libraries.patch
new file mode 100644
index 0000000000000..89b5441738c5b
--- /dev/null
+++ b/pkgs/applications/office/cutemarked-ng/0002-use-pkgcofig-to-find-libraries.patch
@@ -0,0 +1,25 @@
+From bdc66eace846edc8a7b435f7ca9f324427243ce4 Mon Sep 17 00:00:00 2001
+From: rewine <lhongxu@outlook.com>
+Date: Thu, 21 Jul 2022 17:30:22 +0800
+Subject: [PATCH 2/2] use pkgcofig to find libraries
+
+---
+ app/app.pro | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/app/app.pro b/app/app.pro
+index ab961cf..475487d 100644
+--- a/app/app.pro
++++ b/app/app.pro
+@@ -13,6 +13,8 @@ win32: QT += winextras
+ TARGET = cutemarked
+ TEMPLATE = app
+ CONFIG += c++11
++CONFIG += link_pkgconfig
++PKGCONFIG += QMarkdownTextedit hunspell md4c-html
+ 
+ unix:!macx {
+   CONFIG += link_pkgconfig
+-- 
+2.36.1
+
diff --git a/pkgs/applications/office/cutemarked-ng/default.nix b/pkgs/applications/office/cutemarked-ng/default.nix
new file mode 100644
index 0000000000000..9488546aad6e9
--- /dev/null
+++ b/pkgs/applications/office/cutemarked-ng/default.nix
@@ -0,0 +1,57 @@
+{ lib
+, stdenv
+, fetchFromGitHub
+, qmake
+, pkg-config
+, qttools
+, qtbase
+, qtwebengine
+, wrapQtAppsHook
+, qmarkdowntextedit
+, md4c
+, hunspell
+}:
+
+stdenv.mkDerivation rec {
+  pname = "CuteMarkEd-NG";
+  version = "unstable-2021-07-29";
+
+  src = fetchFromGitHub {
+    owner = "Waqar144";
+    repo = pname;
+    rev = "9431ac603cef23d6f29e51e18f1eeee156f5bfb3";
+    sha256 = "sha256-w/D4C2ZYgI/7ZCDamTQlhrJ9vtvAMThgM/fopkdKWYc";
+  };
+
+  patches = [
+    ./0001-remove-dependency-on-vendored-library.patch
+    ./0002-use-pkgcofig-to-find-libraries.patch
+  ];
+
+  postPatch = ''
+    substituteInPlace app/app.pro \
+      --replace '$$[QT_INSTALL_BINS]/lrelease' "lrelease"
+  '';
+
+  nativeBuildInputs = [
+    qmake
+    qttools
+    pkg-config
+    wrapQtAppsHook
+  ];
+
+  buildInputs = [
+    md4c
+    qtwebengine
+    qmarkdowntextedit
+    hunspell.dev
+  ];
+
+  meta = with lib; {
+    description = "A Qt-based, free and open source markdown editor";
+    homepage = "https://github.com/Waqar144/CuteMarkEd-NG";
+    license = licenses.gpl2Plus;
+    maintainers = with maintainers; [ rewine ];
+    platforms = platforms.linux;
+  };
+}
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 7cb4ffd835f56..bfb57a6a9f81b 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -3483,6 +3483,8 @@ with pkgs;
 
   cucumber = callPackage ../development/tools/cucumber {};
 
+  cutemarked-ng = libsForQt5.callPackage ../applications/office/cutemarked-ng { };
+
   dabet = callPackage ../tools/misc/dabet { };
 
   dabtools = callPackage ../applications/radio/dabtools { };