%global _trivial .0 %global _buildid .2 # spec file for llvm19-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: llvm19-bootstrap Version: 19.1.7 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-19.1.7/llvm-project-19.1.7.src.tar.xz Source1: https://github.com/llvm/llvm-project/releases/download/llvmorg-19.1.7/llvm-project-19.1.7.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: clang18 BuildRequires: lld18 BuildRequires: llvm18 BuildRequires: compiler-rt18 %global toolchain clang18 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-19.1.7.src # Verify the integrity of the source tarball using the provided SHA512 hash echo "c7d63286d662707a9cd54758c9e3aaf52794a91900c484c4a6efa62d90bc719d5e7a345e4192feeb0c9fd11c82570d64677c781e5be1d645556b6aa018e47ec8 %{_sourcedir}/llvm-project-19.1.7.src.tar.xz" | sha512sum -c - %build %cmake -S llvm -G Ninja \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_FLAGS="${CFLAGS}" \ -DCMAKE_CXX_FLAGS="${CXXFLAGS}" \ -DCMAKE_INSTALL_PREFIX=%{_libdir}/llvm-19 \ -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}/llvm18/bin/clang \ -DCMAKE_CXX_COMPILER=%{_libdir}/llvm18/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-19 %cmake_build %install # Perform the install using the new versioned prefix. %cmake_install # Fix ambiguous python and perl shebangs. find %{buildroot}%{_libdir}/llvm-19 -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-19/bin/clang %{buildroot}%{_bindir}/clang-19 ln -sf %{_libdir}/llvm-19/bin/clang %{buildroot}%{_bindir}/clang++-19 ln -sf %{_libdir}/llvm-19/bin/lld %{buildroot}%{_bindir}/lld-19 ln -sf %{_libdir}/llvm-19/bin/lld %{buildroot}%{_bindir}/ld.lld-19 ln -sf %{_libdir}/llvm-19/bin/llvm-ar %{buildroot}%{_bindir}/llvm-ar-19 ln -sf %{_libdir}/llvm-19/bin/llvm-nm %{buildroot}%{_bindir}/llvm-nm-19 ln -sf %{_libdir}/llvm-19/bin/llvm-objdump %{buildroot}%{_bindir}/llvm-objdump-19 ln -sf %{_libdir}/llvm-19/bin/llvm-readelf %{buildroot}%{_bindir}/llvm-readelf-19 ln -sf %{_libdir}/llvm-19/bin/llvm-strip %{buildroot}%{_bindir}/llvm-strip-19 # 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}/*-19 %dir %{_libdir}/llvm-19/ %{_libdir}/llvm-19/bin/* %{_libdir}/llvm-19/lib/* %{_libdir}/llvm-19/libexec/* %{_libdir}/llvm-19/include/* %{_libdir}/llvm-19/share/* %{_libdir}/llvm-19/lib/cmake/* %changelog * Thu Aug 07 2025 Yonghang Wang - 19.1.7-1 - Initial bootstrap package for LLVM 19, namespaced.