Commit Graph
6762 Commits
Author SHA1 Message Date
Sam James eb9d324cb4 toolchain.eclass: add TODO re flags for building deps in src_test
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-12 02:19:32 +01:00
Sam James efff53996b toolchain.eclass: drop filter-flags from src_test
This no longer does anything after the previous commit to use
custom variables for flags for tests.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-12 02:19:31 +01:00
Sam James 15ce82749d toolchain.eclass: don't pass user flags in src_test
This is obvious in hindsight. The flags we were passing *precisely because*
we wanted e.g. -Wno-format to be passed to every test also included
-O2 or whatever from the user's flags which breaks tests that may require
no optimisation and so on.

Instead of trying to filter out options in a whack-a-mole game, let's
introduce special GCC_TESTS_* *FLAGS variables which we append
the needed -Wno-* to (etc.) which users can also specify if they really want
or need to.

Note that this isn't as scary or as weird as it sounds. We were only
trying to jam these flags in **purely** to counteract some defaults
we set, these tests really aren't supposed to be run with arbitrary
flags stuck in, but a workaround we added started to introduce way
more than intended.

The torture tests are fine with being run with various optimisation flags
but the rest of the testesuite isn't.

This fixes 361c375864 and some of the
attempts afterwards, although not everything in those commits was bad.

Fixes: 361c375864
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-12 02:19:30 +01:00
Sam James 5ea011f3d6 toolchain.eclass: add comment re GCC_TEST_RUN_EXPENSIVE
Make clear it's not a typo as it comes from gcc's testsuite (could
look like an accidental 'TEST' instead of 'TESTS' like the eclassvars
we use for tests.)

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-12 02:19:29 +01:00
Sam James 1e38f02f41 toolchain.eclass: style tweak
For consistency.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-11 21:53:44 +01:00
Sam James af10cf7228 toolchain.eclass: disable multilib tests for now
... until validate_failures.py can handle them properly, to avoid
trashing our test manifests.

Bug: https://gcc.gnu.org/PR116260
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-10 18:23:49 +01:00
Fabian Groffen c7f5ca73dd eclass/toolchain-funcs: add support for Prefix targets
- support Darwin
- support arm64 (Apple Silicon) Darwin
- skip gen_usr_ldscript on Prefix targets

Signed-off-by: Fabian Groffen <grobian@gentoo.org>
2024-08-10 16:06:07 +02:00
Andrew Ammerlaan 5d6d7c6fba kernel-install.eclass: run depmod after compressing modules
(de)compressing modules changes the path of the module files so we need to
run depmod to ensure that tools such as modprobe/modinfo work.

Note that depmod is often, but *not* always, run by sys-kernel/installkernel.
Systemd installs a hook to do this, but there is no equivalent on openrc
systems. So instead just ensure that the tree of modules we install is
consistent here in the eclass.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-09 17:50:26 +02:00
Sam James c1d510a5f4 toolchain.eclass: tidy up src_test a bit more, another tweak
* Disable -fno-semantic-interposition for tests as ASAN + contract violation
  checks rely on it

* Consolidate the appends vs. filters

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-09 15:29:43 +01:00
Sam James 7136d821f9 Revert "toolchain.eclass: drop *_FOR_TARGET in src_test"
This reverts commit c87ab053be.

I think I was wrong. Gah.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-09 12:49:35 +01:00
Sam James c87ab053be toolchain.eclass: drop *_FOR_TARGET in src_test
We seem to fail way more tests like the gcov ones for this, I guess
it overrides the flags it adds somehow.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-09 12:38:00 +01:00
Sam James 45d958ad4e toolchain.eclass: filter more flags in src_test
* Drop diagnostic flags (colour, URLs) which may break tests
* Drop QA flags to check if *FLAGS are respected; not necessary for tests
and may confuse e.g. export checks (as with mesa).

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-09 09:55:35 +01:00
Sam James 63b01ff63d toolchain.eclass: add another TODO for tests wrt ABIs
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-09 09:55:35 +01:00
Michał Górny a37a72cc9b llvm.org.eclass: Add 20.0.0_pre20240808 snapshot
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-08 21:25:53 +02:00
Andrew Ammerlaan c75b6bf3c8 (dist-)kernel-{install,utils}.eclass: fix finding config during cleanup
The source symlink does not exist on all systems.

If we can't find any config at all then there will be no preferred suffix
which means we fall back to the old '-nt' based cleaning.

Closes: https://bugs.gentoo.org/937569
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/38016
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-08 18:44:27 +02:00
James Le Cuirot 5d7123c199 cargo.eclass: Fix cargo_target_dir helper following recent changes
We used to only set the Rust target when cross-compiling, but now we do
it unconditionally, which changes the target directory.

Closes: https://bugs.gentoo.org/937574
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-08-08 15:36:52 +01:00
Sam James 7200aecb3d toolchain.eclass: add -g for tests
I haven't looked closely yet but I think this is the same as the
binutils issue from before.

Bug: https://bugs.gentoo.org/934149
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-08 11:48:00 +01:00
Sam James d4c9853353 toolchain.eclass: try to silence remaining flag vs FE issues
This is the Fortran issue I mentioned in 6df9779287.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-08 11:29:39 +01:00
Sam James ec6893633b toolchain.eclass: add note re (intended) duplication of CFLAGS et. al
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-08 11:29:39 +01:00
Sam James 6df9779287 toolchain.eclass: more src_test flag fixes
We ended up not running many tests because it got interpreted as '--Werror'
with the braces/splitting (e.g. rust and such got skipped entirely).

With this change, we seem to be nearly there although we have issues
with Fortran tests that have C for interop because we get the unsupported
arg warnings...

Fixes: 5ca076594a
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-08 11:05:21 +01:00
James Le Cuirot 27d469a211 cargo.eclass: Change RUSTFLAGS approach following recent build failures
Cargo turned out to be even worse at handling flags than I thought.
Target-specific flags set by projects were overriding our own, and Cargo
was bailing out when faced with merging a string of flags with an array
of flags.

After weighing up the poor set of options, I've found that it is better
to always set flags via a target-specific environment variable for
reasons set out in comments added here. This approach was previously
just used for cross-compiling, but now we do it unconditionally.

It has the downside of overriding generic [build] flags set by projects,
but these were already being overridden by users and ebuilds setting
RUSTFLAGS themselves.

Closes: https://bugs.gentoo.org/937453
Closes: https://bugs.gentoo.org/937470
Signed-off-by: James Le Cuirot <chewi@gentoo.org>
2024-08-08 10:00:08 +01:00
Sam James 5ca076594a toolchain.eclass: another attempt at flag filtering for tests
The previous method ends up confusing D because those flags don't work
there...

Try passing *FLAGS into RUNTESTFLAGS this time, like in
https://gcc.gnu.org/wiki/Testing_GCC#Testing_a_different_target_from_the_current_host.

This reverts commit 7eab20a224 and
commit f66787897a.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-07 16:13:01 +01:00
Sam James 60bbe46138 toolchain.eclass: fix typos w/ RUNTESTFLAGS
Fixes: 7eab20a224
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-07 10:40:27 +01:00
Sam James cad8e1e7e0 toolchain.eclass: add link to upstream bug for manifests vs ABIs
Bug: https://gcc.gnu.org/PR116260
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-07 10:25:03 +01:00
Sam James 7eab20a224 toolchain.eclass: try harder to suppress -Wformat and friends
* Followup to f66787897a
* See https://inbox.sourceware.org/gcc-patches/87v80cn24t.fsf@gentoo.org/

Still not quite right though per link above.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-07 10:20:24 +01:00
Andrew Ammerlaan 03e930a67c eclass/tests/dist-kernel-utils.sh: add compressed_module_cleanup tests
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/37985
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-07 10:58:41 +02:00
Andrew Ammerlaan 91990a04b7 eclass/tests/tests-common.sh: add in_iuse function
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-07 10:58:40 +02:00
Andrew Ammerlaan 2073571d34 kernel-install.eclass: use dist-kernel_get_module_suffix to find compression
Adjusts kernel-install_compress_modules to use the new function
dist-kernel_get_module_suffix. This makes no functional difference
at the moment since gentoo-kernel-bin is the only consumer and it has
XZ compression in the config. Still this makes it possible to compile
alternate prebuilt kernels with alternate module compression support, and may
in the future help to support gzip and zstd module compression in
gentoo-kernel-bin.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-07 10:58:39 +02:00
Andrew Ammerlaan facd2865e4 dist-kernel-utils.eclass: fix module cleanup when using binpkgs
When installing a binpkg -nt is not a good check because the modules in the
binpkg we are installing may actually be older then what we have in root.

Instead introduce a new function dist-kernel_get_module_suffix to find the
desired compression based on USE=modules-sign and the kernel config. Then,
remove only those files that do not match our desired compression.

Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-07 10:58:35 +02:00
Piotr Kubaj 1a17266f16 rust-toolchain.eclass: add powerpc*musl support
Also adjust indentation.

[sam: Note that this is easier to review with `git diff -w`.]

Signed-off-by: Piotr Kubaj <pkubaj@anongoth.pl>
Closes: https://github.com/gentoo/gentoo/pull/35928
Signed-off-by: Sam James <sam@gentoo.org>
2024-08-07 04:03:18 +01:00
Volkmar W. Pogatzki 69065e361c java-vm-2.eclass: remove function set_java_env
Deprecated with commit 436dd062c on 2016-08-02

Signed-off-by: Volkmar W. Pogatzki <gentoo@pogatzki.net>
Closes: https://github.com/gentoo/gentoo/pull/37995
Signed-off-by: Florian Schmaus <flow@gentoo.org>
2024-08-06 18:39:29 +02:00
James Le Cuirot 83739e9677 distutils-r1.eclass: Support cross-compiling with PyO3
Only one variable needs to be set. For details, see
https://pyo3.rs/latest/building-and-distribution.html#cross-compiling.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/37708
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:15 +02:00
James Le Cuirot 068fd56ff5 python-utils-r1.eclass: Add python_get_stdlib helper function
This is just like python_get_sitedir, but it returns the stdlib
directory such as /usr/lib/python3.12. This is useful for locating the
sysconfigdata file.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:14 +02:00
James Le Cuirot 9b2def86a9 distutils-r1.eclass: Use cargo_env when appropriate for flag handling
cargo_env handles linker flags and enables cross-compiling. It also
handles LTO filtering, so we can remove that from this eclass.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:13 +02:00
James Le Cuirot 1792d3396d cargo.eclass: Shadow flag variables so that LTO filtering remains local
This is currently done for Cargo by distutils-r1.eclass. The next commit
will remove that code, leaving cargo_env responsible for it.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:12 +02:00
James Le Cuirot 7d7c516829 cargo.eclass: Explicitly tell rustc not to strip binaries
Most projects don't strip binaries in release mode by default, but there
are exceptions like app-misc/broot.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:11 +02:00
James Le Cuirot 9e9c222fe9 cargo.eclass: Handle LDFLAGS and RUSTFLAGS better
LDFLAGS are not currently honoured by Cargo builds at all. It would be
particularly advantageous to honour -fuse-ld because alternative linkers
like mold are known to be significantly faster at handling Rust.

As things stand, the eclass sets the linker to CC when cross-compiling,
but it does so erroneously due to a shell quoting issue. If CC includes
arguments, an error occurs when setting the CARGO_TARGET_*_LINKER
variable. Even with the right quoting, Cargo still fails because this
variable is not allowed to include arguments. They have to be specified
via RUSTFLAGS instead.

The build host linker is frequently invoked due to the use of build
scripts by some crates. We would therefore also like to configure the
build host linker properly when cross-compiling, but unfortunately there
is currently no way to do this without using a Rust nightly feature.

The build host linker is now configured in the cargo_gen_config function
because this configuration is static. Conversely, the target host linker
is configured with environment variables in the cargo_env function
because the target may change.

Some ebuilds already set RUSTFLAGS, so some consideration was given to
how to handle these. When set, Cargo prioritises RUSTFLAGS and similar
over specific configuration for the build and target hosts, so these
must be unset. We can still include their contents in that configuration
for convenience though. BUILD_RUSTFLAGS can be used by ebuilds to
set flags only for the build host.

It should not be necessary for ebuilds to figure out which Rust ABI is
applicable in order to set flags only for the target host, so the helper
reads from a simple TARGET_RUSTFLAGS variable without the triple for
convenience.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:11 +02:00
James Le Cuirot 11e91de664 cargo.eclass: Add cargo_env helper and use it in compile, test, install
Rust packages have a tendency to rebuild parts during test and install.
It is not clear whether this can be addressed. We were therefore relying
on some environment variables set during the compile phase for
cross-compiling to work in the later phases. This is not ideal,
especially if you need to build for multiple targets.

These environment variables can also be useful in other contexts, such
as the build runner in app-misc/anki.

This change moves the setting of these variables into a separate helper
that is now used in all these phases and can be used by ebuilds too. The
variables are now kept local to each invocation of this helper,
preventing leakage.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:10 +02:00
James Le Cuirot d57601effe cargo.eclass: Use newer Cargo config file name
"config" is deprecated and "config.toml" has been valid for ages.

Signed-off-by: James Le Cuirot <chewi@gentoo.org>
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:09 +02:00
Michał Górny 9b1ccc14f4 python-utils-r1.eclass: Add a sanity check for PYTHONPATH
Add a sanity check that ensures that PYTHONPATH does not contain any
relative paths.  While at it, also explicitly warn about PYTHONPATH
being set, so we know about it in build logs.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:30:08 +02:00
Michał Górny 9411d6eddb distutils-r1.eclass: Fix disabling DISTUTILS_ALLOW_WHEEL_REUSE
Fix the declaration of DISTUTILS_ALLOW_WHEEL_REUSE to allow disabling it
via setting the variable to an empty value in the environment.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:29:26 +02:00
Michał Górny 69190f6268 eclass/tests/toolchain-funcs.sh: Cover tc-has-64bit-time_t
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/37142
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:29:02 +02:00
Michał Górny 9c0708dcae toolchain-funcs.eclass: Add tc-has-64bit-time_t
Add a helper function to check whether time_t is 64-bit.  This could
be used e.g. to deselect tests that rely on timestamps exceeding Y2k38.
It is meant to be more future-proof than hardcoding a list of 32-bit
architectures, given the necessity of switching to 64-bit time_t
in the future.

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:29:01 +02:00
Michał Górny f14c9139aa eclass/tests/toolchain-funcs.sh: Cover tc-is-lto
Signed-off-by: Michał Górny <mgorny@gentoo.org>
Closes: https://github.com/gentoo/gentoo/pull/37976
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:28:53 +02:00
Michał Górny 625574f702 toolchain-funcs.eclass: Fix tc-is-lto not to leave stray files in T
Fix tc-is-lto function to remove the temporary file after testing.
Besides being cleaner, this fixes a permission problem when using
Paludis and tc-is-lto is used both in pkg_setup() (which creates
the temporary file owned by root) and src_*() phase (which attempts
to rewrite it as a regular user).

Thanks to negril for the report!

Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-06 10:28:53 +02:00
Sam James f66787897a toolchain.eclass: run tests for -m32 if multilib
TODO: Does this handle s390 (-m31) correctly?

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-06 02:45:08 +01:00
Sam James 361c375864 toolchain.eclass: use more conservative flags in src_test
For tests, we need to put some effort in to counteract our defaults
like -Wformat-security and -Wtrampolines (which we may want to revisit
at some point, but it is what it is for now).

Use a subshell so we can mangle the values within without affecting
the rest of the build.

I still get some failures with this (including some related to e.g.
-Wformat-security still) but far fewer, the flags don't get passed
everywhere so needs more poking or maybe just patching those tests
within the patch we use to change defaults.

See also the discussion on gcc-patches recently [0].

[0] https://inbox.sourceware.org/gcc-patches/ee9a8a6b11438f158933a21d7965b486987be5a8.1721454759.git.sam@gentoo.org/

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-04 09:26:41 +01:00
Andrew Ammerlaan 4fe379b989 kernel-install.eclass: fixup indentation
Signed-off-by: Andrew Ammerlaan <andrewammerlaan@gentoo.org>
2024-08-04 09:30:04 +02:00
Sam James e7e43ef530 toolchain.eclass: drop -fno-harden-control-flow-redundancy append
This confuses things if e.g. using GDC from older GCC. Not worth it given
I'd only added it for a personal experiment.

Signed-off-by: Sam James <sam@gentoo.org>
2024-08-04 08:27:04 +01:00
Michał Górny 4b2e118605 llvm.org.eclass: Remove 19.x snapshot support
Signed-off-by: Michał Górny <mgorny@gentoo.org>
2024-08-01 22:20:24 +02:00