tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
bzip2: split into multiple outputs, refactor
Vladimír Čunát
10 years ago
a99e543c
d484c392
+31
-36
3 changed files
expand all
collapse all
unified
split
pkgs
stdenv
common-path.nix
tools
compression
bzip2
builder.sh
default.nix
+1
-1
pkgs/stdenv/common-path.nix
···
7
pkgs.gawk
8
pkgs.gnutar
9
pkgs.gzip
10
-
pkgs.bzip2
11
pkgs.gnumake
12
pkgs.bash
13
pkgs.patch
···
7
pkgs.gawk
8
pkgs.gnutar
9
pkgs.gzip
10
+
pkgs.bzip2.bin
11
pkgs.gnumake
12
pkgs.bash
13
pkgs.patch
-24
pkgs/tools/compression/bzip2/builder.sh
···
1
-
source $stdenv/setup
2
-
installFlags="PREFIX=$out"
3
-
4
-
if test -n "$sharedLibrary"; then
5
-
6
-
preBuild() {
7
-
make -f Makefile-libbz2_so
8
-
}
9
-
10
-
preInstall() {
11
-
mkdir -p $out/lib
12
-
mv libbz2.so* $out/lib
13
-
(cd $out/lib && ln -s libbz2.so.1.0.? libbz2.so && ln -s libbz2.so.1.0.? libbz2.so.1);
14
-
}
15
-
16
-
fi
17
-
18
-
postInstall() {
19
-
rm $out/bin/bunzip2* $out/bin/bzcat*
20
-
ln -s bzip2 $out/bin/bunzip2
21
-
ln -s bzip2 $out/bin/bzcat
22
-
}
23
-
24
-
genericBuild
···
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
+30
-11
pkgs/tools/compression/bzip2/default.nix
···
1
{ stdenv, fetchurl, linkStatic ? false }:
2
3
-
let version = "1.0.6"; in
0
0
0
0
0
4
5
-
stdenv.mkDerivation {
6
name = "bzip2-${version}";
7
-
8
-
builder = ./builder.sh;
9
10
src = fetchurl {
11
url = "http://www.bzip.org/${version}/bzip2-${version}.tar.gz";
12
sha256 = "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152";
13
};
14
0
0
0
0
0
15
crossAttrs = {
16
patchPhase = ''
17
sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
···
23
'';
24
};
25
26
-
sharedLibrary =
27
-
!stdenv.isDarwin && !(stdenv ? isStatic) && stdenv.system != "i686-cygwin" && !linkStatic;
28
29
-
patchPhase = stdenv.lib.optionalString stdenv.isDarwin "substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
0
30
31
-
preConfigure = "substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'";
32
-
33
-
makeFlags = if linkStatic then "LDFLAGS=-static" else "";
34
35
-
inherit linkStatic;
0
0
0
0
0
0
0
0
0
0
0
0
0
36
37
meta = {
38
homepage = "http://www.bzip.org";
···
1
{ stdenv, fetchurl, linkStatic ? false }:
2
3
+
let
4
+
version = "1.0.6";
5
+
inherit (stdenv.lib) optionalString;
6
+
sharedLibrary = with stdenv;
7
+
!( isDarwin || (stdenv ? isStatic) || system == "i686-cygwin" || linkStatic );
8
+
in
9
10
+
stdenv.mkDerivation rec {
11
name = "bzip2-${version}";
0
0
12
13
src = fetchurl {
14
url = "http://www.bzip.org/${version}/bzip2-${version}.tar.gz";
15
sha256 = "1kfrc7f0ja9fdn6j1y6yir6li818npy6217hvr3wzmnmzhs8z152";
16
};
17
18
+
patchPhase = optionalString stdenv.isDarwin
19
+
"substituteInPlace Makefile --replace 'CC=gcc' 'CC=clang'";
20
+
21
+
outputs = [ "dev" "bin" "static" ] ++ stdenv.lib.optional sharedLibrary "out";
22
+
23
crossAttrs = {
24
patchPhase = ''
25
sed -i -e '/<sys\\stat\.h>/s|\\|/|' bzip2.c
···
31
'';
32
};
33
34
+
preConfigure = "substituteInPlace Makefile --replace '$(PREFIX)/man' '$(PREFIX)/share/man'";
0
35
36
+
preBuild = optionalString sharedLibrary "make -f Makefile-libbz2_so";
37
+
makeFlags = optionalString linkStatic "LDFLAGS=-static";
38
39
+
installFlags = "PREFIX=$(bin)";
0
0
40
41
+
postInstall = optionalString sharedLibrary ''
42
+
mkdir -p $out/lib
43
+
mv libbz2.so* $out/lib
44
+
( cd $out/lib && ln -s libbz2.so.1.*.* libbz2.so && ln -s libbz2.so.1.*.* libbz2.so.1 )
45
+
'' + ''
46
+
mkdir -p "$static"
47
+
mv "$bin/lib" "$static/"
48
+
(
49
+
cd "$bin/bin"
50
+
rm {bunzip2,bzcat}*
51
+
ln -s bzip2 bunzip2
52
+
ln -s bzip2 bzcat
53
+
)
54
+
'';
55
56
meta = {
57
homepage = "http://www.bzip.org";