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

gettext: 0.21.1 -> 0.22.4 #279197

Merged
merged 4 commits into from
Nov 8, 2024
Merged

gettext: 0.21.1 -> 0.22.4 #279197

merged 4 commits into from
Nov 8, 2024

Conversation

wegank
Copy link
Member

@wegank wegank commented Jan 6, 2024

Description of changes

https://savannah.gnu.org/news/?group=gettext

On Linux, gettext requires a working iconv, which breaks the build of xgcc in stage1.5. A workaround is to pass --disable-nls to the derivation of xgcc, then build gettext again in stage3, where a fresh glibc has been built.

Things done

  • Built on platform(s)
    • x86_64-linux
    • aarch64-linux
    • x86_64-darwin
    • aarch64-darwin
  • For non-Linux: Is sandboxing enabled in nix.conf? (See Nix manual)
    • sandbox = relaxed
    • sandbox = true
  • Tested, as applicable:
  • Tested compilation of all packages that depend on this change using nix-shell -p nixpkgs-review --run "nixpkgs-review rev HEAD". Note: all changes have to be committed, also see nixpkgs-review usage
  • Tested basic functionality of all binary files (usually in ./result/bin/)
  • 24.05 Release Notes (or backporting 23.05 and 23.11 Release notes)
    • (Package updates) Added a release notes entry if the change is major or breaking
    • (Module updates) Added a release notes entry if the change is significant
    • (Module addition) Added a release notes entry if adding a new NixOS module
  • Fits CONTRIBUTING.md.

Add a 👍 reaction to pull requests you find important.

@wegank wegank mentioned this pull request Jan 6, 2024
12 tasks
@wegank
Copy link
Member Author

wegank commented Jan 6, 2024

@ofborg build gettext gettext.passthru.tests

@wegank

This comment was marked as resolved.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Jan 6, 2024
@wegank wegank force-pushed the gettext-bump-2 branch 2 times, most recently from 27182c2 to 28067b0 Compare January 6, 2024 23:20
@ofborg ofborg bot added 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux-stdenv This PR causes stdenv to rebuild labels Jan 6, 2024
@ofborg ofborg bot requested review from zimbatm and vrthra January 6, 2024 23:44
@wegank wegank force-pushed the gettext-bump-2 branch 3 times, most recently from 5cc404d to 70f6bab Compare January 7, 2024 15:58
@wegank wegank marked this pull request as ready for review January 8, 2024 20:57
@wegank wegank mentioned this pull request Jan 10, 2024
13 tasks
@wegank wegank force-pushed the gettext-bump-2 branch 2 times, most recently from ee48bd5 to a1e9b35 Compare January 13, 2024 17:18
@reckenrode
Copy link
Contributor

It looks like it’s going to require Darwin bootstrap changes to have gettext use CoreServices. I made some progress tonight, but I’ll need to work on it some more tomorrow.

@reckenrode
Copy link
Contributor

The following patch allows the Darwin stdenv to eval. I’ll kick off a build overnight, but I wanted to post it for feedback.

The patch breaks the infinite recursion by conditionally linking CoreServices. Early in the bootstrap, CoreServices is not linked. This should be safe because the set of programs is finite. We don’t have to worry about accidentally linking gettext against something that will crash (such as aria2, which motivated the change). At the end of the bootstrap when everything is rebuilt against the final libraries, gettext is linked against CoreServices from a previous stage. That should be safe to do because CoreServices is a system framework.

diff --git a/pkgs/development/libraries/gettext/default.nix b/pkgs/development/libraries/gettext/default.nix
index 4f81df001cc0..906edc0b446e 100644
--- a/pkgs/development/libraries/gettext/default.nix
+++ b/pkgs/development/libraries/gettext/default.nix
@@ -1,4 +1,4 @@
-{ stdenv, lib, fetchurl, libiconv, xz, bash
+{ stdenv, lib, fetchurl, libiconv, xz, bash, darwin
 }:
 
 # Note: this package is used for bootstrapping fetchurl, and thus
@@ -19,6 +19,7 @@ stdenv.mkDerivation rec {
     # fix reproducibile output, in particular in the grub2 build
     # https://savannah.gnu.org/bugs/index.php?59658
     ./0001-msginit-Do-not-use-POT-Creation-Date.patch
+  ] ++ lib.optionals (darwin.apple_sdk.frameworks.CoreServices == null) [
     # prevent infinite recursion for the darwin stdenv
     ./0002-Revert-Avoid-crash-on-macOS-14.patch
   ];
@@ -62,6 +63,9 @@ stdenv.mkDerivation rec {
   ++ lib.optionals (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) [
     # HACK, see #10874 (and 14664)
     libiconv
+  ]
+  ++ lib.optionals (stdenv.isDarwin && darwin.apple_sdk.frameworks.CoreServices != null) [
+    darwin.apple_sdk.frameworks.CoreServices
   ];
 
   setupHooks = [
diff --git a/pkgs/stdenv/darwin/default.nix b/pkgs/stdenv/darwin/default.nix
index c94c56daae1c..b4b0cdf3e7a0 100644
--- a/pkgs/stdenv/darwin/default.nix
+++ b/pkgs/stdenv/darwin/default.nix
@@ -452,6 +452,9 @@ in
 
       curl = super.curlMinimal;
 
+      # Don’t link CoreServices during the bootstrap to prevent an infinite recursion.
+      gettext = super.gettext.override { darwin.apple_sdk.frameworks.CoreServices = null; };
+
       # Disable tests because they use dejagnu, which fails to run.
       libffi = super.libffi.override { doCheck = false; };
 
@@ -1082,6 +1085,13 @@ in
         inherit (prevStage) fetchurl;
       };
 
+      # Use CoreServices from the previous stage to avoid an infinite recursion.
+      gettext = super.gettext.override {
+        darwin.apple_sdk.frameworks = {
+          inherit (prevStage.darwin.apple_sdk.frameworks) CoreServices;
+        };
+      };
+
       libyaml = super.libyaml.override {
         inherit (prevStage) fetchFromGitHub;
       };

@reckenrode
Copy link
Contributor

It took longer than expected, but I can confirm I was able to bootstrap the Darwin stdenv with the above patch on both aarch64- and x86_64-darwin.

$ ./result-aarch64/bin/gettext --version
gettext (GNU gettext-runtime) 0.22.4
Copyright (C) 1995-2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <https://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Ulrich Drepper.
$ otool -L ./result-aarch64/bin/gettext
./result-aarch64/bin/gettext:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1770.255.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 1122.11.0)
	/nix/store/k36qfqm8qplpp7ay8q7kq3yi17jfb4bk-gettext-0.22.4/lib/libintl.8.dylib (compatibility version 13.0.0, current version 13.0.0)
	/nix/store/nz4fff34byj1jjy1hka717rhpi7ma2i9-libiconv-50/lib/libiconv.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.60.1)
$  otool -L ./result-x86_64/bin/gettext
./result-x86_64/bin/gettext:
	/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation (compatibility version 150.0.0, current version 1349.8.0)
	/System/Library/Frameworks/CoreServices.framework/Versions/A/CoreServices (compatibility version 1.0.0, current version 775.19.0)
	/nix/store/c8ajzwdwr3drjjri6cyd2jx9prd5jy0v-gettext-0.22.4/lib/libintl.8.dylib (compatibility version 13.0.0, current version 13.0.0)
	/nix/store/jbbxab2nl7hs56rxlr16a64ik1rcm8sn-libiconv-50/lib/libiconv.dylib (compatibility version 7.0.0, current version 7.0.0)
	/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1238.60.2)

@AndersonTorres AndersonTorres mentioned this pull request Mar 28, 2024
13 tasks
@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label Apr 5, 2024
@wegank wegank marked this pull request as draft April 13, 2024 15:41
@ofborg ofborg bot removed the 2.status: merge conflict This PR has merge conflicts with the target branch label Jul 16, 2024
@emilazy
Copy link
Member

emilazy commented Nov 8, 2024

@wegank Are you okay for this to be undrafted and merged (either into staging or into llvm-19 for #354107)?

@wegank wegank marked this pull request as ready for review November 8, 2024 18:49
@wegank
Copy link
Member Author

wegank commented Nov 8, 2024

I haven't tested on x86_64-darwin, but feel free to take the commits.

@emilazy
Copy link
Member

emilazy commented Nov 8, 2024

I’ll merge into llvm-19 to minimize risk, since we’ve been doing a lot of Darwin testing there and this would unblock our progress on the bump. Thank you!

@emilazy emilazy changed the base branch from staging to llvm-19 November 8, 2024 18:52
@nix-owners
Copy link

nix-owners bot commented Nov 8, 2024

The PR's base branch is set to llvm-19, but 49 commits from the haskell-updates branch are included. Make sure you know the right base branch for your changes, then:

  • If the changes should go to the haskell-updates branch, change the base branch to haskell-updates
  • If the changes should go to the llvm-19 branch, rebase your PR onto the merge base with the llvm-19 branch:
    # git rebase --onto $(git merge-base upstream/llvm-19 HEAD) $(git merge-base upstream/haskell-updates HEAD)
    git rebase --onto cb98ce38637f70d83a0642647be9141a9e1cb088 c6f1ef99d134c51556cf01db04d33074ebbbf43c
    git push --force-with-lease

@emilazy emilazy merged commit 3f2008c into NixOS:llvm-19 Nov 8, 2024
36 of 40 checks passed
@wegank wegank deleted the gettext-bump-2 branch November 8, 2024 22:41
emilazy added a commit that referenced this pull request Nov 10, 2024
emilazy added a commit that referenced this pull request Nov 10, 2024
emilazy added a commit to emilazy/nixpkgs that referenced this pull request Nov 16, 2024
emilazy added a commit to emilazy/nixpkgs that referenced this pull request Nov 17, 2024
emilazy added a commit that referenced this pull request Nov 17, 2024
emilazy added a commit to emilazy/nixpkgs that referenced this pull request Nov 18, 2024
emilazy added a commit that referenced this pull request Nov 18, 2024
emilazy added a commit that referenced this pull request Nov 18, 2024
emilazy added a commit that referenced this pull request Nov 18, 2024
emilazy added a commit that referenced this pull request Nov 20, 2024
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.

3 participants