Skip to content

Commit

Permalink
depends: Make default host and build comparable
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hebasto committed Aug 4, 2024
1 parent eb85cac commit edb8e0d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions depends/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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))
Expand Down

0 comments on commit edb8e0d

Please sign in to comment.