]>
Commit | Line | Data |
---|---|---|
1dec09b3 CF |
1 | .NOTPARALLEL : |
2 | ||
3 | SOURCES_PATH ?= $(BASEDIR)/sources | |
4 | BASE_CACHE ?= $(BASEDIR)/built | |
5 | SDK_PATH ?= $(BASEDIR)/SDKs | |
1dec09b3 | 6 | NO_WALLET ?= |
be60c6d7 | 7 | PRIORITY_DOWNLOAD_PATH ?= https://z.cash/depends-sources |
1dec09b3 | 8 | |
1ead1bb0 | 9 | BUILD ?= $(shell ./config.guess) |
1dec09b3 CF |
10 | HOST ?= $(BUILD) |
11 | PATCHES_PATH = $(BASEDIR)/patches | |
12 | BASEDIR = $(CURDIR) | |
13 | HASH_LENGTH:=11 | |
df7565d9 CF |
14 | DOWNLOAD_CONNECT_TIMEOUT:=10 |
15 | DOWNLOAD_RETRIES:=3 | |
0adfdc99 | 16 | CRATE_REGISTRY:=vendored-sources |
1dec09b3 CF |
17 | |
18 | host:=$(BUILD) | |
19 | ifneq ($(HOST),) | |
20 | host:=$(HOST) | |
21 | host_toolchain:=$(HOST)- | |
22 | endif | |
23 | ||
2027ad30 CF |
24 | ifneq ($(DEBUG),) |
25 | release_type=debug | |
26 | else | |
27 | release_type=release | |
28 | endif | |
29 | ||
1dec09b3 CF |
30 | base_build_dir=$(BASEDIR)/work/build |
31 | base_staging_dir=$(BASEDIR)/work/staging | |
d546191d | 32 | base_download_dir=$(BASEDIR)/work/download |
1dec09b3 CF |
33 | canonical_host:=$(shell ./config.sub $(HOST)) |
34 | build:=$(shell ./config.sub $(BUILD)) | |
35 | ||
36 | build_arch =$(firstword $(subst -, ,$(build))) | |
37 | build_vendor=$(word 2,$(subst -, ,$(build))) | |
38 | full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build)) | |
39 | build_os:=$(findstring linux,$(full_build_os)) | |
40 | build_os+=$(findstring darwin,$(full_build_os)) | |
41 | build_os:=$(strip $(build_os)) | |
42 | ifeq ($(build_os),) | |
43 | build_os=$(full_build_os) | |
44 | endif | |
45 | ||
46 | host_arch=$(firstword $(subst -, ,$(canonical_host))) | |
47 | host_vendor=$(word 2,$(subst -, ,$(canonical_host))) | |
48 | full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host)) | |
49 | host_os:=$(findstring linux,$(full_host_os)) | |
50 | host_os+=$(findstring darwin,$(full_host_os)) | |
51 | host_os+=$(findstring mingw32,$(full_host_os)) | |
52 | host_os:=$(strip $(host_os)) | |
53 | ifeq ($(host_os),) | |
54 | host_os=$(full_host_os) | |
55 | endif | |
56 | ||
57 | $(host_arch)_$(host_os)_prefix=$(BASEDIR)/$(host) | |
58 | $(host_arch)_$(host_os)_host=$(host) | |
59 | host_prefix=$($(host_arch)_$(host_os)_prefix) | |
60 | build_prefix=$(host_prefix)/native | |
61 | build_host=$(build) | |
62 | ||
63 | AT_$(V):= | |
64 | AT_:=@ | |
65 | AT:=$(AT_$(V)) | |
66 | ||
67 | all: install | |
68 | ||
69 | include hosts/$(host_os).mk | |
70 | include hosts/default.mk | |
71 | include builders/$(build_os).mk | |
72 | include builders/default.mk | |
73 | include packages/packages.mk | |
74 | ||
1dec09b3 | 75 | wallet_packages_$(NO_WALLET) = $(wallet_packages) |
f493d3e0 | 76 | proton_packages_$(NO_PROTON) = $(proton_packages) |
1dec09b3 | 77 | |
d9cd254e | 78 | packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages) $(proton_packages_) $(wallet_packages_) |
d5966580 | 79 | native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages) |
1dec09b3 CF |
80 | all_packages = $(packages) $(native_packages) |
81 | ||
0adfdc99 | 82 | meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk cargo-checksum.sh |
1dec09b3 CF |
83 | |
84 | $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain) | |
85 | ||
86 | include funcs.mk | |
87 | ||
88 | toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin) | |
89 | final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in) | |
90 | final_build_id+=$(shell echo -n $(final_build_id_long) | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH)) | |
235b3a78 | 91 | $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages) |
1dec09b3 CF |
92 | $(AT)rm -rf $(@D) |
93 | $(AT)mkdir -p $(@D) | |
235b3a78 | 94 | $(AT)echo copying packages: $^ |
1dec09b3 | 95 | $(AT)echo to: $(@D) |
235b3a78 | 96 | $(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); ) |
1dec09b3 CF |
97 | $(AT)touch $@ |
98 | ||
99 | $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id) | |
100 | $(AT)@mkdir -p $(@D) | |
101 | $(AT)sed -e 's|@HOST@|$(host)|' \ | |
102 | -e 's|@CC@|$(toolchain_path)$(host_CC)|' \ | |
103 | -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \ | |
104 | -e 's|@AR@|$(toolchain_path)$(host_AR)|' \ | |
105 | -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \ | |
106 | -e 's|@NM@|$(toolchain_path)$(host_NM)|' \ | |
107 | -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \ | |
108 | -e 's|@build_os@|$(build_os)|' \ | |
109 | -e 's|@host_os@|$(host_os)|' \ | |
2027ad30 CF |
110 | -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \ |
111 | -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \ | |
112 | -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \ | |
113 | -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \ | |
1dec09b3 | 114 | -e 's|@no_wallet@|$(NO_WALLET)|' \ |
2027ad30 | 115 | -e 's|@debug@|$(DEBUG)|' \ |
1dec09b3 CF |
116 | $< > $@ |
117 | $(AT)touch $@ | |
118 | ||
235b3a78 CF |
119 | |
120 | define check_or_remove_cached | |
121 | mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \ | |
122 | $(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \ | |
123 | ( rm -f $($(package)_cached_checksum); \ | |
124 | if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); fi ) | |
125 | endef | |
126 | ||
127 | define check_or_remove_sources | |
128 | mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \ | |
129 | $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \ | |
130 | ( if test -f $($(package)_all_sources); then echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; fi; \ | |
131 | rm -f $($(package)_all_sources) $($(1)_fetched)) | |
132 | endef | |
133 | ||
134 | check-packages: | |
135 | @$(foreach package,$(all_packages),$(call check_or_remove_cached,$(package));) | |
136 | check-sources: | |
137 | @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));) | |
138 | ||
139 | $(host_prefix)/share/config.site: check-packages | |
140 | ||
141 | check-packages: check-sources | |
142 | ||
143 | install: check-packages $(host_prefix)/share/config.site | |
144 | ||
145 | ||
146 | download-one: check-sources $(all_sources) | |
147 | ||
422f873e CF |
148 | download-osx: |
149 | @$(MAKE) -s HOST=x86_64-apple-darwin11 download-one | |
150 | download-linux: | |
151 | @$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one | |
152 | download-win: | |
153 | @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one | |
154 | download: download-osx download-linux download-win | |
235b3a78 CF |
155 | |
156 | .PHONY: install cached download-one download-osx download-linux download-win download check-packages check-sources |