diff --git a/pkgs/os-specific/gnu/libpthread/default.nix b/pkgs/os-specific/gnu/libpthread/default.nix new file mode 100644 index 000000000000..11adc6187912 --- /dev/null +++ b/pkgs/os-specific/gnu/libpthread/default.nix @@ -0,0 +1,65 @@ +{ fetchgit, stdenv, autoconf, automake, libtool +, machHeaders, hurdHeaders, hurd +, cross ? null, gccCross ? null, glibcCross ? null }: + +assert (cross != null) -> (gccCross != null) && (glibcCross != null); + +let + date = "2010-05-12"; + + # Use the weird branch prescribed in + # . + rev = "tschwinge/Peter_Herbolzheimer@{${date}}"; +in +stdenv.mkDerivation ({ + name = "libpthread-hurd-${date}"; + + src = fetchgit { + url = "git://git.sv.gnu.org/hurd/libpthread.git"; + sha256 = "1wya9kfmqgn04l995a25p4hxfwddjahfmhdzljb4cribw0bqdizg"; + inherit rev; + }; + + buildNativeInputs = [ autoconf automake libtool ]; + buildInputs = [ machHeaders hurdHeaders hurd ] + ++ stdenv.lib.optional (gccCross != null) gccCross; + + preConfigure = "autoreconf -vfi"; + + meta = { + description = "GNU Hurd's libpthread"; + + license = "LGPLv2+"; + + maintainers = [ stdenv.lib.maintainers.ludo ]; + }; +} + +// + +(if cross != null + then { + crossConfig = cross.config; + + # Tell gcc where to find `crt1.o' et al. This is specified in two + # different ways: one for gcc as run from `configure', and one for linking + # libpthread.so (by default `libtool --mode=link' swallows `-B', hence + # this workaround; see + # .) + LDFLAGS = "-B${glibcCross}/lib"; + makeFlags = [ "LDFLAGS=-Wc,-B${glibcCross}/lib" ]; + + # Help the linker find glibc. + CPATH = "${glibcCross}/include"; + LIBRARY_PATH = "${glibcCross}/lib"; + + passthru = { + # Extra target LDFLAGS to allow the cross-linker to find the + # dependencies of the cross libpthread.so, namely libihash.so. + # + # This is actually only useful while building the final cross-gcc, since + # afterwards gcc-cross-wrapper should add the relevant flags. + TARGET_LDFLAGS = "-Wl,-rpath-link=${hurd}/lib"; + }; + } + else { })) diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 127e6c09d995..7cf7b4f44b0b 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -6110,6 +6110,14 @@ let headersOnly = true; }; + hurdLibpthreadCross = forceBuildDrv(import ../os-specific/gnu/libpthread { + inherit fetchgit stdenv autoconf automake libtool + machHeaders hurdHeaders glibcCross; + hurd = hurdCrossIntermediate; + gccCross = gccCrossStageStatic; + cross = assert crossSystem != null; crossSystem; + }); + hwdata = import ../os-specific/linux/hwdata { inherit fetchurl stdenv; };