llvm-core/clang/clang-15.0.7-r4.ebuild
author gabriel
Sat, 03 May 2025 12:42:16 +0100
changeset 56 c06654b63375
parent 52 a005dcda4775
permissions -rw-r--r--
...forgot manifest again...
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
52
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     1
# Copyright 1999-2024 Gentoo Authors
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     2
# Distributed under the terms of the GNU General Public License v2
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     3
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     4
EAPI=8
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     5
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     6
PYTHON_COMPAT=( python3_{10..13} )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     7
inherit cmake llvm llvm.org multilib multilib-minimal \
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     8
	prefix python-single-r1 toolchain-funcs
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
     9
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    10
DESCRIPTION="C language family frontend for LLVM"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    11
HOMEPAGE="https://llvm.org/"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    12
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    13
# MSVCSetupApi.h: MIT
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    14
# sorttable.js: MIT
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    15
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    16
LICENSE="Apache-2.0-with-LLVM-exceptions UoI-NCSA MIT"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    17
SLOT="${LLVM_MAJOR}/${LLVM_SOABI}g1"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    18
KEYWORDS="amd64 arm arm64 ppc ppc64 ~riscv sparc x86 ~amd64-linux ~x64-macos"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    19
IUSE="debug doc +extra ieee-long-double +pie +static-analyzer test xml"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    20
REQUIRED_USE="${PYTHON_REQUIRED_USE}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    21
RESTRICT="!test? ( test )"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    22
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    23
DEPEND="
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    24
	~llvm-core/llvm-${PV}:${LLVM_MAJOR}=[debug=,${MULTILIB_USEDEP}]
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    25
	static-analyzer? ( dev-lang/perl:* )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    26
	xml? ( dev-libs/libxml2:2=[${MULTILIB_USEDEP}] )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    27
"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    28
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    29
RDEPEND="
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    30
	${PYTHON_DEPS}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    31
	${DEPEND}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    32
	>=llvm-core/clang-common-${PV}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    33
"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    34
BDEPEND="
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    35
	${PYTHON_DEPS}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    36
	doc? ( $(python_gen_cond_dep '
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    37
		dev-python/recommonmark[${PYTHON_USEDEP}]
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    38
		dev-python/sphinx[${PYTHON_USEDEP}]
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    39
	') )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    40
	xml? ( virtual/pkgconfig )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    41
"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    42
PDEPEND="
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    43
	llvm-core/clang-toolchain-symlinks:${LLVM_MAJOR}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    44
	~llvm-core/clang-runtime-${PV}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    45
"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    46
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    47
LLVM_COMPONENTS=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    48
	clang clang-tools-extra cmake
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    49
	llvm/lib/Transforms/Hello
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    50
)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    51
LLVM_MANPAGES=1
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    52
LLVM_TEST_COMPONENTS=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    53
	llvm/lib/Testing/Support
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    54
	llvm/utils/{lit,llvm-lit,unittest}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    55
	llvm/utils/{UpdateTestChecks,update_cc_test_checks.py}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    56
)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    57
LLVM_PATCHSET=${PV/_/-}-r3
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    58
LLVM_USE_TARGETS=llvm
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    59
llvm.org_set_globals
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    60
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    61
# Multilib notes:
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    62
# 1. ABI_* flags control ABIs libclang* is built for only.
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    63
# 2. clang is always capable of compiling code for all ABIs for enabled
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    64
#    target. However, you will need appropriate crt* files (installed
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    65
#    e.g. by sys-devel/gcc and sys-libs/glibc).
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    66
# 3. ${CHOST}-clang wrappers are always installed for all ABIs included
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    67
#    in the current profile (i.e. alike supported by sys-devel/gcc).
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    68
#
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    69
# Therefore: use llvm-core/clang[${MULTILIB_USEDEP}] only if you need
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    70
# multilib clang* libraries (not runtime, not wrappers).
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    71
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    72
pkg_setup() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    73
	LLVM_MAX_SLOT=${LLVM_MAJOR} llvm_pkg_setup
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    74
	python-single-r1_pkg_setup
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    75
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    76
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    77
src_prepare() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    78
	# create extra parent dir for relative CLANG_RESOURCE_DIR access
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    79
	mkdir -p x/y || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    80
	BUILD_DIR=${WORKDIR}/x/y/clang
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    81
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    82
	llvm.org_src_prepare
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    83
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    84
	# add Gentoo Portage Prefix for Darwin (see prefix-dirs.patch)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    85
	eprefixify \
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    86
		lib/Lex/InitHeaderSearch.cpp \
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    87
		lib/Driver/ToolChains/Darwin.cpp || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    88
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    89
	if ! use prefix-guest && [[ -n ${EPREFIX} ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    90
		sed -i "/LibDir.*Loader/s@return \"\/\"@return \"${EPREFIX}/\"@" lib/Driver/ToolChains/Linux.cpp || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    91
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    92
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    93
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    94
check_distribution_components() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    95
	if [[ ${CMAKE_MAKEFILE_GENERATOR} == ninja ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    96
		local all_targets=() my_targets=() l
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    97
		cd "${BUILD_DIR}" || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    98
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
    99
		while read -r l; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   100
			if [[ ${l} == install-*-stripped:* ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   101
				l=${l#install-}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   102
				l=${l%%-stripped*}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   103
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   104
				case ${l} in
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   105
					# meta-targets
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   106
					clang-libraries|distribution)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   107
						continue
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   108
						;;
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   109
					# tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   110
					clang|clangd|clang-*)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   111
						;;
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   112
					# static libraries
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   113
					clang*|findAllSymbols)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   114
						continue
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   115
						;;
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   116
					# conditional to USE=doc
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   117
					docs-clang-html|docs-clang-tools-html)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   118
						use doc || continue
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   119
						;;
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   120
				esac
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   121
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   122
				all_targets+=( "${l}" )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   123
			fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   124
		done < <(${NINJA} -t targets all)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   125
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   126
		while read -r l; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   127
			my_targets+=( "${l}" )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   128
		done < <(get_distribution_components $"\n")
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   129
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   130
		local add=() remove=()
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   131
		for l in "${all_targets[@]}"; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   132
			if ! has "${l}" "${my_targets[@]}"; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   133
				add+=( "${l}" )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   134
			fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   135
		done
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   136
		for l in "${my_targets[@]}"; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   137
			if ! has "${l}" "${all_targets[@]}"; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   138
				remove+=( "${l}" )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   139
			fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   140
		done
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   141
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   142
		if [[ ${#add[@]} -gt 0 || ${#remove[@]} -gt 0 ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   143
			eqawarn "get_distribution_components() is outdated!"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   144
			eqawarn "   Add: ${add[*]}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   145
			eqawarn "Remove: ${remove[*]}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   146
		fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   147
		cd - >/dev/null || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   148
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   149
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   150
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   151
get_distribution_components() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   152
	local sep=${1-;}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   153
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   154
	local out=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   155
		# common stuff
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   156
		clang-cmake-exports
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   157
		clang-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   158
		clang-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   159
		libclang-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   160
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   161
		aarch64-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   162
		arm-common-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   163
		arm-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   164
		core-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   165
		cuda-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   166
		hexagon-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   167
		hip-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   168
		hlsl-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   169
		mips-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   170
		opencl-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   171
		openmp-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   172
		ppc-htm-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   173
		ppc-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   174
		riscv-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   175
		systemz-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   176
		utility-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   177
		ve-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   178
		webassembly-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   179
		windows-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   180
		x86-resource-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   181
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   182
		# libs
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   183
		clang-cpp
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   184
		libclang
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   185
	)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   186
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   187
	if multilib_is_native_abi; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   188
		out+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   189
			# common stuff
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   190
			bash-autocomplete
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   191
			libclang-python-bindings
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   192
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   193
			# tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   194
			c-index-test
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   195
			clang
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   196
			clang-format
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   197
			clang-offload-bundler
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   198
			clang-offload-packager
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   199
			clang-offload-wrapper
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   200
			clang-refactor
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   201
			clang-repl
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   202
			clang-rename
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   203
			clang-scan-deps
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   204
			diagtool
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   205
			hmaptool
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   206
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   207
			# needed for cross-compiling Clang
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   208
			clang-tblgen
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   209
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   210
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   211
		if use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   212
			out+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   213
				# extra tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   214
				clang-apply-replacements
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   215
				clang-change-namespace
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   216
				clang-doc
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   217
				clang-include-fixer
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   218
				clang-move
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   219
				clang-pseudo
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   220
				clang-query
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   221
				clang-reorder-fields
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   222
				clang-tidy
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   223
				clang-tidy-headers
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   224
				clangd
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   225
				find-all-symbols
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   226
				modularize
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   227
				pp-trace
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   228
			)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   229
		fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   230
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   231
		if llvm_are_manpages_built; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   232
			out+=( docs-clang-man )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   233
			use extra && out+=( docs-clang-tools-man )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   234
		fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   235
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   236
		if use doc; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   237
			out+=( docs-clang-html )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   238
			use extra && out+=( docs-clang-tools-html )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   239
		fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   240
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   241
		use static-analyzer && out+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   242
			clang-check
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   243
			clang-extdef-mapping
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   244
			scan-build
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   245
			scan-build-py
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   246
			scan-view
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   247
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   248
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   249
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   250
	printf "%s${sep}" "${out[@]}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   251
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   252
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   253
multilib_src_configure() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   254
	local mycmakeargs=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   255
		-DDEFAULT_SYSROOT=$(usex prefix-guest "" "${EPREFIX}")
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   256
		-DCMAKE_INSTALL_PREFIX="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   257
		-DCMAKE_INSTALL_MANDIR="${EPREFIX}/usr/lib/llvm/${LLVM_MAJOR}/share/man"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   258
		-DCLANG_CONFIG_FILE_SYSTEM_DIR="${EPREFIX}/etc/clang"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   259
		# relative to bindir
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   260
		-DCLANG_RESOURCE_DIR="../../../../lib/clang/${LLVM_VERSION}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   261
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   262
		-DBUILD_SHARED_LIBS=OFF
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   263
		-DCLANG_LINK_CLANG_DYLIB=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   264
		-DLLVM_DISTRIBUTION_COMPONENTS=$(get_distribution_components)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   265
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   266
		-DLLVM_TARGETS_TO_BUILD="${LLVM_TARGETS// /;}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   267
		-DLLVM_BUILD_TESTS=$(usex test)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   268
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   269
		# these are not propagated reliably, so redefine them
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   270
		-DLLVM_ENABLE_EH=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   271
		-DLLVM_ENABLE_RTTI=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   272
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   273
		-DCMAKE_DISABLE_FIND_PACKAGE_LibXml2=$(usex !xml)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   274
		# libgomp support fails to find headers without explicit -I
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   275
		# furthermore, it provides only syntax checking
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   276
		-DCLANG_DEFAULT_OPENMP_RUNTIME=libomp
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   277
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   278
		# disable using CUDA to autodetect GPU, just build for all
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   279
		-DCMAKE_DISABLE_FIND_PACKAGE_CUDA=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   280
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   281
		-DCLANG_DEFAULT_PIE_ON_LINUX=$(usex pie)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   282
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   283
		-DCLANG_ENABLE_ARCMT=$(usex static-analyzer)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   284
		-DCLANG_ENABLE_STATIC_ANALYZER=$(usex static-analyzer)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   285
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   286
		-DPython3_EXECUTABLE="${PYTHON}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   287
	)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   288
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   289
	if ! use elibc_musl; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   290
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   291
			-DPPC_LINUX_DEFAULT_IEEELONGDOUBLE=$(usex ieee-long-double)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   292
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   293
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   294
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   295
	use test && mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   296
		-DLLVM_MAIN_SRC_DIR="${WORKDIR}/llvm"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   297
		-DLLVM_EXTERNAL_LIT="${BUILD_DIR}/bin/llvm-lit"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   298
		-DLLVM_LIT_ARGS="$(get_lit_flags)"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   299
	)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   300
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   301
	if multilib_is_native_abi; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   302
		local build_docs=OFF
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   303
		if llvm_are_manpages_built; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   304
			build_docs=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   305
			mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   306
				-DLLVM_BUILD_DOCS=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   307
				-DLLVM_ENABLE_SPHINX=ON
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   308
				-DCLANG_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/html"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   309
				-DSPHINX_WARNINGS_AS_ERRORS=OFF
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   310
			)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   311
			if use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   312
				mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   313
					-DCLANG-TOOLS_INSTALL_SPHINX_HTML_DIR="${EPREFIX}/usr/share/doc/${PF}/tools-extra"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   314
				)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   315
			fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   316
		fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   317
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   318
			-DCLANG_INCLUDE_DOCS=${build_docs}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   319
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   320
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   321
	if multilib_native_use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   322
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   323
			-DLLVM_EXTERNAL_CLANG_TOOLS_EXTRA_SOURCE_DIR="${WORKDIR}"/clang-tools-extra
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   324
			-DCLANG_TOOLS_EXTRA_INCLUDE_DOCS=${build_docs}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   325
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   326
	else
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   327
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   328
			-DLLVM_TOOL_CLANG_TOOLS_EXTRA_BUILD=OFF
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   329
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   330
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   331
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   332
	if [[ -n ${EPREFIX} ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   333
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   334
			-DGCC_INSTALL_PREFIX="${EPREFIX}/usr"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   335
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   336
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   337
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   338
	if tc-is-cross-compiler; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   339
		has_version -b llvm-core/clang:${LLVM_MAJOR} ||
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   340
			die "llvm-core/clang:${LLVM_MAJOR} is required on the build host."
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   341
		local tools_bin=${BROOT}/usr/lib/llvm/${LLVM_MAJOR}/bin
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   342
		mycmakeargs+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   343
			-DLLVM_TOOLS_BINARY_DIR="${tools_bin}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   344
			-DCLANG_TABLEGEN="${tools_bin}"/clang-tblgen
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   345
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   346
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   347
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   348
	# LLVM can have very high memory consumption while linking,
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   349
	# exhausting the limit on 32-bit linker executable
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   350
	use x86 && local -x LDFLAGS="${LDFLAGS} -Wl,--no-keep-memory"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   351
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   352
	# LLVM_ENABLE_ASSERTIONS=NO does not guarantee this for us, #614844
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   353
	use debug || local -x CPPFLAGS="${CPPFLAGS} -DNDEBUG"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   354
	cmake_src_configure
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   355
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   356
	multilib_is_native_abi && check_distribution_components
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   357
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   358
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   359
multilib_src_compile() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   360
	cmake_build distribution
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   361
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   362
	# provide a symlink for tests
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   363
	if [[ ! -L ${WORKDIR}/lib/clang ]]; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   364
		mkdir -p "${WORKDIR}"/lib || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   365
		ln -s "${BUILD_DIR}/$(get_libdir)/clang" "${WORKDIR}"/lib/clang || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   366
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   367
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   368
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   369
multilib_src_test() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   370
	# respect TMPDIR!
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   371
	local -x LIT_PRESERVES_TMP=1
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   372
	local test_targets=( check-clang )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   373
	if multilib_native_use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   374
		test_targets+=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   375
			check-clang-tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   376
			check-clangd
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   377
		)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   378
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   379
	cmake_build "${test_targets[@]}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   380
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   381
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   382
src_install() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   383
	MULTILIB_WRAPPED_HEADERS=(
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   384
		/usr/include/clang/Config/config.h
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   385
	)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   386
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   387
	multilib-minimal_src_install
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   388
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   389
	# Move runtime headers to /usr/lib/clang, where they belong
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   390
	mv "${ED}"/usr/include/clangrt "${ED}"/usr/lib/clang || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   391
	# move (remaining) wrapped headers back
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   392
	if use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   393
		mv "${T}"/clang-tidy "${ED}"/usr/include/ || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   394
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   395
	mv "${ED}"/usr/include "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   396
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   397
	# Apply CHOST and version suffix to clang tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   398
	local clang_tools=( clang clang++ clang-cl clang-cpp )
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   399
	local abi i
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   400
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   401
	# cmake gives us:
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   402
	# - clang-X
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   403
	# - clang -> clang-X
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   404
	# - clang++, clang-cl, clang-cpp -> clang
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   405
	# we want to have:
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   406
	# - clang-X
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   407
	# - clang++-X, clang-cl-X, clang-cpp-X -> clang-X
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   408
	# - clang, clang++, clang-cl, clang-cpp -> clang*-X
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   409
	# also in CHOST variant
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   410
	for i in "${clang_tools[@]:1}"; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   411
		rm "${ED}/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}" || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   412
		dosym "clang-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}-${LLVM_MAJOR}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   413
		dosym "${i}-${LLVM_MAJOR}" "/usr/lib/llvm/${LLVM_MAJOR}/bin/${i}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   414
	done
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   415
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   416
	# now create target symlinks for all supported ABIs
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   417
	for abi in $(get_all_abis); do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   418
		local abi_chost=$(get_abi_CHOST "${abi}")
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   419
		for i in "${clang_tools[@]}"; do
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   420
			dosym "${i}-${LLVM_MAJOR}" \
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   421
				"/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}-${LLVM_MAJOR}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   422
			dosym "${abi_chost}-${i}-${LLVM_MAJOR}" \
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   423
				"/usr/lib/llvm/${LLVM_MAJOR}/bin/${abi_chost}-${i}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   424
		done
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   425
	done
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   426
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   427
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   428
multilib_src_install() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   429
	DESTDIR=${D} cmake_build install-distribution
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   430
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   431
	if multilib_is_native_abi; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   432
		# install clang-*-wrapper tools
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   433
		# https://bugs.gentoo.org/904143
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   434
		exeinto "/usr/lib/llvm/${LLVM_MAJOR}/bin"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   435
		doexe "${BUILD_DIR}"/bin/clang-{linker,nvlink}-wrapper
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   436
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   437
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   438
	# move headers to /usr/include for wrapping & ABI mismatch checks
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   439
	# (also drop the version suffix from runtime headers)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   440
	rm -rf "${ED}"/usr/include || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   441
	mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/include "${ED}"/usr/include || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   442
	mv "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/$(get_libdir)/clang "${ED}"/usr/include/clangrt || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   443
	if multilib_native_use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   444
		# don't wrap clang-tidy headers, the list is too long
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   445
		# (they're fine for non-native ABI but enabling the targets is problematic)
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   446
		mv "${ED}"/usr/include/clang-tidy "${T}/" || die
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   447
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   448
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   449
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   450
multilib_src_install_all() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   451
	python_fix_shebang "${ED}"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   452
	if use static-analyzer; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   453
		python_optimize "${ED}"/usr/lib/llvm/${LLVM_MAJOR}/share/scan-view
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   454
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   455
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   456
	docompress "/usr/lib/llvm/${LLVM_MAJOR}/share/man"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   457
	llvm_install_manpages
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   458
	# match 'html' non-compression
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   459
	use doc && docompress -x "/usr/share/doc/${PF}/tools-extra"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   460
	# +x for some reason; TODO: investigate
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   461
	use static-analyzer && fperms a-x "/usr/lib/llvm/${LLVM_MAJOR}/share/man/man1/scan-build.1"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   462
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   463
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   464
pkg_postinst() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   465
	if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   466
		eselect compiler-shadow update all
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   467
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   468
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   469
	elog "You can find additional utility scripts in:"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   470
	elog "  ${EROOT}/usr/lib/llvm/${LLVM_MAJOR}/share/clang"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   471
	if use extra; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   472
		elog "Some of them are vim integration scripts (with instructions inside)."
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   473
		elog "The run-clang-tidy.py script requires the following additional package:"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   474
		elog "  dev-python/pyyaml"
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   475
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   476
}
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   477
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   478
pkg_postrm() {
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   479
	if [[ -z ${ROOT} && -f ${EPREFIX}/usr/share/eselect/modules/compiler-shadow.eselect ]] ; then
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   480
		eselect compiler-shadow clean all
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   481
	fi
a005dcda4775 Attempt to make clang 15 compatible with python 3.13
gabriel
parents:
diff changeset
   482
}