> Ximin Luo:
>> However the question is, do we want to do this every time an upstream
>> saves CFLAGS somewhere?
> [...]
>> 2. Define another variable SOURCE_ROOT to be set to the top-level
>> source dir, and patch GCC to use this as the default value for
>> debug-prefix-map (and the analogue for other languages / tools).
>> This would have the same concrete behaviour as the current situation,
>> but then we're defining yet another variable... but probably less
>> tools will need to support this than SOURCE_DATE_EPOCH. And as with
>> (1), this would not be necessary for the path-is-namespace languages.
> This is to some extend already possible with with gcc (Thanks to guillem
> for the idea). Add '-specs /usr/.../rb.spec' to CFLAGS and then set
> inside the specs file debug-prefix-map based on an env var:
>   *cc1_options:
>   + -fdebug-prefix-map=%:getenv(SOURCE_ROOT =.)
> Unfortunately this is not that easy. The getenv function fails hard if
> the env var is not set. And since the build environment for Debian
> packages is mostly unconstrained there seems to be no way to guarantee
> that this variable is always set.

Well, we could have dpkg-buildflags also set SOURCE_ROOT somehow. A hacky 
strawman solution, is to patch:

1. dpkg-buildflags --export to also define SOURCE_ROOT
2. /usr/share/dpkg/buildflags.mk

Debhelper and CDBS should pull in SOURCE_ROOT automatically via (1), no changes 

However code search 
https://codesearch.debian.net/search?q=dpkg-buildflags+--get shows that many 
packages are doing custom things with specific flags, which we would probably 
break with the above approach. (Many of these results are also using debhelper 
but (a) it's unclear how this interacts with their custom flags and (b) I 
imagine quite a lot of them aren't using it.)

It would likely be easier/safer to just patch GCC directly.


GPG: ed25519/56034877E1F87C35
GPG: rsa4096/1318EFAC5FBBDBCE

Reproducible-builds mailing list

Reply via email to