Commit Graph

725 Commits

Author SHA1 Message Date
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
Zbigniew Jędrzejewski-Szmek
30e7d26cb4 Do ELF package notes also on ELN
I assume that this is the right conditional, and RHEL has a different
version of this package.

For https://bugzilla.redhat.com/show_bug.cgi?id=2043166.
2022-01-20 22:04:59 +01:00
Zbigniew Jędrzejewski-Szmek
68d400e374 docs: add more quoting
Also some minor grammar fixups and "s/link editor/linker/" when
talking about ld.
2022-01-20 22:04:59 +01:00
Zbigniew Jędrzejewski-Szmek
38fc865990 ELF notes: rework the description of disabling
I changed the definitions in package-notes to not do anything if
%_package_note_file is undefined. The other macros won't work if it is
not defined anyway, so this is quite natural. With this, undefining
%_package_note_file becomes the most comprehensive mechanism to disable
the feature. (Undefining %_package_note_flags still works so backwards
compat is preserved.)

The new mechanism will work once
https://src.fedoraproject.org/rpms/package-notes/pull-request/1 is merged.
But I don't think it is necessary to add a version requirement here, since
we're only providing the docs here.
2022-01-20 22:03:18 +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
Zbigniew Jędrzejewski-Szmek
bc87a0d123 test/gcc-fedora-flags: modernize quoting 2022-01-13 14:05:59 +01:00
Zbigniew Jędrzejewski-Szmek
0732587e7b Change %define to %global
The packaging guidelines say that %global should is preferred.
2022-01-13 14:05:59 +01:00
Zbigniew Jędrzejewski-Szmek
1aa0c42cd3 buildflags: use consistent indentation and other minor fixes 2022-01-13 14:05:59 +01: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
faf5c36887 brp-mangle-shebangs: also mangle shebangs of JavaScript executables
Fixes https://bugzilla.redhat.com/show_bug.cgi?id=1998924

Unfortunately, the MIME type of JavaScript executables is not text/... but
application/javascript. See RFC 4329.

After considering various approaches to fix this problem, including:

 1) limiting the number of characters `file` reads
 2) using `eu-elfclassify` instead of `file`

This seems like the most sensible approach to fix this one particular problem.
If more instances are found problematic in the future, we'll keep adding the
MIME types.

See the linked bugzilla, the eu-elfclassify pull request [1],
and the devel mailing list thread [2] for details about this problem and
the considered solutions.

[1]: https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/145
[2]: https://lists.fedoraproject.org/archives/list/devel@lists.fedoraproject.org/thread/K3QCBUXYR6ZA34I777X6F2RYJKKECJLM/
2021-12-08 15:19:35 +00:00
Florian Weimer
d1702bd08e buildflags.md: Fix formatting issue in %build_fflags documentation 2021-12-07 21:25:40 +01:00
Miro Hrončok
e682ecf67c Revert "Temporary rpmlint config to ignore problems in soon to be removed kernel-rpm-macros"
This reverts commit 410499b1e006feaaf39fbc0c8ef040f8d2c7267f.
2021-11-18 20:04:18 +01:00
Michal Domonkos
0003cc2879 Drop kmod.attr
Also move this file to kernel-srpm-macros.  Note that we need to require
a new kernel-srpm-macros release now, since that's where kmod.attr is
going to end up.
2021-11-18 20:04:18 +01:00
Michal Domonkos
f2493e3700 Drop kernel-rpm-macros subpackage (new home: kernel-srpm-macros)
This has been done in CentOS Stream already:
https://gitlab.com/redhat/centos-stream/rpms/redhat-rpm-config/-/merge_requests/3
2021-11-18 19:57:55 +01: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
Miro Hrončok
f895eeaa56 Fedora CI: Test that no unexpected dependency was added 2021-11-16 19:37:24 +01:00
Miro Hrončok
09b13a3ec4 Temporary rpmlint config to ignore problems in soon to be removed kernel-rpm-macros 2021-11-16 18:02:02 +00:00
Florian Weimer
aee37a70c1 buildflags.md: Document source tree patching during %configure 2021-11-16 17:43:36 +01:00
Florian Weimer
69360e1d57 buildflags.md: Fix typo introduced in commit 65028a4d 2021-11-16 17:12:32 +01:00
Florian Weimer
f33780a5e7 buildflags.md: Fix typos introduce in commit a3cf0d66 2021-11-16 17:05:39 +01:00
Florian Weimer
ff647eda53 buildflags.md: Document the post-processing on ELF files 2021-11-16 14:51:13 +01:00
Florian Weimer
65028a4d00 buildflags.md: Document -fasynchronous-unwind-tables as generic option
And mention it is disabled on armhfp.
2021-11-15 15:59:36 +01:00
Florian Weimer
23e5f0dbd6 buildflags.md: Mentioned that annobin is only on for gcc, !armhpf 2021-11-15 15:58:09 +01:00
Florian Weimer
a3cf0d66a7 buildflags.md: Treat -fstack-clash-protection as a generic flag
And mention the two exceptions (armhfp, and for clang, aarch64).
2021-11-15 15:51:29 +01:00
Florian Weimer
f824dc72a1 buildflags.md: Document LTO and how to disable it 2021-11-15 15:44:56 +01:00
Florian Weimer
4a0c38832e buildflags.md: Document build_cc, build_cxx, build_cpp 2021-11-15 15:34:32 +01:00
Florian Weimer
a9123ea1ac buildflags.md: Move toolchain selection documentation from macros file 2021-11-15 15:34:15 +01:00
Florian Weimer
ac57cc99aa buildflags.md: Mention optional -fcommon under compiler flags 2021-11-15 15:26:05 +01:00
Florian Weimer
92959df563 buildflags.md: Document _ld_as_needed, --as-needed 2021-11-15 15:25:49 +01:00
Florian Weimer
76114fa60e buildflags.md: Document -mbranch-protection=standard for aarch64 2021-11-15 12:32:38 +01:00
Florian Weimer
92261d7c20 buildflags.md: Drop mentions of ppc64
The ppc64 architecture is no longer built.
2021-11-15 12:31:16 +01:00
Ville Skyttä
8a2e388e10 dist.sh: use grep -E instead of egrep
`egrep` has been deprecated in GNU grep since 2007, and in current
post 3.7 Git it has been made to emit obsolescence warnings:
https://git.savannah.gnu.org/cgit/grep.git/commit/?id=a9515624709865d480e3142fd959bccd1c9372d1
2021-11-13 15:16:45 +02:00
Michal Domonkos
cf47bde9b6 Drop {fpc,gnat,nim}-srpm-macros deps on RHEL
We did this in RHEL-8 [1] so let's not re-introduce the packages in RHEL-9.

Previously, we did that by keeping a downstream-only patch - let's just
have a conditional here, to make the maintenance simpler.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=1588575
2021-11-09 15:27:54 -06: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
Jason Tibbitts
804722591a Release and changelog. 2021-11-01 16:49:51 -05:00
Jason Tibbitts
4cf75bdaf9 Add better error checking to %constrain_build 2021-11-01 16:35:33 -05:00
Jason Tibbitts
4a171cb3bf Release and changelog entry 2021-10-19 20:11:39 -05:00
Jason Tibbitts
9131051920 Add %constrain_build macro
Adds a simple macro which limits the CPU count which is used in the
various build-related macro.  Using this macro at the beginning of the
specfile to limit the CPU count directly, or to set the CPU count based
on the amount of memory in the system and a "job size".

The default action if no options are provided is to limit builds to a
single CPU.
2021-10-19 20:11:39 -05:00
Miro Hrončok
71f61e78a9 CI: Rebuild redhat-rpm-config to assert we did not break the world 2021-10-19 22:54:13 +00:00
Tom Stellard
17a3cd024b Drop annobin-plugin-clang dependency
The annobin clang plugin is not actually used anywhere, so we don't
need to have a dependency on it.

This was also creating a circular dependency that was blocking the
latest clang update.
2021-09-21 18:23:33 +00: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
Michel Alexandre Salim
43dfe7d6f0 Fix macros.build-constraints' %limit_build
number of CPUs will never be set to less than 1
  this now outputs build flag overrides to be used with %make_build etc.
  add documentation

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2021-08-15 13:39:55 -07: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
Michel Alexandre Salim
dbb1278523 Add macros.build-constraints
Keep the misc macros in alphabetical order

Signed-off-by: Michel Alexandre Salim <salimma@fedoraproject.org>
2021-07-24 14:58:08 -07:00
e0cfcc0fc7 Make vpath builddir not include arch-specific info
A number of cases have cropped up where things like documentation
builds fail with out of tree builds because tools like Doxygen like
encoding the build path into the documentation metadata.

This causes failures in Koji and other places where noarch documentation
subpackages from archful packages fail because they fail the comparison
check due to this.
2021-07-10 09:43:26 -04:00