diff options
author | Vladimír Čunát <vcunat@gmail.com> | 2015-07-31 15:20:06 +0200 |
---|---|---|
committer | Vladimír Čunát <vcunat@gmail.com> | 2015-07-31 15:39:52 +0200 |
commit | eb4a88d8fd27cbda512c8728c797ef2b13a91ade (patch) | |
tree | ac8fe610e6c9a60264b4b4264d54cf3a5c98bc12 /pkgs/development/libraries/glibc | |
parent | adfd0c78309fe0ccd651c592a5f673b7bfabb2c0 (diff) | |
download | nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar.gz nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar.bz2 nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar.lz nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar.xz nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.tar.zst nixlib-eb4a88d8fd27cbda512c8728c797ef2b13a91ade.zip |
glibc-locales: check that all we build is supported
Until now, if e.g. the user passed "en_US.UTF-8" instead of "en_US.UTF-8/UTF-8", the locales would be generated without failing but wouldn't work well. Now we guard against such mistakes. Real life examples: https://github.com/fish-shell/fish-shell/issues/1927
Diffstat (limited to 'pkgs/development/libraries/glibc')
-rw-r--r-- | pkgs/development/libraries/glibc/locales.nix | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix index 5d6e678bfe6d..cbf7af22cac1 100644 --- a/pkgs/development/libraries/glibc/locales.nix +++ b/pkgs/development/libraries/glibc/locales.nix @@ -29,10 +29,25 @@ build null { # Hack to allow building of the locales (needed since glibc-2.12) sed -i -e 's,^$(rtld-prefix) $(common-objpfx)locale/localedef,localedef --prefix='$TMPDIR',' ../glibc-2*/localedata/Makefile + '' + + stdenv.lib.optionalString (!allLocales) '' + # Check that all locales to be built are supported + echo -n '${stdenv.lib.concatMapStrings (s: s + " \\\n") locales}' \ + | sort > locales-to-build.txt + cat ../glibc-2*/localedata/SUPPORTED | grep ' \\' \ + | sort > locales-supported.txt + comm -13 locales-supported.txt locales-to-build.txt \ + > locales-unsupported.txt + if [[ $(wc -c locales-unsupported.txt) != "0 locales-unsupported.txt" ]]; then + cat locales-supported.txt + echo "Error: unsupported locales detected:" + cat locales-unsupported.txt + echo "You should choose from the list above the error." + false + fi - ${if allLocales then "" else - "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"} - + echo SUPPORTED-LOCALES='${toString locales}' > ../glibc-2*/localedata/SUPPORTED + '' + '' make localedata/install-locales \ localedir=$out/lib/locale \ ''; |