3 SOURCES_PATH ?
= $(BASEDIR
)/sources
4 BASE_CACHE ?
= $(BASEDIR
)/built
5 SDK_PATH ?
= $(BASEDIR
)/SDKs
9 FALLBACK_DOWNLOAD_PATH ?
= https
://bitcoincore.org
/depends-sources
11 BUILD
= $(shell .
/config.guess
)
13 PATCHES_PATH
= $(BASEDIR
)/patches
16 DOWNLOAD_CONNECT_TIMEOUT
:=10
24 host_toolchain
:=$(HOST
)-
33 base_build_dir
=$(BASEDIR
)/work
/build
34 base_staging_dir
=$(BASEDIR
)/work
/staging
35 base_download_dir
=$(BASEDIR
)/work
/download
36 canonical_host
:=$(shell .
/config.sub
$(HOST
))
37 build
:=$(shell .
/config.sub
$(BUILD
))
39 build_arch
=$(firstword $(subst -, ,$(build
)))
40 build_vendor
=$(word 2,$(subst -, ,$(build
)))
41 full_build_os
:=$(subst $(build_arch
)-$(build_vendor
)-,,$(build
))
42 build_os
:=$(findstring linux
,$(full_build_os
))
43 build_os
+=$(findstring darwin
,$(full_build_os
))
44 build_os
:=$(strip $(build_os
))
46 build_os
=$(full_build_os
)
49 host_arch
=$(firstword $(subst -, ,$(canonical_host
)))
50 host_vendor
=$(word 2,$(subst -, ,$(canonical_host
)))
51 full_host_os
:=$(subst $(host_arch
)-$(host_vendor
)-,,$(canonical_host
))
52 host_os
:=$(findstring linux
,$(full_host_os
))
53 host_os
+=$(findstring darwin
,$(full_host_os
))
54 host_os
+=$(findstring mingw32
,$(full_host_os
))
55 host_os
:=$(strip $(host_os
))
57 host_os
=$(full_host_os
)
60 $(host_arch
)_
$(host_os
)_prefix
=$(BASEDIR
)/$(host
)
61 $(host_arch
)_
$(host_os
)_host
=$(host
)
62 host_prefix
=$($(host_arch
)_
$(host_os
)_prefix
)
63 build_prefix
=$(host_prefix
)/native
72 include hosts
/$(host_os
).mk
73 include hosts
/default.mk
74 include builders
/$(build_os
).mk
75 include builders
/default.mk
76 include packages
/packages.mk
78 build_id_string
:=$(BUILD_ID_SALT
)
79 build_id_string
+=$(shell $(build_CC
) --version
2>/dev
/null
)
80 build_id_string
+=$(shell $(build_AR
) --version
2>/dev
/null
)
81 build_id_string
+=$(shell $(build_CXX
) --version
2>/dev
/null
)
82 build_id_string
+=$(shell $(build_RANLIB
) --version
2>/dev
/null
)
83 build_id_string
+=$(shell $(build_STRIP
) --version
2>/dev
/null
)
85 $(host_arch
)_
$(host_os
)_id_string
:=$(HOST_ID_SALT
)
86 $(host_arch
)_
$(host_os
)_id_string
+=$(shell $(host_CC
) --version
2>/dev
/null
)
87 $(host_arch
)_
$(host_os
)_id_string
+=$(shell $(host_AR
) --version
2>/dev
/null
)
88 $(host_arch
)_
$(host_os
)_id_string
+=$(shell $(host_CXX
) --version
2>/dev
/null
)
89 $(host_arch
)_
$(host_os
)_id_string
+=$(shell $(host_RANLIB
) --version
2>/dev
/null
)
90 $(host_arch
)_
$(host_os
)_id_string
+=$(shell $(host_STRIP
) --version
2>/dev
/null
)
92 qt_packages_
$(NO_QT
) = $(qt_packages
) $(qt_
$(host_os
)_packages
) $(qt_
$(host_arch
)_
$(host_os
)_packages
)
93 wallet_packages_
$(NO_WALLET
) = $(wallet_packages
)
94 upnp_packages_
$(NO_UPNP
) = $(upnp_packages
)
96 packages
+= $($(host_arch
)_
$(host_os
)_packages
) $($(host_os
)_packages
) $(qt_packages_
) $(wallet_packages_
) $(upnp_packages_
)
97 native_packages
+= $($(host_arch
)_
$(host_os
)_native_packages
) $($(host_os
)_native_packages
)
99 ifneq ($(qt_packages_
),)
100 native_packages
+= $(qt_native_packages
)
103 all_packages
= $(packages
) $(native_packages
)
105 meta_depends
= Makefile funcs.mk builders
/default.mk hosts
/default.mk hosts
/$(host_os
).mk builders
/$(build_os
).mk
107 $(host_arch
)_
$(host_os
)_native_toolchain?
=$($(host_os
)_native_toolchain
)
111 toolchain_path
=$($($(host_arch
)_
$(host_os
)_native_toolchain
)_prefixbin
)
112 final_build_id_long
+=$(shell $(build_SHA256SUM
) config.site.in
)
113 final_build_id
+=$(shell echo
-n
"$(final_build_id_long)" |
$(build_SHA256SUM
) | cut
-c-
$(HASH_LENGTH
))
114 $(host_prefix
)/.stamp_
$(final_build_id
): $(native_packages
) $(packages
)
117 $(AT
)echo copying packages
: $^
119 $(AT
)cd
$(@D
); $(foreach package
,$^
, tar xf
$($(package
)_cached
); )
122 $(host_prefix
)/share
/config.site
: config.site.in
$(host_prefix
)/.stamp_
$(final_build_id
)
124 $(AT
)sed
-e
's|@HOST@|$(host)|' \
125 -e
's|@CC@|$(toolchain_path)$(host_CC)|' \
126 -e
's|@CXX@|$(toolchain_path)$(host_CXX)|' \
127 -e
's|@AR@|$(toolchain_path)$(host_AR)|' \
128 -e
's|@RANLIB@|$(toolchain_path)$(host_RANLIB)|' \
129 -e
's|@NM@|$(toolchain_path)$(host_NM)|' \
130 -e
's|@STRIP@|$(toolchain_path)$(host_STRIP)|' \
131 -e
's|@build_os@|$(build_os)|' \
132 -e
's|@host_os@|$(host_os)|' \
133 -e
's|@CFLAGS@|$(strip $(host_CFLAGS) $(host_$(release_type)_CFLAGS))|' \
134 -e
's|@CXXFLAGS@|$(strip $(host_CXXFLAGS) $(host_$(release_type)_CXXFLAGS))|' \
135 -e
's|@CPPFLAGS@|$(strip $(host_CPPFLAGS) $(host_$(release_type)_CPPFLAGS))|' \
136 -e
's|@LDFLAGS@|$(strip $(host_LDFLAGS) $(host_$(release_type)_LDFLAGS))|' \
137 -e
's|@no_qt@|$(NO_QT)|' \
138 -e
's|@no_wallet@|$(NO_WALLET)|' \
139 -e
's|@no_upnp@|$(NO_UPNP)|' \
140 -e
's|@debug@|$(DEBUG)|' \
145 define check_or_remove_cached
146 mkdir
-p
$(BASE_CACHE
)/$(host
)/$(package
) && cd
$(BASE_CACHE
)/$(host
)/$(package
); \
147 $(build_SHA256SUM
) -c
$($(package
)_cached_checksum
) >/dev
/null
2>/dev
/null || \
148 ( rm -f
$($(package
)_cached_checksum
); \
149 if
test -f
"$($(package)_cached)"; then echo
"Checksum mismatch for $(package). Forcing rebuild.."; rm -f
$($(package
)_cached_checksum
) $($(package
)_cached
); fi
)
152 define check_or_remove_sources
153 mkdir
-p
$($(package
)_source_dir
); cd
$($(package
)_source_dir
); \
154 test -f
$($(package
)_fetched
) && ( $(build_SHA256SUM
) -c
$($(package
)_fetched
) >/dev
/null
2>/dev
/null || \
155 ( echo
"Checksum missing or mismatched for $(package) source. Forcing re-download."; \
156 rm -f
$($(package
)_all_sources
) $($(1)_fetched
))) || true
160 @
$(foreach package
,$(all_packages
),$(call check_or_remove_cached
,$(package
));)
162 @
$(foreach package
,$(all_packages
),$(call check_or_remove_sources
,$(package
));)
164 $(host_prefix
)/share
/config.site
: check-packages
166 check-packages
: check-sources
168 install: check-packages
$(host_prefix
)/share
/config.site
171 download-one
: check-sources
$(all_sources
)
174 @
$(MAKE
) -s HOST
=x86_64-apple-darwin11 download-one
176 @
$(MAKE
) -s HOST
=x86_64-unknown-linux-gnu download-one
178 @
$(MAKE
) -s HOST
=x86_64-w64-mingw32 download-one
179 download
: download-osx download-linux download-win
181 .PHONY
: install cached download-one download-osx download-linux download-win download check-packages check-sources