-
Notifications
You must be signed in to change notification settings - Fork 5
/
Makefile
80 lines (65 loc) · 3.15 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
PKG_ID := $(shell yq e ".id" manifest.yaml)
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
UPSTREAM_VERSION :=$(shell ./utils/scripts/get_upstream_version.sh ${PKG_VERSION})
TS_FILES := $(shell find ./ -name \*.ts)
DOC_ASSETS := $(shell find ./docs/assets)
CONFIGURATOR_SRC := $(shell find ./configurator/src) configurator/Cargo.toml configurator/Cargo.lock
UTILS_SRC := $(shell find ./utils/**/*)
.DELETE_ON_ERROR:
all: verify
arm:
@rm -f docker-images/x86_64.tar
@ARCH=aarch64 $(MAKE)
x86:
@rm -f docker-images/aarch64.tar
@ARCH=x86_64 $(MAKE)
verify: $(PKG_ID).s9pk
@start-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"
install:
ifeq (,$(wildcard ~/.embassy/config.yaml))
@echo; echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first"; echo
else
start-cli package install $(PKG_ID).s9pk
endif
clean:
rm -rf docker-images
rm -f image.tar
rm -f $(PKG_ID).s9pk
rm -f js/*.js
rm -f LICENSE
rm -rf configurator/target
$(PKG_ID).s9pk: manifest.yaml instructions.md LICENSE icon.png scripts/embassy.js docker-images/aarch64.tar docker-images/x86_64.tar
ifeq ($(ARCH),aarch64)
@echo "start-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "start-sdk: Preparing x86_64 package ..."
else
@echo "start-sdk: Preparing Universal Package ..."
endif
@start-sdk pack
docker-images/x86_64.tar: configurator/target/x86_64-unknown-linux-musl/release/configurator $(UTILS_SRC) Dockerfile
ifeq ($(ARCH),aarch64)
else
@echo "Building package for x86_64..."
mkdir -p docker-images
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform=linux/amd64 --tag start9/btcpayserver/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --build-arg PLATFORM=amd64 -o type=docker,dest=docker-images/x86_64.tar -f ./Dockerfile .
endif
docker-images/aarch64.tar: configurator/target/aarch64-unknown-linux-musl/release/configurator $(UTILS_SRC) Dockerfile
ifeq ($(ARCH),x86_64)
else
@echo "Building package for aarch64..."
mkdir -p docker-images
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --platform=linux/arm64/v8 --tag start9/btcpayserver/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 -o type=docker,dest=docker-images/aarch64.tar -f ./Dockerfile .
endif
configurator/target/aarch64-unknown-linux-musl/release/configurator: $(CONFIGURATOR_SRC)
docker run --rm -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/configurator:/home/rust/src start9/rust-musl-cross:aarch64-musl cargo build --release --config net.git-fetch-with-cli=true
configurator/target/x86_64-unknown-linux-musl/release/configurator: $(CONFIGURATOR_SRC)
docker run --rm -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/configurator:/home/rust/src start9/rust-musl-cross:x86_64-musl cargo build --release --config net.git-fetch-with-cli=true
instructions.md: docs/instructions.md $(DOC_ASSETS)
cd docs && md-packer < instructions.md > ../instructions.md
scripts/embassy.js: $(TS_FILES)
deno bundle scripts/embassy.ts scripts/embassy.js
LICENSE:
wget https://raw.githubusercontent.com/btcpayserver/btcpayserver/v$(UPSTREAM_VERSION)/LICENSE -O - > LICENSE