-
-
Notifications
You must be signed in to change notification settings - Fork 297
cargo-pgx cross compilation support #981
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
Closed
Closed
Changes from 2 commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
f24ca49
cargo-pgx: add cross-compilation options
jaskij ca11ce0
cargo-pgx: initial cross-compilation support
jaskij ececd93
cargo-pgx: cross-compilation: fix nits
jaskij aba2960
cargo-pgx: remove None variant from CrossBuild
jaskij c0dddb6
cshim: Makefile: the PG_CONFIG assignment weak
jaskij 861f3c7
shim: don't maul PATH in build.rs
jaskij a393856
one more minor nit
jaskij 5f6c892
cargo-pgx: install: cross: add RUSTFLAGS to HOST_ prefixed list used …
jaskij 26a60c9
cargo-pgx: install: cross: if a HOST_ variable is not given, remove i…
jaskij 5fe1254
cargo-pgx: fmt
jaskij 21abab3
Merge branch 'develop' into cross-compilation
jaskij 51d5e20
pgx-pg-sys: fix warning in build.rs
jaskij bf31f2b
Merge branch 'develop' into cross-compilation
jaskij d3838d8
cargo fmt
jaskij a37e131
cshim: build.rs: restore prefixing path
jaskij 951b1c7
cshim: build.rs: explicitly pass PG_CONFIG if path to pg_config is known
jaskij File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| use clap::Args; | ||
| use std::path::PathBuf; | ||
|
|
||
| #[derive(Args, Clone, Default, Debug)] | ||
| pub(crate) struct CrossBuildArgs { | ||
| /// Cross-compilation target - passing this option will make cargo-pgx assume we are cross-compiling | ||
| #[clap(long)] | ||
| pub(crate) target: Option<String>, | ||
| /// Cross-compilation sysroot | ||
| #[clap(long)] | ||
| pub(crate) sysroot: Option<PathBuf>, | ||
| /// Host sysroot | ||
| #[clap(long)] | ||
| pub(crate) host_sysroot: Option<PathBuf>, | ||
| /// Host pg_config | ||
| #[clap(long)] | ||
| pub(crate) host_pg_config: Option<PathBuf>, | ||
| } | ||
|
|
||
| impl CrossBuildArgs { | ||
| pub(crate) fn is_cross_compiling(&self) -> bool { | ||
| self.target.is_some() | ||
| } | ||
|
|
||
| pub(crate) fn to_build(&self) -> CrossBuild { | ||
| match self.is_cross_compiling() { | ||
| true => CrossBuild::Target { | ||
| target: self.target.clone().unwrap(), | ||
| sysroot: self.sysroot.clone(), | ||
| }, | ||
| false => CrossBuild::None, | ||
| } | ||
| } | ||
|
|
||
| pub(crate) fn to_host_build(&self) -> CrossBuild { | ||
| match self.is_cross_compiling() { | ||
| true => CrossBuild::Host { | ||
| sysroot: self.host_sysroot.clone(), | ||
| pg_config: self.host_pg_config.clone(), | ||
| }, | ||
| false => CrossBuild::None, | ||
| } | ||
| } | ||
| } | ||
|
|
||
| #[derive(Debug)] | ||
| pub(crate) enum CrossBuild { | ||
| None, | ||
jaskij marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| Target { target: String, sysroot: Option<PathBuf> }, | ||
| Host { sysroot: Option<PathBuf>, pg_config: Option<PathBuf> }, | ||
| } | ||
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
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
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
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.