%global _trivial .0 %global _buildid .0 # spec file for llvm20--bootstrap # # This spec file is for building a minimal, namespaced version of LLVM 19. # The purpose of this package is to be the first stage of a two-stage # bootstrap build process. It is used to compile the intermediate # llvm19-bootstrap2 package. Name: llvm Version: 20.1.8 Release: 1%{dist}%{?_trivial}%{?_buildid} Summary: The LLVM Compiler Infrastructure, minimal namespaced bootstrap version License: Apache-2.0 AND NCSA URL: https://llvm.org/ Source0: https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/llvm-project-20.1.8.src.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-20.1.8/llvm-project-20.1.8.src.tar.xz.sig # Amazon Patches Patch1000: 0001-add-amazon-triplets-as-recognized-clang-toolchain-in.patch BuildRequires: cmake BuildRequires: gcc14 BuildRequires: gcc14-c++ BuildRequires: ninja-build BuildRequires: zlib-devel BuildRequires: libxml2-devel BuildRequires: python3-devel BuildRequires: openssl-devel BuildRequires: gmp-devel BuildRequires: libtool BuildRequires: binutils-devel # We explicitly list the llvm18 packages as a build dependency. BuildRequires: clang19 BuildRequires: lld19 BuildRequires: llvm19 BuildRequires: compiler-rt19 %global toolchain clang Requires: zlib Requires: libxml2 Requires: gcc14 gcc14-c++ # Disable all debug package generation as this is a minimal bootstrap package. %global debug_package %{nil} %define debuginfo %{nil} %define __strip %{nil} # Allow installed but not packaged files, which is useful for a bootstrap build. %define _unpackaged_files_terminate_build 0 %description This package contains a minimal bootstrap build of the LLVM 19 compiler infrastructure. It is intentionally small, providing just the necessary components to build a more complete, intermediate bootstrap package. %prep %autosetup -p1 -n llvm-project-20.1.8.src %build export CFLAGS="$(echo %{optflags} | sed -e 's|fno-openmp-implicit-rpath||g')" export CXXFLAGS="$(echo %{optflags} | sed -e 's|fno-openmp-implicit-rpath||g')" export LDFLAGS="$(echo %{optflags} | sed -e 's|fno-openmp-implicit-rpath||g')" export CC=clang-19 export CXX=clang++-19 export LD=lld-19 %cmake -S llvm -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS="${CFLAGS}" \ -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ -DCMAKE_INSTALL_PREFIX=%{_libdir}/llvm \ -DLLVM_ENABLE_PROJECTS="clang;lld" \ -DLLVM_BUILD_TESTS=OFF \ -DLLVM_BUILD_DOCS=OFF \ -DLLVM_TOOL_LLD_BUILD=ON \ -DLLVM_TOOL_CLANG_BUILD=ON \ -DCMAKE_C_COMPILER=%{_libdir}/llvm19/bin/clang \ -DCMAKE_CXX_COMPILER=%{_libdir}/llvm19/bin/clang++ \ -DCLANG_DEFAULT_C_STDLIB=glibc \ -DCLANG_DEFAULT_CXX_STDLIB=libstdc++ \ -DLLVM_LINK_LLVM_DYLIB=ON \ -DBUILD_SHARED_LIBS=OFF \ -DLLVM_ENABLE_LTO=OFF \ -DLLVM_TOOL_LLVM_GOLD_BUILD=OFF \ -DCMAKE_C_COMPILER_TARGET="%{_arch}-amazon-linux" \ -DCMAKE_CXX_COMPILER_TARGET="%{_arch}-amazon-linux" \ -DCLANG_DEFAULT_C_STDLIB=glibc \ -DCLANG_DEFAULT_CXX_STDLIB=libstdc++ \ -DCLANG_DEFAULT_LINKER=lld %cmake_build %install # Perform the install using the new versioned prefix. %cmake_install # Fix ambiguous python and perl shebangs. find %{buildroot}%{_libdir}/llvm -type f -exec sed -i -e '1s|#!/usr/bin/env python$|#!/usr/bin/python3|' \ -e '1s|#!/usr/bin/env python3$|#!/usr/bin/python3|' \ -e '1s|#!/usr/bin/env perl$|#!/usr/bin/perl|' {} + # Create symlinks to the core tools in %{_bindir} # Use absolute paths to prevent broken links on 64-bit systems. install -d %{buildroot}%{_bindir} ln -sf %{_libdir}/llvm/bin/clang %{buildroot}%{_bindir}/clang ln -sf %{_libdir}/llvm/bin/clang %{buildroot}%{_bindir}/clang++ ln -sf %{_libdir}/llvm/bin/lld %{buildroot}%{_bindir}/lld ln -sf %{_libdir}/llvm/bin/lld %{buildroot}%{_bindir}/ld.lld ln -sf %{_libdir}/llvm/bin/llvm-ar %{buildroot}%{_bindir}/llvm-ar ln -sf %{_libdir}/llvm/bin/llvm-nm %{buildroot}%{_bindir}/llvm-nm ln -sf %{_libdir}/llvm/bin/llvm-objdump %{buildroot}%{_bindir}/llvm-objdump ln -sf %{_libdir}/llvm/bin/llvm-readelf %{buildroot}%{_bindir}/llvm-readelf ln -sf %{_libdir}/llvm/bin/llvm-strip %{buildroot}%{_bindir}/llvm-strip # Copy the license file to the correct location install -d %{buildroot}%{_defaultlicensedir}/%{name} install -m 644 LICENSE.TXT %{buildroot}%{_defaultlicensedir}/%{name}/LICENSE.TXT %files %license %{_defaultlicensedir}/%{name}/LICENSE.TXT %{_bindir}/* %dir %{_libdir}/llvm/ %{_libdir}/llvm/bin/* %{_libdir}/llvm/lib/* %{_libdir}/llvm/libexec/* %{_libdir}/llvm/include/* %{_libdir}/llvm/share/* %{_libdir}/llvm/lib/cmake/* %changelog * Thu Aug 07 2025 Yonghang Wang - 20.1.8-1 - Initial bootstrap package for LLVM 20, namespaced.