blob: d2a2881b3e010c9bc4988f449025ec3314afb4bd (
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
|
# Maintainer: envolution
# Contributor: Lindasy Zhou <i@lin.moe>
# shellcheck shell=bash disable=SC2034,SC2154
_pkgname="memos"
pkgname="memos-git"
pkgver=0.23.0.rc.3+r3157+gf15346e61
pkgrel=1
pkgdesc="A privacy-first, lightweight note-taking service. Easily capture and share your great thoughts."
url="https://github.com/usememos/memos"
arch=("any")
license=('MIT')
makedepends=("go" "git" "npm" "pnpm" "nvm")
backup=('etc/memos.conf')
options=(!strip !debug)
provides=('memos')
conflicts=('memos')
source=(
"git+https://github.com/usememos/$_pkgname.git"
"systemd.service"
"sysusers.conf"
"memos.conf"
'tmpfiles.conf'
)
sha512sums=('SKIP'
'9c37361974d8b3beecdd8b0bf8db929a4a882623ea7b23aa51bddf37790b66042cef593d6da89b34e7dde4a9a9a1e097ea31ec713b33fee6a699448fb300d4a2'
'692dc4674b86b36c5464c78f493ace50091068f962d40130a32b4ed17517d77e33860333e870f5e80a5e17b6cbd5de45bf57e7de5ea7984bd4e36f95a8daf0fa'
'251e01c4f5fc8aea209453d91da5dde91d58397668e34b78e52a31940e30a89be5601a6ea8cdebe791a96c9324733095de3567998b45ce1542578b1d9b7a5b76'
'cf88b91a88825dcfda35f45461513b8a2e03b07890189fd1cf7b60aa4085c9e88d8338596b69a3d9c3e513e668093ab7cb246febbb7f6ac7796d37e1189db565')
pkgver() {
cd "$srcdir/$_pkgname"
_version=$(git tag --sort=-v:refname --list | head -n1 | tr - .)
_commits=$(git rev-list --count HEAD)
_short_commit_hash=$(git rev-parse --short=9 HEAD)
echo "${_version#'v'}+r${_commits}+g${_short_commit_hash}"
}
_ensure_local_nvm() {
export NVM_DIR="${srcdir}/.nvm"
source /usr/share/nvm/init-nvm.sh || [[ $? != 1 ]]
nvm install
nvm use
echo "in _ensure nvm dir = ${NVM_DIR}"
}
build() {
export COREPACK_ENABLE_STRICT=0
export COREPACK_ENABLE_DOWNLOAD_PROMPT=0
cd $_pkgname/web
# Build frontend
echo "lts/iron" >.nvmrc
_ensure_local_nvm
pnpm install --frozen-lockfile
pnpm build
# Set up backend build environment
mkdir -p "$srcdir/$_pkgname/backend_build_dir/server/router/frontend/dist/"
rm -rf "${srcdir}/${_pkgname}/server/router/frontend/dist"
cp -r "$srcdir/$_pkgname/web/dist" "$srcdir/$_pkgname/server/router/frontend/"
# Compile the backend Go binary
CGO_ENABLED=0 go build -o "$srcdir/${_pkgname}.bin" "$srcdir/$_pkgname/bin/memos/main.go"
}
package() {
install -vDm644 systemd.service "$pkgdir/usr/lib/systemd/system/${_pkgname}.service"
install -vDm644 sysusers.conf "$pkgdir/usr/lib/sysusers.d/${_pkgname}.conf"
install -vDm644 tmpfiles.conf "$pkgdir/usr/lib/tmpfiles.d/${_pkgname}.conf"
install -vDm644 memos.conf "$pkgdir/etc/memos.conf"
pwd
ls -latr
install -Dm755 "memos.bin" "$pkgdir/usr/bin/memos"
install -Dm0644 "${_pkgname}/LICENSE" "$pkgdir/usr/share/licenses/${_pkgname}/LICENSE"
}
# vim:set ts=2 sw=2 et:
|