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