From 8cd8d8fbabd3f183d49076ce9edc33f192f738d0 Mon Sep 17 00:00:00 2001 From: Daringcuteseal Date: Sat, 28 Sep 2024 16:13:25 +0700 Subject: [PATCH] user/xournalpp: new package --- user/xournalpp/patches/no-sig.patch | 33 +++++++++++ user/xournalpp/patches/noexecinfo.patch | 77 +++++++++++++++++++++++++ user/xournalpp/template.py | 34 +++++++++++ 3 files changed, 144 insertions(+) create mode 100644 user/xournalpp/patches/no-sig.patch create mode 100644 user/xournalpp/patches/noexecinfo.patch create mode 100644 user/xournalpp/template.py diff --git a/user/xournalpp/patches/no-sig.patch b/user/xournalpp/patches/no-sig.patch new file mode 100644 index 0000000000..4c6fcae70b --- /dev/null +++ b/user/xournalpp/patches/no-sig.patch @@ -0,0 +1,33 @@ +catching signals and then printing a scuffed backtrace and inhibiting a coredump +is useless, just crash normally so a corefile can be inspected in a debugger +instead of being impossible. +-- +--- a/src/core/control/CrashHandlerUnix.h ++++ b/src/core/control/CrashHandlerUnix.h +@@ -71,26 +71,6 @@ + + sigemptyset(&mask); + +-#ifdef SIGSEGV +- signal(SIGSEGV, crashHandler); +- sigaddset(&mask, SIGSEGV); +-#endif +- +-#ifdef SIGFPE +- signal(SIGFPE, crashHandler); +- sigaddset(&mask, SIGFPE); +-#endif +- +-#ifdef SIGILL +- signal(SIGILL, crashHandler); +- sigaddset(&mask, SIGILL); +-#endif +- +-#ifdef SIGABRT +- signal(SIGABRT, crashHandler); +- sigaddset(&mask, SIGABRT); +-#endif +- + sigprocmask(SIG_UNBLOCK, &mask, 0); + + g_log_set_default_handler(GLogFunc(log_handler), getCrashHandlerLogBuffer()); diff --git a/user/xournalpp/patches/noexecinfo.patch b/user/xournalpp/patches/noexecinfo.patch new file mode 100644 index 0000000000..8cda22055b --- /dev/null +++ b/user/xournalpp/patches/noexecinfo.patch @@ -0,0 +1,77 @@ +diff --git a/src/core/control/CrashHandlerUnix.h b/src/core/control/CrashHandlerUnix.h +index dda77773..5007bddc 100644 +--- a/src/core/control/CrashHandlerUnix.h ++++ b/src/core/control/CrashHandlerUnix.h +@@ -13,7 +13,6 @@ + #include + #include // std::ofstream + +-#include + #include + + #include "util/PathUtil.h" +@@ -109,14 +108,6 @@ static void crashHandler(int sig) { + g_warning("[Crash Handler] Crashed with signal %i", sig); + + time_t lt; +- void* array[100]; +- char** messages; +- +- size_t size; +- +- // get void*'s for all entries on the stack +- size = backtrace(array, 100); +- + time_t curtime = time(0); + char stime[128]; + strftime(stime, sizeof(stime), "%Y%m%d-%H%M%S", localtime(&curtime)); +@@ -141,15 +132,6 @@ static void crashHandler(int sig) { + << std::endl + << std::endl; + +- messages = backtrace_symbols(array, size); +- +- for (size_t i = 0; i < size; i++) { +- fp << FORMAT_STR("[bt]: ({1}) {2}") % i % messages[i]; +- fp << "\n"; +- } +- +- free(messages); +- + fp << "\n\nTry to get a better stacktrace...\n"; + + Stacktrace::printStracktrace(fp); +diff --git a/src/util/Stacktrace.cpp b/src/util/Stacktrace.cpp +index c33b7f2c..ffb92616 100644 +--- a/src/util/Stacktrace.cpp ++++ b/src/util/Stacktrace.cpp +@@ -14,7 +14,6 @@ + #else + + #include // for dladdr +-#include // for backtrace, backtrace_symbols + #include // for readlink, ssize_t + + #ifdef __APPLE__ +@@ -91,12 +90,10 @@ void Stacktrace::printStracktrace(std::ostream& stream) { + std::array trace{}; + std::array buff{}; + +- int trace_size = backtrace(trace.data(), trace.size()); +- char** messages = backtrace_symbols(trace.data(), trace_size); ++ int trace_size = 0; + + // skip first stack frame (points here) + for (unsigned int i = 1; i < trace_size; ++i) { +- stream << "[bt] #" << i - 1 << " " << messages[i] << endl; + + Dl_info info; // NOLINT(cppcoreguidelines-init-variables) + dladdr(trace[i], &info); +@@ -115,7 +112,6 @@ void Stacktrace::printStracktrace(std::ostream& stream) { + pclose(fProc); + } + +- free(messages); + } + #endif + diff --git a/user/xournalpp/template.py b/user/xournalpp/template.py new file mode 100644 index 0000000000..4e9d512bfe --- /dev/null +++ b/user/xournalpp/template.py @@ -0,0 +1,34 @@ +pkgname = "xournalpp" +pkgver = "1.2.3" +pkgrel = 0 +build_style = "cmake" +hostmakedepends = [ + "cmake", + "gettext", + "help2man", + "ninja", + "pkgconf", +] +makedepends = [ + "glib-devel", + "gtk+3-devel", + "gtksourceview4-devel", + "librsvg-devel", + "libsndfile-devel", + "libxml2-devel", + "libzip-devel", + "lua5.4-devel", + "poppler-devel", + "portaudio-devel", +] +pkgdesc = "Handwriting notetaking software with PDF annotation support" +maintainer = "daringcuteseal " +license = "GPL-2.0-or-later" +url = "https://github.com/xournalpp/xournalpp" +source = f"{url}/archive/refs/tags/v{pkgver}.tar.gz" +sha256 = "8817abd1794760c2a3be3a35e56a5588a51e517bc591384fa321994d50e14e7c" +# known overflow in tablet handling thread +tool_flags = { + "CXXFLAGS": ["-DNDEBUG"], + "LDFLAGS": ["-Wl,-z,stack-size=0x200000"], +}