3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2025-04-21 16:16:39 +00:00

Merge branch 'YosysHQ:main' into main

This commit is contained in:
Akash Levy 2024-10-21 16:28:19 -07:00 committed by GitHub
commit 9ba609a7b0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 46 additions and 8 deletions

33
.github/workflows/source-vendor.yml vendored Normal file
View file

@ -0,0 +1,33 @@
name: Create source archive with vendored dependencies
on: [push, workflow_dispatch]
jobs:
vendor-sources:
runs-on: ubuntu-latest
steps:
- name: Checkout repository with submodules
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Create clean tarball
run: |
git archive --format=tar HEAD -o yosys-src-vendored.tar
git submodule foreach '
git archive --format=tar --prefix="${sm_path}/" HEAD --output=${toplevel}/vendor-${name}.tar
'
# 2008 bug https://lists.gnu.org/archive/html/bug-tar/2008-08/msg00002.html
for file in vendor-*.tar; do
tar --concatenate --file=yosys-src-vendored.tar "$file"
done
gzip yosys-src-vendored.tar
- name: Store tarball artifact
uses: actions/upload-artifact@v4
with:
name: vendored-sources
path: yosys-src-vendored.tar.gz
retention-days: 1

3
.gitmodules vendored
View file

@ -7,6 +7,7 @@
[submodule "abc"]
path = abc
url = https://github.com/YosysHQ/abc
[submodule "libs/cxxopts"]
# Don't use paths as names to avoid git archive problems
[submodule "cxxopts"]
path = libs/cxxopts
url = https://github.com/jarro2783/cxxopts

View file

@ -33,6 +33,9 @@ Yosys is free software licensed under the ISC license (a GPL
compatible license that is similar in terms to the MIT license
or the 2-clause BSD license).
Third-party software distributed alongside this software
is licensed under compatible licenses.
Please refer to `abc` and `libs` subdirectories for their license terms.
Web Site and Other Resources
============================

View file

@ -222,7 +222,7 @@ int main(int argc, char **argv)
#endif // YOSYS_ENABLE_TCL
#ifdef WITH_PYTHON
("y,py-scriptfile", "execute the Python <script>",
cxxopts::value<std::vector<std::string>>(), "<script>")
cxxopts::value<std::string>(), "<script>")
#endif // WITH_PYTHON
("p,commands", "execute <commands> (to chain commands, separate them with semicolon + whitespace: 'cmd1; cmd2')",
cxxopts::value<std::vector<std::string>>(), "<commands>")
@ -530,11 +530,11 @@ int main(int argc, char **argv)
if (!scriptfile.empty()) {
if (scriptfile_tcl) {
#ifdef YOSYS_ENABLE_TCL
int tcl_argc = argc - optind;
int tcl_argc = special_args.size();
std::vector<Tcl_Obj*> script_args;
Tcl_Interp *interp = yosys_get_tcl_interp();
for (int i = optind; i < argc; ++i)
script_args.push_back(Tcl_NewStringObj(argv[i], strlen(argv[i])));
for (auto arg : special_args)
script_args.push_back(Tcl_NewStringObj(arg.c_str(), arg.length()));
Tcl_ObjSetVar2(interp, Tcl_NewStringObj("argc", 4), NULL, Tcl_NewIntObj(tcl_argc), 0);
Tcl_ObjSetVar2(interp, Tcl_NewStringObj("argv", 4), NULL, Tcl_NewListObj(tcl_argc, script_args.data()), 0);
@ -548,10 +548,11 @@ int main(int argc, char **argv)
} else if (scriptfile_python) {
#ifdef WITH_PYTHON
PyObject *sys = PyImport_ImportModule("sys");
PyObject *new_argv = PyList_New(argc - optind + 1);
int py_argc = special_args.size() + 1;
PyObject *new_argv = PyList_New(py_argc);
PyList_SetItem(new_argv, 0, PyUnicode_FromString(scriptfile.c_str()));
for (int i = optind; i < argc; ++i)
PyList_SetItem(new_argv, i - optind + 1, PyUnicode_FromString(argv[i]));
for (int i = 1; i < py_argc; ++i)
PyList_SetItem(new_argv, i, PyUnicode_FromString(special_args[i - 1].c_str()));
PyObject *old_argv = PyObject_GetAttrString(sys, "argv");
PyObject_SetAttrString(sys, "argv", new_argv);