Fix compilation error on Linux with HOST environment variable set

The Makefile variable "HOST" was introduced to cross-compile Tux Paint
for iOS.  Unfortunately this variable is often set at the environment
variable level on many Linux distributions so it can cause the Makefile
to think it is attempting to be cross-compiled when that is not the
intention.

This change modifies the Makefile so it attempts to cross compile only
when both HOST and HOSTROOT environment variable (which are both
required for cross compilation) are set.
This commit is contained in:
Mark Kim 2021-09-06 17:36:40 -04:00
parent 8bf9594d75
commit 6adf0fa723

View file

@ -80,9 +80,7 @@ endif
# <HOSTROOT>/lib/pkgconfig *.pc files. # <HOSTROOT>/lib/pkgconfig *.pc files.
# #
ifdef HOST ifdef HOST
ifndef HOSTROOT ifdef HOSTROOT
$(error Must set HOSTROOT to cross compile)
endif
ifeq ($(wildcard $(HOSTROOT)/.),) ifeq ($(wildcard $(HOSTROOT)/.),)
$(error Invalid HOSTROOT: $(HOSTROOT)) $(error Invalid HOSTROOT: $(HOSTROOT))
endif endif
@ -104,7 +102,7 @@ ifdef HOST
MINVEROPT:=-mios-simulator-version-min=$(MINVER) MINVEROPT:=-mios-simulator-version-min=$(MINVER)
SDKROOT:=$(shell xcrun --sdk iphonesimulator --show-sdk-path) SDKROOT:=$(shell xcrun --sdk iphonesimulator --show-sdk-path)
else else
$(error Invalid HOST: $(HOST)) $(error Invalid HOST for cross compilation: $(HOST))
endif endif
# We set PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH because we want to # We set PKG_CONFIG_LIBDIR instead of PKG_CONFIG_PATH because we want to
@ -112,6 +110,7 @@ ifdef HOST
# default path which may have libraries that aren't for HOST. # default path which may have libraries that aren't for HOST.
export PKG_CONFIG_LIBDIR:=$(HOSTROOT)/lib/pkgconfig export PKG_CONFIG_LIBDIR:=$(HOSTROOT)/lib/pkgconfig
endif endif
endif
# change to sdl-console to build a console version on Windows # change to sdl-console to build a console version on Windows
SDL_PCNAME:=sdl SDL_PCNAME:=sdl