aboutsummaryrefslogtreecommitdiffstats
path: root/community/shaderc/APKBUILD
blob: 4812917e546d5d2cb375d0c53894fbc47847dca3 (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
# Contributor: Leo <thinkabit.ukim@gmail.com>
# Maintainer: Leo <thinkabit.ukim@gmail.com>
pkgname=shaderc
pkgver=2019.0
pkgrel=1
pkgdesc="A collection of tools, libraries, and tests for Vulkan shader compilation"
options="!check" # Fails to configure when tests are enabled
url="https://github.com/google/shaderc"
arch="all"
license="Apache-2.0"
makedepends="cmake glslang-static glslang-dev spirv-tools-dev python3"
subpackages="$pkgname-static $pkgname-dev"
source="$pkgname-$pkgver.tar.gz::https://github.com/google/shaderc/archive/v$pkgver.tar.gz
	fix-link-order.patch
	"

prepare() {
	default_prepare
	# Unbundle glslang, SPIRV-Headers and SPIRV-Tools, also don't build examples
	sed -i \
		-e '/add_subdirectory(third_party)/d' \
		-e '/add_subdirectory(examples)/d' CMakeLists.txt

	# Disable git versioning
	sed -i -e '/build-version/d' glslc/CMakeLists.txt

	# Create our own build-version.inc since we disabled git versioning
	# need to keep this in sync with glslang and SPIRV-Tools versions
	# this is displayed with 'glslc --version'
	cat <<- EOF > glslc/src/build-version.inc
		"shaderc 2019.0\n"
		"SPIRV-Tools-2019.3\n"
		"glslang-7.11.3214\n"
	EOF

	mkdir -p "$builddir"/build
}

build() {
	cd build

	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=Release \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		-DSHADERC_SKIP_TESTS=ON \
		-DSHADERC_ENABLE_NV_EXTENSIONS=OFF \
		${CMAKE_CROSSOPTS} ..
	make
}

package() {
	make -C build DESTDIR="$pkgdir" install
}

sha512sums="c76887ad0a96145211b6550b0dfe63091df9e1463f9a3140aba2d1982c33e98ad14fb4bcf9ce2281433fc77626fc892c268d0636b9f348a159dd06e3f41b461a  shaderc-2019.0.tar.gz
bd24c90b93bf8bd7e56682e02543ff8a5c988549e76502144c2f4904e96b67ca0bc9d1e94b811bcdad1e765625256d3feabeb20ca299f2abb220e6e398d5a590  fix-link-order.patch"