236 lines
9.2 KiB
Diff
236 lines
9.2 KiB
Diff
From 595c2a20d256bf8e3b2ac8687c0029b42e64878d Mon Sep 17 00:00:00 2001
|
|
From: Nikita Popov <npopov@redhat.com>
|
|
Date: Jun 13 2025 08:46:26 +0000
|
|
Subject: Invert symlink direction
|
|
|
|
|
|
This is an alternative to:
|
|
https://src.fedoraproject.org/rpms/llvm/pull-request/439.
|
|
|
|
Instead of undoing the prefix change completely, this instead inverts
|
|
the direction of the symlinks: The non-compat package ships all the
|
|
files in the default prefix, but has symlinks from the versioned
|
|
prefix to the default prefix.
|
|
|
|
The implementation approach is to install everything into the
|
|
versioned prefix first (keeping things unified between compat and
|
|
non-compat build initially) and to then move and symlink in
|
|
post-processing.
|
|
|
|
The llvm-config setup here stays the same as it currently is,
|
|
with llvm-config executables being installed in the versioned
|
|
prefix, while the one in the default prefix is managed by
|
|
alternatives. This patch does not fix the issues with alternatives
|
|
handling, we'd apply https://src.fedoraproject.org/rpms/llvm/pull-request/417
|
|
on top of this patch for that.
|
|
|
|
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=2365079.
|
|
|
|
---
|
|
|
|
diff --git a/Makefile b/Makefile
|
|
index ced0465..242e15d 100644
|
|
--- a/Makefile
|
|
+++ b/Makefile
|
|
@@ -4,7 +4,7 @@
|
|
# Tweak this to centos-stream-9-x86_64 to build for CentOS
|
|
MOCK_CHROOT?=fedora-rawhide-x86_64
|
|
MOCK_OPTS?=
|
|
-MOCK_OPTS_RELEASE?=--no-clean --no-cleanup-after --without lto_build --define "debug_package %{nil}" $(MOCK_OPTS)
|
|
+MOCK_OPTS_RELEASE?=--no-clean --no-cleanup-after --without lto_build --without pgo --define "debug_package %{nil}" $(MOCK_OPTS)
|
|
MOCK_OPTS_SNAPSHOT?=$(MOCK_OPTS_RELEASE) --with snapshot_build $(MOCK_OPTS)
|
|
YYYYMMDD?=$(shell date +%Y%m%d)
|
|
SOURCEDIR=$(shell pwd)
|
|
diff --git a/llvm.spec b/llvm.spec
|
|
index 9d9e5d7..dcdef08 100644
|
|
--- a/llvm.spec
|
|
+++ b/llvm.spec
|
|
@@ -316,7 +316,7 @@
|
|
#region main package
|
|
Name: %{pkg_name_llvm}
|
|
Version: %{maj_ver}.%{min_ver}.%{patch_ver}%{?rc_ver:~rc%{rc_ver}}%{?llvm_snapshot_version_suffix:~%{llvm_snapshot_version_suffix}}
|
|
-Release: 7%{?dist}
|
|
+Release: 8%{?dist}
|
|
Summary: The Low Level Virtual Machine
|
|
|
|
License: Apache-2.0 WITH LLVM-exception OR NCSA
|
|
@@ -1330,8 +1330,15 @@ popd
|
|
-DCLANG_INCLUDE_TESTS:BOOL=ON \\\
|
|
-DCLANG_PLUGIN_SUPPORT:BOOL=ON \\\
|
|
-DCLANG_REPOSITORY_STRING="%{?dist_vendor} %{version}-%{release}" \\\
|
|
- -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra \\\
|
|
+ -DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR=../clang-tools-extra
|
|
+
|
|
+%if %{with compat_build}
|
|
+%global cmake_config_args %{cmake_config_args} \\\
|
|
-DCLANG_RESOURCE_DIR=../../../lib/clang/%{maj_ver}
|
|
+%else
|
|
+%global cmake_config_args %{cmake_config_args} \\\
|
|
+ -DCLANG_RESOURCE_DIR=../lib/clang/%{maj_ver}
|
|
+%endif
|
|
#endregion clang options
|
|
|
|
#region compiler-rt options
|
|
@@ -1938,8 +1945,12 @@ rm -Rvf %{buildroot}%{install_datadir}/clang-doc
|
|
# TODO: What are the Fedora guidelines for packaging bash autocomplete files?
|
|
rm -vf %{buildroot}%{install_datadir}/clang/bash-autocomplete.sh
|
|
|
|
-# Create sub-directories in the clang resource directory that will be
|
|
-# populated by other packages
|
|
+%if %{without compat_build}
|
|
+# Move clang resource directory to default prefix.
|
|
+mkdir -p %{buildroot}%{_prefix}/lib/clang
|
|
+mv %{buildroot}%{install_prefix}/lib/clang/%{maj_ver} %{buildroot}%{_prefix}/lib/clang/%{maj_ver}
|
|
+%endif
|
|
+# Create any missing sub-directories in the clang resource directory.
|
|
mkdir -p %{buildroot}%{_prefix}/lib/clang/%{maj_ver}/{bin,include,lib,share}/
|
|
|
|
# Add versioned resource directory macro
|
|
@@ -2025,7 +2036,7 @@ rmdir %{buildroot}%{install_prefix}/%{_lib}/python%{python3_version}
|
|
|
|
# python: fix binary libraries location
|
|
liblldb=$(basename $(readlink -e %{buildroot}%{install_libdir}/liblldb.so))
|
|
-ln -vsf "../../../llvm%{maj_ver}/lib/${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
|
|
+ln -vsf "../../../${liblldb}" %{buildroot}%{python3_sitearch}/lldb/_lldb.so
|
|
%py_byte_compile %{__python3} %{buildroot}%{python3_sitearch}/lldb
|
|
%endif
|
|
%endif
|
|
@@ -2066,62 +2077,69 @@ popd
|
|
rm -f %{buildroot}%{install_libdir}/libLLVMBOLT*.a
|
|
#endregion BOLT installation
|
|
|
|
-# Create symlinks from the system install prefix to the llvm install prefix.
|
|
+# Move files from src to dest and replace the old files in src with relative
|
|
+# symlinks.
|
|
+move_and_replace_with_symlinks() {
|
|
+ local src="$1"
|
|
+ local dest="$2"
|
|
+ mkdir -p "$dest"
|
|
+
|
|
+ # Change to source directory to simplify relative paths
|
|
+ (cd "$src" && \
|
|
+ find * -type d -exec mkdir -p "$dest/{}" \; && \
|
|
+ find * \( -type f -o -type l \) -exec mv "$src/{}" "$dest/{}" \; \
|
|
+ -exec ln -s --relative "$dest/{}" "$src/{}" \;)
|
|
+}
|
|
+
|
|
+%if %{without compat_build}
|
|
+# Move files from the llvm prefix to the system prefix and replace them with
|
|
+# symlinks. We do it this way around because symlinks between multilib packages
|
|
+# would conflict otherwise.
|
|
+move_and_replace_with_symlinks %{buildroot}%{install_bindir} %{buildroot}%{_bindir}
|
|
+move_and_replace_with_symlinks %{buildroot}%{install_libdir} %{buildroot}%{_libdir}
|
|
+move_and_replace_with_symlinks %{buildroot}%{install_libexecdir} %{buildroot}%{_libexecdir}
|
|
+move_and_replace_with_symlinks %{buildroot}%{install_includedir} %{buildroot}%{_includedir}
|
|
+move_and_replace_with_symlinks %{buildroot}%{install_datadir} %{buildroot}%{_datadir}
|
|
+%endif
|
|
+
|
|
+# Create versioned symlinks for binaries.
|
|
# Do this at the end so it includes any files added by preceding steps.
|
|
mkdir -p %{buildroot}%{_bindir}
|
|
for f in %{buildroot}%{install_bindir}/*; do
|
|
filename=`basename $f`
|
|
- if [[ "$filename" == "clang-%{maj_ver}" ]]; then
|
|
+ if [[ "$filename" =~ ^(lit|ld|clang-%{maj_ver})$ ]]; then
|
|
continue
|
|
fi
|
|
- # Add symlink for binaries with version suffix.
|
|
- ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver}
|
|
- # For non-compat builds, also add a symlink without version suffix.
|
|
- %if %{without compat_build}
|
|
- ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename
|
|
+ %if %{with compat_build}
|
|
+ ln -s ../../%{install_bindir}/$filename %{buildroot}/%{_bindir}/$filename-%{maj_ver}
|
|
+ %else
|
|
+ # clang-NN is already created by the build system.
|
|
+ if [[ "$filename" == "clang" ]]; then
|
|
+ continue
|
|
+ fi
|
|
+ ln -s $filename %{buildroot}/%{_bindir}/$filename-%{maj_ver}
|
|
%endif
|
|
done
|
|
|
|
-# Move man pages to system install prefix.
|
|
mkdir -p %{buildroot}%{_mandir}/man1
|
|
for f in %{buildroot}%{install_mandir}/man1/*; do
|
|
filename=`basename $f`
|
|
filename=${filename%.1}
|
|
- mv $f %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1
|
|
- %if %{without compat_build}
|
|
- ln -s $filename-%{maj_ver}.1 %{buildroot}%{_mandir}/man1/$filename.1
|
|
+ %if %{with compat_build}
|
|
+ # Move man pages to system install prefix.
|
|
+ mv $f %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1
|
|
+ %else
|
|
+ # Create suffixed symlink.
|
|
+ ln -s $filename.1 %{buildroot}%{_mandir}/man1/$filename-%{maj_ver}.1
|
|
%endif
|
|
done
|
|
-rmdir %{buildroot}%{install_mandir}/man1
|
|
-rmdir %{buildroot}%{install_mandir}
|
|
+rm -rf %{buildroot}%{install_mandir}
|
|
|
|
+# As an exception, always keep llvm-config in the versioned prefix.
|
|
+# The llvm-config in the default prefix will be managed by alternatives.
|
|
%if %{without compat_build}
|
|
-# We don't create directory symlinks, because RPM does not support
|
|
-# switching between a directory and a symlink, causing upgrade/downgrade issues.
|
|
-# Instead, recursively copy the directories while creating symlinks.
|
|
-copy_with_relative_symlinks() {
|
|
- local src="$1"
|
|
- local dest="$2"
|
|
- mkdir -p "$dest"
|
|
-
|
|
- # Change to source directory to simplify relative paths
|
|
- (cd "$src" && \
|
|
- find * -type d -exec mkdir -p "$dest/{}" \; && \
|
|
- find * \( -type f -o -type l \) -exec ln -s --relative "$src/{}" "$dest/{}" \;)
|
|
-}
|
|
-
|
|
-# Add symlinks for libraries.
|
|
-copy_with_relative_symlinks %{buildroot}%{install_libdir} %{buildroot}%{_libdir}
|
|
-copy_with_relative_symlinks %{buildroot}%{install_libexecdir} %{buildroot}%{_libexecdir}
|
|
-copy_with_relative_symlinks %{buildroot}%{install_includedir} %{buildroot}%{_includedir}
|
|
-copy_with_relative_symlinks %{buildroot}%{install_datadir} %{buildroot}%{_datadir}
|
|
-
|
|
-%if %{maj_ver} >= 21 && %{with offload}
|
|
-# Remove offload libaries since we only want to ship these in the configured
|
|
-# install prefix.
|
|
-rm -Rf %{buildroot}%{_libdir}/amdgcn-amd-amdhsa
|
|
-rm -Rf %{buildroot}%{_libdir}/nvptx64-nvidia-cuda
|
|
-%endif
|
|
+rm %{buildroot}%{install_bindir}/llvm-config
|
|
+mv %{buildroot}%{_bindir}/llvm-config %{buildroot}%{install_bindir}/llvm-config
|
|
%endif
|
|
|
|
# ghost presence for llvm-config, managed by alternatives.
|
|
@@ -3164,10 +3182,12 @@ fi
|
|
libomptarget-nvptx*.bc
|
|
}}
|
|
%else
|
|
-%{install_libdir}/amdgcn-amd-amdhsa/libompdevice.a
|
|
-%{install_libdir}/amdgcn-amd-amdhsa/libomptarget-amdgpu.bc
|
|
-%{install_libdir}/nvptx64-nvidia-cuda/libompdevice.a
|
|
-%{install_libdir}/nvptx64-nvidia-cuda/libomptarget-nvptx.bc
|
|
+%{expand_libs %{expand:
|
|
+ amdgcn-amd-amdhsa/libompdevice.a
|
|
+ amdgcn-amd-amdhsa/libomptarget-amdgpu.bc
|
|
+ nvptx64-nvidia-cuda/libompdevice.a
|
|
+ nvptx64-nvidia-cuda/libomptarget-nvptx.bc
|
|
+}}
|
|
%endif
|
|
|
|
%expand_includes offload
|
|
@@ -3403,6 +3423,10 @@ fi
|
|
|
|
#region changelog
|
|
%changelog
|
|
+* Tue Jun 10 2025 Nikita Popov <npopov@redhat.com> - 20.1.6-8
|
|
+- Invert symlink direction
|
|
+- Fix i686 multilib installation (rhbz#2365079)
|
|
+
|
|
* Thu Jun 05 2025 Timm Bäder <tbaeder@redhat.com> - 20.1.6-7
|
|
- Backport patch to fix rhbz#2363895
|
|
|
|
|