2024-04-21 15:54:59 +00:00
|
|
|
{ lib, stdenv, fetchurl, ant, jdk, hdf4, hdf5, makeDesktopItem, copyDesktopItems, strip-nondeterminism, stripJavaArchivesHook }:
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
stdenv.mkDerivation rec {
|
|
|
|
pname = "hdfview";
|
2023-10-19 13:55:26 +00:00
|
|
|
version = "3.3.1";
|
2020-04-24 23:36:52 +00:00
|
|
|
|
|
|
|
src = fetchurl {
|
2024-09-19 14:19:46 +00:00
|
|
|
url = "https://support.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/hdfview-${version}/src/hdfview-${version}.tar.gz";
|
2023-10-19 13:55:26 +00:00
|
|
|
sha256 = "sha256-WcGYceMOB8gCycJSW4KdApy2gIBgTnE/d0PxGZClUqg=";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
patches = [
|
|
|
|
# Hardcode isUbuntu=false to avoid calling hostname to detect os
|
|
|
|
./0001-Hardcode-isUbuntu-false-to-avoid-hostname-dependency.patch
|
2023-07-15 17:15:38 +00:00
|
|
|
# Disable signing on macOS
|
|
|
|
./disable-mac-signing.patch
|
2024-04-21 15:54:59 +00:00
|
|
|
# Remove timestamp comment from generated versions.properties file
|
|
|
|
./remove-properties-timestamp.patch
|
2022-07-18 16:21:45 +00:00
|
|
|
];
|
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
nativeBuildInputs = [
|
2022-07-18 16:21:45 +00:00
|
|
|
ant
|
|
|
|
jdk
|
2021-03-09 03:18:52 +00:00
|
|
|
copyDesktopItems
|
2024-04-21 15:54:59 +00:00
|
|
|
strip-nondeterminism
|
|
|
|
stripJavaArchivesHook
|
2021-03-09 03:18:52 +00:00
|
|
|
];
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
HDFLIBS = (hdf4.override { javaSupport = true; }).out;
|
|
|
|
HDF5LIBS = (hdf5.override { javaSupport = true; }).out;
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
buildPhase =
|
|
|
|
let
|
2024-09-26 11:04:55 +00:00
|
|
|
arch = if stdenv.hostPlatform.isx86_64 then "x86_64" else "aarch64";
|
2022-07-18 16:21:45 +00:00
|
|
|
in
|
|
|
|
''
|
|
|
|
runHook preBuild
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
ant createJPackage -Dmachine.arch=${arch}
|
2021-03-09 03:18:52 +00:00
|
|
|
|
2022-07-18 16:21:45 +00:00
|
|
|
runHook postBuild
|
|
|
|
'';
|
2020-04-24 23:36:52 +00:00
|
|
|
|
2021-03-09 03:18:52 +00:00
|
|
|
desktopItem = makeDesktopItem rec {
|
|
|
|
name = "HDFView";
|
|
|
|
desktopName = name;
|
|
|
|
exec = name;
|
|
|
|
icon = name;
|
|
|
|
comment = meta.description;
|
2022-03-05 16:20:37 +00:00
|
|
|
categories = [ "Science" "DataVisualization" ];
|
2021-03-09 03:18:52 +00:00
|
|
|
};
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
installPhase = ''
|
2021-03-09 03:18:52 +00:00
|
|
|
runHook preInstall
|
2024-09-26 11:04:55 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isLinux ''
|
2021-03-09 03:18:52 +00:00
|
|
|
mkdir -p $out/bin $out/lib
|
|
|
|
cp -a build/dist/HDFView/bin/HDFView $out/bin/
|
|
|
|
cp -a build/dist/HDFView/lib/app $out/lib/
|
2022-07-18 16:21:45 +00:00
|
|
|
cp -a build/dist/HDFView/lib/libapplauncher.so $out/lib/
|
2021-03-09 03:18:52 +00:00
|
|
|
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/
|
2024-09-26 11:04:55 +00:00
|
|
|
'' + lib.optionalString stdenv.hostPlatform.isDarwin ''
|
2022-07-14 12:49:19 +00:00
|
|
|
mkdir -p $out/Applications
|
|
|
|
cp -a build/dist/HDFView.app $out/Applications/
|
|
|
|
'' + ''
|
2021-03-09 03:18:52 +00:00
|
|
|
runHook postInstall
|
2020-04-24 23:36:52 +00:00
|
|
|
'';
|
|
|
|
|
2024-04-21 15:54:59 +00:00
|
|
|
preFixup = ''
|
|
|
|
# Remove build timestamp from javadoc files
|
|
|
|
find $out/lib/app{,/mods}/doc/javadocs -name "*.html" -exec strip-nondeterminism --type javadoc {} +
|
|
|
|
'';
|
|
|
|
|
2020-04-24 23:36:52 +00:00
|
|
|
meta = {
|
|
|
|
description = "A visual tool for browsing and editing HDF4 and HDF5 files";
|
2021-01-15 22:18:51 +00:00
|
|
|
license = lib.licenses.free; # BSD-like
|
2024-02-29 20:09:43 +00:00
|
|
|
homepage = "https://www.hdfgroup.org/downloads/hdfview";
|
2022-07-14 12:49:19 +00:00
|
|
|
platforms = lib.platforms.linux ++ lib.platforms.darwin;
|
2022-07-18 16:21:45 +00:00
|
|
|
maintainers = with lib.maintainers; [ jiegec ];
|
2024-01-02 11:29:13 +00:00
|
|
|
mainProgram = "HDFView";
|
2020-04-24 23:36:52 +00:00
|
|
|
};
|
|
|
|
}
|