about summary refs log tree commit diff
path: root/pkgs/tools/compression/bzip2
diff options
context:
space:
mode:
authorVladimír Čunát <vcunat@gmail.com>2015-11-20 14:32:58 +0100
committerVladimír Čunát <vcunat@gmail.com>2015-11-20 14:32:58 +0100
commit333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb (patch)
tree0f4757ddd2bb3d73b438eea85828d8e01c049583 /pkgs/tools/compression/bzip2
parentbdbbfa0d4247e203ffe3171621b614374da05f70 (diff)
parentb809f886c0bdbd4665fc65a4c308d38a30c368d8 (diff)
downloadnixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar.gz
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar.bz2
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar.lz
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar.xz
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.tar.zst
nixlib-333d69a5f0e7ccfe7b8c0bdb14ebd3934b3f77fb.zip
Merge staging into closure-size
The most complex problems were from dealing with switches reverted in
the meantime (gcc5, gmp6, ncurses6).
It's likely that darwin is (still) broken nontrivially.
Diffstat (limited to 'pkgs/tools/compression/bzip2')
-rw-r--r--pkgs/tools/compression/bzip2/default.nix60
1 files changed, 35 insertions, 25 deletions
diff --git a/pkgs/tools/compression/bzip2/default.nix b/pkgs/tools/compression/bzip2/default.nix
index da6695ee1da9..48f4c4fe3c35 100644
--- a/pkgs/tools/compression/bzip2/default.nix
+++ b/pkgs/tools/compression/bzip2/default.nix
@@ -2,12 +2,11 @@
 
 let
   version = "1.0.6";
-  inherit (stdenv.lib) optionalString;
-  sharedLibrary = with stdenv;
-    !( isDarwin || (stdenv ? isStatic) || system == "i686-cygwin" || linkStatic );
-in
 
-stdenv.mkDerivation rec {
+  sharedLibrary = !stdenv.isDarwin && !(stdenv ? isStatic)
+               && stdenv.system != "i686-cygwin" && !linkStatic;
+
+in stdenv.mkDerivation {
   name = "bzip2-${version}";
 
   src = fetchurl {
@@ -15,11 +14,6 @@ stdenv.mkDerivation rec {
     sha256 = "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152";
   };
 
-  patchPhase = optionalString stdenv.isDarwin
-    "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
-
-  outputs = [ "dev" "bin" "static" ] ++ stdenv.lib.optional sharedLibrary "out";
-
   crossAttrs = {
     patchPhase = ''
       sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
@@ -31,28 +25,44 @@ stdenv.mkDerivation rec {
     '';
   };
 
-  preConfigure = "substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'";
-
-  preBuild = optionalString sharedLibrary "make -f Makefile-libbz2_so";
-  makeFlags = optionalString linkStatic "LDFLAGS=-static";
+  outputs = [ "dev" "bin" "static" ] ++ stdenv.lib.optional sharedLibrary "out";
 
-  installFlags = "PREFIX=$(bin)";
+  preBuild = stdenv.lib.optionalString sharedLibrary ''
+    make -f Makefile-libbz2_so
+  '';
 
-  postInstall = optionalString sharedLibrary ''
+  preInstall = stdenv.lib.optionalString sharedLibrary ''
     mkdir -p $out/lib
     mv libbz2.so* $out/lib
-    ( cd $out/lib && ln -s libbz2.so.1.*.* libbz2.so && ln -s libbz2.so.1.*.* libbz2.so.1 )
-  '' + ''
-    mkdir -p "$static"
-    mv "$bin/lib" "$static/"
-    (
-      cd "$bin/bin"
-      rm {bunzip2,bzcat}*
-      ln -s bzip2 bunzip2
-      ln -s bzip2 bzcat
+    ( cd $out/lib &&
+      ln -s libbz2.so.1.0.? libbz2.so &&
+      ln -s libbz2.so.1.0.? libbz2.so.1
     )
   '';
 
+  installFlags = [ "PREFIX=$(bin)" ];
+
+  postInstall = ''
+    rm $bin/bin/bunzip2* $bin/bin/bzcat*
+    ln -s bzip2 $bin/bin/bunzip2
+    ln -s bzip2 $bin/bin/bzcat
+
+    mkdir "$static"
+    mv "$bin/lib" "$static/"
+  '';
+
+  patchPhase = stdenv.lib.optionalString stdenv.isDarwin ''
+    substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'
+  '';
+
+  preConfigure = ''
+    substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'
+  '';
+
+  makeFlags = stdenv.lib.optional linkStatic "LDFLAGS=-static";
+
+  inherit linkStatic;
+
   meta = {
     homepage = "http://www.bzip.org";
     description = "high-quality data compression program";