]> Git Repo - VerusCoin.git/blob - depends/Makefile
Merge pull request #592 from jl777/mergemaster
[VerusCoin.git] / depends / Makefile
1 .NOTPARALLEL :
2
3 SOURCES_PATH ?= $(BASEDIR)/sources
4 BASE_CACHE ?= $(BASEDIR)/built
5 SDK_PATH ?= $(BASEDIR)/SDKs
6 NO_WALLET ?=
7 NO_UPNP ?=
8 FALLBACK_DOWNLOAD_PATH ?= https://supernet/depends-sources
9
10 BUILD ?= $(shell ./config.guess)
11 HOST ?= $(BUILD)
12 PATCHES_PATH = $(BASEDIR)/patches
13 BASEDIR = $(CURDIR)
14 HASH_LENGTH:=11
15 DOWNLOAD_CONNECT_TIMEOUT:=10
16 DOWNLOAD_RETRIES:=3
17
18 host:=$(BUILD)
19 ifneq ($(HOST),)
20 host:=$(HOST)
21 host_toolchain:=$(HOST)-
22 endif
23
24 ifneq ($(DEBUG),)
25 release_type=debug
26 else
27 release_type=release
28 endif
29
30 base_build_dir=$(BASEDIR)/work/build
31 base_staging_dir=$(BASEDIR)/work/staging
32 base_download_dir=$(BASEDIR)/work/download
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
75 rust_packages_$(NO_RUST) = $(rust_packages)
76 wallet_packages_$(NO_WALLET) = $(wallet_packages)
77 proton_packages_$(NO_PROTON) = $(proton_packages)
78
79 packages += $($(host_arch)_$(host_os)_packages) $($(host_os)_packages) $(rust_packages_) $(proton_packages_) $(wallet_packages_)
80 native_packages += $($(host_arch)_$(host_os)_native_packages) $($(host_os)_native_packages)
81 all_packages = $(packages) $(native_packages)
82
83 meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk
84
85 $(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
86
87 include funcs.mk
88
89 toolchain_path=$($($(host_arch)_$(host_os)_native_toolchain)_prefixbin)
90 final_build_id_long+=$(shell $(build_SHA256SUM) config.site.in)
91 final_build_id+=$(shell echo -n $(final_build_id_long) | $(build_SHA256SUM) | cut -c-$(HASH_LENGTH))
92 $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
93         $(AT)rm -rf $(@D)
94         $(AT)mkdir -p $(@D)
95         $(AT)echo copying packages: $^
96         $(AT)echo to: $(@D)
97         $(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
98         $(AT)touch $@
99
100 $(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
101         $(AT)@mkdir -p $(@D)
102         $(AT)sed -e 's|@HOST@|$(host)|' \
103             -e 's|@CC@|$(toolchain_path)$(host_CC)|' \
104             -e 's|@CXX@|$(toolchain_path)$(host_CXX)|' \
105             -e 's|@AR@|$(toolchain_path)$(host_AR)|' \
106             -e 's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
107             -e 's|@NM@|$(toolchain_path)$(host_NM)|' \
108             -e 's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \
109             -e 's|@build_os@|$(build_os)|' \
110             -e 's|@host_os@|$(host_os)|' \
111             -e 's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \
112             -e 's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
113             -e 's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
114             -e 's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
115             -e 's|@no_wallet@|$(NO_WALLET)|' \
116             -e 's|@debug@|$(DEBUG)|' \
117             $< > $@
118         $(AT)touch $@
119
120
121 define check_or_remove_cached
122   mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \
123   $(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \
124   ( rm -f $($(package)_cached_checksum); \
125     if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); fi )
126 endef
127
128 define check_or_remove_sources
129   mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \
130   $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \
131     ( if test -f $($(package)_all_sources); then echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; fi; \
132       rm -f $($(package)_all_sources) $($(1)_fetched))
133 endef
134
135 check-packages:
136         @$(foreach package,$(all_packages),$(call check_or_remove_cached,$(package));)
137 check-sources:
138         @$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));)
139
140 $(host_prefix)/share/config.site: check-packages
141
142 check-packages: check-sources
143
144 install: check-packages $(host_prefix)/share/config.site
145
146
147 download-one: check-sources $(all_sources)
148
149 download-osx:
150         @$(MAKE) -s HOST=x86_64-apple-darwin11 download-one
151 download-linux:
152         @$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one
153 download-win:
154         @$(MAKE) -s HOST=x86_64-w64-mingw32 download-one
155 download: download-osx download-linux download-win
156
157 .PHONY: install cached download-one download-osx download-linux download-win download check-packages check-sources
This page took 0.032205 seconds and 4 git commands to generate.