Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

kitty: Fix compilation on aarch64-darwin #137512

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions pkgs/applications/terminal-emulators/kitty/apple-sdk-11.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
diff --git a/setup.py b/setup.py
index a9138efe..54172eb9 100755
--- a/setup.py
+++ b/setup.py
@@ -14,6 +14,7 @@
import sys
import sysconfig
import platform
+import tempfile
import time
from contextlib import suppress
from functools import partial
@@ -229,18 +230,19 @@ def get_sanitize_args(cc: str, ccver: Tuple[int, int]) -> List[str]:

def test_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: str = 'c') -> bool:
src = src or 'int main(void) { return 0; }'
- p = subprocess.Popen(
- [cc] + list(cflags) + ['-x', lang, '-o', os.devnull, '-'],
- stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.PIPE,
- )
- stdin = p.stdin
- assert stdin is not None
- try:
- stdin.write(src.encode('utf-8'))
- stdin.close()
- except BrokenPipeError:
- return False
- return p.wait() == 0
+ with tempfile.TemporaryDirectory() as tdir:
+ p = subprocess.Popen(
+ [cc] + list(cflags) + ['-x', lang, '-o', os.path.join(tdir, 'dummy'), '-'],
+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL, stdin=subprocess.PIPE,
+ )
+ stdin = p.stdin
+ assert stdin is not None
+ try:
+ stdin.write(src.encode('utf-8'))
+ stdin.close()
+ except BrokenPipeError:
+ return False
+ return p.wait() == 0


def first_successful_compile(cc: str, *cflags: str, src: Optional[str] = None, lang: str = 'c') -> str:
5 changes: 5 additions & 0 deletions pkgs/applications/terminal-emulators/kitty/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
lcms2,
installShellFiles,
dbus,
darwin,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Most packages have UserNotifications as input, which defaults to null, and in the all-packages.nix the test if available is done. Any reason to not do that here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

darwin.apple_sdk.frameworks.UserNotifications does not exit in sdk 10, and x86_64-darwin use sdk 10.

Cocoa,
CoreGraphics,
Foundation,
Expand Down Expand Up @@ -45,6 +46,8 @@ buildPythonApplication rec {
libpng
python3
zlib
] ++ lib.optionals (stdenv.isDarwin && (builtins.hasAttr "UserNotifications" darwin.apple_sdk.frameworks)) [
darwin.apple_sdk.frameworks.UserNotifications
] ++ lib.optionals stdenv.isLinux [
fontconfig libunistring libcanberra libX11
libXrandr libXinerama libXcursor libxkbcommon libXi libXext
Expand All @@ -67,6 +70,8 @@ buildPythonApplication rec {

propagatedBuildInputs = lib.optional stdenv.isLinux libGL;

patches = lib.optionals stdenv.isDarwin [ ./apple-sdk-11.patch ];

outputs = [ "out" "terminfo" ];

# Causes build failure due to warning
Expand Down