summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartin Povišer <povik@protonmail.com>2021-11-09 14:10:19 +0100
committerMartin Povišer <povik@protonmail.com>2021-11-09 14:10:19 +0100
commit94a047ca74cb4a596bf3b2e7b8902a8366822b13 (patch)
tree818906d842d60a9d84f0a6b3b9b350d8e394b259
parent30f982bc819b986c688c4ce8aebf5e821e600c3b (diff)
downloadnixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar.gz
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar.bz2
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar.lz
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar.xz
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.tar.zst
nixpkgs-94a047ca74cb4a596bf3b2e7b8902a8366822b13.zip
yosys: fix build on darwin
Attempt to work around a confusion in yosys' build system that causes
builds under clang to fail.
-rw-r--r--pkgs/development/compilers/yosys/default.nix8
-rw-r--r--pkgs/development/compilers/yosys/fix-clang-build.patch26
2 files changed, 27 insertions, 7 deletions
diff --git a/pkgs/development/compilers/yosys/default.nix b/pkgs/development/compilers/yosys/default.nix
index f2624d12418..56e0dc3b57d 100644
--- a/pkgs/development/compilers/yosys/default.nix
+++ b/pkgs/development/compilers/yosys/default.nix
@@ -51,6 +51,7 @@ stdenv.mkDerivation rec {
 
   patches = [
     ./plugin-search-dirs.patch
+    ./fix-clang-build.patch # see https://github.com/YosysHQ/yosys/issues/2011
   ];
 
   postPatch = ''
@@ -104,12 +105,5 @@ stdenv.mkDerivation rec {
     license     = licenses.isc;
     platforms   = platforms.all;
     maintainers = with maintainers; [ shell thoughtpolice emily ];
-    #In file included from kernel/driver.cc:20:
-    #./kernel/yosys.h:42:10: fatal error: 'map' file not found
-    ##include <map>
-
-    #https://github.com/YosysHQ/yosys/issues/681
-    #https://github.com/YosysHQ/yosys/issues/2011
-    broken = stdenv.isDarwin;
   };
 }
diff --git a/pkgs/development/compilers/yosys/fix-clang-build.patch b/pkgs/development/compilers/yosys/fix-clang-build.patch
new file mode 100644
index 00000000000..685841e0f75
--- /dev/null
+++ b/pkgs/development/compilers/yosys/fix-clang-build.patch
@@ -0,0 +1,26 @@
+diff --git a/Makefile b/Makefile
+index 86abc6958..a72f7b792 100644
+--- a/Makefile
++++ b/Makefile
+@@ -145,7 +145,12 @@ bumpversion:
+ ABCREV = 4f5f73d
+ ABCPULL = 1
+ ABCURL ?= https://github.com/YosysHQ/abc
++
++ifneq ($(CONFIG),clang)
++ABCMKARGS = CC=clang CXX="$(CXX)" LD=clang ABC_USE_LIBSTDCXX=1 VERBOSE=$(Q)
++else
+ ABCMKARGS = CC="$(CXX)" CXX="$(CXX)" ABC_USE_LIBSTDCXX=1 VERBOSE=$(Q)
++endif
+ 
+ # set ABCEXTERNAL = <abc-command> to use an external ABC instance
+ # Note: The in-tree ABC (yosys-abc) will not be installed when ABCEXTERNAL is set.
+@@ -187,7 +192,7 @@ endif
+ endif
+ 
+ ifeq ($(CONFIG),clang)
+-CXX = clang
++CXX = clang++
+ LD = clang++
+ CXXFLAGS += -std=$(CXXSTD) -Os
+ ABCMKARGS += ARCHFLAGS="-DABC_USE_STDINT_H"