lol
fork

Configure Feed

Select the types of activity you want to include in your feed.

at 16.09-beta 84 lines 2.5 kB view raw
1{ stdenv, fetchurl, static ? false }: 2 3let version = "1.2.8"; in 4 5stdenv.mkDerivation rec { 6 name = "zlib-${version}"; 7 8 src = fetchurl { 9 urls = 10 [ "http://www.zlib.net/${name}.tar.gz" # old versions vanish from here 11 "mirror://sourceforge/libpng/zlib/${version}/${name}.tar.gz" 12 ]; 13 sha256 = "039agw5rqvqny92cpkrfn243x2gd4xn13hs3xi6isk55d2vqqr9n"; 14 }; 15 16 postPatch = stdenv.lib.optionalString stdenv.isDarwin '' 17 substituteInPlace configure \ 18 --replace '/usr/bin/libtool' 'ar' \ 19 --replace 'AR="libtool"' 'AR="ar"' \ 20 --replace 'ARFLAGS="-o"' 'ARFLAGS="-r"' 21 ''; 22 23 outputs = [ "out" "dev" "static" ]; 24 setOutputFlags = false; 25 outputDoc = "dev"; # single tiny man3 page 26 27 28 preConfigure = '' 29 if test -n "$crossConfig"; then 30 export CC=$crossConfig-gcc 31 fi 32 ''; 33 34 # FIXME needs gcc 4.9 in bootstrap tools 35 hardeningDisable = [ "stackprotector" ]; 36 37 configureFlags = stdenv.lib.optional (!static) "--shared"; 38 39 postInstall = '' 40 moveToOutput lib/libz.a "$static" 41 '' 42 # jww (2015-01-06): Sometimes this library install as a .so, even on 43 # Darwin; others time it installs as a .dylib. I haven't yet figured out 44 # what causes this difference. 45 + stdenv.lib.optionalString stdenv.isDarwin '' 46 for file in $out/lib/*.so* $out/lib/*.dylib* ; do 47 install_name_tool -id "$file" $file 48 done 49 ''; 50 51 # As zlib takes part in the stdenv building, we don't want references 52 # to the bootstrap-tools libgcc (as uses to happen on arm/mips) 53 NIX_CFLAGS_COMPILE = stdenv.lib.optionalString (!stdenv.isDarwin) "-static-libgcc"; 54 55 crossAttrs = { 56 dontStrip = static; 57 dontSetConfigureCross = true; 58 } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "msvcrt") { 59 installFlags = [ 60 "BINARY_PATH=$(out)/bin" 61 "INCLUDE_PATH=$(dev)/include" 62 "LIBRARY_PATH=$(out)/lib" 63 ]; 64 makeFlags = [ 65 "-f" "win32/Makefile.gcc" 66 "PREFIX=${stdenv.cross.config}-" 67 ] ++ stdenv.lib.optional (!static) "SHARED_MODE=1"; 68 69 # Non-typical naming confuses libtool which then refuses to use zlib's DLL 70 # in some cases, e.g. when compiling libpng. 71 postInstall = postInstall + "ln -s zlib1.dll $out/bin/libz.dll"; 72 } // stdenv.lib.optionalAttrs (stdenv.cross.libc == "libSystem") { 73 makeFlags = [ "RANLIB=${stdenv.cross.config}-ranlib" ]; 74 }; 75 76 passthru.version = version; 77 78 meta = with stdenv.lib; { 79 description = "Lossless data-compression library"; 80 license = licenses.zlib; 81 platforms = platforms.all; 82 }; 83} 84