syndicate-rs/Makefile

91 lines
3.2 KiB
Makefile
Raw Permalink Normal View History

2024-06-08 08:34:19 +00:00
__ignored__ := $(shell ./setup.sh)
2021-08-13 16:40:31 +00:00
# Use cargo release to manage publication and versions etc.
#
# cargo install cargo-release
all:
cargo build --all-targets
test:
cargo test
test-all:
cargo test --all-targets
2022-10-26 11:41:46 +00:00
ws-bump:
cargo workspaces version \
--no-global-tag \
2023-01-08 12:19:06 +00:00
--individual-tag-prefix '%n-v' \
2023-10-05 07:56:39 +00:00
--allow-branch 'main' \
$(BUMP_ARGS)
2021-08-13 16:40:31 +00:00
2022-10-26 11:41:46 +00:00
ws-publish:
cargo workspaces publish \
--from-git
2023-02-08 13:35:15 +00:00
PROTOCOLS_BRANCH=main
pull-protocols:
git subtree pull -P syndicate/protocols \
-m 'Merge latest changes from the syndicate-protocols repository' \
git@git.syndicate-lang.org:syndicate-lang/syndicate-protocols \
2023-02-08 13:35:15 +00:00
$(PROTOCOLS_BRANCH)
static: static-x86_64
static-%:
CARGO_TARGET_DIR=target/target.$* cross build --target $*-unknown-linux-musl --features vendored-openssl,jemalloc
###########################################################################
# OK, rather than doing it myself (per
# https://eighty-twenty.org/2019/10/15/cross-compiling-rust), it turns
# out past a certain level of complexity we need more than just a
# linker but also a C compiler, compatible headers, and so forth. This
# proved nontrivial. The Rust team maintains a docker-based
# cross-compilation environment that's very easy to use, so instead,
# I'll just use that!
#
# cargo install cross
#
# The `vendored-openssl` thing is necessary because otherwise I'd have
# to mess about with getting a musl build of openssl, plus its headers
# etc, ready on my system despite being otherwise able to rely on
# cross. I think. It's a bit confusing.
2021-11-13 12:37:53 +00:00
x86_64-binary: x86_64-binary-release
x86_64-binary-release:
CARGO_TARGET_DIR=target/target.x86_64 cross build --target x86_64-unknown-linux-musl --release --all-targets --features vendored-openssl,jemalloc
2021-11-13 12:37:53 +00:00
2022-01-09 20:00:20 +00:00
x86_64-binary-debug:
CARGO_TARGET_DIR=target/target.x86_64 cross build --target x86_64-unknown-linux-musl --all-targets --features vendored-openssl
2022-01-09 20:00:20 +00:00
2021-11-14 14:57:12 +00:00
armv7-binary: armv7-binary-release
2021-11-14 14:57:12 +00:00
armv7-binary-release:
CARGO_TARGET_DIR=target/target.armv7 cross build --target=armv7-unknown-linux-musleabihf --release --all-targets --features vendored-openssl
2021-11-14 14:57:12 +00:00
armv7-binary-debug:
CARGO_TARGET_DIR=target/target.armv7 cross build --target=armv7-unknown-linux-musleabihf --all-targets --features vendored-openssl
# As of 2023-05-12 (and probably earlier!) this is no longer required with current Rust nightlies
# # Hack to workaround https://github.com/rust-embedded/cross/issues/598
# HACK_WORKAROUND_ISSUE_598=CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_RUSTFLAGS="-C link-arg=/usr/local/aarch64-linux-musl/lib/libc.a"
aarch64-binary: aarch64-binary-release
aarch64-binary-release:
CARGO_TARGET_DIR=target/target.aarch64 cross build --target=aarch64-unknown-linux-musl --release --all-targets --features vendored-openssl,jemalloc
aarch64-binary-debug:
CARGO_TARGET_DIR=target/target.aarch64 cross build --target=aarch64-unknown-linux-musl --all-targets --features vendored-openssl
ci-release: x86_64-binary-release aarch64-binary-release armv7-binary-release
rm -rf target/dist
for arch in x86_64 aarch64 armv7; do \
mkdir -p target/dist/$$arch; \
cp -a target/target.$$arch/$$arch-unknown-linux-musl*/release/syndicate-macaroon target/dist/$$arch; \
cp -a target/target.$$arch/$$arch-unknown-linux-musl*/release/syndicate-server target/dist/$$arch; \
done