[pacman-dev] [PATCH 1/2] libmakepkg: always remap debug prefix
Morgan Adamiec
morganamilo at archlinux.org
Thu Apr 22 20:57:49 UTC 2021
On 22/04/2021 21:54, Eli Schwartz wrote:
> On 4/21/21 11:43 AM, morganamilo wrote:
>> Sometimes non debug flags still generate debug symbols. So always remap
>> them.
>
> The purpose of debug prefix mapping is to point to the sources we
> install, which in this case we do not install -- and oftentimes we will
> strip.
>
> What problem is this patch trying to solve?
>
>> diff --git a/scripts/libmakepkg/buildenv/debugflags.sh.in b/scripts/libmakepkg/buildenv/debugflags.sh.in
>> index 60913080..52ff4750 100644
>> --- a/scripts/libmakepkg/buildenv/debugflags.sh.in
>> +++ b/scripts/libmakepkg/buildenv/debugflags.sh.in
>> @@ -30,9 +30,6 @@ buildenv_functions+=('buildenv_debugflags')
>>
>> buildenv_debugflags() {
>> if check_option "debug" "y"; then
>> - DEBUG_CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> - DEBUG_CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> - DEBUG_RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> CFLAGS+=" $DEBUG_CFLAGS"
>> CXXFLAGS+=" $DEBUG_CXXFLAGS"
>> RUSTFLAGS+=" $DEBUG_RUSTFLAGS"
>> diff --git a/scripts/libmakepkg/buildenv/flags.sh.in b/scripts/libmakepkg/buildenv/flags.sh.in
>> new file mode 100644
>> index 00000000..d41556d3
>> --- /dev/null
>> +++ b/scripts/libmakepkg/buildenv/flags.sh.in
>> @@ -0,0 +1,34 @@
>> +#!/usr/bin/bash
>> +#
>> +# debugflags.sh - Specify default flags for building a package
>> +#
>> +# Copyright (c) 2012-2021 Pacman Development Team <pacman-dev at archlinux.org>
>> +#
>> +# 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
>> +# the Free Software Foundation; either version 2 of the License, or
>> +# (at your option) any later version.
>> +#
>> +# This program is distributed in the hope that it will be useful,
>> +# but WITHOUT ANY WARRANTY; without even the implied warranty of
>> +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
>> +# GNU General Public License for more details.
>> +#
>> +# You should have received a copy of the GNU General Public License
>> +# along with this program. If not, see <http://www.gnu.org/licenses/>.
>> +#
>> +
>> +[[ -n "$LIBMAKEPKG_BUILDENV_FLAGS_SH" ]] && return
>> +LIBMAKEPKG_BUILDENV_FLAGS_SH=1
>> +
>> +LIBRARY=${LIBRARY:-'@libmakepkgdir@'}
>> +
>> +source "$LIBRARY/util/option.sh"
>> +
>> +buildenv_functions+=('buildenv_flags')
>> +
>> +buildenv_flags() {
>> + CFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> + CXXFLAGS+=" -fdebug-prefix-map=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> + RUSTFLAGS+=" --remap-path-prefix=$srcdir=${DBGSRCDIR:-/usr/src/debug}"
>> +}
>> diff --git a/scripts/libmakepkg/buildenv/meson.build b/scripts/libmakepkg/buildenv/meson.build
>> index b72d91c0..a69accb7 100644
>> --- a/scripts/libmakepkg/buildenv/meson.build
>> +++ b/scripts/libmakepkg/buildenv/meson.build
>> @@ -4,6 +4,7 @@ sources = [
>> 'buildflags.sh.in',
>> 'compiler.sh.in',
>> 'debugflags.sh.in',
>> + 'flags.sh.in',
>> 'lto.sh.in',
>> 'makeflags.sh.in',
>> ]
>>
>
>
Rust emits some debugging info even in release mode. This info includes
the paths where the files were built. So you end up with
"WARNING: Package contains reference to $srcdir`". Plus if you're not
building in a chroot then the package will contain your homedir and
hence username which can be a privacy issue.
More information about the pacman-dev
mailing list