Skip to content

Commit 3bb9394

Browse files
committed
Merge bitcoin#23998: build: support OpenBSD in depends
471d155 build: add support for OpenBSD to depends (fanquake) 75ae39e build: add a default build tar in depends (fanquake) Pull request description: Completes the BSD trifecta. No Qt. Includes a commit that adds a default build_TAR to depends, to make it easier to override and use gnu/gtar, as OpenBSDs tar does not support some of the options we use. Also includes this patch, boostorg/test@684f067, to fix a compilation issue in Boost test. Have tested on OpenBSD 7.0 with: ```bash gmake -C depends -j9 ./autogen.sh CONFIG_SITE=/home/vagrant/bitcoin/depends/amd64-unknown-openbsd7.0/share/config.site ./configure --disable-external-signer MAKE=gmake gmake check -j9 ``` ACKs for top commit: laanwj: Tested ACK 471d155 theStack: Tested ACK 471d155 Tree-SHA512: 7009b5d4c84355ebe4ece7042e0ce131659b97eace611fb77f1f16901aafb4b28118961a608a245289772ef7c4acb606dc18357a82c91cdceaf6466fc1cfd242
2 parents 2d7ea20 + 471d155 commit 3bb9394

File tree

13 files changed

+98
-8
lines changed

13 files changed

+98
-8
lines changed

depends/Makefile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))
7777
build_os:=$(findstring linux,$(full_build_os))
7878
build_os+=$(findstring darwin,$(full_build_os))
7979
build_os+=$(findstring freebsd,$(full_build_os))
80+
build_os+=$(findstring openbsd,$(full_build_os))
8081
build_os:=$(strip $(build_os))
8182
ifeq ($(build_os),)
8283
build_os=$(full_build_os)
@@ -88,6 +89,7 @@ full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
8889
host_os:=$(findstring linux,$(full_host_os))
8990
host_os+=$(findstring darwin,$(full_host_os))
9091
host_os+=$(findstring freebsd,$(full_host_os))
92+
host_os+=$(findstring openbsd,$(full_host_os))
9193
host_os+=$(findstring mingw32,$(full_host_os))
9294

9395
ifeq (android,$(findstring android,$(full_host_os)))
@@ -182,7 +184,7 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
182184
mkdir -p $(@D)
183185
echo copying packages: $^
184186
echo to: $(@D)
185-
cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); )
187+
cd $(@D); $(foreach package,$^, $(build_TAR) xf $($(package)_cached); )
186188
touch $@
187189

188190
# $PATH is not preserved between ./configure and make by convention. Its

depends/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ For linux S390X cross compilation:
8484

8585
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
8686

87+
### Install the required dependencies: OpenBSD
88+
89+
pkg_add bash gtar
90+
8791
### Dependency Options
8892

8993
The following can be set when running make: `make FOO=bar`

depends/builders/default.mk

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
default_build_CC = gcc
22
default_build_CXX = g++
33
default_build_AR = ar
4+
default_build_TAR = tar
45
default_build_RANLIB = ranlib
56
default_build_STRIP = strip
67
default_build_NM = nm
@@ -12,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1)
1213
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
1314
build_$1=$$(build_$(build_arch)_$(build_os)_$1)
1415
endef
15-
$(foreach var,CC CXX AR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
16+
$(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
1617
define add_build_flags_func
1718
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
1819
build_$1=$$(build_$(build_arch)_$(build_os)_$1)

depends/builders/openbsd.mk

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
build_openbsd_CC = clang
2+
build_openbsd_CXX = clang++
3+
4+
build_openbsd_SHA256SUM = sha256
5+
build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
6+
7+
build_openbsd_TAR = gtar

depends/funcs.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
8484
#default commands
8585
# The default behavior for tar will try to set ownership when running as uid 0 and may not succeed, --no-same-owner disables this behavior
8686
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
87-
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && tar --no-same-owner --strip-components=1 -xf $$($(1)_source)
87+
$(1)_extract_cmds ?= mkdir -p $$($(1)_extract_dir) && echo "$$($(1)_sha256_hash) $$($(1)_source)" > $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_SHA256SUM) -c $$($(1)_extract_dir)/.$$($(1)_file_name).hash && $(build_TAR) --no-same-owner --strip-components=1 -xf $$($(1)_source)
8888
$(1)_preprocess_cmds ?=
8989
$(1)_build_cmds ?=
9090
$(1)_config_cmds ?=
@@ -207,7 +207,7 @@ $($(1)_preprocessed): | $($(1)_extracted)
207207
touch $$@
208208
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
209209
echo Configuring $(1)...
210-
rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); )
210+
rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), $(build_TAR) --no-same-owner -xf $($(package)_cached); )
211211
mkdir -p $$(@D)
212212
+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
213213
touch $$@
@@ -228,7 +228,7 @@ $($(1)_postprocessed): | $($(1)_staged)
228228
touch $$@
229229
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
230230
echo Caching $(1)...
231-
cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | tar --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
231+
cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | $(build_TAR) --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
232232
mkdir -p $$(@D)
233233
rm -rf $$(@D) && mkdir -p $$(@D)
234234
mv $$($(1)_staging_dir)/$$(@F) $$(@)

depends/hosts/openbsd.mk

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
openbsd_CFLAGS=-pipe
2+
openbsd_CFLAGS_CXXFLAGS=$(openbsd_CFLAGS)
3+
4+
openbsd_CFLAGS_release_CFLAGS=-O2
5+
openbsd_CFLAGS_release_CXXFLAGS=$(openbsd_release_CFLAGS)
6+
7+
openbsd_CFLAGS_debug_CFLAGS=-O1
8+
openbsd_CFLAGS_debug_CXXFLAGS=$(openbsd_debug_CFLAGS)
9+
10+
ifeq (86,$(findstring 86,$(build_arch)))
11+
i686_openbsd_CC=clang -m32
12+
i686_openbsd_CXX=clang++ -m32
13+
i686_openbsd_AR=ar
14+
i686_openbsd_RANLIB=ranlib
15+
i686_openbsd_NM=nm
16+
i686_openbsd_STRIP=strip
17+
18+
x86_64_openbsd_CC=clang -m64
19+
x86_64_openbsd_CXX=clang++ -m64
20+
x86_64_openbsd_AR=ar
21+
x86_64_openbsd_RANLIB=ranlib
22+
x86_64_openbsd_NM=nm
23+
x86_64_openbsd_STRIP=strip
24+
else
25+
i686_openbsd_CC=$(default_host_CC) -m32
26+
i686_openbsd_CXX=$(default_host_CXX) -m32
27+
x86_64_openbsd_CC=$(default_host_CC) -m64
28+
x86_64_openbsd_CXX=$(default_host_CXX) -m64
29+
endif
30+
31+
openbsd_cmake_system=OpenBSD

depends/packages/bdb.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
1111
$(package)_config_opts_mingw32=--enable-mingw
1212
$(package)_config_opts_linux=--with-pic
1313
$(package)_config_opts_freebsd=--with-pic
14+
$(package)_config_opts_openbsd=--with-pic
1415
$(package)_config_opts_android=--with-pic
1516
$(package)_cflags+=-Wno-error=implicit-function-declaration
1617
$(package)_cxxflags+=-std=c++17

depends/packages/boost.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ $(package)_download_path=https://boostorg.jfrog.io/artifactory/main/release/$(su
44
$(package)_file_name=boost_$($(package)_version).tar.bz2
55
$(package)_sha256_hash=d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee
66
$(package)_dependencies=native_b2
7+
$(package)_patches=fix_openbsd_test_lib.patch
78

89
define $(package)_set_vars
910
$(package)_config_opts_release=variant=release
@@ -26,11 +27,13 @@ $(package)_config_libraries=test
2627
$(package)_cxxflags+=-std=c++17
2728
$(package)_cxxflags_linux=-fPIC
2829
$(package)_cxxflags_freebsd=-fPIC
30+
$(package)_cxxflags_openbsd=-fPIC
2931
$(package)_cxxflags_android=-fPIC
3032
$(package)_cxxflags_x86_64=-fcf-protection=full
3133
endef
3234

3335
define $(package)_preprocess_cmds
36+
patch -p1 < $($(package)_patch_dir)/fix_openbsd_test_lib.patch && \
3437
echo "using $($(package)_toolset_$(host_os)) : : $($(package)_cxx) : <cflags>\"$($(package)_cflags)\" <cxxflags>\"$($(package)_cxxflags)\" <compileflags>\"$($(package)_cppflags)\" <linkflags>\"$($(package)_ldflags)\" <archiver>\"$($(package)_ar)\" <striper>\"$(host_STRIP)\" <ranlib>\"$(host_RANLIB)\" <rc>\"$(host_WINDRES)\" : ;" > user-config.jam
3538
endef
3639

depends/packages/libevent.mk

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ define $(package)_set_vars
1313
$(package)_config_opts_release=--disable-debug-mode
1414
$(package)_config_opts_linux=--with-pic
1515
$(package)_config_opts_freebsd=--with-pic
16+
$(package)_config_opts_openbsd=--with-pic
1617
$(package)_config_opts_android=--with-pic
1718
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
1819
endef

depends/packages/qt.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -201,11 +201,11 @@ define $(package)_extract_cmds
201201
echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
202202
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
203203
mkdir qtbase && \
204-
tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
204+
$(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
205205
mkdir qttranslations && \
206-
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
206+
$(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
207207
mkdir qttools && \
208-
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
208+
$(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
209209
endef
210210

211211
# Preprocessing steps work as follows:

0 commit comments

Comments
 (0)