nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at devShellTools-shell 109 lines 2.7 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 zlib, 6 libX11, 7 libpng, 8 libjpeg, 9 gd, 10 freetype, 11 runCommand, 12}: 13 14stdenv.mkDerivation (finalAttrs: { 15 pname = "ploticus"; 16 version = "2.42"; 17 18 src = fetchurl { 19 url = "mirror://sourceforge/ploticus/ploticus/${finalAttrs.version}/ploticus${ 20 lib.replaceStrings [ "." ] [ "" ] finalAttrs.version 21 }_src.tar.gz"; 22 hash = "sha256-PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; 23 }; 24 25 patches = [ 26 # Replace hardcoded FHS path with $out. 27 ./ploticus-install.patch 28 29 # Set the location of the PREFABS directory. 30 ./set-prefabs-dir.patch 31 32 # Use gd from Nixpkgs instead of the vendored one. 33 # This is required for non-ASCII fonts to work: 34 # https://ploticus.sourceforge.net/doc/fonts.html 35 ./use-gd-package.patch 36 37 # svg.c:752:26: error: passing argument 1 of 'gzclose' from incompatible pointer type [] 38 # 752 | gzclose( outfp ); 39 # note: expected 'gzFile' {aka 'struct gzFile_s *'} but argument is of type 'FILE *' 40 ./fix-zlib-file-type.patch 41 ]; 42 43 buildInputs = [ 44 zlib 45 libX11 46 libpng 47 gd 48 freetype 49 libjpeg 50 ]; 51 52 hardeningDisable = [ "format" ]; 53 54 postPatch = '' 55 substituteInPlace src/pl.h --subst-var out 56 ''; 57 58 preBuild = '' 59 cd src 60 ''; 61 62 makeFlags = [ "CC:=$(CC)" ]; 63 64 enableParallelBuilding = true; 65 66 preInstall = '' 67 mkdir -p "$out/bin" 68 ''; 69 70 postInstall = '' 71 cd .. 72 73 # Install the prefabs. 74 mkdir -p "$out/share/ploticus/prefabs" 75 cp -rv prefabs/* "$out/share/ploticus/prefabs" 76 77 # Add aliases for backwards compatibility. 78 ln -s "pl" "$out/bin/ploticus" 79 ''; 80 81 passthru.tests = { 82 prefab = 83 runCommand "ploticus-prefab-test" 84 { 85 nativeBuildInputs = [ finalAttrs.finalPackage ]; 86 } 87 '' 88 # trivial test to see if the prefab path munging works 89 mkdir $out/ 90 pl -prefab scat inlinedata="A 1 2" x=2 y=3 -png -o $out/out.png 91 ''; 92 }; 93 94 meta = { 95 description = "Non-interactive software package for producing plots and charts"; 96 longDescription = '' 97 Ploticus is a free, GPL'd, non-interactive 98 software package for producing plots, charts, and graphics from 99 data. Ploticus is good for automated or just-in-time graph 100 generation, handles date and time data nicely, and has basic 101 statistical capabilities. It allows significant user control 102 over colors, styles, options and details. 103 ''; 104 license = lib.licenses.gpl2Plus; 105 maintainers = with lib.maintainers; [ pSub ]; 106 homepage = "https://ploticus.sourceforge.net/"; 107 platforms = with lib.platforms; linux ++ darwin; 108 }; 109})