diff options
Diffstat (limited to 'pkgs/tools/graphics/asymptote/default.nix')
-rw-r--r-- | pkgs/tools/graphics/asymptote/default.nix | 82 |
1 files changed, 58 insertions, 24 deletions
diff --git a/pkgs/tools/graphics/asymptote/default.nix b/pkgs/tools/graphics/asymptote/default.nix index aeb51d66bf6f0..4af2e3be53719 100644 --- a/pkgs/tools/graphics/asymptote/default.nix +++ b/pkgs/tools/graphics/asymptote/default.nix @@ -4,29 +4,26 @@ , boehmgc, libGLU, libGL, mesa, ncurses, readline, gsl, libsigsegv , python3, qtbase, qtsvg, boost , zlib, perl, curl -, texliveSmall, texinfo +, texinfo +, texlive +, texliveSmall , darwin }: -stdenv.mkDerivation rec { - version = "2.88"; +stdenv.mkDerivation (finalAttrs: { + version = "2.89"; pname = "asymptote"; outputs = [ "out" "man" "info" "doc" "tex" ]; src = fetchurl { - url = "mirror://sourceforge/asymptote/${version}/asymptote-${version}.src.tgz"; - hash = "sha256-DecadD+m7pORuH3Sdcs/5M3vUbN6rhSkFoNN0Soq9bs="; + url = "mirror://sourceforge/asymptote/${finalAttrs.version}/asymptote-${finalAttrs.version}.src.tgz"; + hash = "sha256-9k5itO5PhfGnhkDE8eim+Y6R9U7ayrGXJ8fKvpSlf1s="; }; - patches = [ - (fetchpatch { - # partial fix for macOS XDR/V3D support (LDFLAGS change seems like an unrelated bugfix) - name = "restore-LDFLAGS-dont-look-for-tirpc-under-MacOS.patch"; - url = "https://github.com/vectorgraphics/asymptote/commit/7e17096b22d18d133d1bc5916b6e32c0cb24ad10.patch"; - hash = "sha256-olCFzqfZwWOAjqlB5lDPXYRHU9i3VQNgoR0cO5TmW98="; - }) - ]; + # override with TeX Live containers to avoid building sty, docs from source + texContainer = null; + texdocContainer = null; nativeBuildInputs = [ autoreconfHook @@ -37,13 +34,13 @@ stdenv.mkDerivation rec { wrapQtAppsHook cmake pkg-config - ]; + ] ++ lib.optional (finalAttrs.texContainer == null || finalAttrs.texdocContainer == null) + (texliveSmall.withPackages (ps: with ps; [ epsf cm-super ps.texinfo media9 ocgx2 collection-latexextra ])); buildInputs = [ ghostscriptX imagemagick fftw eigen boehmgc ncurses readline gsl libsigsegv zlib perl curl qtbase qtsvg boost - (texliveSmall.withPackages (ps: with ps; [ epsf cm-super ps.texinfo media9 ocgx2 collection-latexextra ])) (python3.withPackages (ps: with ps; [ cson numpy pyqt5 ])) ] ++ lib.optionals stdenv.isLinux [ libtirpc ]; @@ -57,12 +54,25 @@ stdenv.mkDerivation rec { dontWrapQtApps = true; - # Do not build $tex/ls-R which will be generated by texlive.combine + # do not build $tex/ls-R which will be generated by texlive.withPackages + # do not build and install sty and docs, if provided by tex/texdoc texlive containers + # (this is an optimisation to make texliveMedium and texliveFull independent of texliveSmall) preConfigure = '' HOME=$TMP substituteInPlace Makefile.in \ - --replace-fail 'install: install-notexhash install-texhash' 'install: install-notexhash install-asy' - prependToVar configureFlags "--with-latex=$tex/tex/latex" "--with-context=$tex/tex/context/third" + --replace-fail ' install-texhash' ''' + if [[ -n $texContainer ]] ; then + sed -i Makefile.in -e '/(\(latex\|context\)dir)/d' + substituteInPlace Makefile.in \ + --replace-fail 'asy sty' 'asy' + else + prependToVar configureFlags "--with-latex=$tex/tex/latex" "--with-context=$tex/tex/context/third" + fi + if [[ -n $texdocContainer ]] ; then + substituteInPlace Makefile.in \ + --replace-fail ' install-man' ''' \ + --replace-fail 'docdir = $(DESTDIR)@docdir@' 'docdir = $(TMP)/doc' + fi ''; # do not use bundled libgc.so @@ -76,12 +86,36 @@ stdenv.mkDerivation rec { rm "$out"/bin/xasy makeQtWrapper "$out"/share/asymptote/GUI/xasy.py "$out"/bin/xasy --prefix PATH : "$out"/bin - mv "$info"/share/info/asymptote/*.info "$info"/share/info/ - sed -i -e 's|(asymptote/asymptote)|(asymptote)|' "$info"/share/info/asymptote.info - rmdir "$info"/share/info/asymptote - rm -f "$info"/share/info/dir + if [[ -z $texdocContainer ]] ; then + mv "$info"/share/info/asymptote/*.info "$info"/share/info/ + sed -i -e 's|(asymptote/asymptote)|(asymptote)|' "$info"/share/info/asymptote.info + rmdir "$info"/share/info/asymptote + rm -f "$info"/share/info/dir + fi + install -Dt $out/share/emacs/site-lisp/${finalAttrs.pname} $out/share/asymptote/*.el + ''; + + # fixupPhase crashes if the outputs are not directories + preFixup = '' + if [[ -n $texContainer ]] ; then + mkdir -p "$tex" + fi + if [[ -n $texdocContainer ]] ; then + mkdir -p "$doc" "$man" "$info" + fi + ''; - install -Dt $out/share/emacs/site-lisp/${pname} $out/share/asymptote/*.el + postFixup = '' + if [[ -n $texContainer ]] ; then + rmdir "$tex" + ln -s "$texContainer" "$tex" + fi + if [[ -n $texdocContainer ]] ; then + mkdir -p "$man/share" "$info/share" + ln -s "$texdocContainer" "$doc/share" + ln -s "$texdocContainer/doc/man" "$man/share" + ln -s "$texdocContainer/doc/info" "$info/share" + fi ''; dontUseCmakeConfigure = true; @@ -98,4 +132,4 @@ stdenv.mkDerivation rec { maintainers = [ maintainers.raskin ]; platforms = platforms.linux ++ platforms.darwin; }; -} +}) |