From 5f8571613d24190d18484392c4995c90613bf3ab Mon Sep 17 00:00:00 2001 From: Peter Simons Date: Mon, 7 Jul 2008 23:11:53 +0000 Subject: [PATCH] glibcUnstable: added low-priority expression for the latest glibc 2.8 snapshot svn path=/nixpkgs/trunk/; revision=12315 --- .../libraries/glibc-2.8/builder.sh | 63 +++++++++++++++++++ .../libraries/glibc-2.8/default.nix | 58 +++++++++++++++++ .../glibc-2.8/nss-skip-unavail.patch | 25 ++++++++ pkgs/top-level/all-packages.nix | 5 ++ 4 files changed, 151 insertions(+) create mode 100644 pkgs/development/libraries/glibc-2.8/builder.sh create mode 100644 pkgs/development/libraries/glibc-2.8/default.nix create mode 100644 pkgs/development/libraries/glibc-2.8/nss-skip-unavail.patch diff --git a/pkgs/development/libraries/glibc-2.8/builder.sh b/pkgs/development/libraries/glibc-2.8/builder.sh new file mode 100644 index 00000000000..1bf806c0149 --- /dev/null +++ b/pkgs/development/libraries/glibc-2.8/builder.sh @@ -0,0 +1,63 @@ +# glibc cannot have itself in its rpath. +export NIX_NO_SELF_RPATH=1 +export NIX_DONT_SET_RPATH=1 + +source $stdenv/setup + +# Explicitly tell glibc to use our pwd, not /bin/pwd. +export PWD_P=$(type -tP pwd) + +# Needed to install share/zoneinfo/zone.tab. +export BASH_SHELL=$SHELL + + +preConfigure=preConfigure +preConfigure() { + + for i in configure io/ftwtest-sh; do + # Can't use substituteInPlace here because replace hasn't been + # built yet in the bootstrap. + sed -i "$i" -e "s^/bin/pwd^$PWD_P^g" + done + + # In the glibc 2.6/2.7 tarballs C-translit.h is a little bit older + # than C-translit.h.in, forcing Make to rebuild it unnecessarily. + # This wouldn't be problem except that it requires Perl, which we + # don't want as a dependency in the Nixpkgs bootstrap. So force + # the output file to be newer. + touch locale/C-translit.h + + mkdir ../build + cd ../build + + configureScript=../$sourceRoot/configure +} + + +postConfigure=postConfigure +postConfigure() { + # Hack: get rid of the `-static' flag set by the bootstrap stdenv. + # This has to be done *after* `configure' because it builds some + # test binaries. + export NIX_CFLAGS_LINK= + export NIX_LDFLAGS_BEFORE= +} + + +postInstall=postInstall +postInstall() { + if test -n "$installLocales"; then + make localedata/install-locales + fi + rm $out/etc/ld.so.cache + (cd $out/include && ln -s $kernelHeaders/include/* .) || exit 1 + + # Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink + # "lib64" to "lib". + if test -n "$is64bit"; then + ln -s lib $out/lib64 + fi +} + + +genericBuild diff --git a/pkgs/development/libraries/glibc-2.8/default.nix b/pkgs/development/libraries/glibc-2.8/default.nix new file mode 100644 index 00000000000..ca86a9527d7 --- /dev/null +++ b/pkgs/development/libraries/glibc-2.8/default.nix @@ -0,0 +1,58 @@ +{ stdenv, fetchurl, kernelHeaders +, installLocales ? true +, profilingLibraries ? false +}: + +stdenv.mkDerivation rec +{ + name = "glibc-2.8-20080707"; + builder = ./builder.sh; + src = fetchurl + { + url = "ftp://sources.redhat.com/pub/glibc/snapshots/${name}.tar.bz2"; + sha256 = "e317b854807f52cd539ed9b6bf8b1c2977e650e27e90baa787444bd3b74f5e72"; + }; + + inherit kernelHeaders installLocales; + + inherit (stdenv) is64bit; + + patches = [ + /* Fix for NIXPKGS-79: when doing host name lookups, when + nsswitch.conf contains a line like + + hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4 + + don't return an error when mdns4_minimal can't be found. This + is a bug in Glibc: when a service can't be found, NSS should + continue to the next service unless "UNAVAIL=return" is set. + ("NOTFOUND=return" refers to the service returning a NOTFOUND + error, not the service itself not being found.) The reason is + that the "status" variable (while initialised to UNAVAIL) is + outside of the loop that iterates over the services, the + "files" service sets status to NOTFOUND. So when the call to + find "mdns4_minimal" fails, "status" will still be NOTFOUND, + and it will return instead of continuing to "dns". Thus, the + line + + hosts: mdns4_minimal [NOTFOUND=return] dns mdns4 + + does work because "status" will contain UNAVAIL after the + failure to find mdns4_minimal. */ + ./nss-skip-unavail.patch + ]; + + # `--with-tls --without-__thread' enables support for TLS but causes + # it not to be used. Required if we don't want to barf on 2.4 + # kernels. Or something. + configureFlags="--enable-add-ons + --with-headers=${kernelHeaders}/include + ${if profilingLibraries then "--enable-profile" else "--disable-profile"}"; + + # Workaround for this bug: + # http://sourceware.org/bugzilla/show_bug.cgi?id=411 + # I.e. when gcc is compiled with --with-arch=i686, then the + # preprocessor symbol `__i686' will be defined to `1'. This causes + # the symbol __i686.get_pc_thunk.dx to be mangled. + NIX_CFLAGS_COMPILE = "-U__i686"; +} diff --git a/pkgs/development/libraries/glibc-2.8/nss-skip-unavail.patch b/pkgs/development/libraries/glibc-2.8/nss-skip-unavail.patch new file mode 100644 index 00000000000..4d29082f941 --- /dev/null +++ b/pkgs/development/libraries/glibc-2.8/nss-skip-unavail.patch @@ -0,0 +1,25 @@ +diff -rc glibc-2.7-orig/sysdeps/posix/getaddrinfo.c glibc-2.7/sysdeps/posix/getaddrinfo.c +*** glibc-2.7-orig/sysdeps/posix/getaddrinfo.c 2007-10-17 18:05:12.000000000 +0200 +--- glibc-2.7/sysdeps/posix/getaddrinfo.c 2008-04-08 12:17:09.000000000 +0200 +*************** +*** 498,505 **** + int no_data = 0; + int no_inet6_data = 0; + service_user *nip = NULL; +- enum nss_status inet6_status = NSS_STATUS_UNAVAIL; +- enum nss_status status = NSS_STATUS_UNAVAIL; + int no_more; + int old_res_options; + +--- 498,503 ---- +*************** +*** 689,694 **** +--- 687,694 ---- + + while (!no_more) + { ++ enum nss_status inet6_status = NSS_STATUS_UNAVAIL; ++ enum nss_status status = NSS_STATUS_UNAVAIL; + nss_gethostbyname3_r fct = NULL; + if (req->ai_flags & AI_CANONNAME) + /* No need to use this function if we do not look for diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 56a24b2dd7c..0d2517f7653 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -2614,6 +2614,11 @@ let pkgs = rec { #installLocales = false; }); + glibcUnstable = lowPrio (import ../development/libraries/glibc-2.8 { + inherit fetchurl stdenv kernelHeaders; + installLocales = getPkgConfig "glibc" "locales" false; + }); + glibc_multi = assert system == "x86_64-linux"; runCommand "${glibc.name}-multi"