about summary refs log tree commit diff
path: root/nixpkgs/pkgs/applications/science/math/eukleides/default.nix
blob: b5a9fc3fa86db8d81633c4bbaf26badc2a3d600e (plain) (blame)
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
{ lib, stdenv, fetchurl, bison, flex, makeWrapper, texinfo, readline, texLive }:

lib.fix (eukleides: stdenv.mkDerivation rec {
  pname = "eukleides";
  version = "1.5.4";

  src = fetchurl {
    url = "http://www.eukleides.org/files/${pname}-${version}.tar.bz2";
    sha256 = "0s8cyh75hdj89v6kpm3z24i48yzpkr8qf0cwxbs9ijxj1i38ki0q";
  };

  # use $CC instead of hardcoded gcc
  patches = [ ./use-CC.patch ];

  nativeBuildInputs = [ bison flex texinfo makeWrapper ];

  buildInputs = [ readline texLive ];

  preConfigure = ''
    substituteInPlace Makefile \
      --replace mktexlsr true

    substituteInPlace doc/Makefile \
      --replace ginstall-info install-info

    substituteInPlace Config \
      --replace '/usr/local' "$out" \
      --replace '$(SHARE_DIR)/texmf' "$tex"
  '';

  preInstall = ''
    mkdir -p $out/bin
  '';

  postInstall = ''
    wrapProgram $out/bin/euktoeps \
      --set-default TEXINPUTS : \
      --prefix TEXINPUTS : "$tex/tex/latex/eukleides" \
      --prefix PATH : "${texLive}/bin"
    wrapProgram $out/bin/euktopdf \
      --set-default TEXINPUTS : \
      --prefix TEXINPUTS : "$tex/tex/latex/eukleides" \
      --prefix PATH : "${texLive}/bin"
  '';

  outputs = [ "out" "doc" "tex" ];

  passthru.tlType = "run";
  passthru.pkgs = [ eukleides.tex ];

  meta = {
    description = "Geometry Drawing Language";
    homepage = "http://www.eukleides.org/";
    license = lib.licenses.gpl3Plus;

    longDescription = ''
      Eukleides is a computer language devoted to elementary plane
      geometry. It aims to be a fairly comprehensive system to create
      geometric figures, either static or dynamic. Eukleides allows to
      handle basic types of data: numbers and strings, as well as
      geometric types of data: points, vectors, sets (of points), lines,
      circles and conics.
    '';

    platforms = lib.platforms.unix;
    maintainers = [ lib.maintainers.peti ];
  };
})