···1-# Glibc cannot have itself in its RPATH.
2-export NIX_NO_SELF_RPATH=1
3-4-source $stdenv/setup
5-6-postConfigure() {
7- # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
8- # This has to be done *after* `configure' because it builds some
9- # test binaries.
10- export NIX_CFLAGS_LINK=
11- export NIX_LDFLAGS_BEFORE=
12-13- export NIX_DONT_SET_RPATH=1
14- unset CFLAGS
15-}
16-17-18-postInstall() {
19- if test -n "$installLocales"; then
20- make -j${NIX_BUILD_CORES:-1} -l${NIX_BUILD_CORES:-1} localedata/install-locales
21- fi
22-23- test -f $out/etc/ld.so.cache && rm $out/etc/ld.so.cache
24-25- # FIXME: Use `test -n $linuxHeaders' when `kernelHeaders' has been
26- # renamed.
27- if test -z "$hurdHeaders"; then
28- # Include the Linux kernel headers in Glibc, except the `scsi'
29- # subdirectory, which Glibc provides itself.
30- (cd $out/include && \
31- ln -sv $(ls -d $kernelHeaders/include/* | grep -v 'scsi$') .)
32- fi
33-34- if test -f "$out/lib/libhurduser.so"; then
35- # libc.so, libhurduser.so, and libmachuser.so depend on each
36- # other, so add them to libc.so (a RUNPATH on libc.so.0.3
37- # would be ignored by the cross-linker.)
38- echo "adding \`libhurduser.so' and \`libmachuser.so' to the \`libc.so' linker script..."
39- sed -i "$out/lib/libc.so" \
40- -e"s|\(libc\.so\.[^ ]\+\>\)|\1 $out/lib/libhurduser.so $out/lib/libmachuser.so|g"
41- fi
42-43- # Fix for NIXOS-54 (ldd not working on x86_64). Make a symlink
44- # "lib64" to "lib".
45- if test -n "$is64bit"; then
46- ln -s lib $out/lib64
47- fi
48-49- # This file, that should not remain in the glibc derivation,
50- # may have not been created during the preInstall
51- rm -f $out/lib/libgcc_s.so.1
52-}
53-54-genericBuild
···1-/* Build configuration used to build glibc, Info files, and locale
2- information. */
3-4-cross :
5-6-{ name, fetchurl, stdenv, installLocales ? false
7-, gccCross ? null, kernelHeaders ? null
8-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
9-, mig ? null, fetchgit ? null
10-, profilingLibraries ? false, meta
11-, preConfigure ? "", ... }@args :
12-13-let
14- # For GNU/Hurd, see below.
15- version = if hurdHeaders != null then "20111025" else "2.14.1";
16-17- needsPortsNative = stdenv.isMips || stdenv.isArm;
18- needsPortsCross = cross.arch == "mips" || cross.arch == "arm";
19- needsPorts = if (stdenv ? cross) && stdenv.cross != null then true
20- else if cross == null then needsPortsNative
21- else needsPortsCross;
22-23- srcPorts = fetchurl {
24- url = "mirror://gnu/glibc/glibc-ports-2.14.1.tar.bz2";
25- sha256 = "1acs4sd5mjzmssmd0md6dfqwnziph2am7v09mbnnd8aadpxhm0qw";
26- };
27-28-in
29-30-assert (cross != null) -> (gccCross != null);
31-32-assert (mig != null) -> (machHeaders != null);
33-assert (machHeaders != null) -> (hurdHeaders != null);
34-assert (hurdHeaders != null) -> (libpthreadHeaders != null);
35-assert (hurdHeaders != null) -> (fetchgit != null);
36-37-stdenv.mkDerivation ({
38- inherit kernelHeaders installLocales;
39-40- # The host/target system.
41- crossConfig = if (cross != null) then cross.config else null;
42-43- inherit (stdenv) is64bit;
44-45- enableParallelBuilding = true;
46-47- patches =
48- stdenv.lib.optional (fetchgit == null)
49- /* Fix for NIXPKGS-79: when doing host name lookups, when
50- nsswitch.conf contains a line like
51-52- hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4
53-54- don't return an error when mdns4_minimal can't be found. This
55- is a bug in Glibc: when a service can't be found, NSS should
56- continue to the next service unless "UNAVAIL=return" is set.
57- ("NOTFOUND=return" refers to the service returning a NOTFOUND
58- error, not the service itself not being found.) The reason is
59- that the "status" variable (while initialised to UNAVAIL) is
60- outside of the loop that iterates over the services, the
61- "files" service sets status to NOTFOUND. So when the call to
62- find "mdns4_minimal" fails, "status" will still be NOTFOUND,
63- and it will return instead of continuing to "dns". Thus, the
64- line
65-66- hosts: mdns4_minimal [NOTFOUND=return] dns mdns4
67-68- does work because "status" will contain UNAVAIL after the
69- failure to find mdns4_minimal. */
70- ./nss-skip-unavail.patch
71- ++ [
72- /* Have rpcgen(1) look for cpp(1) in $PATH. */
73- ./rpcgen-path.patch
74-75- /* Allow nixos and nix handle the locale-archive. */
76- ./nix-locale-archive.patch
77-78- /* don't use /etc/ld.so.cache, for non-nixos systems */
79- ./dont_use_system_ld_so_cache.patch
80-81- /* Without this patch many KDE binaries crash. */
82- ./glibc-elf-localscope.patch
83- ];
84-85- postPatch = ''
86- # Needed for glibc to build with the gnumake 3.82
87- # http://comments.gmane.org/gmane.linux.lfs.support/31227
88- sed -i 's/ot \$/ot:\n\ttouch $@\n$/' manual/Makefile
89-90- # nscd needs libgcc, and we don't want it dynamically linked
91- # because we don't want it to depend on bootstrap-tools libs.
92- echo "LDFLAGS-nscd += -static-libgcc" >> nscd/Makefile
93- '';
94-95- configureFlags = [
96- "-C"
97- "--enable-add-ons"
98- "--sysconfdir=/etc"
99- "--localedir=/var/run/current-system/sw/lib/locale"
100- "libc_cv_ssp=no"
101- (if kernelHeaders != null
102- then "--with-headers=${kernelHeaders}/include"
103- else "--without-headers")
104- (if profilingLibraries
105- then "--enable-profile"
106- else "--disable-profile")
107- ] ++ stdenv.lib.optionals (cross != null) [
108- (if cross.withTLS then "--with-tls" else "--without-tls")
109- (if cross.float == "soft" then "--without-fp" else "--with-fp")
110- "--enable-kernel=2.6.0"
111- "--with-__thread"
112- ] ++ stdenv.lib.optionals stdenv.isArm [
113- "--host=arm-linux-gnueabi"
114- "--build=arm-linux-gnueabi"
115- "--without-fp"
116-117- # To avoid linking with -lgcc_s (dynamic link)
118- # so the glibc does not depend on its compiler store path
119- "libc_cv_as_needed=no"
120- ];
121-122- installFlags = [ "sysconfdir=$(out)/etc" ];
123-124- buildInputs = stdenv.lib.optionals (cross != null) [ gccCross ]
125- ++ stdenv.lib.optional (mig != null) mig;
126-127- # Needed to install share/zoneinfo/zone.tab. Set to impure /bin/sh to
128- # prevent a retained dependency on the bootstrap tools in the stdenv-linux
129- # bootstrap.
130- BASH_SHELL = "/bin/sh";
131-132- # Workaround for this bug:
133- # http://sourceware.org/bugzilla/show_bug.cgi?id=411
134- # I.e. when gcc is compiled with --with-arch=i686, then the
135- # preprocessor symbol `__i686' will be defined to `1'. This causes
136- # the symbol __i686.get_pc_thunk.dx to be mangled.
137- NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (stdenv.system == "i686-linux") "-U__i686";
138-}
139-140-# Remove the `gccCross' attribute so that the *native* glibc store path
141-# doesn't depend on whether `gccCross' is null or not.
142-// (removeAttrs args [ "gccCross" ]) //
143-144-{
145- name = name + "-${version}" +
146- stdenv.lib.optionalString (cross != null) "-${cross.config}";
147-148- src =
149- if hurdHeaders != null
150- then fetchgit {
151- # Shamefully the "official" glibc won't build on GNU, so use the one
152- # maintained by the Hurd folks, `tschwinge/Roger_Whittaker' branch.
153- # See <http://www.gnu.org/software/hurd/source_repositories/glibc.html>.
154- url = "git://git.sv.gnu.org/hurd/glibc.git";
155- sha256 = "3fb3dd7030a4b6d3e144fa94c32a0c4f46f17f94e2dfbc6bef41cfc3198725ca";
156- rev = "d740cf9d201dc9ecb0335b0a585828dea9cce793";
157- }
158- else fetchurl {
159- url = "mirror://gnu/glibc/glibc-${version}.tar.bz2";
160- sha256 = "0fsvf5d6sib483rp7asdy8hs0dysxqkrvw316c82hsxy7vxa51bf";
161- };
162-163- # `fetchurl' is a function and thus should not be passed to the
164- # `derivation' primitive.
165- fetchurl = null;
166-167- # Remove absolute paths from `configure' & co.; build out-of-tree.
168- preConfigure = ''
169- export PWD_P=$(type -tP pwd)
170- for i in configure io/ftwtest-sh; do
171- # Can't use substituteInPlace here because replace hasn't been
172- # built yet in the bootstrap.
173- sed -i "$i" -e "s^/bin/pwd^$PWD_P^g"
174- done
175-176- ${if needsPorts then "tar xvf ${srcPorts}" else ""}
177-178- mkdir ../build
179- cd ../build
180-181- configureScript="`pwd`/../$sourceRoot/configure"
182-183- ${preConfigure}
184- '';
185-186- meta = {
187- homepage = http://www.gnu.org/software/libc/;
188- description = "The GNU C Library";
189-190- longDescription =
191- '' Any Unix-like operating system needs a C library: the library which
192- defines the "system calls" and other basic facilities such as
193- open, malloc, printf, exit...
194-195- The GNU C library is used as the C library in the GNU system and
196- most systems with the Linux kernel.
197- '';
198-199- license = "LGPLv2+";
200-201- maintainers = [ stdenv.lib.maintainers.ludo ];
202- #platforms = stdenv.lib.platforms.linux;
203- } // meta;
204-}
205-206-//
207-208-(if hurdHeaders != null
209- then {
210- # Work around the fact that the configure snippet that looks for
211- # <hurd/version.h> does not honor `--with-headers=$sysheaders' and that
212- # glibc expects Mach, Hurd, and pthread headers to be in the same place.
213- CPATH = "${hurdHeaders}/include:${machHeaders}/include:${libpthreadHeaders}/include";
214-215- # `fetchgit' is a function and thus should not be passed to the
216- # `derivation' primitive.
217- fetchgit = null;
218-219- # Install NSS stuff in the right place.
220- # XXX: This will be needed for all new glibcs and isn't Hurd-specific.
221- makeFlags = ''vardbdir="$out/var/db"'';
222- }
223- else { }))
···1-{ stdenv, fetchurl, kernelHeaders
2-, machHeaders ? null, hurdHeaders ? null, libpthreadHeaders ? null
3-, mig ? null, fetchgit ? null
4-, installLocales ? true
5-, profilingLibraries ? false
6-, gccCross ? null
7-, debugSymbols ? false
8-}:
9-10-assert stdenv.gcc.gcc != null;
11-12-let
13- build = import ./common.nix;
14- cross = if gccCross != null then gccCross.target else null;
15-in
16- build cross ({
17- name = "glibc${if debugSymbols then "-debug" else ""}";
18-19- inherit fetchurl stdenv kernelHeaders installLocales profilingLibraries
20- gccCross;
21-22- builder = ./builder.sh;
23-24- # When building glibc from bootstrap-tools, we need libgcc_s at RPATH for
25- # any program we run, because the gcc will have been placed at a new
26- # store path than that determined when built (as a source for the
27- # bootstrap-tools tarball)
28- # Building from a proper gcc staying in the path where it was installed,
29- # libgcc_s will not be at {gcc}/lib, and gcc's libgcc will be found without
30- # any special hack.
31- preInstall = ''
32- if [ -f ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 ]; then
33- mkdir -p $out/lib
34- ln -s ${stdenv.gcc.gcc}/lib/libgcc_s.so.1 $out/lib/libgcc_s.so.1
35- fi
36- '';
37-38- meta.description = "The GNU C Library";
39- }
40-41- //
42-43- (if debugSymbols
44- then {
45- # Build with debugging symbols, but leave optimizations on and don't
46- # attempt to keep the build tree.
47- dontStrip = true;
48- dontCrossStrip = true;
49- NIX_STRIP_DEBUG = 0;
50- }
51- else {})
52-53- //
54-55- (if hurdHeaders != null
56- then rec {
57- inherit machHeaders hurdHeaders libpthreadHeaders mig fetchgit;
58-59- propagatedBuildInputs = [ machHeaders hurdHeaders libpthreadHeaders ];
60-61- passthru = {
62- # When building GCC itself `propagatedBuildInputs' above is not
63- # honored, so we pass it here so that the GCC builder can do the right
64- # thing.
65- inherit propagatedBuildInputs;
66- };
67- }
68- else { })
69-70- //
71-72- (if cross != null
73- then {
74- preConfigure = ''
75- sed -i s/-lgcc_eh//g "../$sourceRoot/Makeconfig"
76-77- cat > config.cache << "EOF"
78- libc_cv_forced_unwind=yes
79- libc_cv_c_cleanup=yes
80- libc_cv_gnu89_inline=yes
81- # Only due to a problem in gcc configure scripts:
82- libc_cv_sparc64_tls=${if cross.withTLS then "yes" else "no"}
83- EOF
84- export BUILD_CC=gcc
85- export CC="$crossConfig-gcc"
86- export AR="$crossConfig-ar"
87- export RANLIB="$crossConfig-ranlib"
88-89- dontStrip=1
90- '';
91-92- # To avoid a dependency on the build system 'bash'.
93- preFixup = ''
94- rm $out/bin/{ldd,tzselect,catchsegv,xtrace}
95- '';
96- }
97- else {}))
···1-{ stdenv, fetchurl, texinfo, perl }:
2-3-let build = import ./common.nix;
4-in
5- /* null cross builder */
6- build null {
7- name = "glibc-info";
8-9- inherit fetchurl stdenv;
10-11- configureFlags = [ "--enable-add-ons" ];
12-13- buildInputs = [ texinfo perl ];
14-15- buildPhase = "make info";
16-17- # I don't know why the info is not generated in 'build'
18- # Somehow building the info still does not work, because the final
19- # libc.info hasn't a Top node.
20- installPhase = ''
21- mkdir -p "$out/share/info"
22- cp -v "../$sourceRoot/manual/"*.info* "$out/share/info"
23- '';
24-25- meta.description = "GNU Info manual of the GNU C Library";
26- }
···1-# Glibc cannot have itself in its RPATH.
2-export NIX_NO_SELF_RPATH=1
3-4-source $stdenv/setup
5-6-postConfigure() {
7- # Hack: get rid of the `-static' flag set by the bootstrap stdenv.
8- # This has to be done *after* `configure' because it builds some
9- # test binaries.
10- export NIX_CFLAGS_LINK=
11- export NIX_LDFLAGS_BEFORE=
12-13- export NIX_DONT_SET_RPATH=1
14- unset CFLAGS
15-}
16-17-genericBuild
···00000000000000000
-47
pkgs/development/libraries/glibc/2.14/locales.nix
···1-/* This function builds just the `lib/locale/locale-archive' file from
2- Glibc and nothing else. If `allLocales' is true, all supported
3- locales are included; otherwise, just the locales listed in
4- `locales'. See localedata/SUPPORTED in the Glibc source tree for
5- the list of all supported locales:
6- http://sourceware.org/cgi-bin/cvsweb.cgi/libc/localedata/SUPPORTED?cvsroot=glibc
7-*/
8-9-{ stdenv, fetchurl, allLocales ? true, locales ? ["en_US.UTF-8/UTF-8"] }:
10-11-let build = import ./common.nix;
12-in
13- build null {
14- name = "glibc-locales";
15-16- inherit fetchurl stdenv;
17- installLocales = true;
18-19- builder = ./locales-builder.sh;
20-21- # Awful hack: `localedef' doesn't allow the path to `locale-archive'
22- # to be overriden, but you *can* specify a prefix, i.e. it will use
23- # <prefix>/<path-to-glibc>/lib/locale/locale-archive. So we use
24- # $TMPDIR as a prefix, meaning that the locale-archive is placed in
25- # $TMPDIR/nix/store/...-glibc-.../lib/locale/locale-archive.
26- buildPhase =
27- ''
28- mkdir -p $TMPDIR/"$(dirname $(readlink -f $(type -p localedef)))/../lib/locale"
29-30- # Hack to allow building of the locales (needed since glibc-2.12)
31- sed -i -e "s,^LOCALEDEF=.*,LOCALEDEF=localedef --prefix=$TMPDIR," -e \
32- /library-path/d ../glibc-2*/localedata/Makefile
33- ${if allLocales then "" else
34- "echo SUPPORTED-LOCALES=\"${toString locales}\" > ../glibc-2*/localedata/SUPPORTED"}
35-36- make localedata/install-locales \
37- localedir=$out/lib/locale \
38- '';
39-40- installPhase =
41- ''
42- mkdir -p "$out/lib/locale"
43- cp -v "$TMPDIR/nix/store/"*"/lib/locale/locale-archive" "$out/lib/locale"
44- '';
45-46- meta.description = "Locale information for the GNU C Library";
47- }