aboutsummaryrefslogtreecommitdiffstats
path: root/main/glslang/APKBUILD
blob: edf70e806df7b8aea66dc9598fd02dc4b35b5433 (plain) (blame)
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
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer:
pkgname=glslang
pkgver=8.13.3743
pkgrel=1
pkgdesc="Khronos reference front-end for GLSL, ESSL, and sample SPIR-V generator"
url="https://github.com/KhronosGroup/glslang"
arch="all"
license="BSD-3-Clause"
depends_dev="$pkgname"
makedepends="cmake samurai python3 bison spirv-tools-dev"
checkdepends="bash"
subpackages="$pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/KhronosGroup/glslang/archive/$pkgver.tar.gz
	pkgconfig.patch
	default-resources.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	mkdir -p build-shared build-static
	(cd build-shared
		cmake \
			-GNinja \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DCMAKE_INSTALL_LIBDIR=lib \
			-DCMAKE_BUILD_TYPE=None \
			-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
			-DCMAKE_C_FLAGS="$CFLAGS" \
			-DBUILD_SHARED_LIBS=ON \
			$CMAKE_CROSSOPTS ..
		ninja
	)
	sed -i '/add_library(glslang-default-resource-limits/ s/$/ STATIC/' StandAlone/CMakeLists.txt
	(cd build-static
		cmake \
			-GNinja \
			-DCMAKE_INSTALL_PREFIX=/usr \
			-DCMAKE_INSTALL_LIBDIR=lib \
			-DCMAKE_BUILD_TYPE=None \
			-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
			-DCMAKE_C_FLAGS="$CFLAGS" \
			-DBUILD_SHARED_LIBS=OFF \
			$CMAKE_CROSSOPTS ..
		ninja
	)
}

check() {
	case "$CARCH" in
		s390x|mips64) return 0;; # testsuite seems to fail on big endian
	esac
	cd Test
	msg "Testing shared version of glslang"
	./runtests localResults ../build-shared/StandAlone/glslangValidator ../build-shared/StandAlone/spirv-remap
	msg "Testing static version of glslang"
	./runtests localResults ../build-static/StandAlone/glslangValidator ../build-static/StandAlone/spirv-remap
}

package() {
	DESTDIR="$pkgdir" ninja -C build-shared install
	DESTDIR="$pkgdir" ninja -C build-static install
}

sha512sums="19169c4ffa511113978af8e8efc57b290d4aa962a4c2429dbea1af72204787c6ce20ffbbb452dc04bef5416e00510819d84463a2e76295b9a59b409e12af6792  glslang-8.13.3743.tar.gz
9490ed637a8f4a032fb0e0d266843b4ffccedce5983de1f16f96348c7b8340d4d8791f3a6a247f53ef5ea256deecf674d8cf0030d77b7d7d396091aed5bbb404  pkgconfig.patch
f526443c070fc3e4639cdec0a4876e5a75529af4cf41282ba23b0d9234434f764bf55b93aaaf7ed1de757193842f3d0b51437cf62c41d955dd86907fcc1a911e  default-resources.patch"