2023-05-24 13:37:59 +00:00
|
|
|
{ lib
|
|
|
|
, fetchurl
|
|
|
|
, bash
|
|
|
|
, tinycc
|
|
|
|
, gnumake
|
2023-10-09 19:29:22 +00:00
|
|
|
, gnutar
|
2023-05-24 13:37:59 +00:00
|
|
|
, gzip
|
|
|
|
}:
|
|
|
|
let
|
|
|
|
pname = "bzip2";
|
|
|
|
version = "1.0.8";
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
url = "https://sourceware.org/pub/bzip2/bzip2-${version}.tar.gz";
|
|
|
|
sha256 = "0s92986cv0p692icqlw1j42y9nld8zd83qwhzbqd61p1dqbh6nmb";
|
|
|
|
};
|
|
|
|
in
|
|
|
|
bash.runCommand "${pname}-${version}" {
|
|
|
|
inherit pname version;
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
tinycc.compiler
|
|
|
|
gnumake
|
2023-10-09 19:29:22 +00:00
|
|
|
gnutar
|
2023-05-24 13:37:59 +00:00
|
|
|
gzip
|
|
|
|
];
|
|
|
|
|
|
|
|
passthru.tests.get-version = result:
|
|
|
|
bash.runCommand "${pname}-get-version-${version}" {} ''
|
2023-10-09 19:29:22 +00:00
|
|
|
${result}/bin/bzip2 --help
|
2023-05-24 13:37:59 +00:00
|
|
|
mkdir $out
|
|
|
|
'';
|
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "High-quality data compression program";
|
|
|
|
homepage = "https://www.sourceware.org/bzip2";
|
|
|
|
license = licenses.bsdOriginal;
|
|
|
|
maintainers = teams.minimal-bootstrap.members;
|
|
|
|
platforms = platforms.unix;
|
|
|
|
};
|
|
|
|
} ''
|
|
|
|
# Unpack
|
2023-10-09 19:29:22 +00:00
|
|
|
tar xzf ${src}
|
2023-05-24 13:37:59 +00:00
|
|
|
cd bzip2-${version}
|
|
|
|
|
|
|
|
# Build
|
|
|
|
make \
|
2023-10-09 19:29:22 +00:00
|
|
|
-j $NIX_BUILD_CORES \
|
|
|
|
CC="tcc -B ${tinycc.libs}/lib" \
|
2023-05-24 13:37:59 +00:00
|
|
|
AR="tcc -ar" \
|
|
|
|
bzip2 bzip2recover
|
|
|
|
|
|
|
|
# Install
|
2023-10-09 19:29:22 +00:00
|
|
|
make install -j $NIX_BUILD_CORES PREFIX=$out
|
2023-05-24 13:37:59 +00:00
|
|
|
''
|