|
1 | 1 | .PHONY: dist
|
2 | 2 |
|
3 | 3 | # Compile the binaries for all targets.
|
4 |
| -build: |
| 4 | +build: build-aarch64-unknown-linux-musl \ |
| 5 | + build-armv5te-unknown-linux-musleabi \ |
| 6 | + build-armv7-unknown-linux-musleabihf \ |
| 7 | + build-mips-unknown-linux-musl \ |
| 8 | + build-mipsel-unknown-linux-musl |
| 9 | + |
| 10 | +build-aarch64-unknown-linux-musl: |
5 | 11 | cross build --target aarch64-unknown-linux-musl --release
|
| 12 | + |
| 13 | +build-armv5te-unknown-linux-musleabi: |
6 | 14 | cross build --target armv5te-unknown-linux-musleabi --release
|
| 15 | + |
| 16 | +build-armv7-unknown-linux-musleabihf: |
7 | 17 | cross build --target armv7-unknown-linux-musleabihf --release
|
| 18 | + |
| 19 | +build-mips-unknown-linux-musl: |
8 | 20 | cross build --target mips-unknown-linux-musl --release --no-default-features --features semtech_udp
|
| 21 | + |
| 22 | +build-mipsel-unknown-linux-musl: |
9 | 23 | cross build --target mipsel-unknown-linux-musl --release --no-default-features --features semtech_udp
|
10 | 24 |
|
11 |
| -# Build distributable binaries. |
12 |
| -dist: build package |
| 25 | +# Build distributable binaries for all targets. |
| 26 | +dist: dist-aarch64-unknown-linux-musl \ |
| 27 | + dist-armv5te-unknown-linux-musleabi \ |
| 28 | + dist-armv7-unknown-linux-musleabihf \ |
| 29 | + dist-mips-unknown-linux-musl \ |
| 30 | + dist-mipsel-unknown-linux-musl |
13 | 31 |
|
14 |
| -# Update the version. |
15 |
| -version: |
16 |
| - test -n "$(VERSION)" |
17 |
| - sed -i 's/^version.*/version = "$(VERSION)"/g' ./Cargo.toml |
18 |
| - make test |
19 |
| - git add . |
20 |
| - git commit -v -m "Bump version to $(VERSION)" |
21 |
| - git tag -a v$(VERSION) -m "v$(VERSION)" |
| 32 | +dist-aarch64-unknown-linux-musl: build-aarch64-unknown-linux-musl package-aarch64-unknown-linux-musl |
22 | 33 |
|
23 |
| -# Cleanup dist. |
24 |
| -clean: |
25 |
| - cargo clean |
26 |
| - rm -rf dist |
| 34 | +dist-armv5te-unknown-linux-musleabi: build-armv5te-unknown-linux-musleabi package-armv5te-unknown-linux-musleabi |
27 | 35 |
|
28 |
| -# Run tests |
29 |
| -test: |
30 |
| - cargo clippy --no-deps |
31 |
| - cargo test |
| 36 | +dist-armv7-unknown-linux-musleabihf: build-armv7-unknown-linux-musleabihf package-armv7-unknown-linux-musleabihf |
32 | 37 |
|
33 |
| -# Enter the devshell. |
34 |
| -devshell: |
35 |
| - nix-shell |
| 38 | +dist-mips-unknown-linux-musl: build-mips-unknown-linux-musl package-mips-unknown-linux-musl |
36 | 39 |
|
37 |
| -# Enter the Docker based devshell. |
38 |
| -docker-devshell: |
39 |
| - docker-compose run --rm chirpstack-mqtt-forwarder |
| 40 | +dist-mipsel-unknown-linux-musl: build-mipsel-unknown-linux-musl package-mipsel-unknown-linux-musl |
40 | 41 |
|
41 |
| -# Package the compiled binaries. |
42 |
| -package: package-targz-armv7hf package-targz-arm64 package-deb \ |
43 |
| - package-dragino \ |
44 |
| - package-multitech-conduit \ |
45 |
| - package-multitech-conduit-ap \ |
46 |
| - package-tektelic-kona \ |
47 |
| - package-kerlink-klkgw \ |
48 |
| - package-rak-ramips-24kec |
49 |
| - |
50 |
| -package-targz-armv7hf: |
| 42 | +# Package the compiled binaries |
| 43 | +package-aarch64-unknown-linux-musl: |
51 | 44 | $(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version'))
|
52 | 45 | mkdir -p dist
|
53 |
| - tar -czvf dist/chirpstack-mqtt-forwarder_$(PKG_VERSION)_armv7hf.tar.gz -C target/armv7-unknown-linux-musleabihf/release chirpstack-mqtt-forwarder |
54 | 46 |
|
55 |
| -package-targz-arm64: |
56 |
| - $(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')) |
57 |
| - mkdir -p dist |
| 47 | + # .tar.gz |
58 | 48 | tar -czvf dist/chirpstack-mqtt-forwarder_$(PKG_VERSION)_arm64.tar.gz -C target/aarch64-unknown-linux-musl/release chirpstack-mqtt-forwarder
|
59 | 49 |
|
60 |
| -package-deb: |
| 50 | + # .deb |
61 | 51 | cargo deb --target aarch64-unknown-linux-musl --no-build --no-strip
|
62 |
| - cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip |
| 52 | + cp target/aarch64-unknown-linux-musl/debian/*.deb ../dist |
| 53 | + |
| 54 | +package-armv7-unknown-linux-musleabihf: package-tektelic-kona package-kerlink-klkgw |
| 55 | + $(eval PKG_VERSION := $(shell cargo metadata --no-deps --format-version 1 | jq -r '.packages[0].version')) |
63 | 56 | mkdir -p dist
|
| 57 | + |
| 58 | + # .tar.gz |
| 59 | + tar -czvf dist/chirpstack-mqtt-forwarder_$(PKG_VERSION)_armv7hf.tar.gz -C target/armv7-unknown-linux-musleabihf/release chirpstack-mqtt-forwarder |
| 60 | + |
| 61 | + # .deb |
| 62 | + cargo deb --target armv7-unknown-linux-musleabihf --no-build --no-strip |
64 | 63 | cp target/armv7-unknown-linux-musleabihf/debian/*.deb ../dist
|
65 |
| - cp target/aarch64-unknown-linux-musl/debian/*.deb ../dist |
66 | 64 |
|
| 65 | +package-armv5te-unknown-linux-musleabi: package-multitech-conduit package-multitech-conduit-ap |
| 66 | + |
| 67 | +package-mips-unknown-linux-musl: package-dragino |
| 68 | + |
| 69 | +package-mipsel-unknown-linux-musl: package-rak-ramips-24kec |
| 70 | + |
| 71 | +# Gateway specific packaging. |
67 | 72 | package-dragino:
|
68 | 73 | cd packaging/vendor/dragino/mips_24kc && ./package.sh
|
69 | 74 | mkdir -p dist/vendor/dragino/mips_24kc
|
@@ -93,3 +98,30 @@ package-kerlink-klkgw:
|
93 | 98 | cd packaging/vendor/kerlink/klkgw && ./package.sh
|
94 | 99 | mkdir -p dist/vendor/kerlink/klkgw
|
95 | 100 | cp packaging/vendor/kerlink/klkgw/*.ipk dist/vendor/kerlink/klkgw
|
| 101 | + |
| 102 | +# Update the version. |
| 103 | +version: |
| 104 | + test -n "$(VERSION)" |
| 105 | + sed -i 's/^version.*/version = "$(VERSION)"/g' ./Cargo.toml |
| 106 | + make test |
| 107 | + git add . |
| 108 | + git commit -v -m "Bump version to $(VERSION)" |
| 109 | + git tag -a v$(VERSION) -m "v$(VERSION)" |
| 110 | + |
| 111 | +# Cleanup dist. |
| 112 | +clean: |
| 113 | + cargo clean |
| 114 | + rm -rf dist |
| 115 | + |
| 116 | +# Run tests |
| 117 | +test: |
| 118 | + cargo clippy --no-deps |
| 119 | + cargo test |
| 120 | + |
| 121 | +# Enter the devshell. |
| 122 | +devshell: |
| 123 | + nix-shell |
| 124 | + |
| 125 | +# Enter the Docker based devshell. |
| 126 | +docker-devshell: |
| 127 | + docker-compose run --rm chirpstack-mqtt-forwarder |
0 commit comments