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

python310Packages.cocotb: unbreak on Darwin #178918

Merged
merged 1 commit into from
Jun 26, 2022
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
From 94c4768cd69b026e498d92133dd6c7d8589cf911 Mon Sep 17 00:00:00 2001
From: Jiajie Chen <[email protected]>
Date: Sat, 25 Jun 2022 10:19:44 +0800
Subject: [PATCH] Patch LDCXXSHARED for macOS along with LDSHARED

In Nixpkgs, we patched distutils to respect LDCXXSHARED environment, so
the replacement should be taken on LDCXXSHARED as well.
---
cocotb_build_libs.py | 1 +
1 file changed, 1 insertion(+)

diff --git a/cocotb_build_libs.py b/cocotb_build_libs.py
index 66097ec2..d5555b36 100755
--- a/cocotb_build_libs.py
+++ b/cocotb_build_libs.py
@@ -583,6 +583,7 @@ def get_ext():

if sys.platform == "darwin":
cfg_vars["LDSHARED"] = cfg_vars["LDSHARED"].replace("-bundle", "-dynamiclib")
+ cfg_vars["LDCXXSHARED"] = cfg_vars["LDCXXSHARED"].replace("-bundle", "-dynamiclib")

share_lib_dir = os.path.relpath(os.path.join(cocotb_share_dir, "lib"))
include_dir = os.path.relpath(os.path.join(cocotb_share_dir, "include"))
--
2.36.1

10 changes: 9 additions & 1 deletion pkgs/development/python-modules/cocotb/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,17 @@ buildPythonPackage rec {

# remove circular dependency cocotb-bus from setup.py
substituteInPlace setup.py --replace "'cocotb-bus<1.0'" ""
'' + lib.optionalString stdenv.isDarwin ''
# disable lto on darwin
# https://github.com/NixOS/nixpkgs/issues/19098
substituteInPlace cocotb_build_libs.py --replace "-flto" ""
'';

patches = [
# Fix "can't link with bundle (MH_BUNDLE) only dylibs (MH_DYLIB) file" error
./0001-Patch-LDCXXSHARED-for-macOS-along-with-LDSHARED.patch
];

checkInputs = [ cocotb-bus pytestCheckHook swig verilog ];

checkPhase = ''
Expand All @@ -53,6 +62,5 @@ buildPythonPackage rec {
homepage = "https://github.com/cocotb/cocotb";
license = licenses.bsd3;
maintainers = with maintainers; [ matthuszagh ];
broken = stdenv.isDarwin;
};
}