]> git.r.bdr.sh - rbdr/lyricli/blame - Makefile
Attempt to set the aarch64 ld library
[rbdr/lyricli] / Makefile
CommitLineData
738ec06d
RBR
1profile := dev
2target = $(shell rustc -vV | grep host | awk '{print $$2}')
3architectures := x86_64-unknown-linux-gnu aarch64-unknown-linux-gnu
44e7b4de 4app_name := lrc
8d584ce7 5long_app_name := lyricli
be6fd3ec 6host_architecture := $(target)
169297c8
BB
7
8default: build
9
738ec06d
RBR
10set_rust:
11 rustup default stable
12
13prepare:
14 rustup target add $(target)
15
16build: 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
19ifeq ($(host_architecture), x86_64-unknown-linux-gnu)
20ifeq ($(target), aarch64-unknown-linux-gnu)
21 LD_LIBRARY_PATH=/usr/local/aarch64-linux-gnu/lib:${LD_LIBRARY_PATH}
22endif
23endif
738ec06d
RBR
24 @export $$(cat .env | xargs) > /dev/null 2>&1 && cargo build --profile $(profile) --target $(target)
25
26release: rpm tar deb
27 @$(eval filename := $(app_name)-$(target)-$(channel))
28
29$(architectures):
30ifneq ($(channel),)
31 $(MAKE) -e channel=$(channel) -e target=$@ release
32else
33 $(MAKE) -e target=$@ build
34endif
35
36deb: build
8d584ce7 37ifeq ($(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)
44endif
738ec06d
RBR
45
46rpm: build
8d584ce7 47ifeq ($(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)
54endif
738ec06d
RBR
55
56tar: 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
63package: $(architectures)
64
8d584ce7 65mac:
534287c3 66 @$(eval mac_architectures := x86_64-apple-darwin aarch64-apple-darwin)
8d584ce7 67ifeq ($(tag),)
534287c3 68 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=unstable package
8d584ce7 69else
534287c3 70 $(MAKE) -e profile=release -e architectures='$(mac_architectures)' -e channel=$(tag) package
8d584ce7
RBR
71endif
72
73
738ec06d
RBR
74ci:
75ifeq ($(GIT_REF),refs/heads/main)
76 $(MAKE) -e profile=release -e channel=unstable package
77else ifneq (,$(findstring refs/tags/,$(GIT_REF)))
78 $(MAKE) -e profile=release -e channel=$(subst refs/tags/,,$(GIT_REF)) package
79endif
80
81.PHONY: default build $(architectures) rpm package prepare set_rust ci release