Merge pull request #180613 from jiegec/hdfview

Fix hdfview issue 179793 and bump hdfview to 3.1.4
This commit is contained in:
Robert Scott 2022-07-15 21:42:35 +01:00 committed by GitHub
commit 2a0c7fc3d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 9 deletions

View File

@ -0,0 +1,38 @@
From e5eb394458e19ce8f8a231e8b2005c80c64fd426 Mon Sep 17 00:00:00 2001
From: Jiajie Chen <c@jia.je>
Date: Fri, 15 Jul 2022 10:13:23 +0800
Subject: [PATCH] Hardcode isUbuntu=false to avoid hostname dependency.
The original build.xml detects whether the system is ubuntu based on its
hostname, which is useless in nixpkgs and brings additional dependency.
As suggested by @risicle in #180613, we can simply hardcode isUbuntu to
false.
Signed-off-by: Jiajie Chen <c@jia.je>
---
build.xml | 8 +++-----
1 file changed, 3 insertions(+), 5 deletions(-)
diff --git a/build.xml b/build.xml
index c4f0974..15a6078 100644
--- a/build.xml
+++ b/build.xml
@@ -143,11 +143,9 @@
</and>
</condition>
- <exec executable="hostname" outputproperty="computer.hostname"/>
-
- <condition property="isUbuntu">
- <contains string="${computer.hostname}" substring="ubuntu" />
- </condition>
+ <!-- Since we do not package .deb nor .rpm files, we can safely
+ hardcode isUbuntu = false. -->
+ <property name="isUbuntu" value="false" />
<!-- Build 64-bit binary.
Note: os.arch gives the architecture of the JVM, NOT the OS;
--
2.36.1

View File

@ -2,29 +2,38 @@
stdenv.mkDerivation rec {
pname = "hdfview";
version = "3.1.3";
version = "3.1.4";
src = fetchurl {
url = "https://support.hdfgroup.org/ftp/HDF5/releases/HDF-JAVA/${pname}-${version}/src/${pname}-${version}.tar.gz";
sha256 = "sha256-VmgHSVMFoy09plU5pSnyaPz8N15toy7QfCtXI7mqDGY=";
sha256 = "sha256-iY/NUifU57aX795eWpaUBflrclF/nfvb3OKZEpD9VqA=";
};
patches = [
# Hardcode isUbuntu=false to avoid calling hostname to detect os
./0001-Hardcode-isUbuntu-false-to-avoid-hostname-dependency.patch
];
nativeBuildInputs = [
ant jdk
nettools # "hostname" required
ant
jdk
copyDesktopItems
];
HDFLIBS = (hdf4.override { javaSupport = true; }).out;
HDF5LIBS = (hdf5.override { javaSupport = true; }).out;
buildPhase = ''
runHook preBuild
buildPhase =
let
arch = if stdenv.isx86_64 then "x86_64" else "aarch64";
in
''
runHook preBuild
ant createJPackage
ant createJPackage -Dmachine.arch=${arch}
runHook postBuild
'';
runHook postBuild
'';
desktopItem = makeDesktopItem rec {
name = "HDFView";
@ -41,6 +50,7 @@ stdenv.mkDerivation rec {
mkdir -p $out/bin $out/lib
cp -a build/dist/HDFView/bin/HDFView $out/bin/
cp -a build/dist/HDFView/lib/app $out/lib/
cp -a build/dist/HDFView/lib/libapplauncher.so $out/lib/
ln -s ${jdk}/lib/openjdk $out/lib/runtime
mkdir -p $out/share/applications $out/share/icons/hicolor/32x32/apps
@ -57,5 +67,6 @@ stdenv.mkDerivation rec {
license = lib.licenses.free; # BSD-like
homepage = "https://portal.hdfgroup.org/display/HDFVIEW/HDFView";
platforms = lib.platforms.linux ++ lib.platforms.darwin;
maintainers = with lib.maintainers; [ jiegec ];
};
}