at 23.05-pre 81 lines 2.9 kB view raw
1{ lib, stdenv, fetchurl, makeWrapper, pkg-config, texinfo 2, cairo, gd, libcerf, pango, readline, zlib 3, withTeXLive ? false, texlive 4, withLua ? false, lua 5, withCaca ? false, libcaca 6, libX11 ? null 7, libXt ? null 8, libXpm ? null 9, libXaw ? null 10, aquaterm ? false 11, withWxGTK ? false, wxGTK32, Cocoa 12, fontconfig ? null 13, gnused ? null 14, coreutils ? null 15, withQt ? false, mkDerivation, qttools, qtbase, qtsvg 16}: 17 18assert libX11 != null -> (fontconfig != null && gnused != null && coreutils != null); 19let 20 withX = libX11 != null && !aquaterm && !stdenv.isDarwin; 21in 22(if withQt then mkDerivation else stdenv.mkDerivation) rec { 23 pname = "gnuplot"; 24 version = "5.4.5"; 25 26 src = fetchurl { 27 url = "mirror://sourceforge/gnuplot/${pname}-${version}.tar.gz"; 28 sha256 = "sha256-ZvZ5EV3TBVnhEEmPyU2SaUnU03C0mZoELnJLjpEO5Hg="; 29 }; 30 31 nativeBuildInputs = [ makeWrapper pkg-config texinfo ] ++ lib.optional withQt qttools; 32 33 buildInputs = 34 [ cairo gd libcerf pango readline zlib ] 35 ++ lib.optional withTeXLive (texlive.combine { inherit (texlive) scheme-small; }) 36 ++ lib.optional withLua lua 37 ++ lib.optional withCaca libcaca 38 ++ lib.optionals withX [ libX11 libXpm libXt libXaw ] 39 ++ lib.optionals withQt [ qtbase qtsvg ] 40 ++ lib.optional withWxGTK wxGTK32 41 ++ lib.optional (withWxGTK && stdenv.isDarwin) Cocoa; 42 43 postPatch = '' 44 # lrelease is in qttools, not in qtbase. 45 sed -i configure -e 's|''${QT5LOC}/lrelease|lrelease|' 46 ''; 47 48 configureFlags = [ 49 (if withX then "--with-x" else "--without-x") 50 (if withQt then "--with-qt=qt5" else "--without-qt") 51 (if aquaterm then "--with-aquaterm" else "--without-aquaterm") 52 ] ++ lib.optional withCaca "--with-caca"; 53 54 CXXFLAGS = lib.optionalString (stdenv.isDarwin && withQt) "-std=c++11"; 55 56 postInstall = lib.optionalString withX '' 57 wrapProgram $out/bin/gnuplot \ 58 --prefix PATH : '${gnused}/bin' \ 59 --prefix PATH : '${coreutils}/bin' \ 60 --prefix PATH : '${fontconfig.bin}/bin' \ 61 --run '. ${./set-gdfontpath-from-fontconfig.sh}' 62 ''; 63 64 enableParallelBuilding = true; 65 66 meta = with lib; { 67 homepage = "http://www.gnuplot.info/"; 68 description = "A portable command-line driven graphing utility for many platforms"; 69 platforms = platforms.linux ++ platforms.darwin; 70 license = { 71 # Essentially a BSD license with one modifaction: 72 # Permission to modify the software is granted, but not the right to 73 # distribute the complete modified source code. Modifications are to 74 # be distributed as patches to the released version. Permission to 75 # distribute binaries produced by compiling modified sources is granted, 76 # provided you: ... 77 url = "https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright"; 78 }; 79 maintainers = with maintainers; [ lovek323 ]; 80 }; 81}