Draft: user/trilium: new aport #142

Closed
ayakael wants to merge 7 commits from trilium/initial into edge
10 changed files with 174 additions and 118 deletions

View file

@ -1,8 +1,8 @@
# Contributor: Aiden Grossman <agrossman154@yahoo.com>
# Maintainer: Aiden Grossman <agrossman154@yahoo.com>
pkgname=freecad
pkgver=0.20.2
pkgrel=4
pkgver=0.21.0
pkgrel=0
pkgdesc="Free and open source 3D parametric modeler"
url="https://freecadweb.org/"
license="LGPL-2.0-or-later"
@ -44,14 +44,11 @@ makedepends="
vtk-dev
xerces-c-dev
"
options="!check" # Failing test units upstream as well
checkdepends="xvfb-run mesa mesa-dri-gallium font-opensans"
source="https://github.com/FreeCAD/FreeCAD/archive/$pkgver/freecad-$pkgver.tar.gz
$pkgname-python3.11-1.patch::https://github.com/FreeCAD/FreeCAD/commit/fe02d63c8c9b1280978be841d04e68a0a55cceb9.patch
numpy-1.20.patch
$pkgname-cstdint.patch::https://github.com/FreeCAD/FreeCAD/commit/f8f02f089537497a1bf46bc1057f01659b6636c1.patch
no-execinfo.patch
no-workaround-spnav.patch
resourceDirectory.patch
tests.patch
"
builddir="$srcdir/FreeCAD-$pkgver"
@ -93,11 +90,7 @@ package() {
}
sha512sums="
c3acd77dd2bb9a2a23ac354da3b6102effb89c95d675e91421d65486414dfe8cc0188a7212245e0deb63f17b9c5df76133017be09e4cd14b833be8cbec52a08d freecad-0.20.2.tar.gz
75a237f7ed7a89a98c0e5bdb3d3f0788749602daf718089aa0814e05f93ced1e15ad5867c7c87f170b48c5984f9ace1bbc95c4f386ce72bfb8d616323b47f1e5 freecad-python3.11-1.patch
80b08b031810fce7b6d698c662f64fa4f8a904f283f46b478b1d718529164c0ee61ce190f633abf04e03212720480f3f0603b0c1e160af79d7b6bb82da3bd0e4 numpy-1.20.patch
f5b4428217d9abd18aed1dcd8a5c77132b90173d07627ff9164919a87f04d242f9d616e9655751ec06ff57fc3e242090cc4d7e1d7045fdae9bc2e281e7855281 freecad-0.21.0.tar.gz
27dffdbb124096e7fcbec3589cdcfc587ea09bf039c1c1108edb68a9a4fd1278f66a39642636f98b8759a44da92485fd748f8b3d615b0625bc37fc717130e237 freecad-cstdint.patch
73aaba7015dce7048eb7d2456131b5b5ba4673cc980503331987be54d99daed5f61db015ca33d7d2ef0f02bd3192da8ce122c103c3b93f9959927deb4f0b933e no-execinfo.patch
15696bdaaf77482f1b5d3806535a8004c8cec7d598d62092d9f0394b4ca9e2ad6cedd77c4b86a83a06324d16678c1c6bbf3a390b807729717a2f513e858afd50 no-workaround-spnav.patch
8ba13b17bad66316757d180c1b9e9e72a24382627eac7c43a2264b3b5101e6e8f701775f2b805ed733f500fbcd8b0e8e422ec58a9ab3d948d613b666157d4c52 resourceDirectory.patch
5db19e0aa2ca1fd21f4c56afc9db54390a799262aaa0a741704c2c304b0068fd6ca1dcc086465e12e9c0cfe06aac750aaf9b8f5f4db324539af4dd3394803ff9 tests.patch
"

View file

@ -1,69 +0,0 @@
Patch-Source: https://github.com/FreeCAD/FreeCAD/commit/7b377a216b9185960e4cee980a6504dc1a755f50
fixes stderr reassignment
--
From 7b377a216b9185960e4cee980a6504dc1a755f50 Mon Sep 17 00:00:00 2001
From: wmayer <wmayer@users.sourceforge.net>
Date: Wed, 29 Jun 2022 15:19:18 +0200
Subject: [PATCH] Gui: remove workaround for spnav 0.23 due to build failure
with musl libc
---
src/Gui/3Dconnexion/GuiNativeEventLinux.cpp | 27 ---------------------
1 file changed, 27 deletions(-)
diff --git a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
index 7f0ddd75d262..455ece0b36bd 100644
--- a/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
+++ b/src/Gui/3Dconnexion/GuiNativeEventLinux.cpp
@@ -21,42 +21,17 @@
***************************************************************************/
#include <FCConfig.h>
-#include <cstdio>
#include "GuiNativeEventLinux.h"
#include "GuiApplicationNativeEventAware.h"
#include <Base/Console.h>
-#include <Base/FileInfo.h>
#include <QMainWindow>
#include <QSocketNotifier>
#include <spnav.h>
-namespace {
-class RedirectStdErr
-{
-public:
- RedirectStdErr()
- : fi(Base::FileInfo::getTempFileName())
- , file(stderr)
- {
- stderr = fopen(fi.filePath().c_str(), "w");
- }
- ~RedirectStdErr()
- {
- fclose(stderr);
- fi.deleteFile();
- stderr = file;
- }
-
-private:
- Base::FileInfo fi;
- FILE* file;
-};
-}
-
Gui::GuiNativeEvent::GuiNativeEvent(Gui::GUIApplicationNativeEventAware *app)
: GuiAbstractNativeEvent(app)
{
@@ -72,8 +47,6 @@ Gui::GuiNativeEvent::~GuiNativeEvent()
void Gui::GuiNativeEvent::initSpaceball(QMainWindow *window)
{
- // tmp. redirect stderr to a file to suppress an error message from spnav_open()
- RedirectStdErr err;
Q_UNUSED(window)
if (spnav_open() == -1) {
Base::Console().Log("Couldn't connect to spacenav daemon. Please ignore if you don't have a spacemouse.\n");

View file

@ -1,25 +0,0 @@
Patch-Source: https://github.com/FreeCAD/FreeCAD/commit/8b0df1dc936b544091f6a2d68df1c1a14ae3de5b
--
From 8b0df1dc936b544091f6a2d68df1c1a14ae3de5b Mon Sep 17 00:00:00 2001
From: lorenz <looooo@users.noreply.github.com>
Date: Tue, 27 Dec 2022 04:59:35 +0100
Subject: [PATCH] FEM: femmesh: fix AttributeError: module 'numpy' has no
attribute 'int'
---
src/Mod/Fem/femmesh/meshtools.py | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Mod/Fem/femmesh/meshtools.py b/src/Mod/Fem/femmesh/meshtools.py
index dd8671b..d2e2b0a 100644
--- a/src/Mod/Fem/femmesh/meshtools.py
+++ b/src/Mod/Fem/femmesh/meshtools.py
@@ -485,7 +485,7 @@ def get_femelement_sets(
# fem_objects = FreeCAD FEM document objects
# get femelements for reference shapes of each obj.References
count_femelements = 0
- referenced_femelements = np.zeros((max(femelement_table.keys())+1,),dtype=np.int)
+ referenced_femelements = np.zeros((max(femelement_table.keys())+1,),dtype=int)
has_remaining_femelements = None
for fem_object_i, fem_object in enumerate(fem_objects):
obj = fem_object["Object"]

View file

@ -1,11 +0,0 @@
--- ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake.orig
+++ ./cMake/FreeCAD_Helpers/ConfigureCMakeVariables.cmake
@@ -23,7 +23,7 @@
"Path to the directory containing PyCXX's cxxextensions.c source file")
# used as compiler defines
- set(RESOURCEDIR "${CMAKE_INSTALL_DATADIR}")
+ set(RESOURCEDIR "../../share/freecad")
set(LIBRARYDIR "${CMAKE_INSTALL_LIBDIR}")
set(DOCDIR "${CMAKE_INSTALL_DOCDIR}")

83
user/trilium/APKBUILD Normal file
View file

@ -0,0 +1,83 @@
# Maintainer: Antoine Martin (ayakael) <dev@ayakael.net>
# Contributor: Antoine Martin (ayakael) <dev@ayakael.net>
pkgname=trilium
pkgver=0.59.4
pkgrel=0
pkgdesc="A hierarchical note taking application with focus on building large personal knowledge bases."
arch="x86_64"
url="https://github.com/zadam/trilium"
license="AGPL-3.0"
depends="electron"
makedepends="
npm
nodejs
python3
"
subpackages="$pkgname-dumpdb"
source="$pkgname-$pkgver.tar.gz::https://github.com/zadam/trilium/archive/refs/tags/v$pkgver.tar.gz
copy-trilium.sh.patch
config-sample.ini.patch
trilium.sh
trilium-dumpdb.sh
trilium.desktop
"
prepare() {
default_prepare
sed -i "s|@electronversion@||" ../trilium.sh
mkdir -p "$srcdir/node_modules/lib"
}
_trilium_desktop_src_dir=./dist/trilium-linux-x64-src
build() {
export npm_config_cache="$srcdir/npm_cache"
export npm_config_prefix="$srcdir/node_modules"
export ELECTRON_SKIP_BINARY_DOWNLOAD=1
npm install --build-from-source
# Building trilium (desktop)
./bin/copy-trilium.sh $_trilium_desktop_src_dir
rm -rf $_trilium_desktop_src_dir/dump-db
rm -r $_trilium_desktop_src_dir/src/public/app-dist/*.mobile.*
npx electron-builder --linux --x64 --dir \
--project=$_trilium_desktop_src_dir \
-c.electronDist=/usr/lib/electron \
-c.electronVersion="$(electron --version | tail -c +2)"
}
package() {
install -vDm644 $_trilium_desktop_src_dir/dist/linux-unpacked/resources/app.asar -t "$pkgdir/usr/lib/$pkgname"
install -vDm644 $_trilium_desktop_src_dir/package.json -t "$pkgdir/usr/lib/$pkgname"
install -vDm644 bin/tpl/anonymize-database.sql -t "$pkgdir/usr/lib/$pkgname"
for i in 16 32 64 128 256 512; do
install -vDm644 images/app-icons/png/${i}x$i.png "$pkgdir/usr/share/icons/hicolor/${i}x$i/apps/$pkgname.png"
done
install -vDm755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/trilium"
install -vDm644 "$srcdir"/$pkgname.desktop -t "$pkgdir"/usr/share/applications
}
dumpdb() {
pkgdesc="An emergency tool to extract notes from the database where they're stored to plain files on the filesystem"
depends="nodejs"
install -vd "$pkgdir/usr/lib/$pkgname"
cp -vr dump-db/. -t "$pkgdir/usr/lib/$pkgname"
chmod -v 755 "$pkgdir/usr/lib/$pkgname/dump-db.js"
install -vDm755 "$srcdir/$pkgname.sh" "$pkgdir/usr/bin/trilium-dumpdb"
}
sha512sums="
96a4788574f66a830515eb8fe11bdc87e1083f04c3f409d095cdde2515c008c2ba32a0554d7e5cda4602c2b20861e5b442e022f3c1be4fd3397c0f9e4d24eae2 trilium-0.59.4.tar.gz
90ed115b3c7664d958f8426ac55253d46e770ebbfc4b7443581943df7e85211d709948e7ca41d698b28d4510c3e4c50244726ce49d44e1fa530fbf8129e42c5a copy-trilium.sh.patch
48fcb6931b632280a16b14744ee64804de1b399b0682076fdf1fa5669f691a53371532363020d8c7fb3704ea7bd633903cab1b92018f88a7170e6c2e213cd149 config-sample.ini.patch
6b03a7cce3836966d00e282d012cce944b8b56e29200fa06e64563a95e4edde591c0018715639a5e2acdbfd11a73ccb8283fbad19efc7dff218e8398c7e12d30 trilium.sh
e1fa62cdc2ecde41f5c5336bca3dd2d2b9e65de1a3162ef4ed336aaa7660c2b1c23793df7cdbd09e8b020890de0ba2d58c8704d2d1f0916da1212167c4820c0f trilium-dumpdb.sh
d0c051a0412f17f0373ead660ae6ddfefe5e8f8e2104a0ffc52d9af94c57c1274a2dc8d2317516dafa0fa85263250633acb56556318f21a663105dd7fce9b36f trilium.desktop
"

View file

@ -0,0 +1,13 @@
diff --git a/config-sample.ini.orig b/config-sample.ini
index 0e8da03..046b970 100644
--- a/config-sample.ini.orig
+++ b/config-sample.ini
@@ -9,7 +9,7 @@ noAuthentication=false
noBackup=false
# Disable automatically generating desktop icon
-# noDesktopIcon=true
+noDesktopIcon=true
[Network]
# host setting is relevant only for web deployments - set the host on which the server will listen

View file

@ -0,0 +1,33 @@
diff --git a/./bin/copy-trilium.sh.orig b/./bin/copy-trilium.sh
index ae460ff..95015ca 100755
--- a/./bin/copy-trilium.sh.orig
+++ b/./bin/copy-trilium.sh
@@ -5,12 +5,12 @@ if [[ $# -eq 0 ]] ; then
exit 1
fi
-n exec 16.19.1 npm run webpack
+npm run webpack
DIR=$1
rm -rf $DIR
-mkdir $DIR
+mkdir -p $DIR
echo "Copying Trilium to build directory $DIR"
@@ -27,11 +27,11 @@ cp -r electron.js $DIR/
cp webpack-* $DIR/
# run in subshell (so we return to original dir)
-(cd $DIR && n exec 16.19.1 npm install --only=prod)
+(cd $DIR && npm install --only=prod)
# cleanup of useless files in dependencies
rm -r $DIR/node_modules/image-q/demo
-rm -r $DIR/node_modules/better-sqlite3/Release
+rm -r $DIR/node_modules/better-sqlite3/build/Release
rm -r $DIR/node_modules/better-sqlite3/deps/sqlite3.tar.gz
rm -r $DIR/node_modules/@jimp/plugin-print/fonts
rm -r $DIR/node_modules/jimp/browser

View file

@ -0,0 +1,3 @@
#!/bin/sh
exec node /usr/lib/trilium-dumpdb/dump-db.js $@

View file

@ -0,0 +1,15 @@
[Desktop Entry]
Name=Trilium Notes
GenericName=Note-taking
Comment=A hierarchical note taking application with focus on building large personal knowledge bases.
Exec=trilium
Terminal=false
Type=Application
Icon=trilium
Categories=Office;Utility
StartupWMClass=Trilium
Actions=safe-mode
[Desktop Action safe-mode]
Name=Run in safe mode
Exec=trilium --safe-mode

21
user/trilium/trilium.sh Normal file
View file

@ -0,0 +1,21 @@
#!/bin/sh
for i in "$@"; do
case $i in
--disable-tls-certificate-check)
export NODE_TLS_REJECT_UNAUTHORIZED=0 # Allows for certificates which aren't in the system's store
shift # This decreases security and shouldn't be used regularly in untrusted networks.
;;
--safe-mode)
export TRILIUM_SAFE_MODE=1 # Enables some extra safety measures (i.e. disabling user scripting) to allow Trilium to load
_safemodecmdargs="--disable-gpu"
shift # if something user-defined is causing it to crash
;;
*)
;;
esac
done
export ELECTRON_IS_DEV=0 # Without this env variable Arch's Electron would open devtools by default
exec electron@electronversion@ /usr/lib/trilium/app.asar $_safemodecmdargs $@