forked from ports/contrib
54 lines
1.8 KiB
Plaintext
54 lines
1.8 KiB
Plaintext
# Description: A collection of tools, libraries and tests for shader compilation.
|
|
# URL: https://github.com/google/shaderc
|
|
# Maintainer: Danny Rawlins, crux at romster dot me
|
|
# Depends on: glslang spirv-tools
|
|
# Optional: asciidoctor
|
|
|
|
name=shaderc
|
|
version=2021.1
|
|
## DEPS
|
|
_spirv_headers=07f259e68af3a540038fa32df522554e74f53ed5
|
|
release=1
|
|
source=(https://github.com/google/shaderc/archive/v$version/$name-v$version.tar.gz
|
|
https://github.com/KhronosGroup/SPIRV-Headers/archive/$_spirv_headers/SPIRV-Headers-$_spirv_headers.tar.gz
|
|
glslc.1)
|
|
|
|
build() {
|
|
mkdir -p $name-$version/third_party/spirv-headers
|
|
mv SPIRV-Headers-$_spirv_headers/* $name-$version/third_party/spirv-headers
|
|
|
|
# de-vendor libs and disable git versioning
|
|
sed '/examples/d;/third_party/d' -i $name-$version/CMakeLists.txt
|
|
sed '/build-version/d' -i $name-$version/glslc/CMakeLists.txt
|
|
cat <<- EOF > $name-$version/glslc/src/build-version.inc
|
|
"${version}\\n"
|
|
"$(prt-get info spirv-tools | awk '/^Version:/ {print $2}')\\n"
|
|
"$(prt-get info glslang | awk '/^Version:/ {print $2}')\\n"
|
|
EOF
|
|
|
|
prt-get isinst ninja && PKGMK_SHADERC+=' -G Ninja'
|
|
|
|
cmake -S $name-$version -B build $PKGMK_SHADERC \
|
|
-D CMAKE_INSTALL_PREFIX=/usr \
|
|
-D CMAKE_INSTALL_LIBDIR=lib \
|
|
-D CMAKE_BUILD_TYPE=Release \
|
|
-D CMAKE_CXX_FLAGS_RELEASE="$CXXFLAGS" \
|
|
-D CMAKE_C_FLAGS_RELEASE="$CFLAGS" \
|
|
-D CMAKE_EXE_LINKER_FLAGS="$LDFLAGS -Wl,-z,defs" \
|
|
-D SHADERC_SKIP_TESTS=ON \
|
|
-D glslang_SOURCE_DIR:PATH='/usr/include/glslang' \
|
|
-D SPIRV-Headers_SOURCE_DIR:PATH="$SRC/$name-$version/third_party/spirv-headers"
|
|
|
|
cmake --build build -j ${JOBS:-1}
|
|
DESTDIR=$PKG cmake --install build
|
|
|
|
if [ -e '/usr/bin/asciidoctor' ]; then
|
|
cd $name-$version/glslc
|
|
asciidoctor -b manpage README.asciidoc -o glslc.1
|
|
install -D -m 0644 -t $PKG/usr/share/man/man1 glslc.1
|
|
cd -
|
|
else
|
|
install -D -m 0644 -t $PKG/usr/share/man/man1 $SRC/glslc.1
|
|
fi
|
|
}
|