From 70105fa368b579fdd94e6698cf6c24d01dcbf3948d2e912f4bb91c4e479b420e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt Date: Thu, 16 Jun 2022 15:59:30 +0000 Subject: [PATCH] Replace -suseN SO versioning with %version-based (cf. vulkan-validationlayers) OBS-URL: https://build.opensuse.org/package/show/X11:Wayland/spirv-tools?expand=0&rev=82 --- baselibs.conf | 4 +-- spirv-tools.spec | 15 +++++---- ver.diff | 80 +++++++++++++++++++++--------------------------- 3 files changed, 44 insertions(+), 55 deletions(-) diff --git a/baselibs.conf b/baselibs.conf index e52d048..56cb492 100644 --- a/baselibs.conf +++ b/baselibs.conf @@ -1,4 +1,4 @@ -libSPIRV-Tools-suse26 +libSPIRV-Tools-2022_3_sdk216 spirv-tools-devel requires -spirv-tools- - requires "libSPIRV-Tools-suse26- = " + requires "libSPIRV-Tools-2022_3_sdk216- = " diff --git a/spirv-tools.spec b/spirv-tools.spec index d064aa8..a2862e1 100644 --- a/spirv-tools.spec +++ b/spirv-tools.spec @@ -17,7 +17,7 @@ %define _lto_cflags %nil -%define lname libSPIRV-Tools-suse26 +%define lname libSPIRV-Tools-2022_3_sdk216 Name: spirv-tools Version: 2022.3~sdk216 @@ -67,6 +67,8 @@ integration into other code bases directly. %prep %autosetup -p1 -n SPIRV-Tools-sdk-1.3.216.0 +find . -type f -name CMakeLists.txt -exec \ + perl -i -pe 's{\@PACKAGE_VERSION\@}{%version}' CMakeLists.txt {} + %build %if 0%{?suse_version} >= 1550 @@ -79,6 +81,9 @@ integration into other code bases directly. %install %cmake_install perl -i -lpe 's{^#!/usr/bin/env sh$}{#!/bin/sh}' "%buildroot/%_bindir/spirv-lesspipe.sh" +for i in "" "-diff" "-link" "-lint" "-opt" "-reduce" "-shared"; do + ln -s "libSPIRV-Tools$i-%version.so" "%buildroot/%_libdir/libSPIRV-Tools$i.so" +done %post -n %lname -p /sbin/ldconfig %postun -n %lname -p /sbin/ldconfig @@ -88,13 +93,7 @@ perl -i -lpe 's{^#!/usr/bin/env sh$}{#!/bin/sh}' "%buildroot/%_bindir/spirv-less %doc LICENSE %files -n %lname -%_libdir/libSPIRV-Tools.so.* -%_libdir/libSPIRV-Tools-diff.so.* -%_libdir/libSPIRV-Tools-link.so.* -%_libdir/libSPIRV-Tools-lint.so.* -%_libdir/libSPIRV-Tools-opt.so.* -%_libdir/libSPIRV-Tools-reduce.so.* -%_libdir/libSPIRV-Tools-shared.so.* +%_libdir/libSPIRV-Tools-*2*.so %files devel %_libdir/cmake/ diff --git a/ver.diff b/ver.diff index 6c3c713..4fb767d 100644 --- a/ver.diff +++ b/ver.diff @@ -4,114 +4,104 @@ Date: 2016-06-13 11:46:16.846841814 +0200 Unversioned libraries suck! --- - source/CMakeLists.txt | 3 +++ - source/diff/CMakeLists.txt | 2 ++ + source/CMakeLists.txt | 2 ++ + source/diff/CMakeLists.txt | 1 + source/fuzz/CMakeLists.txt | 1 + source/link/CMakeLists.txt | 1 + source/lint/CMakeLists.txt | 1 + source/opt/CMakeLists.txt | 1 + source/reduce/CMakeLists.txt | 1 + - 7 files changed, 10 insertions(+) + 7 files changed, 8 insertions(+) -Index: SPIRV-Tools-2022.2/source/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/CMakeLists.txt +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/CMakeLists.txt @@ -377,6 +377,7 @@ endfunction() add_library(${SPIRV_TOOLS}-shared SHARED ${SPIRV_SOURCES}) spirv_tools_default_target_options(${SPIRV_TOOLS}-shared) set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES CXX_VISIBILITY_PRESET hidden) -+set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES SOVERSION suse26) ++set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}-shared-@PACKAGE_VERSION@") target_compile_definitions(${SPIRV_TOOLS}-shared PRIVATE SPIRV_TOOLS_IMPLEMENTATION PUBLIC SPIRV_TOOLS_SHAREDLIB -@@ -387,6 +388,7 @@ if(SPIRV_TOOLS_BUILD_STATIC) - spirv_tools_default_target_options(${SPIRV_TOOLS}-static) - # The static target does not have the '-static' suffix. - set_target_properties(${SPIRV_TOOLS}-static PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}") -+ set_target_properties(${SPIRV_TOOLS}-static PROPERTIES SOVERSION suse26) - - # Create the "${SPIRV_TOOLS}" target as an alias to either "${SPIRV_TOOLS}-static" - # or "${SPIRV_TOOLS}-shared" depending on the value of BUILD_SHARED_LIBS. -@@ -399,6 +401,7 @@ if(SPIRV_TOOLS_BUILD_STATIC) +@@ -399,6 +400,7 @@ if(SPIRV_TOOLS_BUILD_STATIC) set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-static ${SPIRV_TOOLS}-shared) else() add_library(${SPIRV_TOOLS} ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_SOURCES}) -+ set_target_properties(${SPIRV_TOOLS} PROPERTIES SOVERSION suse26) ++ set_target_properties(${SPIRV_TOOLS} PROPERTIES OUTPUT_NAME "${SPIRV_TOOLS}-@PACKAGE_VERSION@") spirv_tools_default_target_options(${SPIRV_TOOLS}) set(SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS} ${SPIRV_TOOLS}-shared) endif() -Index: SPIRV-Tools-2022.2/source/diff/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/diff/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/diff/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/diff/CMakeLists.txt -@@ -35,7 +35,9 @@ target_link_libraries(SPIRV-Tools-diff - target_link_libraries(SPIRV-Tools-diff +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/diff/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/diff/CMakeLists.txt +@@ -36,6 +36,7 @@ target_link_libraries(SPIRV-Tools-diff PUBLIC SPIRV-Tools-opt) -+ set_property(TARGET SPIRV-Tools-diff PROPERTY FOLDER "SPIRV-Tools libraries") -+set_target_properties(SPIRV-Tools-diff PROPERTIES SOVERSION suse26) ++set_target_properties(SPIRV-Tools-diff PROPERTIES OUTPUT_NAME "SPIRV-Tools-diff-@PACKAGE_VERSION@") spvtools_check_symbol_exports(SPIRV-Tools-diff) if(ENABLE_SPIRV_TOOLS_INSTALL) -Index: SPIRV-Tools-2022.2/source/fuzz/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/fuzz/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/fuzz/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/fuzz/CMakeLists.txt +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/fuzz/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/fuzz/CMakeLists.txt @@ -439,6 +439,7 @@ if(SPIRV_BUILD_FUZZER) spvtools_pch(SPIRV_TOOLS_FUZZ_SOURCES pch_source_fuzz) add_library(SPIRV-Tools-fuzz ${SPIRV_TOOLS_FUZZ_SOURCES}) -+ set_target_properties(SPIRV-Tools-fuzz PROPERTIES SOVERSION suse26) ++ set_target_properties(SPIRV-Tools-fuzz PROPERTIES OUTPUT_NAME "SPIRV-Tools-fuzz-@PACKAGE_VERSION@") spvtools_default_compile_options(SPIRV-Tools-fuzz) -Index: SPIRV-Tools-2022.2/source/link/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/link/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/link/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/link/CMakeLists.txt +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/link/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/link/CMakeLists.txt @@ -14,6 +14,7 @@ add_library(SPIRV-Tools-link ${SPIRV_TOOLS_LIBRARY_TYPE} linker.cpp ) -+set_target_properties(SPIRV-Tools-link PROPERTIES SOVERSION suse26) ++set_target_properties(SPIRV-Tools-link PROPERTIES OUTPUT_NAME "SPIRV-Tools-link-@PACKAGE_VERSION@") spvtools_default_compile_options(SPIRV-Tools-link) target_include_directories(SPIRV-Tools-link -Index: SPIRV-Tools-2022.2/source/lint/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/lint/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/lint/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/lint/CMakeLists.txt +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/lint/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/lint/CMakeLists.txt @@ -27,6 +27,7 @@ endif() add_library(SPIRV-Tools-lint ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_LINT_SOURCES}) -+set_target_properties(SPIRV-Tools-lint PROPERTIES SOVERSION suse26) ++set_target_properties(SPIRV-Tools-lint PROPERTIES OUTPUT_NAME "SPIRV-Tools-lint-@PACKAGE_VERSION@") spvtools_default_compile_options(SPIRV-Tools-lint) target_include_directories(SPIRV-Tools-lint PUBLIC -Index: SPIRV-Tools-2022.2/source/opt/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/opt/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/opt/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/opt/CMakeLists.txt -@@ -245,6 +245,7 @@ spvtools_pch(SPIRV_TOOLS_OPT_SOURCES pch +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/opt/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/opt/CMakeLists.txt +@@ -249,6 +249,7 @@ spvtools_pch(SPIRV_TOOLS_OPT_SOURCES pch add_library(SPIRV-Tools-opt ${SPIRV_TOOLS_LIBRARY_TYPE} ${SPIRV_TOOLS_OPT_SOURCES}) -+set_target_properties(SPIRV-Tools-opt PROPERTIES SOVERSION suse26) ++set_target_properties(SPIRV-Tools-opt PROPERTIES OUTPUT_NAME "SPIRV-Tools-opt-@PACKAGE_VERSION@") spvtools_default_compile_options(SPIRV-Tools-opt) target_include_directories(SPIRV-Tools-opt PUBLIC -Index: SPIRV-Tools-2022.2/source/reduce/CMakeLists.txt +Index: SPIRV-Tools-sdk-1.3.216.0/source/reduce/CMakeLists.txt =================================================================== ---- SPIRV-Tools-2022.2.orig/source/reduce/CMakeLists.txt -+++ SPIRV-Tools-2022.2/source/reduce/CMakeLists.txt +--- SPIRV-Tools-sdk-1.3.216.0.orig/source/reduce/CMakeLists.txt ++++ SPIRV-Tools-sdk-1.3.216.0/source/reduce/CMakeLists.txt @@ -92,6 +92,7 @@ target_include_directories(SPIRV-Tools-r $ PRIVATE ${spirv-tools_BINARY_DIR} ) -+set_target_properties(SPIRV-Tools-reduce PROPERTIES SOVERSION suse26) ++set_target_properties(SPIRV-Tools-reduce PROPERTIES OUTPUT_NAME "SPIRV-Tools-reduce-@PACKAGE_VERSION@") # The reducer reuses a lot of functionality from the SPIRV-Tools library. target_link_libraries(SPIRV-Tools-reduce PUBLIC ${SPIRV_TOOLS_FULL_VISIBILITY}