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