Skip to content

Commit

Permalink
notekit: new port
Browse files Browse the repository at this point in the history
  • Loading branch information
barracuda156 authored and herbygillot committed May 12, 2024
1 parent a84cec9 commit 05eb3c7
Show file tree
Hide file tree
Showing 4 changed files with 130 additions and 0 deletions.
65 changes: 65 additions & 0 deletions gnome/notekit/Portfile
@@ -0,0 +1,65 @@
# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4

PortSystem 1.0
PortGroup github 1.0
PortGroup legacysupport 1.1
PortGroup meson 1.0

github.setup blackhole89 notekit ff37a8b9115bd3a023ca8c6d80ad923af8d9df8f
version 2024.03.14
categories gnome sysutils
license MIT
maintainers {@barracuda156 gmail.com:vital.had} openmaintainer
description GTK3 hierarchical markdown note-taking application
long_description {*}${description} with tablet support.
checksums rmd160 4e56fc48e614e3cfd507466cac4a062da93949b4 \
sha256 b1068d5c9207153833f9b2dce5538e4424d789bb65a6a9ce9ba29b790495be97 \
size 2911104
github.tarball_from archive

depends_build-append \
port:pkgconfig

depends_lib-append port:desktop-file-utils \
port:fontconfig \
path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
port:gtkmm3 \
port:gtksourceviewmm3 \
path:lib/pkgconfig/harfbuzz.pc:harfbuzz \
port:jsoncpp \
port:MicroTeX \
port:zlib

# Used to provide wrappers.
legacysupport.newest_darwin_requires_legacy 0
legacysupport.redirect_bins ${name}

# https://github.com/blackhole89/notekit/issues/158
# Clang needs this patch; GCC does not fail without it, but still complains:
# warning: capture of variable 'mainwindow' with non-automatic storage duration
# So use it for both.
patchfiles-append clang-build.patch

# Find resources:
patchfiles-append patch-use-correct-path.diff

# Meson fails to find a version from GTK3.
# But we do not need it, since we do it manually below.
patchfiles-append patch-gtk_update_icon_cache.diff

post-patch {
reinplace "s|@PREFIX@|${prefix}|" ${worksrcpath}/mainwindow.cpp
}

compiler.cxx_standard 2020

configure.args-append \
-Dclatexmath=true

# Port installs hicolor icons, desktop application file and gschemas
post-activate {
system "${prefix}/bin/gtk-update-icon-cache-3.0 -f -t ${prefix}/share/icons/hicolor"
system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
system "${prefix}/bin/glib-compile-schemas ${prefix}/share/glib-2.0/schemas"
}
38 changes: 38 additions & 0 deletions gnome/notekit/files/clang-build.patch
@@ -0,0 +1,38 @@
From ea003311a6137abe7bd5737900b9d9babfd0a299 Mon Sep 17 00:00:00 2001
From: sp1rit <sp1rit@disroot.org>
Date: Mon, 30 Jan 2023 19:52:53 +0100
Subject: [PATCH] tweaks to llvm clang build

Signed-off-by: sp1rit <sp1rit@disroot.org>
---
main.cpp | 4 ++--
meson.build | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/main.cpp b/main.cpp
index 98b67a7..43904bc 100644
--- main.cpp
+++ main.cpp
@@ -23,8 +23,8 @@ int main (int argc, char *argv[])
Glib::RefPtr<Gtk::Application> app = Gtk::Application::create(argc, argv, "com.github.blackhole89.notekit");
#endif

- app->signal_activate().connect( [app,&mainwindow]() {
- mainwindow=new CMainWindow(app);
+ app->signal_activate().connect( [app]() {
+ auto mainwindow=new CMainWindow(app);
app->add_window(*mainwindow);
} );

diff --git a/meson.build b/meson.build
index 6720b25..c43cee1 100644
--- meson.build
+++ meson.build
@@ -1,6 +1,6 @@
project('notekit', 'cpp',
version : '0.3.0',
- default_options : ['warning_level=3', 'cpp_std=c++14']
+ default_options : ['warning_level=3', 'cpp_std=c++17']
)

has_devenv = meson.version().version_compare('>=0.58.0')
16 changes: 16 additions & 0 deletions gnome/notekit/files/patch-gtk_update_icon_cache.diff
@@ -0,0 +1,16 @@
--- gnome/meson.build 2024-03-14 09:08:54
+++ gnome/meson.build 2024-05-12 16:42:20
@@ -8,13 +8,11 @@
if meson.version().version_compare('>=0.59.0')
gnome.post_install(
glib_compile_schemas: true,
- gtk_update_icon_cache: true,
update_desktop_database: true
)
else
gnome.post_install(
glib_compile_schemas: true,
- gtk_update_icon_cache: true
)
endif
endif
11 changes: 11 additions & 0 deletions gnome/notekit/files/patch-use-correct-path.diff
@@ -0,0 +1,11 @@
--- mainwindow.cpp 2024-03-14 09:08:54
+++ mainwindow.cpp 2024-05-12 06:19:17
@@ -269,7 +269,7 @@

char *data_dirs = getenv("XDG_DATA_DIRS");
if(!data_dirs || !*data_dirs)
- data_dirs=strdup("/usr/local/share:/usr/share");
+ data_dirs=strdup("@PREFIX@/share");
else
data_dirs=strdup(data_dirs);

0 comments on commit 05eb3c7

Please sign in to comment.