summarylogtreecommitdiffstats
path: root/PKGBUILD
blob: 08b69882fe427540f7e3f9294f9d53e629245889 (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
# Maintainer: Chi_Tang <me@chitang.dev>
# Maintainer: Integral <integral@member.fsf.org>

pkgname=nekoray
pkgver=4.0.1
_pkgver=${pkgver/.beta/-beta}
pkgrel=2
pkgdesc="Qt based cross-platform GUI proxy configuration manager (backend: sing-box)"
arch=('x86_64' 'aarch64' 'riscv64')
url="https://matsuridayo.github.io"
license=('GPL-3.0-or-later')
makedepends=('cmake' 'git' 'go')
depends=(
	'qt6-base' 'qt6-svg' 'qt6-tools'
	'protobuf' 'yaml-cpp' 'zxing-cpp'
	'abseil-cpp'
)
optdepends=(
	'sing-geoip: geoip data for NekoBox'
	'sing-geosite: geosite data for NekoBox'
)
source=(
	"git+https://github.com/MatsuriDayo/${pkgname}.git#tag=${_pkgver}"
	"git+https://github.com/Skycoder42/QHotkey.git"
	"nekobox.sh"
	"nekobox.desktop"
)
sha512sums=('711e677fcb925367959b073d1287a721c253db4213fdf3e77c0d7d7042e47d4809ec7549f0e446ac5e9f1e73da68642bf09dd7c3dbea672443d89413ebbfb688'
            'SKIP'
            '3a65300520462bd6a5667c50b7db1ccbf7107b9d5c65959d00451a68cdd77d9e13288da03ccb0d712cd4fb076cdfb3c635490d6148268f920cde7ba11b7237a9'
            'f99795f5f82fca74bbc36569d3595bc141c3fef00a0c6076585da683f0a5144dbfdbbe4525cf82576e9010262f74f462ae40f5a7b95dafc01033763a9b1711bd')

prepare() {
	cd "${pkgname}/"

	git submodule init
	git config submodule.3rdparty/QHotkey.url "${srcdir}/QHotkey"
	git -c protocol.file.allow=always submodule update

	./libs/get_source.sh
}

build() {
	cd "${pkgname}/"

	cmake -B build -DQT_VERSION_MAJOR=6 -DNKR_PACKAGE=ON
	cmake --build build

	export GOARCH

	case $CARCH in
	x86_64) GOARCH=amd64 ;;
	aarch64) GOARCH=arm64 ;;
	riscv64) GOARCH=riscv64 ;;
	esac

	GOOS=linux ./libs/build_go.sh
}

package() {
	# Assets
	install -Dm644 nekobox.desktop -t "${pkgdir}/usr/share/applications/"
	install -Dm644 "${pkgname}/res/public/nekobox.png" -t "${pkgdir}/usr/share/pixmaps/"

	# Core
	local core_srcdir=linux

	case $CARCH in
	x86_64) core_srcdir+=64 ;;
	aarch64) core_srcdir+=-arm64 ;;
	riscv64) core_srcdir+=-riscv64 ;;
	esac

	install -Dm755 "${pkgname}/deployment/${core_srcdir}/nekobox_core" -t "${pkgdir}/usr/lib/nekobox/"

	# Binary file
	install -Dm755 "${pkgname}/build/nekobox" -t "${pkgdir}/usr/lib/nekobox/"

	# Launcher
	install -Dm755 nekobox.sh "${pkgdir}/usr/bin/nekobox"
}