summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Kuzminsky <seb@highlab.com>2016-04-07 11:36:10 -0600
committerSebastian Kuzminsky <seb@highlab.com>2016-04-07 16:00:36 -0600
commit855f57b0db7f6c4f62ec3e100b00f9d163defc07 (patch)
tree334a07047cea6edebb843640f60eca8c0939b7aa
parent6c89e522fd88a04753da1c1d4b2936788ea61b9c (diff)
add a patch to support kfreebsd
-rw-r--r--debian/patches/kfreebsd-support.patch151
-rw-r--r--debian/patches/series1
2 files changed, 152 insertions, 0 deletions
diff --git a/debian/patches/kfreebsd-support.patch b/debian/patches/kfreebsd-support.patch
new file mode 100644
index 00000000..9da6cd91
--- /dev/null
+++ b/debian/patches/kfreebsd-support.patch
@@ -0,0 +1,151 @@
+Description: Change yosys to look for the #define constant "__unix__"
+ instead of "__linux__", to select code appropriate for Unix-like
+ systems. This has been tested with Clang 3.5 and GCC 4.6, 4.8, and
+ 4.9 on Linux, and Clang 3.5 and GCC 4.9 on kFreeBSD.
+Author: Sebastian Kuzminsky <seb@highlab.com>
+
+Index: yosys/kernel/driver.cc
+===================================================================
+--- yosys.orig/kernel/driver.cc 2016-04-07 11:33:18.000000000 -0600
++++ yosys/kernel/driver.cc 2016-04-07 11:35:04.000000000 -0600
+@@ -30,7 +30,7 @@
+ #include <limits.h>
+ #include <errno.h>
+
+-#ifdef __linux__
++#ifdef __unix__
+ # include <sys/types.h>
+ # include <unistd.h>
+ #endif
+@@ -382,7 +382,7 @@
+ #else
+ std::string meminfo;
+ std::string stats_divider = ", ";
+-# ifdef __linux__
++# ifdef __unix__
+ std::ifstream statm;
+ statm.open(stringf("/proc/%lld/statm", (long long)getpid()));
+ if (statm.is_open()) {
+@@ -436,7 +436,7 @@
+ }
+ }
+
+-#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
++#if defined(YOSYS_ENABLE_COVER) && defined(__unix__)
+ if (getenv("YOSYS_COVER_DIR") || getenv("YOSYS_COVER_FILE"))
+ {
+ string filename;
+Index: yosys/kernel/log.cc
+===================================================================
+--- yosys.orig/kernel/log.cc 2016-04-07 11:33:18.000000000 -0600
++++ yosys/kernel/log.cc 2016-04-07 11:35:04.000000000 -0600
+@@ -25,7 +25,7 @@
+ # include <sys/time.h>
+ #endif
+
+-#ifdef __linux__
++#ifdef __unix__
+ # include <dlfcn.h>
+ #endif
+
+@@ -264,7 +264,7 @@
+ log_flush();
+ }
+
+-#if defined(__linux__) && defined(YOSYS_ENABLE_PLUGINS)
++#if defined(__unix__) && defined(YOSYS_ENABLE_PLUGINS)
+ void log_backtrace(const char *prefix, int levels)
+ {
+ if (levels <= 0) return;
+@@ -423,7 +423,7 @@
+ // ---------------------------------------------------
+ // This is the magic behind the code coverage counters
+ // ---------------------------------------------------
+-#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
++#if defined(YOSYS_ENABLE_COVER) && defined(__unix__)
+
+ dict<std::string, std::pair<std::string, int>> extra_coverage_data;
+
+Index: yosys/kernel/log.h
+===================================================================
+--- yosys.orig/kernel/log.h 2016-04-07 11:33:18.000000000 -0600
++++ yosys/kernel/log.h 2016-04-07 11:35:04.000000000 -0600
+@@ -102,7 +102,7 @@
+ // This is the magic behind the code coverage counters
+ // ---------------------------------------------------
+
+-#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
++#if defined(YOSYS_ENABLE_COVER) && defined(__unix__)
+
+ #define cover(_id) do { \
+ static CoverData __d __attribute__((section("yosys_cover_list"), aligned(1), used)) = { __FILE__, __FUNCTION__, _id, __LINE__, 0 }; \
+Index: yosys/kernel/yosys.cc
+===================================================================
+--- yosys.orig/kernel/yosys.cc 2016-04-07 11:33:18.000000000 -0600
++++ yosys/kernel/yosys.cc 2016-04-07 11:35:04.000000000 -0600
+@@ -64,7 +64,7 @@
+
+ void memhasher_on()
+ {
+-#ifdef __linux__
++#ifdef __unix__
+ memhasher_rng += time(NULL) << 16 ^ getpid();
+ #endif
+ memhasher_store.resize(0x10000);
+@@ -622,7 +622,7 @@
+ } TclPass;
+ #endif
+
+-#if defined(__linux__)
++#if defined(__unix__)
+ std::string proc_self_dirname()
+ {
+ char path[PATH_MAX];
+Index: yosys/libs/minisat/System.cc
+===================================================================
+--- yosys.orig/libs/minisat/System.cc 2016-04-07 11:33:18.000000000 -0600
++++ yosys/libs/minisat/System.cc 2016-04-07 11:35:04.000000000 -0600
+@@ -25,7 +25,7 @@
+
+ #include "System.h"
+
+-#if defined(__linux__)
++#if defined(__unix__)
+
+ #include <stdlib.h>
+
+@@ -99,7 +99,7 @@
+
+ void Minisat::setX86FPUPrecision()
+ {
+-#if defined(__linux__) && defined(_FPU_EXTENDED) && defined(_FPU_DOUBLE) && defined(_FPU_GETCW)
++#if defined(__unix__) && defined(_FPU_EXTENDED) && defined(_FPU_DOUBLE) && defined(_FPU_GETCW)
+ // Only correct FPU precision on Linux architectures that needs and supports it:
+ fpu_control_t oldcw, newcw;
+ _FPU_GETCW(oldcw); newcw = (oldcw & ~_FPU_EXTENDED) | _FPU_DOUBLE; _FPU_SETCW(newcw);
+Index: yosys/libs/minisat/System.h
+===================================================================
+--- yosys.orig/libs/minisat/System.h 2016-04-07 11:33:18.000000000 -0600
++++ yosys/libs/minisat/System.h 2016-04-07 11:35:04.000000000 -0600
+@@ -21,7 +21,7 @@
+ #ifndef Minisat_System_h
+ #define Minisat_System_h
+
+-#if defined(__linux__)
++#if defined(__unix__)
+ #include <fpu_control.h>
+ #endif
+
+Index: yosys/passes/cmds/cover.cc
+===================================================================
+--- yosys.orig/passes/cmds/cover.cc 2016-04-07 11:33:18.000000000 -0600
++++ yosys/passes/cmds/cover.cc 2016-04-07 11:35:04.000000000 -0600
+@@ -128,7 +128,7 @@
+ log("\n");
+ }
+
+-#if defined(YOSYS_ENABLE_COVER) && defined(__linux__)
++#if defined(YOSYS_ENABLE_COVER) && defined(__unix__)
+ for (auto &it : get_coverage_data()) {
+ if (!patterns.empty()) {
+ for (auto &p : patterns)
diff --git a/debian/patches/series b/debian/patches/series
index a73b8046..01697657 100644
--- a/debian/patches/series
+++ b/debian/patches/series
@@ -6,3 +6,4 @@ spelling-fixes.patch
switch-to-free-font.patch
manual-build.patch
add-missing-headers.patch
+kfreebsd-support.patch