void-packages/srcpkgs/llvm19/template

1109 lines
30 KiB
Bash

# Template file for 'llvm19'
pkgname=llvm19
version=19.1.4
revision=1
build_wrksrc=llvm
build_style=cmake
_llvm_prefix=lib/llvm/19
_llvm_mandir=usr/${_llvm_prefix}/share/man
_llvm_bindir=usr/${_llvm_prefix}/bin
_llvm_datadir=usr/${_llvm_prefix}/share
_llvm_incdir=usr/${_llvm_prefix}/include
_llvm_libdir=usr/${_llvm_prefix}/lib
_llvm_libexecdir=usr/${_llvm_prefix}/libexec
_ext_suffix=".cpython-${py3_ver/./}-linux-${XBPS_TARGET_LIBC/glibc/gnu}.so"
configure_args="
-DCMAKE_BUILD_TYPE=Release -Wno-dev
-DCMAKE_INSTALL_PREFIX=/usr/${_llvm_prefix}
-DENABLE_LINKER_BUILD_ID=YES
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES
-DLIBCXXABI_USE_COMPILER_RT=YES
-DLIBCXXABI_USE_LLVM_UNWINDER=YES
-DLIBCXX_CXX_ABI=libcxxabi
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES
-DLIBCXX_USE_COMPILER_RT=YES
-DLIBOMP_ENABLE_SHARED=YES
-DLIBOMP_INSTALL_ALIASES=NO
-DOPENMP_INSTALL_LIBDIR=lib
-DOFFLOAD_INSTALL_LIBDIR=lib
-DLLVM_BUILD_DOCS=YES
-DLLVM_INCLUDE_DOCS=YES
-DLLVM_ENABLE_SPHINX=YES
-DLLVM_ENABLE_Z3_SOLVER=YES
-DSPHINX_WARNINGS_AS_ERRORS=NO
-DLLVM_INSTALL_UTILS=YES
-DLLVM_BUILD_LLVM_DYLIB=YES
-DLLVM_LINK_LLVM_DYLIB=YES
-DCLANG_LINK_CLANG_DYLIB=YES
-DCLANG_CONFIG_FILE_SYSTEM_DIR=/etc/clang19
-DLLVM_ENABLE_RTTI=YES
-DLLVM_ENABLE_FFI=YES
-DLLVM_BINUTILS_INCDIR=/usr/include
-DLLDB_PYTHON_RELATIVE_PATH=lib/python${py3_ver}/site-packages
-DLLDB_PYTHON_EXE_RELATIVE_PATH=bin/python${py3_ver}
-DLLDB_PYTHON_EXT_SUFFIX=$_ext_suffix
-DLLVM_ENABLE_PER_TARGET_RUNTIME_DIR=NO
-DLLVM_SPIRV=/usr/bin/llvm-spirv
"
hostmakedepends="perl python3 zlib-devel libffi-devel swig python3-Sphinx
python3-recommonmark python3-sphinx-automodapi git python3-sphinx-markdown-tables python3-yaml pkg-config
python3-mdit-py-plugins python3-MyST-Parser python3-markdown-it
patchelf $(vopt_if graphviz graphviz)"
makedepends="python3-devel zlib-devel elfutils-devel libffi-devel libedit-devel
libxml2-devel binutils-devel z3-devel"
short_desc="LLVM Compiler Infrastructure Project - Version 19"
maintainer="Daniel Martinez <danielmartinez@cock.li>"
license="Apache-2.0 AND NCSA AND custom:Apache-2.0-with-llvm-exception"
homepage="https://www.llvm.org"
distfiles="https://github.com/llvm/llvm-project/archive/refs/tags/llvmorg-${version}.tar.gz"
checksum=010e1fd3cabee8799bd2f8a6fbc68f28207494f315cf9da7057a2820f79fd531
conflicts="llvm18>=0 llvm17>=0 llvm15>=0"
lib32disabled=yes
python_version=3
build_options="clang clang_tools_extra lld mlir libclc polly lldb flang bolt
openmp libc libcxx libunwind offload lto graphviz full_debug"
build_options_default="clang clang_tools_extra lld libclc polly lldb
libcxx libunwind mlir"
# fails to build with libquadmth on musl
case "$XBPS_TARGET_MACHINE" in
x86_64|i686) makedepends+=" libquadmath-devel" ;;
esac
case "$XBPS_TARGET_MACHINE" in
x86_64*|aarch64*|riscv64*)
build_options_default+=" bolt flang"
if [ -z "$CROSS_BUILD" ]; then
build_options_default+=" offload"
fi
;;
armv*)
nopie=yes
configure_args+=" -DLLVM_ENABLE_PIE=NO"
configure_args+=" -DLLDB_INCLUDE_TESTS=NO"
;;
esac
if [ -z "$CROSS_BUILD" ]; then
hostmakedepends+=" llvm19-bootstrap"
# Needs lld on the target machine
configure_args+=" -DLLVM_USE_LINKER=lld"
fi
# build fails because compiler_rt generates armv7 instructions when target is armv6
case "$XBPS_TARGET_MACHINE" in
armv6*)
# Don't enable openmp on armv6*
#/builddir/llvm19-19.1.0/openmp/runtime/src/kmp_platform.h:263:2:
#error Unknown or unsupported architecture
;;
*)
build_options_default+=" openmp "
configure_args+=" -DCOMPILER_RT_DEFAULT_TARGET_ONLY=ON"
;;
esac
if [ "$XBPS_TARGET_LIBC" = "musl" ]; then
_is_musl="YES"
configure_args+=" -DLIBCXX_HAS_MUSL_LIBC=YES
-DCOMPILER_RT_BUILD_GWP_ASAN=OFF"
else
_is_musl="NO"
fi
if [ "$build_option_lto" ]; then
configure_args+=" -DLLVM_ENABLE_LTO=On"
fi
subpackages="
libllvm19 llvm19-doc llvm19-devel compiler-rt19
$( vopt_if clang 'clang19 clang19-headers clang19-devel libclang19 libclang-cpp19 clang-analyzer19' )
$( vopt_if clang_tools_extra 'clang-tools-extra19' )
$( vopt_if bolt 'llvm-bolt19' )
$( vopt_if lldb 'lldb19 lldb19-devel liblldb19' )
$( vopt_if lld 'lld19 lld19-devel' )
$( vopt_if libclc 'libclc19' )
$( vopt_if mlir 'mlir19 mlir19-devel' )
$( vopt_if flang 'flang19 flang19-devel' )
$( vopt_if openmp 'libomp19 libomp19-devel' )
$( vopt_if libunwind 'llvm-libunwind llvm-libunwind-devel' )
$( vopt_if libcxx 'libcxx libcxxabi libcxxabi-devel libcxx-devel' )
"
_enabled_projects="$(vopt_if clang 'clang;')\
$(vopt_if clang_tools_extra 'clang-tools-extra;')\
$(vopt_if bolt 'bolt;')\
$(vopt_if polly 'polly;')\
$(vopt_if lldb 'lldb;')\
$(vopt_if lld 'lld;')\
$(vopt_if libclc 'libclc;')\
$(vopt_if mlir 'mlir;')\
$(vopt_if flang 'flang;')"
_enabled_runtimes="compiler-rt\
$(vopt_if openmp ';openmp')\
$(vopt_if offload ';offload')\
$(vopt_if libc ';libc')\
$(vopt_if libunwind ';libunwind')\
$(vopt_if libcxx ';libcxxabi;libcxx')"
configure_args+=" -DLLVM_ENABLE_RUNTIMES=${_enabled_runtimes}"
configure_args+=" -DLLVM_ENABLE_PROJECTS=${_enabled_projects}"
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" llvm19-cross-tools SPIRV-LLVM-Translator19"
configure_args+=" -DLLVM_TOOLS_BINAIRY_DIR=/${_llvm_bindir}"
configure_args+=" -DLLVM_NATIVE_TOOL_DIR=/${_llvm_bindir}"
configure_args+=" -DLLVM_TABLEGEN=/${_llvm_bindir}/llvm-tblgen"
configure_args+=" -DCLANG_TABLEGEN=/${_llvm_bindir}/clang-tblgen"
configure_args+=" -DMLIR_TABLEGEN=/${_llvm_bindir}/mlir-tblgen"
configure_args+=" -DMLIR_PDLL_TABLEGEN=/${_llvm_bindir}/mlir-pdll"
configure_args+=" -DMLIR_LINALG_ODS_YAML_GEN=/${_llvm_bindir}/mlir-linalg-ods-yaml-gen"
configure_args+=" -DMLIR_CONFIG_SRC_SHARDER_TABLEGEN_EXE=/${_llvm_bindir}/mlir-src-sharder"
configure_args+=" -DCLANG_TIDY_CONFUSABLE_CHARS_GEN=/${_llvm_bindir}/clang-tidy-confusable-chars-gen"
configure_args+=" -DCLANG_PSEUDO_GEN=/${_llvm_bindir}/clang-pseudo-gen"
configure_args+=" -DLLVM_CONFIG_PATH=/${_llvm_bindir}/llvm-config"
configure_args+=" -DLLDB_TABLEGEN_EXE=/${_llvm_bindir}/lldb-tblgen"
configure_args+=" -DLIBOMP_OMPD_GDB_SUPPORT=NO"
if [ "$build_option_flang" ]; then
configure_args+=" -DLIBOMP_FORTRAN_MODULES_COMPILER=/${_llvm_bindir}/flang-new"
fi
fi
# For OCaml bindings and lldb lua scripting
if [ -z "$CROSS_BUILD" ]; then
subpackages="llvm19-cross-tools ${subpackages}"
# OCaml cross build is broken
hostmakedepends+=" ocaml ocaml-findlib"
# lldb cross build fails with lua
makedepends+=" lua53-devel "
fi
case "$XBPS_TARGET_MACHINE" in
arm*-musl|i686-musl)
# sanitizer code is broken since it duplicates some libc bits
configure_args+=" -DCOMPILER_RT_BUILD_SANITIZERS=OFF"
configure_args+=" -DCOMPILER_RT_BUILD_XRAY=OFF"
configure_args+=" -DCOMPILER_RT_BUILD_MEMPROF=OFF"
;;
esac
case "$XBPS_TARGET_MACHINE" in
i686*) _arch="X86";;
x86_64*) _arch="X86";;
armv5*) _arch="Armv5te";;
armv6*) _arch="Armv6";;
armv7*) _arch="Armv7";;
aarch64*) _arch="AArch64";;
mips*) _arch="Mips";;
ppc*) _arch="PowerPC";;
riscv64*) _arch="RISCV64";;
esac
_triplet=${XBPS_CROSS_TRIPLET:-$XBPS_TRIPLET}
configure_args+=" -DLLVM_TARGET_ARCH=${_arch}"
configure_args+=" -DLLVM_HOST_TRIPLE=${_triplet}"
configure_args+=" -DLLVM_DEFAULT_TARGET_TRIPLE=${_triplet}"
_vlink_libs() {
local _files="$1"
local _f
for _f in $DESTDIR/$_files; do
local _base=$(basename "${_f}")
ln -s llvm/19/lib/${_base} ${DESTDIR}/usr/lib
vmove ${_llvm_libdir}/${_base}
vmove usr/lib/${_base}
done
}
post_patch() {
# need libssp_nonshared on some musl platforms (because of nodefaultlibs)
case "$XBPS_TARGET_MACHINE" in
ppc64*) ;;
ppc*-musl|i686-musl|mips*-musl)
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
${wrksrc}/libunwind/src/CMakeLists.txt
vsed -i 's,^# Setup flags.$,add_library_flags(ssp_nonshared),' \
${wrksrc}/libcxxabi/src/CMakeLists.txt
vsed -i 's,#ssp,,' ${wrksrc}/libcxx/CMakeLists.txt
;;
esac
}
_setup_cross_cflags() {
CC="clang"
CXX="clang++"
CFLAGS+=" -Wno-gnu-include-next -Wno-unused-command-line-argument"
CXXFLAGS+=" -Wno-gnu-include-next -Wno-unused-command-line-argument"
local gcc_version=$(gcc -dumpversion)
CFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}"
CFLAGS+=" --gcc-toolchain=/usr"
CFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
CXXFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE}"
CXXFLAGS+=" --gcc-toolchain=/usr"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/${XBPS_CROSS_TRIPLET}"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include/c++/${gcc_version%.*}/backward"
CXXFLAGS+=" -isystem ${XBPS_CROSS_BASE}/usr/include"
}
_setup_debug() {
if [ ! "$build_option_full_debug" ]; then
# Vastly reduce size of debugging symbols:
CFLAGS=${CFLAGS/ -g/ -gline-tables-only}
CXXFLAGS=${CXXFLAGS/ -g/ -gline-tables-only}
fi
}
pre_configure() {
CC="clang"
CXX="clang++"
if [ "$CROSS_BUILD" ]; then
_setup_cross_cflags
fi
_setup_debug
}
pre_build() {
_setup_debug
}
post_build() {
if [ "$CROSS_BUILD" ]; then
CC="clang"
CXX="clang++"
CFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE} "
CFLAGS+=" --gcc-toolchain=/usr"
CFLAGS+=" -L/${_llvm_libdir}/${XBPS_CROSS_TRIPLET} "
CXXFLAGS+=" --target=${XBPS_CROSS_TRIPLET} --sysroot=${XBPS_CROSS_BASE} "
CXXFLAGS+=" --gcc-toolchain=/usr"
CXXFLAGS+=" -L/${_llvm_libdir}/${XBPS_CROSS_TRIPLET} "
else
export CC=${wrksrc}/llvm/build/bin/clang
export CXX=${wrksrc}/llvm/build/bin/clang++
fi
mkdir -p ${wrksrc}/${build_wrksrc}/builddir_runtimes
cmake -G Ninja ${wrksrc}/runtimes -B ${wrksrc}/${build_wrksrc}/builddir_runtimes \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_ASM_COMPILER_TARGET=${_triplet} \
-DCMAKE_C_COMPILER=$CC \
-DCMAKE_C_COMPILER_TARGET=${_triplet} \
-DCMAKE_CXX_COMPILER=$CXX \
-DCMAKE_CXX_COMPILER_TARGET=${_triplet} \
-DLLVM_ENABLE_RUNTIMES="libcxx;libcxxabi;libunwind" \
-DLIBCXXABI_ENABLE_STATIC_UNWINDER=YES \
-DLIBCXXABI_USE_COMPILER_RT=YES \
-DLIBCXXABI_USE_LLVM_UNWINDER=YES \
-DLIBCXX_CXX_ABI=libcxxabi \
-DLIBCXX_ENABLE_STATIC_ABI_LIBRARY=YES \
-DLIBCXX_USE_COMPILER_RT=YES \
-DLLVM_ENABLE_SPHINX=ON \
-DLLVM_TARGET_ARCH=${_arch} \
-DLLVM_HOST_TRIPLE=${_triplet} \
-DLLVM_DEFAULT_TARGET_TRIPLE=${_triplet} \
-DLIBCXX_HAS_MUSL_LIBC=${_is_musl} \
-DSPHINX_WARNINGS_AS_ERRORS=OFF
ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/builddir_runtimes
ninja ${makejobs} -C ${wrksrc}/${build_wrksrc}/builddir_runtimes docs-libcxx-html docs-libunwind-html
}
post_install() {
# Required for multilib.
if [ "$XBPS_TARGET_MACHINE" = "x86_64" ]; then
for _header in llvm-config; do
mv ${DESTDIR}/${_llvm_incdir}/llvm/Config/${_header}{,-64}.h
vinstall ${FILESDIR}/llvm-Config-${_header}.h 644 \
${_llvm_incdir}/llvm/Config ${_header}.h
done
fi
# Remove llvm-config-host in cross builds.
if [ "$CROSS_BUILD" ]; then
rm -f ${DESTDIR}/${_llvm_bindir}/llvm-config-host
fi
rm -rf ${DESTDIR}/usr/share/gdb
if [ "$build_option_libcxx" ]; then
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \
-P ${wrksrc}/${build_wrksrc}/builddir_runtimes/libcxx/docs/cmake_install.cmake
LIBCXX_DOCS=${_llvm_datadir}/doc/LLVM/libcxx
vmkdir ${LIBCXX_DOCS}
vcopy ${wrksrc}/${build_wrksrc}/builddir_runtimes/libcxx/docs/html ${LIBCXX_DOCS}
fi
if [ "$build_option_libunwind" ]; then
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \
-P ${wrksrc}/${build_wrksrc}/builddir_runtimes/libunwind/docs/cmake_install.cmake
LIBUNWIND_DOCS=${_llvm_datadir}/doc/LLVM/libunwind
vmkdir ${LIBUNWIND_DOCS}
vcopy ${wrksrc}/${build_wrksrc}/builddir_runtimes/libunwind/docs/html ${LIBUNWIND_DOCS}
fi
cmake -DCMAKE_INSTALL_PREFIX=${DESTDIR}/usr \
-P ${wrksrc}/${build_wrksrc}/builddir_runtimes/cmake_install.cmake
# Can this be disabled some other way?
rm -f ${DESTDIR}/usr/lib64
vmkdir usr/lib/clang
ln -s ../llvm/19/lib/clang/19 ${DESTDIR}/usr/lib/clang/19
}
_llvm_alts=(
bin/FileCheck share/man/man1/FileCheck.1
bin/UnicodeNameMappingGenerator
bin/bugpoint share/man/man1/bugpoint.1
bin/clang-installapi
bin/clang-nvlink-wrapper
bin/count
bin/dsymutil share/man/man1/dsymutil.1
bin/intercept-build
bin/llc
bin/lli
bin/lli-child-target
bin/llvm-PerfectShuffle
bin/llvm-addr2line
bin/llvm-ar
bin/llvm-as
bin/llvm-bcanalyzer
bin/llvm-bitcode-strip
bin/llvm-c-test
bin/llvm-cat
bin/llvm-cfi-verify
bin/llvm-cgdata
bin/llvm-config
bin/llvm-cov
bin/llvm-cvtres
bin/llvm-cxxdump
bin/llvm-cxxfilt
bin/llvm-cxxmap
bin/llvm-debuginfo-analyzer
bin/llvm-debuginfod
bin/llvm-debuginfod-find
bin/llvm-diff
bin/llvm-dis
bin/llvm-dlltool
bin/llvm-dwarfdump
bin/llvm-dwarfutil
bin/llvm-dwp
bin/llvm-exegesis
bin/llvm-extract
bin/llvm-gsymutil
bin/llvm-ifs
bin/llvm-install-name-tool
bin/llvm-jitlink
bin/llvm-jitlink-executor
bin/llvm-lib
bin/llvm-libtool-darwin
bin/llvm-link
bin/llvm-lipo
bin/llvm-lto
bin/llvm-lto2
bin/llvm-mc
bin/llvm-mca
bin/llvm-ml
bin/llvm-modextract
bin/llvm-mt
bin/llvm-nm
bin/llvm-objcopy
bin/llvm-objdump
bin/llvm-opt-report share/man/man1/llvm-opt-report.1
bin/llvm-otool
bin/llvm-pdbutil
bin/llvm-profdata share/man/man1/llvm-profdata.1
bin/llvm-profgen share/man/man1/llvm-profgen.1
bin/llvm-ranlib share/man/man1/llvm-ranlib.1
bin/llvm-rc
bin/llvm-readelf share/man/man1/llvm-readelf.1
bin/llvm-readobj share/man/man1/llvm-readobj.1
bin/llvm-readtapi
bin/llvm-reduce share/man/man1/llvm-reduce.1
bin/llvm-remarkutil share/man/man1/llvm-remarkutil.1
bin/llvm-rtdyld
bin/llvm-sim
bin/llvm-size share/man/man1/llvm-size.1
bin/llvm-split
bin/llvm-stress share/man/man1/llvm-stress.1
bin/llvm-strings share/man/man1/llvm-strings.1
bin/llvm-strip share/man/man1/llvm-strip.1
bin/llvm-symbolizer share/man/man1/llvm-symbolizer.1
bin/llvm-tblgen share/man/man1/llvm-tblgen.1
bin/llvm-tli-checker share/man/man1/llvm-tli-checker.1
bin/llvm-undname
bin/llvm-windres
bin/llvm-xray
bin/not
bin/obj2yaml
bin/opt share/man/man1/opt.1
bin/prepare_builtins
bin/reduce-chunk-list
bin/sancov
bin/sanstats
bin/split-file
bin/tblgen-to-irdl
bin/verify-uselistorder
bin/yaml-bench
bin/yaml2obj
share/man/man1/lit.1
share/man/man1/llc.1
share/man/man1/lldb-tblgen.1
share/man/man1/lli.1
share/man/man1/llvm-addr2line.1
share/man/man1/llvm-ar.1
share/man/man1/llvm-as.1
share/man/man1/llvm-bcanalyzer.1
share/man/man1/llvm-config.1
share/man/man1/llvm-cov.1
share/man/man1/llvm-cxxfilt.1
share/man/man1/llvm-cxxmap.1
share/man/man1/llvm-debuginfo-analyzer.1
share/man/man1/llvm-diff.1
share/man/man1/llvm-dis.1
share/man/man1/llvm-dwarfdump.1
share/man/man1/llvm-dwarfutil.1
share/man/man1/llvm-exegesis.1
share/man/man1/llvm-extract.1
share/man/man1/llvm-ifs.1
share/man/man1/llvm-install-name-tool.1
share/man/man1/llvm-lib.1
share/man/man1/llvm-libtool-darwin.1
share/man/man1/llvm-link.1
share/man/man1/llvm-lipo.1
share/man/man1/llvm-locstats.1
share/man/man1/llvm-mc.1
share/man/man1/llvm-mca.1
share/man/man1/llvm-nm.1
share/man/man1/llvm-objcopy.1
share/man/man1/llvm-objdump.1
share/man/man1/llvm-otool.1
share/man/man1/llvm-pdbutil.1
share/man/man1/tblgen.1
)
alternatives=$(:)
for _alt in "${_llvm_alts[@]}"; do
alternatives+=" llvm:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
clang19_package() {
lib32disabled=yes
depends="libstdc++-devel libgcc-devel binutils ${XBPS_TARGET_LIBC}-devel
compiler-rt19>=${version}_${revision}"
conflicts="clang18>=0 clang17>=0 clang15>=0"
short_desc+=" - C language family frontend"
homepage="https://clang.llvm.org/"
_clang19_files=(
bin/clang-19
bin/clang
bin/clang++
bin/clang-cl
bin/clang-cpp
bin/clang-check
bin/clang-extdef-mapping
bin/clang-format
bin/git-clang-format
bin/clang-linker-wrapper
bin/clang-offload-bundler
bin/clang-offload-packager
bin/clang-refactor
bin/clang-rename
bin/clang-repl
bin/clang-scan-deps
bin/clang-tblgen
bin/c-index-test
bin/diagtool
bin/amdgpu-arch
bin/nvptx-arch
bin/hmaptool
lib/LLVMgold.so
share/man/man1/clang.1
share/man/man1/diagtool.1
share/man/man1/clang-tblgen.1
)
for _alt in "${_clang19_files[@]}"; do
alternatives+=" clang:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
if [ "$build_option_polly" ]; then
alternatives+="
clang:/usr/lib/LLVMPolly.so:/${_llvm_libdir}/LLVMPolly.so
clang:/usr/share/man/man1/polly.1:/${_llvm_mandir}/man1/polly1.1
"
fi
pkg_install() {
vlicense ${wrksrc}/clang/LICENSE.TXT
for _bin in "${_clang19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_bin}
done
if [ "$build_option_polly" ]; then
vmove ${_llvm_libdir}/LLVMPolly.so
vmove ${_llvm_mandir}/man1/polly.1
fi
}
}
clang19-headers_package() {
lib32disabled=yes
short_desc+=" - C language family frontend - Headers"
homepage="https://clang.llvm.org/"
pkg_install() {
vmove ${_llvm_libdir}/clang/19/include
vmove ${_llvm_incdir}/c++
vmove ${_llvm_datadir}/libc++
vmove usr/lib/clang
}
}
clang19-devel_package() {
lib32disabled=yes
depends="libstdc++-devel libgcc-devel binutils ${XBPS_TARGET_LIBC}-devel
clang19>=${version}_${revision} clang-analyzer19>=${version}_${revision}
llvm19>=${version}_${revision}"
conflicts="clang18-devel clang17-devel clang15-devel"
if [ "$build_option_clang_tools_extra" ]; then
depends+=" clang-tools-extra19>=${version}_${revision}"
fi
short_desc+=" - C language family frontend - development Files"
homepage="https://clang.llvm.org/"
pkg_install() {
vmove ${_llvm_incdir}/clang
vmove ${_llvm_incdir}/clang-c
vmove ${_llvm_libdir}/libear
vmove ${_llvm_libdir}/cmake/clang
vmove "${_llvm_libdir}/libclang*.a"
vmove "${_llvm_libdir}/libclang*.so"
vmove ${_llvm_datadir}/clang
if [ "$build_option_clang_tools_extra" ]; then
vmove ${_llvm_incdir}/clang-tidy
vmove ${_llvm_libdir}/libfindAllSymbols.a
fi
if [ "$build_option_polly" ]; then
vmove ${_llvm_incdir}/polly
vmove ${_llvm_libdir}/cmake/polly
vmove "${_llvm_libdir}/libPolly*.a"
fi
}
}
libclang19_package() {
depends="clang19-headers>=${version}_${revision}"
short_desc+=" - C frontend library"
pkg_install() {
_vlink_libs "${_llvm_libdir}/libclang.so.*"
}
}
libclang-cpp19_package() {
depends="clang19-headers>=${version}_${revision}"
short_desc+=" - C frontend library (C++ interface)"
pkg_install() {
_vlink_libs "${_llvm_libdir}/libclang-cpp.so.*"
}
}
clang-analyzer19_package() {
depends="clang19>=${version}_${revision} python3 perl"
conflicts="clang-analyzer18>=0 clang-analyzer17>=0 clang-analyzer15>=0"
short_desc+=" - A source code analysis framework"
homepage="https://clang-analyzer.llvm.org/"
pycompile_dirs="${_llvm_datadir}/scan-view"
_clang_analyzer19_files=(
share/scan-view
share/scan-build
lib/libscanbuild
libexec/analyze-c++
libexec/analyze-cc
libexec/intercept-c++
libexec/intercept-cc
libexec/c++-analyzer
libexec/ccc-analyzer
share/man/man1/scan-build.1
bin/analyze-build
bin/scan-build
bin/scan-build-py
bin/scan-view
)
for _alt in "${_clang_analyzer19_files[@]}"; do
alternatives+=" clang-analyzer:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
for _f in "${_clang_analyzer19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
}
}
clang-tools-extra19_package() {
lib32disabled=yes
depends="clang19>=${version}_${revision} python3"
conflicts="clang-tools-extra18>=0 clang-tools-extra17>=0 clang-tools-extra15>=0"
short_desc+=" - Extra Clang tools"
homepage="https://clang.llvm.org/extra/"
_clang_tools_extra19_files=(
bin/clang-apply-replacements
bin/clang-change-namespace
bin/clang-doc
bin/clang-include-cleaner
bin/clang-include-fixer
bin/clang-move
bin/clang-pseudo
bin/clang-query
bin/clang-reorder-fields
bin/clang-tidy
bin/clangd
bin/find-all-symbols
bin/modularize
bin/pp-trace
bin/run-clang-tidy
share/man/man1/extraclangtools.1
)
for _alt in "${_clang_tools_extra19_files[@]}"; do
alternatives+=" clang-tools-extra:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
vlicense ${wrksrc}/clang-tools-extra/LICENSE.TXT
for _f in "${_clang_tools_extra19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
}
}
# "bolt" package name is already used
llvm-bolt19_package() {
lib32disabled=yes
depends="clang19>=${version}_${revision}"
conflicts="llvm-bolt18>=0 llvm-bolt17>=0"
short_desc+=" - post-link optimizer"
homepage="https://github.com/llvm/llvm-project/tree/main/bolt"
_llvm_bolt19_files=(
bin/llvm-bolt
bin/perf2bolt
bin/llvm-boltdiff
bin/merge-fdata
bin/llvm-bolt-heatmap
)
for _alt in "${_llvm_bolt19_files[@]}"; do
alternatives+=" llvm-bolt:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
vlicense ${wrksrc}/bolt/LICENSE.TXT
for _f in "${_llvm_bolt19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
if [ -z "$CROSS_BUILD" ]; then
vmove ${_llvm_libdir}/libbolt_rt_instr.a
vmove ${_llvm_libdir}/libbolt_rt_hugify.a
fi
}
}
lldb19_package() {
lib32disabled=yes
depends+=" python3-six"
conflicts="lldb18>=0 lldb17>=0 lldb15>=0"
short_desc+=" - LLDB debugger"
homepage="https://lldb.llvm.org/"
_lldb19_files=(
bin/lldb
bin/lldb-argdumper
bin/lldb-instr
bin/lldb-server
bin/lldb-dap
lib/python${py3_ver}/site-packages/lldb
)
if [ -z "$CROSS_BUILD" ]; then
_lldb19_files+=("lib/lua/5.3/lldb.so")
fi
for _alt in "${_lldb19_files[@]}"; do
alternatives+=" lldb:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
vlicense ${wrksrc}/lldb/LICENSE.TXT
for _f in "${_lldb19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
}
}
lldb19-devel_package() {
lib32disabled=yes
depends="lldb19>=${version}_${revision}"
conflicts="lldb18-devel>=0 lldb17-devel>=0 lldb15-devel>=0"
short_desc+=" - LLDB debugger - development files"
pkg_install() {
vmove ${_llvm_incdir}/lldb
vmove "${_llvm_libdir}/liblldb*.so"
}
}
liblldb19_package() {
lib32disabled=yes
short_desc+=" - LLDB debugger - runtime library"
pkg_install() {
_vlink_libs "${_llvm_libdir}/liblldb*.so.*"
}
}
lld19_package() {
lib32disabled=yes
conflicts="lld18>=0 lld17>=0 lld15>=0"
short_desc+=" - linker"
homepage="https://lld.llvm.org"
_lld19_files=(
bin/lld
bin/lld-link
bin/ld.lld
bin/ld64.lld
bin/wasm-ld
)
for _alt in "${_lld19_files[@]}"; do
alternatives+=" lld:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
vlicense ${wrksrc}/lld/LICENSE.TXT
for _f in "${_lld19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
}
}
lld19-devel_package() {
lib32disabled=yes
depends="lld19>=${version}_${revision} llvm19>=${version}_${revision}"
conflicts="lld18-devel>=0 lld17-devel>=0 lld15-devel>=0"
short_desc+=" - linker - development files"
homepage="https://lld.llvm.org"
pkg_install() {
vmove ${_llvm_incdir}/lld
vmove ${_llvm_libdir}/cmake/lld
vmove "${_llvm_libdir}/liblld*.a"
}
}
mlir19_package() {
lib32disabled=yes
short_desc+=" - multi-level IR compiler framework"
homepage="https://mlir.llvm.org/"
_mlir19_files=(
bin/mlir-cat
bin/mlir-cpu-runner
bin/mlir-linalg-ods-yaml-gen
bin/mlir-lsp-server
bin/mlir-minimal-opt
bin/mlir-minimal-opt-canonicalize
bin/mlir-opt
bin/mlir-pdll
bin/mlir-pdll-lsp-server
bin/mlir-query
bin/mlir-reduce
bin/mlir-tblgen
bin/mlir-transform-opt
bin/mlir-translate
bin/tblgen-lsp-server
share/man/man1/mlir-tblgen.1
)
for _alt in "${_mlir19_files[@]}"; do
alternatives+=" mlir:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
for _f in "${_mlir19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
_vlink_libs "${_llvm_libdir}/libMLIR*.so.*"
_vlink_libs "${_llvm_libdir}/libmlir*.so.*"
}
}
mlir19-devel_package() {
lib32disabled=yes
depends="mlir19>=${version}_${revision} llvm19>=${version}_${revision}"
conflicts="mlir18-devel>=0 mlir17-devel>=0"
short_desc+=" - multi-level IR compiler framework - development files"
homepage="https://mlir.llvm.org/"
pkg_install() {
vmove ${_llvm_incdir}/mlir
vmove ${_llvm_incdir}/mlir-c
vmove ${_llvm_libdir}/cmake/mlir
vmove "${_llvm_libdir}/libMLIR*"
vmove "${_llvm_libdir}/objects-Release/obj.MLIR*"
vmove "${_llvm_libdir}/libmlir*"
}
}
flang19_package() {
lib32disabled=yes
depends="mlir19>=${version}_${revision}"
conflicts="flang18>=0 flang17>=0"
short_desc+=" - Fortran language frontend"
homepage="https://flang.llvm.org/"
_flang19_files=(
bin/flang-new
bin/bbc
bin/f18-parse-demo
bin/fir-opt
bin/tco
)
for _alt in "${_flang19_files[@]}"; do
alternatives+=" flang:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
for _f in "${_flang19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
vmove "${_llvm_libdir}/libflang*.a"
vmove "${_llvm_libdir}/libFortran*.a"
vmove "${_llvm_incdir}/flang/*.mod"
}
}
flang19-devel_package() {
lib32disabled=yes
depends="flang19>=${version}_${revision} llvm19>=${version}_${revision}"
conflicts="flang18-devel>=0 flang17-devel>=0"
short_desc+=" - Fortran language frontend - development files"
homepage="https://flang.llvm.org/"
pkg_install() {
vmove ${_llvm_incdir}/flang
vmove ${_llvm_libdir}/cmake/flang
vmove "${_llvm_libdir}/libFIR*.a"
vmove "${_llvm_libdir}/libHLFIR*.a"
vmove "${_llvm_libdir}/libCUF*.a"
}
}
libomp19_package() {
short_desc+=" - Clang OpenMP support library"
conflicts="libomp18>=0 libomp17>=0"
_libomp19_files=(
lib/libomp.so
)
case "$XBPS_TARGET_MACHINE" in
x86_64*|aarch64*|riscv64*)
_libomp19_files+=("lib/libompd.so")
;;
esac
if [ "$build_option_offload" ]; then
_libomp19_files+=("bin/llvm-omp-device-info")
_libomp19_files+=("bin/llvm-omp-kernel-replay")
_libomp19_files+=("lib/libomptarget.so")
fi
for _alt in "${_libomp19_files[@]}"; do
alternatives+=" libomp:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
for _f in "${_libomp19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
if [ "$build_option_offload" ]; then
_vlink_libs "${_llvm_libdir}/libomp*.so*"
fi
}
}
libomp19-devel_package() {
short_desc+=" - Clang OpenMP support library - development files"
depends="libomp19>=${version}_${revision}"
conflicts="libomp18-devel>=0 libomp17-devel>=0"
pkg_install() {
if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher.so" ]; then
vmove "${_llvm_libdir}/libarcher*.so"
fi
if [ -f "${DESTDIR}/${_llvm_libdir}/libarcher_static.a" ]; then
vmove "${_llvm_libdir}/libarcher*.a"
fi
vmove ${_llvm_libdir}/cmake/openmp
if [ "$build_option_offload" ]; then
vmove "${_llvm_libdir}/libomptarget*.bc"
vmove "${_llvm_libdir}/libomp*.a"
fi
}
}
llvm-libunwind_package() {
short_desc+=" - libunwind"
pkg_install() {
vmove "usr/lib/libunwind.so.*"
}
}
llvm-libunwind-devel_package() {
short_desc+=" - libunwind - development files"
depends="llvm-libunwind>=${version}_${revision}"
conflicts="libunwind-devel>=0"
pkg_install() {
vmove usr/include/mach-o
vmove "usr/include/*unwind*"
vmove "usr/lib/libunwind.a"
vmove "usr/lib/libunwind.so"
}
}
libcxxabi_package() {
short_desc+=" - low level support for libc++"
pkg_install() {
vmove "usr/lib/libc++abi.so.*"
}
}
libcxxabi-devel_package() {
short_desc+=" - low level support for libc++ - development files"
depends="libcxxabi>=${version}_${revision}"
pkg_install() {
vmove usr/include/c++/v1/cxxabi.h
vmove usr/include/c++/v1/__cxxabi_config.h
vmove usr/lib/libc++abi.so
vmove usr/lib/libc++abi.a
}
}
libcxx_package() {
short_desc+=" - C++ standard library"
pkg_install() {
vmove "usr/lib/libc++.so.*"
}
}
libcxx-devel_package() {
short_desc+=" - C++ standard library - development files"
depends="libcxx>=${version}_${revision}"
pkg_install() {
vmove usr/lib/libc++.modules.json
vmove usr/include/c++
vmove usr/share/libc++
vmove "usr/lib/libc++.so"
vmove "usr/lib/libc++.a"
vmove "usr/lib/libc++experimental.a"
}
}
compiler-rt19_package() {
short_desc+=" - runtime libraries"
depends="clang19-headers>=${version}_${revision}"
noshlibprovides=yes
noverifyrdeps=yes
homepage="https://compiler-rt.llvm.org/"
pkg_install() {
vmove ${_llvm_libdir}/clang/19/lib
if [ -d "${DESTDIR}/${_llvm_libdir}/clang/19/bin" ]; then
vmove ${_llvm_libdir}/clang/19/bin
fi
if [ -d "${DESTDIR}/${_llvm_libdir}/clang/19/share" ]; then
vmove ${_llvm_libdir}/clang/19/share
fi
}
}
libllvm19_package() {
short_desc+=" - library"
pkg_install() {
_vlink_libs "${_llvm_libdir}/libLLVM-*.so"
_vlink_libs "${_llvm_libdir}/libLLVM.so.*"
}
}
llvm19-doc_package() {
short_desc+=" - documentation"
pkg_install() {
vmove ${_llvm_datadir}/doc
}
}
llvm19-devel_package() {
depends="llvm19>=${version}_${revision}"
conflicts="llvm18-devel>=0 llvm17-devel>=0 llvm15-devel>=0"
short_desc+=" - development files"
if [ "$build_option_openmp" ]; then
depends+=" libomp19-devel>=${version}_${revision} "
fi
if [ "$build_option_mlir" ]; then
depends+=" mlir19-devel>=${version}_${revision} "
fi
if [ "$build_option_clang" ]; then
depends+=" clang19-devel>=${version}_${revision} "
fi
pkg_install() {
vmove ${_llvm_libdir}/libLLVM.so
vmove ${_llvm_libdir}/libLTO.so
vmove ${_llvm_libdir}/libRemarks.so
vmove ${_llvm_incdir}/llvm
vmove ${_llvm_incdir}/llvm-c
vmove "${_llvm_libdir}/libLLVM*.a"
vmove ${_llvm_libdir}/cmake/llvm
}
}
# These binaries are ONLY used when building llvm, they aren't normally installed
llvm19-cross-tools_package() {
conflicts="llvm18-cross-tools>=0 llvm17-cross-tools>=0"
short_desc+=" - build tools for cross compiling LLVM"
depends="llvm19-devel>=${version}_${revision}"
if [ "$build_option_lldb" ]; then
depends+=" lldb19-devel>=${version}_${revision}"
fi
if [ "$build_option_lld" ]; then
depends+=" lld19-devel>=${version}_${revision}"
fi
if [ "$build_option_flang" ]; then
depends+=" flang19-devel>=${version}_${revision}"
fi
pkg_install() {
# Binaries ONLY used during the process of building llvm, and aren't usually installed
vmkdir ${_llvm_bindir}
vcopy build/bin/clang-tidy-confusable-chars-gen ${_llvm_bindir}
vcopy build/bin/clang-pseudo-gen ${_llvm_bindir}
if [ "$build_option_lldb" ]; then
vcopy build/bin/lldb-tblgen ${_llvm_bindir}
fi
if [ "$build_option_mlir" ]; then
vcopy build/bin/mlir-src-sharder ${_llvm_bindir}
fi
}
}
libclc19_package() {
short_desc+=" - Open implementation of the OpenCL C programming language"
replaces="libclc-git>=0"
_libclc19_files=(
share/clc
include/clc
share/pkgconfig/libclc.pc
)
for _alt in "${_libclc19_files[@]}"; do
alternatives+=" libclc:/usr/${_alt}:/usr/${_llvm_prefix}/${_alt}"
done
pkg_install() {
for _f in "${_libclc19_files[@]}"; do
vmove usr/${_llvm_prefix}/${_f}
done
}
}