Replace global compat_build with bcond

This commit is contained in:
Konrad Kleine 2021-05-05 22:53:09 +02:00
parent 81370f3bc6
commit 89c3d8eb13

View File

@ -1,4 +1,4 @@
%global compat_build 0 %bcond_with compat_build
%global maj_ver 12 %global maj_ver 12
%global min_ver 0 %global min_ver 0
@ -35,7 +35,7 @@
%{_bindir}/clang-cl \ %{_bindir}/clang-cl \
%{_bindir}/clang-cpp \ %{_bindir}/clang-cpp \
%if 0%{?compat_build} %if %{with compat_build}
%global pkg_name clang%{maj_ver} %global pkg_name clang%{maj_ver}
# Install clang to same prefix as llvm, so that apps that use llvm-config # Install clang to same prefix as llvm, so that apps that use llvm-config
# will also be able to find clang libs. # will also be able to find clang libs.
@ -78,7 +78,7 @@ License: NCSA
URL: http://llvm.org URL: http://llvm.org
Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz
Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig Source3: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_srcdir}.tar.xz.sig
%if !0%{?compat_build} %if %{without compat_build}
Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz
Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig Source2: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{version}%{?rc_ver:-rc%{rc_ver}}/%{clang_tools_srcdir}.tar.xz.sig
%endif %endif
@ -93,7 +93,7 @@ Patch4: 0005-PATCH-clang-Partially-Revert-scan-view-Remove-Report.patch
Patch5: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch Patch5: 0006-PATCH-clang-Allow-__ieee128-as-an-alias-to-__float12.patch
# Patches for clang-tools-extra # Patches for clang-tools-extra
%if !0%{?compat_build} %if %{without compat_build}
Patch201: 0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch Patch201: 0001-PATCH-clang-tools-extra-Make-clangd-CompletionModel-.patch
%endif %endif
@ -101,7 +101,7 @@ BuildRequires: gcc
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: cmake BuildRequires: cmake
BuildRequires: ninja-build BuildRequires: ninja-build
%if 0%{?compat_build} %if %{with compat_build}
BuildRequires: llvm%{maj_ver}-devel = %{version} BuildRequires: llvm%{maj_ver}-devel = %{version}
BuildRequires: llvm%{maj_ver}-static = %{version} BuildRequires: llvm%{maj_ver}-static = %{version}
%else %else
@ -198,7 +198,7 @@ Runtime library for clang.
%package devel %package devel
Summary: Development header files for clang Summary: Development header files for clang
%if !0%{?compat_build} %if %{without compat_build}
Requires: %{name}%{?_isa} = %{version}-%{release} Requires: %{name}%{?_isa} = %{version}-%{release}
# The clang CMake files reference tools from clang-tools-extra. # The clang CMake files reference tools from clang-tools-extra.
Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release} Requires: %{name}-tools-extra%{?_isa} = %{version}-%{release}
@ -215,7 +215,7 @@ Provides: %{name}-resource-filesystem(major) = %{maj_ver}
%description resource-filesystem %description resource-filesystem
This package owns the clang resouce directory: $libdir/clang/$version/ This package owns the clang resouce directory: $libdir/clang/$version/
%if !0%{?compat_build} %if %{without compat_build}
%package analyzer %package analyzer
Summary: A source code analysis framework Summary: A source code analysis framework
License: NCSA and MIT License: NCSA and MIT
@ -263,7 +263,7 @@ Requires: python3
%prep %prep
%{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}' %{gpgverify} --keyring='%{SOURCE4}' --signature='%{SOURCE3}' --data='%{SOURCE0}'
%if 0%{?compat_build} %if %{with compat_build}
%autosetup -n %{clang_srcdir} -p2 %autosetup -n %{clang_srcdir} -p2
%else %else
@ -330,7 +330,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
-DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_C_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \ -DCMAKE_CXX_FLAGS_RELWITHDEBINFO="%{optflags} -DNDEBUG" \
%endif %endif
%if 0%{?compat_build} %if %{with compat_build}
-DCLANG_BUILD_TOOLS:BOOL=OFF \ -DCLANG_BUILD_TOOLS:BOOL=OFF \
-DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \ -DLLVM_CONFIG:FILEPATH=%{_bindir}/llvm-config-%{maj_ver}-%{__isa_bits} \
-DCMAKE_INSTALL_PREFIX=%{install_prefix} \ -DCMAKE_INSTALL_PREFIX=%{install_prefix} \
@ -347,7 +347,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%endif %endif
%endif %endif
\ \
%if 0%{compat_build} %if %{with compat_build}
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \ -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen-%{maj_ver} \
%else %else
-DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \ -DLLVM_TABLEGEN_EXE:FILEPATH=%{_bindir}/llvm-tblgen \
@ -375,7 +375,7 @@ sed -i 's/\@FEDORA_LLVM_LIB_SUFFIX\@//g' test/lit.cfg.py
%cmake_install %cmake_install
%if 0%{?compat_build} %if %{with compat_build}
# Remove binaries/other files # Remove binaries/other files
rm -Rf %{buildroot}%{install_bindir} rm -Rf %{buildroot}%{install_bindir}
@ -449,7 +449,7 @@ rm -Rvf %{buildroot}%{_includedir}/clang-tidy/
ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff ln -s %{_datadir}/clang/clang-format-diff.py %{buildroot}%{_bindir}/clang-format-diff
%check %check
%if !0%{?compat_build} %if %{without compat_build}
# requires lit.py from LLVM utilities # requires lit.py from LLVM utilities
# FIXME: Fix failing ARM tests # FIXME: Fix failing ARM tests
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \ LD_LIBRARY_PATH=%{buildroot}/%{_libdir} %cmake_build --target check-all || \
@ -462,7 +462,7 @@ false
%endif %endif
%if !0%{?compat_build} %if %{without compat_build}
%files %files
%license LICENSE.TXT %license LICENSE.TXT
%{clang_binaries} %{clang_binaries}
@ -473,7 +473,7 @@ false
%endif %endif
%files libs %files libs
%if !0%{?compat_build} %if %{without compat_build}
%{_libdir}/clang/ %{_libdir}/clang/
%{_libdir}/*.so.* %{_libdir}/*.so.*
%else %else
@ -482,7 +482,7 @@ false
%endif %endif
%files devel %files devel
%if !0%{?compat_build} %if %{without compat_build}
%{_libdir}/*.so %{_libdir}/*.so
%{_includedir}/clang/ %{_includedir}/clang/
%{_includedir}/clang-c/ %{_includedir}/clang-c/
@ -500,11 +500,11 @@ false
%dir %{pkg_libdir}/clang/%{version}/include/ %dir %{pkg_libdir}/clang/%{version}/include/
%dir %{pkg_libdir}/clang/%{version}/lib/ %dir %{pkg_libdir}/clang/%{version}/lib/
%dir %{pkg_libdir}/clang/%{version}/share/ %dir %{pkg_libdir}/clang/%{version}/share/
%if !0%{?compat_build} %if %{without compat_build}
%{pkg_libdir}/clang/%{maj_ver} %{pkg_libdir}/clang/%{maj_ver}
%endif %endif
%if !0%{?compat_build} %if %{without compat_build}
%files analyzer %files analyzer
%{_bindir}/scan-view %{_bindir}/scan-view
%{_bindir}/scan-build %{_bindir}/scan-build