Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

Commit

Permalink
Attempt static link for alpine
Browse files Browse the repository at this point in the history
  • Loading branch information
KendallWeihe committed Jul 5, 2024
1 parent 5d7f7dc commit 74b60d8
Show file tree
Hide file tree
Showing 3 changed files with 55 additions and 51 deletions.
100 changes: 50 additions & 50 deletions .github/workflows/dylibs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,59 +3,59 @@ name: Build Rust Crate for macOS
on:
push:
branches:
- kendall/build-both-macs
- kendall/build-both-macs_alpine4

jobs:
build-intel:
runs-on: macos-13
name: Build on Intel (x86) macOS
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install stable
- name: Set Target
run: rustup target add x86_64-apple-darwin
- name: Build
run: cargo build --target x86_64-apple-darwin -p tbdex_uniffi --release
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: intel-build-dylib
path: target/x86_64-apple-darwin/release/libtbdex_uniffi.dylib
# build-intel:
# runs-on: macos-13
# name: Build on Intel (x86) macOS
# steps:
# - uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Set Target
# run: rustup target add x86_64-apple-darwin
# - name: Build
# run: cargo build --target x86_64-apple-darwin -p tbdex_uniffi --release
# - name: Upload .dylib
# uses: actions/upload-artifact@v3
# with:
# name: intel-build-dylib
# path: target/x86_64-apple-darwin/release/libtbdex_uniffi.dylib

build-apple-silicon:
runs-on: macos-latest
name: Build on Apple Silicon (ARM) macOS
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install stable
- name: Build
run: cargo build -p tbdex_uniffi --release
- name: Upload .dylib
uses: actions/upload-artifact@v3
with:
name: apple-silicon-build-dylib
path: target/release/libtbdex_uniffi.dylib
# build-apple-silicon:
# runs-on: macos-latest
# name: Build on Apple Silicon (ARM) macOS
# steps:
# - uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Build
# run: cargo build -p tbdex_uniffi --release
# - name: Upload .dylib
# uses: actions/upload-artifact@v3
# with:
# name: apple-silicon-build-dylib
# path: target/release/libtbdex_uniffi.dylib

build-ubuntu:
runs-on: ubuntu-latest
name: Build on Ubuntu (AMD64)
steps:
- uses: actions/checkout@v2
- name: Install Rust
run: rustup toolchain install stable
- name: Set Target
run: rustup target add x86_64-unknown-linux-gnu
- name: Install Dependencies
run: sudo apt-get update && sudo apt-get install -y build-essential
- name: Build
run: cargo build --target x86_64-unknown-linux-gnu -p tbdex_uniffi --release
- name: Upload .so
uses: actions/upload-artifact@v3
with:
name: ubuntu-build-so
path: target/x86_64-unknown-linux-gnu/release/libtbdex_uniffi.so
# build-ubuntu:
# runs-on: ubuntu-latest
# name: Build on Ubuntu (AMD64)
# steps:
# - uses: actions/checkout@v2
# - name: Install Rust
# run: rustup toolchain install stable
# - name: Set Target
# run: rustup target add x86_64-unknown-linux-gnu
# - name: Install Dependencies
# run: sudo apt-get update && sudo apt-get install -y build-essential
# - name: Build
# run: cargo build --target x86_64-unknown-linux-gnu -p tbdex_uniffi --release
# - name: Upload .so
# uses: actions/upload-artifact@v3
# with:
# name: ubuntu-build-so
# path: target/x86_64-unknown-linux-gnu/release/libtbdex_uniffi.so

build-alpine:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -90,7 +90,7 @@ jobs:
export OPENSSL_LIB_DIR=/usr/lib
export OPENSSL_INCLUDE_DIR=/usr/include
export PKG_CONFIG_PATH=/usr/lib/pkgconfig
RUSTFLAGS="-C target-feature=-crt-static" cargo build --release --target x86_64-unknown-linux-musl -p tbdex_uniffi
RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-musl -p tbdex_uniffi
- name: Upload .so
uses: actions/upload-artifact@v3
with:
Expand Down
5 changes: 4 additions & 1 deletion bindings/tbdex_uniffi/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,7 @@ crate-type = ["cdylib"]

[[bin]]
name = "uniffi-bindgen"
path = "uniffi-bindgen.rs"
path = "uniffi-bindgen.rs"

[target.x86_64-unknown-linux-musl]
linker = "rust-lld"
1 change: 1 addition & 0 deletions bindings/tbdex_uniffi/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
/// This build script generates the Rust scaffolded code for UniFFI bindings https://mozilla.github.io/uniffi-rs/tutorial/Rust_scaffolding.html#setup-for-crates-using-udl
/// ex. code like `#[no_mangle]` and `extern "C"` is necessary https://doc.rust-lang.org/nomicon/ffi.html#rust-side
fn main() {
println!("cargo:rustc-link-lib=static=musl");
uniffi::generate_scaffolding("src/tbdex.udl").unwrap();
}

0 comments on commit 74b60d8

Please sign in to comment.