Skip to content

Commit

Permalink
depends: add C_STANDARD and CXX_STANDARD
Browse files Browse the repository at this point in the history
See bitcoin/bitcoin#22380. GNU flavor is used for the C standard as
OpenSSL have troubles building without it.
  • Loading branch information
div72 committed Sep 23, 2024
1 parent f726a99 commit a7fa64f
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 9 deletions.
3 changes: 3 additions & 0 deletions depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ NO_WALLET ?=
NO_UPNP ?=
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources

C_STANDARD ?= gnu11
CXX_STANDARD ?= c++17

BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches
Expand Down
2 changes: 2 additions & 0 deletions depends/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ The following can be set when running make: make FOO=bar
BASE_CACHE: built packages will be placed here
SDK_PATH: Path where sdk's can be found (used by macOS)
FALLBACK_DOWNLOAD_PATH: If a source file can't be fetched, try here before giving up
C_STANDARD: Set the C standard version used. Defaults to `c11`.
CXX_STANDARD: Set the C++ standard version used. Defaults to `c++17`.
NO_QT: Don't download/build/cache qt and its dependencies
NO_WALLET: Don't download/build/cache libs needed to enable the wallet
NO_UPNP: Don't download/build/cache packages needed for enabling upnp
Expand Down
4 changes: 2 additions & 2 deletions depends/hosts/darwin.mk
Original file line number Diff line number Diff line change
Expand Up @@ -115,8 +115,8 @@ darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
-Xclang -internal-externc-isystem$(clang_resource_dir)/include \
-Xclang -internal-externc-isystem$(OSX_SDK)/usr/include

darwin_CFLAGS=-pipe
darwin_CXXFLAGS=$(darwin_CFLAGS)
darwin_CFLAGS=-pipe -std=$(C_STANDARD)
darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD)

darwin_release_CFLAGS=-O2
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions depends/hosts/linux.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
linux_CFLAGS=-pipe
linux_CXXFLAGS=$(linux_CFLAGS)
linux_CFLAGS=-pipe -std=$(C_STANDARD)
linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD)

linux_release_CFLAGS=-O2
linux_release_CXXFLAGS=$(linux_release_CFLAGS)
Expand Down
4 changes: 2 additions & 2 deletions depends/hosts/mingw32.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
mingw32_CXX := $(host)-g++-posix
endif

mingw32_CFLAGS=-pipe
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD)

mingw32_release_CFLAGS=-O2
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/boost.mk
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ ifneq (,$(findstring clang,$($(package)_cxx)))
endif
$(package)_archiver_$(host_os)=$($(package)_ar)
$(package)_config_libraries=filesystem,system,thread,test,iostreams
$(package)_cxxflags+=-std=c++17 -DBOOST_NO_CXX98_FUNCTION_BASE
$(package)_cxxflags+=-DBOOST_NO_CXX98_FUNCTION_BASE
$(package)_cxxflags_linux=-fPIC
$(package)_cxxflags_android=-fPIC
endef
Expand Down
3 changes: 2 additions & 1 deletion depends/packages/openssl.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ $(package)_file_name=OpenSSL_$(subst .,_,$($(package)_version)).tar.gz
$(package)_sha256_hash=dac036669576e83e8523afdb3971582f8b5d33993a2d6a5af87daa035f529b4f

define $(package)_set_vars
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc)"
# OpenSSL relies on the asm keyword but that fails when it's not compiled with GNU extensions.
$(package)_config_env=AR="$($(package)_ar)" RANLIB="$($(package)_ranlib)" CC="$($(package)_cc) -Dasm=__asm__"
$(package)_config_opts=--prefix=$(host_prefix) --openssldir=$(host_prefix)/etc/openssl
$(package)_config_opts+=no-camellia
$(package)_config_opts+=no-capieng
Expand Down
2 changes: 1 addition & 1 deletion depends/packages/qt.mk
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ $(package)_config_opts_release += -silent
$(package)_config_opts_debug = -debug
$(package)_config_opts_debug += -optimized-tools
$(package)_config_opts += -bindir $(build_prefix)/bin
$(package)_config_opts += -c++std c++17
$(package)_config_opts += -c++std
$(package)_config_opts += -confirm-license
$(package)_config_opts += -hostprefix $(build_prefix)
$(package)_config_opts += -no-compile-examples
Expand Down

0 comments on commit a7fa64f

Please sign in to comment.