Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at gcc-offload 141 lines 3.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 makeWrapper, 6 pkg-config, 7 texinfo, 8 cairo, 9 gd, 10 libcerf, 11 pango, 12 readline, 13 zlib, 14 withTeXLive ? false, 15 texliveSmall, 16 withLua ? false, 17 lua, 18 withCaca ? false, 19 libcaca, 20 libX11 ? null, 21 libXt ? null, 22 libXpm ? null, 23 libXaw ? null, 24 aquaterm ? false, 25 withWxGTK ? false, 26 wxGTK32, 27 Cocoa, 28 fontconfig ? null, 29 gnused ? null, 30 coreutils ? null, 31 withQt ? false, 32 mkDerivation, 33 qttools, 34 qtbase, 35 qtsvg, 36}: 37 38assert libX11 != null -> (fontconfig != null && gnused != null && coreutils != null); 39let 40 withX = libX11 != null && !aquaterm && !stdenv.hostPlatform.isDarwin; 41in 42(if withQt then mkDerivation else stdenv.mkDerivation) rec { 43 pname = "gnuplot"; 44 version = "6.0.1"; 45 46 src = fetchurl { 47 url = "mirror://sourceforge/gnuplot/${pname}-${version}.tar.gz"; 48 sha256 = "sha256-6FpmDBoqGAj/JPfmmYH/y6xmpFydz3EbZWELJupxN5o="; 49 }; 50 51 nativeBuildInputs = [ 52 makeWrapper 53 pkg-config 54 texinfo 55 ] ++ lib.optional withQt qttools; 56 57 buildInputs = 58 [ 59 cairo 60 gd 61 libcerf 62 pango 63 readline 64 zlib 65 ] 66 ++ lib.optional withTeXLive texliveSmall 67 ++ lib.optional withLua lua 68 ++ lib.optional withCaca libcaca 69 ++ lib.optionals withX [ 70 libX11 71 libXpm 72 libXt 73 libXaw 74 ] 75 ++ lib.optionals withQt [ 76 qtbase 77 qtsvg 78 ] 79 ++ lib.optional withWxGTK wxGTK32 80 ++ lib.optional (withWxGTK && stdenv.hostPlatform.isDarwin) Cocoa; 81 82 postPatch = '' 83 # lrelease is in qttools, not in qtbase. 84 sed -i configure -e 's|''${QT5LOC}/lrelease|lrelease|' 85 ''; 86 87 configureFlags = 88 [ 89 (if withX then "--with-x" else "--without-x") 90 (if withQt then "--with-qt=qt5" else "--without-qt") 91 (if aquaterm then "--with-aquaterm" else "--without-aquaterm") 92 ] 93 ++ lib.optional withCaca "--with-caca" 94 ++ lib.optional withTeXLive "--with-texdir=${placeholder "out"}/share/texmf/tex/latex/gnuplot"; 95 96 CXXFLAGS = lib.optionalString (stdenv.hostPlatform.isDarwin && withQt) "-std=c++11"; 97 98 # we'll wrap things ourselves 99 dontWrapGApps = true; 100 dontWrapQtApps = true; 101 102 # binary wrappers don't support --run 103 postInstall = lib.optionalString withX '' 104 wrapProgramShell $out/bin/gnuplot \ 105 --prefix PATH : '${ 106 lib.makeBinPath [ 107 gnused 108 coreutils 109 fontconfig.bin 110 ] 111 }' \ 112 "''${gappsWrapperArgs[@]}" \ 113 "''${qtWrapperArgs[@]}" \ 114 --run '. ${./set-gdfontpath-from-fontconfig.sh}' 115 ''; 116 117 # When cross-compiling, don't build docs and demos. 118 # Inspiration taken from https://sourceforge.net/p/gnuplot/gnuplot-main/merge-requests/10/ 119 makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 120 "-C src" 121 ]; 122 123 enableParallelBuilding = true; 124 125 meta = with lib; { 126 homepage = "http://www.gnuplot.info/"; 127 description = "Portable command-line driven graphing utility for many platforms"; 128 platforms = platforms.linux ++ platforms.darwin; 129 license = { 130 # Essentially a BSD license with one modifaction: 131 # Permission to modify the software is granted, but not the right to 132 # distribute the complete modified source code. Modifications are to 133 # be distributed as patches to the released version. Permission to 134 # distribute binaries produced by compiling modified sources is granted, 135 # provided you: ... 136 url = "https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright"; 137 }; 138 maintainers = with maintainers; [ lovek323 ]; 139 mainProgram = "gnuplot"; 140 }; 141}