Skip to content

Commit 997dcf3

Browse files
committed
Fix musl builds with vendored OpenSSL
Add vendored-openssl feature that compiles OpenSSL from source for static musl builds. Update Makefile to use EXTRA_FEATURES.
1 parent bc162c2 commit 997dcf3

4 files changed

Lines changed: 24 additions & 2 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ jobs:
4141
run: make release
4242
env:
4343
CARGO_BUILD_TARGET: ${{ matrix.target }}
44+
EXTRA_FEATURES: ${{ contains(matrix.target, 'linux-musl') && 'vendored-openssl' || '' }}
4445

4546
- name: Ad-hoc sign (macOS)
4647
if: contains(matrix.os, 'macos')

Cargo.lock

Lines changed: 11 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ name = "codey"
1616
path = "src/main.rs"
1717

1818
[dependencies]
19+
20+
# OpenSSL vendored for static musl builds
21+
openssl = { version = "0.10", features = ["vendored"], optional = true }
1922
# TUI (CLI only)
2023
ratatui = { version = "0.30.0-beta.0", features = ["scrolling-regions"], optional = true }
2124
crossterm = { version = "0.28", features = ["event-stream"], optional = true }
@@ -103,6 +106,9 @@ cli = [
103106
"ratskin", "textwrap"
104107
]
105108

109+
# Vendored OpenSSL for static musl builds
110+
vendored-openssl = ["openssl"]
111+
106112
# Enable performance profiling with JSON export
107113
# Build with: cargo build --release --features profiling
108114
profiling = ["dep:sysinfo"]

Makefile

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,13 @@ run: $(PATCH_DEPS)
1717

1818
release: $(PATCH_DEPS)
1919
ifdef CARGO_BUILD_TARGET
20-
cargo build --release --target $(CARGO_BUILD_TARGET)
20+
ifdef EXTRA_FEATURES
21+
cargo build --release --target $(CARGO_BUILD_TARGET) --features "cli,$(EXTRA_FEATURES)"
2122
else
22-
cargo build --release
23+
cargo build --release --target $(CARGO_BUILD_TARGET) --features cli
24+
endif
25+
else
26+
cargo build --release --features cli
2327
endif
2428

2529
profile: release

0 commit comments

Comments
 (0)