-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
47 lines (31 loc) · 1.65 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
VERSION?=$(shell git rev-parse --abbrev-ref HEAD)
SYSTEM?=$(subst ",,$(shell nix-instantiate --eval -E '(import <nixpkgs> {}).system'))
TARGETS=dfx-env.tar.gz ic-binaries-$(VERSION)-$(SYSTEM).tar.gz ic-canisters-$(VERSION)-wasm32.tar.gz dfx-extensions-$(VERSION).tar.gz
default:
echo $(VERSION) $(SYSTEM) $(TARGETS)
all: $(TARGETS)
binaries: ic-binaries-$(VERSION)-$(SYSTEM).tar.gz
canisters: ic-canisters-$(VERSION)-wasm32.tar.gz
extensions: dfx-extensions-$(VERSION).tar.gz
dfx-env:
mkdir dfx-env
dfx-env.tar.gz: | dfx-env
sed -e "s/version ? null/version ? \"$(VERSION)\"/" dfx-env.nix > dfx-env/default.nix
tar -zcvf dfx-env.tar.gz dfx-env
ic-binaries-$(VERSION)-$(SYSTEM).tar.gz:
tar -zcv -C $$(nix-build --pure release.nix --no-out-link -A binaries) --transform "s,^.,ic-binaries-$(VERSION)," -f $@ .
ic-canisters-$(VERSION)-wasm32.tar.gz:
tar -zcv -C $$(nix-build --pure release.nix --no-out-link -A canisters) --transform "s,^.,ic-canisters-$(VERSION)," -f $@ .
dfx-extensions-$(VERSION).tar.gz:
tar -zcv -C $$(nix-build --pure release.nix --no-out-link -A extensions) --transform "s,^.,dfx-extensions-$(VERSION)," -f $@ .
subnet-replica-versions:
curl https://ic-api.internetcomputer.org/api/v3/subnet-replica-versions?limit=1 -o $@
replica-rev: subnet-replica-versions
cat $< | jq -r '.data[0].replica_version_id' > $@
update-sources-ic: nix/sources.nix replica-rev
sed -i "0,/pin/{s/\"[^\"]*\"; # pin/\"$$(cat replica-rev)\"; # pin/}" $<
update-sources: nix/sources.nix update-sources-ic
update-nix-fetchgit $<
clean:
rm -rf dfx-env subnet-replica-versions replica-rev $(TARGETS)
.PHONY: update-sources binaries canisters extensions default all clean