From a86599f11994e5da0af314cfd4e1a39149f2da1f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= Date: Mon, 10 Jun 2019 17:48:29 +0200 Subject: [PATCH] Release 7.11.3214 Add patch to build against system spirv-tools MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Robert-André Mauchin --- 0001-pkg-config-compatibility.patch | 221 ++++++++++++++++++++++++++++ fix-hack.patch | 10 -- glslang.spec | 28 ++-- sources | 2 +- 4 files changed, 240 insertions(+), 21 deletions(-) create mode 100644 0001-pkg-config-compatibility.patch delete mode 100644 fix-hack.patch diff --git a/0001-pkg-config-compatibility.patch b/0001-pkg-config-compatibility.patch new file mode 100644 index 0000000..5edeae6 --- /dev/null +++ b/0001-pkg-config-compatibility.patch @@ -0,0 +1,221 @@ +From d2a8230cc05d77dad82a60329881244814797e4c Mon Sep 17 00:00:00 2001 +From: Rafael Amador Galvan +Date: Fri, 8 Mar 2019 11:39:58 -0600 +Subject: [PATCH 1/2] pkg-config compatibility + +--- + CMakeLists.txt | 13 ++++++++----- + SPIRV/CMakeLists.txt | 19 +++++++++++++++++-- + SPIRV/SpvTools.cpp | 4 ++-- + SPIRV/spirv.pc.cmake.in | 11 +++++++++++ + StandAlone/CMakeLists.txt | 9 ++++++++- + glslang/CMakeLists.txt | 3 +++ + glslang/glslang.pc.cmake.in | 11 +++++++++++ + 7 files changed, 60 insertions(+), 10 deletions(-) + create mode 100644 SPIRV/spirv.pc.cmake.in + create mode 100644 glslang/glslang.pc.cmake.in + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aafa70ed1..21ecef08d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -57,6 +57,13 @@ macro(glslang_pch SRCS PCHCPP) + endmacro(glslang_pch) + + project(glslang) ++ ++# using pkg-config to configure include paths and link libraries ++include(FindPkgConfig) ++pkg_check_modules(SPIRV_TOOLS REQUIRED SPIRV-Tools>=2019.2.1) ++if(BUILD_SHARED_LIBS) ++ pkg_check_modules(SPIRV_TOOLS_SHARED REQUIRED SPIRV-Tools-shared>=2019.2.1) ++endif(BUILD_SHARED_LIBS) + # make testing optional + include(CTest) + +@@ -117,11 +124,7 @@ endfunction(glslang_set_link_args) + # We depend on these for later projects, so they should come first. + add_subdirectory(External) + +-if(NOT TARGET SPIRV-Tools-opt) +- set(ENABLE_OPT OFF) +-endif() +- +-if(ENABLE_OPT) ++if(${SPIRV_TOOLS_FOUND} EQUAL 1) + message(STATUS "optimizer enabled") + add_definitions(-DENABLE_OPT=1) + else() +diff --git a/SPIRV/CMakeLists.txt b/SPIRV/CMakeLists.txt +index 1997e74c3..1760a065b 100644 +--- a/SPIRV/CMakeLists.txt ++++ b/SPIRV/CMakeLists.txt +@@ -48,6 +48,10 @@ set_property(TARGET SPIRV PROPERTY FOLDER glslang) + set_property(TARGET SPIRV PROPERTY POSITION_INDEPENDENT_CODE ON) + target_include_directories(SPIRV PUBLIC ..) + ++ ++set(SPIRV_NAME spirv) ++set(SPIRV_VERSION 1.3) ++ + if (ENABLE_SPVREMAPPER) + add_library(SPVRemapper ${LIB_TYPE} ${SPVREMAP_SOURCES} ${SPVREMAP_HEADERS}) + set_property(TARGET SPVRemapper PROPERTY FOLDER glslang) +@@ -61,13 +65,21 @@ if(WIN32 AND BUILD_SHARED_LIBS) + endif() + endif() + ++target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS}) ++target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_CFLAGS_OTHER}) ++target_link_libraries(SPIRV ${SPIRV_TOOLS_LIBRARIES}) ++if(BUILD_SHARED_LIBS) ++ target_include_directories(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS}) ++ target_compile_options(SPIRV PUBLIC ${SPIRV_TOOLS_SHARED_CFLAGS_OTHER}) ++ target_link_libraries(SPIRV ${SPIRV_TOOLS_SHARED_LIBRARIES}) ++endif(BUILD_SHARED_LIBS) ++ + if(ENABLE_OPT) + target_include_directories(SPIRV + PRIVATE ${spirv-tools_SOURCE_DIR}/include + PRIVATE ${spirv-tools_SOURCE_DIR}/source + ) +- target_link_libraries(SPIRV glslang SPIRV-Tools-opt) +- target_include_directories(SPIRV PUBLIC ../External) ++ target_link_libraries(SPIRV glslang) + else() + target_link_libraries(SPIRV glslang) + endif(ENABLE_OPT) +@@ -96,5 +108,8 @@ if(ENABLE_GLSLANG_INSTALL) + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() + ++ # spirv.pc Configuration ++ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/spirv.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc @ONLY) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/spirv.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + install(FILES ${HEADERS} ${SPVREMAP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/SPIRV/) + endif(ENABLE_GLSLANG_INSTALL) +diff --git a/SPIRV/SpvTools.cpp b/SPIRV/SpvTools.cpp +index eec06e0ac..723a64452 100644 +--- a/SPIRV/SpvTools.cpp ++++ b/SPIRV/SpvTools.cpp +@@ -43,8 +43,8 @@ + #include + + #include "SpvTools.h" +-#include "spirv-tools/optimizer.hpp" +-#include "spirv-tools/libspirv.h" ++#include ++#include + + namespace glslang { + +diff --git a/SPIRV/spirv.pc.cmake.in b/SPIRV/spirv.pc.cmake.in +new file mode 100644 +index 000000000..dfcad940b +--- /dev/null ++++ b/SPIRV/spirv.pc.cmake.in +@@ -0,0 +1,11 @@ ++ prefix=@CMAKE_INSTALL_PREFIX@ ++ exec_prefix=@CMAKE_INSTALL_PREFIX@ ++ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ ++ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++ ++ Name: @SPIRV_NAME@ ++ Description: SPIR-V is a binary intermediate language for representing graphical-shader stages and compute kernels for multiple Khronos APIs, including OpenCL, OpenGL, and Vulkan ++ Requires: ++ Version: @SPIRV_VERSION@ ++ Libs: -L${libdir} -lSPIRV ++ Cflags: -I${includedir} +\ No newline at end of file +diff --git a/StandAlone/CMakeLists.txt b/StandAlone/CMakeLists.txt +index 5cea53d9f..89a7da9c4 100644 +--- a/StandAlone/CMakeLists.txt ++++ b/StandAlone/CMakeLists.txt +@@ -23,6 +23,14 @@ set(LIBRARIES + SPVRemapper + glslang-default-resource-limits) + ++if(BUILD_SHARED_LIBS) ++ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_SHARED_LIBRARIES}) ++ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_SHARED_INCLUDE_DIRS}) ++else() ++ set(LIBRARIES ${LIBRARIES} ${SPIRV_TOOLS_LIBRARIES}) ++ target_include_directories(glslangValidator PUBLIC ${SPIRV_TOOLS_INCLUDE_DIRS}) ++endif(BUILD_SHARED_LIBS) ++ + if(WIN32) + set(LIBRARIES ${LIBRARIES} psapi) + elseif(UNIX) +@@ -33,7 +41,6 @@ endif(WIN32) + + target_link_libraries(glslangValidator ${LIBRARIES}) + target_link_libraries(spirv-remap ${LIBRARIES}) +-target_include_directories(glslangValidator PUBLIC ../External) + + if(WIN32) + source_group("Source" FILES ${SOURCES}) +diff --git a/glslang/CMakeLists.txt b/glslang/CMakeLists.txt +index 5f51476ba..daf717fab 100644 +--- a/glslang/CMakeLists.txt ++++ b/glslang/CMakeLists.txt +@@ -80,6 +80,7 @@ set(HEADERS + # WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) + # set(BISON_GLSLParser_OUTPUT_SOURCE ${CMAKE_CURRENT_SOURCE_DIR}/MachineIndependent/glslang_tab.cpp) + ++set(VERSION 7.11.3113) + glslang_pch(SOURCES MachineIndependent/pch.cpp) + + add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${SOURCES} ${HEADERS}) +@@ -113,6 +114,8 @@ if(ENABLE_GLSLANG_INSTALL) + install(TARGETS glslang + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif() ++ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/glslang.pc.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc @ONLY) ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/glslang.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + endif(ENABLE_GLSLANG_INSTALL) + + if(ENABLE_GLSLANG_INSTALL) +diff --git a/glslang/glslang.pc.cmake.in b/glslang/glslang.pc.cmake.in +new file mode 100644 +index 000000000..921497eb6 +--- /dev/null ++++ b/glslang/glslang.pc.cmake.in +@@ -0,0 +1,11 @@ ++ prefix=@CMAKE_INSTALL_PREFIX@ ++ exec_prefix=@CMAKE_INSTALL_PREFIX@ ++ libdir=${exec_prefix}/@CMAKE_INSTALL_LIBDIR@ ++ includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++ ++ Name: @PROJECT_NAME@ ++ Description: OpenGL and OpenGL ES shader front end and validator ++ Requires: ++ Version: @VERSION@ ++ Libs: -L${libdir} -lglslang -lOSDependent -lHLSL -lOGLCompiler -lSPVRemapper ++ Cflags: -I${includedir} +\ No newline at end of file + +From 0ebd323091567c65be3f2831a3bcac6223b0aa52 Mon Sep 17 00:00:00 2001 +From: Rafael Amador Galvan +Date: Fri, 8 Mar 2019 11:50:49 -0600 +Subject: [PATCH 2/2] removed the section belonging to the SPIRV-Tools + dependency + +--- + External/CMakeLists.txt | 7 ------- + 1 file changed, 7 deletions(-) + +diff --git a/External/CMakeLists.txt b/External/CMakeLists.txt +index 4d9690134..24f03237a 100644 +--- a/External/CMakeLists.txt ++++ b/External/CMakeLists.txt +@@ -34,10 +34,3 @@ if(BUILD_TESTING) + endif() + endif() + +-if(ENABLE_OPT AND NOT TARGET SPIRV-Tools-opt) +- if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools) +- set(SPIRV_SKIP_TESTS ON CACHE BOOL "Skip building SPIRV-Tools tests") +- add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/spirv-tools spirv-tools) +- endif() +-endif() +- diff --git a/fix-hack.patch b/fix-hack.patch deleted file mode 100644 index 1da0110..0000000 --- a/fix-hack.patch +++ /dev/null @@ -1,10 +0,0 @@ -diff -up glslang-05d12a9461dd0a76053bdd42f062a37a10d56afb/Test/baseResults/spv.debugInfo.1.1.frag.out.dma glslang-05d12a9461dd0a76053bdd42f062a37a10d56afb/Test/baseResults/spv.debugInfo.1.1.frag.out ---- glslang-05d12a9461dd0a76053bdd42f062a37a10d56afb/Test/baseResults/spv.debugInfo.1.1.frag.out.dma 2019-02-12 15:50:57.272983148 +1000 -+++ glslang-05d12a9461dd0a76053bdd42f062a37a10d56afb/Test/baseResults/spv.debugInfo.1.1.frag.out 2019-02-12 15:51:08.378280485 +1000 -@@ -1,6 +1,4 @@ - spv.debugInfo.frag --error: SPIRV-Tools Validation Errors --error: Invalid SPIR-V binary version 1.3 for target environment SPIR-V 1.0 (under OpenGL 4.5 semantics). - // Module Version 10300 - // Generated by (magic number): 80007 - // Id's are bound by 124 diff --git a/glslang.spec b/glslang.spec index 170ff7a..d3fd8ff 100644 --- a/glslang.spec +++ b/glslang.spec @@ -1,23 +1,26 @@ -%global commit e0d59bbe1857e75134989eddb7437e9c068ec915 -%global shortcommit %(c=%{commit}; echo ${c:0:7}) -%global commit_date 20190329 -%global gitrel .%{commit_date}.git%{shortcommit} +# %%global commit e0d59bbe1857e75134989eddb7437e9c068ec915 +# %%global shortcommit %%(c=%%{commit}; echo ${c:0:7}) +# %%global commit_date 20190610 +# %%global gitrel .%%{commit_date}.git%%{shortcommit} Name: glslang -Version: 3.1 -Release: 0.13%{?gitrel}%{?dist} +Version: 7.11.3214 +Release: 1%{?dist} Summary: OpenGL and OpenGL ES shader front end and validator License: BSD and GPLv3+ and ASL 2.0 URL: https://github.com/KhronosGroup -Source0: %url/%{name}/archive/%{commit}.tar.gz#/%{name}-%{commit}.tar.gz +Source0: %url/%{name}/archive/%{version}/%{name}-%{version}.tar.gz Patch0: nodate.patch Patch1: glslang-default-resource-limits_staticlib.patch Patch2: glslang_tests.patch -Patch3: fix-hack.patch +# Patch to build against system spirv-tools +Patch3: https://patch-diff.githubusercontent.com/raw/KhronosGroup/glslang/pull/1722.patch#/0001-pkg-config-compatibility.patch + BuildRequires: cmake3 BuildRequires: gcc-c++ BuildRequires: ninja-build +BuildRequires: spirv-tools-devel %description %{name} is the official reference compiler front end for the OpenGL @@ -34,7 +37,7 @@ ES and OpenGL shading languages. It implements a strict interpretation of the specifications for these languages. %prep -%autosetup -p1 -n %{name}-%{commit} +%autosetup -p1 -n %{name}-%{version} # Fix rpmlint warning on debuginfo find . -name '*.h' -or -name '*.cpp' -or -name '*.hpp'| xargs chmod a-x @@ -77,8 +80,14 @@ install -pm 0644 build/StandAlone/libglslang-default-resource-limits.a %{buildro %{_libdir}/libSPVRemapper.a %{_libdir}/libglslang.a %{_libdir}/libglslang-default-resource-limits.a +%{_libdir}/pkgconfig/glslang.pc +%{_libdir}/pkgconfig/spirv.pc %changelog +* Mon Jun 10 01:27:27 CEST 2019 Robert-André Mauchin - 7.11.3214-1 +- Release 7.11.3214 +- Add patch to build against system spirv-tools + * Fri Mar 29 2019 Dave Airlie - 3.1-0.13.20190329.gite0d59bb - Update for vulkan 1.1.101.0 @@ -119,4 +128,3 @@ install -pm 0644 build/StandAlone/libglslang-default-resource-limits.a %{buildro * Thu Jul 13 2017 Leigh Scott - 3.1-0.1.20171028.git715c353 - First build - diff --git a/sources b/sources index 5504544..790402f 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (glslang-e0d59bbe1857e75134989eddb7437e9c068ec915.tar.gz) = e86c4903097d6b58cfd32964f0ab914dcde35bcf0b31ce6f41dd3b2d2e339fdc614f1d8524d35afb69203d60ce500623f250e71a38d663e9bc18cc9decdf6f98 +SHA512 (glslang-7.11.3214.tar.gz) = 5e7f8c063b30fc5edf65898b2371f4128aead05008865d065de9d3a94354de787035067ec908651c7e88bf294251d1410929d2b1c19e03d9b51476ea8a7eae96