@@ -0,0 +1,41 @@
1+{ stdenv, lib, makeWrapper, fetchzip, jre }:
2+
3+stdenv.mkDerivation rec {
4+ name = "bftools-${version}";
5+ version = "5.9.2";
6+
7+ src = fetchzip {
8+ url = "http://downloads.openmicroscopy.org/bio-formats/${version}/artifacts/bftools.zip";
9+ sha256 = "08lmbg3kfxh17q6548il0i2h3f9a6ch8r0r067p14dajhzfpjyqj";
10+ };
11+
12+ installPhase = ''
13+ find . -maxdepth 1 -perm -111 -type f -not -name "*.sh" \
14+ -exec install -vD {} "$out"/bin/{} \;
15+
16+ mkdir $out/libexec
17+ mkdir -p $out/share/java
18+
19+ cp ./*.sh $out/libexec
20+ cp ./*.jar $out/share/java
21+
22+ for file in $out/bin/*; do
23+ substituteInPlace $file --replace "\$BF_DIR" $out/libexec
24+ done
25+ substituteInPlace $out/libexec/bf.sh --replace "\$BF_JAR_DIR" $out/share/java
26+ '';
27+
28+ postFixup = ''
29+ wrapProgram $out/libexec/bf.sh --prefix PATH : "${lib.makeBinPath [ jre ]}"
30+ '';
31+
32+ nativeBuildInputs = [ makeWrapper ];
33+
34+ meta = with stdenv.lib; {
35+ description = "A bundle of scripts for using Bio-Formats on the command line with bioformats_package.jar already included";
36+ license = licenses.gpl2;
37+ platforms = platforms.all;
38+ homepage = https://www.openmicroscopy.org/bio-formats/;
39+ maintainers = [ maintainers.tbenst ];
40+ };
41+}