mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-22 21:50:14 +01:00
Merge bitcoin/bitcoin#22380: build: add and use C_STANDARD and CXX_STANDARD in depends
f7595f1354build: add and use CXX_STANDARD in depends (fanquake)7e7b3e42fabuild: add and use C_STANDARD in depends (fanquake) Pull request description: By explicitly setting a C standard version we avoid any potential for issues/differences in libraries that may come about due to C STD version, as well as avoid potentially being opted into newer code / features in libraries when compiler defaults change (i.e as of 11.0.0, Clang now defaults to gnu17 over gnu11). This should be a no-op for our release builds, because it's just explicitly setting the default that is [already being used](https://github.com/fanquake/core-review/blob/master/compiler-defaults.md). However this is relevant for anyone building depends with a newer compiler. I found [one broken `__STDC_VERSION__` check in the](https://github.com/miniupnp/miniupnp/pull/552) miniupnpc header. At the same time, add `CXX_STANDARD` for setting our C++ standard, and use that over setting `-std=c++17` for cxx packages. Guix builds: ```bash ``` ACKs for top commit: dongcarl: Code Review ACKf7595f1354laanwj: Code review ACKf7595f1354Tree-SHA512: 9255190d91ba3de20762b1d6af35c59d64f3d77a52bbe9a3f1dfb6bcf16daef66054ebef96b58e7285cd01bf613e69a78bd5e8681c21293e254f23d1fa7b0f71
This commit is contained in:
@@ -45,6 +45,9 @@ MULTIPROCESS ?=
|
||||
LTO ?=
|
||||
FALLBACK_DOWNLOAD_PATH ?= https://bitcoincore.org/depends-sources
|
||||
|
||||
C_STANDARD ?= c11
|
||||
CXX_STANDARD ?= c++17
|
||||
|
||||
BUILD = $(shell ./config.guess)
|
||||
HOST ?= $(BUILD)
|
||||
PATCHES_PATH = $(BASEDIR)/patches
|
||||
|
||||
@@ -96,6 +96,8 @@ The following can be set when running make: `make FOO=bar`
|
||||
- `BASE_CACHE`: Built packages will be placed here
|
||||
- `SDK_PATH`: Path where SDKs 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_QR`: Don't download/build/cache packages needed for enabling qrencode
|
||||
- `NO_ZMQ`: Don't download/build/cache packages needed for enabling ZeroMQ
|
||||
|
||||
@@ -6,6 +6,9 @@ android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++
|
||||
android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang
|
||||
endif
|
||||
|
||||
android_CFLAGS=-std=$(C_STANDARD)
|
||||
android_CXXFLAGS=-std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
android_CFLAGS += -flto
|
||||
android_LDFLAGS += -flto
|
||||
|
||||
@@ -109,15 +109,15 @@ 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_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
darwin_CFLAGS += -flto
|
||||
darwin_CXXFLAGS += -flto
|
||||
darwin_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
darwin_CXXFLAGS=$(darwin_CFLAGS)
|
||||
|
||||
darwin_release_CFLAGS=-O2
|
||||
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
freebsd_CFLAGS=-pipe
|
||||
freebsd_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
freebsd_CFLAGS += -flto
|
||||
freebsd_CXXFLAGS += -flto
|
||||
freebsd_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
freebsd_CXXFLAGS=$(freebsd_CFLAGS)
|
||||
|
||||
freebsd_release_CFLAGS=-O2
|
||||
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
linux_CFLAGS=-pipe
|
||||
linux_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
linux_CFLAGS += -flto
|
||||
linux_CXXFLAGS += -flto
|
||||
linux_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
linux_CXXFLAGS=$(linux_CFLAGS)
|
||||
|
||||
linux_release_CFLAGS=-O2
|
||||
linux_release_CXXFLAGS=$(linux_release_CFLAGS)
|
||||
|
||||
|
||||
@@ -2,15 +2,15 @@ ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
|
||||
mingw32_CXX := $(host)-g++-posix
|
||||
endif
|
||||
|
||||
mingw32_CFLAGS=-pipe
|
||||
mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
mingw32_CFLAGS += -flto
|
||||
mingw32_CXXFLAGS += -flto
|
||||
mingw32_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
mingw32_CXXFLAGS=$(mingw32_CFLAGS)
|
||||
|
||||
mingw32_release_CFLAGS=-O2
|
||||
mingw32_release_CXXFLAGS=$(mingw32_release_CFLAGS)
|
||||
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
netbsd_CFLAGS=-pipe
|
||||
netbsd_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
netbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
netbsd_CFLAGS += -flto
|
||||
netbsd_CXXFLAGS += -flto
|
||||
netbsd_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
openbsd_CFLAGS=-pipe
|
||||
openbsd_CXXFLAGS=$(openbsd_CFLAGS)
|
||||
openbsd_CFLAGS=-pipe -std=$(C_STANDARD)
|
||||
openbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
|
||||
|
||||
ifneq ($(LTO),)
|
||||
openbsd_CFLAGS += -flto
|
||||
openbsd_CXXFLAGS += -flto
|
||||
openbsd_LDFLAGS += -flto
|
||||
endif
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@ $(package)_config_opts_netbsd=--with-pic
|
||||
$(package)_config_opts_openbsd=--with-pic
|
||||
$(package)_config_opts_android=--with-pic
|
||||
$(package)_cflags+=-Wno-error=implicit-function-declaration
|
||||
$(package)_cxxflags+=-std=c++17
|
||||
$(package)_cppflags_mingw32=-DUNICODE -D_UNICODE
|
||||
endef
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ define $(package)_set_vars
|
||||
$(package)_config_opts_netbsd=--with-pic
|
||||
$(package)_config_opts_openbsd=--with-pic
|
||||
$(package)_config_opts_android=--with-pic
|
||||
$(package)_cxxflags+=-std=c++17
|
||||
endef
|
||||
|
||||
define $(package)_preprocess_cmds
|
||||
|
||||
@@ -15,7 +15,7 @@ QMAKE_MAC_SDK.macosx.SDKVersion = $${MAC_SDK_VERSION}
|
||||
QMAKE_MAC_SDK.macosx.PlatformPath = /phony
|
||||
!host_build: QMAKE_CFLAGS += -target $${MAC_TARGET}
|
||||
!host_build: QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_CFLAGS
|
||||
!host_build: QMAKE_CXXFLAGS += $$QMAKE_CFLAGS
|
||||
!host_build: QMAKE_CXXFLAGS += -target $${MAC_TARGET}
|
||||
!host_build: QMAKE_LFLAGS += -target $${MAC_TARGET}
|
||||
QMAKE_AR = $${CROSS_COMPILE}ar cq
|
||||
QMAKE_RANLIB=$${CROSS_COMPILE}ranlib
|
||||
|
||||
Reference in New Issue
Block a user