tangled
alpha
login
or
join now
pyrox.dev
/
nixpkgs
lol
0
fork
atom
overview
issues
pulls
pipelines
yosys: 0.29 -> 0.30
authored by
Psentee
and committed by
Weijia Wang
2 years ago
344daa4c
0837dc6b
+42
-31
2 changed files
expand all
collapse all
unified
split
pkgs
development
compilers
yosys
default.nix
plugin-search-dirs.patch
+2
-2
pkgs/development/compilers/yosys/default.nix
···
71
72
in stdenv.mkDerivation rec {
73
pname = "yosys";
74
-
version = "0.29";
75
76
src = fetchFromGitHub {
77
owner = "YosysHQ";
78
repo = "yosys";
79
rev = "${pname}-${version}";
80
-
hash = "sha256-qsuKXYuKsMAALIy1SjxhEhZIMO8B4MF2vmVbwqgzLyM=";
81
};
82
83
enableParallelBuilding = true;
···
71
72
in stdenv.mkDerivation rec {
73
pname = "yosys";
74
+
version = "0.30";
75
76
src = fetchFromGitHub {
77
owner = "YosysHQ";
78
repo = "yosys";
79
rev = "${pname}-${version}";
80
+
hash = "sha256-qhMcXJFEuBPl7vh+gYTu7PnSWi+L3YMLrBMQyYqfc0w=";
81
};
82
83
enableParallelBuilding = true;
+40
-29
pkgs/development/compilers/yosys/plugin-search-dirs.patch
···
1
-
diff --git a/passes/cmds/plugin.cc b/passes/cmds/plugin.cc
2
-
index 3ed19497..f9534bd0 100644
3
-
--- a/passes/cmds/plugin.cc
4
-
+++ b/passes/cmds/plugin.cc
5
-
@@ -75,8 +75,27 @@ void load_plugin(std::string filename, std::vector<std::string> aliases)
6
-
#endif
0
0
0
0
0
0
0
0
0
0
0
7
8
-
void *hdl = dlopen(filename.c_str(), RTLD_LAZY|RTLD_LOCAL);
9
-
- if (hdl == NULL && orig_filename.find('/') == std::string::npos)
10
-
- hdl = dlopen((proc_share_dirname() + "plugins/" + orig_filename + ".so").c_str(), RTLD_LAZY|RTLD_LOCAL);
11
-
+ if (hdl == NULL && orig_filename.find('/') == std::string::npos) {
12
-
+ std::string install_dir = proc_share_dirname() + "plugins";
0
13
+
14
-
+ vector<string> all_dirs;
15
-
+ all_dirs.push_back(install_dir);
0
0
16
+
17
-
+ char* plugin_dirs = getenv("NIX_YOSYS_PLUGIN_DIRS");
18
-
+ if (plugin_dirs != NULL) {
19
-
+ std::string p(plugin_dirs), t;
20
-
+ std::stringstream ss(p);
21
+
22
-
+ while(std::getline(ss, t, ':')) {
23
-
+ all_dirs.push_back(t);
24
-
+ }
25
-
+ }
26
+
27
-
+ for (auto dir : all_dirs) {
28
-
+ hdl = dlopen((dir + "/" + orig_filename + ".so").c_str(), RTLD_LAZY|RTLD_LOCAL);
29
-
+ if (hdl != NULL) break;
30
-
+ }
31
-
+ }
32
-
if (hdl == NULL)
33
-
log_cmd_error("Can't load module `%s': %s\n", filename.c_str(), dlerror());
34
-
loaded_plugins[orig_filename] = hdl;
···
1
+
diff --git i/passes/cmds/plugin.cc w/passes/cmds/plugin.cc
2
+
index 08b4aa8c4..f00f540e9 100644
3
+
--- i/passes/cmds/plugin.cc
4
+
+++ w/passes/cmds/plugin.cc
5
+
@@ -87,15 +87,33 @@ void load_plugin(std::string filename, std::vector<std::string> aliases)
6
+
7
+
// We were unable to open the file, try to do so from the plugin directory
8
+
if (hdl == NULL && orig_filename.find('/') == std::string::npos) {
9
+
- hdl = dlopen([orig_filename]() {
10
+
- std::string new_path = proc_share_dirname() + "plugins/" + orig_filename;
11
+
+ std::string install_dir = proc_share_dirname() + "plugins";
12
+
13
+
- // Check if we need to append .so
14
+
- if (new_path.find(".so") == std::string::npos)
15
+
- new_path.append(".so");
16
+
+ vector<string> all_dirs;
17
+
+ all_dirs.push_back(install_dir);
18
19
+
- return new_path;
20
+
- }().c_str(), RTLD_LAZY|RTLD_LOCAL);
21
+
+ char* plugin_dirs = getenv("NIX_YOSYS_PLUGIN_DIRS");
22
+
+ if (plugin_dirs != NULL) {
23
+
+ std::string p(plugin_dirs), t;
24
+
+ std::stringstream ss(p);
25
+
26
+
+ while(std::getline(ss, t, ':')) {
27
+
+ all_dirs.push_back(t);
28
+
+ }
29
+
+ }
30
+
31
+
+ for (auto dir : all_dirs) {
32
+
+ hdl = dlopen([dir, orig_filename]() {
33
+
+ std::string new_path = dir + "/" + orig_filename;
0
34
+
35
+
+ // Check if we need to append .so
36
+
+ if (new_path.find(".so") == std::string::npos)
37
+
+ new_path.append(".so");
0
38
+
39
+
+ return new_path;
40
+
+ }().c_str(), RTLD_LAZY|RTLD_LOCAL);
41
+
+ if (hdl != NULL) break;
42
+
+ }
43
+
}
44
+
45
+
if (hdl == NULL)
0