Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

gcc: deduplicate version expressions #249707

Merged
21 commits merged into from Aug 21, 2023
Merged

gcc: deduplicate version expressions #249707

21 commits merged into from Aug 21, 2023

Conversation

ghost
Copy link

@ghost ghost commented Aug 17, 2023

Description of changes

This PR combines our 10 copy-pasted-but-slightly-different gcc expressions into a single Nix expression which uses conditionals where necessary. It reduces the size of our GCC expression by 64% -- from over 5,000 lines of Nix code to under 2,000.

Prior to this PR, making any kind of change uniformly across all versions of GCC was either impossible or extremely error-prone.

This (mostly) completes the work begun in #243607

This PR causes no change in eval -- all gcc packages have the same drvPath after it as they did before:

$ nix-instantiate . -A gcc48 -A gcc49 -A gcc6 -A gcc7 -A gcc8 -A gcc9 -A gcc10 -A gcc11 -A gcc12 -A gcc13
/nix/store/1y7jfw7siqlkz6lnjgl20y54q1bm4v9j-gcc-wrapper-4.8.5.drv
/nix/store/sz8pywyyxxdl42l3pd8kj3wyzfwpr1fm-gcc-wrapper-4.9.4.drv
/nix/store/3q7k9c694c8bcdpdiq4q8z64cr7xjv3d-gcc-wrapper-6.5.0.drv
/nix/store/dbdn4fy29bb86wpm7xsbjsvy27fi7byz-gcc-wrapper-7.5.0.drv
/nix/store/qcih34x7kvs3w0njfmc8k7f9i0hl3fnz-gcc-wrapper-8.5.0.drv
/nix/store/w98c0lzlc774sny2f9ff477mwa3zk4f4-gcc-wrapper-9.5.0.drv
/nix/store/cvq5ghz01az3kl5i7bb2nmiia23ayy16-gcc-wrapper-10.5.0.drv
/nix/store/4b3w1l9fx1398w8m1nwq5p89ri519yqw-gcc-wrapper-11.4.0.drv
/nix/store/bcgvf0frnxj0qxhi04f0f13dkd9naxk7-gcc-wrapper-12.3.0.drv
/nix/store/n3k4pmvv9079j91w9b5slr3nicc6fdlw-gcc-wrapper-13.2.0.drv

The patches/default.nix expression is more complicated than necessary because it preserves the order of the patches exactly. A follow-up PR will greatly simplify that file, but that follow-up PR won't preserve drvPaths like this one does. Likewise, the fixing the GLIBC_DYNAMIC_LINKER... part of postPatch will be made massively simpler by not worrying about keeping all the whitespace exactly the same.

Things done

@ghost
Copy link
Author

ghost commented Aug 21, 2023

Rebased.

The last merge of staging into master caused a really nasty merge conflict here.

Since this is strictly cleanup (no change after eval), in order to prevent that from happening again I am going to merge this to both master and staging once ofborg goes green. It's much easier to rebase other patches past this one than it is to rebase this one past other patches.

@ghost ghost mentioned this pull request Aug 21, 2023
12 tasks
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Aug 21, 2023
@ghost ghost mentioned this pull request Aug 21, 2023
12 tasks
@ghost
Copy link
Author

ghost commented Aug 21, 2023

The patches/default.nix expression is more complicated than necessary because it preserves the order of the patches exactly. A follow-up PR will greatly simplify that file, but that follow-up PR won't preserve drvPaths like this one does.

Found here:

@ghost
Copy link
Author

ghost commented Aug 21, 2023

Likewise, the fixing the GLIBC_DYNAMIC_LINKER... part of postPatch will be made massively simpler by not worrying about keeping all the whitespace exactly the same.

Found here:

@ghost
Copy link
Author

ghost commented Aug 21, 2023

The last merge of staging into master caused a really nasty merge conflict here.

Since this is strictly cleanup (no change after eval), in order to prevent that from happening again I am merging this to both master and staging. It's much easier to rebase other patches past this one than it is to rebase this one past other patches.

@ghost ghost merged commit e61c8da into NixOS:master Aug 21, 2023
@ghost ghost deleted the pr/gcc/deduplicate branch August 21, 2023 09:17
@ghost ghost linked an issue Aug 21, 2023 that may be closed by this pull request
AndersonTorres pushed a commit that referenced this pull request Sep 11, 2023
This PR sorts the huge pile of patches and deduplicates it.  Unlike
its predecessors #249707 and
#250489 this commit *does*
affect eval.

Patches below are organized into three general categories:

1. Patches relevant to gcc>=12 on every platform
2. Patches relevant to gcc>=12 on specific platforms
3. Patches relevant only to gcc<12, sorted by the newest version to
   which they might be relevant
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

our gcc-unwrapped expression is illegible
0 participants