blob: 2a150fba6ba4a4665dfde43d2d05ebe3b357c44b (
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
|
# Maintainer: Noam Lewis
#
# Source package - builds from source
pkgname=fresh-editor
pkgver=0.5.8
pkgrel=1
pkgdesc="A lightweight, fast terminal-based text editor with LSP support and TypeScript plugins"
url="https://sinelaw.github.io/fresh/"
license=("GPL-3.0-or-later")
arch=('x86_64' 'aarch64')
depends=("gcc-libs" "glibc")
makedepends=("cargo" "clang")
provides=("fresh-editor")
conflicts=("fresh-editor-bin")
# `!lto`: makepkg's default `lto` option adds -flto=auto to CFLAGS, so clang
# emits the C dependencies (QuickJS, ...) as LLVM bitcode. rustc then links
# with its own bundled rust-lld, which cannot read bitcode from a newer system
# clang ("Unknown attribute kind (105)"). Plain object files have no LLVM
# version coupling; Rust's own LTO (profile.release) is unaffected.
options=('!debug' '!lto')
source=("fresh-editor-${pkgver}-source.tar.gz::https://github.com/sinelaw/fresh/releases/download/v${pkgver}/fresh-editor-${pkgver}-source.tar.gz")
sha256sums=("a36fa779b44a76ee589bd66a4d91a216ed9e3995ceca9f1a5811935fbb6eb5d3")
prepare() {
cd "fresh-$pkgver"
cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')"
}
build() {
cd "fresh-$pkgver"
export CARGO_TARGET_DIR=target
export CC=clang
# Bake the install channel into the binary (compile-time provenance).
export FRESH_BUILD_CHANNEL=aur
# `web` is opt-in in Cargo.toml (it embeds the browser UI and pulls in the
# sha1 WebSocket-handshake dep), so it has to be named here or the package
# ships a `fresh` that rejects `--web` (#3316).
cargo build --locked --release --features web
}
package() {
cd "fresh-$pkgver"
# Binary (installed alongside plugins, symlinked from /usr/bin)
install -Dm755 target/release/fresh "$pkgdir/usr/share/$pkgname/fresh"
install -dm755 "$pkgdir/usr/bin"
ln -s "/usr/share/$pkgname/fresh" "$pkgdir/usr/bin/fresh"
# Documentation
install -Dm644 README.md "$pkgdir/usr/share/doc/$pkgname/README.md"
# License
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# Provenance receipt (belt-and-suspenders alongside the embedded channel).
cat > "$pkgdir/usr/share/$pkgname/install-receipt.toml" <<EOF
schema = 1
channel = "aur"
version = "$pkgver"
package_name = "fresh-editor"
managed = true
self_update = false
[hints]
aur_pkg = "fresh-editor"
EOF
# Plugins
cp -r crates/fresh-editor/plugins "$pkgdir/usr/share/$pkgname/"
# Keymaps
cp -r crates/fresh-editor-core/keymaps "$pkgdir/usr/share/$pkgname/"
# Desktop file
install -Dm644 crates/fresh-editor/resources/fresh.desktop "$pkgdir/usr/share/applications/fresh.desktop"
# Hicolor icons
for icon in docs/icons/linux/hicolor/*/apps/fresh.png; do
size=$(basename $(dirname $(dirname "$icon")))
install -Dm644 "$icon" "$pkgdir/usr/share/icons/hicolor/${size}/apps/fresh.png"
done
}
|