Unverified Commit 11ce9e84 authored by Pierre Bourdon's avatar Pierre Bourdon Committed by GitHub
Browse files

Merge pull request #269525 from NixOS/backport-269191-to-release-23.11

[Backport release-23.11] protege-distribution: 5.5.0 -> 5.6.3
parents f8174fb2 0a287f45
Loading
Loading
Loading
Loading
+24 −18
Original line number Diff line number Diff line
{ lib, stdenv, fetchurl, unzip, jre8
{ lib
, stdenv
, fetchurl
, unzip
, jdk11
, copyDesktopItems
, makeDesktopItem
, iconConvTools
, makeDesktopItem
, makeWrapper
}:

stdenv.mkDerivation rec {
  pname = "protege-distribution";
  version = "5.5.0";
  version = "5.6.3";

  src = fetchurl {
    url = "https://github.com/protegeproject/protege-distribution/releases/download/v${version}/Protege-${version}-platform-independent.zip";
    sha256 = "092x22wyisdnhccx817mqq15sxqdfc7iz4whr4mbvzrd9di6ipjq";
    url = "https://github.com/protegeproject/protege-distribution/releases/download/protege-${version}/Protege-${version}-platform-independent.zip";
    sha256 = "08pr0rn76wcc9bczdf93nlshxbid4z4nyvmaz198hhlq96aqpc3i";
  };

  nativeBuildInputs = [ unzip copyDesktopItems iconConvTools ];
  nativeBuildInputs = [
    copyDesktopItems
    iconConvTools
    jdk11
    makeWrapper
    unzip
  ];

  patches = [
    # Replace logic for searching the install directory with a static cd into $out
@@ -23,11 +34,8 @@ stdenv.mkDerivation rec {
  ];

  postPatch = ''
    # Resolve @out@ (introduced by "static-path.patch") to $out, and set the
    # correct Java executable (Protege is a JRE 8 application)
    substituteInPlace run.sh \
      --subst-var-by out $out \
      --replace "java -X" "exec ${jre8.outPath}/bin/java -X"
    # Resolve @out@ (introduced by "static-path.patch") to $out
    substituteInPlace run.sh --subst-var-by out $out
  '';

  dontConfigure = true;
@@ -36,20 +44,18 @@ stdenv.mkDerivation rec {
  installPhase = ''
    runHook preInstall

    mkdir $out

    # Delete non-Linux launch scripts
    rm run.{bat,command}
    mkdir -p $out/bin

    # Move launch script into /bin, giving it a recognizable name
    install -D run.sh $out/bin/run-protege
    # Wrap launch script to set $JAVA_HOME correctly
    mv run.sh $out/bin/run-protege
    wrapProgram  $out/bin/run-protege --set JAVA_HOME ${jdk11.home}

    # Generate and copy icons to where they can be found
    icoFileToHiColorTheme app/Protege.ico protege $out

    # Move everything else under protege/
    mkdir $out/protege
    mv {bin,bundles,conf,plugins} $out/protege
    mv {bundles,conf,plugins} $out/protege

    runHook postInstall
  '';