diff options
author | Hunter Sezen <orbea@riseup.net> | 2019-08-10 06:53:30 +0700 |
---|---|---|
committer | Willy Sudiarto Raharjo <willysr@slackbuilds.org> | 2019-08-10 06:53:30 +0700 |
commit | 25d7992a5d2b2f2bec1d0ad6ab846a85c6b8a501 (patch) | |
tree | d520065eb9a4b245733618e413433286ab2d3342 | |
parent | c757d6e2b846620175d88ec8de452b86e7496a7a (diff) |
graphics/shaderc: Added (Shader tools, libraries and tests).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
-rw-r--r-- | graphics/shaderc/README | 2 | ||||
-rw-r--r-- | graphics/shaderc/fix-glslang-link-order.patch | 44 | ||||
-rw-r--r-- | graphics/shaderc/shaderc.SlackBuild | 118 | ||||
-rw-r--r-- | graphics/shaderc/shaderc.info | 10 | ||||
-rw-r--r-- | graphics/shaderc/slack-desc | 19 |
5 files changed, 193 insertions, 0 deletions
diff --git a/graphics/shaderc/README b/graphics/shaderc/README new file mode 100644 index 0000000000000..9a0f3f00d777a --- /dev/null +++ b/graphics/shaderc/README @@ -0,0 +1,2 @@ +A collection of tools, libraries, and tests for Vulkan shader +compilation. diff --git a/graphics/shaderc/fix-glslang-link-order.patch b/graphics/shaderc/fix-glslang-link-order.patch new file mode 100644 index 0000000000000..ad7de1f33b121 --- /dev/null +++ b/graphics/shaderc/fix-glslang-link-order.patch @@ -0,0 +1,44 @@ +From 21c8be385b3fab5edcb934a6d99f69fd389c4e67 Mon Sep 17 00:00:00 2001 +From: Niklas Haas <git@haasn.xyz> +Date: Tue, 29 May 2018 07:34:00 +0200 +Subject: [PATCH] Fix the link order of libglslang and libHLSL + +libglslang depends on libHLSL, so the latter needs to be specified last. +This fixes an issue when trying to build shaderc against system-wide +versions of libglslang/libHLSL, rather than the in-tree versions from +third_party. + +Additionally, libshaderc_util also depends on SPIRV-Tools +--- + glslc/CMakeLists.txt | 2 +- + libshaderc_util/CMakeLists.txt | 4 ++-- + 2 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/glslc/CMakeLists.txt b/glslc/CMakeLists.txt +index acf6fb0..0f5d888 100644 +--- a/glslc/CMakeLists.txt ++++ b/glslc/CMakeLists.txt +@@ -18,7 +18,7 @@ add_library(glslc STATIC + shaderc_default_compile_options(glslc) + target_include_directories(glslc PUBLIC ${glslang_SOURCE_DIR}) + target_link_libraries(glslc PRIVATE glslang OSDependent OGLCompiler +- HLSL glslang SPIRV ${CMAKE_THREAD_LIBS_INIT}) ++ glslang SPIRV HLSL ${CMAKE_THREAD_LIBS_INIT}) + target_link_libraries(glslc PRIVATE shaderc_util shaderc) + + add_executable(glslc_exe src/main.cc) +diff --git a/libshaderc_util/CMakeLists.txt b/libshaderc_util/CMakeLists.txt +index 873540a..6d0c465 100644 +--- a/libshaderc_util/CMakeLists.txt ++++ b/libshaderc_util/CMakeLists.txt +@@ -34,8 +34,8 @@ endif(SHADERC_ENABLE_INSTALL) + + find_package(Threads) + target_link_libraries(shaderc_util PRIVATE +- glslang OSDependent OGLCompiler HLSL glslang SPIRV +- SPIRV-Tools-opt ${CMAKE_THREAD_LIBS_INIT}) ++ glslang OSDependent OGLCompiler glslang HLSL SPIRV ++ SPIRV-Tools-opt SPIRV-Tools ${CMAKE_THREAD_LIBS_INIT}) + + shaderc_add_tests( + TEST_PREFIX shaderc_util diff --git a/graphics/shaderc/shaderc.SlackBuild b/graphics/shaderc/shaderc.SlackBuild new file mode 100644 index 0000000000000..bf2c19eafba88 --- /dev/null +++ b/graphics/shaderc/shaderc.SlackBuild @@ -0,0 +1,118 @@ +#!/bin/sh + +# Slackware build script for shaderc + +# Copyright 2018-2019 Hunter Sezen California, USA +# All rights reserved. +# +# Redistribution and use of this script, with or without modification, is +# permitted provided that the following conditions are met: +# +# 1. Redistributions of this script must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED +# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO +# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, +# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; +# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, +# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR +# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF +# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +PRGNAM=shaderc +VERSION=${VERSION:-2019.0} +BUILD=${BUILD:-1} +TAG=${TAG:-_SBo} + +if [ -z "$ARCH" ]; then + case "$( uname -m )" in + i?86) ARCH=i586 ;; + arm*) ARCH=arm ;; + *) ARCH=$( uname -m ) ;; + esac +fi + +CWD=$(pwd) +TMP=${TMP:-/tmp/SBo} +PKG=$TMP/package-$PRGNAM +OUTPUT=${OUTPUT:-/tmp} + +if [ "$ARCH" = "i586" ]; then + SLKCFLAGS="-O2 -march=i586 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "i686" ]; then + SLKCFLAGS="-O2 -march=i686 -mtune=i686" + LIBDIRSUFFIX="" +elif [ "$ARCH" = "x86_64" ]; then + SLKCFLAGS="-O2 -fPIC" + LIBDIRSUFFIX="64" +else + SLKCFLAGS="-O2" + LIBDIRSUFFIX="" +fi + +set -eu + +rm -rf $PKG +mkdir -p $TMP $PKG $OUTPUT +cd $TMP +rm -rf $PRGNAM-$VERSION +tar xvf $CWD/$PRGNAM-$VERSION.tar.gz +cd $PRGNAM-$VERSION +chown -R root:root . +find -L . \ + \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \ + -o -perm 511 \) -exec chmod 755 {} \; -o \ + \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \ + -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \; + +# Disable examples. third party code and git versioning (From AUR). +sed -i '/examples/d;/third_party/d' CMakeLists.txt +sed -i '/build-version/d' glslc/CMakeLists.txt + +glslang_version="$(glslangValidator -v | grep 'Glslang Version')" + +# Create build-version.inc since git versioning is disabled. +# There does not seem to be any good way to get the glslang version +# so use the latest version from their github repo. +# https://github.com/KhronosGroup/glslang +# This is displayed with 'glslc --version'. +cat > glslc/src/build-version.inc <<EOF + "shaderc $VERSION\\n" + "SPIRV-Tools-$(pkg-config --modversion SPIRV-Tools)\\n" + "glslang-${glslang_version##* }\\n" +EOF + +# Fix the link order of libglslang and libHLS +# https://github.com/google/shaderc/pull/463 +patch -p1 < $CWD/fix-glslang-link-order.patch + +mkdir -p build +cd build + cmake \ + -DCMAKE_C_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_CXX_FLAGS:STRING="$SLKCFLAGS" \ + -DCMAKE_INSTALL_PREFIX=/usr \ + -DSHADERC_SKIP_TESTS=ON \ + -DCMAKE_SKIP_RPATH=TRUE \ + -DCMAKE_BUILD_TYPE=Release .. + make + make install DESTDIR=$PKG +cd .. + +find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | + grep ELF | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true + +mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION +cp -a AUTHORS CHANGES CONTRIBUTING.md CONTRIBUTORS LICENSE README.md \ + $PKG/usr/doc/$PRGNAM-$VERSION +cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild + +mkdir -p $PKG/install +cat $CWD/slack-desc > $PKG/install/slack-desc + +cd $PKG +/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.${PKGTYPE:-tgz} diff --git a/graphics/shaderc/shaderc.info b/graphics/shaderc/shaderc.info new file mode 100644 index 0000000000000..1e5fb60f2b2b9 --- /dev/null +++ b/graphics/shaderc/shaderc.info @@ -0,0 +1,10 @@ +PRGNAM="shaderc" +VERSION="2019.0" +HOMEPAGE="https://github.com/google/shaderc" +DOWNLOAD="https://github.com/google/shaderc/archive/v2019.0/shaderc-2019.0.tar.gz" +MD5SUM="8eb2b40712db2762a5cc40b568fd8ad9" +DOWNLOAD_x86_64="" +MD5SUM_x86_64="" +REQUIRES="vulkan-sdk" +MAINTAINER="Hunter Sezen" +EMAIL="orbea@riseup.net" diff --git a/graphics/shaderc/slack-desc b/graphics/shaderc/slack-desc new file mode 100644 index 0000000000000..57ea91542bbf4 --- /dev/null +++ b/graphics/shaderc/slack-desc @@ -0,0 +1,19 @@ +# HOW TO EDIT THIS FILE: +# The "handy ruler" below makes it easier to edit a package description. +# Line up the first '|' above the ':' following the base package name, and +# the '|' on the right side marks the last column you can put a character in. +# You must make exactly 11 lines for the formatting to be correct. It's also +# customary to leave one space after the ':' except on otherwise blank lines. + + |-----handy-ruler------------------------------------------------------| +shaderc: shaderc (Vulkan shader compilation tools, libaries and tests) +shaderc: +shaderc: A collection of tools, libraries, and tests for Vulkan shader +shaderc: compilation. +shaderc: +shaderc: Homepage: https://github.com/google/shaderc +shaderc: +shaderc: +shaderc: +shaderc: +shaderc: |