summary refs log tree commit diff
path: root/pkgs/tools/compression
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2016-05-05 08:30:19 +0200
committerVladimír Čunát <vcunat@gmail.com>2016-05-05 08:30:19 +0200
commit1dc36904d8cefa8188c785efd03274637c838e31 (patch)
tree0cf37f0803f1e9c6985d09f2870e5ec61229d2ca /pkgs/tools/compression
parent75f1cc61b86b002f551529f1cafa30b4f4010bd9 (diff)
parent7a005601d48f760864258e369364b3b847d4e9fd (diff)
downloadnixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar.gz
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar.bz2
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar.lz
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar.xz
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.tar.zst
nixlib-1dc36904d8cefa8188c785efd03274637c838e31.zip
Merge #14920: windows improvements, mainly mingw
Diffstat (limited to 'pkgs/tools/compression')
-rw-r--r--pkgs/tools/compression/bzip2/default.nix51
1 files changed, 29 insertions, 22 deletions
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index a165ab2b157b..d3ed5121ba98 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -35,10 +35,6 @@ in stdenv.mkDerivation {
       sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
     '';
     preConfigure = "sh ./autogen.sh";
-    # clear native hooks that are not needed with autoconf
-    preBuild = "";
-    preInstall = "";
-    postInstall = "";
   };
 
   outputs = [ "dev" "bin" "static" ] ++ stdenv.lib.optional sharedLibrary "out";
@@ -47,21 +43,23 @@ in stdenv.mkDerivation {
     make -f ${if stdenv.isDarwin then "Makefile-libbz2_dylib" else "Makefile-libbz2_so"}
   '';
 
-  preInstall = stdenv.lib.optionalString sharedLibrary (if !stdenv.isDarwin then ''
-    mkdir -p $out/lib
-    mv libbz2.so* $out/lib
-    ( cd $out/lib &&
-      ln -s libbz2.so.1.0.? libbz2.so &&
-      ln -s libbz2.so.1.0.? libbz2.so.1
-    )
-  '' else ''
-    mkdir -p $out/lib
-    mv libbz2.*.dylib $out/lib
-    ( cd $out/lib &&
-      ln -s libbz2.1.0.?.dylib libbz2.dylib &&
-      ln -s libbz2.1.0.?.dylib libbz2.1.dylib
-    )
-  '');
+  preInstall = stdenv.lib.optionalString
+    (sharedLibrary && stdenv.cross.libc or null != "msvcrt")
+    (if !stdenv.isDarwin then ''
+      mkdir -p $out/lib
+      mv libbz2.so* $out/lib
+      ( cd $out/lib &&
+        ln -s libbz2.so.1.0.? libbz2.so &&
+        ln -s libbz2.so.1.0.? libbz2.so.1
+      )
+    '' else ''
+      mkdir -p $out/lib
+      mv libbz2.*.dylib $out/lib
+      ( cd $out/lib &&
+        ln -s libbz2.1.0.?.dylib libbz2.dylib &&
+        ln -s libbz2.1.0.?.dylib libbz2.1.dylib
+      )
+    '');
 
   installFlags = [ "PREFIX=$(bin)" ];
 
@@ -70,9 +68,18 @@ in stdenv.mkDerivation {
     ln -s bzip2 $bin/bin/bunzip2
     ln -s bzip2 $bin/bin/bzcat
 
-    mkdir "$static"
-    mv "$bin/lib" "$static/"
-  '';
+  ''
+    + (if stdenv.cross.libc or null != "msvcrt" # mingw TODO: avoided rebuilds for now
+      then ''
+        mkdir "$static"
+        mv "$bin/lib" "$static/"
+      ''
+      else ''
+        moveToOutput "lib/*.a" "$static"
+        moveToOutput "lib/*.dll.a" "$out"
+        mkdir -p "$static" # empty for now, but we want to avoid failure
+      '')
+    ;
 
   postPatch = ''
     substituteInPlace Makefile --replace CC=gcc CC=cc