2010-05-19 21:28:57 +00:00
|
|
|
{ fetchgit, stdenv, autoconf, automake, libtool
|
2011-11-01 22:10:45 +00:00
|
|
|
, machHeaders, hurdHeaders, hurd, headersOnly ? false
|
2010-05-19 21:28:57 +00:00
|
|
|
, cross ? null, gccCross ? null, glibcCross ? null }:
|
|
|
|
|
|
|
|
assert (cross != null) -> (gccCross != null) && (glibcCross != null);
|
2011-11-01 22:10:45 +00:00
|
|
|
assert (!headersOnly) -> (hurd != null);
|
2010-05-19 21:28:57 +00:00
|
|
|
|
|
|
|
let
|
2011-11-01 22:10:45 +00:00
|
|
|
date = "20111020";
|
2010-05-19 21:28:57 +00:00
|
|
|
|
2010-06-15 15:01:15 +00:00
|
|
|
# Use the `tschwinge/Peter_Herbolzheimer' branch as prescribed in
|
2010-05-19 21:28:57 +00:00
|
|
|
# <http://www.gnu.org/software/hurd/hurd/building/cross-compiling.html>.
|
2011-11-01 22:10:45 +00:00
|
|
|
rev = "a7b82c3302bf9c47176648eb802a61ae2d9a16f5";
|
2010-05-19 21:28:57 +00:00
|
|
|
in
|
|
|
|
stdenv.mkDerivation ({
|
2011-11-01 22:10:45 +00:00
|
|
|
name = "libpthread-hurd-${if headersOnly then "headers-" else ""}${date}";
|
2010-05-19 21:28:57 +00:00
|
|
|
|
|
|
|
src = fetchgit {
|
|
|
|
url = "git://git.sv.gnu.org/hurd/libpthread.git";
|
2011-11-01 22:10:45 +00:00
|
|
|
sha256 = "e8300762914d927c0da4168341a5982a1057613e1af363ee68942087b2570b3d";
|
2010-05-19 21:28:57 +00:00
|
|
|
inherit rev;
|
|
|
|
};
|
|
|
|
|
2012-12-28 18:20:09 +00:00
|
|
|
nativeBuildInputs = [ autoconf automake libtool ];
|
2011-11-01 22:10:45 +00:00
|
|
|
buildInputs = [ machHeaders hurdHeaders ]
|
|
|
|
++ stdenv.lib.optional (!headersOnly) hurd
|
2010-05-19 21:28:57 +00:00
|
|
|
++ stdenv.lib.optional (gccCross != null) gccCross;
|
|
|
|
|
|
|
|
preConfigure = "autoreconf -vfi";
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
description = "GNU Hurd's libpthread";
|
|
|
|
|
2014-06-19 04:19:00 +00:00
|
|
|
license = stdenv.lib.licenses.lgpl2Plus;
|
2010-05-19 21:28:57 +00:00
|
|
|
|
|
|
|
maintainers = [ stdenv.lib.maintainers.ludo ];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2011-11-01 22:10:45 +00:00
|
|
|
(if headersOnly
|
|
|
|
then {
|
|
|
|
configureFlags =
|
|
|
|
[ "--build=i586-pc-gnu"
|
|
|
|
"ac_cv_lib_ihash_hurd_ihash_create=yes"
|
|
|
|
];
|
|
|
|
|
|
|
|
buildPhase = ":";
|
|
|
|
installPhase = "make install-data-local-headers";
|
|
|
|
}
|
|
|
|
else { })
|
|
|
|
|
|
|
|
//
|
|
|
|
|
2010-05-19 21:28:57 +00:00
|
|
|
(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
|
|
|
|
# <http://lists.gnu.org/archive/html/bug-libtool/2010-05/msg00012.html>.)
|
|
|
|
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.
|
2010-07-15 14:06:09 +00:00
|
|
|
# Note: these are raw `ld' flags, so `-Wl,' must be prepended when using
|
|
|
|
# `gcc'.
|
2010-05-19 21:28:57 +00:00
|
|
|
#
|
|
|
|
# This is actually only useful while building the final cross-gcc, since
|
|
|
|
# afterwards gcc-cross-wrapper should add the relevant flags.
|
2010-07-15 14:06:09 +00:00
|
|
|
TARGET_LDFLAGS = "-rpath-link=${hurd}/lib";
|
2010-05-19 21:28:57 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
else { }))
|