blob: da3eeebb9f0a8414dc11ec95b3345671edc6ff1b (
plain)
1 # Description: A collection of tools, libraries and tests for shader compilation.
2 # URL: https://github.com/google/shaderc
3 # Maintainer: Danny Rawlins, crux at romster dot me
4 # Depends on: glslang
5 # Optional: asciidoctor
6
7 name=shaderc
8 version=2020.3
9 release=1
10 source=(https://github.com/google/$name/archive/v$version/$name-v$version.tar.gz
11 glslc.1 spvc.1 glslc-asciidoc.patch spvc-asciidoc.patch
12 0001-Drop-third-party-code-in-CMakeLists.txt.patch
13 shaderc-2020.3-system-glslang.patch
14 0001-Fix-SPIRV-includes-location.patch)
15
16 build() {
17 cd $name-$version
18
19 patch -d glslc -p0 -i $SRC/glslc-asciidoc.patch
20 patch -d spvc -p0 -i $SRC/spvc-asciidoc.patch
21
22 patch -p1 -i $SRC/0001-Drop-third-party-code-in-CMakeLists.txt.patch
23 patch -p1 -i $SRC/0001-Fix-SPIRV-includes-location.patch
24 patch -p1 -i $SRC/shaderc-2020.3-system-glslang.patch
25
26 # de-vendor libs and disable git versioning
27 sed '/examples/d;/third_party/d' -i CMakeLists.txt
28 sed '/build-version/d' -i glslc/CMakeLists.txt
29 cat <<- EOF > glslc/src/build-version.inc
30 "${version}\\n"
31 "$(prt-get info spirv-tools | awk '/^Version:/ {print $2}')\\n"
32 "$(prt-get info glslang | awk '/^Version:/ {print $2}')\\n"
33 EOF
34
35 mkdir build
36 cd build
37
38 cmake .. \
39 -DCMAKE_BUILD_TYPE=Release \
40 -DCMAKE_INSTALL_PREFIX=/usr \
41 -DCMAKE_INSTALL_LIBDIR=lib \
42 -DSHADERC_SKIP_TESTS=ON \
43 -GNinja
44
45 ninja -j ${JOBS:-1}
46
47 DESTDIR=$PKG ninja install
48
49 if [ -e '/usr/bin/asciidoctor' ]; then
50 cd ../glslc
51 asciidoctor -b manpage README.asciidoc -o glslc.1
52 install -D -m 0644 -t $PKG/usr/share/man/man1 glslc.1
53
54 cd ../spvc
55 asciidoctor -b manpage README.asciidoc -o spvc.1
56 install -D -m 0644 -t $PKG/usr/share/man/man1 spvc.1
57 else
58 install -D -m 0644 -t $PKG/usr/share/man/man1 $SRC/glslc.1
59 install -D -m 0644 -t $PKG/usr/share/man/man1 $SRC/spvc.1
60 fi
61 }
|