Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 209 lines 4.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 autoreconfHook, 6 bison, 7 glm, 8 flex, 9 wrapQtAppsHook, 10 cmake, 11 pkg-config, 12 libglut, 13 ghostscriptX, 14 imagemagick, 15 fftw, 16 eigen, 17 libtirpc, 18 boehmgc, 19 libGLU, 20 libGL, 21 libglvnd, 22 ncurses, 23 readline, 24 gsl, 25 libsigsegv, 26 python3, 27 qtbase, 28 qtsvg, 29 boost186, 30 zlib, 31 perl, 32 curl, 33 texinfo, 34 texliveSmall, 35}: 36 37stdenv.mkDerivation (finalAttrs: { 38 version = "3.05"; 39 pname = "asymptote"; 40 41 outputs = [ 42 "out" 43 "man" 44 "info" 45 "doc" 46 "tex" 47 ]; 48 49 src = fetchurl { 50 url = "mirror://sourceforge/asymptote/${finalAttrs.version}/asymptote-${finalAttrs.version}.src.tgz"; 51 hash = "sha256-NcFtCjvdhppW5O//Rjj4HDqIsva2ZNGWRxAV2/TGmoc="; 52 }; 53 54 # override with TeX Live containers to avoid building sty, docs from source 55 texContainer = null; 56 texdocContainer = null; 57 58 nativeBuildInputs = [ 59 autoreconfHook 60 bison 61 flex 62 bison 63 texinfo 64 wrapQtAppsHook 65 cmake 66 ghostscriptX 67 perl 68 pkg-config 69 (python3.withPackages ( 70 ps: with ps; [ 71 click 72 cson 73 numpy 74 pyqt5 75 ] 76 )) 77 ] 78 ++ lib.optional (finalAttrs.texContainer == null || finalAttrs.texdocContainer == null) ( 79 texliveSmall.withPackages ( 80 ps: with ps; [ 81 epsf 82 cm-super 83 ps.texinfo 84 media9 85 ocgx2 86 collection-latexextra 87 ] 88 ) 89 ); 90 91 buildInputs = [ 92 ghostscriptX 93 imagemagick 94 fftw 95 eigen 96 boehmgc 97 ncurses 98 readline 99 gsl 100 libsigsegv 101 zlib 102 perl 103 curl 104 qtbase 105 qtsvg 106 # relies on removed asio::io_service 107 # https://github.com/kuafuwang/LspCpp/issues/52 108 boost186 109 (python3.withPackages ( 110 ps: with ps; [ 111 cson 112 numpy 113 pyqt5 114 ] 115 )) 116 ] 117 ++ lib.optionals stdenv.hostPlatform.isLinux [ libtirpc ]; 118 119 propagatedBuildInputs = [ 120 glm 121 ] 122 ++ lib.optionals stdenv.hostPlatform.isLinux [ 123 libglut 124 libGLU 125 libGL 126 libglvnd 127 ]; 128 129 dontWrapQtApps = true; 130 131 # do not build $tex/ls-R which will be generated by texlive.withPackages 132 # do not build and install sty and docs, if provided by tex/texdoc texlive containers 133 # (this is an optimisation to make texliveMedium and texliveFull independent of texliveSmall) 134 preConfigure = '' 135 HOME=$TMP 136 substituteInPlace Makefile.in \ 137 --replace-fail ' install-texhash' ''' 138 if [[ -n $texContainer ]] ; then 139 sed -i Makefile.in -e '/(\(latex\|context\)dir)/d' 140 substituteInPlace Makefile.in \ 141 --replace-fail 'asy sty' 'asy' 142 else 143 prependToVar configureFlags "--with-latex=$tex/tex/latex" "--with-context=$tex/tex/context/third" 144 fi 145 if [[ -n $texdocContainer ]] ; then 146 substituteInPlace Makefile.in \ 147 --replace-fail ' install-man' ''' \ 148 --replace-fail 'docdir = $(DESTDIR)@docdir@' 'docdir = $(TMP)/doc' 149 fi 150 ''; 151 152 # do not use bundled libgc.so 153 configureFlags = [ "--enable-gc=system" ]; 154 155 env.NIX_CFLAGS_COMPILE = "-I${boehmgc.dev}/include/gc"; 156 157 postInstall = '' 158 rm "$out"/bin/xasy 159 chmod +x "$out"/share/asymptote/GUI/xasy.py 160 makeQtWrapper "$out"/share/asymptote/GUI/xasy.py "$out"/bin/xasy --prefix PATH : "$out"/bin 161 162 if [[ -z $texdocContainer ]] ; then 163 mv "$info"/share/info/asymptote/*.info "$info"/share/info/ 164 sed -i -e 's|(asymptote/asymptote)|(asymptote)|' "$info"/share/info/asymptote.info 165 rmdir "$info"/share/info/asymptote 166 rm -f "$info"/share/info/dir 167 fi 168 install -Dt $out/share/emacs/site-lisp/${finalAttrs.pname} $out/share/asymptote/*.el 169 ''; 170 171 # fixupPhase crashes if the outputs are not directories 172 preFixup = '' 173 if [[ -n $texContainer ]] ; then 174 mkdir -p "$tex" 175 fi 176 if [[ -n $texdocContainer ]] ; then 177 mkdir -p "$doc" "$man" "$info" 178 fi 179 ''; 180 181 postFixup = '' 182 if [[ -n $texContainer ]] ; then 183 rmdir "$tex" 184 ln -s "$texContainer" "$tex" 185 fi 186 if [[ -n $texdocContainer ]] ; then 187 mkdir -p "$man/share" "$info/share" 188 ln -s "$texdocContainer" "$doc/share" 189 ln -s "$texdocContainer/doc/man" "$man/share" 190 ln -s "$texdocContainer/doc/info" "$info/share" 191 fi 192 ''; 193 194 dontUseCmakeConfigure = true; 195 196 enableParallelBuilding = true; 197 # Missing install depends: 198 # ...-coreutils-9.1/bin/install: cannot stat 'asy-keywords.el': No such file or directory 199 # make: *** [Makefile:272: install-asy] Error 1 200 enableParallelInstalling = false; 201 202 meta = with lib; { 203 description = "Tool for programming graphics intended to replace Metapost"; 204 homepage = "https://asymptote.sourceforge.io/"; 205 license = licenses.gpl3Plus; 206 maintainers = [ maintainers.raskin ]; 207 platforms = platforms.linux ++ platforms.darwin; 208 }; 209})