at 16.09-beta 83 lines 2.4 kB view raw
1{ fetchgit, stdenv, autoconf, automake, libtool 2, machHeaders, hurdHeaders, hurd, headersOnly ? false 3, cross ? null, gccCross ? null, glibcCross ? null }: 4 5assert (cross != null) -> (gccCross != null) && (glibcCross != null); 6assert (!headersOnly) -> (hurd != null); 7 8let 9 date = "20111020"; 10 11 # Use the `tschwinge/Peter_Herbolzheimer' branch as prescribed in 12 # <http://www.gnu.org/software/hurd/hurd/building/cross-compiling.html>. 13 rev = "a7b82c3302bf9c47176648eb802a61ae2d9a16f5"; 14in 15stdenv.mkDerivation ({ 16 name = "libpthread-hurd-${if headersOnly then "headers-" else ""}${date}"; 17 18 src = fetchgit { 19 url = "git://git.sv.gnu.org/hurd/libpthread.git"; 20 sha256 = "e8300762914d927c0da4168341a5982a1057613e1af363ee68942087b2570b3d"; 21 inherit rev; 22 }; 23 24 nativeBuildInputs = [ autoconf automake libtool ]; 25 buildInputs = [ machHeaders hurdHeaders ] 26 ++ stdenv.lib.optional (!headersOnly) hurd 27 ++ stdenv.lib.optional (gccCross != null) gccCross; 28 29 preConfigure = "autoreconf -vfi"; 30 31 meta = { 32 description = "GNU Hurd's libpthread"; 33 34 license = stdenv.lib.licenses.lgpl2Plus; 35 36 maintainers = [ stdenv.lib.maintainers.ludo ]; 37 }; 38} 39 40// 41 42(if headersOnly 43 then { 44 configureFlags = 45 [ "--build=i586-pc-gnu" 46 "ac_cv_lib_ihash_hurd_ihash_create=yes" 47 ]; 48 49 dontBuild = true; 50 installPhase = "make install-data-local-headers"; 51 } 52 else { }) 53 54// 55 56(if cross != null 57 then { 58 crossConfig = cross.config; 59 60 # Tell gcc where to find `crt1.o' et al. This is specified in two 61 # different ways: one for gcc as run from `configure', and one for linking 62 # libpthread.so (by default `libtool --mode=link' swallows `-B', hence 63 # this workaround; see 64 # <http://lists.gnu.org/archive/html/bug-libtool/2010-05/msg00012.html>.) 65 LDFLAGS = "-B${glibcCross}/lib"; 66 makeFlags = [ "LDFLAGS=-Wc,-B${glibcCross}/lib" ]; 67 68 # Help the linker find glibc. 69 CPATH = "${glibcCross}/include"; 70 LIBRARY_PATH = "${glibcCross}/lib"; 71 72 passthru = { 73 # Extra target LDFLAGS to allow the cross-linker to find the 74 # dependencies of the cross libpthread.so, namely libihash.so. 75 # Note: these are raw `ld' flags, so `-Wl,' must be prepended when using 76 # `gcc'. 77 # 78 # This is actually only useful while building the final cross-gcc, since 79 # afterwards gcc-cross-wrapper should add the relevant flags. 80 TARGET_LDFLAGS = "-rpath-link=${hurd}/lib"; 81 }; 82 } 83 else { }))