at 24.11-pre 93 lines 3.2 kB view raw
1{ lib, stdenv, fetchurl, makeWrapper, pkg-config, texinfo 2, cairo, gd, libcerf, pango, readline, zlib 3, withTeXLive ? false, texliveSmall 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 = "6.0.0"; 25 26 src = fetchurl { 27 url = "mirror://sourceforge/gnuplot/${pname}-${version}.tar.gz"; 28 sha256 = "sha256-Y1oo8Jk/arDRF54HKtObgTnQf1Ejf4Qdk8bC/0sXWOw="; 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 texliveSmall 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 # we'll wrap things ourselves 57 dontWrapGApps = true; 58 dontWrapQtApps = true; 59 60 # binary wrappers don't support --run 61 postInstall = lib.optionalString withX '' 62 wrapProgramShell $out/bin/gnuplot \ 63 --prefix PATH : '${lib.makeBinPath [ gnused coreutils fontconfig.bin ]}' \ 64 "''${gappsWrapperArgs[@]}" \ 65 "''${qtWrapperArgs[@]}" \ 66 --run '. ${./set-gdfontpath-from-fontconfig.sh}' 67 ''; 68 69 # When cross-compiling, don't build docs and demos. 70 # Inspiration taken from https://sourceforge.net/p/gnuplot/gnuplot-main/merge-requests/10/ 71 makeFlags = lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ 72 "-C src" 73 ]; 74 75 enableParallelBuilding = true; 76 77 meta = with lib; { 78 homepage = "http://www.gnuplot.info/"; 79 description = "A portable command-line driven graphing utility for many platforms"; 80 platforms = platforms.linux ++ platforms.darwin; 81 license = { 82 # Essentially a BSD license with one modifaction: 83 # Permission to modify the software is granted, but not the right to 84 # distribute the complete modified source code. Modifications are to 85 # be distributed as patches to the released version. Permission to 86 # distribute binaries produced by compiling modified sources is granted, 87 # provided you: ... 88 url = "https://sourceforge.net/p/gnuplot/gnuplot-main/ci/master/tree/Copyright"; 89 }; 90 maintainers = with maintainers; [ lovek323 ]; 91 mainProgram = "gnuplot"; 92 }; 93}