Repository navigation
OpenBSD port - #5324
OpenBSD port#5324abdelq wants to merge 12 commits into
Conversation
7225bf1 to
2f5b8ca
Compare
First get zig building against static llvm/clang/lld libraries. There are many ways to build llvm and we don't ensure our cmake can deal with them all. It can deal with a minimalist static build of llvm and my brain cannot recall if llvm can be built with both static/dynamic libraries, please don't do so even if llvm allows it. If it helps, around time of #4803 I have an llvm-tarball that was linking zig0. It's here . |
| var prg_name = argv[0]; | ||
| if (prg_name[0] == '/' or prg_name[0] == '.') { | ||
| return os.realpathZ(prg_name, out_buffer); | ||
| } | ||
| prg_name = mem.spanZ(prg_name); |
There was a problem hiding this comment.
This code assumes pathname beginning with . is a path component of either . or .. but it could also be a dot-named file. Let's use std.mem.indexOfScalar(..., '/') to detect idx == 0 or "." or ".." here.
| if (*prg_name == '/' || *prg_name == '.') { | ||
| buf_init_from_str(tmp, prg_name); | ||
| return os_path_real(tmp, out_path); | ||
| } else { |
There was a problem hiding this comment.
same here. handle 3 cases explicitly as lib/std/fs.zig equivalent
| // Look for the program in the set of directories | ||
| char *path, *paths = buf_ptr(tmp); | ||
| while ((path = strsep(&paths, ":")) != nullptr) { | ||
| snprintf(out, PATH_MAX, "%s/%s", path, prg_name); |
There was a problem hiding this comment.
- use
buf_sprintfinstead ofsnprintf - use
memSplitinstead ofstrsep
| }, | ||
| .openbsd => { | ||
| // OpenBSD has no support for this. Out of the various tried methods, | ||
| // the only working workaround comes from stackoverflow.com/a/31495527 |
There was a problem hiding this comment.
It's better to not implement this at all then it is to have a workaround.
|
I suggest to take advantage of zig's lazy top level declaration analysis, and the fact that we don't have any OpenBSD CI tests to regress, and break this into a series of smaller changes, landing your progress into master branch. Progress towards another operating system support does not have to be in one giant PR that does everything, you can make progress one piece at a time. This will prevent a situation like this right now, where an entire body of work is abandoned, even though it has plenty of useful changes which could have easily landed in master. Thanks for your work, I hope we can get some of it landed. |
First time contribution, a follow-up to #1921. This requires OpenBSD
-currentor 6.7 (related to #4803), which is slated for release on the 19th. Furthermore, LLVM 10 also needs to be compiled.Sadly, as it stands, I couldn't get Zig to compile properly (excerpt follows):
Running a debugger yields:
I've tried a few things to no avail. Looking for other people's input (@mikdusan? @jreut?), hence opening this draft PR.