# Cross.rs configuration for cross-compilation
# See: https://github.com/cross-rs/cross

[build]
# Use pre-build commands to install target architecture OpenSSL
pre-build = []

[target.aarch64-unknown-linux-gnu]
# Install ARM64 OpenSSL development libraries
pre-build = [
  "dpkg --add-architecture arm64",
  "apt-get update",
  "apt-get install -y pkg-config libssl-dev:arm64",
]

[target.armv7-unknown-linux-gnueabihf]
# Install ARMv7 OpenSSL development libraries
pre-build = [
  "dpkg --add-architecture armhf",
  "apt-get update",
  "apt-get install -y pkg-config libssl-dev:armhf",
]

# Environment variables for OpenSSL cross-compilation
[target.aarch64-unknown-linux-gnu.env]
passthrough = [
  "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig",
  "PKG_CONFIG_ALLOW_CROSS=1",
]

[target.armv7-unknown-linux-gnueabihf.env]
passthrough = [
  "PKG_CONFIG_PATH=/usr/lib/arm-linux-gnueabihf/pkgconfig",
  "PKG_CONFIG_ALLOW_CROSS=1",
]
