]>
Commit | Line | Data |
---|---|---|
738ec06d RBR |
1 | profile := dev |
2 | target = $(shell rustc -vV | grep host | awk '{print $$2}') | |
3 | architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu | |
44e7b4de | 4 | app_name := lrc |
8d584ce7 | 5 | long_app_name := lyricli |
be6fd3ec | 6 | host_architecture := $(target) |
169297c8 BB |
7 | |
8 | default: build | |
9 | ||
738ec06d RBR |
10 | set_rust: |
11 | rustup default stable | |
12 | ||
13 | prepare: | |
14 | rustup target add $(target) | |
15 | ||
16 | build: prepare | |
be6fd3ec RBR |
17 | # I need an actually configurable way to make this work. Right now i'm only |
18 | # cross compiling in the CI, and I know what I'm running, but | |
19 | ifeq ($(host_architecture), x86_64-unknown-linux-gnu) | |
20 | ifeq ($(target), aarch64-unknown-linux-gnu) | |
9ec2c51a | 21 | LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu/lib:${LD_LIBRARY_PATH} |
be6fd3ec RBR |
22 | endif |
23 | endif | |
738ec06d RBR |
24 | @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target) |
25 | ||
26 | release: rpm tar deb | |
27 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
28 | ||
29 | $(architectures): | |
30 | ifneq ($(channel),) | |
31 | $(MAKE) -e channel=$(channel) -e target=$@ release | |
32 | else | |
33 | $(MAKE) -e target=$@ build | |
34 | endif | |
35 | ||
36 | deb: build | |
8d584ce7 | 37 | ifeq ($(findstring linux,$(target)),linux) |
738ec06d | 38 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
f5a040da | 39 | @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo deb --profile $(profile) --target $(target) |
738ec06d RBR |
40 | mv target/$(target)/debian/*.deb $(filename).deb |
41 | sha256sum $(filename).deb > $(filename).deb.sha256 | |
8d584ce7 RBR |
42 | rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) |
43 | rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) | |
44 | endif | |
738ec06d RBR |
45 | |
46 | rpm: build | |
8d584ce7 | 47 | ifeq ($(findstring linux,$(target)),linux) |
738ec06d | 48 | @$(eval filename := $(app_name)-$(target)-$(channel)) |
f5a040da | 49 | @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo generate-rpm --profile $(profile) --target $(target) |
738ec06d RBR |
50 | mv target/$(target)/generate-rpm/*.rpm $(filename).rpm |
51 | sha256sum $(filename).rpm > $(filename).rpm.sha256 | |
8d584ce7 RBR |
52 | rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) |
53 | rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) | |
54 | endif | |
738ec06d RBR |
55 | |
56 | tar: build | |
57 | @$(eval filename := $(app_name)-$(target)-$(channel)) | |
58 | tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name) | |
59 | sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256 | |
8d584ce7 RBR |
60 | rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) |
61 | rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(long_app_name) | |
738ec06d RBR |
62 | |
63 | package: $(architectures) | |
64 | ||
8d584ce7 | 65 | mac: |
534287c3 | 66 | @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin) |
8d584ce7 | 67 | ifeq ($(tag),) |
534287c3 | 68 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package |
8d584ce7 | 69 | else |
534287c3 | 70 | $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package |
8d584ce7 RBR |
71 | endif |
72 | ||
73 | ||
738ec06d RBR |
74 | ci: |
75 | ifeq ($(GIT_REF),refs/heads/main) | |
76 | $(MAKE) -e profile=release -e channel=unstable package | |
77 | else ifneq (,$(findstring refs/tags/,$(GIT_REF))) | |
78 | $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package | |
79 | endif | |
80 | ||
81 | .PHONY: default build $(architectures) rpm package prepare set_rust ci release |