-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
99 lines (74 loc) · 3.21 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.PHONY: dist
# Compile the binaries for all targets
build: build-aarch64-unknown-linux-musl \
build-x86_64-unknown-linux-musl \
build-armv7-unknown-linux-musleabihf
build-x86_64-unknown-linux-musl:
cross build --target x86_64-unknown-linux-musl --release
build-aarch64-unknown-linux-musl:
cross build --target aarch64-unknown-linux-musl --release
build-armv7-unknown-linux-musleabihf:
cross build --target armv7-unknown-linux-musleabihf --release
# Build distributable binaries for all targets
dist: dist-aarch64-unknown-linux-musl \
dist-x86_64-unknown-linux-musl \
dist-armv7-unknown-linux-musleabihf
dist-x86_64-unknown-linux-musl: build-x86_64-unknown-linux-musl package-x86_64-unknown-linux-musl
dist-aarch64-unknown-linux-musl: build-aarch64-unknown-linux-musl package-aarch64-unknown-linux-musl
dist-armv7-unknown-linux-musleabihf: build-armv7-unknown-linux-musleabihf package-armv7-unknown-linux-musleabihf
# Package the compiled binaries
package-x86_64-unknown-linux-musl:
$(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'))
mkdir -p dist
# .tar.gz
tar -czvf dist/chirpstack-pulsar-integration_$(PKG_VERSION)_amd64.tar.gz -C target/x86_64-unknown-linux-musl/release chirpstack-pulsar-integration
# .deb
cargo deb --target x86_64-unknown-linux-musl --no-build --no-strip
cp ./target/x86_64-unknown-linux-musl/debian/*.deb ./dist
# .rpm
cargo generate-rpm --target x86_64-unknown-linux-musl --target-dir ./target
cp ./target/x86_64-unknown-linux-musl/generate-rpm/*.rpm ./dist
package-aarch64-unknown-linux-musl:
$(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'))
mkdir -p dist
# .tar.gz
tar -czvf dist/chirpstack-pulsar-integration_$(PKG_VERSION)_arm64.tar.gz -C target/aarch64-unknown-linux-musl/release chirpstack-pulsar-integration
# .deb
cargo deb --target aarch64-unknown-linux-musl --no-build --no-strip
cp ./target/aarch64-unknown-linux-musl/debian/*.deb ./dist
# .rpm
cargo generate-rpm --target aarch64-unknown-linux-musl --target-dir ./target
cp ./target/aarch64-unknown-linux-musl/generate-rpm/*.rpm ./dist
package-armv7-unknown-linux-musleabihf:
$(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'))
mkdir -p dist
# .tar.gz
tar -czvf dist/chirpstack-pulsar-integration_$(PKG_VERSION)_armv7hf.tar.gz -C target/armv7-unknown-linux-musleabihf/release chirpstack-pulsar-integration
# .deb
cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip
cp ./target/armv7-unknown-linux-musleabihf/debian/*.deb ./dist
# .rpm
cargo generate-rpm --target armv7-unknown-linux-musleabihf --target-dir ./target
cp ./target/armv7-unknown-linux-musleabihf/generate-rpm/*.rpm ./dist
# Update the version
version:
test -n "$(VERSION)"
sed -i 's/^ version.*/ version = "$(VERSION)"/g' ./Cargo.toml
make test
git add .
git commit -v -m "Bump version to $(VERSION)"
git tag -a v$(VERSION) -m "v$(VERSION)"
# Cleanup dist.
clean:
cargo clean
rm -rf dist
# Run tests.
test:
cargo clippy
cargo test
# Enter the devshell.
devshell:
nix-shell
# Install dev dependencies
dev-dependencies:
cargo install cargo-generate-rpm --version 0.12.1