From 30b5330e85883acdcb0502349ce67878529f58ce Mon Sep 17 00:00:00 2001 From: Stefan Frijters Date: Sun, 9 May 2021 11:39:58 +0200 Subject: [PATCH] eukleides: Fix build, expose tex package --- .../science/math/eukleides/default.nix | 50 +++++++++++++++---- 1 file changed, 39 insertions(+), 11 deletions(-) diff --git a/pkgs/applications/science/math/eukleides/default.nix b/pkgs/applications/science/math/eukleides/default.nix index 5f7fe58465d0..94a90127ed8b 100644 --- a/pkgs/applications/science/math/eukleides/default.nix +++ b/pkgs/applications/science/math/eukleides/default.nix @@ -1,21 +1,49 @@ -{ 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"; @@ -34,4 +62,4 @@ stdenv.mkDerivation { platforms = lib.platforms.linux; maintainers = [ lib.maintainers.peti ]; }; -} +})