New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Implement for Haiku #66
Conversation
2260993
to
c0b8d16
Compare
Tested on Haiku R1/beta3.
Is binding to the haiku C++ API with a small native extension compiled by |
Sure! Do you have experience how to work with
|
I don't have experience with ccx to call this directly in Rust, but a tiny I'd probably prefer to not add a dep on bindgen because it is fairly heavy but it also has a CLI which we could use to generate bindings from a C++ header and check in, similar to the approach you use for the |
It works. The stress-test now executes in 19 seconds. Well, at least on an x86_64 system it works. But even if it only works for 64bit systems, I guess that's good enough. |
This is looking great! If you'd like to add clang-format to CI, we can use: https://github.com/artichoke/clang-format. I use it in Artichoke for C code. I recently added C++ support to the file scanner. I tried it out with a simple commit 20fa465a054534b98955a721ad5ba7dad03e851a (HEAD -> pr-haiku)
Author: Ryan Lopopolo <rjl@hyperbo.la>
Date: Wed Sep 28 19:41:25 2022 -0700
Add clang-format config
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 0000000..444c17f
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,9 @@
+---
+BasedOnStyle: Google
+IndentWidth: 4
+ColumnLimit: 100
+---
+Language: Cpp
+SortIncludes: false
+TabWidth: 4
+UseTab: Never
diff --git a/include/impl_haiku.h b/include/impl_haiku.h
index cd50fe8..2d9c362 100644
--- a/include/impl_haiku.h
+++ b/include/impl_haiku.h
@@ -5,5 +5,5 @@
#include <cstddef>
namespace tz_haiku {
- size_t get_tz(uint8_t *buf, size_t buf_len);
+size_t get_tz(uint8_t *buf, size_t buf_len);
} A GitHub Actions workflow to check this in CI looks like: c:
name: Lint and format C
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Setup Node.js runtime
uses: actions/setup-node@v3
with:
node-version: 16
- name: Install npm
run: npm i -f -g npm@8.16.0
- name: Lint and check formatting with clang-format
run: npx github:artichoke/clang-format --check |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I left a suggested change to make the Rust side of things a bit easier to read and I was hoping we could add some comments in a couple of places on the C++ side of things.
Thanks for digging into cxx and the Haiku C++ docs. I like this a lot better than the initial pass at this PR.
I don't understand how this change could break the wasm implementation?? https://github.com/strawlab/iana-time-zone/actions/runs/3148078221/jobs/5118236934 |
Co-authored-by: Ryan Lopopolo <rjl@hyperbo.la>
This fixes the compilation errors with -Zminimal-versions, but I don't know why. I couldn't find anything in the wasm-bindgen changelogs, but I found these: - libp2p/rust-libp2p#2020 - libp2p/rust-libp2p#2023
I'm not sure either, but I bumped the minimum version of |
This is looking good! One more question on the C++ side. |
@astraw this looks good to me. Do you want to take a quick look before we start the 7 day clock on this unsafe-proposed PR? |
Thanks. However, I think a |
build.rs's main function is empty for other OSes. #[cfg(target_os = "haiku")]
let _: () = {
....
} I don't think that having an empty build script would make a noticeably difference. |
The concern is that the build script must be executed (not what it executes per se). I'm not so much worried about execution time etc but rather about cross compilation or using other toolchains etc. |
Cross compilation is not affected, because the build script is always only executed on the host. At least I don't see how it could be affected right now. E.g. if your build.rs to read |
Yes, a |
Yeah, also this way users of other OS don't need to wonder why iana-time-zone executes a build script all of a sudden. I split off the code into its own crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Apart from the one trivial change, this looks good to me.
Thanks also for breaking this off into a separate crate. I think it is better that way.
`iana-time-zone` depends on `iana-time-zone-haiku` depends on `cxx-build` depends on `codespan-reporting` depends on `termcolor`. With `-Zminimal-versions` `termcolor==1.0.0` is selected, but `codespan-reporting` actually needs `termcolor>=1.0.4`. We could either depend on `termcolor >= 1.0.4"` to fix the problem ... or we can ignore it.
We have 2 approvals now, so according to our |
@Kijewski thanks for the work on this, including shifting most of it to its own crate. |
Tested on Haiku R1/beta3.
The stress-test takes 1m43s. That's quite terrible.