Skip to content

Commit

Permalink
Merge bitcoin#30584: depends: Make default host and build comparable
Browse files Browse the repository at this point in the history
b28917b depends: Make default `host` and `build` comparable (Hennadii Stepanov)

Pull request description:

  To detect cross-compiling, the host and build platforms are compared. The `build` variable is always an output of `config.sub`, but the `host` is not. This can lead to false results. For example, on OpenBSD:
   - host=amd64-unknown-openbsd7.5
   - build=x86_64-unknown-openbsd7.5

  This PR sets the default value of the `host` variable to the value of `build`, ensuring cross-compiling won't be triggered when the `HOST` variable is not set.

  This PR fixes needless triggering of cross-compiling for CMake-built packages in depends on OpenBSD due to this code:https://github.com/bitcoin/bitcoin/blob/eb85cacd2969caaea682104f498f6b2e6cfb80f8/depends/funcs.mk#L193-L197

  No changes in Guix build.

ACKs for top commit:
  laanwj:
    Concept and code review ACK b28917b
  theuni:
    utACK b28917b.

Tree-SHA512: 8c5835cb8b739355b71f7cb161b350ad8b038a00e6b1def36354ba228cea3dcb9883df3c9a8e79d7d0143241f6f054129fe90772b1b2579702db51237f9d66ff
  • Loading branch information
fanquake committed Feb 12, 2025
2 parents 0b6ed34 + b28917b commit 42251e0
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ C_STANDARD ?= c11
CXX_STANDARD ?= c++20

BUILD = $(shell ./config.guess)
HOST ?= $(BUILD)
PATCHES_PATH = $(BASEDIR)/patches
BASEDIR = $(CURDIR)
HASH_LENGTH:=11
Expand All @@ -59,11 +58,6 @@ DOWNLOAD_RETRIES:=3
HOST_ID_SALT ?= salt
BUILD_ID_SALT ?= salt

host:=$(BUILD)
ifneq ($(HOST),)
host:=$(HOST)
endif

ifneq ($(DEBUG),)
release_type=debug
else
Expand All @@ -73,9 +67,15 @@ endif
base_build_dir=$(WORK_PATH)/build
base_staging_dir=$(WORK_PATH)/staging
base_download_dir=$(WORK_PATH)/download
canonical_host:=$(shell ./config.sub $(HOST))
build:=$(shell ./config.sub $(BUILD))

host:=$(build)
ifneq ($(HOST),)
host:=$(HOST)
endif
HOST ?= $(BUILD)
canonical_host:=$(shell ./config.sub $(HOST))

build_arch =$(firstword $(subst -, ,$(build)))
build_vendor=$(word 2,$(subst -, ,$(build)))
full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))
Expand Down

0 comments on commit 42251e0

Please sign in to comment.