Merge bitcoin/bitcoin#32584: depends: hard-code necessary c(xx)flags rather than setting them per-host

9954d6c833 depends: hard-code necessary c(xx)flags rather than setting them per-host (Cory Fields)

Pull request description:

  The per-host flag variables hold platform-specific defaults that are ignored when flag environment variables are set, so it was wrong for them to contain -std options relied on by package definitions.

  Additionally, these flags (-pipe and -std=xx) will no longer be passed into the CMake build, meaning less duplication in the build summary.

  Pulled out of #31920.

ACKs for top commit:
  achow101:
    ACK 9954d6c833
  ryanofsky:
    Code review ACK 9954d6c833. No changes since last review other than improving the commit message. Change overall makes sense because it deduplicates host definitions, stops dropping `-std` flags from package builds when custom CFLAGS/CXXFLAGS environment variables are set, and stops passing duplicate flags to cmake that have no effect.
  theuni:
    ACK 9954d6c833

Tree-SHA512: 62a2a21b741893cf708ca71fb5f0626c30d52685c845f9016f428a5e38fc8515acd4bf2c83635d6505b63830d1c296472026ec3d341c8069f1e490a991b6b5ef
This commit is contained in:
Ava Chow
2025-07-30 13:56:14 -07:00
7 changed files with 16 additions and 14 deletions

View File

@@ -8,9 +8,11 @@ $(1)_ar=$$($$($(1)_type)_AR)
$(1)_ranlib=$$($$($(1)_type)_RANLIB)
$(1)_nm=$$($$($(1)_type)_NM)
$(1)_cflags=$$($$($(1)_type)_CFLAGS) \
$$($$($(1)_type)_$$(release_type)_CFLAGS)
$$($$($(1)_type)_$$(release_type)_CFLAGS) \
-pipe -std=$(C_STANDARD)
$(1)_cxxflags=$$($$($(1)_type)_CXXFLAGS) \
$$($$($(1)_type)_$$(release_type)_CXXFLAGS)
$$($$($(1)_type)_$$(release_type)_CXXFLAGS) \
-pipe -std=$(CXX_STANDARD)
$(1)_ldflags=$$($$($(1)_type)_LDFLAGS) \
$$($$($(1)_type)_$$(release_type)_LDFLAGS) \
-L$$($($(1)_type)_prefix)/lib

View File

@@ -60,8 +60,8 @@ darwin_CXX=$(clangxx_prog) --target=$(host) \
-iwithsysroot/usr/include/c++/v1 \
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
darwin_CFLAGS=-pipe -std=$(C_STANDARD) -mmacos-version-min=$(OSX_MIN_VERSION)
darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD) -mmacos-version-min=$(OSX_MIN_VERSION)
darwin_CFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION)
darwin_CXXFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION)
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
ifneq ($(build_os),darwin)

View File

@@ -1,5 +1,5 @@
freebsd_CFLAGS=-pipe -std=$(C_STANDARD)
freebsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
freebsd_CFLAGS=
freebsd_CXXFLAGS=
freebsd_release_CFLAGS=-O2
freebsd_release_CXXFLAGS=$(freebsd_release_CFLAGS)

View File

@@ -1,5 +1,5 @@
linux_CFLAGS=-pipe -std=$(C_STANDARD)
linux_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
linux_CFLAGS=
linux_CXXFLAGS=
ifneq ($(LTO),)
linux_AR = $(host_toolchain)gcc-ar

View File

@@ -5,8 +5,8 @@ ifneq ($(shell $(SHELL) $(.SHELLFLAGS) "command -v $(host)-g++-posix"),)
mingw32_CXX := $(host)-g++-posix
endif
mingw32_CFLAGS=-pipe -std=$(C_STANDARD)
mingw32_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
mingw32_CFLAGS=
mingw32_CXXFLAGS=
ifneq ($(LTO),)
mingw32_AR = $(host_toolchain)gcc-ar

View File

@@ -1,5 +1,5 @@
netbsd_CFLAGS=-pipe -std=$(C_STANDARD)
netbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
netbsd_CFLAGS=
netbsd_CXXFLAGS=
ifneq ($(LTO),)
netbsd_AR = $(host_toolchain)gcc-ar

View File

@@ -1,5 +1,5 @@
openbsd_CFLAGS=-pipe -std=$(C_STANDARD)
openbsd_CXXFLAGS=-pipe -std=$(CXX_STANDARD)
openbsd_CFLAGS=
openbsd_CXXFLAGS=
openbsd_release_CFLAGS=-O2
openbsd_release_CXXFLAGS=$(openbsd_release_CFLAGS)