depot/third_party/nixpkgs/pkgs/os-specific/linux/minimal-bootstrap/xz/default.nix
Default email bcb2f287e1 Project import generated by Copybara.
GitOrigin-RevId: d603719ec6e294f034936c0d0dc06f689d91b6c3
2024-06-20 20:27:18 +05:30

70 lines
1.3 KiB
Nix

{ lib
, buildPlatform
, hostPlatform
, fetchurl
, bash
, tinycc
, gnumake
, gnused
, gnugrep
, gawk
, gnutar
, gzip
}:
let
pname = "xz";
version = "5.4.3";
src = fetchurl {
url = "https://tukaani.org/xz/xz-${version}.tar.gz";
hash = "sha256-HDguC8Lk4K9YOYqQPdYv/35RAXHS3keh6+BtFSjpt+k=";
};
in
bash.runCommand "${pname}-${version}" {
inherit pname version;
nativeBuildInputs = [
tinycc.compiler
gnumake
gnused
gnugrep
gawk
gnutar
gzip
];
passthru.tests.get-version = result:
bash.runCommand "${pname}-get-version-${version}" {} ''
${result}/bin/xz --version
mkdir $out
'';
meta = with lib; {
description = "General-purpose data compression software, successor of LZMA";
homepage = "https://tukaani.org/xz";
license = with licenses; [ gpl2Plus lgpl21Plus ];
maintainers = teams.minimal-bootstrap.members;
platforms = platforms.unix;
};
} ''
# Unpack
tar xzf ${src}
cd xz-${version}
# Configure
export CC="tcc -B ${tinycc.libs}/lib"
export AR="tcc -ar"
export LD=tcc
bash ./configure \
--prefix=$out \
--build=${buildPlatform.config} \
--host=${hostPlatform.config} \
--disable-shared \
--disable-assembler
# Build
make -j $NIX_BUILD_CORES
# Install
make -j $NIX_BUILD_CORES install
''