Merge pull request #178918 from jiegec/cocotb-darwin

python310Packages.cocotb: unbreak on Darwin
This commit is contained in:
Mario Rodas 2022-06-25 23:43:56 -05:00 committed by GitHub
commit 78dc753984
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,26 @@
From 94c4768cd69b026e498d92133dd6c7d8589cf911 Mon Sep 17 00:00:00 2001
From: Jiajie Chen <c@jia.je>
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

View File

@ -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 = ''
@ -53,6 +62,5 @@ buildPythonPackage rec {
homepage = "https://github.com/cocotb/cocotb";
license = licenses.bsd3;
maintainers = with maintainers; [ matthuszagh ];
broken = stdenv.isDarwin;
};
}