mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-10-03 13:30:36 +00:00
81 lines
1.8 KiB
Nix
81 lines
1.8 KiB
Nix
{
|
|
lib,
|
|
stdenv,
|
|
fetchurl,
|
|
fetchpatch,
|
|
zlib,
|
|
bzip2,
|
|
xz,
|
|
curl,
|
|
libdeflate,
|
|
perl,
|
|
}:
|
|
|
|
stdenv.mkDerivation (finalAttrs: {
|
|
pname = "htslib";
|
|
version = "1.22";
|
|
|
|
src = fetchurl {
|
|
url = "https://github.com/samtools/htslib/releases/download/${finalAttrs.version}/htslib-${finalAttrs.version}.tar.bz2";
|
|
hash = "sha256-YlDB3yl9tHdRbmCsjfRe11plLR8lsPN/EvWxcmnq/ek=";
|
|
};
|
|
|
|
patches = [
|
|
(fetchpatch {
|
|
url = "https://github.com/samtools/htslib/commit/31006e1c8edd02eb6321ed9be76b84fca5d20cb6.patch";
|
|
hash = "sha256-sbnkVmXIbs/Cn/msUUrJpJZCI2DHX5kpGSka2cccZIQ=";
|
|
})
|
|
];
|
|
|
|
# perl is only used during the check phase.
|
|
nativeBuildInputs = [ perl ];
|
|
|
|
buildInputs = [
|
|
zlib
|
|
bzip2
|
|
xz
|
|
curl
|
|
libdeflate
|
|
];
|
|
|
|
configureFlags =
|
|
if !stdenv.hostPlatform.isStatic then
|
|
[ "--enable-libcurl" ] # optional but strongly recommended
|
|
else
|
|
[
|
|
"--disable-libcurl"
|
|
"--disable-plugins"
|
|
];
|
|
|
|
# In the case of static builds, we need to replace the build and install phases
|
|
buildPhase = lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
make AR=$AR lib-static
|
|
make LDFLAGS=-static bgzip htsfile tabix
|
|
'';
|
|
|
|
installPhase = lib.optionalString stdenv.hostPlatform.isStatic ''
|
|
install -d $out/bin
|
|
install -d $out/lib
|
|
install -d $out/include/htslib
|
|
install -D libhts.a $out/lib
|
|
install -m644 htslib/*h $out/include/htslib
|
|
install -D bgzip htsfile tabix $out/bin
|
|
'';
|
|
|
|
preCheck = ''
|
|
patchShebangs test/
|
|
'';
|
|
|
|
enableParallelBuilding = true;
|
|
|
|
doCheck = true;
|
|
|
|
meta = {
|
|
description = "C library for reading/writing high-throughput sequencing data";
|
|
license = lib.licenses.mit;
|
|
homepage = "http://www.htslib.org/";
|
|
platforms = lib.platforms.unix;
|
|
maintainers = [ lib.maintainers.mimame ];
|
|
};
|
|
})
|