From 9cc12e9f05b66bcb2f75a299b377baeae9f9006a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Sat, 18 Aug 2007 16:15:09 +0000 Subject: [PATCH] * Old work on Glibc with NPTL. No idea if it compiles/works. svn path=/nixpkgs/trunk/; revision=9157 --- .../libraries/glibc-nptl/builder.sh | 52 +++++++++++++ .../libraries/glibc-nptl/default.nix | 27 +++++++ .../glibc-nptl/glibc-getcwd-param-MAX.patch | 14 ++++ .../libraries/glibc-nptl/glibc-pwd.patch | 74 +++++++++++++++++++ 4 files changed, 167 insertions(+) create mode 100644 pkgs/development/libraries/glibc-nptl/builder.sh create mode 100644 pkgs/development/libraries/glibc-nptl/default.nix create mode 100644 pkgs/development/libraries/glibc-nptl/glibc-getcwd-param-MAX.patch create mode 100644 pkgs/development/libraries/glibc-nptl/glibc-pwd.patch diff --git a/pkgs/development/libraries/glibc-nptl/builder.sh b/pkgs/development/libraries/glibc-nptl/builder.sh new file mode 100644 index 000000000000..e4f6dec13545 --- /dev/null +++ b/pkgs/development/libraries/glibc-nptl/builder.sh @@ -0,0 +1,52 @@ +# 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) + + +preConfigure=preConfigure +preConfigure() { + + for i in configure io/ftwtest-sh; do + substituteInPlace "$i" \ + --replace "@PWD@" "pwd" + done + + 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-nptl/default.nix b/pkgs/development/libraries/glibc-nptl/default.nix new file mode 100644 index 000000000000..dbc49cd4a50f --- /dev/null +++ b/pkgs/development/libraries/glibc-nptl/default.nix @@ -0,0 +1,27 @@ +{ stdenv, fetchurl, kernelHeaders +, installLocales ? true +, profilingLibraries ? false +}: + +stdenv.mkDerivation { + name = "glibc-2.5"; + builder = ./builder.sh; + + src = fetchurl { + url = http://ftp.gnu.org/gnu/glibc/glibc-2.5.tar.bz2; + md5 = "1fb29764a6a650a4d5b409dda227ac9f"; + }; + + patches = [ ./glibc-pwd.patch ./glibc-getcwd-param-MAX.patch ]; + + inherit kernelHeaders installLocales; + + inherit (stdenv) is64bit; + + # `--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"}"; +} diff --git a/pkgs/development/libraries/glibc-nptl/glibc-getcwd-param-MAX.patch b/pkgs/development/libraries/glibc-nptl/glibc-getcwd-param-MAX.patch new file mode 100644 index 000000000000..8543dbbf1d76 --- /dev/null +++ b/pkgs/development/libraries/glibc-nptl/glibc-getcwd-param-MAX.patch @@ -0,0 +1,14 @@ +2006-06-18 Mike Frysinger + + * sysdeps/unix/sysv/linux/getcwd.c: Include sys/param.h. + +--- glibc-old/sysdeps/unix/sysv/linux/getcwd.c ++++ glibc-new/sysdeps/unix/sysv/linux/getcwd.c +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include + #include diff --git a/pkgs/development/libraries/glibc-nptl/glibc-pwd.patch b/pkgs/development/libraries/glibc-nptl/glibc-pwd.patch new file mode 100644 index 000000000000..07039718477f --- /dev/null +++ b/pkgs/development/libraries/glibc-nptl/glibc-pwd.patch @@ -0,0 +1,74 @@ +diff -ruN glibc-20050110/configure glibc-20050110.patched/configure +--- glibc-20050110/configure 2005-01-05 10:39:53.000000000 +0100 ++++ glibc-20050110.patched/configure 2005-01-18 13:33:01.000000000 +0100 +@@ -1393,7 +1393,7 @@ + ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. + + +-if test "`cd $srcdir; /bin/pwd`" = "`/bin/pwd`"; then ++if test "`cd $srcdir; @PWD@`" = "`@PWD@`"; then + { { echo "$as_me:$LINENO: error: you must configure in a separate build directory" >&5 + echo "$as_me: error: you must configure in a separate build directory" >&2;} + { (exit 1); exit 1; }; } +diff -ruN glibc-20050110/io/ftwtest-sh glibc-20050110.patched/io/ftwtest-sh +--- glibc-20050110/io/ftwtest-sh 2004-02-09 21:12:23.000000000 +0100 ++++ glibc-20050110.patched/io/ftwtest-sh 2005-01-18 13:33:15.000000000 +0100 +@@ -120,7 +120,7 @@ + sort > $testout + + # perhaps $tmp involves some symlinks... +-tmpreal=`cd $tmp; /bin/pwd 2>/dev/null || /usr/bin/pwd` ++tmpreal=`cd $tmp; @PWD@ 2>/dev/null || /usr/bin/pwd` + + cat </dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d | + sort > $testout +@@ -160,7 +160,7 @@ + EOF + rm $testout + +-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/. | + sort > $testout +@@ -182,7 +182,7 @@ + EOF + rm $testout + +-curwd=`/bin/pwd 2>/dev/null || /usr/bin/pwd` ++curwd=`@PWD@ 2>/dev/null || /usr/bin/pwd` + cd "$tmp" + LD_LIBRARY_PATH=$objpfx $ldso $testprogram --chdir ftwtest.d/foo/lvl1/link@1 | + sort > $testout +diff -ruN glibc-20050110/scripts/rellns-sh glibc-20050110.patched/scripts/rellns-sh +--- glibc-20050110/scripts/rellns-sh 1999-12-19 00:40:25.000000000 +0100 ++++ glibc-20050110.patched/scripts/rellns-sh 2005-01-18 13:35:53.245937423 +0100 +@@ -22,13 +22,13 @@ + exit 1 + fi + +-if test -x /bin/pwd; then +- pwd=/bin/pwd +-elif test -x /usr/bin/pwd; then +- pwd=/usr/bin/pwd +-else ++#if test -x /bin/pwd; then ++# pwd=/bin/pwd ++#elif test -x /usr/bin/pwd; then ++# pwd=/usr/bin/pwd ++#else + pwd='pwd' +-fi ++#fi + + # Make both paths absolute. + if test -d $1; then