diff --git a/pkgs/tools/misc/hdfview/default.nix b/pkgs/tools/misc/hdfview/default.nix index dc13bb52791..8537e5748c3 100644 --- a/pkgs/tools/misc/hdfview/default.nix +++ b/pkgs/tools/misc/hdfview/default.nix @@ -1,39 +1,58 @@ -{ lib, stdenv, fetchurl, ant, javac, hdf_java }: +{ lib, stdenv, fetchurl, ant, jdk, nettools, hdf4, hdf5, makeDesktopItem, copyDesktopItems }: stdenv.mkDerivation rec { pname = "hdfview"; - version = "2.14"; + version = "3.1.2"; src = fetchurl { - url = "https://support.hdfgroup.org/ftp/HDF5/hdf-java/current/src/${pname}-${version}.tar.gz"; - sha256 = "0lv9djfm7hnp14mcyzbiax3xjb8vkbzhh7bdl6cvgy53pc08784p"; + url = "https://support.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/${pname}-${version}/src/${pname}-${version}.tar.gz"; + sha256 = "0kyw9i3f817z71l0ak7shl0wqxasz9h5fl05mklyapa7cj27637c"; }; - nativeBuildInputs = [ ant javac ]; + nativeBuildInputs = [ + ant jdk + nettools # "hostname" required + copyDesktopItems + ]; - HDFLIBS = hdf_java; + HDFLIBS = (hdf4.override { javaSupport = true; }).out; + HDF5LIBS = (hdf5.override { javaSupport = true; }).out; buildPhase = '' - ant run - ant package + runHook preBuild + + ant createJPackage + + runHook postBuild ''; + desktopItem = makeDesktopItem rec { + name = "HDFView"; + desktopName = name; + exec = name; + icon = name; + comment = meta.description; + categories = "Science;DataVisualization;"; + }; + installPhase = '' - mkdir $out - # exclude jre - cp -r build/HDF_Group/HDFView/*/{lib,share} $out/ - mkdir $out/bin - cp -r build/HDF_Group/HDFView/*/hdfview.sh $out/bin/hdfview - chmod +x $out/bin/hdfview - substituteInPlace $out/bin/hdfview \ - --replace "@JAVABIN@" "${javac}/bin/" \ - --replace "@INSTALLDIR@" "$out" + runHook preInstall + + mkdir -p $out/bin $out/lib + cp -a build/dist/HDFView/bin/HDFView $out/bin/ + cp -a build/dist/HDFView/lib/app $out/lib/ + ln -s ${jdk}/lib/openjdk $out/lib/runtime + + mkdir -p $out/share/applications $out/share/icons/hicolor/32x32/apps + cp src/HDFView.png $out/share/icons/hicolor/32x32/apps/ + + runHook postInstall ''; meta = { description = "A visual tool for browsing and editing HDF4 and HDF5 files"; license = lib.licenses.free; # BSD-like - homepage = "https://support.hdfgroup.org/products/java/index.html"; + homepage = "https://portal.hdfgroup.org/display/HDFVIEW/HDFView"; platforms = lib.platforms.linux; }; } diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index 9527454d765..3dec64193e0 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5109,9 +5109,7 @@ in hdf5-blosc = callPackage ../development/libraries/hdf5-blosc { }; - hdfview = callPackage ../tools/misc/hdfview { - javac = jdk8; # TODO: https://github.com/NixOS/nixpkgs/pull/89731 - }; + hdfview = callPackage ../tools/misc/hdfview { }; hdf_java = callPackage ../tools/misc/hdfjava { javac = jdk8; # TODO: https://github.com/NixOS/nixpkgs/pull/89731