]> git.r.bdr.sh - rbdr/page/blame - Makefile
Add the packaging steps + manual
[rbdr/page] / Makefile
CommitLineData
102424ed
RBR
1profile := dev
2target = $(shell rustc -vV | grep host | awk '{print $$2}')
3architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
4app_name := page
48ea9080
RBR
5
6default: build
7
102424ed
RBR
8set_rust:
9 rustup default stable
48ea9080 10
102424ed
RBR
11prepare:
12 rustup target add $(target)
13
14build: prepare
15 cargo build --profile $(profile) --target $(target)
16
a411ac34
RBR
17release: rpm tar deb
18 @$(eval filename := $(app_name)-$(target)-$(channel))
102424ed
RBR
19
20$(architectures):
21ifneq ($(channel),)
22 $(MAKE) -e channel=$(channel) -e target=$@ release
23else
24 $(MAKE) -e target=$@ build
25endif
26
a411ac34
RBR
27deb: build
28 @$(eval filename := $(app_name)-$(target)-$(channel))
29 cargo deb --profile $(profile) --target $(target)
30 mv target/$(target)/debian/*.deb $(filename).deb
31 sha256sum $(filename).deb > $(filename).deb.sha256
32 rsync -avz $(filename).deb deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
33 rsync -avz $(filename).deb.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
34
102424ed 35rpm: build
a411ac34
RBR
36 @$(eval filename := $(app_name)-$(target)-$(channel))
37 cargo generate-rpm --profile $(profile) --target $(target)
38 mv target/$(target)/generate-rpm/*.rpm $(filename).rpm
39 sha256sum $(filename).rpm > $(filename).rpm.sha256
40 rsync -avz $(filename).rpm deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
41 rsync -avz $(filename).rpm.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
102424ed
RBR
42
43tar: build
a411ac34
RBR
44 @$(eval filename := $(app_name)-$(target)-$(channel))
45 tar -czvf $(filename).tar.gz -C target/$(target)/$(profile)/ $(app_name)
46 sha256sum $(filename).tar.gz > $(filename).tar.gz.sha256
47 rsync -avz $(filename).tar.gz deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
48 rsync -avz $(filename).tar.gz.sha256 deploy@conchos.unlimited.pizza:/srv/http/build.r.bdr.sh/$(app_name)
102424ed
RBR
49
50package: $(architectures)
51
52ci:
53ifeq ($(GIT_REF),refs/heads/main)
54 $(MAKE) -e profile=release -e channel=unstable package
55else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
56 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
57endif
58
59.PHONY: default build $(architectures) rpm package prepare set_rust ci release