glibc: Don't check /etc/ld.so.cache

Idea by Eelco, initial patch by Jack Cummings, minor fixups by me

svn path=/nixpkgs/branches/stdenv-updates/; revision=33741
This commit is contained in:
Shea Levy 2012-04-11 04:42:23 +00:00
parent 6e195330d6
commit 8f60696e06
6 changed files with 92 additions and 15 deletions

View file

@ -51,11 +51,4 @@ postInstall() {
rm -f $out/lib/libgcc_s.so.1
}
postFixup() {
# libelf uses gencat, so we need to fix it's rpath so that it doesn't pick up the system rpath.
patchelf --set-rpath $out/lib $out/bin/gencat
# librt (used by acl, used by coreutils) links against pthread, try *not* to pick up the system one.
patchelf --set-rpath $out/lib $out/lib/librt-*.so
}
genericBuild

View file

@ -75,6 +75,9 @@ stdenv.mkDerivation ({
/* Allow nixos and nix handle the locale-archive. */
./nix-locale-archive.patch
/* don't use /etc/ld.so.cache, for non-nixos systems */
./dont_use_system_ld_so_cache.patch
/* Without this patch many KDE binaries crash. */
./glibc-elf-localscope.patch
] ++ stdenv.lib.optional installLocales ./catalan-firstdays.patch;

View file

@ -0,0 +1,43 @@
diff -Naur glibc-2.13-orig/elf/ldconfig.c glibc-2.13/elf/ldconfig.c
--- glibc-2.13-orig/elf/ldconfig.c 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/elf/ldconfig.c 2012-04-10 23:28:45.957492340 -0400
@@ -51,7 +51,7 @@
#endif
#ifndef LD_SO_CONF
-# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
+# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
#endif
/* Get libc version number. */
diff -Naur glibc-2.13-orig/elf/Makefile glibc-2.13/elf/Makefile
--- glibc-2.13-orig/elf/Makefile 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/elf/Makefile 2012-04-10 23:27:05.666477442 -0400
@@ -459,11 +459,11 @@
$(objpfx)sprof: $(libdl)
$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
-SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
-CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
+PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
-D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
-CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
-CFLAGS-cache.c = $(SYSCONF-FLAGS)
+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
+CFLAGS-cache.c = $(PREFIX-FLAGS)
CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
diff -Naur glibc-2.13-orig/sysdeps/generic/dl-cache.h glibc-2.13/sysdeps/generic/dl-cache.h
--- glibc-2.13-orig/sysdeps/generic/dl-cache.h 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/sysdeps/generic/dl-cache.h 2012-04-10 23:28:20.077488815 -0400
@@ -29,7 +29,7 @@
#endif
#ifndef LD_SO_CACHE
-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
+# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
#endif
#ifndef add_system_dir

View file

@ -51,12 +51,4 @@ postInstall() {
rm -f $out/lib/libgcc_s.so.1
}
postFixup() {
# libelf uses gencat, so we need to fix it's rpath so that it doesn't pick up the system rpath.
patchelf --set-rpath $out/lib $out/bin/gencat
# librt (used by acl, used by coreutils) links against pthread, try *not* to pick up the system one.
patchelf --set-rpath $out/lib $out/lib/librt-*.so
}
genericBuild

View file

@ -75,6 +75,9 @@ stdenv.mkDerivation ({
/* Allow nixos and nix handle the locale-archive. */
./nix-locale-archive.patch
/* don't use /etc/ld.so.cache, for non-nixos systems */
./dont_use_system_ld_so_cache.patch
/* Without this patch many KDE binaries crash. */
./glibc-elf-localscope.patch
];

View file

@ -0,0 +1,43 @@
diff -Naur glibc-2.13-orig/elf/ldconfig.c glibc-2.13/elf/ldconfig.c
--- glibc-2.13-orig/elf/ldconfig.c 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/elf/ldconfig.c 2012-04-10 23:28:45.957492340 -0400
@@ -51,7 +51,7 @@
#endif
#ifndef LD_SO_CONF
-# define LD_SO_CONF SYSCONFDIR "/ld.so.conf"
+# define LD_SO_CONF PREFIX "/etc/ld.so.conf"
#endif
/* Get libc version number. */
diff -Naur glibc-2.13-orig/elf/Makefile glibc-2.13/elf/Makefile
--- glibc-2.13-orig/elf/Makefile 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/elf/Makefile 2012-04-10 23:27:05.666477442 -0400
@@ -459,11 +459,11 @@
$(objpfx)sprof: $(libdl)
$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
-SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
-CFLAGS-ldconfig.c = $(SYSCONF-FLAGS) -D'LIBDIR="$(libdir)"' \
+PREFIX-FLAGS := -D'PREFIX="$(prefix)"'
+CFLAGS-ldconfig.c = $(PREFIX-FLAGS) -D'LIBDIR="$(libdir)"' \
-D'SLIBDIR="$(slibdir)"' -DIS_IN_ldconfig=1
-CFLAGS-dl-cache.c = $(SYSCONF-FLAGS)
-CFLAGS-cache.c = $(SYSCONF-FLAGS)
+CFLAGS-dl-cache.c = $(PREFIX-FLAGS)
+CFLAGS-cache.c = $(PREFIX-FLAGS)
CPPFLAGS-.os += $(if $(filter $(@F),$(patsubst %,%.os,$(all-rtld-routines))),-DNOT_IN_libc=1 -DIS_IN_rtld=1)
diff -Naur glibc-2.13-orig/sysdeps/generic/dl-cache.h glibc-2.13/sysdeps/generic/dl-cache.h
--- glibc-2.13-orig/sysdeps/generic/dl-cache.h 2011-01-17 23:34:07.000000000 -0500
+++ glibc-2.13/sysdeps/generic/dl-cache.h 2012-04-10 23:28:20.077488815 -0400
@@ -29,7 +29,7 @@
#endif
#ifndef LD_SO_CACHE
-# define LD_SO_CACHE SYSCONFDIR "/ld.so.cache"
+# define LD_SO_CACHE PREFIX "/etc/ld.so.cache"
#endif
#ifndef add_system_dir