force cross compiler/cross compiling
now that config.guess knows how to detect musl, it's possible when building on a musl-based system that $build will spuriously match $target, preventing the desired behavior of building as a cross compiler or as a cross-compiled native compiler. run config.guess and config.sub from the litecross makefile to check if $build is going to match $target, and if so, append junk to the libc/abi part of the $build tuple so that it no longer matches.
This commit is contained in:
parent
463cd3e669
commit
97b7d13f65
|
@ -86,8 +86,15 @@ ifneq ($(NATIVE),)
|
||||||
HOST:=$(TARGET)
|
HOST:=$(TARGET)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(BUILD),)
|
||||||
|
GUESS = $(shell cd $(GCC_SRCDIR) && ./config.guess)
|
||||||
|
TARGET_CANON = $(shell cd $(GCC_SRCDIR) && ./config.sub $(TARGET))
|
||||||
|
BUILD = $(GUESS)$(if $(subst $(TARGET_CANON),,$(GUESS)),,xx)
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(HOST),)
|
ifeq ($(HOST),)
|
||||||
SYSROOT = /$(TARGET)
|
SYSROOT = /$(TARGET)
|
||||||
|
FULL_BINUTILS_CONFIG += --build=$(BUILD) --host=$(BUILD)
|
||||||
FULL_GCC_CONFIG += --with-build-sysroot=$(CURDIR)/obj_sysroot \
|
FULL_GCC_CONFIG += --with-build-sysroot=$(CURDIR)/obj_sysroot \
|
||||||
AR_FOR_TARGET=$(PWD)/obj_binutils/binutils/ar \
|
AR_FOR_TARGET=$(PWD)/obj_binutils/binutils/ar \
|
||||||
AS_FOR_TARGET=$(PWD)/obj_binutils/gas/as-new \
|
AS_FOR_TARGET=$(PWD)/obj_binutils/gas/as-new \
|
||||||
|
@ -98,6 +105,7 @@ FULL_GCC_CONFIG += --with-build-sysroot=$(CURDIR)/obj_sysroot \
|
||||||
RANLIB_FOR_TARGET=$(PWD)/obj_binutils/binutils/ranlib \
|
RANLIB_FOR_TARGET=$(PWD)/obj_binutils/binutils/ranlib \
|
||||||
READELF_FOR_TARGET=$(PWD)/obj_binutils/binutils/readelf \
|
READELF_FOR_TARGET=$(PWD)/obj_binutils/binutils/readelf \
|
||||||
STRIP_FOR_TARGET=$(PWD)/obj_binutils/binutils/strip-new \
|
STRIP_FOR_TARGET=$(PWD)/obj_binutils/binutils/strip-new \
|
||||||
|
--build=$(BUILD) --host=$(BUILD) \
|
||||||
# end
|
# end
|
||||||
FULL_MUSL_CONFIG += CC="$(XGCC)" LIBCC="../obj_gcc/$(TARGET)/libgcc/libgcc.a"
|
FULL_MUSL_CONFIG += CC="$(XGCC)" LIBCC="../obj_gcc/$(TARGET)/libgcc/libgcc.a"
|
||||||
MUSL_VARS = AR=../obj_binutils/binutils/ar RANLIB=../obj_binutils/binutils/ranlib
|
MUSL_VARS = AR=../obj_binutils/binutils/ar RANLIB=../obj_binutils/binutils/ranlib
|
||||||
|
@ -108,8 +116,8 @@ obj_gcc/.lc_built: | obj_sysroot/.lc_libs obj_sysroot/.lc_headers
|
||||||
obj_gcc/.lc_configured: obj_binutils/.lc_built
|
obj_gcc/.lc_configured: obj_binutils/.lc_built
|
||||||
else
|
else
|
||||||
SYSROOT = /
|
SYSROOT = /
|
||||||
FULL_BINUTILS_CONFIG += --host=$(HOST)
|
FULL_BINUTILS_CONFIG += --build=$(BUILD) --host=$(HOST)
|
||||||
FULL_GCC_CONFIG += --host=$(HOST)
|
FULL_GCC_CONFIG += --build=$(BUILD) --host=$(HOST)
|
||||||
MUSL_VARS =
|
MUSL_VARS =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue