From 7471cd75e84c9c8407ba8e8f43a1bae8179ced98 Mon Sep 17 00:00:00 2001 From: Konrad Kleine Date: Tue, 16 Feb 2021 11:40:45 +0100 Subject: [PATCH] Prepare for snapshot build Increase verbosity for %autosetup Modified patch so it cleanly applies Renaming man pages is no longer needed Fix this error: mv /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/clang-tblgen.1 /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/lldb-tblgen.1 /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/llvm-tblgen.1 /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/mlir-tblgen.1 /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/tblgen.1 /builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/llvm-tblgen.1 mv: target '/builddir/build/BUILDROOT/llvm-13.0.0~pre20210427.gd122d80b3d1c3f-1.fc35.x86_64/usr/share/man/man1/llvm-tblgen.1' is not a directory Add entry for changelog when building a snapshot Reset 0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch because it is not applicable to LLVM 12 Moved BuildRequires: python3-psutil out in PR See https://src.fedoraproject.org/rpms/llvm/pull-request/91 Make download path for snapshot sources-easily adjustable Added cmake subpackage with shared cmake files Install cmake files into /usr/lib64/cmake/llvm with the llvm-devel pkg --- ...source-interleave-prefix-test-case-c.patch | 29 +++++++++ llvm.spec | 59 ++++++++++++++++++- 2 files changed, 86 insertions(+), 2 deletions(-) create mode 100644 0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch diff --git a/0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch b/0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch new file mode 100644 index 0000000..1f423e9 --- /dev/null +++ b/0001-PATCH-llvm-Make-source-interleave-prefix-test-case-c.patch @@ -0,0 +1,29 @@ +From ff206863a626dad99d011aeb60770270c300e56f Mon Sep 17 00:00:00 2001 +From: Konrad Kleine +Date: Tue, 27 Apr 2021 14:41:57 +0200 +Subject: [PATCH] [PATCH][llvm] Make source-interleave-prefix test case + compatible with llvm-test + +llvm-test runs test from a directory that's not the upstream one, and that leads +to some false positive. Workaround this by forcing the current working +directory. +--- + llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test +index 746add22f96e..8b28b877e372 100644 +--- a/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test ++++ b/llvm/test/tools/llvm-objdump/X86/source-interleave-prefix.test +@@ -11,7 +11,7 @@ + + ; RUN: sed -e "s,SRC_COMPDIR,./Inputs,g" %p/Inputs/source-interleave.ll > %t-relative-path.ll + ; RUN: llc -o %t-relative-path.o -filetype=obj -mtriple=x86_64-pc-linux %t-relative-path.ll +-; RUN: llvm-objdump --prefix myprefix --source %t-relative-path.o 2>&1 | \ ++; RUN: mkdir -p %t0 && cd %t0 && llvm-objdump --prefix myprefix --source %t-relative-path.o 2>&1 | \ + ; RUN: FileCheck %s --check-prefix=CHECK-BROKEN-PREFIX -DFILE=%t-relative-path.o -DPREFIX=. -DCOMPDIR=/Inputs + ; CHECK-BROKEN-PREFIX: warning: '[[FILE]]': failed to find source [[PREFIX]][[COMPDIR]]{{[/\\]}}source-interleave-x86_64.c + +-- +2.31.1 + diff --git a/llvm.spec b/llvm.spec index 8b63e2d..fe9ce1e 100644 --- a/llvm.spec +++ b/llvm.spec @@ -24,6 +24,19 @@ %endif %global llvm_srcdir llvm-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:rc%{rc_ver}}.src +%if %{with snapshot_build} +%undefine rc_ver +%global llvm_snapshot_vers pre%{llvm_snapshot_yyyymmdd}.g%{llvm_snapshot_git_revision_short} +# FIXME(kkleine): Until we have the top-level "cmake" directory of the LLVM +# source tree separated out, we're going to use the complete source tarball +# ("llvm-project" instead of "llvm") for this. +%global llvm_srcdir llvm-project-%{llvm_snapshot_version_major}.%{llvm_snapshot_version_minor}.%{llvm_snapshot_version_patch}.src/llvm +%global maj_ver %{llvm_snapshot_version_major} +%global min_ver %{llvm_snapshot_version_minor} +%global patch_ver %{llvm_snapshot_version_patch} +%endif + + %if %{with compat_build} %global pkg_name llvm%{maj_ver} %global exec_suffix -%{maj_ver} @@ -67,15 +80,28 @@ %endif Name: %{pkg_name} +<<<<<<< HEAD Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}} Release: 1%{?dist} +======= +Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_vers:~%{llvm_snapshot_vers}} +Release: 8%{?dist} +>>>>>>> c3d4228 (Prepare for snapshot build) Summary: The Low Level Virtual Machine License: NCSA URL: http://llvm.org +%if %{with snapshot_build} +# FIXME(kkleine): Until we have the top-level "cmake" directory of the LLVM +# source tree separated out, we're going to use the complete source tarball +# ("llvm-project" instead of "llvm") for this. +Source0: %{llvm_snapshot_source_prefix}llvm-project-%{llvm_snapshot_yyyymmdd}.src.tar.xz +%else Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{llvm_srcdir}.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-%{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:-rc%{rc_ver}}/%{llvm_srcdir}.tar.xz.sig Source2: tstellar-gpg-key.asc +%endif + %if %{without compat_build} Source3: run-lit-tests @@ -169,6 +195,12 @@ Summary: LLVM shared libraries %description libs Shared libraries for the LLVM compiler infrastructure. +%package cmake-devel +Summary: LLVM Shared development CMake files + +%description cmake-devel +Some CMake files that are shared by LLVM sub-projects when building. + %package static Summary: LLVM static libraries Conflicts: %{name}-devel < 8 @@ -199,7 +231,9 @@ LLVM's modified googletest sources. %endif %prep +%if %{without snapshot_build} %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' +%endif %autosetup -n %{llvm_srcdir} -p2 %py3_shebang_fix \ @@ -276,8 +310,12 @@ LLVM's modified googletest sources. -DLLVM_ENABLE_SPHINX:BOOL=ON \ -DLLVM_ENABLE_DOXYGEN:BOOL=OFF \ \ +%if %{with snapshot_build} + -DLLVM_VERSION_SUFFIX="%{llvm_snapshot_vers}" \ +%else %if %{without compat_build} -DLLVM_VERSION_SUFFIX='' \ +%endif %endif -DLLVM_BUILD_LLVM_DYLIB:BOOL=ON \ -DLLVM_LINK_LLVM_DYLIB:BOOL=ON \ @@ -354,7 +392,14 @@ ln -s %{_libdir}/LLVMgold.so %{buildroot}%{_libdir}/bfd-plugins/ # Add version suffix to binaries for f in %{buildroot}/%{install_bindir}/*; do filename=`basename $f` - ln -s ../../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix} + # this one already got renamed earlier, just keep a symbolic link for it for + # cmake compatibility + if test "$filename" == "llvm-config%{exec_suffix}-%{__isa_bits}" + then + (cd %{buildroot}/%{install_bindir} ; ln -s llvm-config%{exec_suffix}-%{__isa_bits} llvm-config ) + else + ln -s ../../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename%{exec_suffix} + fi done # Move header files @@ -409,7 +454,12 @@ rm %{buildroot}%{_bindir}/llvm-config%{exec_suffix} # ghost presence touch %{buildroot}%{_bindir}/llvm-config%{exec_suffix} - +%if %{without compat_build} +# install shared cmake modules into /usr/lib64/cmake/llvm or /usr/lib/cmake/llvm +# see https://docs.fedoraproject.org/en-US/packaging-guidelines/RPMMacros/ +# see https://reviews.llvm.org/D88458 +cp -Rv ../cmake/Modules/* %{buildroot}%{_libdir}/cmake/llvm/ +%endif %check # Disable check section on arm due to some kind of memory related failure. @@ -545,9 +595,14 @@ fi %{_datadir}/llvm/src/utils %{_libdir}/libLLVMTestingSupport.a +%files cmake-devel +%{_libdir}/cmake/llvm/ + %endif %changelog +%{?llvm_snapshot_changelog_entry} + * Mon Jan 10 2022 Nikita Popov - 13.0.1~rc1-1 - Upstream 13.0.1 rc1 release