Add and use check_append_debug_flags
This commit is contained in:
parent
3c28c30133
commit
e41d018398
2 changed files with 16 additions and 6 deletions
|
@ -33,6 +33,19 @@ done
|
||||||
|
|
||||||
readonly -a buildenv_functions buildenv_vars build_options
|
readonly -a buildenv_functions buildenv_vars build_options
|
||||||
|
|
||||||
|
check_append_debug_flags() {
|
||||||
|
local -n flag=$1
|
||||||
|
local -n debug_flag=$2
|
||||||
|
|
||||||
|
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
||||||
|
if [[ $# -gt 1 ]]; then
|
||||||
|
local debug_extra=$3
|
||||||
|
append_once debug_flag "$debug_extra"
|
||||||
|
fi
|
||||||
|
append_once flag "$debug_flag"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
prepare_buildenv() {
|
prepare_buildenv() {
|
||||||
# ensure this function runs first
|
# ensure this function runs first
|
||||||
buildenv_buildflags
|
buildenv_buildflags
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
#
|
#
|
||||||
# rust.sh - Specify flags for building a package with rust
|
# rust.sh - Specify flags for building a package with rust
|
||||||
#
|
#
|
||||||
# Copyright (c) 2022 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
# Copyright (c) 2022-2024 Pacman Development Team <pacman-dev@lists.archlinux.org>
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -30,8 +30,5 @@ buildenv_vars+=('RUSTFLAGS' 'DEBUG_RUSTFLAGS')
|
||||||
buildenv_functions+=('buildenv_rust')
|
buildenv_functions+=('buildenv_rust')
|
||||||
|
|
||||||
buildenv_rust() {
|
buildenv_rust() {
|
||||||
if check_option "debug" "y" && ! check_option "buildflags" "n"; then
|
check_append_debug_flags RUSTFLAGS DEBUG_RUSTFLAGS "--remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
||||||
append_once DEBUG_RUSTFLAGS "--remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}/${pkgbase}"
|
}
|
||||||
append_once RUSTFLAGS "$DEBUG_RUSTFLAGS"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue