OBS adding systemwide %optflags and %build_ldflags


Is there an option for systemwide custom %optflags and %build_ldflags similar to that of .rpmmacros?

I wish to add these flags:

%optflags: -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection

%build_ldflags: -Wl,-z,relro  -Wl,-z,now

[FONT=monospace]%bcond_with hardened_build[/FONT]

Please help.

That’s what project config is for.


You can add global project config in your home: or ones inside your sub projects.

Thank you.