Added build for shaderc

This commit is contained in:
dslm4515
2024-02-06 19:21:45 -06:00
parent f257196197
commit eab39784a1
3 changed files with 103 additions and 0 deletions

View File

@ -0,0 +1,48 @@
#! /bin/bash
# shaderc
# Source: https://github.com/google/shaderc/archive/refs/tags/v2023.8.tar.gz
#
# $BUILD = Directory to temporarily install
# $PKGS = Directory to store built packages
#
# DEPS
# Required: spirv-tools spirv-headers glslang
# Recommended: NONE
# Optional: gmock
patch -Np1 -i ../patches/shaderc-chimera/drop-build-versions.patch
patch -Np1 -i ../patches/shaderc-chimera/unbundle.patch
CFLAGS="-I/usr/include/glslang " \
CXXFLAGS=$CFLAGS \
cmake -B OUT -DCMAKE_INSTALL_PREFIX=/usr -GNinja \
-DCMAKE_BUILD_TYPE=Release \
-DSHADERC_SKIP_TESTS=ON -DSHADERC_SKIP_EXAMPLES=ON \
-DPYTHON_EXECUTABLE=python3
read -p "Compile?" && ninja -C OUT -j2 &&
sudo -S DESTDIR=$BUILD ninja -C OUT install &&
cd $BUILD && sudo -S mkdir -v ${BUILD}/install &&
cat > /tmp/slack-desc << "EOF"
# 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
shaderc:
shaderc: A collection of tools, libraries, and tests for Vulkan shader
shaderc: compilation.
shaderc:
shaderc: https://github.com/google/shaderc
shaderc:
EOF
sudo -S mv -v /tmp/slack-desc install/ &&
sudo -S makepkg -l y -c n $PKGS/shaderc-2023.8-$PSUFFIX &&
sudo -S rm -rf ${BUILD}/*

View File

@ -0,0 +1,34 @@
From 7cba3e0aecc609661a4260601dbcf83329ee950c Mon Sep 17 00:00:00 2001
From: Daniel Kolesa <daniel@octaforge.org>
Date: Fri, 31 Dec 2021 17:26:07 +0100
Subject: [PATCH] kill build version nonsense
---
glslc/src/main.cc | 5 -----
1 file changed, 5 deletions(-)
diff --git a/glslc/src/main.cc b/glslc/src/main.cc
index 5ca5d61..53e1618 100644
--- a/glslc/src/main.cc
+++ b/glslc/src/main.cc
@@ -197,10 +197,6 @@ bool SetResourceLimits(const std::string& str, shaderc::CompileOptions* options,
return true;
}
-const char kBuildVersion[] =
-#include "build-version.inc"
- ;
-
// Gets an optional stage name followed by required offset argument. Returns
// false and emits a message to *errs if any errors occur. After calling this
// function, *index will be the index of the last command line argument
@@ -286,7 +282,6 @@ int main(int argc, char** argv) {
#undef RESOURCE
return 0;
} else if (arg == "--version") {
- std::cout << kBuildVersion << std::endl;
std::cout << "Target: " << spvTargetEnvDescription(SPV_ENV_UNIVERSAL_1_0)
<< std::endl;
return 0;
--
2.32.0

View File

@ -0,0 +1,21 @@
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -124,8 +124,6 @@ endif(MSVC)
# Configure subdirectories.
# We depend on these for later projects, so they should come first.
-add_subdirectory(third_party)
-
add_subdirectory(libshaderc_util)
add_subdirectory(libshaderc)
add_subdirectory(glslc)
--- a/glslc/CMakeLists.txt
+++ b/glslc/CMakeLists.txt
@@ -53,7 +53,6 @@ shaderc_default_compile_options(glslc_exe)
target_include_directories(glslc_exe PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/.. ${spirv-tools_SOURCE_DIR}/include)
set_target_properties(glslc_exe PROPERTIES OUTPUT_NAME glslc)
target_link_libraries(glslc_exe PRIVATE glslc shaderc_util shaderc)
-add_dependencies(glslc_exe build-version)
shaderc_add_tests(
TEST_PREFIX glslc