Skip to content

Commit b28917b

Browse files
committed
depends: Make default host and build comparable
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 change 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.
1 parent 99e041f commit b28917b

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

depends/Makefile

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ C_STANDARD ?= c11
5151
CXX_STANDARD ?= c++20
5252

5353
BUILD = $(shell ./config.guess)
54-
HOST ?= $(BUILD)
5554
PATCHES_PATH = $(BASEDIR)/patches
5655
BASEDIR = $(CURDIR)
5756
HASH_LENGTH:=11
@@ -60,11 +59,6 @@ DOWNLOAD_RETRIES:=3
6059
HOST_ID_SALT ?= salt
6160
BUILD_ID_SALT ?= salt
6261

63-
host:=$(BUILD)
64-
ifneq ($(HOST),)
65-
host:=$(HOST)
66-
endif
67-
6862
ifneq ($(DEBUG),)
6963
release_type=debug
7064
else
@@ -74,9 +68,15 @@ endif
7468
base_build_dir=$(WORK_PATH)/build
7569
base_staging_dir=$(WORK_PATH)/staging
7670
base_download_dir=$(WORK_PATH)/download
77-
canonical_host:=$(shell ./config.sub $(HOST))
7871
build:=$(shell ./config.sub $(BUILD))
7972

73+
host:=$(build)
74+
ifneq ($(HOST),)
75+
host:=$(HOST)
76+
endif
77+
HOST ?= $(BUILD)
78+
canonical_host:=$(shell ./config.sub $(HOST))
79+
8080
build_arch =$(firstword $(subst -, ,$(build)))
8181
build_vendor=$(word 2,$(subst -, ,$(build)))
8282
full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))

0 commit comments

Comments
 (0)