1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
{ lib
, stdenv
, fetchurl
, unzip
, jre
, jre8
, genericUpdater
, writeShellScript
, common-updater-scripts
, gnused
}:
let
inherit (lib.versions) major majorMinor splitVersion;
inherit (lib.strings) concatStringsSep versionAtLeast;
common = { pname, version, src, description, java ? jre
, prog ? null, jar ? null, license ? lib.licenses.mpl20
, updateScript ? null }:
stdenv.mkDerivation (finalAttrs: let
mainProgram = if prog == null then pname else prog;
jar' = if jar == null then pname else jar;
in {
inherit pname version src;
nativeBuildInputs = [ unzip ];
buildCommand = ''
unzip $src -d $out
mkdir -p $out/bin $out/share $out/share/java
cp -s "$out"/*.jar "$out/share/java/" # */
rm -rf $out/notices
mv $out/doc $out/share
cat > $out/bin/${mainProgram} <<EOF
#! $shell
export JAVA_HOME=${jre}
exec ${jre}/bin/java -jar $out/${jar'}.jar "\$@"
EOF
chmod a+x $out/bin/${mainProgram}
'';
passthru = lib.optionalAttrs (updateScript != null) {
inherit updateScript;
};
meta = with lib; {
inherit description license mainProgram;
homepage = if versionAtLeast finalAttrs.version "11"
then "https://www.saxonica.com/products/latest.xml"
else "https://www.saxonica.com/products/archive.xml";
sourceProvenance = with sourceTypes; [ binaryBytecode ];
maintainers = with maintainers; [ rvl ];
platforms = platforms.all;
};
});
# Saxon release zipfiles and tags often use dashes instead of dots.
dashify = version: concatStringsSep "-" (splitVersion version);
# SaxonJ-HE release files are pushed to the Saxon-HE GitHub repository.
# They are also available from Maven.
#
# Older releases were uploaded to SourceForge. They are also
# available from the Saxon-Archive GitHub repository.
github = {
updateScript = version: genericUpdater {
versionLister = writeShellScript "saxon-he-versionLister" ''
export PATH="${lib.makeBinPath [ common-updater-scripts gnused ]}:$PATH"
major_ver="${major version}"
list-git-tags --url="https://github.com/Saxonica/Saxon-HE.git" \
| sed -En \
-e "s/SaxonHE([0-9]+)-([0-9]+)/\1.\2/" \
-e "/^''${major_ver:-[0-9]+}\./p"
'';
};
downloadUrl = version: let
tag = "SaxonHE${dashify version}";
filename = "${major version}/Java/${tag}J.zip";
in
"https://raw.githubusercontent.com/Saxonica/Saxon-HE/${tag}/${filename}";
};
in {
saxon = common rec {
pname = "saxon";
version = "6.5.3";
src = fetchurl {
url = "mirror://sourceforge/saxon/saxon${dashify version}.zip";
sha256 = "0l5y3y2z4wqgh80f26dwwxwncs8v3nkz3nidv14z024lmk730vs3";
};
description = "XSLT 1.0 processor";
# https://saxon.sourceforge.net/saxon6.5.3/conditions.html
license = lib.licenses.mpl10;
java = jre8;
};
saxonb_8_8 = common rec {
pname = "saxonb";
version = "8.8";
jar = "saxon8";
src = fetchurl {
url = "mirror://sourceforge/saxon/saxonb${dashify version}j.zip";
sha256 = "15bzrfyd2f1045rsp9dp4znyhmizh1pm97q8ji2bc0b43q23xsb8";
};
description = "Complete and conformant processor of XSLT 2.0, XQuery 1.0, and XPath 2.0";
java = jre8;
};
saxonb_9_1 = common rec {
pname = "saxonb";
version = "9.1.0.8";
jar = "saxon9";
src = fetchurl {
url = "mirror://sourceforge/saxon/Saxon-B/${version}/saxonb${dashify version}j.zip";
sha256 = "1d39jdnwr3v3pzswm81zry6yikqlqy9dp2l2wmpqdiw00r5drg4j";
};
description = "Complete and conformant processor of XSLT 2.0, XQuery 1.0, and XPath 2.0";
};
# Saxon-HE (home edition) replaces Saxon-B as the open source
# version of the Saxon XSLT and XQuery processor.
saxon_9-he = common rec {
pname = "saxon-he";
version = "9.9.0.1";
jar = "saxon9he";
src = fetchurl {
url = "mirror://sourceforge/saxon/Saxon-HE/${majorMinor version}/SaxonHE${dashify version}J.zip";
sha256 = "1inxd7ia7rl9fxfrw8dy9sb7rqv76ipblaki5262688wf2dscs60";
};
description = "Processor for XSLT 3.0, XPath 2.0 and 3.1, and XQuery 3.1";
};
saxon_11-he = common rec {
pname = "saxon-he";
version = "11.6";
jar = "saxon-he-${version}";
src = fetchurl {
url = github.downloadUrl version;
sha256 = "/AVX5mtZSO6Is19t3+FlEvtIBsnwB3MIWAPCht8Aqnw=";
};
updateScript = github.updateScript version;
description = "Processor for XSLT 3.0, XPath 2.0 and 3.1, and XQuery 3.1";
};
saxon_12-he = common rec {
pname = "saxon-he";
version = "12.5";
jar = "saxon-he-${version}";
src = fetchurl {
url = github.downloadUrl version;
hash = "sha256-NaRnKHkr1M7C/CYtSHd7THm1ze7wPSmB46ZOyzoZ9xY=";
};
updateScript = github.updateScript version;
description = "Processor for XSLT 3.0, XPath 3.1, and XQuery 3.1";
};
}
|