1{
2 lib,
3 fetchFromGitHub,
4 copyDesktopItems,
5 iconConvTools,
6 makeDesktopItem,
7 makeWrapper,
8 jdk11,
9 maven,
10}:
11
12maven.buildMavenPackage rec {
13 pname = "protege";
14 version = "5.6.4";
15
16 src = fetchFromGitHub {
17 owner = "protegeproject";
18 repo = "protege";
19 rev = version;
20 hash = "sha256-Q3MHa7nCeF31n7JPltcemFBc/sJwGA9Ev0ymjQhY/U0=";
21 };
22
23 mvnJdk = jdk11;
24 mvnHash = "sha256-kemP2gDv1CYuaoK0fwzBxdLTusarPasf2jCDQj/HPYE=";
25
26 patches = [
27 # Pin built-in Maven plugins to avoid checksum variations on Maven updates
28 ./enforce-plugin-versions.patch
29 # Avoid building platform-dependent builds which embed their own JREs
30 ./platform-independent-only.patch
31 ];
32
33 nativeBuildInputs = [
34 copyDesktopItems
35 iconConvTools
36 jdk11
37 makeWrapper
38 ];
39
40 installPhase = ''
41 runHook preInstall
42
43 mkdir -p $out/bin $out/share/protege
44
45 # Copy the application directory whole into the output, as it is used by the
46 # launcher script as a reference point to look for default configuration
47 mv protege-desktop/target/protege-${version}-platform-independent/Protege-${version} $out/Protege
48
49 # Place a wrapper for the launcher script into a default /bin location
50 makeWrapper $out/Protege/run.sh $out/bin/protege \
51 --set JAVA_HOME ${jdk11.home}
52
53 # Link all jars from within the standard /share/protege directory
54 ln -s -t $out/share/protege $out/Protege/bundles/*
55
56 # Generate and copy icons to where they can be found
57 icoFileToHiColorTheme $out/Protege/app/Protege.ico protege $out
58
59 runHook postInstall
60 '';
61
62 desktopItems = [
63 (makeDesktopItem {
64 name = pname;
65 desktopName = "Protege Desktop";
66 genericName = "Ontology Editor";
67 icon = "protege";
68 comment = meta.description;
69 categories = [ "Development" ];
70 exec = "protege";
71 })
72 ];
73
74 meta = {
75 homepage = "https://protege.stanford.edu/";
76 downloadPage = "https://protege.stanford.edu/software.php#desktop-protege";
77 description = "Free and open-source OWL 2 ontology editor";
78 longDescription = ''
79 Protégé Desktop is a feature rich ontology editing environment with full
80 support for the OWL 2 Web Ontology Language, and direct in-memory
81 connections to description logic reasoners.
82 '';
83 maintainers = with lib.maintainers; [ nessdoor ];
84 license = with lib.licenses; [ bsd2 ];
85 # TODO Protege is able to run on Darwin as well, but I (@nessdoor) had no
86 # way of testing it nor any experience in packaging Darwin apps, so I
87 # will leave the task to someone who has the right tools and knowledge.
88 platforms = lib.platforms.unix;
89 mainProgram = "protege";
90 sourceProvenance = with lib.sourceTypes; [
91 fromSource
92 binaryBytecode
93 ];
94 };
95}