diff --git a/0001-Fix-typo-in-the-.pc.in-files-that-botched-the-versio.patch b/0001-Fix-typo-in-the-.pc.in-files-that-botched-the-versio.patch new file mode 100644 index 0000000..88b18b0 --- /dev/null +++ b/0001-Fix-typo-in-the-.pc.in-files-that-botched-the-versio.patch @@ -0,0 +1,51 @@ +From 38413a86dc8782048089077a07b2347bf430dc02 Mon Sep 17 00:00:00 2001 +From: Larry Gritz +Date: Sat, 9 May 2020 12:48:09 -0700 +Subject: [PATCH] Fix typo in the .pc.in files that botched the version (#1168) + +Signed-off-by: Larry Gritz +--- + src/build-scripts/oslcomp.pc.in | 2 +- + src/build-scripts/oslexec.pc.in | 2 +- + src/build-scripts/oslquery.pc.in | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/src/build-scripts/oslcomp.pc.in b/src/build-scripts/oslcomp.pc.in +index 00244fd1..63cf7a9f 100644 +--- a/src/build-scripts/oslcomp.pc.in ++++ b/src/build-scripts/oslcomp.pc.in +@@ -6,6 +6,6 @@ includedir=${prefix}/include + Name: oslcomp + Description: oslcomp Compile OSL shaders from source + URL: https://github.com/imageworks/OpenShadingLanguage +-Version: @PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_PATCH@ ++Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ + Libs: -L${libdir} -loslcomp + Cflags: -I${includedir} +diff --git a/src/build-scripts/oslexec.pc.in b/src/build-scripts/oslexec.pc.in +index e29cf9a1..1ad264c2 100644 +--- a/src/build-scripts/oslexec.pc.in ++++ b/src/build-scripts/oslexec.pc.in +@@ -6,6 +6,6 @@ includedir=${prefix}/include + Name: oslexec + Description: oslexec Execute compiled OSL shaders + URL: https://github.com/imageworks/OpenShadingLanguage +-Version: @PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_PATCH@ ++Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ + Libs: -L${libdir} -loslexec + Cflags: -I${includedir} +diff --git a/src/build-scripts/oslquery.pc.in b/src/build-scripts/oslquery.pc.in +index 060cd4c0..4da229b2 100644 +--- a/src/build-scripts/oslquery.pc.in ++++ b/src/build-scripts/oslquery.pc.in +@@ -6,6 +6,6 @@ includedir=${prefix}/include + Name: oslquery + Description: oslquery Query parameters of OSL compiled shaders + URL: https://github.com/imageworks/OpenShadingLanguage +-Version: @PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_PATCH@ ++Version: @PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@PROJECT_VERSION_PATCH@ + Libs: -L${libdir} -loslquery + Cflags: -I${includedir} +-- +2.26.2 + diff --git a/0001-Use-single-shared-clang-cpp-library-starting-with-LL.patch b/0001-Use-single-shared-clang-cpp-library-starting-with-LL.patch new file mode 100644 index 0000000..b91ce4c --- /dev/null +++ b/0001-Use-single-shared-clang-cpp-library-starting-with-LL.patch @@ -0,0 +1,41 @@ +From 891061d02a71ce1a5aad6807063b69f8e38e174a Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Stefan=20Br=C3=BCns?= +Date: Wed, 13 May 2020 20:23:49 +0200 +Subject: [PATCH] Use single shared clang-cpp library starting with LLVM 9 + +Since 9.0 LLVM defaults to building a single clang-cpp library for +non-developer builds. + +As this is just the default, and some distributions enable it only with +LLVM 10 (e.g. Fedora), make the clang-cpp search dependent on the build +mode. +--- + src/cmake/modules/FindLLVM.cmake | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/src/cmake/modules/FindLLVM.cmake b/src/cmake/modules/FindLLVM.cmake +index 8b17ad8e..21a87f38 100644 +--- a/src/cmake/modules/FindLLVM.cmake ++++ b/src/cmake/modules/FindLLVM.cmake +@@ -79,6 +79,18 @@ if (NOT LLVM_LIBRARY) + set (LLVM_LIBRARY "${LLVM_LIBRARIES}") + endif () + ++execute_process (COMMAND ${LLVM_CONFIG} --shared-mode ++ OUTPUT_VARIABLE LLVM_SHARED_MODE ++ OUTPUT_STRIP_TRAILING_WHITESPACE) ++if (LLVM_VERSION VERSION_GREATER_EQUAL 9.0 AND (LLVM_SHARED_MODE STREQUAL "shared")) ++ find_library ( _CLANG_CPP_LIBRARY ++ NAMES "clang-cpp" ++ PATHS ${LLVM_LIB_DIR}) ++ if (_CLANG_CPP_LIBRARY) ++ list (APPEND CLANG_LIBRARIES ${_CLANG_CPP_LIBRARY}) ++ endif () ++endif () ++ + foreach (COMPONENT clangFrontend clangDriver clangSerialization + clangParse clangSema clangAnalysis clangAST clangBasic + clangEdit clangLex) +-- +2.26.2 + diff --git a/OpenShadingLanguage.changes b/OpenShadingLanguage.changes index 7592d9d..8c336f8 100644 --- a/OpenShadingLanguage.changes +++ b/OpenShadingLanguage.changes @@ -1,3 +1,20 @@ +------------------------------------------------------------------- +Wed May 13 19:11:41 UTC 2020 - Stefan BrĂ¼ns + +- Use the correct CMake variable to set the shader install location. +- Replace osl-pkgconfig-versions.patch with correct upstream + 0001-Fix-typo-in-the-.pc.in-files-that-botched-the-versio.patch +- Adapt to LLVM 9/10 changes defaulting to single clang-cpp library, + add 0001-Use-single-shared-clang-cpp-library-starting-with-LL.patch + instead of mangling CMake output. +- Dropped osl-oslimageio-soname.patch, which erroneously adds a + version to the OpenImageIO plugin, voiding any chance for + OIIO to find and load the plugin. +- Rename the osl.imageio package to OpenImageIO-plugin-osl, to + better reflect its purpose, install the plugin to the default + OpenImageIO plugin directory. +- Use python3 for the build process. + ------------------------------------------------------------------- Tue Apr 21 09:54:50 UTC 2020 - Dave Plater diff --git a/OpenShadingLanguage.spec b/OpenShadingLanguage.spec index ebf6ee5..34f8fd5 100644 --- a/OpenShadingLanguage.spec +++ b/OpenShadingLanguage.spec @@ -1,7 +1,7 @@ # # spec file for package OpenShadingLanguage # -# Copyright (c) 2020 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2020 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -19,8 +19,8 @@ # The library soname versions follow the package version major and minor numbers. %define sover %(echo %{version} | cut -d . -f 1,2) %define sufx %(echo %{sover}|tr . _) -# LLVM version is needed because -lclang-cpp doesn't exist < 10 -%define llvm_version %(llvm-config --version | cut -d . -f 1) +# Required for the plugin directory name, see https://github.com/OpenImageIO/oiio/issues/2583 +%define oiio_major_minor_ver %(rpm -q --queryformat='%%{version}' OpenImageIO-devel | cut -d . -f 1-2) Name: OpenShadingLanguage Version: 1.11.4.1 @@ -28,26 +28,29 @@ Release: 0 Summary: A language for programmable shading License: BSD-3-Clause Group: Productivity/Graphics/Other -Url: https://github.com/imageworks/OpenShadingLanguage +URL: https://github.com/imageworks/OpenShadingLanguage Source0: https://github.com/imageworks/OpenShadingLanguage/archive/Release-%{version}-dev.tar.gz#/%{name}-Release-%{version}.tar.gz Source1: https://creativecommons.org/licenses/by/3.0/legalcode.txt +# PATCH-FIX-UPSTREAM Patch0: 0001-LLVM-10-odds-and-ends-1135.patch +# PATCH-FIX-UPSTREAM Patch1: 0001-Some-SPI-build-fixes-for-finding-the-right-llvm.patch -Patch2: osl-pkgconfig-versions.patch -Patch3: osl-oslimageio-soname.patch +# PATCH-FIX-UPSTREAM +Patch2: 0001-Fix-typo-in-the-.pc.in-files-that-botched-the-versio.patch +# PATCH-FIX-UPSTREAM - https://github.com/imageworks/OpenShadingLanguage/pull/1171 +Patch3: 0001-Use-single-shared-clang-cpp-library-starting-with-LL.patch BuildRequires: OpenEXR-devel -BuildRequires: OpenImageIO-devel >= 2.0 BuildRequires: bison -BuildRequires: clang-devel >= 4 -BuildRequires: cmake +BuildRequires: clang-devel >= 7 +BuildRequires: cmake >= 3.12 BuildRequires: flex BuildRequires: gcc-c++ BuildRequires: libboost_filesystem-devel BuildRequires: libboost_system-devel BuildRequires: libboost_thread-devel -BuildRequires: libboost_wave-devel BuildRequires: pkg-config -BuildRequires: python +BuildRequires: python3-base +BuildRequires: cmake(OpenImageIO) >= 2.0 BuildRequires: cmake(pugixml) Requires: %{name}-common-headers = %{version} Recommends: %{name}-doc = %{version} @@ -164,16 +167,20 @@ Open Shading Language (OSL) is a language for programmable shading in advanced renderers and other applications, ideal for describing materials, lights, displacement, and pattern generation. -%package -n osl.imageio%{sufx} -Summary: Shader interface to OpenImageIO functions +%package -n OpenImageIO-plugin-osl +Summary: OpenImageIO input plugin License: BSD-3-Clause Group: System/Libraries +Obsoletes: osl.imageio < 1.11.4.1 +Provides: osl.imageio = %{version} -%description -n osl.imageio%{sufx} +%description -n OpenImageIO-plugin-osl Open Shading Language (OSL) is a language for programmable shading in advanced renderers and other applications, ideal for describing materials, lights, displacement, and pattern generation. +This is a plugin to access OSL from OpenImageIO. + %package devel Summary: Development files for %{name} License: BSD-3-Clause @@ -184,7 +191,6 @@ Requires: liboslexec%{sufx} = %{version} Requires: liboslnoise%{sufx} = %{version} Requires: liboslquery%{sufx} = %{version} Requires: libtestshade%{sufx} = %{version} -Requires: osl.imageio%{sufx} = %{version} %description devel The %{name}-devel package contains libraries and header files for @@ -193,29 +199,26 @@ developing applications that use %{name}. %prep %setup -q -n %{name}-Release-%{version}-dev %autopatch -p1 -echo "Using LLVM%{llvm_version}" +find . -iname CMakeLists.txt -exec sed "-i" "-e s/COMMAND python/COMMAND python3/" "{}" \; %build %cmake \ -DCMAKE_INSTALL_DOCDIR:PATH=%{_docdir}/%{name} \ - -DOSL_INSTALL_SHADERDIR:PATH=%{_datadir}/%{name} \ + -DOSL_SHADER_INSTALL_DIR:PATH=%{_datadir}/%{name}/shaders/ \ -DCMAKE_CXX_STANDARD:STRING=14 -%if 0%{?llvm_version} >= 10 -# Add missing -lclang-cpp to linker scripts for liboslcomp and liboslexec -sed -i 's/\-ldl /\-ldl \-lclang-cpp /' src/liboslexec/CMakeFiles/oslexec.dir/link.txt -sed -i 's/\-ldl /\-ldl \-lclang-cpp /' src/liboslcomp/CMakeFiles/oslcomp.dir/link.txt -%endif -make %{?_smp_mflags} +%cmake_build %install %cmake_install # Add Creative Commons license for documentation cp -v %{SOURCE1} . +# Move the OpenImageIO plugin into its default search path +mkdir %{buildroot}%{_libdir}/OpenImageIO-%{oiio_major_minor_ver} +mv %{buildroot}%{_libdir}/osl.imageio.so %{buildroot}%{_libdir}/OpenImageIO-%{oiio_major_minor_ver}/ find %{buildroot} -name LICENSE -print -delete find %{buildroot} -name README.md -print -delete find %{buildroot} -name CHANGES.md -print -delete -find %{buildroot} -type f -name "*.la" -delete -print %post -n liboslcomp%{sufx} -p /sbin/ldconfig %postun -n liboslcomp%{sufx} -p /sbin/ldconfig @@ -232,9 +235,6 @@ find %{buildroot} -type f -name "*.la" -delete -print %post -n libtestshade%{sufx} -p /sbin/ldconfig %postun -n libtestshade%{sufx} -p /sbin/ldconfig -%post -n osl.imageio%{sufx} -p /sbin/ldconfig -%postun -n osl.imageio%{sufx} -p /sbin/ldconfig - %files %license LICENSE %{_bindir}/* @@ -244,16 +244,16 @@ find %{buildroot} -type f -name "*.la" -delete -print %doc %{_docdir}/%{name}/ %files MaterialX-shaders-source -%{_datadir}/OSL/shaders/MaterialX +%{_datadir}/%{name}/shaders/MaterialX %files example-shaders-source -%{_datadir}/OSL/shaders/*.osl -%{_datadir}/OSL/shaders/*.oso +%{_datadir}/%{name}/shaders/*.osl +%{_datadir}/%{name}/shaders/*.oso %files common-headers -%dir %{_datadir}/OSL -%dir %{_datadir}/OSL/shaders -%{_datadir}/OSL/shaders/*.h +%dir %{_datadir}/%{name} +%dir %{_datadir}/%{name}/shaders +%{_datadir}/%{name}/shaders/*.h %files -n liboslcomp%{sufx} %license LICENSE @@ -275,14 +275,14 @@ find %{buildroot} -type f -name "*.la" -delete -print %license LICENSE %{_libdir}/libtestshade.so.%{sover}* -%files -n osl.imageio%{sufx} +%files -n OpenImageIO-plugin-osl %license LICENSE -%{_libdir}/osl.imageio.so.%{sover}* +%{_libdir}/OpenImageIO-%{oiio_major_minor_ver}/osl.imageio.so %files devel %license LICENSE %{_includedir}/* -%{_libdir}/*.so +%{_libdir}/lib*.so %{_libdir}/cmake/ %{_libdir}/pkgconfig/ diff --git a/osl-oslimageio-soname.patch b/osl-oslimageio-soname.patch deleted file mode 100644 index def3eb6..0000000 --- a/osl-oslimageio-soname.patch +++ /dev/null @@ -1,33 +0,0 @@ -From: Dave Plater -Date: Fri 24 Apr 08:52:18 SAST 2020 -Subject: input: reenable shared library build osl.imageio.so -Upstream: submitted - -The build mistakes version 1.11 for > 2.1 and builds osl.imageio.so as -a plugin. This would mean relocating it to a plugin directory.Index: b/src/osl.imageio/CMakeLists.txt -=================================================================== ---- a/src/osl.imageio/CMakeLists.txt 2020-03-24 07:33:42.000000000 +0200 -+++ b/src/osl.imageio/CMakeLists.txt 2020-04-22 09:31:43.152642764 +0200 -@@ -28,20 +28,16 @@ macro (add_oiio_plugin) - - # Get the name of the current directory and use it as the target name. - get_filename_component (_plugin_name ${CMAKE_CURRENT_SOURCE_DIR} NAME) -- if (OPENIMAGEIO_VERSION VERSION_LESS 2.1) - # Prior to OIIO 2.1, OIIO built plugin modules as shared libs rather - # than "modules". On OSX, that changed its extension from ".dylib" - # to ".so". If building against OIIO < 2.1, do it the old way. - # This clause can disappear when OIIO 2.1 is the minimum that OSL - # supports. -- add_library (${_plugin_name} SHARED ${_plugin_UNPARSED_ARGUMENTS}) -- set_target_properties (${_plugin_name} -+ add_library (${_plugin_name} SHARED ${_plugin_UNPARSED_ARGUMENTS}) -+ set_target_properties (${_plugin_name} - PROPERTIES - VERSION ${OSL_VERSION_MAJOR}.${OSL_VERSION_MINOR}.${OSL_VERSION_PATCH} - SOVERSION ${SOVERSION} ) -- else () -- add_library (${_plugin_name} MODULE ${_plugin_UNPARSED_ARGUMENTS}) -- endif () - - target_compile_definitions (${_plugin_name} PRIVATE - ${_plugin_DEFINITIONS}) diff --git a/osl-pkgconfig-versions.patch b/osl-pkgconfig-versions.patch deleted file mode 100644 index 7036a31..0000000 --- a/osl-pkgconfig-versions.patch +++ /dev/null @@ -1,22 +0,0 @@ -From: Dave Plater -Date: Tue 21 Apr 10:49:01 SAST 2020 -Subject: input: Fix version field in pc files -Upstream: submitted - -CMakeLists.txt fails to provide Version: -@PACKAGE_VERSION_MAJOR@.@PACKAGE_VERSION_MINOR@.@PACKAGE_VERSION_PATCH@ -for pc files resulting in a Version: field of .. -This patch adds the above variables.diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9877af9a..4b84c7a9 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -50,6 +50,9 @@ set (OSO_FILE_VERSION_MINOR 0) - # This needs to be early, for CMAKE_INSTALL_FULL_DATADIR - include (GNUInstallDirs) - -+set (PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) -+set (PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) -+set (PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) - - option (VERBOSE "Print lots of messages while compiling" OFF) - set (${PROJ_NAME}_NAMESPACE ${PROJECT_NAME} CACHE STRING