FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

ohttp: build: use proper target OS for bindgen by schopin-mozilla · Pull Request #98 · martinthomson/ohttp · GitHub

ohttp: build: use proper target OS for bindgen - #98

Merged
martinthomson merged 1 commit into
martinthomson:mainfrom
schopin-mozilla:cross-compiling-bindings
Aug 6, 2026
Merged

ohttp: build: use proper target OS for bindgen#98
martinthomson merged 1 commit into
martinthomson:mainfrom
schopin-mozilla:cross-compiling-bindings

Conversation

Copy link
Copy Markdown
Contributor

When running bindgen, we can't use std::env::consts::OS as it will be the host OS in the build script, rather than the target one. It doesn't matter much for Linux and Windows as the defined constants don't appear to be used anywhere (at least in the Firefox build), the code relying instead on other values such as __linux__ (compiler-defined) or XP_WIN.

martinthomson left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Quite right. Cross compilation support has never been a high priority here; if this is all it takes, then I'm surprised, but pleased.

Copy link
Copy Markdown
Contributor Author

There are other uses of consts::OS in the build script, but I'm not entirely sure whether they're right or not. I know that at least this patch applied to the vendored version in the firefox tree gets the crate to build on my windows-on-mac scenario (which then fails later because of course, that'd be too easy 😉 ).

When running bindgen, we can't use std::env::consts::OS as it will be
the host OS in the build script, rather than the target one. It doesn't
matter much for Linux and Windows as the defined constants don't appear
to be used anywhere (at least in the Firefox build), the code relying
instead on other values such as `__linux__` (compiler-defined) or
`XP_WIN`.
schopin-mozilla force-pushed the cross-compiling-bindings branch from 49bd48e to 32bc9cf Compare August 6, 2026 07:58

Copy link
Copy Markdown
Contributor Author

That last push is just to fix the author info, I had a mishap with my git config.

martinthomson merged commit 5f5b640 into martinthomson:main Aug 6, 2026

Copy link
Copy Markdown
Owner

I took a quick look at the other uses of OS and I think those all relate to local constraints. I could be wrong about some of those, but I'm willing to say that any progress is some progress.

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL