From 2a15e3ba751d1f1a9337335262f3b3e26753c7b3 Mon Sep 17 00:00:00 2001 From: Luflosi Date: Tue, 18 Feb 2020 16:51:31 +0100 Subject: [PATCH] kitty: better fix for build error Without the `no-werror.patch`, the compilation would fail with the following warning: ``` clang-7: error: argument unused during compilation: '-fno-strict-overflow' [-Werror,-Wunused-command-line-argument] ``` To fix this, the compiler command line options `-pedantic-errors` and `-Werror` were patched out of the build script so that the warning would not become an error and stop the build. This is not ideal as this piece of code is changed fairly frequently, which requires fixing the patch. In the next kitty version the patch would need to be fixed again. A better alternative is to just not pass `-fno-strict-overflow` to the compiler. This is done by disabling the `strictoverflow` hardening feature. --- pkgs/applications/misc/kitty/default.nix | 6 ++++-- pkgs/applications/misc/kitty/no-werror.patch | 11 ----------- 2 files changed, 4 insertions(+), 13 deletions(-) delete mode 100644 pkgs/applications/misc/kitty/no-werror.patch diff --git a/pkgs/applications/misc/kitty/default.nix b/pkgs/applications/misc/kitty/default.nix index 188e902614f..cdba8c3f686 100644 --- a/pkgs/applications/misc/kitty/default.nix +++ b/pkgs/applications/misc/kitty/default.nix @@ -74,10 +74,12 @@ buildPythonApplication rec { }) ] ++ stdenv.lib.optionals stdenv.isDarwin [ ./no-lto.patch - ./no-werror.patch ./png2icns.patch ]; + # Causes build failure due to warning + hardeningDisable = stdenv.lib.optional stdenv.isDarwin "strictoverflow"; + buildPhase = if stdenv.isDarwin then '' ${python.interpreter} setup.py kitty.app --update-check-interval=0 '' else '' @@ -123,6 +125,6 @@ buildPythonApplication rec { description = "A modern, hackable, featureful, OpenGL based terminal emulator"; license = licenses.gpl3; platforms = platforms.darwin ++ platforms.linux; - maintainers = with maintainers; [ tex rvolosatovs ma27 ]; + maintainers = with maintainers; [ tex rvolosatovs ma27 Luflosi ]; }; } diff --git a/pkgs/applications/misc/kitty/no-werror.patch b/pkgs/applications/misc/kitty/no-werror.patch deleted file mode 100644 index bc1b369d98d..00000000000 --- a/pkgs/applications/misc/kitty/no-werror.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/setup.py -+++ b/setup.py -@@ -217,7 +217,7 @@ def init_env( - cflags = os.environ.get( - 'OVERRIDE_CFLAGS', ( - '-Wextra {} -Wno-missing-field-initializers -Wall -Wstrict-prototypes -std=c11' -- ' -pedantic-errors -Werror {} {} -fwrapv {} {} -pipe {} -fvisibility=hidden' -+ ' {} {} -fwrapv {} {} -pipe {} -fvisibility=hidden' - ).format( - float_conversion, - optimize,