merge bitcoin#23998: support OpenBSD in depends

excludes `fix_openbsd_test_lib.patch` as it's already present

```
Preprocessing boost...
patching file boost/test/impl/execution_monitor.ipp
Reversed (or previously applied) patch detected!  Assume -R? [n]
```
This commit is contained in:
Kittywhiskers Van Gogh 2023-06-30 16:00:24 +00:00 committed by PastaPastaPasta
parent df50931ae2
commit 7181c721e2
12 changed files with 58 additions and 8 deletions

View File

@ -72,6 +72,7 @@ full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))
build_os:=$(findstring linux,$(full_build_os)) build_os:=$(findstring linux,$(full_build_os))
build_os+=$(findstring darwin,$(full_build_os)) build_os+=$(findstring darwin,$(full_build_os))
build_os+=$(findstring freebsd,$(full_build_os)) build_os+=$(findstring freebsd,$(full_build_os))
build_os+=$(findstring openbsd,$(full_build_os))
build_os:=$(strip $(build_os)) build_os:=$(strip $(build_os))
ifeq ($(build_os),) ifeq ($(build_os),)
build_os=$(full_build_os) build_os=$(full_build_os)
@ -83,6 +84,7 @@ full_host_os:=$(subst $(host_arch)-$(host_vendor)-,,$(canonical_host))
host_os:=$(findstring linux,$(full_host_os)) host_os:=$(findstring linux,$(full_host_os))
host_os+=$(findstring darwin,$(full_host_os)) host_os+=$(findstring darwin,$(full_host_os))
host_os+=$(findstring freebsd,$(full_host_os)) host_os+=$(findstring freebsd,$(full_host_os))
host_os+=$(findstring openbsd,$(full_host_os))
host_os+=$(findstring mingw32,$(full_host_os)) host_os+=$(findstring mingw32,$(full_host_os))
ifeq (android,$(findstring android,$(full_host_os))) ifeq (android,$(findstring android,$(full_host_os)))
@ -170,7 +172,7 @@ $(host_prefix)/.stamp_$(final_build_id): $(native_packages) $(packages)
mkdir -p $(@D) mkdir -p $(@D)
echo copying packages: $^ echo copying packages: $^
echo to: $(@D) echo to: $(@D)
cd $(@D); $(foreach package,$^, tar xf $($(package)_cached); ) cd $(@D); $(foreach package,$^, $(build_TAR) xf $($(package)_cached); )
touch $@ touch $@
# $PATH is not preserved between ./configure and make by convention. Its # $PATH is not preserved between ./configure and make by convention. Its

View File

@ -84,6 +84,10 @@ For linux S390X cross compilation:
sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu sudo apt-get install g++-s390x-linux-gnu binutils-s390x-linux-gnu
### Install the required dependencies: OpenBSD
pkg_add bash gtar
### Dependency Options ### Dependency Options
The following can be set when running make: `make FOO=bar` The following can be set when running make: `make FOO=bar`

View File

@ -1,6 +1,7 @@
default_build_CC = gcc default_build_CC = gcc
default_build_CXX = g++ default_build_CXX = g++
default_build_AR = ar default_build_AR = ar
default_build_TAR = tar
default_build_RANLIB = ranlib default_build_RANLIB = ranlib
default_build_STRIP = strip default_build_STRIP = strip
default_build_NM = nm default_build_NM = nm
@ -12,7 +13,7 @@ build_$(build_os)_$1 ?= $$(default_build_$1)
build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1) build_$(build_arch)_$(build_os)_$1 ?= $$(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1)
endef endef
$(foreach var,CC CXX AR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var)))) $(foreach var,CC CXX AR TAR RANLIB NM STRIP SHA256SUM DOWNLOAD OTOOL INSTALL_NAME_TOOL,$(eval $(call add_build_tool_func,$(var))))
define add_build_flags_func define add_build_flags_func
build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1) build_$(build_arch)_$(build_os)_$1 += $(build_$(build_os)_$1)
build_$1=$$(build_$(build_arch)_$(build_os)_$1) build_$1=$$(build_$(build_arch)_$(build_os)_$1)

View File

@ -0,0 +1,7 @@
build_openbsd_CC = clang
build_openbsd_CXX = clang++
build_openbsd_SHA256SUM = sha256
build_openbsd_DOWNLOAD = curl --location --fail --connect-timeout $(DOWNLOAD_CONNECT_TIMEOUT) --retry $(DOWNLOAD_RETRIES) -o
build_openbsd_TAR = gtar

View File

@ -86,7 +86,7 @@ $(1)_download_path_fixed=$(subst :,\:,$$($(1)_download_path))
#default commands #default commands
# 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 # 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
$(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash)) $(1)_fetch_cmds ?= $(call fetch_file,$(1),$(subst \:,:,$$($(1)_download_path_fixed)),$$($(1)_download_file),$($(1)_file_name),$($(1)_sha256_hash))
$(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) $(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)
$(1)_preprocess_cmds ?= $(1)_preprocess_cmds ?=
$(1)_build_cmds ?= $(1)_build_cmds ?=
$(1)_config_cmds ?= $(1)_config_cmds ?=
@ -187,7 +187,7 @@ $($(1)_preprocessed): | $($(1)_extracted)
touch $$@ touch $$@
$($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed) $($(1)_configured): | $($(1)_dependencies) $($(1)_preprocessed)
echo Configuring $(1)... echo Configuring $(1)...
rm -rf $(host_prefix); mkdir -p $(host_prefix)/lib; cd $(host_prefix); $(foreach package,$($(1)_all_dependencies), tar --no-same-owner -xf $($(package)_cached); ) 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); )
mkdir -p $$(@D) mkdir -p $$(@D)
+cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1)) +cd $$(@D); $($(1)_config_env) $(call $(1)_config_cmds, $(1))
touch $$@ touch $$@
@ -208,7 +208,7 @@ $($(1)_postprocessed): | $($(1)_staged)
touch $$@ touch $$@
$($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed) $($(1)_cached): | $($(1)_dependencies) $($(1)_postprocessed)
echo Caching $(1)... echo Caching $(1)...
cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | tar --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T - cd $$($(1)_staging_dir)/$(host_prefix); find . | sort | $(build_TAR) --no-recursion -czf $$($(1)_staging_dir)/$$(@F) -T -
mkdir -p $$(@D) mkdir -p $$(@D)
rm -rf $$(@D) && mkdir -p $$(@D) rm -rf $$(@D) && mkdir -p $$(@D)
mv $$($(1)_staging_dir)/$$(@F) $$(@) mv $$($(1)_staging_dir)/$$(@F) $$(@)

31
depends/hosts/openbsd.mk Normal file
View File

@ -0,0 +1,31 @@
openbsd_CFLAGS=-pipe
openbsd_CFLAGS_CXXFLAGS=$(openbsd_CFLAGS)
openbsd_CFLAGS_release_CFLAGS=-O2
openbsd_CFLAGS_release_CXXFLAGS=$(openbsd_release_CFLAGS)
openbsd_CFLAGS_debug_CFLAGS=-O1
openbsd_CFLAGS_debug_CXXFLAGS=$(openbsd_debug_CFLAGS)
ifeq (86,$(findstring 86,$(build_arch)))
i686_openbsd_CC=clang -m32
i686_openbsd_CXX=clang++ -m32
i686_openbsd_AR=ar
i686_openbsd_RANLIB=ranlib
i686_openbsd_NM=nm
i686_openbsd_STRIP=strip
x86_64_openbsd_CC=clang -m64
x86_64_openbsd_CXX=clang++ -m64
x86_64_openbsd_AR=ar
x86_64_openbsd_RANLIB=ranlib
x86_64_openbsd_NM=nm
x86_64_openbsd_STRIP=strip
else
i686_openbsd_CC=$(default_host_CC) -m32
i686_openbsd_CXX=$(default_host_CXX) -m32
x86_64_openbsd_CC=$(default_host_CC) -m64
x86_64_openbsd_CXX=$(default_host_CXX) -m64
endif
openbsd_cmake_system=OpenBSD

View File

@ -11,6 +11,7 @@ $(package)_config_opts=--disable-shared --enable-cxx --disable-replication --ena
$(package)_config_opts_mingw32=--enable-mingw $(package)_config_opts_mingw32=--enable-mingw
$(package)_config_opts_linux=--with-pic $(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic $(package)_config_opts_freebsd=--with-pic
$(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic $(package)_config_opts_android=--with-pic
$(package)_cflags+=-Wno-error=implicit-function-declaration $(package)_cflags+=-Wno-error=implicit-function-declaration
$(package)_cxxflags=-std=c++17 $(package)_cxxflags=-std=c++17

View File

@ -30,6 +30,7 @@ $(package)_config_libraries=filesystem,thread,test
$(package)_cxxflags=-std=c++17 -fvisibility=hidden $(package)_cxxflags=-std=c++17 -fvisibility=hidden
$(package)_cxxflags_linux=-fPIC $(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_freebsd=-fPIC $(package)_cxxflags_freebsd=-fPIC
$(package)_cxxflags_openbsd=-fPIC
$(package)_cxxflags_android=-fPIC $(package)_cxxflags_android=-fPIC
$(package)_cxxflags_x86_64=-fcf-protection=full $(package)_cxxflags_x86_64=-fcf-protection=full
endef endef

View File

@ -13,6 +13,7 @@ define $(package)_set_vars
$(package)_config_opts_release=--disable-debug-mode $(package)_config_opts_release=--disable-debug-mode
$(package)_config_opts_linux=--with-pic $(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic $(package)_config_opts_freebsd=--with-pic
$(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic $(package)_config_opts_android=--with-pic
$(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601 $(package)_cppflags_mingw32=-D_WIN32_WINNT=0x0601
endef endef

View File

@ -208,11 +208,11 @@ define $(package)_extract_cmds
echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \ echo "$($(package)_qttools_sha256_hash) $($(package)_source_dir)/$($(package)_qttools_file_name)" >> $($(package)_extract_dir)/.$($(package)_file_name).hash && \
$(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \ $(build_SHA256SUM) -c $($(package)_extract_dir)/.$($(package)_file_name).hash && \
mkdir qtbase && \ mkdir qtbase && \
tar --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source) -C qtbase && \
mkdir qttranslations && \ mkdir qttranslations && \
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \ $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttranslations_file_name) -C qttranslations && \
mkdir qttools && \ mkdir qttools && \
tar --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools $(build_TAR) --no-same-owner --strip-components=1 -xf $($(package)_source_dir)/$($(package)_qttools_file_name) -C qttools
endef endef
# Preprocessing steps work as follows: # Preprocessing steps work as follows:

View File

@ -8,6 +8,7 @@ define $(package)_set_vars
$(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking $(package)_config_opts=--disable-shared --disable-readline --disable-dynamic-extensions --enable-option-checking
$(package)_config_opts_linux=--with-pic $(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic $(package)_config_opts_freebsd=--with-pic
$(package)_config_opts_openbsd=--with-pic
endef endef
define $(package)_preprocess_cmds define $(package)_preprocess_cmds

View File

@ -11,6 +11,7 @@ define $(package)_set_vars
$(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking $(package)_config_opts += --disable-Werror --disable-drafts --enable-option-checking
$(package)_config_opts_linux=--with-pic $(package)_config_opts_linux=--with-pic
$(package)_config_opts_freebsd=--with-pic $(package)_config_opts_freebsd=--with-pic
$(package)_config_opts_openbsd=--with-pic
$(package)_config_opts_android=--with-pic $(package)_config_opts_android=--with-pic
$(package)_cxxflags=-std=c++17 $(package)_cxxflags=-std=c++17
endef endef