diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml
index 161b543..0b40325 100644
--- a/.github/workflows/rust.yml
+++ b/.github/workflows/rust.yml
@@ -23,7 +23,7 @@ on:
name: rust-ci
env:
- RUST_MSRV: "1.63"
+ RUST_MSRV: &RUST_MSRV "1.63"
jobs:
codespell:
@@ -52,7 +52,7 @@ jobs:
- uses: actions/checkout@v6
- uses: dtolnay/rust-toolchain@master
with:
- toolchain: ${{ env.RUST_MSRV }}
+ toolchain: *RUST_MSRV
- uses: taiki-e/install-action@cargo-hack
- name: cargo check
run: >-
@@ -145,6 +145,23 @@ jobs:
run: cargo install --force cbindgen
- run: make validate-cbindgen
+ build:
+ runs-on: ubuntu-latest
+ strategy:
+ fail-fast: false
+ matrix:
+ rust-version:
+ - *RUST_MSRV
+ - stable
+ - nightly
+ steps:
+ - uses: actions/checkout@v6
+ - uses: dtolnay/rust-toolchain@master
+ with:
+ toolchain: ${{ matrix.rust-version }}
+ - run: make debug
+ - run: make release
+
rustdoc:
name: cargo doc
runs-on: ubuntu-latest
diff --git a/Cargo.toml b/Cargo.toml
index f48b32a..9e1f909 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -48,7 +48,7 @@ rust-version = "1.63"
maintenance = { status = "experimental" }
[lib]
-# When building the CAPI, our Makefile adds --crate-type={cdylib,staticlib}.
+# MSRV(1.64): Replace with --crate-type={cdy,static}lib in Makefile.
crate-type = ["rlib"]
[features]
diff --git a/Makefile b/Makefile
index 84fe948..51f863a 100644
--- a/Makefile
+++ b/Makefile
@@ -29,6 +29,8 @@
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see .
+SHELL := /bin/bash
+
CARGO ?= cargo
CARGO_NIGHTLY ?= cargo +nightly
@@ -48,8 +50,8 @@ CARGO_CHECK := $(call cargo_hack,$(CARGO),check)
CARGO_CLIPPY := $(call cargo_hack,$(CARGO),clippy)
CARGO_LLVM_COV := $(call cargo_hack,$(CARGO_NIGHTLY),llvm-cov)
-RUSTC_FLAGS := --features=capi -- -C panic=abort
-CARGO_FLAGS ?=
+RUSTC_FLAGS := -C panic=abort
+CARGO_FLAGS ?= --features=capi
SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs')
@@ -58,21 +60,29 @@ SRC_FILES = $(wildcard Cargo.*) $(shell find . -name '*.rs')
debug: target/debug
target/debug: $(SRC_FILES)
+ # MSRV(1.64): Use cargo rustc --crate-type={cdy,static}lib.
+ sed -i.orig '/^crate-type/ s/=.*/= ["rlib", "cdylib", "staticlib"]/' Cargo.toml
+ RUSTFLAGS="$(RUSTC_FLAGS)" $(CARGO) build $(CARGO_FLAGS)
+ mv Cargo.toml{.orig,}
# For some reason, --crate-types needs separate invocations. We can't use
# #![crate_type] unfortunately, as using it with #![cfg_attr] has been
# deprecated.
- $(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS)
- $(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS)
+ #$(CARGO) rustc $(CARGO_FLAGS) --crate-type=cdylib $(RUSTC_FLAGS)
+ #$(CARGO) rustc $(CARGO_FLAGS) --crate-type=staticlib $(RUSTC_FLAGS)
.PHONY: release
release: target/release
target/release: $(SRC_FILES)
+ # MSRV(1.64): Use cargo rustc --crate-type={cdy,static}lib.
+ sed -i.orig '/^crate-type/ s/=.*/= ["rlib", "cdylib", "staticlib"]/' Cargo.toml
+ RUSTFLAGS="$(RUSTC_FLAGS)" $(CARGO) build $(CARGO_FLAGS)
+ mv Cargo.toml{.orig,}
# For some reason, --crate-types needs separate invocations. We can't use
# #![crate_type] unfortunately, as using it with #![cfg_attr] has been
# deprecated.
- $(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=cdylib $(RUSTC_FLAGS)
- $(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=staticlib $(RUSTC_FLAGS)
+ #$(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=cdylib $(RUSTC_FLAGS)
+ #$(CARGO) rustc $(CARGO_FLAGS) --release --crate-type=staticlib $(RUSTC_FLAGS)
.PHONY: smoke-test
smoke-test: