summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: d098cedac5ed495e739cf79fbd55849a54495c68 (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
# Maintainer: j4qfrost <j4qfrost at gmail dot com>
# Maintainer: ptolemy753 <dsconce at protonmail dot com>
# Maintainer: peeweep <peeweep at 0x0 dot ee>
# Contributor: Caleb Maclennan <caleb@alerque.com>

pkgname=neovide-git
_pkgname=${pkgname%-git}
pkgver=0.11.2.r18.g5743356
pkgrel=1
pkgdesc='No Nonsense Neovim Client in Rust'
arch=(x86_64)
url="https://github.com/$_pkgname/$_pkgname"
license=(MIT)
depends=(gcc-libs
         glibc
         fontconfig libfontconfig.so
         freetype2 libfreetype.so
         hicolor-icon-theme
         libglvnd
         neovim
         sndio)
makedepends=(cargo
             cmake
             git
             gtk3
             python
             sdl2)
optdepends=('vulkan-intel: vulkan support for intel')
provides=("$_pkgname=$pkgver")
conflicts=("$_pkgname")
source=("$_pkgname::git+$url.git")
sha256sums=('SKIP')

prepare() {
	cd "$_pkgname"
	sed -i -e '/^incremental/a opt-level = 3' Cargo.toml
	cargo fetch --locked --target "$CARCH-unknown-linux-gnu"
}

pkgver() {
	cd "$_pkgname"
	git describe --long --tags | sed 's/\([^-]*-g\)/r\1/;s/-/./g'
}

build() {
	cd "$_pkgname"
	export RUSTUP_TOOLCHAIN=stable
	export CARGO_TARGET_DIR=target
	# this uses malloc_usable_size, which is incompatible with fortification level 3
	# upstream tracking issue https://github.com/neovide/neovide/issues/2040
	export CFLAGS="${CFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
	export CXXFLAGS="${CXXFLAGS/_FORTIFY_SOURCE=3/_FORTIFY_SOURCE=2}"
	CFLAGS+=' -ffat-lto-objects'
	export SKIA_USE_SYSTEM_LIBRARIES=true
	cargo build --frozen --release --features embed-fonts
}

package() {
	cd "$_pkgname"
	install -Dm0755 -t "$pkgdir/usr/bin/" "target/release/$_pkgname"
	install -Dm0644 -t "$pkgdir/usr/share/applications/" "assets/$_pkgname.desktop"
	for px in 16 32 48 256; do
		install -Dm0644 "assets/$_pkgname-${px}x${px}.png" \
			"$pkgdir/usr/share/icons/hicolor/${px}x${px}/apps/$_pkgname.png"
	done
	install -Dm0644 -t "$pkgdir/usr/share/licenses/$pkgname/" LICENSE
}