Skip to content

Commit 941d37c

Browse files
committed
gh-actions: Add FreeBSD cross compilation
Signed-off-by: Daniel Schaefer <[email protected]>
1 parent d4153e2 commit 941d37c

File tree

2 files changed

+34
-30
lines changed

2 files changed

+34
-30
lines changed

.github/workflows/ci.yml

+27-30
Original file line numberDiff line numberDiff line change
@@ -3,36 +3,33 @@ on:
33
push:
44

55
jobs:
6-
# Won't work because pkg-config can't find hidapi.
7-
# I changed build.rs to search for 'hidapi-libusb', which is how it's installed
8-
# on Ubuntu. But that still can't find it.
9-
# freebsd-cross-build:
10-
# name: Cross-Build for FreeBSD
11-
# runs-on: 'ubuntu-22.04'
12-
# env:
13-
# CARGO_NET_GIT_FETCH_WITH_CLI: true
14-
# steps:
15-
# - uses: actions/checkout@v3
16-
17-
# - name: Install dependencies
18-
# run: |
19-
# sudo apt-get update
20-
# sudo apt-get install -y libudev-dev libhidapi-dev
21-
22-
# - name: Setup Rust toolchain
23-
# run: rustup show
24-
25-
# - name: Install cross compilation tool
26-
# run: cargo install cross
27-
28-
# - name: Build FreeBSD tool
29-
# run: cross build --target=x86_64-unknown-freebsd --no-default-features --features unix
30-
31-
# - name: Upload FreeBSD App
32-
# uses: actions/upload-artifact@v3
33-
# with:
34-
# name: framework_tool_freebsd
35-
# path: target/x86_64-unknown-freebsd/debug/framework_tool
6+
freebsd-cross-build:
7+
name: Cross-Build for FreeBSD
8+
runs-on: 'ubuntu-24.04'
9+
env:
10+
CARGO_NET_GIT_FETCH_WITH_CLI: true
11+
steps:
12+
- uses: actions/checkout@v4
13+
14+
- name: Install dependencies
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y libudev-dev libhidapi-dev
18+
19+
- name: Setup Rust toolchain
20+
run: rustup show
21+
22+
- name: Install cross compilation tool
23+
run: cargo install cross
24+
25+
- name: Build FreeBSD tool
26+
run: cross build --target=x86_64-unknown-freebsd --no-default-features --features cross_freebsd
27+
28+
- name: Upload FreeBSD App
29+
uses: actions/upload-artifact@v4
30+
with:
31+
name: framework_tool_freebsd
32+
path: target/x86_64-unknown-freebsd/debug/framework_tool
3633

3734
build:
3835
name: Build Linux and UEFI

Cross.toml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[target.x86_64-unknown-freebsd]
2+
image = "ghcr.io/cross-rs/x86_64-unknown-freebsd:main"
3+
pre-build = ["""
4+
export FREEBSD_MIRROR=$(/freebsd-fetch-best-mirror.sh) &&
5+
/freebsd-setup-packagesite.sh &&
6+
/freebsd-install-package.sh hidapi
7+
"""]

0 commit comments

Comments
 (0)