Updating the perl-5.10 expression to support the bootstrapping stdenv better

- I still have not understood why it worked without this fix before, and I think
this has been triggered by the gcc-4.4, but I have not investigated this much. I
went with the trivial fix.

Adding a glibc-2.10.1 expression, because the glibc-2.11 still does not have
a ports release, so it cannot be used in arm. I'm using it only in native
compilation by now.

Making the default glibc to be 2.10 instead of 2.11 in armv5tel-linux.


svn path=/nixpkgs/branches/stdenv-updates/; revision=18688
This commit is contained in:
Lluís Batlle i Rossell 2009-11-28 12:57:42 +00:00
parent f310356cbc
commit 2b580b9846
13 changed files with 566 additions and 3 deletions

View File

@ -57,7 +57,8 @@ stdenv.mkDerivation {
${if stdenv.system == "armv5tel-linux" then "-Dldflags=\"-lm -lrt\"" else ""};
'';
preBuild = if (stdenv.gcc.nativeTools) then preBuildNative else preBuildNoNative;
preBuild = if (stdenv ? gcc && stdenv.gcc.nativeTools) then
preBuildNative else preBuildNoNative;
setupHook = ./setup-hook.sh;
}

View File

@ -0,0 +1,42 @@
Support GNU Binutils 2.20 and beyond. Patch from
http://sourceware.org/ml/libc-alpha/2009-09/msg00009.html .
diff --git a/configure b/configure
index 48e6952..b1d84d7 100755
--- a/configure
+++ b/configure
@@ -4841,7 +4841,7 @@ $as_echo_n "checking version of $AS... " >&6; }
ac_prog_version=`$AS --version 2>&1 | sed -n 's/^.*GNU assembler.* \([0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
@@ -4904,7 +4904,7 @@ $as_echo_n "checking version of $LD... " >&6; }
ac_prog_version=`$LD --version 2>&1 | sed -n 's/^.*GNU ld.* \([0-9][0-9]*\.[0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 2.1[3-9]*)
+ 2.1[3-9]*|[2-9].[2-9]*)
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
diff --git a/configure.in b/configure.in
index 4584afe..7c4f71f 100644
--- a/configure.in
+++ b/configure.in
@@ -897,10 +897,10 @@ AC_SUBST(MIG)dnl Needed by sysdeps/mach/configure.in
# Accept binutils 2.13 or newer.
AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], AS=: critic_missing="$critic_missing as")
+ [2.1[3-9]*|[2-9].[2-9]*], AS=: critic_missing="$critic_missing as")
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
- [2.1[3-9]*], LD=: critic_missing="$critic_missing ld")
+ [2.1[3-9]*|[2-9].[2-9]*], LD=: critic_missing="$critic_missing ld")
# We need the physical current working directory. We cannot use the
# "pwd -P" shell builtin since that's not portable. Instead we try to

View File

@ -0,0 +1,33 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
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=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
postInstall() {
if test -n "$installLocales"; then
make localedata/install-locales
fi
test -f $out/etc/ld.so.cache && 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

View File

@ -0,0 +1,164 @@
/* Build configuration used to build glibc, Info files, and locale
information. */
{ name, fetchurl, stdenv, installLocales ? false
, cross ? null, gccCross ? null, kernelHeaders ? null
, profilingLibraries ? false, meta, ... }@args :
let version = "2.10.1";
in
assert (cross != null) -> (gccCross != null);
stdenv.mkDerivation ({
inherit kernelHeaders installLocales;
# The host/target system.
crossConfig = if (cross != null) then cross.config else null;
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
/* Make it possible to override the locale-archive in NixOS. */
./locale-override.patch
/* Have rpcgen(1) look for cpp(1) in $PATH. */
./rpcgen-path.patch
/* Make sure `nscd' et al. are linked against `libssp'. */
./stack-protector-link.patch
/* Allow binutils 2.20 to be used (patch on its version checking) */
./binutils-2.20.patch
];
configureFlags = [
"-C"
"--enable-add-ons"
(if kernelHeaders != null
then "--with-headers=${kernelHeaders}/include"
else "--without-headers")
(if profilingLibraries
then "--enable-profile"
else "--disable-profile")
] ++ stdenv.lib.optionals (cross != null) [
"--with-tls"
"--enable-kernel=2.6.0"
"--without-fp"
"--with-__thread"
] ++ (if (stdenv.system == "armv5tel-linux") then [
"--host=arm-linux-gnueabi"
"--build=arm-linux-gnueabi"
"--without-fp"
] else []);
buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ];
# 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
# bootstrap.
BASH_SHELL = "/bin/sh";
}
//
(if (stdenv.system == "i686-linux")
then {
# 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";
}
else {})
//
args
//
{
name = args.name + "-${version}" +
stdenv.lib.optionalString (cross != null) "-${cross.config}";
src = fetchurl {
url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
sha256 = "0rz67p3zy3hj1pbcx8qjwnh926d412zs51ss82232qdbgrikxbfb";
};
srcPorts = fetchurl {
url = "mirror://gnu/glibc/glibc-ports-${version}.tar.bz2";
sha256 = "0wa0mdsfv0b97a0vbmc3l1258lq2y7p7i14bb4rklsh342byrwdi";
};
# `fetchurl' is a function and thus should not be passed to the
# `derivation' primitive.
fetchurl = null;
# Remove absolute paths from `configure' & co.; build out-of-tree.
preConfigure = ''
export PWD_P=$(type -tP pwd)
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
tar xvjf "$srcPorts"
mkdir ../build
cd ../build
configureScript="../$sourceRoot/configure"
${if args ? preConfigure
then args.preConfigure
else ""}
'';
meta = ({
homepage = http://www.gnu.org/software/libc/;
description = "The GNU C Library";
longDescription =
'' Any Unix-like operating system needs a C library: the library which
defines the "system calls" and other basic facilities such as
open, malloc, printf, exit...
The GNU C library is used as the C library in the GNU system and
most systems with the Linux kernel.
'';
license = "LGPLv2+";
maintainers = [ stdenv.lib.maintainers.ludo ];
platforms = stdenv.lib.platforms.linux;
}
//
args.meta
);
})

View File

@ -0,0 +1,51 @@
{ stdenv, fetchurl, kernelHeaders
, installLocales ? true
, profilingLibraries ? false
, gccCross ? null
}:
let
build = import ./common.nix;
cross = if gccCross != null then gccCross.target else null;
in
build ({
name = "glibc";
inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
cross;
builder = ./builder.sh;
preInstall = ''
ensureDir $out/lib
ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
'';
postInstall = ''
rm $out/lib/libgcc_s.so.1
'';
meta.description = "The GNU C Library";
}
//
(if cross != null
then {
preConfigure = ''
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
EOF
export BUILD_CC=gcc
export CC="$crossConfig-gcc"
export AR="$crossConfig-ar"
export RANLIB="$crossConfig-ranlib"
dontStrip = 1
'';
}
else {}))

View File

@ -0,0 +1,25 @@
{ stdenv, fetchurl, texinfo, perl }:
let build = import ./common.nix;
in
build {
name = "glibc-info";
inherit fetchurl stdenv;
configureFlags = [ "--enable-add-ons" ];
buildInputs = [ texinfo perl ];
buildPhase = "make info";
# I don't know why the info is not generated in 'build'
# Somehow building the info still does not work, because the final
# libc.info hasn't a Top node.
installPhase = ''
ensureDir "$out/share/info"
cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
'';
meta.description = "GNU Info manual of the GNU C Library";
}

View File

@ -0,0 +1,72 @@
diff -rc glibc-2.9-20081208-orig/locale/loadarchive.c glibc-2.9-20081208/locale/loadarchive.c
*** glibc-2.9-20081208-orig/locale/loadarchive.c 2005-09-09 18:56:52.000000000 +0200
--- glibc-2.9-20081208/locale/loadarchive.c 2009-04-19 13:54:26.000000000 +0200
***************
*** 124,129 ****
--- 124,142 ----
}
+ static int
+ open_locale_archive ()
+ {
+ int fd = -1;
+ char *path = getenv ("LOCALE_ARCHIVE");
+ if (path)
+ fd = open_not_cancel_2 (path, O_RDONLY|O_LARGEFILE);
+ if (fd < 0)
+ fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
+ return fd;
+ }
+
+
/* Find the locale *NAMEP in the locale archive, and return the
internalized data structure for its CATEGORY data. If this locale has
already been loaded from the archive, just returns the existing data
***************
*** 203,209 ****
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 216,222 ----
archmapped = &headmap;
/* The archive has never been opened. */
! fd = open_locale_archive ();
if (fd < 0)
/* Cannot open the archive, for whatever reason. */
return NULL;
***************
*** 394,400 ****
if (fd == -1)
{
struct stat64 st;
! fd = open_not_cancel_2 (archfname, O_RDONLY|O_LARGEFILE);
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
--- 407,413 ----
if (fd == -1)
{
struct stat64 st;
! fd = open_locale_archive ();
if (fd == -1)
/* Cannot open the archive, for whatever reason. */
return NULL;
diff -rc glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h glibc-2.9-20081208/sysdeps/generic/unsecvars.h
*** glibc-2.9-20081208-orig/sysdeps/generic/unsecvars.h 2006-10-11 18:24:05.000000000 +0200
--- glibc-2.9-20081208/sysdeps/generic/unsecvars.h 2009-04-19 13:55:34.000000000 +0200
***************
*** 16,21 ****
--- 16,22 ----
"LD_SHOW_AUXV\0" \
"LD_USE_LOAD_BIAS\0" \
"LOCALDOMAIN\0" \
+ "LOCALE_ARCHIVE\0" \
"LOCPATH\0" \
"MALLOC_TRACE\0" \
"NIS_PATH\0" \

View File

@ -0,0 +1,42 @@
/* This function builds just the `lib/locale/locale-archive' file from
Glibc and nothing else. If `allLocales' is true, all supported
locales are included; otherwise, just the locales listed in
`locales'. See localedata/SUPPORTED in the Glibc source tree for
the list of all supported locales:
http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
*/
{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
let build = import ./common.nix;
in
build {
name = "glibc-locales";
inherit fetchurl stdenv;
installLocales = true;
builder = ./localesbuilder.sh;
# 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
# <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use
# $TMPDIR as a prefix, meaning that the locale-archive is placed in
# $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
buildPhase =
''
mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
make localedata/install-locales \
LOCALEDEF="localedef --prefix=$TMPDIR" \
localedir=$out/lib/locale \
${if allLocales then "" else "SUPPORTED-LOCALES=\"${toString locales}\""}
'';
installPhase =
''
ensureDir "$out/lib/locale"
cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
'';
meta.description = "Locale information for the GNU C Library";
}

View File

@ -0,0 +1,17 @@
# Glibc cannot have itself in its RPATH.
export NIX_NO_SELF_RPATH=1
source $stdenv/setup
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=
export NIX_DONT_SET_RPATH=1
unset CFLAGS
}
genericBuild

View File

@ -0,0 +1,25 @@
diff -rc glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c
*** glibc-2.9-20081208-orig/sysdeps/posix/getaddrinfo.c 2008-07-30 21:14:22.000000000 +0200
--- glibc-2.9-20081208/sysdeps/posix/getaddrinfo.c 2008-12-10 11:39:32.000000000 +0100
***************
*** 505,512 ****
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;
--- 505,510 ----
***************
*** 702,707 ****
--- 700,707 ----
while (!no_more)
{
+ enum nss_status inet6_status = NSS_STATUS_UNAVAIL;
+ enum nss_status status = NSS_STATUS_UNAVAIL;
nss_gethostbyname4_r fct4
= __nss_lookup_function (nip, "gethostbyname4_r");
if (fct4 != NULL)

View File

@ -0,0 +1,72 @@
By default, rpcgen(1) looks for cpp(1) from a list of fixed absolute paths
(`/lib/cpp', etc.), which may only be overrided with the `-Y' option. This
patch makes it run any `cpp' command found in $PATH.
--- glibc-2.7/sunrpc/rpc_main.c 2006-11-10 21:54:46.000000000 +0100
+++ glibc-2.7/sunrpc/rpc_main.c 2009-04-22 14:32:10.000000000 +0200
@@ -79,7 +79,7 @@ static const char *cmdname;
static const char *svcclosetime = "120";
static int cppDefined; /* explicit path for C preprocessor */
-static const char *CPP = SUNOS_CPP;
+static const char *CPP = "cpp";
static const char CPPFLAGS[] = "-C";
static char *pathbuf;
static int cpp_pid;
@@ -108,7 +108,6 @@ static char *extendfile (const char *fil
static void open_output (const char *infile, const char *outfile);
static void add_warning (void);
static void clear_args (void);
-static void find_cpp (void);
static void open_input (const char *infile, const char *define);
static int check_nettype (const char *name, const char *list_to_check[]);
static void c_output (const char *infile, const char *define,
@@ -327,31 +326,6 @@ clear_args (void)
argcount = FIXEDARGS;
}
-/* make sure that a CPP exists */
-static void
-find_cpp (void)
-{
- struct stat buf;
-
- if (stat (CPP, &buf) < 0)
- { /* /lib/cpp or explicit cpp does not exist */
- if (cppDefined)
- {
- fprintf (stderr, _ ("cannot find C preprocessor: %s \n"), CPP);
- crash ();
- }
- else
- { /* try the other one */
- CPP = SVR4_CPP;
- if (stat (CPP, &buf) < 0)
- { /* can't find any cpp */
- fputs (_ ("cannot find any C preprocessor (cpp)\n"), stdout);
- crash ();
- }
- }
- }
-}
-
/*
* Open input file with given define for C-preprocessor
*/
@@ -370,7 +344,6 @@ open_input (const char *infile, const ch
switch (cpp_pid)
{
case 0:
- find_cpp ();
putarg (0, CPP);
putarg (1, CPPFLAGS);
addarg (define);
@@ -380,7 +353,7 @@ open_input (const char *infile, const ch
close (1);
dup2 (pd[1], 1);
close (pd[0]);
- execv (arglist[0], (char **) arglist);
+ execvp (arglist[0], (char **) arglist);
perror ("execv");
exit (1);
case -1:

View File

@ -0,0 +1,12 @@
Make sure `nscd' et al. are linked against `libssp'.
--- glibc-2.11/nscd/Makefile 2009-10-30 18:17:08.000000000 +0100
+++ glibc-2.11/nscd/Makefile 2009-11-22 01:19:37.000000000 +0100
@@ -126,6 +126,7 @@ CFLAGS-res_hconf.c += $(nscd-cflags)
ifeq (yesyes,$(have-fpie)$(build-shared))
relro-LDFLAGS += -Wl,-z,now
+$(objpfx)nscd: LDFLAGS += -lssp
$(objpfx)nscd: $(addprefix $(objpfx),$(nscd-modules:=.o))
$(+link-pie)
endif

View File

@ -3417,7 +3417,9 @@ let
let haveRedHatKernel = system == "i686-linux" || system == "x86_64-linux";
haveBrokenRedHatKernel = haveRedHatKernel && getConfig ["brokenRedHatKernel"] false;
in
useFromStdenv "glibc" (if haveBrokenRedHatKernel then glibc25 else glibc211);
useFromStdenv "glibc" (if haveBrokenRedHatKernel then glibc25 else
# glibc211 does not have ports still.
if (system == "armv5tel-linux") then glibc210 else glibc211);
glibc25 = import ../development/libraries/glibc-2.5 {
inherit fetchurl stdenv kernelHeaders;
@ -3443,6 +3445,11 @@ let
glibcCross = cross: glibc29Cross cross;
glibc210 = makeOverridable (import ../development/libraries/glibc-2.10) {
inherit fetchurl stdenv kernelHeaders;
installLocales = getPkgConfig "glibc" "locales" false;
};
glibc211 = makeOverridable (import ../development/libraries/glibc-2.11) {
inherit fetchurl stdenv kernelHeaders;
installLocales = getPkgConfig "glibc" "locales" false;
@ -3462,7 +3469,7 @@ let
installLocales = getPkgConfig "glibc" "locales" false;
};
glibcLocales = makeOverridable (import ../development/libraries/glibc-2.11/locales.nix) {
glibcLocales = makeOverridable (import ../development/libraries/glibc-2.10/locales.nix) {
inherit fetchurl stdenv;
};