mirror of
https://github.com/gentoo-mirror/guru.git
synced 2025-04-10 20:18:41 -04:00
dev-lang/swift: respect MAKEOPTS -j
The Swift build system takes a '-j'/'--jobs' flag, but the value from MAKEOPTS needs to be manually exposed to it for it to be respected. Closes: https://bugs.gentoo.org/951202 Signed-off-by: Itai Ferber <itai@itaiferber.net>
This commit is contained in:
parent
6c6dc8ce59
commit
0cf9b38183
@ -202,6 +202,26 @@ src_compile() {
|
||||
# contents are irrelevant.
|
||||
addpredict /var/lib/portage/home/.swiftpm
|
||||
|
||||
# Setting `-j<n>`/`--jobs=<n>` in MAKEOPTS needs to be manually exposed to
|
||||
# the Swift build system.
|
||||
local jobs_flag
|
||||
if [[ -n "${MAKEOPTS}" ]]; then
|
||||
local num_jobs make_opts=( $(getopt -qu -o 'j:' -l 'jobs:' -- ${MAKEOPTS}) )
|
||||
while [[ "${#make_opts[@]}" -gt 1 ]]; do
|
||||
case "${make_opts[0]}" in
|
||||
-j | --jobs )
|
||||
num_jobs="${make_opts[1]}"
|
||||
make_opts=("${make_opts[@]:2}") ;;
|
||||
-- ) break ;;
|
||||
* ) make_opts=("${make_opts[@]:1}") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "${num_jobs}" ]]; then
|
||||
jobs_flag="--jobs=${num_jobs}"
|
||||
fi
|
||||
fi
|
||||
|
||||
local _extra_cmake_options=(
|
||||
# BFD doesn't link Swift symbols properly, so we have to ensure Swift is
|
||||
# built with LLD.
|
||||
@ -243,6 +263,7 @@ src_compile() {
|
||||
--no-assertions \
|
||||
--build-subdir="Ninja-Release" \
|
||||
--install-destdir="${S}/stage0" \
|
||||
"${jobs_flag}" \
|
||||
--extra-cmake-options="${extra_cmake_options}" \
|
||||
--bootstrapping=off \
|
||||
--llvm-install-components='llvm-ar;llvm-cov;llvm-profdata;IndexStore;clang;clang-resource-headers;compiler-rt;clangd;lld;LTO;clang-features-file' \
|
||||
@ -267,6 +288,7 @@ src_compile() {
|
||||
--no-assertions \
|
||||
--build-subdir="Ninja-Release" \
|
||||
--install-destdir="${S}/stage1" \
|
||||
"${jobs_flag}" \
|
||||
--extra-cmake-options="${extra_cmake_options}" \
|
||||
--cmark --skip-test-cmark \
|
||||
--foundation --skip-test-foundation \
|
||||
@ -290,6 +312,7 @@ src_compile() {
|
||||
--no-assertions \
|
||||
--build-subdir="Ninja-Release" \
|
||||
--install-destdir="${S}/stage2" \
|
||||
"${jobs_flag}" \
|
||||
--extra-cmake-options="${extra_cmake_options}" \
|
||||
--foundation --skip-test-foundation \
|
||||
--indexstore-db --skip-test-indexstore-db \
|
||||
|
@ -182,6 +182,25 @@ src_configure() {
|
||||
cp "${FILESDIR}/${PF}/gentoo.ini" "${SWIFT_BUILD_PRESETS_INI_PATH}"
|
||||
local extra_build_flags=()
|
||||
|
||||
# Setting `-j<n>`/`--jobs=<n>` in MAKEOPTS needs to be manually exposed to
|
||||
# the Swift build system.
|
||||
if [[ -n "${MAKEOPTS}" ]]; then
|
||||
local num_jobs make_opts=( $(getopt -qu -o 'j:' -l 'jobs:' -- ${MAKEOPTS}) )
|
||||
while [[ "${#make_opts[@]}" -gt 1 ]]; do
|
||||
case "${make_opts[0]}" in
|
||||
-j | --jobs )
|
||||
num_jobs="${make_opts[1]}"
|
||||
make_opts=("${make_opts[@]:2}") ;;
|
||||
-- ) break ;;
|
||||
* ) make_opts=("${make_opts[@]:1}") ;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [[ -n "${num_jobs}" ]]; then
|
||||
extra_build_flags+=(--jobs="${num_jobs}")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ "$(tc-get-cxx-stdlib)" = 'libc++' ]]; then
|
||||
# On systems which use libc++ as their default C++ stdlib (e.g. systems
|
||||
# with the LLVM profile), we want to build the internal libc++ and
|
||||
|
Loading…
x
Reference in New Issue
Block a user