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