Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at release-16.03 85 lines 2.2 kB view raw
1{ stdenv, lib, fetchFromGitHub, autoconf, automake, libtool, pkgconfig 2 3, ApplicationServices, CoreServices }: 4 5let 6 stable = "stable"; 7 unstable = "unstable"; 8 9 meta = with lib; { 10 description = "A multi-platform support library with a focus on asynchronous I/O"; 11 homepage = https://github.com/libuv/libuv; 12 maintainers = with maintainers; [ cstrahan ]; 13 platforms = with platforms; linux ++ darwin; 14 }; 15 16 mkName = stability: version: 17 if stability == stable 18 then "libuv-${version}" 19 else "libuv-${stability}-${version}"; 20 21 mkSrc = version: sha256: fetchFromGitHub { 22 owner = "libuv"; 23 repo = "libuv"; 24 rev = "v${version}"; 25 inherit sha256; 26 }; 27 28 # for versions < 0.11.6 29 mkWithoutAutotools = stability: version: sha256: stdenv.mkDerivation { 30 name = mkName stability version; 31 src = mkSrc version sha256; 32 buildPhase = lib.optionalString stdenv.isDarwin '' 33 mkdir extrapath 34 ln -s /usr/sbin/dtrace extrapath/dtrace 35 export PATH=$PATH:`pwd`/extrapath 36 '' + '' 37 mkdir build 38 make builddir_name=build 39 40 rm -r build/src 41 rm build/libuv.a 42 cp -r include build 43 44 mkdir build/lib 45 mv build/libuv.* build/lib 46 47 pushd build/lib 48 lib=$(basename libuv.*) 49 ext="''${lib##*.}" 50 mv $lib libuv.10.$ext 51 ln -s libuv.10.$ext libuv.$ext 52 popd 53 ''; 54 installPhase = '' 55 cp -r build $out 56 ''; 57 inherit meta; 58 }; 59 60 # for versions > 0.11.6 61 mkWithAutotools = stability: version: sha256: stdenv.mkDerivation { 62 name = mkName stability version; 63 src = mkSrc version sha256; 64 buildInputs = [ automake autoconf libtool pkgconfig ] 65 ++ stdenv.lib.optionals stdenv.isDarwin [ ApplicationServices CoreServices ]; 66 preConfigure = '' 67 LIBTOOLIZE=libtoolize ./autogen.sh 68 ''; 69 inherit meta; 70 }; 71 72 toVersion = with lib; name: 73 replaceChars ["_"] ["."] (removePrefix "v" name); 74 75in 76 77 with lib; 78 79 mapAttrs (v: h: mkWithAutotools unstable (toVersion v) h) { 80 v0_11_29 = "1z07phfwryfy2155p3lxcm2a33h20sfl96lds5dghn157x6csz7m"; 81 } 82 // 83 mapAttrs (v: h: mkWithAutotools stable (toVersion v) h) { 84 v1_7_5 = "18x6cy2xn31am97vn6jli7kmb2fbp4c8kmv7jm97vggh0x55flsc"; 85 }