Skip to content

Commit

Permalink
Fix bindgen dependency cfg
Browse files Browse the repository at this point in the history
  • Loading branch information
justsmth committed Apr 2, 2024
1 parent 2502a73 commit 6086891
Show file tree
Hide file tree
Showing 5 changed files with 72 additions and 51 deletions.
21 changes: 18 additions & 3 deletions .github/workflows/analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,22 @@ jobs:
env:
RUSTC_WRAPPER: ""

bindgen-dependency:
if: github.repository == 'aws/aws-lc-rs'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-12, macos-13-xlarge ]
steps:
- uses: actions/checkout@v3
with:
submodules: 'recursive'
- uses: dtolnay/rust-toolchain@stable
- name: Run cargo tree
run: |
if cargo tree -e build -p aws-lc-sys | grep -q bindgen; then exit 1; else exit 0; fi
mirai-analysis:
if: github.repository == 'aws/aws-lc-rs'
runs-on: ubuntu-latest
Expand All @@ -155,7 +171,7 @@ jobs:
MIRAI_TMP_SRC=$(mktemp -d)
git clone --depth 1 --branch ${{ env.MIRAI_TAG }} https://github.com/facebookexperimental/MIRAI.git ${MIRAI_TMP_SRC}
pushd ${MIRAI_TMP_SRC}
cargo install --force --path ./checker --no-default-features
cargo install --locked --force --path ./checker --no-default-features
popd
rm -rf ${MIRAI_TMP_SRC}
Expand All @@ -164,6 +180,7 @@ jobs:
run: |
cargo update
cargo update -p clap --precise 4.4.18
cargo update -p cargo-platform --precise 0.1.7
cargo mirai
minimal-versions:
Expand All @@ -186,8 +203,6 @@ jobs:
working-directory: ./aws-lc-rs
run: cargo --locked check



copyright:
runs-on: ubuntu-latest
steps:
Expand Down
4 changes: 2 additions & 2 deletions aws-lc-fips-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ cmake = "0.1.48"
dunce = "1.0"
fs_extra = "1.3"

[target.'cfg(any(target = "aarch64-apple-darwin", target = "x86_64-apple-darwin", target = "aarch64-unknown-linux-gnu", target = "x86_64-unknown-linux-gnu", target = "aarch64-unknown-linux-musl", target = "x86_64-unknown-linux-musl"))'.build-dependencies]
[target.'cfg(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = "")))'.build-dependencies]
bindgen = { version = "0.69.2", optional = true }

[target.'cfg(not(any(target = "aarch64-apple-darwin", target = "x86_64-apple-darwin", target = "aarch64-unknown-linux-gnu", target = "x86_64-unknown-linux-gnu", target = "aarch64-unknown-linux-musl", target = "x86_64-unknown-linux-musl")))'.build-dependencies]
[target.'cfg(not(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = ""))))'.build-dependencies]
bindgen = { version = "0.69.2" }

[dependencies]
Expand Down
42 changes: 20 additions & 22 deletions aws-lc-fips-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,10 @@ use cmake_builder::CmakeBuilder;

#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
not(all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
))
))]
mod bindgen;
Expand Down Expand Up @@ -133,7 +130,14 @@ fn prefix_string() -> String {
format!("aws_lc_fips_{}", VERSION.to_string().replace('.', "_"))
}

#[cfg(feature = "bindgen")]
#[cfg(any(
feature = "bindgen",
not(all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
))
))]
fn target_platform_prefix(name: &str) -> String {
format!("{}_{}", target().replace('-', "_"), name)
}
Expand Down Expand Up @@ -164,13 +168,10 @@ fn test_command(executable: &OsStr, args: &[&OsStr]) -> TestCommandResult {

#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
not(all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
))
))]
fn generate_bindings(manifest_dir: &Path, prefix: Option<String>, bindings_path: &PathBuf) {
Expand Down Expand Up @@ -339,13 +340,10 @@ fn main() {
} else if is_bindgen_required {
#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
not(all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
))
))]
{
Expand Down
5 changes: 3 additions & 2 deletions aws-lc-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -55,14 +55,15 @@ cmake = "0.1.48"
dunce = "1.0"
fs_extra = "1.3"

[target.'cfg(any(target = "aarch64-apple-darwin", target = "x86_64-apple-darwin", target = "aarch64-unknown-linux-gnu", target = "i686-unknown-linux-gnu", target = "x86_64-unknown-linux-gnu", target = "aarch64-unknown-linux-musl", target = "x86_64-unknown-linux-musl"))'.build-dependencies]
[target.'cfg(any(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = "")), all(target_arch = "i686", target_os = "linux", target_env = "gnu")))'.build-dependencies]
bindgen = { version = "0.69.2", optional = true }

[target.'cfg(not(any(target = "aarch64-apple-darwin", target = "x86_64-apple-darwin", target = "aarch64-unknown-linux-gnu", target = "i686-unknown-linux-gnu", target = "x86_64-unknown-linux-gnu", target = "aarch64-unknown-linux-musl", target = "x86_64-unknown-linux-musl")))'.build-dependencies]
[target.'cfg(not(any(all(any(target_arch = "x86_64", target_arch = "aarch64"), any(target_os = "linux", target_os = "macos"), any(target_env = "gnu", target_env = "musl", target_env = "")), all(target_arch = "i686", target_os = "linux", target_env = "gnu"))))'.build-dependencies]
bindgen = { version = "0.69.2" }

[dependencies]
libc = "0.2.121"
paste = "1.0.11"

[package.metadata.aws-lc-sys]
commit-hash = "4e690737e0a386f8c5eb9a0a88becc7985b5d24e"
51 changes: 29 additions & 22 deletions aws-lc-sys/builder/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,12 @@ use cmake_builder::CmakeBuilder;
#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "i686-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
),
all(target_arch = "i686", target_os = "linux", target_env = "gnu")
))
))]
mod bindgen;
Expand Down Expand Up @@ -127,7 +126,17 @@ fn prefix_string() -> String {
format!("aws_lc_{}", VERSION.to_string().replace('.', "_"))
}

#[cfg(feature = "bindgen")]
#[cfg(any(
feature = "bindgen",
not(any(
all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
),
all(target_arch = "i686", target_os = "linux", target_env = "gnu")
))
))]
fn target_platform_prefix(name: &str) -> String {
format!("{}_{}", target().replace('-', "_"), name)
}
Expand Down Expand Up @@ -157,13 +166,12 @@ fn test_command(executable: &OsStr, args: &[&OsStr]) -> TestCommandResult {
#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "i686-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
),
all(target_arch = "i686", target_os = "linux", target_env = "gnu")
))
))]
fn generate_bindings(manifest_dir: &Path, prefix: Option<String>, bindings_path: &PathBuf) {
Expand Down Expand Up @@ -336,13 +344,12 @@ fn main() {
#[cfg(any(
feature = "bindgen",
not(any(
target = "aarch64-apple-darwin",
target = "x86_64-apple-darwin",
target = "aarch64-unknown-linux-gnu",
target = "i686-unknown-linux-gnu",
target = "x86_64-unknown-linux-gnu",
target = "aarch64-unknown-linux-musl",
target = "x86_64-unknown-linux-musl"
all(
any(target_arch = "x86_64", target_arch = "aarch64"),
any(target_os = "linux", target_os = "macos"),
any(target_env = "gnu", target_env = "musl", target_env = "")
),
all(target_arch = "i686", target_os = "linux", target_env = "gnu")
))
))]
{
Expand Down

0 comments on commit 6086891

Please sign in to comment.