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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
|
{
lib,
stdenvNoCC,
fetchurl,
unzip,
jre,
jre8,
genericUpdater,
writeShellScript,
makeWrapper,
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,
}:
stdenvNoCC.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
makeWrapper
];
sourceRoot = ".";
installPhase = ''
runHook preInstall
install -Dm444 -t $out/share/java/ *.jar
mv doc $out/share
mkdir -p $out/bin
makeWrapper ${lib.getExe jre} $out/bin/${mainProgram} \
--add-flags "-jar $out/share/java/${jar'}.jar"
# Other distributions like debian distribute it as saxon*-xslt,
# this makes compilling packages that target other distros easier.
ln -s $out/bin/${mainProgram} $out/bin/${mainProgram}-xslt
''
+ lib.optionalString (versionAtLeast finalAttrs.version "11") ''
mv lib $out/share/java
''
+ lib.optionalString (versionAtLeast finalAttrs.version "8") ''
makeWrapper ${lib.getExe jre} $out/bin/transform \
--add-flags "-cp $out/share/java/${jar'}.jar net.sf.saxon.Transform"
makeWrapper ${lib.getExe jre} $out/bin/query \
--add-flags "-cp $out/share/java/${jar'}.jar net.sf.saxon.Query"
''
+ "runHook postInstall";
passthru = lib.optionalAttrs (updateScript != null) {
inherit updateScript;
};
meta = {
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 lib.sourceTypes; [ binaryBytecode ];
maintainers = with lib.maintainers; [ rvl ];
platforms = lib.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/OldFiles/${version}/saxon${
builtins.replaceStrings [ "." ] [ "_" ] version
}.zip";
hash = "sha256-Q28wzqyUCPBJ2C3a8acdG2lmeee8GeEAgg9z8oUfvlA=";
};
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";
hash = "sha256-aOk+BB5kAbZElAifVG+AP1bo7Se3patzISA40bzLf5U=";
};
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.7";
jar = "saxon-he-${version}";
src = fetchurl {
url = github.downloadUrl version;
sha256 = "MGzhUW9ZLVvTSqEdpAZWAiwTYxCZxbn26zESDmIe4Vo=";
};
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.10";
jar = "saxon-he-${version}";
src = fetchurl {
url = github.downloadUrl version;
hash = "sha256-HH259ybfg1NJxk7dYx3gMQ7KMSkRACMAZOuhU/YHsL4=";
};
updateScript = github.updateScript version;
description = "Processor for XSLT 3.0, XPath 3.1, and XQuery 3.1";
};
}
|