ci: add x86_64-unknown-freebsd to multiarch
FreeBSD is in an experimental support and not in `cross` release
yet, so try to specify a docker image.
diff --git a/.github/workflows/stable.yml b/.github/workflows/stable.yml
index 6cb7645..ddce63e 100644
--- a/.github/workflows/stable.yml
+++ b/.github/workflows/stable.yml
@@ -146,6 +146,11 @@
strategy:
matrix:
target: ["aarch64-unknown-linux-gnu","armv7-unknown-linux-gnueabihf","i686-unknown-linux-gnu"]
+ cmd: ["test"]
+ include:
+ # cross doesn't support test in FreeBSD yet.
+ - target: "x86_64-unknown-freebsd"
+ cmd: "build"
# Only run on "pull_request" event for external PRs. This is to avoid
# duplicate builds for PRs created from internal branches.
if: github.event_name == 'push' || github.event.pull_request.head.repo.full_name != github.repository
@@ -155,18 +160,10 @@
with:
submodules: 'recursive'
- - name: Install stable toolchain
- uses: actions-rs/toolchain@v1
- with:
- profile: minimal
- toolchain: ${{ env.TOOLCHAIN }}
- target: ${{ matrix.target }}
- override: true
-
- - name: Run cargo test
+ - name: Run cargo build/test
uses: actions-rs/cargo@v1
with:
- command: test
+ command: ${{ matrix.cmd }}
args: --target=${{ matrix.target }} --verbose
use-cross: true
diff --git a/Cross.toml b/Cross.toml
new file mode 100644
index 0000000..1628cac
--- /dev/null
+++ b/Cross.toml
@@ -0,0 +1,2 @@
+[target.x86_64-unknown-freebsd]
+image = "rustembedded/cross:x86_64-unknown-freebsd"
diff --git a/src/build.rs b/src/build.rs
index 875f556..7bb2d90 100644
--- a/src/build.rs
+++ b/src/build.rs
@@ -40,10 +40,12 @@
]),
];
-// ARM Linux.
-const CMAKE_PARAMS_ARM_LINUX: &[(&str, &[(&str, &str)])] = &[
+// Processor.
+const CMAKE_PARAMS_PROCESSOR: &[(&str, &[(&str, &str)])] = &[
("aarch64", &[("CMAKE_SYSTEM_PROCESSOR", "aarch64")]),
("arm", &[("CMAKE_SYSTEM_PROCESSOR", "arm")]),
+ ("x86_64", &[("CMAKE_SYSTEM_PROCESSOR", "x86_64")]),
+ ("x86", &[("CMAKE_SYSTEM_PROCESSOR", "x86")]),
];
/// Returns the platform-specific output path for lib.
@@ -155,8 +157,8 @@
"linux" => match arch.as_ref() {
"aarch64" | "arm" => {
- for (arm_arch, params) in CMAKE_PARAMS_ARM_LINUX {
- if *arm_arch == arch {
+ for (cpu_arch, params) in CMAKE_PARAMS_PROCESSOR {
+ if *cpu_arch == arch {
for (name, value) in *params {
boringssl_cmake.define(name, value);
}
@@ -181,6 +183,23 @@
_ => boringssl_cmake,
},
+ "freebsd" => {
+ boringssl_cmake.define("CMAKE_SYSTEM_NAME", "FreeBSD");
+ boringssl_cmake.cxxflag("-Wno-cpp");
+ boringssl_cmake.cxxflag("-include sys/cdefs.h");
+ boringssl_cmake.cxxflag("-include sys/syslimits.h");
+
+ for (cpu_arch, params) in CMAKE_PARAMS_PROCESSOR {
+ if *cpu_arch == arch {
+ for (name, value) in *params {
+ boringssl_cmake.define(name, value);
+ }
+ }
+ }
+
+ boringssl_cmake
+ },
+
_ => {
// Configure BoringSSL for building on 32-bit non-windows platforms.
if arch == "x86" && os != "windows" {