summary refs log tree commit diff
path: root/pkgs/applications
diff options
context:
space:
mode:
authorVladimír Čunát <v@cunat.cz>2021-05-16 10:21:22 +0200
committerVladimír Čunát <v@cunat.cz>2021-05-16 10:35:28 +0200
commit9de0430aace2b7fae8e0cc0e94345b79fb366b14 (patch)
treed4c409176e3855c2e9daa6b2d32b9bf6e86f6758 /pkgs/applications
parent6adf079ce5f1cf71f4134cd2eed448935b4c9170 (diff)
parent06e7dc2f436dadcaefe946d43f3810b67f34fef7 (diff)
downloadnixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar.gz
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar.bz2
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar.lz
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar.xz
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.tar.zst
nixpkgs-9de0430aace2b7fae8e0cc0e94345b79fb366b14.zip
Merge #122322: eukleides: Fix build, expose tex package
Diffstat (limited to 'pkgs/applications')
-rw-r--r--pkgs/applications/science/math/eukleides/default.nix52
1 files changed, 40 insertions, 12 deletions
diff --git a/pkgs/applications/science/math/eukleides/default.nix b/pkgs/applications/science/math/eukleides/default.nix
index 5f7fe58465d..fe498fdbd8a 100644
--- a/pkgs/applications/science/math/eukleides/default.nix
+++ b/pkgs/applications/science/math/eukleides/default.nix
@@ -1,26 +1,54 @@
-{ lib, stdenv, fetchurl, bison, flex, texinfo, readline, texLive }:
+{ lib, stdenv, fetchurl, bison, flex, makeWrapper, texinfo, readline, texLive }:
 
-let
-  name    = "eukleides";
+lib.fix (eukleides: stdenv.mkDerivation rec {
+  pname = "eukleides";
   version = "1.5.4";
-in
-stdenv.mkDerivation {
-  name = "${name}-${version}";
 
   src = fetchurl {
-    url = "http://www.eukleides.org/files/${name}-${version}.tar.bz2";
+    url = "http://www.eukleides.org/files/${pname}-${version}.tar.bz2";
     sha256 = "0s8cyh75hdj89v6kpm3z24i48yzpkr8qf0cwxbs9ijxj1i38ki0q";
   };
 
-  buildInputs = [bison flex texinfo readline texLive];
+  nativeBuildInputs = [ bison flex texinfo makeWrapper ];
 
-  preConfigure = "sed -i 's/ginstall-info/install-info/g' doc/Makefile";
-  installPhase = "mkdir -p $out/bin ; make PREFIX=$out install";
+  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.gpl2;
+    license = lib.licenses.gpl3Plus;
 
     longDescription = ''
       Eukleides is a computer language devoted to elementary plane
@@ -34,4 +62,4 @@ stdenv.mkDerivation {
     platforms = lib.platforms.linux;
     maintainers = [ lib.maintainers.peti ];
   };
-}
+})