Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at devShellTools-shell 79 lines 1.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 ocamlPackages, 6 makeWrapper, 7 libGLU, 8 libGL, 9 libglut, 10 mpfr, 11 gmp, 12 pkgsHostTarget, 13}: 14 15let 16 inherit (pkgsHostTarget.targetPackages.stdenv) cc; 17in 18 19stdenv.mkDerivation rec { 20 pname = "glsurf"; 21 version = "3.3.1"; 22 23 src = fetchurl { 24 url = "https://raffalli.eu/~christophe/glsurf/glsurf-${version}.tar.gz"; 25 sha256 = "0w8xxfnw2snflz8wdr2ca9f5g91w5vbyp1hwlx1v7vg83d4bwqs7"; 26 }; 27 28 nativeBuildInputs = [ 29 makeWrapper 30 ] 31 ++ (with ocamlPackages; [ 32 ocaml 33 findlib 34 ]); 35 36 buildInputs = [ 37 libglut 38 libGL 39 libGLU 40 mpfr 41 gmp 42 ] 43 ++ (with ocamlPackages; [ 44 camlp4 45 lablgl 46 camlimages 47 num 48 ]); 49 50 postPatch = '' 51 for f in callbacks*/Makefile; do 52 substituteInPlace "$f" --replace-warn "+camlp4" \ 53 "${ocamlPackages.camlp4}/lib/ocaml/${ocamlPackages.ocaml.version}/site-lib/camlp4" 54 done 55 56 # Fatal error: exception Sys_error("Mutex.unlock: Operation not permitted") 57 sed -i "/gl_started/d" src/draw.ml* src/main.ml 58 59 # Compatibility with camlimages 5.0.5 60 substituteInPlace src/Makefile --replace-warn camlimages.all_formats camlimages.core 61 ''; 62 63 installPhase = '' 64 mkdir -p $out/bin $out/share/doc/glsurf 65 cp ./src/glsurf.opt $out/bin/glsurf 66 cp ./doc/doc.pdf $out/share/doc/glsurf 67 cp -r ./examples $out/share/doc/glsurf 68 69 wrapProgram "$out/bin/glsurf" --set CC "${cc}/bin/${cc.targetPrefix}cc" 70 ''; 71 72 meta = { 73 homepage = "https://raffalli.eu/~christophe/glsurf/"; 74 description = "Program to draw implicit surfaces and curves"; 75 mainProgram = "glsurf"; 76 license = lib.licenses.gpl2Plus; 77 platforms = lib.platforms.all; 78 }; 79}