From ba0649790452a507c0972d788e551baad0ad18be Mon Sep 17 00:00:00 2001 From: Yuka Date: Mon, 18 Oct 2021 08:53:36 +0200 Subject: [PATCH] glibcLocales: support building on musl (#141971) --- pkgs/development/libraries/glibc/common.nix | 6 ++++-- pkgs/development/libraries/glibc/locales.nix | 6 ++++-- pkgs/top-level/all-packages.nix | 4 ++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 3f78ef4041a6..dbb9f3ffa877 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -37,6 +37,8 @@ , profilingLibraries ? false , withGd ? false , meta +, extraBuildInputs ? [] +, extraNativeBuildInputs ? [] , ... } @ args: @@ -189,8 +191,8 @@ stdenv.mkDerivation ({ outputs = [ "out" "bin" "dev" "static" ]; depsBuildBuild = [ buildPackages.stdenv.cc ]; - nativeBuildInputs = [ bison python3Minimal ]; - buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ]; + nativeBuildInputs = [ bison python3Minimal ] ++ extraNativeBuildInputs; + buildInputs = [ linuxHeaders ] ++ lib.optionals withGd [ gd libpng ] ++ extraBuildInputs; # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to # prevent a retained dependency on the bootstrap tools in the stdenv-linux diff --git a/pkgs/development/libraries/glibc/locales.nix b/pkgs/development/libraries/glibc/locales.nix index 208eedd71934..bada8b3f31f7 100644 --- a/pkgs/development/libraries/glibc/locales.nix +++ b/pkgs/development/libraries/glibc/locales.nix @@ -6,7 +6,7 @@ https://sourceware.org/git/?p=glibc.git;a=blob;f=localedata/SUPPORTED */ -{ lib, stdenv, buildPackages, callPackage, writeText +{ lib, stdenv, buildPackages, callPackage, writeText, glibc , allLocales ? true, locales ? [ "en_US.UTF-8/UTF-8" ] }: @@ -17,6 +17,8 @@ callPackage ./common.nix { inherit stdenv; } { outputs = [ "out" ]; + extraNativeBuildInputs = [ glibc ]; + # Awful hack: `localedef' doesn't allow the path to `locale-archive' # to be overriden, but you *can* specify a prefix, i.e. it will use # //lib/locale/locale-archive. So we use @@ -24,7 +26,7 @@ callPackage ./common.nix { inherit stdenv; } { # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive. buildPhase = '' - mkdir -p $TMPDIR/"${buildPackages.stdenv.cc.libc.out}/lib/locale" + mkdir -p $TMPDIR/"${buildPackages.glibc.out}/lib/locale" echo 'C.UTF-8/UTF-8 \' >> ../glibc-2*/localedata/SUPPORTED diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 5be56dccff0e..a5bf68078618 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -16250,8 +16250,8 @@ with pkgs; relibc = callPackage ../development/libraries/relibc { }; - # Only supported on Linux, using glibc - glibcLocales = if stdenv.hostPlatform.libc == "glibc" then callPackage ../development/libraries/glibc/locales.nix { } else null; + # Only supported on Linux + glibcLocales = if stdenv.hostPlatform.isLinux then callPackage ../development/libraries/glibc/locales.nix { } else null; glibcInfo = callPackage ../development/libraries/glibc/info.nix { };