blob: 97aed7fd8eb88ecc80a96ed8c4ef835be62989c9 (
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
|
# Maintainer: Caleb Maclennan <caleb@alerque.com>
# Contributor: Gabriel Saillard (GitSquared) <gabriel@saillard.dev>
# Contributor: David Birks <david@tellus.space>
# Contributor: Simon Doppler (dopsi) <dop.simon@gmail.com>
# Contributor: dpeukert
# Contributor: lonaowna
pkgname=marktext-git
_pkgname=${pkgname%-git}
pkgver=0.16.3.r2.gf501ef4
pkgrel=1
pkgdesc='A simple and elegant open-source markdown editor that focused on speed and usability'
arch=(x86_64)
url='https://marktext.app'
_url="https://github.com/$_pkgname/$_pkgname"
license=(MIT)
_electron=electron17
depends=("$_electron"
libxkbfile
libsecret
openssl
ripgrep)
makedepends=(git
jq
moreutils
node-gyp
nodejs-lts-hydrogen
npm
yarn
yq)
provides=("$_pkgname-$pkgver")
conflicts=("$_pkgname")
source=("$pkgname::git+https://github.com/$_pkgname/${pkgname/-/.}"
"$_pkgname.sh"
"$_pkgname-arg-handling.patch")
sha256sums=('SKIP'
'8f37f164a642a536b75f54b49e7c7a7c1e4d355a91dd8ece4cab6a95b42d369e'
'c754a1cad52d10a38eeddb9293ce0a4540296c6adbb47eb5311eaaeded150a01')
pkgver() {
cd "$pkgname"
git describe --long --tags --abbrev=7 --match="v*" HEAD |
sed 's/^v//;s/\([^-]*-g\)/r\1/;s/-/./g'
}
prepare() {
local _electronDist=$(dirname $(realpath $(which $_electron)))
local _electronVersion=$($_electron --version | sed -e 's/^v//')
cd "$pkgname"
jq 'del(.devDependencies["electron"], .scripts["preinstall", "postinstall"])' \
package.json | sponge package.json
yq -y ". + {\"electronDist\": \"$_electronDist\", \"electronVersion\": \"$_electronVersion\"}" \
electron-builder.yml | sponge electron-builder.yml
mkdir -p "$srcdir/node_modules"
yarn --cache-folder "$srcdir/node_modules" install --frozen-lockfile
yarn --cache-folder "$srcdir/node_modules" add -D --no-lockfile --ignore-scripts electron@$_electronVersion
patch -p1 < "$srcdir/$_pkgname-arg-handling.patch"
}
build() {
cd "$pkgname"
yarn --cache-folder "$srcdir/node_modules" run \
electron-rebuild
node .electron-vue/build.js
yarn --cache-folder "$srcdir/node_modules" run \
electron-builder --linux --x64 --dir
sed -e "s/@ELECTRON@/$_electron/" "../$pkgname.sh" > "$pkgname"
}
package() {
cd "$pkgname"
install -Dm755 "$_pkgname.sh" "$pkgdir/usr/bin/$_pkgname"
local _dist=build/linux-unpacked/resources
install -Dm644 -t "$pkgdir/usr/lib/$_pkgname/" "$_dist/app.asar"
cp -a "$_dist"/{app.asar.unpacked,hunspell_dictionaries} "$pkgdir/usr/lib/$_pkgname/"
local _rg_path="$pkgdir/usr/lib/marktext/app.asar.unpacked/node_modules/vscode-ripgrep/bin/"
mkdir -p $_rg_path
ln -sf /usr/bin/rg "$_rg_path"
install -Dm0755 -t "${pkgdir}/usr/share/applications/" resources/linux/marktext.desktop
install -Dm0755 -t "${pkgdir}/usr/share/metainfo/" resources/linux/marktext.appdata.xml
install -Dm0644 resources/icons/icon.png "${pkgdir}/usr/share/pixmaps/marktext.png"
install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
install -Dm0644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md CONTRIBUTING.md
cp -a docs "$pkgdir/usr/share/doc/$pkgname/"
pushd "resources/icons"
find -name maktext.png -exec \
install -Dm644 {} "$pkgdir/usr/share/icons/hicolor/{}" \;
}
|