···11-# Glibc cannot have itself in its RPATH.
22-export NIX_NO_SELF_RPATH=1
33-44-source $stdenv/setup
55-66-postConfigure() {
77- # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
88- # This has to be done *after* `configure' because it builds some
99- # test binaries.
1010- export NIX_CFLAGS_LINK=
1111- export NIX_LDFLAGS_BEFORE=
1212-1313- export NIX_DONT_SET_RPATH=1
1414- unset CFLAGS
1515-}
1616-1717-1818-postInstall() {
1919- if test -n "$installLocales"; then
2020- make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
2121- fi
2222-2323- test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
2424-2525- # FIXME: Use `test -n $linuxHeaders' when `kernelHeaders' has been
2626- # renamed.
2727- if test -z "$hurdHeaders"; then
2828- # Include the Linux kernel headers in Glibc, except the `scsi'
2929- # subdirectory, which Glibc provides itself.
3030- (cd $out/include && \
3131- ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
3232- fi
3333-3434- if test -f "$out/lib/libhurduser.so"; then
3535- # libc.so, libhurduser.so, and libmachuser.so depend on each
3636- # other, so add them to libc.so (a RUNPATH on libc.so.0.3
3737- # would be ignored by the cross-linker.)
3838- echo "adding \`libhurduser.so' and \`libmachuser.so' to the \`libc.so' linker script..."
3939- sed -i "$out/lib/libc.so" \
4040- -e"s|\(libc\.so\.[^ ]\+\>\)|\1 $out/lib/libhurduser.so $out/lib/libmachuser.so|g"
4141- fi
4242-4343- # Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
4444- # "lib64" to "lib".
4545- if test -n "$is64bit"; then
4646- ln -s lib $out/lib64
4747- fi
4848-4949- # This file, that should not remain in the glibc derivation,
5050- # may have not been created during the preInstall
5151- rm -f $out/lib/libgcc_s.so.1
5252-}
5353-5454-genericBuild
-223
pkgs/development/libraries/glibc/2.14/common.nix
···11-/* Build configuration used to build glibc, Info files, and locale
22- information. */
33-44-cross :
55-66-{ name, fetchurl, stdenv, installLocales ? false
77-, gccCross ? null, kernelHeaders ? null
88-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
99-, mig ? null, fetchgit ? null
1010-, profilingLibraries ? false, meta
1111-, preConfigure ? "", ... }@args :
1212-1313-let
1414- # For GNU/Hurd, see below.
1515- version = if hurdHeaders != null then "20111025" else "2.14.1";
1616-1717- needsPortsNative = stdenv.isMips || stdenv.isArm;
1818- needsPortsCross = cross.arch == "mips" || cross.arch == "arm";
1919- needsPorts = if (stdenv ? cross) && stdenv.cross != null then true
2020- else if cross == null then needsPortsNative
2121- else needsPortsCross;
2222-2323- srcPorts = fetchurl {
2424- url = "mirror://gnu/glibc/glibc-ports-2.14.1.tar.bz2";
2525- sha256 = "1acs4sd5mjzmssmd0md6dfqwnziph2am7v09mbnnd8aadpxhm0qw";
2626- };
2727-2828-in
2929-3030-assert (cross != null) -> (gccCross != null);
3131-3232-assert (mig != null) -> (machHeaders != null);
3333-assert (machHeaders != null) -> (hurdHeaders != null);
3434-assert (hurdHeaders != null) -> (libpthreadHeaders != null);
3535-assert (hurdHeaders != null) -> (fetchgit != null);
3636-3737-stdenv.mkDerivation ({
3838- inherit kernelHeaders installLocales;
3939-4040- # The host/target system.
4141- crossConfig = if (cross != null) then cross.config else null;
4242-4343- inherit (stdenv) is64bit;
4444-4545- enableParallelBuilding = true;
4646-4747- patches =
4848- stdenv.lib.optional (fetchgit == null)
4949- /* Fix for NIXPKGS-79: when doing host name lookups, when
5050- nsswitch.conf contains a line like
5151-5252- hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
5353-5454- don't return an error when mdns4_minimal can't be found. This
5555- is a bug in Glibc: when a service can't be found, NSS should
5656- continue to the next service unless "UNAVAIL=return" is set.
5757- ("NOTFOUND=return" refers to the service returning a NOTFOUND
5858- error, not the service itself not being found.) The reason is
5959- that the "status" variable (while initialised to UNAVAIL) is
6060- outside of the loop that iterates over the services, the
6161- "files" service sets status to NOTFOUND. So when the call to
6262- find "mdns4_minimal" fails, "status" will still be NOTFOUND,
6363- and it will return instead of continuing to "dns". Thus, the
6464- line
6565-6666- hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
6767-6868- does work because "status" will contain UNAVAIL after the
6969- failure to find mdns4_minimal. */
7070- ./nss-skip-unavail.patch
7171- ++ [
7272- /* Have rpcgen(1) look for cpp(1) in $PATH. */
7373- ./rpcgen-path.patch
7474-7575- /* Allow nixos and nix handle the locale-archive. */
7676- ./nix-locale-archive.patch
7777-7878- /* don't use /etc/ld.so.cache, for non-nixos systems */
7979- ./dont_use_system_ld_so_cache.patch
8080-8181- /* Without this patch many KDE binaries crash. */
8282- ./glibc-elf-localscope.patch
8383- ];
8484-8585- postPatch = ''
8686- # Needed for glibc to build with the gnumake 3.82
8787- # http://comments.gmane.org/gmane.linux.lfs.support/31227
8888- sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
8989-9090- # nscd needs libgcc, and we don't want it dynamically linked
9191- # because we don't want it to depend on bootstrap-tools libs.
9292- echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
9393- '';
9494-9595- configureFlags = [
9696- "-C"
9797- "--enable-add-ons"
9898- "--sysconfdir=/etc"
9999- "--localedir=/var/run/current-system/sw/lib/locale"
100100- "libc_cv_ssp=no"
101101- (if kernelHeaders != null
102102- then "--with-headers=${kernelHeaders}/include"
103103- else "--without-headers")
104104- (if profilingLibraries
105105- then "--enable-profile"
106106- else "--disable-profile")
107107- ] ++ stdenv.lib.optionals (cross != null) [
108108- (if cross.withTLS then "--with-tls" else "--without-tls")
109109- (if cross.float == "soft" then "--without-fp" else "--with-fp")
110110- "--enable-kernel=2.6.0"
111111- "--with-__thread"
112112- ] ++ stdenv.lib.optionals stdenv.isArm [
113113- "--host=arm-linux-gnueabi"
114114- "--build=arm-linux-gnueabi"
115115- "--without-fp"
116116-117117- # To avoid linking with -lgcc_s (dynamic link)
118118- # so the glibc does not depend on its compiler store path
119119- "libc_cv_as_needed=no"
120120- ];
121121-122122- installFlags = [ "sysconfdir=$(out)/etc" ];
123123-124124- buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]
125125- ++ stdenv.lib.optional (mig != null) mig;
126126-127127- # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
128128- # prevent a retained dependency on the bootstrap tools in the stdenv-linux
129129- # bootstrap.
130130- BASH_SHELL = "/bin/sh";
131131-132132- # Workaround for this bug:
133133- # http://sourceware.org/bugzilla/show_bug.cgi?id=411
134134- # I.e. when gcc is compiled with --with-arch=i686, then the
135135- # preprocessor symbol `__i686' will be defined to `1'. This causes
136136- # the symbol __i686.get_pc_thunk.dx to be mangled.
137137- NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.system == "i686-linux") "-U__i686";
138138-}
139139-140140-# Remove the `gccCross' attribute so that the *native* glibc store path
141141-# doesn't depend on whether `gccCross' is null or not.
142142-// (removeAttrs args [ "gccCross" ]) //
143143-144144-{
145145- name = name + "-${version}" +
146146- stdenv.lib.optionalString (cross != null) "-${cross.config}";
147147-148148- src =
149149- if hurdHeaders != null
150150- then fetchgit {
151151- # Shamefully the "official" glibc won't build on GNU, so use the one
152152- # maintained by the Hurd folks, `tschwinge/Roger_Whittaker' branch.
153153- # See <http://www.gnu.org/software/hurd/source_repositories/glibc.html>.
154154- url = "git://git.sv.gnu.org/hurd/glibc.git";
155155- sha256 = "3fb3dd7030a4b6d3e144fa94c32a0c4f46f17f94e2dfbc6bef41cfc3198725ca";
156156- rev = "d740cf9d201dc9ecb0335b0a585828dea9cce793";
157157- }
158158- else fetchurl {
159159- url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
160160- sha256 = "0fsvf5d6sib483rp7asdy8hs0dysxqkrvw316c82hsxy7vxa51bf";
161161- };
162162-163163- # `fetchurl' is a function and thus should not be passed to the
164164- # `derivation' primitive.
165165- fetchurl = null;
166166-167167- # Remove absolute paths from `configure' & co.; build out-of-tree.
168168- preConfigure = ''
169169- export PWD_P=$(type -tP pwd)
170170- for i in configure io/ftwtest-sh; do
171171- # Can't use substituteInPlace here because replace hasn't been
172172- # built yet in the bootstrap.
173173- sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
174174- done
175175-176176- ${if needsPorts then "tar xvf ${srcPorts}" else ""}
177177-178178- mkdir ../build
179179- cd ../build
180180-181181- configureScript="`pwd`/../$sourceRoot/configure"
182182-183183- ${preConfigure}
184184- '';
185185-186186- meta = {
187187- homepage = http://www.gnu.org/software/libc/;
188188- description = "The GNU C Library";
189189-190190- longDescription =
191191- '' Any Unix-like operating system needs a C library: the library which
192192- defines the "system calls" and other basic facilities such as
193193- open, malloc, printf, exit...
194194-195195- The GNU C library is used as the C library in the GNU system and
196196- most systems with the Linux kernel.
197197- '';
198198-199199- license = "LGPLv2+";
200200-201201- maintainers = [ stdenv.lib.maintainers.ludo ];
202202- #platforms = stdenv.lib.platforms.linux;
203203- } // meta;
204204-}
205205-206206-//
207207-208208-(if hurdHeaders != null
209209- then {
210210- # Work around the fact that the configure snippet that looks for
211211- # <hurd/version.h> does not honor `--with-headers=$sysheaders' and that
212212- # glibc expects Mach, Hurd, and pthread headers to be in the same place.
213213- CPATH = "${hurdHeaders}/include:${machHeaders}/include:${libpthreadHeaders}/include";
214214-215215- # `fetchgit' is a function and thus should not be passed to the
216216- # `derivation' primitive.
217217- fetchgit = null;
218218-219219- # Install NSS stuff in the right place.
220220- # XXX: This will be needed for all new glibcs and isn't Hurd-specific.
221221- makeFlags = ''vardbdir="$out/var/db"'';
222222- }
223223- else { }))
-97
pkgs/development/libraries/glibc/2.14/default.nix
···11-{ stdenv, fetchurl, kernelHeaders
22-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
33-, mig ? null, fetchgit ? null
44-, installLocales ? true
55-, profilingLibraries ? false
66-, gccCross ? null
77-, debugSymbols ? false
88-}:
99-1010-assert stdenv.gcc.gcc != null;
1111-1212-let
1313- build = import ./common.nix;
1414- cross = if gccCross != null then gccCross.target else null;
1515-in
1616- build cross ({
1717- name = "glibc${if debugSymbols then "-debug" else ""}";
1818-1919- inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
2020- gccCross;
2121-2222- builder = ./builder.sh;
2323-2424- # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
2525- # any program we run, because the gcc will have been placed at a new
2626- # store path than that determined when built (as a source for the
2727- # bootstrap-tools tarball)
2828- # Building from a proper gcc staying in the path where it was installed,
2929- # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
3030- # any special hack.
3131- preInstall = ''
3232- if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
3333- mkdir -p $out/lib
3434- ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
3535- fi
3636- '';
3737-3838- meta.description = "The GNU C Library";
3939- }
4040-4141- //
4242-4343- (if debugSymbols
4444- then {
4545- # Build with debugging symbols, but leave optimizations on and don't
4646- # attempt to keep the build tree.
4747- dontStrip = true;
4848- dontCrossStrip = true;
4949- NIX_STRIP_DEBUG = 0;
5050- }
5151- else {})
5252-5353- //
5454-5555- (if hurdHeaders != null
5656- then rec {
5757- inherit machHeaders hurdHeaders libpthreadHeaders mig fetchgit;
5858-5959- propagatedBuildInputs = [ machHeaders hurdHeaders libpthreadHeaders ];
6060-6161- passthru = {
6262- # When building GCC itself `propagatedBuildInputs' above is not
6363- # honored, so we pass it here so that the GCC builder can do the right
6464- # thing.
6565- inherit propagatedBuildInputs;
6666- };
6767- }
6868- else { })
6969-7070- //
7171-7272- (if cross != null
7373- then {
7474- preConfigure = ''
7575- sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
7676-7777- cat > config.cache << "EOF"
7878- libc_cv_forced_unwind=yes
7979- libc_cv_c_cleanup=yes
8080- libc_cv_gnu89_inline=yes
8181- # Only due to a problem in gcc configure scripts:
8282- libc_cv_sparc64_tls=${if cross.withTLS then "yes" else "no"}
8383- EOF
8484- export BUILD_CC=gcc
8585- export CC="$crossConfig-gcc"
8686- export AR="$crossConfig-ar"
8787- export RANLIB="$crossConfig-ranlib"
8888-8989- dontStrip=1
9090- '';
9191-9292- # To avoid a dependency on the build system 'bash'.
9393- preFixup = ''
9494- rm $out/bin/{ldd,tzselect,catchsegv,xtrace}
9595- '';
9696- }
9797- else {}))
···11-diff -ru a/elf/dl-close.c b/elf/dl-close.c
22---- a/elf/dl-close.c 2011-02-04 00:35:03.000000000 +0100
33-+++ b/elf/dl-close.c 2011-02-22 02:16:12.367883000 +0100
44-@@ -180,24 +186,28 @@
55- /* Signal the object is still needed. */
66- l->l_idx = IDX_STILL_USED;
77-88-+#define mark_used(dmap) \
99-+ do { \
1010-+ if ((dmap)->l_idx != IDX_STILL_USED) \
1111-+ { \
1212-+ assert ((dmap)->l_idx >= 0 && (dmap)->l_idx < nloaded); \
1313-+ \
1414-+ if (!used[(dmap)->l_idx]) \
1515-+ { \
1616-+ used[(dmap)->l_idx] = 1; \
1717-+ if ((dmap)->l_idx - 1 < done_index) \
1818-+ done_index = (dmap)->l_idx - 1; \
1919-+ } \
2020-+ } \
2121-+ } while (0)
2222-+
2323- /* Mark all dependencies as used. */
2424- if (l->l_initfini != NULL)
2525- {
2626- struct link_map **lp = &l->l_initfini[1];
2727- while (*lp != NULL)
2828- {
2929-- if ((*lp)->l_idx != IDX_STILL_USED)
3030-- {
3131-- assert ((*lp)->l_idx >= 0 && (*lp)->l_idx < nloaded);
3232--
3333-- if (!used[(*lp)->l_idx])
3434-- {
3535-- used[(*lp)->l_idx] = 1;
3636-- if ((*lp)->l_idx - 1 < done_index)
3737-- done_index = (*lp)->l_idx - 1;
3838-- }
3939-- }
4040--
4141-+ mark_used(*lp);
4242- ++lp;
4343- }
4444- }
4545-@@ -206,19 +216,25 @@
4646- for (unsigned int j = 0; j < l->l_reldeps->act; ++j)
4747- {
4848- struct link_map *jmap = l->l_reldeps->list[j];
4949--
5050-- if (jmap->l_idx != IDX_STILL_USED)
5151-- {
5252-- assert (jmap->l_idx >= 0 && jmap->l_idx < nloaded);
5353--
5454-- if (!used[jmap->l_idx])
5555-- {
5656-- used[jmap->l_idx] = 1;
5757-- if (jmap->l_idx - 1 < done_index)
5858-- done_index = jmap->l_idx - 1;
5959-- }
6060-- }
6161-+ mark_used(jmap);
6262- }
6363-+ /* And the same for owners of our scopes; normally, our last
6464-+ scope provider would render us unused, but this can be
6565-+ prevented by the NODELETE flag. */
6666-+ if (__builtin_expect(l->l_type == lt_loaded
6767-+ && (l->l_flags_1 & DF_1_NODELETE), 0))
6868-+ for (size_t cnt = 0; l->l_scope[cnt] != NULL; ++cnt)
6969-+ /* This relies on l_scope[] entries being always set either
7070-+ to its own l_symbolic_searchlist address, or some map's
7171-+ l_searchlist address. */
7272-+ if (l->l_scope[cnt] != &l->l_symbolic_searchlist)
7373-+ {
7474-+ struct link_map *ls = (struct link_map *)
7575-+ ((char *) l->l_scope[cnt]
7676-+ - offsetof (struct link_map, l_searchlist));
7777-+ assert (ls->l_ns == nsid);
7878-+ mark_used(ls);
7979-+ }
8080- }
8181-8282- /* Sort the entries. */
-26
pkgs/development/libraries/glibc/2.14/info.nix
···11-{ stdenv, fetchurl, texinfo, perl }:
22-33-let build = import ./common.nix;
44-in
55- /* null cross builder */
66- build null {
77- name = "glibc-info";
88-99- inherit fetchurl stdenv;
1010-1111- configureFlags = [ "--enable-add-ons" ];
1212-1313- buildInputs = [ texinfo perl ];
1414-1515- buildPhase = "make info";
1616-1717- # I don't know why the info is not generated in 'build'
1818- # Somehow building the info still does not work, because the final
1919- # libc.info hasn't a Top node.
2020- installPhase = ''
2121- mkdir -p "$out/share/info"
2222- cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
2323- '';
2424-2525- meta.description = "GNU Info manual of the GNU C Library";
2626- }
···11-# Glibc cannot have itself in its RPATH.
22-export NIX_NO_SELF_RPATH=1
33-44-source $stdenv/setup
55-66-postConfigure() {
77- # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
88- # This has to be done *after* `configure' because it builds some
99- # test binaries.
1010- export NIX_CFLAGS_LINK=
1111- export NIX_LDFLAGS_BEFORE=
1212-1313- export NIX_DONT_SET_RPATH=1
1414- unset CFLAGS
1515-}
1616-1717-genericBuild
-47
pkgs/development/libraries/glibc/2.14/locales.nix
···11-/* This function builds just the `lib/locale/locale-archive' file from
22- Glibc and nothing else. If `allLocales' is true, all supported
33- locales are included; otherwise, just the locales listed in
44- `locales'. See localedata/SUPPORTED in the Glibc source tree for
55- the list of all supported locales:
66- http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
77-*/
88-99-{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
1010-1111-let build = import ./common.nix;
1212-in
1313- build null {
1414- name = "glibc-locales";
1515-1616- inherit fetchurl stdenv;
1717- installLocales = true;
1818-1919- builder = ./locales-builder.sh;
2020-2121- # Awful hack: `localedef' doesn't allow the path to `locale-archive'
2222- # to be overriden, but you *can* specify a prefix, i.e. it will use
2323- # <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use
2424- # $TMPDIR as a prefix, meaning that the locale-archive is placed in
2525- # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
2626- buildPhase =
2727- ''
2828- mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
2929-3030- # Hack to allow building of the locales (needed since glibc-2.12)
3131- sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
3232- /library-path/d ../glibc-2*/localedata/Makefile
3333- ${if allLocales then "" else
3434- "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
3535-3636- make localedata/install-locales \
3737- localedir=$out/lib/locale \
3838- '';
3939-4040- installPhase =
4141- ''
4242- mkdir -p "$out/lib/locale"
4343- cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
4444- '';
4545-4646- meta.description = "Locale information for the GNU C Library";
4747- }