From 0ea638dac5eb4cc82e1e46acadbddadf6495a291 Mon Sep 17 00:00:00 2001 From: Randy Eckenrode Date: Thu, 27 Jul 2023 17:00:52 -0400 Subject: [PATCH] texlive: fix build with clang 16 There are two instances of `main` with an implicit `int` return type. This is fixed upstream, so this patch is to allow texlive-2022 to build until texlive-2023 is merged into nixpkgs. --- pkgs/tools/typesetting/tex/texlive/bin.nix | 9 ++++++++ .../tex/texlive/fix-implicit-int.patch | 22 +++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 pkgs/tools/typesetting/tex/texlive/fix-implicit-int.patch diff --git a/pkgs/tools/typesetting/tex/texlive/bin.nix b/pkgs/tools/typesetting/tex/texlive/bin.nix index c62b1165bba5..b48886e10096 100644 --- a/pkgs/tools/typesetting/tex/texlive/bin.nix +++ b/pkgs/tools/typesetting/tex/texlive/bin.nix @@ -102,6 +102,12 @@ core = stdenv.mkDerivation rec { perl ]; + patches = [ + # Fix implicit `int` on `main`, which results in an error when building with clang 16. + # This is fixed upstream and can be dropped with the 2023 release. + ./fix-implicit-int.patch + ]; + hardeningDisable = [ "format" ]; preConfigure = '' @@ -224,6 +230,9 @@ core-big = stdenv.mkDerivation { #TODO: upmendex stripLen = 1; extraPrefix = "libs/luajit/LuaJIT-src/"; }) + # Fix implicit `int` on `main`, which results in an error when building with clang 16. + # This is fixed upstream and can be dropped with the 2023 release. + ./fix-implicit-int.patch ]; hardeningDisable = [ "format" ]; diff --git a/pkgs/tools/typesetting/tex/texlive/fix-implicit-int.patch b/pkgs/tools/typesetting/tex/texlive/fix-implicit-int.patch new file mode 100644 index 000000000000..f74409fe1066 --- /dev/null +++ b/pkgs/tools/typesetting/tex/texlive/fix-implicit-int.patch @@ -0,0 +1,22 @@ +diff -ur a/utils/m-tx/mtx-src/prepmx.c b/utils/m-tx/mtx-src/prepmx.c +--- a/utils/m-tx/mtx-src/prepmx.c 2018-04-28 17:56:18.000000000 -0600 ++++ b/utils/m-tx/mtx-src/prepmx.c 2023-07-11 15:21:26.351024424 -0600 +@@ -769,6 +769,7 @@ + } + + ++int + main(int argc, Char *argv[]) + { /* ---- Main program ------------------------ */ + PASCAL_MAIN(argc, argv); +diff -ur a/utils/pmx/pmx-src/libf2c/main.c b/utils/pmx/pmx-src/libf2c/main.c +--- a/utils/pmx/pmx-src/libf2c/main.c 2016-02-09 22:31:26.000000000 -0700 ++++ b/utils/pmx/pmx-src/libf2c/main.c 2023-07-11 15:49:35.043438384 -0600 +@@ -106,6 +106,7 @@ + #ifdef KR_headers + main(argc, argv) int argc; char **argv; + #else ++int + main(int argc, char **argv) + #endif + {