-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
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
gettext: adopt and update #299647
Changes from all commits
cbcc006
c49c132
e0dd875
63675b3
c28c2c8
fc29c3f
fbec618
e6d50ce
2acc524
8bd736c
54c8075
8f72b73
ad3dca2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
From 2f702ed832b2aa0feaa1948104eb0388943177e6 Mon Sep 17 00:00:00 2001 | ||
From: Weijia Wang <contact@weijia.wang> | ||
Date: Sun, 7 Jan 2024 01:27:16 +0100 | ||
Subject: [PATCH] Revert "Avoid crash on macOS 14." | ||
|
||
This reverts commit 1bcf74a9fa6dcf33645f54a854dc49387e76a40b. | ||
--- | ||
gettext-runtime/configure | 2 +- | ||
gettext-runtime/intl/configure | 2 +- | ||
gettext-tools/configure | 2 +- | ||
3 files changed, 3 insertions(+), 3 deletions(-) | ||
|
||
diff --git a/gettext-runtime/configure b/gettext-runtime/configure | ||
index 2a376c6..88c9312 100755 | ||
--- a/gettext-runtime/configure | ||
+++ b/gettext-runtime/configure | ||
@@ -22421,7 +22421,7 @@ printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h | ||
INTL_MACOSX_LIBS= | ||
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ | ||
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then | ||
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" | ||
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | ||
fi | ||
|
||
|
||
diff --git a/gettext-runtime/intl/configure b/gettext-runtime/intl/configure | ||
index 8bea363..78f70d7 100755 | ||
--- a/gettext-runtime/intl/configure | ||
+++ b/gettext-runtime/intl/configure | ||
@@ -17428,7 +17428,7 @@ printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h | ||
INTL_MACOSX_LIBS= | ||
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ | ||
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then | ||
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" | ||
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | ||
fi | ||
|
||
|
||
diff --git a/gettext-tools/configure b/gettext-tools/configure | ||
index 5ce6cf1..08f1062 100755 | ||
--- a/gettext-tools/configure | ||
+++ b/gettext-tools/configure | ||
@@ -25810,7 +25810,7 @@ printf "%s\n" "#define HAVE_CFLOCALECOPYPREFERREDLANGUAGES 1" >>confdefs.h | ||
INTL_MACOSX_LIBS= | ||
if test $gt_cv_func_CFPreferencesCopyAppValue = yes \ | ||
|| test $gt_cv_func_CFLocaleCopyPreferredLanguages = yes; then | ||
- INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation -Wl,-framework -Wl,CoreServices" | ||
+ INTL_MACOSX_LIBS="-Wl,-framework -Wl,CoreFoundation" | ||
fi | ||
|
||
|
||
-- | ||
2.39.3 (Apple Git-145) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,125 @@ | ||
{ lib | ||
, bash | ||
, darwin | ||
, fetchurl | ||
, libiconv | ||
, stdenv | ||
, xz | ||
|
||
, enableCoreServices ? stdenv.isDarwin | ||
# HACK, see #10874 (and 14664) | ||
, enableLibiconv ? (!stdenv.isLinux && !stdenv.hostPlatform.isCygwin) | ||
}: | ||
|
||
# Note: this package is used for bootstrapping fetchurl, and thus cannot use | ||
# fetchpatch! All mutable patches (retrieved via by GitHub, cgit or similar | ||
# means) that perhaps are needed here should be included directly in Nixpkgs as | ||
# regular files inside this same directory. | ||
|
||
stdenv.mkDerivation (finalAttrs: ({ | ||
pname = "gettext"; | ||
version = "0.22.5"; | ||
|
||
src = fetchurl { | ||
url = "mirror://gnu/gettext/gettext-${finalAttrs.version}.tar.gz"; | ||
hash = "sha256-7BcFselpuDqfBzFE7IBhUduIEn9eQP5alMtsj6SJlqA="; | ||
}; | ||
|
||
patches = [ | ||
# Parameterize some tools to their absolute paths in gettext.sh.in | ||
./001-absolute-paths.diff | ||
# fix reproducibile output, in particular in the grub2 build | ||
# https://savannah.gnu.org/bugs/index.php?59658 | ||
./002-msginit-do-not-use-pot-creation-date.patch | ||
] | ||
++ lib.optionals enableCoreServices [ | ||
# prevent infinite recursion for the darwin stdenv | ||
./003-revert-avoid-crash-on-macos-14.patch | ||
]; | ||
|
||
outputs = [ "out" "man" "doc" "info" ]; | ||
|
||
hardeningDisable = [ "format" ]; | ||
|
||
configureFlags = [ | ||
(lib.enableFeature false "csharp") | ||
(lib.withFeature true "xz") | ||
] ++ lib.optionals (stdenv.hostPlatform != stdenv.buildPlatform) [ | ||
# On cross building, gettext supposes that the wchar.h from libc does not | ||
# fulfill gettext needs, so it tries to work with its own wchar.h file, | ||
# which does not cope well with the system's wchar.h and stddef.h (gcc-4.3 - | ||
# glibc-2.9) | ||
"gl_cv_func_wcwidth_works=yes" | ||
]; | ||
|
||
postPatch = '' | ||
substituteAllInPlace gettext-runtime/src/gettext.sh.in | ||
substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd | ||
substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd | ||
substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd | ||
'' + lib.optionalString stdenv.hostPlatform.isCygwin '' | ||
sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in | ||
sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in | ||
'' + lib.optionalString stdenv.hostPlatform.isMinGW '' | ||
sed -i "s/@GNULIB_CLOSE@/1/" */*/unistd.in.h | ||
''; | ||
|
||
nativeBuildInputs = [ | ||
xz | ||
(lib.getBin xz) | ||
]; | ||
|
||
buildInputs = lib.optionals (!stdenv.hostPlatform.isMinGW) [ | ||
bash | ||
] | ||
++ lib.optionals enableLibiconv [ | ||
libiconv | ||
] | ||
++ lib.optionals enableCoreServices [ | ||
darwin.apple_sdk.frameworks.CoreServices | ||
]; | ||
|
||
strictDeps = true; | ||
|
||
env = { | ||
LDFLAGS = lib.optionalString stdenv.isSunOS "-lm -lmd -lmp -luutil -lnvpair -lnsl -lidmap -lavl -lsec"; | ||
gettextNeedsLdflags = stdenv.hostPlatform.libc != "glibc" && !stdenv.hostPlatform.isMusl; | ||
}; | ||
|
||
enableParallelBuilding = true; | ||
enableParallelChecking = false; # fails sometimes | ||
|
||
setupHooks = [ | ||
../../../build-support/setup-hooks/role.bash | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like it won't pass the by-name check. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. |
||
./gettext-setup-hook.sh | ||
]; | ||
|
||
meta = { | ||
homepage = "https://www.gnu.org/software/gettext/"; | ||
description = "Well integrated set of translation tools and documentation"; | ||
longDescription = '' | ||
Usually, programs are written and documented in English, and use English | ||
at execution time for interacting with users. Using a common language is | ||
quite handy for communication between developers, maintainers and users | ||
from all countries. On the other hand, most people are less comfortable | ||
with English than with their own native language, and would rather be | ||
using their mother tongue for day to day's work, as far as possible. Many | ||
would simply love seeing their computer screen showing a lot less of | ||
English, and far more of their own language. | ||
|
||
GNU gettext is an important step for the GNU Translation Project, as it is | ||
an asset on which we may build many other steps. This package offers to | ||
programmers, translators, and even users, a well integrated set of tools | ||
and documentation. Specifically, the GNU gettext utilities are a set of | ||
tools that provides a framework to help other GNU packages produce | ||
multi-lingual messages. | ||
''; | ||
mainProgram = "gettext"; | ||
maintainers = with lib.maintainers; [ zimbatm AndersonTorres ]; | ||
license = with lib.licenses; [ gpl2Plus ]; | ||
platforms = lib.platforms.all; | ||
}; | ||
} | ||
// lib.optionalAttrs stdenv.isDarwin { | ||
makeFlags = [ "CFLAGS=-D_FORTIFY_SOURCE=0" ]; | ||
})) |
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 ofout
?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 upGETTEXTDATADIRS
while the other ensures thatlibintl
is linked.Edit:
CoreServices
needs to be inpropagatedBuildInputs
for it to be picked up byoverrideSDK
. Otherwise, anything that needs a non-default SDK and uses gettext won’t build (e.g., Wine).There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.