[dev-db/mongodb] allow clang on gcc profile
This commit is contained in:
parent
62b49ec482
commit
b360af06a9
@ -45,6 +45,7 @@ RDEPEND="acct-group/mongodb
|
||||
>=sys-libs/zlib-1.2.12:=
|
||||
clang? (
|
||||
$(llvm_gen_dep "
|
||||
sys-devel/clang:\${LLVM_SLOT}
|
||||
sys-devel/llvm:\${LLVM_SLOT}
|
||||
")
|
||||
)
|
||||
@ -117,9 +118,8 @@ pkg_pretend() {
|
||||
|
||||
pkg_setup() {
|
||||
python-any-r1_pkg_setup
|
||||
if tc-is-clang; then
|
||||
if use clang; then
|
||||
llvm-r1_pkg_setup
|
||||
llvm_fix_tool_path CC CXX
|
||||
fi
|
||||
}
|
||||
|
||||
@ -139,11 +139,6 @@ src_configure() {
|
||||
# --use-system-tcmalloc is strongly NOT recommended:
|
||||
# for MONGO_GIT_HASH use GitOrigin-RevId from the commit of the tag
|
||||
scons_opts=(
|
||||
AR="$(tc-getAR)"
|
||||
CC="$(tc-getCC)"
|
||||
CXX="$(tc-getCXX)"
|
||||
CCFLAGS="${CXXFLAGS}"
|
||||
|
||||
VERBOSE=1
|
||||
VARIANT_DIR=gentoo
|
||||
MONGO_VERSION="${PV}"
|
||||
@ -161,6 +156,49 @@ src_configure() {
|
||||
--use-system-zstd
|
||||
)
|
||||
|
||||
local have_switched_compiler=
|
||||
if use clang; then
|
||||
# Force clang
|
||||
local version_clang=$(clang --version 2>/dev/null | grep -F -- 'clang version' | awk '{ print $3 }')
|
||||
[[ -n ${version_clang} ]] && version_clang=$(ver_cut 1 "${version_clang}")
|
||||
[[ -z ${version_clang} ]] && die "Failed to read clang version!"
|
||||
|
||||
if tc-is-gcc; then
|
||||
have_switched_compiler=yes
|
||||
fi
|
||||
|
||||
AR=llvm-ar
|
||||
CC=${CHOST}-clang-${version_clang}
|
||||
CXX=${CHOST}-clang++-${version_clang}
|
||||
|
||||
scons_opts+=(
|
||||
AR="$(get_llvm_prefix)/bin/${AR}"
|
||||
CC="$(get_llvm_prefix)/bin/${CC}"
|
||||
CXX="$(get_llvm_prefix)/bin/${CXX}"
|
||||
)
|
||||
elif ! use clang && ! tc-is-gcc ; then
|
||||
# Force gcc
|
||||
have_switched_compiler=yes
|
||||
AR=gcc-ar
|
||||
CC=${CHOST}-gcc
|
||||
CXX=${CHOST}-g++
|
||||
scons_opts+=(
|
||||
AR="${AR}"
|
||||
CC="${CC}"
|
||||
CXX="${CXX}"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n "${have_switched_compiler}" ]] ; then
|
||||
# Because we switched active compiler we have to ensure
|
||||
# that no unsupported flags are set
|
||||
strip-unsupported-flags
|
||||
scons_opts+=(
|
||||
CCFLAGS="${CXXFLAGS}"
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300
|
||||
use amd64 && scons_opts+=( --experimental-optimization=-sandybridge ) # Bug 890294
|
||||
use debug && scons_opts+=( --dbg=on )
|
||||
|
@ -46,6 +46,7 @@ RDEPEND="acct-group/mongodb
|
||||
>=sys-libs/zlib-1.2.12:=
|
||||
clang? (
|
||||
$(llvm_gen_dep "
|
||||
sys-devel/clang:\${LLVM_SLOT}
|
||||
sys-devel/llvm:\${LLVM_SLOT}
|
||||
")
|
||||
)
|
||||
@ -96,14 +97,6 @@ python_check_deps() {
|
||||
python_has_version -b "dev-python/typing-extensions[${PYTHON_USEDEP}]"
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
python-any-r1_pkg_setup
|
||||
if tc-is-clang; then
|
||||
llvm-r1_pkg_setup
|
||||
llvm_fix_tool_path CC CXX
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_pretend() {
|
||||
# Bug 809692 + 890294
|
||||
if use amd64 && ! use cpu_flags_x86_avx; then
|
||||
@ -124,6 +117,13 @@ pkg_pretend() {
|
||||
fi
|
||||
}
|
||||
|
||||
pkg_setup() {
|
||||
python-any-r1_pkg_setup
|
||||
if use clang; then
|
||||
llvm-r1_pkg_setup
|
||||
fi
|
||||
}
|
||||
|
||||
src_prepare() {
|
||||
default
|
||||
|
||||
@ -140,11 +140,6 @@ src_configure() {
|
||||
# --use-system-tcmalloc is strongly NOT recommended:
|
||||
# for MONGO_GIT_HASH use GitOrigin-RevId from the commit of the tag
|
||||
scons_opts=(
|
||||
AR="$(tc-getAR)"
|
||||
CC="$(tc-getCC)"
|
||||
CXX="$(tc-getCXX)"
|
||||
CCFLAGS="${CXXFLAGS}"
|
||||
|
||||
VERBOSE=1
|
||||
VARIANT_DIR=gentoo
|
||||
MONGO_VERSION="${PV}"
|
||||
@ -162,6 +157,49 @@ src_configure() {
|
||||
--use-system-zstd
|
||||
)
|
||||
|
||||
local have_switched_compiler=
|
||||
if use clang; then
|
||||
# Force clang
|
||||
local version_clang=$(clang --version 2>/dev/null | grep -F -- 'clang version' | awk '{ print $3 }')
|
||||
[[ -n ${version_clang} ]] && version_clang=$(ver_cut 1 "${version_clang}")
|
||||
[[ -z ${version_clang} ]] && die "Failed to read clang version!"
|
||||
|
||||
if tc-is-gcc; then
|
||||
have_switched_compiler=yes
|
||||
fi
|
||||
|
||||
AR=llvm-ar
|
||||
CC=${CHOST}-clang-${version_clang}
|
||||
CXX=${CHOST}-clang++-${version_clang}
|
||||
|
||||
scons_opts+=(
|
||||
AR="$(get_llvm_prefix)/bin/${AR}"
|
||||
CC="$(get_llvm_prefix)/bin/${CC}"
|
||||
CXX="$(get_llvm_prefix)/bin/${CXX}"
|
||||
)
|
||||
elif ! use clang && ! tc-is-gcc ; then
|
||||
# Force gcc
|
||||
have_switched_compiler=yes
|
||||
AR=gcc-ar
|
||||
CC=${CHOST}-gcc
|
||||
CXX=${CHOST}-g++
|
||||
scons_opts+=(
|
||||
AR="${AR}"
|
||||
CC="${CC}"
|
||||
CXX="${CXX}"
|
||||
)
|
||||
fi
|
||||
|
||||
if [[ -n "${have_switched_compiler}" ]] ; then
|
||||
# Because we switched active compiler we have to ensure
|
||||
# that no unsupported flags are set
|
||||
strip-unsupported-flags
|
||||
scons_opts+=(
|
||||
CCFLAGS="${CXXFLAGS}"
|
||||
)
|
||||
|
||||
fi
|
||||
|
||||
use arm64 && scons_opts+=( --use-hardware-crc32=off ) # Bug 701300
|
||||
use amd64 && scons_opts+=( --experimental-optimization=-sandybridge ) # Bug 890294
|
||||
use debug && scons_opts+=( --dbg=on )
|
||||
|
Loading…
Reference in New Issue
Block a user