summaryrefslogtreecommitdiffstats
path: root/pkgs/by-name/xm/xmlbeans/package.nix
blob: cf465b645eeaadfc193683ae8e817be3bc85ad1e (plain)
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
{
  lib,
  stdenv,
  fetchzip,
  jre_headless,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "xmlbeans";
  version = "5.3.0-20241203";

  src = fetchzip {
    # old releases are deleted from the cdn
    url = "https://web.archive.org/web/20250404194918/https://dlcdn.apache.org/poi/xmlbeans/release/bin/apache-xmlbeans-bin-5.3.0-20241203.zip";
    hash = "sha256-AeV+s0VfBgb0YbsY6dNJeqcsguZhDmjuyqXT/415a3k=";
    stripRoot = false;
  };

  postPatch = ''
    cp -r apache-xmlbeans-*/* .
    rm -r apache-xmlbeans-*
    rm bin/*.cmd
    substituteInPlace bin/dumpxsb \
      --replace-fail 'echo `dirname $0`' ""
    substituteInPlace bin/_setlib \
      --replace-fail 'echo XMLBEANS_LIB=$XMLBEANS_LIB' ""
    for file in bin/*; do
      substituteInPlace $file \
        --replace-warn "java " "${jre_headless}/bin/java "
    done
  '';

  installPhase = ''
    runHook preInstall

    mkdir -p $out
    chmod +x bin/*
    cp -r bin/ lib/ $out/

    runHook postInstall
  '';

  meta = {
    description = "Java library for accessing XML by binding it to Java types";
    homepage = "https://xmlbeans.apache.org/";
    downloadPage = "https://dlcdn.apache.org/poi/xmlbeans/release/bin/";
    license = lib.licenses.asl20;
    maintainers = [ ];
  };
})