File mingw64-spirv-tools.spec of Package mingw64-spirv-tools

#
# spec file for package mingw64-spirv-tools
#
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via https://bugs.opensuse.org/
#


%define _lto_cflags %nil
%define lname libSPIRV-Tools-2023_1

%define _name   spirv-tools
Name:           mingw64-%{_name}
Version:        2023.1
Release:        0
Summary:        API and commands for processing SPIR-V modules
License:        Apache-2.0
Group:          Development/Libraries/C and C++
URL:            https://github.com/KhronosGroup/SPIRV-Tools
Source:         https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/v%version.tar.gz
Patch1:         ver.diff
#PATCH-FIX-UPSTREAM https://github.com/KhronosGroup/SPIRV-Tools/pull/5127
Patch3:         SPIRV-Tools-2022.3-init-_old_mode-fix.patch
#PATCH-FIX-UPSTREAM https://github.com/KhronosGroup/SPIRV-Tools/pull/5129
Patch4:         SPIRV-Tools-2022.3-cmake-install-dir-mingw.patch
BuildRequires:  bison
BuildRequires:  mingw64-cross-cmake 
BuildRequires:  mingw64-cross-gcc-c++
BuildRequires:  mingw64-pkg-config
BuildRequires:  mingw64-spirv-headers >= 1.6.1+sdk236
BuildRequires:  python3-base
BuildRequires:  python3-xml
%_mingw64_package_header_debug
BuildArch:      noarch

%description
The package includes an assembler, binary module parser,
disassembler, and validator for SPIR-V.

%package -n mingw64-%lname
Summary:        SPIR-V tool component library
Group:          System/Libraries

%description -n mingw64-%lname
The SPIR-V Tool library contains all of the implementation details
driving the SPIR-V assembler, binary module parser, disassembler and
validator, and is used in the standalone tools whilst also enabling
integration into other code bases directly.

%package devel
Summary:        Development headers for the SPIR-V tool library
Group:          Development/Libraries/C and C++
Requires:       mingw64-%lname = %version

%description devel
The SPIR-V Tool library contains all of the implementation details
driving the SPIR-V assembler, binary module parser, disassembler and
validator, and is used in the standalone tools whilst also enabling
integration into other code bases directly.

%_mingw64_debug_package

%prep
%define slibv 2023.1
%autosetup -p1 -n SPIRV-Tools-%version
find . -type f -name CMakeLists.txt -exec \
	perl -i -pe 's{\@PACKAGE_VERSION\@}{%slibv}' CMakeLists.txt {} +

%build
%if 0%{?suse_version} >= 1550
#export CXXFLAGS="%optflags -Wno-error=stringop-truncation"
%endif
%_mingw64_cmake -DSPIRV-Headers_SOURCE_DIR="%_mingw64_prefix" \
	-DSPIRV_TOOLS_BUILD_STATIC:BOOL=OFF -DBUILD_SHARED_LIBS:BOOL=ON
%_mingw64_cmake_build

%install
%_mingw64_cmake_install
perl -i -lpe 's{^#!/usr/bin/env sh$}{#!/bin/sh}' "%buildroot%_mingw64_bindir/spirv-lesspipe.sh"

%files
%_mingw64_bindir/spirv-*.exe
%doc LICENSE

%files -n mingw64-%lname
%_mingw64_bindir/libSPIRV-Tools*.dll
%_mingw64_bindir/libSPIRV-Tools-diff*.dll
%_mingw64_bindir/libSPIRV-Tools-link*.dll
%_mingw64_bindir/libSPIRV-Tools-lint*.dll
%_mingw64_bindir/libSPIRV-Tools-opt*.dll
%_mingw64_bindir/libSPIRV-Tools-reduce*.dll
%_mingw64_bindir/libSPIRV-Tools-shared*.dll

%files devel
%_mingw64_bindir/spirv-lesspipe.sh
%_mingw64_libdir/cmake/
%_mingw64_libdir/libSPIRV-Tools.dll.a
%_mingw64_libdir/libSPIRV-Tools-diff.dll.a
%_mingw64_libdir/libSPIRV-Tools-link.dll.a
%_mingw64_libdir/libSPIRV-Tools-lint.dll.a
%_mingw64_libdir/libSPIRV-Tools-opt.dll.a
%_mingw64_libdir/libSPIRV-Tools-reduce.dll.a
%_mingw64_libdir/libSPIRV-Tools-shared.dll.a
%_mingw64_libdir/pkgconfig/SPIRV-Tools.pc
%_mingw64_libdir/pkgconfig/SPIRV-Tools-shared.pc
%_mingw64_includedir/spirv-tools/

%changelog
openSUSE Build Service is sponsored by