aboutsummarylogtreecommitdiffstats
path: root/PKGBUILD
blob: b21ab5d9c6769566412bb787d8f8957a814bd7b9 (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
# Maintainer: xiliuya <xiliuya@aliyun.com>

pkgname=lightpanda
pkgver=0.3.6
pkgrel=2
pkgdesc="Headless browser designed for AI and automation - 11x faster than Chrome, 9x less memory"
arch=('x86_64' 'aarch64')
url="https://lightpanda.io"
license=('AGPL-3.0-only')
provides=('lightpanda')
makedepends=('zig' 'rust' 'cargo' 'git' 'python3')

source=(lightpanda_${pkgver}.tar.gz::https://github.com/lightpanda-io/browser/archive/refs/tags/${pkgver}.tar.gz)
sha256sums=('5c2dd0f0dd93d67f5eb4394d9a778fcfd35cdcf3cae0403caf9d2a023e65a479')
build() {
    zig version
	cd "browser-${pkgver}"

	if [[ "$CARCH" == "x86_64" ]]; then
		msg2 "Optional: enable AVX build with:   ENABLE_AVX=1 makepkg -si"
		if [[ "$ENABLE_AVX" == "1" ]]; then
			msg2 $'\e[32mBuilding with AVX\e[0m'
			ZIG_CPU="x86_64_v3"
		else
			msg2 $'\e[32mBuilding baseline (no AVX)\e[0m'
			ZIG_CPU="x86_64"
		fi
	else
		ZIG_CPU="aarch64"
	fi

	printf "\033[36mBuilding v8 snapshot (release safe)...\033[0m\n"
	zig build -Doptimize=ReleaseFast -Dcpu="$ZIG_CPU" snapshot_creator -- src/snapshot.bin || (
		printf "\033[33mBuild ERROR\033[0m\n"
		exit 1
	)
	printf "\033[33mBuild OK\033[0m\n"

	printf "\033[36mBuilding (release fast)...\033[0m\n"
	zig build -Doptimize=ReleaseFast -Dcpu="$ZIG_CPU" -Dsnapshot_path=../../snapshot.bin || (
		printf "\033[33mBuild ERROR\033[0m\n"
		exit 1
	)
	printf "\033[33mBuild OK\033[0m\n"

}

package() {
	install -Dm755 "${srcdir}/browser-${pkgver}/zig-out/bin/lightpanda" "$pkgdir/usr/bin/lightpanda"
	chmod +x "$pkgdir/usr/bin/lightpanda"
}