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: adopt and update #299647

Closed
wants to merge 13 commits into from
Closed

gettext: adopt and update #299647

wants to merge 13 commits into from

Conversation

AndersonTorres
Copy link
Member

Description of changes

Picking the work from Wegank at #279197

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.

@github-actions github-actions bot added the 6.topic: stdenv Standard environment label Mar 28, 2024
- finalAttrs design pattern
- reword comment
- use lib.* functions
- put LDFLAGS under env
- get rid of nested with in meta
- set meta.mainProgram
- remmove vrthra and add AndersonTorres as maintainer
Controlled by enableLibiconv (default as (!stdenv.isLinux &&
!stdenv.hostPlatform.isCygwin)).
"Canonicalizing" them to be read in ASCIIbetical order.
Drop CoreServices in order to avoid infinite recursion.
Removing the assumption it was built with iconv support.
@AndersonTorres
Copy link
Member Author

@ofborg build pkgsMusl.gettext

enableParallelChecking = false; # fails sometimes

setupHooks = [
../../../build-support/setup-hooks/role.bash
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like it won't pass the by-name check.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am cogitating to write a dummy package that installs those scripts at Nix Store.

@AndersonTorres
Copy link
Member Author

@infinisil apologies in advance.

I am collecting some work on updates at gettext.
One of the restrictions of this new by-name hierarchy is that the package is self-contained.

However, this expression requires a file from build-support/setup-hooks/, namely role.bash

The easy and dirty solution is make a copy of this file.

I am thinking about creating a Nix package that installs all these build-support/setup-hooks/ in the Nix Store so that it can be retrieved by Nix expressions like ${nix-setup-hooks}/share/setup-hooks/role.bash.
What do you think?

@infinisil
Copy link
Member

infinisil commented Mar 30, 2024

I wouldn't put all the setup hooks in a single derivation. There's already various derivations defining specific setup hooks, I'd follow that pattern. By putting them in separate derivations, you can add them to e.g. nativeBuildInput, and they'll get run automatically. Otherwise this sounds good to me!

I'm very glad to see this being improved, this is exactly the sort of thing the self-contained restriction of pkgs/by-name is for :D

@wegank wegank added the 2.status: merge conflict This PR has merge conflicts with the target branch label May 3, 2024
@reckenrode
Copy link
Contributor

reckenrode commented May 6, 2024

I’m pretty sure this will be needed for the clang 18 update on Darwin. The current version of gettext is replacing m4/extern-inline.m4 from gnulib with a version from 2013 that doesn’t work with clang 18. According to recent changelogs, gettext has fixed for building on macOS. Hopefully that’s referring to the issue I’m encountering with GNU stuff and clang 18.

@Sigmanificient Sigmanificient added the 0.kind: package adoption Requests or PRs for adopting packages that have no maintainers label May 10, 2024
Comment on lines +34 to +38
]
++ lib.optionals enableCoreServices [
# prevent infinite recursion for the darwin stdenv
./003-revert-avoid-crash-on-macos-14.patch
];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
]
++ lib.optionals enableCoreServices [
# prevent infinite recursion for the darwin stdenv
./003-revert-avoid-crash-on-macos-14.patch
];
];
propagatedBuildInputs = lib.optionals enableCoreServices [
# prevent infinite recursion for the darwin stdenv
./003-revert-avoid-crash-on-macos-14.patch
];

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When autoreconfPhase is run with the new gettext, m4/intlmacosx.m4 is updated, adding CoreServices as a dependency of the original package.

Copy link
Contributor

@reckenrode reckenrode May 20, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After rebuilding the stdenv with this change, there is one downside. It requires adding CoreServices and its propagated inputs the Darwin stdenv’s allowedRequisites, which differ depending on the SDK.

Is it possible to add a dev output to gettext, so CoreServices is propagated from it instead of out?

I used the following (with CoreServices as a regular build input) to successfully rebuild the Darwin stdenv. libpsl is an example of a package that needs CoreServices propagated to it. It also built successfully.

I also split the hook into two hooks. The one copied into $out sets up GETTEXTDATADIRS while the other ensures that libintl is linked.

  # Two setup hooks are needed. One is for making sure gettext can find its data files at runtime, and the other
  # is to make sure `libintl` is linked even on non-glibc targets. This is the latter hook. The other is below.
  setupHooks = [
    ../../../build-support/setup-hooks/role.bash
    ./gettext-setup-hook-dev.sh
  ];

  postInstall = ''
    mkdir -p "$out/nix-support"
    cat ${../../../build-support/setup-hooks/role.bash} ${./gettext-setup-hook.sh} > "$out/nix-support/setup-hook"
  '';

Edit: CoreServices needs to be in propagatedBuildInputs for it to be picked up by overrideSDK. Otherwise, anything that needs a non-default SDK and uses gettext won’t build (e.g., Wine).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will wait your modifications before migrating this, since I don't and I won't have a Darwin machine.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Modifications to the existing gettext package? I can open a PR (or PRs, depending) for those.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The migration to by-name will be a little bit harder.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because of the hooks? I cheated with libiconv-darwin (by reexporting them from libiconvReal and using those), but I don’t think that will be possible here.

@reckenrode reckenrode mentioned this pull request Jul 16, 2024
13 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: package adoption Requests or PRs for adopting packages that have no maintainers 2.status: merge conflict This PR has merge conflicts with the target branch 6.topic: stdenv Standard environment 10.rebuild-darwin: 501+ 10.rebuild-darwin: 5001+ 10.rebuild-darwin-stdenv This PR causes stdenv to rebuild 10.rebuild-linux: 501+ 10.rebuild-linux: 5001+ 10.rebuild-linux-stdenv This PR causes stdenv to rebuild
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants