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

pkgname=nekoray
pkgver=4.0.beta3
_pkgver=${pkgver/.beta/-beta}
pkgrel=5
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' 'ninja' '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}"
	"nekobox.sh"
	"nekobox.desktop"
	"https://github.com/MatsuriDayo/nekoray/pull/1350.patch"
)
sha512sums=('86a5bd9c86b12b1bee5678917bf9c3da744b02141589cc737b3ba65dc918f7abb881a899aed47be11b0a0ae09511be1bedd0a8a8819a20efe6a2874efe942bb0'
            '3a65300520462bd6a5667c50b7db1ccbf7107b9d5c65959d00451a68cdd77d9e13288da03ccb0d712cd4fb076cdfb3c635490d6148268f920cde7ba11b7237a9'
            'f99795f5f82fca74bbc36569d3595bc141c3fef00a0c6076585da683f0a5144dbfdbbe4525cf82576e9010262f74f462ae40f5a7b95dafc01033763a9b1711bd'
            '132b4c9b278baf494ddf6739f0188253ed3830b6fb7b232be0029f52ad7c04a6fb0210cc330330e84f82d1def7b88f7911caf7db23c28ac9f8a91a8386437f8f')

prepare() {
	cd "${pkgname}/"
	patch -p1 <../1350.patch # Add /usr/share/sing-box to core asset search path
}

build() {
	cd "${pkgname}/"
	git submodule init
	git submodule update
	bash libs/get_source.sh

	mkdir build
	cd build
	cmake -GNinja -DQT_VERSION_MAJOR=6 -DNKR_PACKAGE=ON ..
	ninja

	cd ..

	export GOARCH

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

	GOOS=linux ./libs/build_go.sh
}

package() {
	install -dm755 "${pkgdir}/usr/bin/"

	# 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"
}