1{ stdenv, fetchurl, unzip, jre, coreutils, makeDesktopItem }:
2
3stdenv.mkDerivation rec {
4 name = "basex-7.8.2";
5
6 src = fetchurl {
7 url = "http://files.basex.org/releases/7.8.2/BaseX782.zip";
8 sha256 = "0i9h7fsvn8cy1g44f23iyqndwamvx4kvyc4y3i00j15qm6qd2kbm";
9 };
10
11 buildInputs = [ unzip jre ];
12
13 desktopItem = makeDesktopItem {
14 name = "basex";
15 exec = "basexgui %f";
16 icon = "${./basex.svg}"; # icon copied from Ubuntu basex package
17 comment = "Visually query and analyse your XML data";
18 desktopName = "BaseX XML Database";
19 genericName = "XML database tool";
20 categories = "Development;Utility;Database";
21 mimeType = "text/xml";
22 };
23
24 # We're using a pre-built package
25 configurePhase = "true";
26 buildPhase = "true";
27 installPhase = ''
28 mkdir -p "$out"
29 cp -r * "$out"
30
31 # Remove Windows batch files (unclutter $out/bin)
32 rm -f "$out"/bin/*.bat
33
34 # Move some top-level stuff to $out/share/basex (unclutter $out)
35 mkdir -p "$out/share/basex"
36 mv "$out"/*.txt "$out/share/basex/"
37 mv "$out"/webapp "$out/share/basex/"
38
39 # Remove empty directories
40 rmdir "$out/repo"
41 rmdir "$out/data"
42
43 # Install desktop file
44 mkdir -p "$out/share/applications"
45 cp "$desktopItem"/share/applications/* "$out/share/applications/"
46
47 # Use substitutions instead of wrapper scripts
48 for file in "$out"/bin/*; do
49 sed -i -e "s|/usr/bin/env bash|${stdenv.shell}|" \
50 -e "s|java|${jre}/bin/java|" \
51 -e "s|readlink|${coreutils}/bin/readlink|" \
52 -e "s|dirname|${coreutils}/bin/dirname|" \
53 -e "s|basename|${coreutils}/bin/basename|" \
54 -e "s|echo|${coreutils}/bin/echo|" \
55 "$file"
56 done
57 '';
58
59 meta = with stdenv.lib; {
60 description = "XML database and XPath/XQuery processor";
61 longDescription = ''
62 BaseX is a very fast and light-weight, yet powerful XML database and
63 XPath/XQuery processor, including support for the latest W3C Full Text
64 and Update Recommendations. It supports large XML instances and offers a
65 highly interactive front-end (basexgui). Apart from two local standalone
66 modes, BaseX offers a client/server architecture.
67 '';
68 homepage = http://basex.org/;
69 license = licenses.bsd3;
70 platforms = platforms.linux;
71 maintainers = [ maintainers.bjornfor ];
72 };
73}