diff options
Diffstat (limited to 'pkgs/development/libraries/glibc/common.nix')
-rw-r--r-- | pkgs/development/libraries/glibc/common.nix | 64 |
1 files changed, 50 insertions, 14 deletions
diff --git a/pkgs/development/libraries/glibc/common.nix b/pkgs/development/libraries/glibc/common.nix index 74fb00501096..db80a8be299c 100644 --- a/pkgs/development/libraries/glibc/common.nix +++ b/pkgs/development/libraries/glibc/common.nix @@ -1,26 +1,34 @@ /* Build configuration used to build glibc, Info files, and locale information. */ -cross: - -{ name, fetchurl, lib, stdenv, installLocales ? false -, linuxHeaders ? null -, profilingLibraries ? false, meta -, withGd ? false, gd ? null, libpng ? null -, preConfigure ? "" -, buildPackages ? {} +{ stdenv, lib, fetchurl +, gd ? null, libpng ? null +, buildPlatform, hostPlatform +, buildPackages +}: + +{ name +, withLinuxHeaders ? false +, profilingLibraries ? false +, installLocales ? false +, withGd ? false +, meta , ... } @ args: let + inherit (buildPackages) linuxHeaders; version = "2.25"; sha256 = "067bd9bb3390e79aa45911537d13c3721f1d9d3769931a30c2681bfee66f23a0"; + cross = if buildPlatform != hostPlatform then hostPlatform else null; in -assert cross != null -> buildPackages.stdenv ? cc; +assert withLinuxHeaders -> linuxHeaders != null; +assert withGd -> gd != null && libpng != null; stdenv.mkDerivation ({ - inherit linuxHeaders installLocales; + inherit installLocales; + linuxHeaders = if withLinuxHeaders then linuxHeaders else null; # The host/target system. crossConfig = if cross != null then cross.config else null; @@ -87,13 +95,13 @@ stdenv.mkDerivation ({ "--enable-obsolete-rpc" "--sysconfdir=/etc" "--enable-stackguard-randomization" - (if linuxHeaders != null + (if withLinuxHeaders then "--with-headers=${linuxHeaders}/include" else "--without-headers") (if profilingLibraries then "--enable-profile" else "--disable-profile") - ] ++ lib.optionals (cross == null && linuxHeaders != null) [ + ] ++ lib.optionals (cross == null && withLinuxHeaders) [ "--enable-kernel=2.6.32" ] ++ lib.optionals (cross != null) [ (if cross.withTLS then "--with-tls" else "--without-tls") @@ -125,7 +133,7 @@ stdenv.mkDerivation ({ BASH_SHELL = "/bin/sh"; } -// (removeAttrs args [ "lib" "buildPackages" "fetchurl" "withGd" "gd" "libpng" ]) // +// (removeAttrs args [ "withLinuxHeaders" "withGd" ]) // { name = name + "-${version}" + @@ -154,7 +162,22 @@ stdenv.mkDerivation ({ ''makeFlags="$makeFlags BUILD_LDFLAGS=-Wl,-rpath,${stdenv.cc.libc}/lib"'' } - ${preConfigure} + + '' + lib.optionalString (cross != null) '' + sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig" + + cat > config.cache << "EOF" + libc_cv_forced_unwind=yes + libc_cv_c_cleanup=yes + libc_cv_gnu89_inline=yes + # Only due to a problem in gcc configure scripts: + libc_cv_sparc64_tls=${if cross.withTLS then "yes" else "no"} + EOF + + export BUILD_CC=gcc + export CC="$crossConfig-gcc" + export AR="$crossConfig-ar" + export RANLIB="$crossConfig-ranlib" ''; preBuild = lib.optionalString withGd "unset NIX_DONT_SET_RPATH"; @@ -177,4 +200,17 @@ stdenv.mkDerivation ({ maintainers = [ lib.maintainers.eelco ]; platforms = lib.platforms.linux; } // meta; +} + +// lib.optionalAttrs (cross != null) { + preInstall = null; # clobber the native hook + + dontStrip = true; + + separateDebugInfo = false; # this is currently broken for crossDrv + + # To avoid a dependency on the build system 'bash'. + preFixup = '' + rm $bin/bin/{ldd,tzselect,catchsegv,xtrace} + ''; }) |