Skip to content

Commit 90b6403

Browse files
author
cevap
committed
Ion Core depends folder
1 parent af8bd30 commit 90b6403

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+5683
-0
lines changed

.gitignore

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
SDKs/
2+
work/
3+
built/
4+
sources/
5+
config.site
6+
x86_64*
7+
i686*
8+
mips*
9+
arm*
10+
aarch64*
11+
riscv32*
12+
riscv64*
13+
s390x*
14+
i386*
15+
powerpc*
16+
alpha*
17+
m68k*
18+
sparc64*
19+
hppa*
20+
sh4*

Makefile

Lines changed: 188 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,188 @@
1+
.NOTPARALLEL :
2+
3+
SOURCES_PATH ?= $(BASEDIR)/sources
4+
WORK_PATH = $(BASEDIR)/work
5+
BASE_CACHE ?= $(BASEDIR)/built
6+
SDK_PATH ?= $(BASEDIR)/SDKs
7+
NO_QT ?=
8+
NO_WALLET ?=
9+
NO_UPNP ?=
10+
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
11+
12+
BUILD = $(shell ./config.guess)
13+
HOST ?= $(BUILD)
14+
PATCHES_PATH = $(BASEDIR)/patches
15+
BASEDIR = $(CURDIR)
16+
HASH_LENGTH:=11
17+
DOWNLOAD_CONNECT_TIMEOUT:=10
18+
DOWNLOAD_RETRIES:=3
19+
HOST_ID_SALT ?= salt
20+
BUILD_ID_SALT ?= salt
21+
22+
host:=$(BUILD)
23+
ifneq ($(HOST),)
24+
host:=$(HOST)
25+
endif
26+
27+
ifneq ($(DEBUG),)
28+
release_type=debug
29+
else
30+
release_type=release
31+
endif
32+
33+
base_build_dir=$(WORK_PATH)/build
34+
base_staging_dir=$(WORK_PATH)/staging
35+
base_download_dir=$(WORK_PATH)/download
36+
canonical_host:=$(shell ./config.sub $(HOST))
37+
build:=$(shell ./config.sub $(BUILD))
38+
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))
45+
ifeq ($(build_os),)
46+
build_os=$(full_build_os)
47+
endif
48+
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))
56+
ifeq ($(host_os),)
57+
host_os=$(full_host_os)
58+
endif
59+
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
64+
build_host=$(build)
65+
66+
AT_$(V):=
67+
AT_:=@
68+
AT:=$(AT_$(V))
69+
70+
all: install
71+
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
77+
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)
84+
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)
91+
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)
95+
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)
98+
99+
ifneq ($(qt_packages_),)
100+
native_packages += $(qt_native_packages)
101+
endif
102+
103+
all_packages = $(packages) $(native_packages)
104+
105+
meta_depends = Makefile funcs.mk builders/default.mk hosts/default.mk hosts/$(host_os).mk builders/$(build_os).mk
106+
107+
$(host_arch)_$(host_os)_native_toolchain?=$($(host_os)_native_toolchain)
108+
109+
include funcs.mk
110+
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)
115+
$(AT)rm -rf $(@D)
116+
$(AT)mkdir -p $(@D)
117+
$(AT)echo copying packages: $^
118+
$(AT)echo to: $(@D)
119+
$(AT)cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
120+
$(AT)touch $@
121+
122+
$(host_prefix)/share/config.site : config.site.in $(host_prefix)/.stamp_$(final_build_id)
123+
$(AT)@mkdir -p $(@D)
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|@allow_host_packages@|$(ALLOW_HOST_PACKAGES)|' \
138+
-e 's|@no_qt@|$(NO_QT)|' \
139+
-e 's|@no_wallet@|$(NO_WALLET)|' \
140+
-e 's|@no_upnp@|$(NO_UPNP)|' \
141+
-e 's|@debug@|$(DEBUG)|' \
142+
$< > $@
143+
$(AT)touch $@
144+
145+
146+
define check_or_remove_cached
147+
mkdir -p $(BASE_CACHE)/$(host)/$(package) && cd $(BASE_CACHE)/$(host)/$(package); \
148+
$(build_SHA256SUM) -c $($(package)_cached_checksum) >/dev/null 2>/dev/null || \
149+
( rm -f $($(package)_cached_checksum); \
150+
if test -f "$($(package)_cached)"; then echo "Checksum mismatch for $(package). Forcing rebuild.."; rm -f $($(package)_cached_checksum) $($(package)_cached); fi )
151+
endef
152+
153+
define check_or_remove_sources
154+
mkdir -p $($(package)_source_dir); cd $($(package)_source_dir); \
155+
test -f $($(package)_fetched) && ( $(build_SHA256SUM) -c $($(package)_fetched) >/dev/null 2>/dev/null || \
156+
( echo "Checksum missing or mismatched for $(package) source. Forcing re-download."; \
157+
rm -f $($(package)_all_sources) $($(1)_fetched))) || true
158+
endef
159+
160+
check-packages:
161+
@$(foreach package,$(all_packages),$(call check_or_remove_cached,$(package));)
162+
check-sources:
163+
@$(foreach package,$(all_packages),$(call check_or_remove_sources,$(package));)
164+
165+
$(host_prefix)/share/config.site: check-packages
166+
167+
check-packages: check-sources
168+
169+
clean-all: clean
170+
@rm -rf $(SOURCES_PATH) x86_64* i686* mips* arm* aarch64* riscv32* riscv64* s390x* ppc64el* ppc64le* powerpc64le* i386* sparc* m68k* alpha* sh4* hppa*
171+
172+
clean:
173+
@rm -rf $(WORK_PATH) $(BASE_CACHE) $(BUILD)
174+
175+
install: check-packages $(host_prefix)/share/config.site
176+
177+
178+
download-one: check-sources $(all_sources)
179+
180+
download-osx:
181+
@$(MAKE) -s HOST=x86_64-apple-darwin14 download-one
182+
download-linux:
183+
@$(MAKE) -s HOST=x86_64-unknown-linux-gnu download-one
184+
download-win:
185+
@$(MAKE) -s HOST=x86_64-w64-mingw32 download-one
186+
download: download-osx download-linux download-win
187+
188+
.PHONY: install cached clean clean-all download-one download-osx download-linux download-win download check-packages check-sources

README.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
### Usage
2+
3+
To build dependencies for the current arch+OS:
4+
5+
make
6+
7+
To build for another arch/OS:
8+
9+
make HOST=host-platform-triplet
10+
11+
For example:
12+
13+
make HOST=x86_64-w64-mingw32 -j4
14+
15+
A prefix will be generated that's suitable for plugging into Bitcoin's
16+
configure. In the above example, a dir named x86_64-w64-mingw32 will be
17+
created. To use it for Bitcoin:
18+
19+
./configure --prefix=`pwd`/depends/x86_64-w64-mingw32
20+
21+
Common `host-platform-triplets` for cross compilation are:
22+
23+
- `i686-w64-mingw32` for Win32
24+
- `x86_64-w64-mingw32` for Win64
25+
- `x86_64-apple-darwin14` for macOS
26+
- `arm-linux-gnueabihf` for Linux ARM 32 bit
27+
- `aarch64-linux-gnu` for Linux ARM 64 bit
28+
- `riscv32-linux-gnu` for Linux RISC-V 32 bit
29+
- `riscv64-linux-gnu` for Linux RISC-V 64 bit
30+
- `ppc64le-linux-gnu` for Linux PPC64EL 64 bit
31+
- `s390x-linux-gnu` for Linux S390X 64 bit
32+
No other options are needed, the paths are automatically configured.
33+
34+
### Install the required dependencies: Ubuntu & Debian
35+
36+
#### For macOS cross compilation
37+
38+
sudo apt-get install curl librsvg2-bin libtiff-tools bsdmainutils cmake imagemagick libcap-dev libz-dev libbz2-dev python-setuptools
39+
40+
#### For Win32/Win64 cross compilation
41+
42+
- see [build-windows.md](../doc/build-windows.md#cross-compilation-for-ubuntu-and-windows-subsystem-for-linux)
43+
44+
#### For linux (including i386, ARM) cross compilation
45+
46+
Common linux dependencies:
47+
48+
sudo apt-get install make automake cmake curl g++-multilib libtool binutils-gold bsdmainutils pkg-config python3
49+
50+
For linux ARM cross compilation:
51+
52+
sudo apt-get install g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf
53+
54+
For linux AARCH64 cross compilation:
55+
56+
sudo apt-get install g++-aarch64-linux-gnu binutils-aarch64-linux-gnu
57+
58+
For linux RISC-V 64-bit cross compilation (there are no packages for 32-bit):
59+
60+
sudo apt-get install g++-riscv64-linux-gnu binutils-riscv64-linux-gnu
61+
62+
RISC-V known issue: gcc-7.3.0 and gcc-7.3.1 result in a broken `test_ion` executable (see https://github.com/bitcoin/bitcoin/pull/13543),
63+
this is apparently fixed in gcc-8.1.0.
64+
65+
### Dependency Options
66+
The following can be set when running make: make FOO=bar
67+
68+
SOURCES_PATH: downloaded sources will be placed here
69+
BASE_CACHE: built packages will be placed here
70+
SDK_PATH: Path where sdk's can be found (used by macOS)
71+
FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
72+
NO_QT: Don't download/build/cache qt and its dependencies
73+
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
74+
NO_UPNP: Don't download/build/cache packages needed for enabling upnp
75+
DEBUG: disable some optimizations and enable more runtime checking
76+
HOST_ID_SALT: Optional salt to use when generating host package ids
77+
BUILD_ID_SALT: Optional salt to use when generating build package ids
78+
79+
If some packages are not built, for example `make NO_WALLET=1`, the appropriate
80+
options will be passed to bitcoin's configure. In this case, `--disable-wallet`.
81+
82+
### Additional targets
83+
84+
download: run 'make download' to fetch all sources without building them
85+
download-osx: run 'make download-osx' to fetch all sources needed for macOS builds
86+
download-win: run 'make download-win' to fetch all sources needed for win builds
87+
download-linux: run 'make download-linux' to fetch all sources needed for linux builds
88+
89+
### Other documentation
90+
91+
- [description.md](description.md): General description of the depends system
92+
- [packages.md](packages.md): Steps for adding packages
93+

builders/darwin.mk

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
build_darwin_CC: = $(shell xcrun -f clang)
2+
build_darwin_CXX: = $(shell xcrun -f clang++)
3+
build_darwin_AR: = $(shell xcrun -f ar)
4+
build_darwin_RANLIB: = $(shell xcrun -f ranlib)
5+
build_darwin_STRIP: = $(shell xcrun -f strip)
6+
build_darwin_OTOOL: = $(shell xcrun -f otool)
7+
build_darwin_NM: = $(shell xcrun -f nm)
8+
build_darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
9+
build_darwin_SHA256SUM = shasum -a 256
10+
build_darwin_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
11+
12+
#darwin host on darwin builder. overrides darwin host preferences.
13+
darwin_CC=$(shell xcrun -f clang) -mmacosx-version-min=$(OSX_MIN_VERSION)
14+
darwin_CXX:=$(shell xcrun -f clang++) -mmacosx-version-min=$(OSX_MIN_VERSION) -stdlib=libc++
15+
darwin_AR:=$(shell xcrun -f ar)
16+
darwin_RANLIB:=$(shell xcrun -f ranlib)
17+
darwin_STRIP:=$(shell xcrun -f strip)
18+
darwin_LIBTOOL:=$(shell xcrun -f libtool)
19+
darwin_OTOOL:=$(shell xcrun -f otool)
20+
darwin_NM:=$(shell xcrun -f nm)
21+
darwin_INSTALL_NAME_TOOL:=$(shell xcrun -f install_name_tool)
22+
darwin_native_toolchain=

builders/default.mk

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
default_build_CC = gcc
2+
default_build_CXX = g++
3+
default_build_AR = ar
4+
default_build_RANLIB = ranlib
5+
default_build_STRIP = strip
6+
default_build_NM = nm
7+
default_build_OTOOL = otool
8+
default_build_INSTALL_NAME_TOOL = install_name_tool
9+
10+
define add_build_tool_func
11+
build_$(build_os)_$1 ?= $$(default_build_$1)
12+
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
13+
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
14+
endef
15+
$(foreach var,CC CXX AR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
16+
define add_build_flags_func
17+
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
18+
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
19+
endef
20+
$(foreach flags, CFLAGS CXXFLAGS LDFLAGS, $(eval $(call add_build_flags_func,$(flags))))

builders/linux.mk

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
build_linux_SHA256SUM = sha256sum
2+
build_linux_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o

0 commit comments

Comments
 (0)