dev-lang/swift: use $(get_makeopts_jobs) instead of parsing MAKEOPTS

Acked-by: Katalin Rebhan <kat@knifepoint.net>
Part-off: https://codeberg.org/gentoo/guru/pulls/203
Merges: https://codeberg.org/gentoo/guru/pulls/203
Signed-off-by: M. Muddassar Sarfraz <zyx@envs.net>
This commit is contained in:
M. Muddassar Sarfraz committed 2026-11-29 20:49:48 +05:00
1 parent 7c2d90ce2e
commit 699c2a99b8
2 files changed
+6 -42

No files matched your search

+2 -22
View File
@@ -5,7 +5,7 @@ EAPI=8
LLVM_COMPAT=( {17..21} )
PYTHON_COMPAT=( python3_{13..14} )
inherit flag-o-matic llvm-r2 python-single-r1
inherit flag-o-matic llvm-r2 multiprocessing python-single-r1
DESCRIPTION="A high-level, general-purpose, multi-paradigm, compiled programming language"
HOMEPAGE="https://www.swift.org"
@@ -235,26 +235,6 @@ src_compile() {
# See https://github.com/swiftlang/swift-foundation/blob/749a17d9220883db1237d09143160e06a9b64b66/Sources/FoundationEssentials/String/String%2BPath.swift#L390-L407.
local -x CFFIXED_USER_HOME="$HOME"
# 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.
@@ -296,7 +276,7 @@ src_compile() {
--no-assertions \
--build-subdir="Ninja-Release" \
--install-destdir="${S}/stage0" \
"${jobs_flag}" \
--jobs=$(get_makeopts_jobs) \
--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' \
+4 -20
View File
@@ -5,7 +5,7 @@ EAPI=8
LLVM_COMPAT=( {17..22} )
PYTHON_COMPAT=( python3_{13..14} )
inherit flag-o-matic llvm-r2 python-single-r1
inherit flag-o-matic llvm-r2 multiprocessing python-single-r1
DESCRIPTION="A high-level, general-purpose, multi-paradigm, compiled programming language"
HOMEPAGE="https://www.swift.org"
@@ -214,26 +214,10 @@ src_configure() {
# Extend the 'gentoo' build preset with user-specified flags and flags for
# libc++ systems.
cp "${FILESDIR}/${PN}-6.1-gentoo.ini" "${SWIFT_BUILD_PRESETS_INI_PATH}" || die
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
local extra_build_flags=(
--jobs=$(get_makeopts_jobs)
)
if use libcxx; then
extra_build_flags+=(