bzip2: split into multiple outputs, refactor
This commit is contained in:
parent
d484c392aa
commit
a99e543c36
@ -7,7 +7,7 @@
|
||||
pkgs.gawk
|
||||
pkgs.gnutar
|
||||
pkgs.gzip
|
||||
pkgs.bzip2
|
||||
pkgs.bzip2.bin
|
||||
pkgs.gnumake
|
||||
pkgs.bash
|
||||
pkgs.patch
|
||||
|
@ -1,24 +0,0 @@
|
||||
source $stdenv/setup
|
||||
installFlags="PREFIX=$out"
|
||||
|
||||
if test -n "$sharedLibrary"; then
|
||||
|
||||
preBuild() {
|
||||
make -f Makefile-libbz2_so
|
||||
}
|
||||
|
||||
preInstall() {
|
||||
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);
|
||||
}
|
||||
|
||||
fi
|
||||
|
||||
postInstall() {
|
||||
rm $out/bin/bunzip2* $out/bin/bzcat*
|
||||
ln -s bzip2 $out/bin/bunzip2
|
||||
ln -s bzip2 $out/bin/bzcat
|
||||
}
|
||||
|
||||
genericBuild
|
@ -1,17 +1,25 @@
|
||||
{ stdenv, fetchurl, linkStatic ? false }:
|
||||
|
||||
let version = "1.0.6"; in
|
||||
let
|
||||
version = "1.0.6";
|
||||
inherit (stdenv.lib) optionalString;
|
||||
sharedLibrary = with stdenv;
|
||||
!( isDarwin || (stdenv ? isStatic) || system == "i686-cygwin" || linkStatic );
|
||||
in
|
||||
|
||||
stdenv.mkDerivation {
|
||||
stdenv.mkDerivation rec {
|
||||
name = "bzip2-${version}";
|
||||
|
||||
builder = ./builder.sh;
|
||||
|
||||
src = fetchurl {
|
||||
url = "http://www.bzip.org/${version}/bzip2-${version}.tar.gz";
|
||||
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
|
||||
@ -23,16 +31,27 @@ stdenv.mkDerivation {
|
||||
'';
|
||||
};
|
||||
|
||||
sharedLibrary =
|
||||
!stdenv.isDarwin && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
|
||||
|
||||
patchPhase = stdenv.lib.optionalString stdenv.isDarwin "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
|
||||
|
||||
preConfigure = "substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'";
|
||||
|
||||
makeFlags = if linkStatic then "LDFLAGS=-static" else "";
|
||||
preBuild = optionalString sharedLibrary "make -f Makefile-libbz2_so";
|
||||
makeFlags = optionalString linkStatic "LDFLAGS=-static";
|
||||
|
||||
inherit linkStatic;
|
||||
installFlags = "PREFIX=$(bin)";
|
||||
|
||||
postInstall = 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
|
||||
)
|
||||
'';
|
||||
|
||||
meta = {
|
||||
homepage = "http://www.bzip.org";
|
||||
|
Loading…
Reference in New Issue
Block a user