File mingw32-clang13.spec of Package mingw32-clang13
#
# spec file for package mingw32-clang13
#
# Copyright (c) 2023 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 _tagver 13.0.1
%define _sonum 13
%define _soclang 13
%define _name clang%{_soclang}
Name: mingw32-%{_name}
Version: %{_tagver}.1
Release: 1
Summary: CLANG frontend for LLVM
License: Apache-2.0 WITH LLVM-exception AND NCSA
Group: Development/Languages/C and C++
URL: https://clang.llvm.org/
# NOTE: please see README.packaging in the llvm package for details on how to update this package
Source: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{_tagver}/clang-%{_tagver}.src.tar.xz
BuildRequires: cmake(LLVM) = %{_tagver}
BuildRequires: gcc-c++
BuildRequires: libxml2-devel
BuildRequires: libxml2-devel
BuildRequires: mingw32(cmake:LLVM) = %{version}
BuildRequires: mingw32(pkg:zlib)
BuildRequires: mingw32-cross-cmake
BuildRequires: mingw32-cross-gcc-c++
BuildRequires: mingw32-libxml2-devel
BuildRequires: pkgconfig(zlib)
%_mingw32_package_header_debug
BuildArch: noarch
ExcludeArch: aarch64
ExcludeArch: ppc64le
ExcludeArch: i586
#Requires(post): mingw32-update-alternatives
#Requires(postun):mingw32-update-alternatives
Recommends: mingw32-clang-tools
Recommends: mingw32-cross-gcc
#Recommends: glibc-devel
#Recommends: libstdc++-devel
Suggests: mingw32-clang%{_sonum}-doc
#Suggests: libc++-devel
%description
This package contains the clang (C language) frontend for LLVM.
%package -n mingw32-clang%{_sonum}-tools
Summary: Tools for Clang
Group: Development/Languages/C and C++
URL: https://clang-analyzer.llvm.org/
# Avoid multiple provider errors
Requires: mingw32-clang%{_sonum}
# Some binaries used to be in the clang package.
#Conflicts: clang5
#Conflicts: clang6
# hmaptool used to be contained in the llvm package.
#Conflicts: llvm5
#Conflicts: llvm6
%if %{suse_version} <= 1500
# llvm9 in SLE/Leap 15.x is still affected.
#Conflicts: llvm9
%endif
Conflicts: mingw32-scan-build < %{version}
Conflicts: mingw32-scan-view < %{version}
Provides: mingw32-scan-build = %{version}
Provides: mingw32-scan-view = %{version}
Conflicts: mingw32-emacs-llvm < %{version}
Provides: mingw32-emacs-llvm = %{version}
Conflicts: mingw32-vim-plugin-llvm < %{version}
Provides: mingw32-clang-tools = %{version}
%description -n mingw32-clang%{_sonum}-tools
This package contains tools and scripts for using Clang, including:
* bash completions for clang,
* the clang-doc tool,
* plugins for using clang-format, clang-rename, clang-include-fixer
in vim and emacs.
* scripts for using clang-format: git-clang-format and clang-format-diff,
* scripts for using clang-tidy: run-clang-tidy and clang-tidy-diff,
* scripts for using the Clang static analyzer: scan-build and scan-view,
* a script for using find-all-symbols: run-find-all-symbols.
%package -n mingw32-libclang%{_soclang}
Summary: Clang stable C API for indexing and code completion
Group: System/Libraries
Conflicts: mingw32-libclang%{_soclang} < %{version}
%description -n mingw32-libclang%{_soclang}
This library exposes a limited C API for indexing and code completion for
code written in languages of the C family.
It is designed to be stable across major versions of LLVM.
It corresponds to the header files in %{_mingw32_includedir}/clang-c.
%package -n mingw32-clang%{_soclang}-devel
Summary: CLANG frontend for LLVM (devel package)
Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version}
Requires: mingw32-clang%{_sonum} = %{version}
Requires: mingw32-clang-tools >= %{version}
Requires: mingw32-libclang%{_soclang} >= %{version}
#Requires: mingw32-libclang-cpp%%{_sonum} = %%{version}
Provides: mingw32-clang-devel = %{version}
%description -n mingw32-clang%{_soclang}-devel
This package contains the clang (C language) frontend for LLVM.
(development files)
%_mingw32_debug_package
%prep
%autosetup -p1 -n clang-%{_tagver}.src
%build
# build required native tools
d=$PWD
%cmake -B NATIVE
cd $d/build/NATIVE
export PATH=$PWD/bin:$PATH
%cmake_build clang-tblgen
cd $d
%_mingw32_cmake \
-DCLANG_ENABLE_ARCMT:BOOL=OFF \
-DCLANG_ENABLE_STATIC_ANALYZER:BOOL=OFF \
-DCMAKE_DLL_NAME_WITH_SOVERSION=1 \
-DCOMPILER_RT_BUILD_SANITIZERS:BOOL=OFF \
-DCOMPILER_RT_BUILD_XRAY:BOOL=OFF \
-DCOMPILER_RT_USE_LIBCXX:BOOL=OFF \
-DENABLE_LINKER_BUILD_ID=ON \
-DLLVM_TABLEGEN_EXE=/usr/%{_mingw32_target}/bin/llvm-tblgen \
-DLLVM_TARGETS_TO_BUILD=Native \
-Dexternal_project_source_dirs="-DCMAKE_C_COMPILER=gcc;-DCMAKE_CXX_COMPILER=g++" \
%_mingw32_cmake_build
%install
%_mingw32_cmake_install
# fix mingw32-clang13-tools.noarch: E: env-script-interpreter
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_mingw32_bindir}/git-clang-format
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_mingw32_bindir}/hmaptool
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_mingw32_datadir}/clang/*.py
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_mingw32_datadir}/clang/*.el
sed -i 's,/usr/bin/env ,/usr/bin/,g' %{buildroot}%{_mingw32_datadir}/clang/*.sh
# fix mingw32-clang13-tools.noarch: E: script-without-shebang
chmod a-x %{buildroot}%{_mingw32_datadir}/clang/*.sh
chmod a-x %{buildroot}%{_mingw32_datadir}/clang/*.py
chmod a-x %{buildroot}%{_mingw32_datadir}/clang/*.el
chmod a-x %{buildroot}%{_mingw32_datadir}/clang/*.sh
rm %{buildroot}%{_mingw32_datadir}/clang/*.applescript
%files
%license CODE_OWNERS.TXT LICENSE.TXT
%{_mingw32_bindir}/c-index-test.exe
%{_mingw32_bindir}/clang++.exe
%{_mingw32_bindir}/clang-cl.exe
%{_mingw32_bindir}/clang-cpp.exe
%{_mingw32_bindir}/clang-format.exe
%{_mingw32_bindir}/clang-offload-bundler.exe
%{_mingw32_bindir}/clang-offload-wrapper.exe
%{_mingw32_bindir}/clang-refactor.exe
%{_mingw32_bindir}/clang-rename.exe
%{_mingw32_bindir}/clang-repl.exe
%{_mingw32_bindir}/clang-scan-deps.exe
%{_mingw32_bindir}/clang.exe
%{_mingw32_bindir}/diagtool.exe
%files -n mingw32-clang%{_sonum}-tools
%license CODE_OWNERS.TXT LICENSE.TXT
%{_mingw32_bindir}/git-clang-format
%{_mingw32_bindir}/hmaptool
%{_mingw32_datadir}/clang
%files -n mingw32-libclang%{_soclang}
%license CODE_OWNERS.TXT LICENSE.TXT
%{_mingw32_bindir}/libclang*.dll
%files -n mingw32-clang%{_soclang}-devel
%license CODE_OWNERS.TXT LICENSE.TXT
%{_mingw32_includedir}/clang-c/
%{_mingw32_includedir}/clang/
%dir %{_mingw32_libdir}/clang
%dir %{_mingw32_libdir}/clang/%{_tagver}
%{_mingw32_libdir}/clang/%{_tagver}/include
%{_mingw32_libdir}/cmake/clang
%{_mingw32_libdir}/libclang*.dll.a