1 { lib, stdenv, fetchurl
2 , autoreconfHook, bison, glm, flex, wrapQtAppsHook, cmake, pkg-config
3 , libglut, ghostscriptX, imagemagick, fftw, eigen, libtirpc
4 , boehmgc, libGLU, libGL, ncurses, readline, gsl, libsigsegv
5 , python3, qtbase, qtsvg, boost
12 stdenv.mkDerivation (finalAttrs: {
16 outputs = [ "out" "man" "info" "doc" "tex" ];
19 url = "mirror://sourceforge/asymptote/${finalAttrs.version}/asymptote-${finalAttrs.version}.src.tgz";
20 hash = "sha256-nZtcb6fg+848HlT+sl4tUdKMT+d5jyTHbNyugpGo6mY=";
23 # override with TeX Live containers to avoid building sty, docs from source
25 texdocContainer = null;
36 ] ++ lib.optional (finalAttrs.texContainer == null || finalAttrs.texdocContainer == null)
37 (texliveSmall.withPackages (ps: with ps; [ epsf cm-super ps.texinfo media9 ocgx2 collection-latexextra ]));
40 ghostscriptX imagemagick fftw eigen
41 boehmgc ncurses readline gsl libsigsegv
42 zlib perl curl qtbase qtsvg boost
43 (python3.withPackages (ps: with ps; [ cson numpy pyqt5 ]))
44 ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libtirpc ];
46 propagatedBuildInputs = [
48 ] ++ lib.optionals stdenv.hostPlatform.isLinux [
50 ] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
54 dontWrapQtApps = true;
56 # do not build $tex/ls-R which will be generated by texlive.withPackages
57 # do not build and install sty and docs, if provided by tex/texdoc texlive containers
58 # (this is an optimisation to make texliveMedium and texliveFull independent of texliveSmall)
61 substituteInPlace Makefile.in \
62 --replace-fail ' install-texhash' '''
63 if [[ -n $texContainer ]] ; then
64 sed -i Makefile.in -e '/(\(latex\|context\)dir)/d'
65 substituteInPlace Makefile.in \
66 --replace-fail 'asy sty' 'asy'
68 prependToVar configureFlags "--with-latex=$tex/tex/latex" "--with-context=$tex/tex/context/third"
70 if [[ -n $texdocContainer ]] ; then
71 substituteInPlace Makefile.in \
72 --replace-fail ' install-man' ''' \
73 --replace-fail 'docdir = $(DESTDIR)@docdir@' 'docdir = $(TMP)/doc'
77 # do not use bundled libgc.so
78 configureFlags = [ "--enable-gc=system" ]
79 # TODO add open_memstream to enable XDR/V3D on Darwin (requires memstream or >=10.13 Apple SDK)
80 ++ lib.optional stdenv.hostPlatform.isDarwin "--enable-xdr=no";
82 env.NIX_CFLAGS_COMPILE = "-I${boehmgc.dev}/include/gc";
86 makeQtWrapper "$out"/share/asymptote/GUI/xasy.py "$out"/bin/xasy --prefix PATH : "$out"/bin
88 if [[ -z $texdocContainer ]] ; then
89 mv "$info"/share/info/asymptote/*.info "$info"/share/info/
90 sed -i -e 's|(asymptote/asymptote)|(asymptote)|' "$info"/share/info/asymptote.info
91 rmdir "$info"/share/info/asymptote
92 rm -f "$info"/share/info/dir
94 install -Dt $out/share/emacs/site-lisp/${finalAttrs.pname} $out/share/asymptote/*.el
97 # fixupPhase crashes if the outputs are not directories
99 if [[ -n $texContainer ]] ; then
102 if [[ -n $texdocContainer ]] ; then
103 mkdir -p "$doc" "$man" "$info"
108 if [[ -n $texContainer ]] ; then
110 ln -s "$texContainer" "$tex"
112 if [[ -n $texdocContainer ]] ; then
113 mkdir -p "$man/share" "$info/share"
114 ln -s "$texdocContainer" "$doc/share"
115 ln -s "$texdocContainer/doc/man" "$man/share"
116 ln -s "$texdocContainer/doc/info" "$info/share"
120 dontUseCmakeConfigure = true;
122 enableParallelBuilding = true;
123 # Missing install depends:
124 # ...-coreutils-9.1/bin/install: cannot stat 'asy-keywords.el': No such file or directory
125 # make: *** [Makefile:272: install-asy] Error 1
126 enableParallelInstalling = false;
129 description = "Tool for programming graphics intended to replace Metapost";
130 license = licenses.gpl3Plus;
131 maintainers = [ maintainers.raskin ];
132 platforms = platforms.linux ++ platforms.darwin;