From edb8e0daea8789815ecd581ef5bc66e6b11a01f8 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 4 Aug 2024 23:08:26 +0100 Subject: [PATCH] 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. --- depends/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/depends/Makefile b/depends/Makefile index 52a9a14e56a15..190f2fee5bdb8 100644 --- a/depends/Makefile +++ b/depends/Makefile @@ -61,11 +61,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 @@ -78,6 +73,11 @@ base_download_dir=$(WORK_PATH)/download canonical_host:=$(shell ./config.sub $(HOST)) build:=$(shell ./config.sub $(BUILD)) +host:=$(build) +ifneq ($(HOST),) +host:=$(HOST) +endif + build_arch =$(firstword $(subst -, ,$(build))) build_vendor=$(word 2,$(subst -, ,$(build))) full_build_os:=$(subst $(build_arch)-$(build_vendor)-,,$(build))