From 10aacc7a4374c2b7878ad08dbdcaf3fad926b866 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Sun, 30 Mar 2025 03:11:11 +0300 Subject: [PATCH 1/2] ttf2pt1: fix build with gcc14 - add patch fixing build with c99 from fedora: https://src.fedoraproject.org/rpms/ttf2pt1/c/070de5269475785d27ae7996513bee12cb9a0f53 Fixes build error: ``` t1asm.c: In function 'main': t1asm.c:501:15: error: implicit declaration of function 'getopt'; did you mean 'getsubopt'? [] 501 | while ((c = getopt(argc, argv, "bl:")) != -1) | ^~~~~~ | getsubopt ``` - add patch fixing build with gcc14 from fedora https://src.fedoraproject.org/rpms/ttf2pt1/c/1ebb612acb7088095c6bd7242209f0ce848895fb Patch does not apply as is with `fetchpatch` because of incorrect listed files: `diff -u ft.c{.orig,}`. Fixes `-Wincompatible-pointer-types` errors: `error: intialization of ... from incompatible pointer type ...` for `outl_moveto`, `outl_lineto`, `outl_conicto` and `outl_cubicto` in `ft.c` --- pkgs/by-name/tt/ttf2pt1/package.nix | 16 ++++++- pkgs/by-name/tt/ttf2pt1/ttf2pt1-gcc14.patch | 47 +++++++++++++++++++++ 2 files changed, 62 insertions(+), 1 deletion(-) create mode 100644 pkgs/by-name/tt/ttf2pt1/ttf2pt1-gcc14.patch diff --git a/pkgs/by-name/tt/ttf2pt1/package.nix b/pkgs/by-name/tt/ttf2pt1/package.nix index 75b32dc70a2c..116692bc667f 100644 --- a/pkgs/by-name/tt/ttf2pt1/package.nix +++ b/pkgs/by-name/tt/ttf2pt1/package.nix @@ -4,6 +4,7 @@ fetchurl, perl, freetype, + fetchpatch, }: stdenv.mkDerivation rec { @@ -28,7 +29,20 @@ stdenv.mkDerivation rec { buildInputs = [ freetype ]; nativeBuildInputs = [ perl ]; - patches = ./gentoo-makefile.patch; # also contains the freetype patch + patches = [ + ./gentoo-makefile.patch # also contains the freetype patch + + # fix build with c99 + # https://src.fedoraproject.org/rpms/ttf2pt1/c/070de5269475785d27ae7996513bee12cb9a0f53 + (fetchpatch { + url = "https://src.fedoraproject.org/rpms/ttf2pt1/raw/070de5269475785d27ae7996513bee12cb9a0f53/f/ttf2pt1-c99.patch"; + hash = "sha256-7+RnExqxED+fUJSj3opfYi0eQ5zqswOZnKjQMvlF020="; + }) + + # fix build with gcc14 + # https://src.fedoraproject.org/rpms/ttf2pt1/c/1ebb612acb7088095c6bd7242209f0ce848895fb + ./ttf2pt1-gcc14.patch + ]; meta = { description = "True Type to Postscript Type 3 converter, fpdf"; diff --git a/pkgs/by-name/tt/ttf2pt1/ttf2pt1-gcc14.patch b/pkgs/by-name/tt/ttf2pt1/ttf2pt1-gcc14.patch new file mode 100644 index 000000000000..22503463c87a --- /dev/null +++ b/pkgs/by-name/tt/ttf2pt1/ttf2pt1-gcc14.patch @@ -0,0 +1,47 @@ +diff --git a/ft.c b/ft.c +index 4ca1ca6..3ae9ac9 100644 +--- a/ft.c ++++ b/ft.c +@@ -457,7 +457,7 @@ static double lastx, lasty; + + static int + outl_moveto( +- FT_Vector *to, ++ const FT_Vector *to, + void *unused + ) + { +@@ -477,7 +477,7 @@ outl_moveto( + + static int + outl_lineto( +- FT_Vector *to, ++ const FT_Vector *to, + void *unused + ) + { +@@ -493,8 +493,8 @@ outl_lineto( + + static int + outl_conicto( +- FT_Vector *control1, +- FT_Vector *to, ++ const FT_Vector *control1, ++ const FT_Vector *to, + void *unused + ) + { +@@ -514,9 +514,9 @@ outl_conicto( + + static int + outl_cubicto( +- FT_Vector *control1, +- FT_Vector *control2, +- FT_Vector *to, ++ const FT_Vector *control1, ++ const FT_Vector *control2, ++ const FT_Vector *to, + void *unused + ) + { + From 9a9d6d44fe4b5c02aa17bce255d16d2e25d3b324 Mon Sep 17 00:00:00 2001 From: ghpzin Date: Sun, 30 Mar 2025 03:11:11 +0300 Subject: [PATCH 2/2] ttf2pt1: modernize - replace `rec` with `finalAttrs` --- pkgs/by-name/tt/ttf2pt1/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pkgs/by-name/tt/ttf2pt1/package.nix b/pkgs/by-name/tt/ttf2pt1/package.nix index 116692bc667f..67f27ccb9bd3 100644 --- a/pkgs/by-name/tt/ttf2pt1/package.nix +++ b/pkgs/by-name/tt/ttf2pt1/package.nix @@ -7,12 +7,12 @@ fetchpatch, }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "ttf2pt1"; version = "3.4.4"; src = fetchurl { - url = "mirror://sourceforge/ttf2pt1/ttf2pt1-${version}.tgz"; + url = "mirror://sourceforge/ttf2pt1/ttf2pt1-${finalAttrs.version}.tgz"; sha256 = "1l718n4k4widx49xz7qrj4mybzb8q67kp2jw7f47604ips4654mf"; }; @@ -50,4 +50,4 @@ stdenv.mkDerivation rec { license = "ttf2pt1"; platforms = lib.platforms.linux; }; -} +})