Commit Graph

196 Commits

Author SHA1 Message Date
Dan Horák
bddb41760d move the baseline arch to z13 for s390x in F-38+
https://fedoraproject.org/wiki/Changes/z13BaselineForIBMZ
2022-08-26 16:07:02 +02:00
Timm Bäder
6024b1e611 Move llvm_compile_lto_to_elf before __debug_install_post
Resolves: https://bugzilla.redhat.com/show_bug.cgi?id=2082081
2022-06-22 12:56:17 +02:00
Nick Clifton
e7f471687c Add definition of _find_debuginfo_extra_opts which will move annobin data into a separate debuginfo file. 2022-06-17 11:33:00 +01:00
Tom Stellard
9a1b602bdb Move -fno-openmp-implicit-rpath option from CFLAGS to LDFLAGS
This option needs to be passed to the linker not the compiler.
2022-05-27 16:09:09 +00:00
Miro Hrončok
6cce360fd2 Remove a tab character from the definition of %__global_compiler_flags
From https://bugzilla.redhat.com/2083296:

> The issue is that some packages break up the flags at spaces,
> in order to look for specific flags or to add flags of their own.
>  The z3 package, for example, has some python code that does this:
>
>     def exec_cmd(cmd):
>         if isinstance(cmd, str):
>             cmd = cmd.split(' ')
>         ...
>
> The result is one of the commands in the list consists of a single tab character.
>  When that is passed to the compiler, the compiler does not like it at all.
2022-05-17 10:53:35 +02:00
Tom Stellard
0e07c90567 Add -fno-openmp-implicit-rpath when building with clang
This prevents clang from adding RUNPATH for libomp.so to binaries built
with -fopenmp.

https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild
2022-04-19 16:30:13 +00:00
Timm Bäder
ccc728db6d Add %__brp_remove_la_files to __os_install_post 2022-02-21 09:19:27 +01:00
Florian Weimer
00cb14aeb4 ppc64le: Switch baseline to POWER9 on ELN (ELN issue 78) 2022-02-10 16:35:07 +01:00
Florian Weimer
04be20e64b s390x: Switch baseline to z14 on ELN (ELN issue 79) 2022-02-10 12:08:15 +01:00
Robert-André Mauchin
31ad743a45 Add package note generation to check preamble Fix: rhbz#2043977
Packages which do not have %%build section but do also
compile and link test programs in %%check would fail because
no package note would have been generated.
2022-01-23 11:11:02 +01:00
Zbigniew Jędrzejewski-Szmek
ce70218eed Move package note generation to build preamble
We would try to regenerate the file whenever set_build_flags was used.
For packages which call %configure multiple times this would mean a
few times during build, and also in the build and check
preambles. Let's just simplify this and call it only in the build preamble.

https://src.fedoraproject.org/rpms/package-notes/pull-request/1
changes %_generate_package_note_file to be unconditional. This means we'll
always rewrite the file and will not use a stale version. (But the two
fixes are independent, even though they make the most sense together.)
2022-01-20 22:04:59 +01:00
Miro Hrončok
a87ba4ab1c Fix %set_build_flags when %_generate_package_note_file is not defined 2022-01-20 19:24:09 +01:00
Miro Hrončok
357f950c28 Remove package ELF note from the extension LDFLAGS
Related: https://bugzilla.redhat.com/2043092
2022-01-20 19:18:33 +01:00
Zbigniew Jędrzejewski-Szmek
57edf0cad7 Inject linker script to generate package notes
https://fedoraproject.org/wiki/Changes/Package_information_on_ELF_objects
Macros are used only if defined. Definitions are provided in the
package-notes-srpm-macros, which is now Required (on Fedora).
2022-01-17 09:20:00 +01:00
Tom Stellard
9183c1c8d4 Call %set_build_flags before %build, %check, and %install stages
https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck
2022-01-14 20:57:22 +00:00
Tom Stellard
95f28bd10b Add -Wl,--build-id=sha1 to the default LDFLAGS
This is already the default for ld.bfd, so this is effectively a no-op
for most packages.  However, lld defaults different build-id algorithm
that the RPM build process does not support, so it needs this flag.

This flag can be overriden by setting the %_build_id_flags macro,
which packages could do if they wanted to use a more secure build-id
algorithm.
2021-12-15 01:24:25 +00:00
Miro Hrončok
2f1ae3aa01 Revert "Add llvm-lto-elf-check script" to avoid a dependency on Python
This reverts commit ac2ca1dbba.
2021-11-16 22:28:14 +01:00
Florian Weimer
a9123ea1ac buildflags.md: Move toolchain selection documentation from macros file 2021-11-15 15:34:15 +01:00
David Benoit
ac2ca1dbba
Add llvm-lto-elf-check script
The brp-llvm-compile-lto-elf script uses PCRE in grep to match
for the -flto flag in bitcode object dumps, using negative
lookahead to exclude the case where -fno-lto is specified after.
When lines in the bitcode dump exceed the length that PCRE can
match against, grep will error out causing brp-llvm-compile-lto-elf
to fail.

This script implements an equivalent regex match in python to avoid
the limit in PCRE grep.

Resolves: rhbz#2017193
2021-11-08 11:52:34 -05:00
Florian Weimer
2dd8d4cbdf ELN: Enable -march=x86-64-v2 for Clang as well 2021-08-30 14:45:07 +02:00
Tom Stellard
3ec329b234 Add build_ prefix to cc, cxx, and cpp macros
RPM requires macros to be at least 3 characters, so we need to
rename the cc macro anyway and using the build_ prefix is consistent
with other macros like build_cflags.
2021-08-17 21:15:06 +00:00
Tom Stellard
73aefaaac7 Add cc, cxx, and cpp macros
These macros are being added as part of this Fedora change:
https://fedoraproject.org/wiki/Changes/CompilerPolicy
2021-08-16 16:41:58 +00:00
Florian Weimer
bc8fa85e90 Active GCC plugin during LTO linking
See the downstream bug for details:

  https://bugzilla.redhat.com/show_bug.cgi?id=1983727
2021-08-02 12:43:26 +02:00
Miro Hrončok
cfdc80c51a Require python-srpm-macros with Python related BuildRoot Policy scripts 2021-07-08 12:56:48 +02:00
Miro Hrončok
74e11b4fa8 Move Python related BuildRoot Policy scripts from redhat-rpm-config to python-srpm-macros
This allows us to maintain our own BuildRoot Policy scripts in an easier way.

This change needs to be coordinated with the addition of the files to python-srpm-macros.

redhat-rpm-config requires python-srpm-macros, so no significant change is expected for the packagers.

This also moves the Python BRPs to the end of the list which should be fine.
2021-07-08 12:56:15 +02:00
Ben Burton
fdce9c67af Adapt macros and BRP scripts for %topdir with spaces
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1947416
2021-06-28 11:33:07 +02:00
Panu Matilainen
def9a339d2 Drop reference to now extinct brp-python-hardlink script
The script was dropped in rpm 4.17.0 beta1, so we can't very well
try to use it on builds. For now I'm intentionally dropping just the
macro definition: in case the Python community wants to bring it
back, all they need to do is revive the script and add the macro
definition for it.
2021-06-22 15:57:21 +03:00
Charalampos Stratakis
139bc590fb Enable RPATH check after %install
Part of https://fedoraproject.org/wiki/Changes/Broken_RPATH_will_fail_rpmbuild

Resolves: rhbz#1964548
2021-05-31 17:39:22 +02:00
Arjun Shankar
b6b865f3d5 Disable annobin on armv7hl
On armv7hl, enabling annobin can in some cases lead to corrupt unwind
information in generated object files:
https://bugzilla.redhat.com/show_bug.cgi?id=1951492

The root-cause of this is still unclear and until this is sorted out,
it is best to disable annobin on the architecture.
2021-05-26 21:36:44 +02:00
Marek Marczykowski-Górecki
3d7758a2f0 Use _changelog_trimage instead of _changelog_trimtimeUpdate macros
_changelog_trimtime is deprecated in favor of _changelog_trimage.
Furthermore, _changelog_trimage is relative to the newest entry
instead of the build time - which helps with package reproducibility.
Details:
 - https://github.com/rpm-software-management/rpm/commit/a587258
 - https://bugzilla.redhat.com/1722806
2021-04-14 15:59:48 +00:00
David Benoit
391eca3508 add brp-llvm-compile-lto-elf 2021-04-06 21:25:50 -04:00
Florian Weimer
d8287391e7 Use -march=x86-64-v2 only for the gcc toolchain
LLVM 12 is required for -march=x86-64-v2.
2021-01-19 20:34:39 +01:00
Florian Weimer
0ce9e05ca9 x86_64: Enable -march=x86-64-v2 for ELN, following GCC. 2021-01-19 20:10:22 +01:00
Florian Weimer
5c9060a85e s390x: Tune for z14 (as in Red Hat Enterprise Linux 8) 2020-10-20 12:23:29 +02:00
Florian Weimer
6854161259 Fix another syntax issue in the macros file 2020-10-05 14:30:56 +02:00
Florian Weimer
e6fe6513ee Fix syntax error in macros file 2020-10-05 14:09:46 +02:00
Florian Weimer
9bbf519889 s390x: Switch Fedora ELN to z13 baseline
This matches Red Hat Enterprise Linux 8.  Reportedly, the Fedora
infrastructure is ready for this change.
2020-10-05 13:38:25 +02:00
Miro Hrončok
0d621460ce Filter out LTO flags from %%extension flags macros
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1877652
2020-09-11 20:42:36 +02:00
Tom Stellard
d698d04313
Add -flto to ldflags for clang toolchain
Also, add a gating CI tests to ensure that future macro changes work
with clang.
2020-08-20 19:03:54 +02:00
8a5ee87c50 Fix CC/CXX exports and allow overrides like CFLAGS and CXXFLAGS
Some packages require being able to redefine the compiler variables
set to add additional base arguments that must be used everywhere.
This change makes it possible for that to work correctly.
2020-08-20 08:45:21 -04:00
Jeff Law
4637e1bd55 - Use -flto=auto for GCC to speed up builds 2020-07-30 10:45:53 -06:00
Tom Stellard
06f1d527d7 Only use supported lto flags for clang toolchain 2020-07-28 02:16:26 +00:00
Jeff Law
5baaf4a99c Enable LTO by default 2020-07-21 21:38:41 -06:00
Lumir Balhar
5f32aac09e New opt-in possibility to fix byte-compilation reproducibility
A new script brp-fix-pyc-reproducibility creates an opt-in way of how to fix
problems with the reproducibility of byte-compiled Python files. The script
uses marshalparser [0] which currently doesn't provide solutions for all issues
but can fix at least problems with reference flags. For more info see
this Bugzilla [1].

If you want to use this new feature, you need to define
`%py_reproducible_pyc_path` to specify a path you want to fix `.pyc`
files in (recursively) and build-require /usr/bin/marshalparser.

if you forget to build-require the parser. The error message is:
```
+ /usr/lib/rpm/redhat/brp-python-bytecompile '' 1 0
Bytecompiling .py files below /builddir/build/BUILDROOT/tldr-0.5-2.fc33.x86_64/usr/lib/python3.9 using /usr/bin/python3.9
+ /usr/lib/rpm/redhat/brp-fix-pyc-reproducibility /builddir/build/BUILDROOT/tldr-0.5-2.fc33.x86_64
ERROR: If %py_reproducible_pyc_path is defined, you have to also BuildRequire: /usr/bin/marshalparser !
error: Bad exit status from /var/tmp/rpm-tmp.UUJr4v (%install)
```

A build fails if the parser is not able to parse any of the `.pyc` files.

And finally, if a build is properly configured it produces fixed `.pyc` files.

Currently, `.pyc` files in the tldr package contain a lot of unused reference flags:
```
$ dnf install -y tldr
$ marshalparser --unused /usr/lib/python3.9/site-packages/__pycache__/tldr.cpython-39.pyc
… long output …
190 - Flag_ref(byte=9610, type='TYPE_SHORT_ASCII_INTERNED', content=b'init', usages=0)
191 - Flag_ref(byte=9633, type='TYPE_SHORT_ASCII_INTERNED', content=b'source', usages=0)
192 - Flag_ref(byte=9651, type='TYPE_SHORT_ASCII_INTERNED', content=b'argv', usages=0)
193 - Flag_ref(byte=9657, type='TYPE_SHORT_ASCII_INTERNED', content=b'print_help', usages=0)
194 - Flag_ref(byte=9669, type='TYPE_SHORT_ASCII_INTERNED', content=b'stderr', usages=0)
195 - Flag_ref(byte=9682, type='TYPE_SHORT_ASCII_INTERNED', content=b'parse_args', usages=0)
196 - Flag_ref(byte=9737, type='TYPE_SHORT_ASCII_INTERNED', content=b'encode', usages=0)
197 - Flag_ref(byte=9782, type='TYPE_SHORT_ASCII_INTERNED', content=b'parser', usages=0)
198 - Flag_ref(byte=9790, type='TYPE_SHORT_ASCII_INTERNED', content=b'options', usages=0)
199 - Flag_ref(byte=9799, type='TYPE_SHORT_ASCII_INTERNED', content=b'rest', usages=0)
200 - Flag_ref(byte=9821, type='TYPE_SHORT_ASCII_INTERNED', content=b'result', usages=0)
202 - Flag_ref(byte=10022, type='TYPE_SHORT_ASCII_INTERNED', content=b'__main__', usages=0)
203 - Flag_ref(byte=10102, type='TYPE_SHORT_ASCII_INTERNED', content=b'argparse', usages=0)
204 - Flag_ref(byte=10433, type='TYPE_SHORT_ASCII_INTERNED', content=b'__name__', usages=0)
205 - Flag_ref(byte=10463, type='TYPE_SHORT_ASCII_INTERNED', content=b'<module>', usages=0)
```

This new feature fixes them:

```
$ marshalparser --unused /usr/lib/python3.9/site-packages/__pycache__/tldr.cpython-39.pyc
<empty output>
```

[0] https://github.com/fedora-python/marshalparser
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1686078
2020-07-21 11:42:54 +00:00
Miro Hrončok
e453b585b4 Drop double newline 2020-07-21 13:42:29 +02:00
Lumir Balhar
ecf9fd3bdb No more automagic Python bytecompilation (phase 3) 2020-06-15 16:20:05 +02:00
Igor Raits
2c5594c9af
Fix broken %configure
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-04 03:14:15 +02:00
Igor Raits
5d8c70518a
Cleanup unused CCC_OVERRIDE_OPTIONS
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-03 21:41:23 +02:00
Igor Raits
7562b38ec5
Add support for selecting a clang as a toolchain
Signed-off-by: Igor Raits <ignatenkobrain@fedoraproject.org>
2020-06-03 21:30:21 +02:00
Jeff Law
891c721814 Latest version of sed fixes for broken/compromised configure macros 2020-05-30 13:21:08 -06:00