Commit Graph

221 Commits

Author SHA1 Message Date
David Abdurachmanov ea923090ec
Apply riscv64 fixes
Signed-off-by: David Abdurachmanov <davidlt@rivosinc.com>
2023-08-25 09:32:21 +03:00
Charalampos Stratakis 7331757cf1 Strip all extension builder flags except -fexceptions and -fcf-protection
This preserves binary compatibility with the main interpreters
the extensions are built against while removing Fedora's flags
that are not required to be inherited on user built extensions.

This implements https://fedoraproject.org/wiki/Changes/Python_Extension_Flags_Reduction
2023-08-04 12:58:12 +02:00
Florian Weimer f447520e2d Fix warnings that appear during the build of the llvm package
The package redefines %optflags on i686 and s390x, so the
%__build_for_lang_* macros are no longer expanded, triggering
a warning from RPM (“%__build_for_lang_any defined but not
used within scope”).  Clang warns about -Wno-complain-wrong-lang
with -Wall, so the warning option is suppressed for
"%toolchain" != "gcc".

Reported-by: Tulio Magno Quites Machado Filho <tuliom@ascii.art.br>
2023-07-07 13:58:33 +02:00
Florian Weimer 246107d5f6 Implement the %build_type_safety_c macro (#2218019)
The default remains at 0 (no change) until the corresponding Fedora
change proposal is accepted:

  <https://fedoraproject.org/wiki/Changes/GNUToolchainF39>
2023-07-05 14:28:21 +02:00
Florian Weimer 7692bbaf45 Filter out C, C++ build flags from Fortran build flags (#2177253)
And pave the way for future front-end-specific compiler flags.
2023-07-05 13:04:12 +02:00
Florian Weimer 77c5fc5b62 Fix typo in comment 2023-07-05 13:03:34 +02:00
Tom Stellard 76bd9dd983 Remove -fno-openmp-implicit-rpath from clang ldflags
This option was dropped from upstream.
2023-06-30 23:43:40 +00:00
Florian Weimer ee3d1273d6 Switch ELN to x86-64-v3
Fixes: https://github.com/fedora-eln/eln/issues/83
Co-Authored-By: Stephen Gallagher <sgallagh@redhat.com>
2023-03-09 14:19:20 +01:00
Maxwell G 16122a6127
%set_build_flags: unconditionally set RUSTFLAGS 2023-02-28 18:29:18 -06:00
Maxwell G 9fb7ec9c17 Include RUSTFLAGS in %set_build_flags
Resolves: https://bugzilla.redhat.com/2167183
2023-02-28 17:31:25 -06:00
Tom Stellard e0e0971163 Rename _pkg_extra_* macros to _distro_extra_* macros
The two intended uses cases for the _pkg_extra_* macros were to
make it easier for packagers to add new compile flags for use
with their package and also to make it easier to do distro wide
experiments with new flags.

However, it was pointed out on the mailing list[1] that you
can't satisfy both of these uses cases at the same time with
just one set of macros.  For example, if a packager uses
_pkg_extra_* macros to add flags specific to their own
package, then someone using _pkg_extra_* macros to
apply a new flag distro wide would override the package
specific flag.

I feel like the distro-wide use case is much more important,
so rather than create two sets of new flags, one for each use
case, I think it's best to rename the _pkg_extra_* macros
to _distro_extra_* and document that they are only meant
to be used for adding distro-wide flags and packagers should
not use this macro.

[1] https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/message/TOG5RHWPS3VYMM52HFGZOUJVRCGZ7VXB/
2023-02-28 15:26:26 +00:00
Tom Stellard 1988722cbb Add %pkg_extra_* macros
https://fedoraproject.org/wiki/Changes/RPMMacrosForBuildFlags
2023-02-07 14:31:38 +00:00
Tom Stellard 60ee618083 Make -flto=thin the default lto flag for clang
https://fedoraproject.org/wiki/Changes/LLVM-16
2023-01-17 00:58:07 +00:00
Siddhesh Poyarekar 1b98c06642 Consolidate the _FORTIFY_SOURCE switches
The double undefine was unnecessary and exposed a bug in ccache. Club
the undefine and define into a single -Wp instead, which works for all
redefinitions of _FORTIFY_SOURCE.
2023-01-16 11:04:09 -05:00
Miro Hrončok 6ef1a40e16 Don't use %[ ] expressions with %{undefined rhel}, it breaks macro opt evaluation
Fixes https://bugzilla.redhat.com/2160716
2023-01-13 16:51:21 +01:00
Stephen Gallagher 9e10bb665e
Disable frame pointers on ELN and RHEL
RHEL does not intend to enable frame pointers at this time, and any
change will be done so based on a variety of inputs including the data
from Fedora.  Disable them for ELN to set proper expectations.

Signed-off-by: Stephen Gallagher <sgallagh@redhat.com>
2023-01-12 10:36:47 -05:00
Davide Cavalca 9ce7719338 Set arch specific flags for frame pointers support 2023-01-05 08:00:20 -08:00
Davide Cavalca f080fb9562 Enable frame pointers by default 2023-01-05 07:59:43 -08:00
Miro Hrončok f1687dbc47 Set %source_date_epoch_from_changelog to 1
https://fedoraproject.org/wiki/Changes/ReproducibleBuildsClampMtimes
2023-01-04 12:33:55 +01:00
Siddhesh Poyarekar 4c05f3cfa2 Enable _FORTIFY_SOURCE=3 by default
Make the _FORTIFY_SOURCE flags configurable so that the command line is
not cluttered with _FORTIFY_SOURCE definitions and undefines.  Introduce
a %_fortify_level variable that a package may override by either
undefining or defining to a specific value.

Also bump the default value to 3, to implement the systemwide proposal
for Fedora 38:

https://fedoraproject.org/wiki/Changes/Add_FORTIFY_SOURCE%3D3_to_distribution_build_flags
2023-01-03 10:33:35 -05:00
Davide Cavalca 04a4350d3e Add conditional support for always including frame pointers
If `%_include_frame_pointers` is defined, add `-fno-omit-frame-pointer`
and `-mno-omit-leaf-frame-pointer` to the compiler flags to ensure frame
pointers are always included.

This is in preparation for
https://fedoraproject.org/wiki/Changes/fno-omit-frame-pointer
2022-12-28 13:12:39 -08:00
Florian Weimer f857d65cdd Add %_configure_use_runstatedir to disable --runstatedir 2022-12-10 13:39:25 +01:00
Florian Weimer 3e8695eaed Merge #217 `Set -g when building Vala applications` 2022-11-04 08:52:49 +00:00
Michael Catanzaro d0970582ad Set -g when building Vala applications
This requires the build system support VALAFLAGS. At least Meson and
Automake do.

Using -g is desired because it allows us to see Vala source files and
line numbers in backtraces when possible, falling back to generated C
code otherwise. Line numbers for generated C are almost always less
useful when debugging crashes.
2022-09-13 12:44:51 -05:00
Frederic Berat c0d29236fe macros: Add runstatedir option to configure
The %configure macro now uses the runstatedir option if available.
2022-08-30 15:40:38 +02:00
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