75 lines
2.7 KiB
Nix
75 lines
2.7 KiB
Nix
{ stdenv, fetchurl, cpio, curl
|
|
, python, perl, zlib, bzip2, boost }:
|
|
|
|
stdenv.mkDerivation rec {
|
|
version = "2.6.0";
|
|
name = "ncbi-blast-${version}";
|
|
|
|
src = fetchurl {
|
|
url = "ftp://ftp.ncbi.nlm.nih.gov/blast/executables/blast+/${version}/ncbi-blast-${version}+-src.tar.gz";
|
|
sha256 = "15n937pw5aqmyfjb6l387d18grqbb96l63d5xj4l7yyh0zbf2405";
|
|
};
|
|
|
|
# The install target is broken as it tries to install a subdirectory using install
|
|
patches = [ ./install.patch ];
|
|
|
|
# Contains a lot of hardcoded paths for standard utils and some scripts the just reset PATH for the fun of it.
|
|
#
|
|
# - for every $cmd on the path, replace all occurances of /usr/bin/$cmd and /bin/$cmd with it
|
|
# - delete every line that has PATH=/bin:/usr/bin in it
|
|
#
|
|
# A bit of prefix/suffix matching and escaping is required for the first to avoid replacing things like $(foo)/bin/...
|
|
# and keeping the sed regexps valid in the face of commands like [.
|
|
#
|
|
postPatch = ''
|
|
patchShebangs .
|
|
echo 'replacing hardcoded /bin and /usr/bin commands with any nix equivalents on the PATH'
|
|
find -L ''${PATH//:/ } -maxdepth 1 -type f -perm -u=x -print0 |
|
|
while read -d ''' -r cmd; do
|
|
cmd=''${cmd//\/\\\\}
|
|
cmd=''${cmd//{/\\{}
|
|
cmd=''${cmd//[/\\[}
|
|
cmd=''${cmd//(/\\(}
|
|
cmd=''${cmd//)/\\)}
|
|
cmd=''${cmd//+/\\+}
|
|
cmd=''${cmd//\*/\\*}
|
|
cmd=''${cmd//\?/\\?}
|
|
cmd=''${cmd//!/\\!}
|
|
echo 's!(^|[[:space:]({>`'\'''";|,=@\!]|&&|\|\|)(/usr)?/bin/'"''${cmd##*/}"'($|[[:space:])}<`'\'''";|,]|&&|\|\|)!\1'"$cmd"'\3!g'
|
|
done >> commands.sed
|
|
find c++ -type f -print0 | xargs -0 -n 16 -P $NIX_BUILD_CORES \
|
|
sed -i -E \
|
|
-e '/ *PATH=['\'''"]?\/bin:\/usr\/bin/d' \
|
|
-e 's!/bin/(\$base_action|\$LN_S)!\1!g' \
|
|
-f commands.sed
|
|
'';
|
|
|
|
# AR command variable is abused to include parameters, but these don't get figured out if $AR is already set
|
|
preConfigure = ''
|
|
cd c++
|
|
test -n "$AR" && AR="$AR cr" || true
|
|
'';
|
|
|
|
configureFlags = "--with-dll --without-debug --with-bin-release --with-strip --with-mt --without-opengl --without-connext";
|
|
|
|
buildInputs = [
|
|
boost
|
|
zlib
|
|
bzip2
|
|
cpio
|
|
curl
|
|
python
|
|
# python3 -- some scripts like ./c++/scripts/projects/magicblast/post_build/blast_utils.py
|
|
perl
|
|
];
|
|
|
|
meta = with stdenv.lib; {
|
|
homepage = https://blast.ncbi.nlm.nih.gov/;
|
|
description = "BLAST finds regions of similarity between biological sequences. The program compares nucleotide or protein sequences to sequence databases and calculates the statistical significance.";
|
|
platforms = platforms.all;
|
|
license = licenses.publicDomain;
|
|
};
|
|
|
|
enableParallelBuilding = true;
|
|
}
|