nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 112 lines 3.1 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 ant, 6 jdk, 7 hdf4, 8 hdf5, 9 makeDesktopItem, 10 copyDesktopItems, 11 strip-nondeterminism, 12 stripJavaArchivesHook, 13}: 14 15stdenv.mkDerivation (finalAttrs: { 16 pname = "hdfview"; 17 version = "3.3.2"; 18 19 src = fetchFromGitHub { 20 owner = "HDFGroup"; 21 repo = "hdfview"; 22 tag = "v${finalAttrs.version}"; 23 sha256 = "sha256-aJHeknkF38qDH9l+vuzdKFZZTcs/XMjtlHuu/LTF124="; 24 }; 25 26 patches = [ 27 # Hardcode isUbuntu=false to avoid calling hostname to detect os 28 ./0001-Hardcode-isUbuntu-false-to-avoid-hostname-dependency.patch 29 # Disable signing on macOS 30 ./disable-mac-signing.patch 31 # Remove timestamp comment from generated versions.properties file 32 ./remove-properties-timestamp.patch 33 ]; 34 35 nativeBuildInputs = [ 36 ant 37 jdk 38 copyDesktopItems 39 strip-nondeterminism 40 stripJavaArchivesHook 41 ]; 42 43 HDFLIBS = (hdf4.override { javaSupport = true; }).out; 44 HDF5LIBS = (hdf5.override { javaSupport = true; }).out; 45 46 buildPhase = 47 let 48 arch = if stdenv.hostPlatform.isx86_64 then "x86_64" else "aarch64"; 49 in 50 '' 51 runHook preBuild 52 53 ant createJPackage -Dmachine.arch=${arch} 54 55 runHook postBuild 56 ''; 57 58 desktopItem = makeDesktopItem rec { 59 name = "HDFView"; 60 desktopName = name; 61 exec = name; 62 icon = name; 63 comment = finalAttrs.finalPackage.meta.description; 64 categories = [ 65 "Science" 66 "DataVisualization" 67 ]; 68 }; 69 70 installPhase = '' 71 runHook preInstall 72 '' 73 + lib.optionalString stdenv.hostPlatform.isLinux '' 74 mkdir -p $out/bin $out/lib 75 cp -a build/dist/HDFView/bin/HDFView $out/bin/ 76 cp -a build/dist/HDFView/lib/app $out/lib/ 77 cp -a build/dist/HDFView/lib/libapplauncher.so $out/lib/ 78 ln -s ${jdk}/lib/openjdk $out/lib/runtime 79 80 mkdir -p $out/share/applications $out/share/icons/hicolor/32x32/apps 81 cp src/HDFView.png $out/share/icons/hicolor/32x32/apps/ 82 '' 83 + lib.optionalString stdenv.hostPlatform.isDarwin '' 84 mkdir -p $out/Applications 85 cp -a build/dist/HDFView.app $out/Applications/ 86 '' 87 + '' 88 runHook postInstall 89 ''; 90 91 preFixup = '' 92 # Remove build timestamp from javadoc files 93 find $out/lib/app{,/mods}/doc/javadocs -name "*.html" -exec strip-nondeterminism --type javadoc {} + 94 ''; 95 96 meta = { 97 description = "Visual tool for browsing and editing HDF4 and HDF5 files"; 98 license = lib.licenses.free; # BSD-like 99 homepage = "https://www.hdfgroup.org/downloads/hdfview"; 100 downloadPage = "https://github.com/HDFGroup/hdfview"; 101 platforms = lib.platforms.unix; 102 maintainers = with lib.maintainers; [ jiegec ]; 103 mainProgram = "HDFView"; 104 # Startup issue is described here: 105 # https://github.com/NixOS/nixpkgs/issues/340048 A possible solution is 106 # suggested here: 107 # https://forum.hdfgroup.org/t/building-hdfview-3-1-0-on-centos-6-swt-library-not-found/5698 108 # But it requires us to update swt, which is a bit hard, the swt update is tracked here: 109 # https://github.com/NixOS/nixpkgs/issues/219771 110 broken = true; 111 }; 112})