From 9337e7e10a4e17dc2c8c63a430f48b3abb15520d Mon Sep 17 00:00:00 2001 From: Petr Zahradnik Date: Sun, 6 Apr 2025 23:16:28 +0200 Subject: [PATCH] ploticus: fix zlib file handle type --- .../pl/ploticus/fix-zlib-file-type.patch | 28 +++++++++++++++++++ pkgs/by-name/pl/ploticus/package.nix | 17 +++++++---- 2 files changed, 40 insertions(+), 5 deletions(-) create mode 100644 pkgs/by-name/pl/ploticus/fix-zlib-file-type.patch diff --git a/pkgs/by-name/pl/ploticus/fix-zlib-file-type.patch b/pkgs/by-name/pl/ploticus/fix-zlib-file-type.patch new file mode 100644 index 000000000000..15a4d3e83c29 --- /dev/null +++ b/pkgs/by-name/pl/ploticus/fix-zlib-file-type.patch @@ -0,0 +1,28 @@ +Index: src/svg.c +=================================================================== +--- a/src/svg.c ++++ b/src/svg.c +@@ -676,9 +676,9 @@ + double x1, y1, x2, y2; + { + char *buf; + #ifdef WZ +- FILE *outfp; ++ gzFile outfp; + #endif + + if (svg_style_in_prog) fprintf( svg_fp, ""); + fprintf( svg_fp, "\n" ); /* close default style */ +@@ -731,10 +731,10 @@ + svg_fp = fopen( svg_tmpfilename, "r" ); + if( svg_fp == NULL ) return( Eerr( 2487, "cannot reopen temp file", svg_tmpfilename ) ); + #ifdef WZ + if( svg_compress ) { +- if( svg_stdout ) outfp = (FILE *) gzdopen( 1, svg_compressmode ); /* stdout = 1 */ +- else outfp = (FILE *) gzopen( svg_filename, svg_compressmode ); ++ if( svg_stdout ) outfp = gzdopen( 1, svg_compressmode ); /* stdout = 1 */ ++ else outfp = gzopen( svg_filename, svg_compressmode ); + if( outfp == NULL ) return( Eerr( 2488, "cannot open output file", svg_filename ) ); + } + #endif + buf = svg_style; /* reuse */ diff --git a/pkgs/by-name/pl/ploticus/package.nix b/pkgs/by-name/pl/ploticus/package.nix index 63f2409da4b8..ecb3e6861fa2 100644 --- a/pkgs/by-name/pl/ploticus/package.nix +++ b/pkgs/by-name/pl/ploticus/package.nix @@ -19,7 +19,7 @@ stdenv.mkDerivation (finalAttrs: { url = "mirror://sourceforge/ploticus/ploticus/${finalAttrs.version}/ploticus${ lib.replaceStrings [ "." ] [ "" ] finalAttrs.version }_src.tar.gz"; - sha256 = "PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; + hash = "sha256-PynkufQFIDqT7+yQDlgW2eG0OBghiB4kHAjKt91m4LA="; }; patches = [ @@ -33,6 +33,11 @@ stdenv.mkDerivation (finalAttrs: { # This is required for non-ASCII fonts to work: # https://ploticus.sourceforge.net/doc/fonts.html ./use-gd-package.patch + + # svg.c:752:26: error: passing argument 1 of 'gzclose' from incompatible pointer type [] + # 752 | gzclose( outfp ); + # note: expected 'gzFile' {aka 'struct gzFile_s *'} but argument is of type 'FILE *' + ./fix-zlib-file-type.patch ]; buildInputs = [ @@ -56,6 +61,8 @@ stdenv.mkDerivation (finalAttrs: { makeFlags = [ "CC:=$(CC)" ]; + enableParallelBuilding = true; + preInstall = '' mkdir -p "$out/bin" ''; @@ -84,7 +91,7 @@ stdenv.mkDerivation (finalAttrs: { ''; }; - meta = with lib; { + meta = { description = "Non-interactive software package for producing plots and charts"; longDescription = '' Ploticus is a free, GPL'd, non-interactive @@ -94,9 +101,9 @@ stdenv.mkDerivation (finalAttrs: { statistical capabilities. It allows significant user control over colors, styles, options and details. ''; - license = licenses.gpl2Plus; - maintainers = with maintainers; [ pSub ]; + license = lib.licenses.gpl2Plus; + maintainers = with lib.maintainers; [ pSub ]; homepage = "https://ploticus.sourceforge.net/"; - platforms = with platforms; linux ++ darwin; + platforms = with lib.platforms; linux ++ darwin; }; })