blob: 4489930925c9e8e3a2e7c2f2b0aa7f2594af6c37 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
|
# Maintainer: Xuanwo <xuanwo@archlinuxcn.org>
# Contributor: Bader <Bad3r@pm.me>
# Acknowledgment: @pychuang (logseq-desktop-git)
# avoid cluttering user home, while allowing data to be cached
export HOME="${SRCDEST:-$startdir}/node-home"
export XDG_CACHE_HOME="$HOME/.cache"
export XDG_CONFIG_HOME="$HOME/.config"
export XDG_DATA_HOME="$HoME/.local/share"
# basic info
_pkgname="logseq-desktop"
pkgname="$_pkgname"
pkgver=0.10.7
pkgrel=1
pkgdesc="Privacy-first, open-source platform for knowledge sharing and management"
url="https://github.com/logseq/logseq"
license=('AGPL-3.0-or-later')
arch=("x86_64")
makedepends=(
"clojure"
"gendesk"
"git"
"nodejs"
"npm"
"yarn"
)
install="$pkgname.install"
_pkgsrc="logseq-${pkgver}"
source=(
"$_pkgname-${pkgver}.zip"::"$url/archive/refs/tags/${pkgver}.zip"
)
sha256sums=(
'99048f718282214af1b1263b6e63fc492611513af5b4de7aab6881c0e2754090'
)
prepare() {
cat <<'EOF' > "$_pkgname.sh"
#!/usr/bin/env sh
set -e
APPDIR="/opt/logseq-desktop"
_ELECTRON="${APPDIR}/Logseq"
_FLAGS_FILE="${XDG_CONFIG_HOME:-$HOME/.config}/logseq-flags.conf"
if [ -r "$_FLAGS_FILE" ]; then
_USER_FLAGS="$(cat "$_FLAGS_FILE")"
fi
if [[ $EUID -ne 0 ]] || [[ $ELECTRON_RUN_AS_NODE ]]; then
exec ${_ELECTRON} $_USER_FLAGS "$@"
else
exec ${_ELECTRON} --no-sandbox $_USER_FLAGS "$@"
fi
EOF
local _gendesk_options=(
-q -f -n
--pkgname="$_pkgname"
--pkgdesc="$pkgdesc"
--name="Logseq"
--exec="logseq %u"
--icon="logseq"
--terminal=false
--categories="Office"
--mimetypes="x-scheme-handler/logseq"
--startupnotify=true
--custom="StartupWMClass=Logseq"
)
gendesk "${_gendesk_options[@]}"
cd "$_pkgsrc"
# download required js modules
yarn install
# create and sync files to folder `static`
yarn gulp:build
# go to folder `static` and download required js modules in static
cd "static"
yarn install
# go back to the top-level folder and download clojure dependencies
cd "${srcdir}/$_pkgsrc"
clojure -P -M:cljs
}
build() {
cd "$_pkgsrc"
# build
yarn cljs:release
# packaging javescript files to an executable
cd "static"
yarn electron-forge package
}
package() {
# create destination folder and copy files
install -dm755 "$pkgdir/opt/$_pkgname"
cp --reflink=auto -a -r -u --verbose "$_pkgsrc/static/out/Logseq-linux-x64"/* "$pkgdir/opt/$_pkgname"
# User flag aware launcher
install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/logseq"
# create license folder and make soft links to actual license
install -dm755 "$pkgdir/usr/share/licenses/$pkgname/"
ln -s "/opt/$_pkgname/LICENSE" "$pkgdir/usr/share/licenses/$pkgname/"
ln -s "/opt/$_pkgname/LICENSES.chromium.html" "$pkgdir/usr/share/licenses/$pkgname/"
# install readme and additional license file (the top-level AGPL3)
install -Dm644 "$_pkgsrc/README.md" -t "$pkgdir/usr/share/doc/$pkgname/"
install -Dm644 "$_pkgsrc/LICENSE.md" -t "$pkgdir/usr/share/licenses/$pkgname/"
# copy xdg desktop files
install -dm755 "$pkgdir/usr/share/applications"
install -Dm644 "$_pkgname.desktop" -t "$pkgdir/usr/share/applications"
}
|