mirror of
https://github.com/gentoo-mirror/guru.git
synced 2026-10-12 17:51:11 -04:00
sys-devel/clang-bloomberg-p2996: treeclean
Signed-off-by: Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
This commit is contained in:
1 parent
7e3a7a0506
commit
463b7ce884
9 files changed
-810
No files matched your search
@@ -24,12 +24,6 @@
|
||||
# Removal after 2026-08-22
|
||||
net-proxy/MTProxy
|
||||
|
||||
# Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com> (2026-07-04)
|
||||
# C++26 reflection has been available in GCC 16 for a few months.
|
||||
# This package has served its purpose and may be removed.
|
||||
# Removal after 2026-09-04
|
||||
sys-devel/clang-bloomberg-p2996
|
||||
|
||||
# Bjorn <bjorn.megaflow@gmail.com> (2026-06-23)
|
||||
# Requires gui-libs/libadwaita >= 1.9, which is currently not in
|
||||
# the main Gentoo repository.
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
DIST clang-bloomberg-p2996-21.0.0_p20250702.tar.gz 240748568 BLAKE2B 07d1e5dfab32031ddbc5f7f86a7cfef9f751c7db71af1aea8c87bfb9a4819c5f47907d2c1a35fb929f28974df1413d394a6cef35324b6dc49e224ae3d6b4afe8 SHA512 f9304170c1f139e25fa17ba20eeb39e4612eedd853b7889d194fd526081c6a3eff05077bb9ae954360ee600b7419a8d63cb9171bcac8ba8694ae62b0413f891c
|
||||
DIST clang-bloomberg-p2996-21.0.0_p20260204.tar.gz 240770843 BLAKE2B 9dadc6c85a363d7170ec163910bcde2a92529024f08f8140e35c4e87452100252c1d427f22eedb220967439b585e98259ebd70687353ffea7124f9f5b46e38e5 SHA512 57d359fa677cb71f9a57254f90b134a47758e343850431c439690ca7922b012acdff31479fda4f9e49762dd1568204a7d181549980e86091798a00174fc5c912
|
||||
@@ -1,250 +0,0 @@
|
||||
# Copyright 2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit cmake prefix python-utils-r1
|
||||
|
||||
DESCRIPTION="Clang fork implementing experimental support for P2996 (Reflection for C++26)"
|
||||
HOMEPAGE="https://github.com/bloomberg/clang-p2996"
|
||||
|
||||
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD MIT public-domain rc"
|
||||
SLOT="0"
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/bloomberg/clang-p2996.git"
|
||||
EGIT_BRANCH="p2996"
|
||||
else
|
||||
GIT_COMMIT="d77eff1cbd78fd065668acf93b1f5f400d39134d"
|
||||
SRC_URI="https://github.com/bloomberg/clang-p2996/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
S="${WORKDIR}/clang-p2996-${GIT_COMMIT}"
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
ALL_LLVM_TARGETS="AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV SPIRV Sparc SystemZ VE WebAssembly +X86 XCore Xtensa"
|
||||
IUSE="+debug +default-reflection-latest +pie +static-libs"
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
IUSE+=" ${target%${target#+}}llvm_targets_${target#+}"
|
||||
done
|
||||
|
||||
RDEPEND="
|
||||
app-arch/zstd:=
|
||||
dev-libs/libxml2:=
|
||||
virtual/zlib:=
|
||||
"
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/21.0.0_p20250702-unknown-reflection.patch"
|
||||
"${FILESDIR}/21.0.0_p20250702-uninitialized.patch"
|
||||
)
|
||||
|
||||
CMAKE_USE_DIR="$S/llvm"
|
||||
|
||||
src_prepare() {
|
||||
# create extra parent dir for relative CLANG_RESOURCE_DIR access
|
||||
mkdir -p x/y || die
|
||||
BUILD_DIR=${WORKDIR}/x/y/clang
|
||||
|
||||
use default-reflection-latest && eapply "${FILESDIR}/21.0.0_p20250702-enable-reflection-latest.patch"
|
||||
|
||||
cmake_src_prepare
|
||||
|
||||
# add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
|
||||
eprefixify \
|
||||
clang/lib/Lex/InitHeaderSearch.cpp \
|
||||
clang/lib/Driver/ToolChains/Darwin.cpp || die
|
||||
|
||||
if ! use prefix-guest && [[ -n ${EPREFIX} ]]; then
|
||||
sed -i "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" clang/lib/Driver/ToolChains/Linux.cpp || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local targets=()
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
use llvm_targets_${target#+} && targets+=("${target#+}")
|
||||
done
|
||||
if [ ${#targets[@]} -eq 0 ]; then
|
||||
die "At least one LLVM target must be enabled"
|
||||
fi
|
||||
|
||||
local libdir=$(get_libdir)
|
||||
local mycmakeargs=(
|
||||
-DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}")
|
||||
-DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
|
||||
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/bloomberg-p2996"
|
||||
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
|
||||
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DLLVM_HOST_TRIPLE="${CHOST}"
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON
|
||||
-DLLVM_ENABLE_PROJECTS="clang"
|
||||
-DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx"
|
||||
-DRUNTIMES_CMAKE_ARGS="\
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF;\
|
||||
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||
-DLLVM_TARGETS_TO_BUILD="$(IFS=';'; echo "${targets[*]}")"
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
||||
-DLLVM_INCLUDE_TESTS=OFF
|
||||
-DLLVM_BUILD_TESTS=OFF
|
||||
-DLLVM_INSTALL_GTEST=OFF
|
||||
|
||||
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
|
||||
-DLLVM_ENABLE_EH=ON
|
||||
-DLLVM_ENABLE_RTTI=ON
|
||||
-DLLVM_ENABLE_ZLIB=FORCE_ON
|
||||
|
||||
-DLIBCXX_ENABLE_SHARED=ON
|
||||
-DLIBCXX_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXX_CXX_ABI=libcxxabi
|
||||
-DLIBCXX_USE_COMPILER_RT=OFF
|
||||
-DLIBCXX_HAS_GCC_S_LIB=OFF
|
||||
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
|
||||
-DLIBCXX_INCLUDE_TESTS=OFF
|
||||
-DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
|
||||
-DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang/bloomberg-p2996"
|
||||
-DCLANG_CONFIG_FILE_USER_DIR="~/.config/clang"
|
||||
# relative to bindir
|
||||
-DCLANG_RESOURCE_DIR="../../../../lib/clang/bloomberg-p2996"
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON
|
||||
-DCLANG_INCLUDE_TESTS=OFF
|
||||
|
||||
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie)
|
||||
|
||||
-DPython3_EXECUTABLE="${PYTHON}"
|
||||
|
||||
-DOCAMLFIND=NO
|
||||
)
|
||||
|
||||
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cmake_src_compile
|
||||
}
|
||||
|
||||
_doclang_cfg() {
|
||||
local triple="${1}"
|
||||
|
||||
local tool
|
||||
for tool in clang{,++,-cpp}; do
|
||||
newins - "${triple}-${tool}.cfg" <<-EOF
|
||||
# This configuration file is used by ${triple}-${tool} driver.
|
||||
@../${triple}-${tool}.cfg
|
||||
@gentoo-plugins.cfg
|
||||
@gentoo-runtimes.cfg
|
||||
EOF
|
||||
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Install symlinks for triples with other vendor strings since some
|
||||
# programs insist on mangling the triple.
|
||||
local vendor
|
||||
for vendor in gentoo pc unknown; do
|
||||
local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
|
||||
for tool in clang{,++,-cpp}; do
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
doclang_cfg() {
|
||||
#local triple=$(get_abi_CHOST "${abi}")
|
||||
local triple=${CHOST}
|
||||
|
||||
_doclang_cfg ${triple}
|
||||
|
||||
# LLVM may have different arch names in some cases. For example in x86
|
||||
# profiles the triple uses i686, but llvm will prefer i386 if invoked
|
||||
# with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
|
||||
# be used if invoked through ${CHOST}-clang{,++,-cpp} though.
|
||||
#
|
||||
# To make sure the correct triples are installed,
|
||||
# see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
|
||||
# and compare with CHOST values in profiles.
|
||||
|
||||
local abi=${triple%%-*}
|
||||
case ${abi} in
|
||||
armv4l|armv4t|armv5tel|armv6j|armv7a)
|
||||
_doclang_cfg ${triple/${abi}/arm}
|
||||
;;
|
||||
i686)
|
||||
_doclang_cfg ${triple/${abi}/i386}
|
||||
;;
|
||||
sparc)
|
||||
_doclang_cfg ${triple/${abi}/sparcel}
|
||||
;;
|
||||
sparc64)
|
||||
_doclang_cfg ${triple/${abi}/sparcv9}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
# Rename programs and update symlinks
|
||||
cd "${D}/usr/lib/llvm/bloomberg-p2996/bin" || die
|
||||
for file in *; do
|
||||
if [[ -f "${file}" && -x "${file}" && ! -L "${file}" ]]; then
|
||||
# Rename regular, executable files
|
||||
mv "${file}" "bloomberg-p2996-${file}" || die "Failed to rename ${file}"
|
||||
elif [[ -L "${file}" ]]; then
|
||||
# Update symlink to point to renamed target
|
||||
local target
|
||||
target=$(readlink "${file}") || die "Failed to read symlink ${file}"
|
||||
ln -sf "bloomberg-p2996-${target}" "bloomberg-p2996-${file}" || die "Failed to update symlink ${file}"
|
||||
rm "${file}" || die "Failed to remove original symlink ${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
local ldpath="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/$(get_libdir)"
|
||||
newenvd - "60llvm-bloomberg-p2996" <<-_EOF_
|
||||
PATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
# we need to duplicate it in ROOTPATH for Portage to respect...
|
||||
ROOTPATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
LDPATH="${ldpath}:${ldpath}/${CHOST}"
|
||||
_EOF_
|
||||
|
||||
insinto "/etc/clang/bloomberg-p2996"
|
||||
newins - gentoo-runtimes.cfg <<-EOF
|
||||
# This file is initially generated by sys-devel/clang-bloomberg-p2996::guru.
|
||||
# It is used to control the default runtimes using by clang.
|
||||
|
||||
--rtlib=libgcc
|
||||
--unwindlib=libgcc
|
||||
--stdlib=libc++
|
||||
-fuse-ld=bfd
|
||||
-L${ldpath}/${CHOST}
|
||||
EOF
|
||||
newins - gentoo-plugins.cfg <<-EOF
|
||||
# This file is used to load optional LLVM plugins.
|
||||
EOF
|
||||
|
||||
doclang_cfg
|
||||
|
||||
rm -r "${D}/usr/share/man" || die
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog "Binaries are installed with a 'bloomberg-p2996-' prefix,"
|
||||
elog "e.g.: bloomberg-p2996-clang++"
|
||||
use default-reflection-latest && \
|
||||
elog "Pass -fno-reflection-latest to disable reflection support." || \
|
||||
elog "Pass -freflection-latest to enable reflection support."
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
# Copyright 2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit cmake prefix python-utils-r1
|
||||
|
||||
DESCRIPTION="Clang fork implementing experimental support for P2996 (Reflection for C++26)"
|
||||
HOMEPAGE="https://github.com/bloomberg/clang-p2996"
|
||||
|
||||
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD MIT public-domain rc"
|
||||
SLOT="0"
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/bloomberg/clang-p2996.git"
|
||||
EGIT_BRANCH="p2996"
|
||||
else
|
||||
GIT_COMMIT="2ea0a79fe7bb5f6fdb8c687ba0e21ab63696e7f7"
|
||||
SRC_URI="https://github.com/bloomberg/clang-p2996/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
S="${WORKDIR}/clang-p2996-${GIT_COMMIT}"
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
ALL_LLVM_TARGETS="AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV SPIRV Sparc SystemZ VE WebAssembly +X86 XCore Xtensa"
|
||||
IUSE="+debug +default-reflection-latest +pie +static-libs"
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
IUSE+=" ${target%${target#+}}llvm_targets_${target#+}"
|
||||
done
|
||||
|
||||
RDEPEND="
|
||||
app-arch/zstd:=
|
||||
dev-libs/libxml2:=
|
||||
virtual/zlib:=
|
||||
"
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/21.0.0_p20250702-unknown-reflection.patch"
|
||||
"${FILESDIR}/21.0.0_p20250702-uninitialized.patch"
|
||||
)
|
||||
|
||||
CMAKE_USE_DIR="$S/llvm"
|
||||
|
||||
src_prepare() {
|
||||
# create extra parent dir for relative CLANG_RESOURCE_DIR access
|
||||
mkdir -p x/y || die
|
||||
BUILD_DIR=${WORKDIR}/x/y/clang
|
||||
|
||||
use default-reflection-latest && eapply "${FILESDIR}/21.0.0_p20250702-enable-reflection-latest.patch"
|
||||
|
||||
cmake_src_prepare
|
||||
|
||||
# add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
|
||||
eprefixify \
|
||||
clang/lib/Lex/InitHeaderSearch.cpp \
|
||||
clang/lib/Driver/ToolChains/Darwin.cpp || die
|
||||
|
||||
if ! use prefix-guest && [[ -n ${EPREFIX} ]]; then
|
||||
sed -i "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" clang/lib/Driver/ToolChains/Linux.cpp || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local targets=()
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
use llvm_targets_${target#+} && targets+=("${target#+}")
|
||||
done
|
||||
if [ ${#targets[@]} -eq 0 ]; then
|
||||
die "At least one LLVM target must be enabled"
|
||||
fi
|
||||
|
||||
local libdir=$(get_libdir)
|
||||
local mycmakeargs=(
|
||||
-DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}")
|
||||
-DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
|
||||
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/bloomberg-p2996"
|
||||
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
|
||||
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DLLVM_HOST_TRIPLE="${CHOST}"
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON
|
||||
-DLLVM_ENABLE_PROJECTS="clang"
|
||||
-DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx"
|
||||
-DRUNTIMES_CMAKE_ARGS="\
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF;\
|
||||
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||
-DLLVM_TARGETS_TO_BUILD="$(IFS=';'; echo "${targets[*]}")"
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
||||
-DLLVM_INCLUDE_TESTS=OFF
|
||||
-DLLVM_BUILD_TESTS=OFF
|
||||
-DLLVM_INSTALL_GTEST=OFF
|
||||
|
||||
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
|
||||
-DLLVM_ENABLE_EH=ON
|
||||
-DLLVM_ENABLE_RTTI=ON
|
||||
-DLLVM_ENABLE_ZLIB=FORCE_ON
|
||||
|
||||
-DLIBCXX_ENABLE_SHARED=ON
|
||||
-DLIBCXX_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXX_CXX_ABI=libcxxabi
|
||||
-DLIBCXX_USE_COMPILER_RT=OFF
|
||||
-DLIBCXX_HAS_GCC_S_LIB=OFF
|
||||
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
|
||||
-DLIBCXX_INCLUDE_TESTS=OFF
|
||||
-DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
|
||||
-DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang/bloomberg-p2996"
|
||||
-DCLANG_CONFIG_FILE_USER_DIR="~/.config/clang"
|
||||
# relative to bindir
|
||||
-DCLANG_RESOURCE_DIR="../../../../lib/clang/bloomberg-p2996"
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON
|
||||
-DCLANG_INCLUDE_TESTS=OFF
|
||||
|
||||
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie)
|
||||
|
||||
-DPython3_EXECUTABLE="${PYTHON}"
|
||||
|
||||
-DOCAMLFIND=NO
|
||||
)
|
||||
|
||||
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cmake_src_compile
|
||||
}
|
||||
|
||||
_doclang_cfg() {
|
||||
local triple="${1}"
|
||||
|
||||
local tool
|
||||
for tool in clang{,++,-cpp}; do
|
||||
newins - "${triple}-${tool}.cfg" <<-EOF
|
||||
# This configuration file is used by ${triple}-${tool} driver.
|
||||
@../${triple}-${tool}.cfg
|
||||
@gentoo-plugins.cfg
|
||||
@gentoo-runtimes.cfg
|
||||
EOF
|
||||
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Install symlinks for triples with other vendor strings since some
|
||||
# programs insist on mangling the triple.
|
||||
local vendor
|
||||
for vendor in gentoo pc unknown; do
|
||||
local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
|
||||
for tool in clang{,++,-cpp}; do
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
doclang_cfg() {
|
||||
#local triple=$(get_abi_CHOST "${abi}")
|
||||
local triple=${CHOST}
|
||||
|
||||
_doclang_cfg ${triple}
|
||||
|
||||
# LLVM may have different arch names in some cases. For example in x86
|
||||
# profiles the triple uses i686, but llvm will prefer i386 if invoked
|
||||
# with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
|
||||
# be used if invoked through ${CHOST}-clang{,++,-cpp} though.
|
||||
#
|
||||
# To make sure the correct triples are installed,
|
||||
# see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
|
||||
# and compare with CHOST values in profiles.
|
||||
|
||||
local abi=${triple%%-*}
|
||||
case ${abi} in
|
||||
armv4l|armv4t|armv5tel|armv6j|armv7a)
|
||||
_doclang_cfg ${triple/${abi}/arm}
|
||||
;;
|
||||
i686)
|
||||
_doclang_cfg ${triple/${abi}/i386}
|
||||
;;
|
||||
sparc)
|
||||
_doclang_cfg ${triple/${abi}/sparcel}
|
||||
;;
|
||||
sparc64)
|
||||
_doclang_cfg ${triple/${abi}/sparcv9}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
# Rename programs and update symlinks
|
||||
cd "${D}/usr/lib/llvm/bloomberg-p2996/bin" || die
|
||||
for file in *; do
|
||||
if [[ -f "${file}" && -x "${file}" && ! -L "${file}" ]]; then
|
||||
# Rename regular, executable files
|
||||
mv "${file}" "bloomberg-p2996-${file}" || die "Failed to rename ${file}"
|
||||
elif [[ -L "${file}" ]]; then
|
||||
# Update symlink to point to renamed target
|
||||
local target
|
||||
target=$(readlink "${file}") || die "Failed to read symlink ${file}"
|
||||
ln -sf "bloomberg-p2996-${target}" "bloomberg-p2996-${file}" || die "Failed to update symlink ${file}"
|
||||
rm "${file}" || die "Failed to remove original symlink ${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
local ldpath="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/$(get_libdir)"
|
||||
newenvd - "60llvm-bloomberg-p2996" <<-_EOF_
|
||||
PATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
# we need to duplicate it in ROOTPATH for Portage to respect...
|
||||
ROOTPATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
LDPATH="${ldpath}:${ldpath}/${CHOST}"
|
||||
_EOF_
|
||||
|
||||
insinto "/etc/clang/bloomberg-p2996"
|
||||
newins - gentoo-runtimes.cfg <<-EOF
|
||||
# This file is initially generated by sys-devel/clang-bloomberg-p2996::guru.
|
||||
# It is used to control the default runtimes using by clang.
|
||||
|
||||
--rtlib=libgcc
|
||||
--unwindlib=libgcc
|
||||
--stdlib=libc++
|
||||
-fuse-ld=bfd
|
||||
-L${ldpath}/${CHOST}
|
||||
EOF
|
||||
newins - gentoo-plugins.cfg <<-EOF
|
||||
# This file is used to load optional LLVM plugins.
|
||||
EOF
|
||||
|
||||
doclang_cfg
|
||||
|
||||
rm -r "${D}/usr/share/man" || die
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog "Binaries are installed with a 'bloomberg-p2996-' prefix,"
|
||||
elog "e.g.: bloomberg-p2996-clang++"
|
||||
use default-reflection-latest && \
|
||||
elog "Pass -fno-reflection-latest to disable reflection support." || \
|
||||
elog "Pass -freflection-latest to enable reflection support."
|
||||
}
|
||||
@@ -1,250 +0,0 @@
|
||||
# Copyright 2025 Gentoo Authors
|
||||
# Distributed under the terms of the GNU General Public License v2
|
||||
|
||||
EAPI=8
|
||||
|
||||
inherit cmake prefix python-utils-r1
|
||||
|
||||
DESCRIPTION="Clang fork implementing experimental support for P2996 (Reflection for C++26)"
|
||||
HOMEPAGE="https://github.com/bloomberg/clang-p2996"
|
||||
|
||||
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA BSD MIT public-domain rc"
|
||||
SLOT="0"
|
||||
|
||||
if [[ ${PV} == 9999 ]]; then
|
||||
inherit git-r3
|
||||
EGIT_REPO_URI="https://github.com/bloomberg/clang-p2996.git"
|
||||
EGIT_BRANCH="p2996"
|
||||
else
|
||||
GIT_COMMIT=""
|
||||
SRC_URI="https://github.com/bloomberg/clang-p2996/archive/${GIT_COMMIT}.tar.gz -> ${P}.tar.gz"
|
||||
S="${WORKDIR}/clang-p2996-${GIT_COMMIT}"
|
||||
KEYWORDS="~amd64"
|
||||
fi
|
||||
|
||||
ALL_LLVM_TARGETS="AArch64 AMDGPU ARC ARM AVR BPF CSKY DirectX Hexagon Lanai LoongArch M68k MSP430 Mips NVPTX PowerPC RISCV SPIRV Sparc SystemZ VE WebAssembly +X86 XCore Xtensa"
|
||||
IUSE="+debug +default-reflection-latest +pie +static-libs"
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
IUSE+=" ${target%${target#+}}llvm_targets_${target#+}"
|
||||
done
|
||||
|
||||
RDEPEND="
|
||||
app-arch/zstd:=
|
||||
dev-libs/libxml2:=
|
||||
virtual/zlib:=
|
||||
"
|
||||
DEPEND="${RDEPEND}"
|
||||
|
||||
PATCHES=(
|
||||
"${FILESDIR}/21.0.0_p20250702-unknown-reflection.patch"
|
||||
"${FILESDIR}/21.0.0_p20250702-uninitialized.patch"
|
||||
)
|
||||
|
||||
CMAKE_USE_DIR="$S/llvm"
|
||||
|
||||
src_prepare() {
|
||||
# create extra parent dir for relative CLANG_RESOURCE_DIR access
|
||||
mkdir -p x/y || die
|
||||
BUILD_DIR=${WORKDIR}/x/y/clang
|
||||
|
||||
use default-reflection-latest && eapply "${FILESDIR}/21.0.0_p20250702-enable-reflection-latest.patch"
|
||||
|
||||
cmake_src_prepare
|
||||
|
||||
# add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
|
||||
eprefixify \
|
||||
clang/lib/Lex/InitHeaderSearch.cpp \
|
||||
clang/lib/Driver/ToolChains/Darwin.cpp || die
|
||||
|
||||
if ! use prefix-guest && [[ -n ${EPREFIX} ]]; then
|
||||
sed -i "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" clang/lib/Driver/ToolChains/Linux.cpp || die
|
||||
fi
|
||||
}
|
||||
|
||||
src_configure() {
|
||||
local targets=()
|
||||
for target in ${ALL_LLVM_TARGETS}; do
|
||||
use llvm_targets_${target#+} && targets+=("${target#+}")
|
||||
done
|
||||
if [ ${#targets[@]} -eq 0 ]; then
|
||||
die "At least one LLVM target must be enabled"
|
||||
fi
|
||||
|
||||
local libdir=$(get_libdir)
|
||||
local mycmakeargs=(
|
||||
-DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}")
|
||||
-DCMAKE_CXX_COMPILER_TARGET="${CHOST}"
|
||||
-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/bloomberg-p2996"
|
||||
-DLLVM_LIBDIR_SUFFIX=${libdir#lib}
|
||||
|
||||
-DBUILD_SHARED_LIBS=OFF
|
||||
-DLLVM_HOST_TRIPLE="${CHOST}"
|
||||
-DLLVM_BUILD_LLVM_DYLIB=ON
|
||||
-DLLVM_LINK_LLVM_DYLIB=ON
|
||||
-DLLVM_ENABLE_PROJECTS="clang"
|
||||
-DLLVM_ENABLE_RUNTIMES="libcxxabi;libcxx"
|
||||
-DRUNTIMES_CMAKE_ARGS="\
|
||||
-DCMAKE_EXE_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_SHARED_LINKER_FLAGS=-Wl,-rpath,${BUILD_DIR}/${libdir};\
|
||||
-DCMAKE_BUILD_WITH_INSTALL_RPATH=OFF;\
|
||||
-DCMAKE_INSTALL_RPATH_USE_LINK_PATH=ON"
|
||||
-DLLVM_TARGETS_TO_BUILD="$(IFS=';'; echo "${targets[*]}")"
|
||||
-DLLVM_INCLUDE_BENCHMARKS=OFF
|
||||
-DLLVM_INCLUDE_TESTS=OFF
|
||||
-DLLVM_BUILD_TESTS=OFF
|
||||
-DLLVM_INSTALL_GTEST=OFF
|
||||
|
||||
-DLLVM_ENABLE_ASSERTIONS=$(usex debug)
|
||||
-DLLVM_ENABLE_EH=ON
|
||||
-DLLVM_ENABLE_RTTI=ON
|
||||
-DLLVM_ENABLE_ZLIB=FORCE_ON
|
||||
|
||||
-DLIBCXX_ENABLE_SHARED=ON
|
||||
-DLIBCXX_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXX_CXX_ABI=libcxxabi
|
||||
-DLIBCXX_USE_COMPILER_RT=OFF
|
||||
-DLIBCXX_HAS_GCC_S_LIB=OFF
|
||||
-DLIBCXX_INCLUDE_BENCHMARKS=OFF
|
||||
-DLIBCXX_INCLUDE_TESTS=OFF
|
||||
-DLIBCXXABI_ENABLE_STATIC=$(usex static-libs)
|
||||
-DLIBCXXABI_LIBUNWIND_INCLUDES="${EPREFIX}"/usr/include
|
||||
-DLIBCXXABI_USE_LLVM_UNWINDER=OFF
|
||||
|
||||
-DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang/bloomberg-p2996"
|
||||
-DCLANG_CONFIG_FILE_USER_DIR="~/.config/clang"
|
||||
# relative to bindir
|
||||
-DCLANG_RESOURCE_DIR="../../../../lib/clang/bloomberg-p2996"
|
||||
-DCLANG_LINK_CLANG_DYLIB=ON
|
||||
-DCLANG_INCLUDE_TESTS=OFF
|
||||
|
||||
-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
|
||||
-DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie)
|
||||
|
||||
-DPython3_EXECUTABLE="${PYTHON}"
|
||||
|
||||
-DOCAMLFIND=NO
|
||||
)
|
||||
|
||||
use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
|
||||
cmake_src_configure
|
||||
}
|
||||
|
||||
src_compile() {
|
||||
cmake_src_compile
|
||||
}
|
||||
|
||||
_doclang_cfg() {
|
||||
local triple="${1}"
|
||||
|
||||
local tool
|
||||
for tool in clang{,++,-cpp}; do
|
||||
newins - "${triple}-${tool}.cfg" <<-EOF
|
||||
# This configuration file is used by ${triple}-${tool} driver.
|
||||
@../${triple}-${tool}.cfg
|
||||
@gentoo-plugins.cfg
|
||||
@gentoo-runtimes.cfg
|
||||
EOF
|
||||
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/bloomberg-p2996-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
|
||||
# Install symlinks for triples with other vendor strings since some
|
||||
# programs insist on mangling the triple.
|
||||
local vendor
|
||||
for vendor in gentoo pc unknown; do
|
||||
local vendor_triple="${triple%%-*}-${vendor}-${triple#*-*-}"
|
||||
for tool in clang{,++,-cpp}; do
|
||||
if [[ ! -f "${ED}/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg" ]]; then
|
||||
dosym "${triple}-${tool}.cfg" "/etc/clang/bloomberg-p2996/${vendor_triple}-${tool}.cfg"
|
||||
fi
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
doclang_cfg() {
|
||||
#local triple=$(get_abi_CHOST "${abi}")
|
||||
local triple=${CHOST}
|
||||
|
||||
_doclang_cfg ${triple}
|
||||
|
||||
# LLVM may have different arch names in some cases. For example in x86
|
||||
# profiles the triple uses i686, but llvm will prefer i386 if invoked
|
||||
# with "clang" on x86 or "clang -m32" on x86_64. The gentoo triple will
|
||||
# be used if invoked through ${CHOST}-clang{,++,-cpp} though.
|
||||
#
|
||||
# To make sure the correct triples are installed,
|
||||
# see Triple::getArchTypeName() in llvm/lib/TargetParser/Triple.cpp
|
||||
# and compare with CHOST values in profiles.
|
||||
|
||||
local abi=${triple%%-*}
|
||||
case ${abi} in
|
||||
armv4l|armv4t|armv5tel|armv6j|armv7a)
|
||||
_doclang_cfg ${triple/${abi}/arm}
|
||||
;;
|
||||
i686)
|
||||
_doclang_cfg ${triple/${abi}/i386}
|
||||
;;
|
||||
sparc)
|
||||
_doclang_cfg ${triple/${abi}/sparcel}
|
||||
;;
|
||||
sparc64)
|
||||
_doclang_cfg ${triple/${abi}/sparcv9}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
src_install() {
|
||||
cmake_src_install
|
||||
|
||||
# Rename programs and update symlinks
|
||||
cd "${D}/usr/lib/llvm/bloomberg-p2996/bin" || die
|
||||
for file in *; do
|
||||
if [[ -f "${file}" && -x "${file}" && ! -L "${file}" ]]; then
|
||||
# Rename regular, executable files
|
||||
mv "${file}" "bloomberg-p2996-${file}" || die "Failed to rename ${file}"
|
||||
elif [[ -L "${file}" ]]; then
|
||||
# Update symlink to point to renamed target
|
||||
local target
|
||||
target=$(readlink "${file}") || die "Failed to read symlink ${file}"
|
||||
ln -sf "bloomberg-p2996-${target}" "bloomberg-p2996-${file}" || die "Failed to update symlink ${file}"
|
||||
rm "${file}" || die "Failed to remove original symlink ${file}"
|
||||
fi
|
||||
done
|
||||
|
||||
local ldpath="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/$(get_libdir)"
|
||||
newenvd - "60llvm-bloomberg-p2996" <<-_EOF_
|
||||
PATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
# we need to duplicate it in ROOTPATH for Portage to respect...
|
||||
ROOTPATH="${EPREFIX}/usr/lib/llvm/bloomberg-p2996/bin"
|
||||
LDPATH="${ldpath}:${ldpath}/${CHOST}"
|
||||
_EOF_
|
||||
|
||||
insinto "/etc/clang/bloomberg-p2996"
|
||||
newins - gentoo-runtimes.cfg <<-EOF
|
||||
# This file is initially generated by sys-devel/clang-bloomberg-p2996::guru.
|
||||
# It is used to control the default runtimes using by clang.
|
||||
|
||||
--rtlib=libgcc
|
||||
--unwindlib=libgcc
|
||||
--stdlib=libc++
|
||||
-fuse-ld=bfd
|
||||
-L${ldpath}/${CHOST}
|
||||
EOF
|
||||
newins - gentoo-plugins.cfg <<-EOF
|
||||
# This file is used to load optional LLVM plugins.
|
||||
EOF
|
||||
|
||||
doclang_cfg
|
||||
|
||||
rm -r "${D}/usr/share/man" || die
|
||||
}
|
||||
|
||||
pkg_postinst() {
|
||||
elog "Binaries are installed with a 'bloomberg-p2996-' prefix,"
|
||||
elog "e.g.: bloomberg-p2996-clang++"
|
||||
use default-reflection-latest && \
|
||||
elog "Pass -fno-reflection-latest to disable reflection support." || \
|
||||
elog "Pass -freflection-latest to enable reflection support."
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
index a7af861541b8..d372914dfaaf 100644
|
||||
--- a/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
|
||||
@@ -7066,7 +7066,7 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
||||
Args.AddLastArg(CmdArgs, options::OPT_fapinotes_swift_version);
|
||||
|
||||
if (Args.hasFlag(options::OPT_freflection_latest,
|
||||
- options::OPT_fno_reflection_latest, false)) {
|
||||
+ options::OPT_fno_reflection_latest, true)) {
|
||||
CmdArgs.push_back("-freflection");
|
||||
CmdArgs.push_back("-fparameter-reflection");
|
||||
CmdArgs.push_back("-fannotation-attributes");
|
||||
@@ -1,13 +0,0 @@
|
||||
diff --git a/llvm/include/llvm/ObjectYAML/ELFYAML.h b/llvm/include/llvm/ObjectYAML/ELFYAML.h
|
||||
index e883f2f3e144..1089feab39ea 100644
|
||||
--- a/llvm/include/llvm/ObjectYAML/ELFYAML.h
|
||||
+++ b/llvm/include/llvm/ObjectYAML/ELFYAML.h
|
||||
@@ -275,7 +275,7 @@ struct Section : public Chunk {
|
||||
std::optional<llvm::yaml::Hex64> Size;
|
||||
|
||||
// Holds the original section index.
|
||||
- unsigned OriginalSecNdx;
|
||||
+ unsigned OriginalSecNdx = 0;
|
||||
|
||||
Section(ChunkKind Kind, bool IsImplicit = false) : Chunk(Kind, IsImplicit) {}
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
diff --git a/clang/lib/AST/ExprConstantMeta.cpp b/clang/lib/AST/ExprConstantMeta.cpp
|
||||
index 0808f3124833..bc23ad41dbe5 100644
|
||||
--- a/clang/lib/AST/ExprConstantMeta.cpp
|
||||
+++ b/clang/lib/AST/ExprConstantMeta.cpp
|
||||
@@ -1664,6 +1664,7 @@ StringRef DescriptionOf(APValue RV, bool Granular = true) {
|
||||
return "an annotation";
|
||||
}
|
||||
}
|
||||
+ llvm_unreachable("unknown reflection");
|
||||
}
|
||||
|
||||
bool DiagnoseReflectionKind(DiagFn Diagnoser, SourceRange Range,
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
|
||||
<pkgmetadata>
|
||||
<maintainer type="person">
|
||||
<email>falbrechtskirchinger@gmail.com</email>
|
||||
<name>Florian Albrechtskirchinger</name>
|
||||
</maintainer>
|
||||
<use>
|
||||
<flag name="default-reflection-latest">Defaults -freflection-latest to on.</flag>
|
||||
</use>
|
||||
<upstream>
|
||||
<remote-id type="github">bloomberg/clang-p2996</remote-id>
|
||||
</upstream>
|
||||
</pkgmetadata>
|
||||
Reference in new issue
Block a user