toolchain: skip gcc/minimal for musl

No extra libc header build step is done, so no extra toolchain is needed
for preparing it.
This saves a significant amount of build time and disk space

Signed-off-by: Felix Fietkau <nbd@nbd.name>
This commit is contained in:
Felix Fietkau 2016-07-07 14:12:30 +02:00
parent 1692c71564
commit 74c9b9cfeb
7 changed files with 46 additions and 48 deletions

View File

@ -24,33 +24,42 @@
# 8) toolchain/libc/utils/install # 8) toolchain/libc/utils/install
# build & install libc utilities # build & install libc utilities
# #
# For musl, steps 2 and 4 are skipped, and step 3 is done after 5
curdir:=toolchain curdir:=toolchain
# subdirectories to descend into # subdirectories to descend into
$(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/minimal gcc/initial gcc/final $(LIBC)/headers $(LIBC) fortify-headers) $(curdir)/builddirs := $(if $(CONFIG_GDB),gdb) $(if $(CONFIG_INSIGHT),insight) $(if $(CONFIG_EXTERNAL_TOOLCHAIN),wrapper,kernel-headers binutils gcc/initial gcc/final $(LIBC) fortify-headers)
ifdef CONFIG_USE_UCLIBC ifdef CONFIG_USE_UCLIBC
$(curdir)/builddirs += $(LIBC)/utils $(curdir)/builddirs += $(LIBC)/utils
endif endif
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
# builddir dependencies # builddir dependencies
ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),) ifeq ($(CONFIG_EXTERNAL_TOOLCHAIN),)
ifdef CONFIG_USE_MUSL
$(curdir)/kernel-headers/compile:=$(curdir)/gcc/initial/install
$(curdir)/$(LIBC)/compile:=$(curdir)/kernel-headers/install
else
$(curdir)/builddirs += $(LIBC)/headers gcc/minimal
$(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install $(curdir)/gcc/minimal/compile:=$(curdir)/binutils/install
$(curdir)/kernel-headers/install:=$(curdir)/gcc/minimal/install $(curdir)/kernel-headers/compile:=$(curdir)/gcc/minimal/install
$(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare $(curdir)/gcc/initial/prepare:=$(curdir)/gcc/minimal/prepare
$(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare $(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
$(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install $(curdir)/$(LIBC)/headers/compile:=$(curdir)/kernel-headers/install
$(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install $(curdir)/gcc/initial/compile:=$(curdir)/$(LIBC)/headers/install
endif
$(curdir)/gcc/initial/compile+=$(curdir)/binutils/install
$(curdir)/gcc/final/prepare:=$(curdir)/gcc/initial/prepare
$(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install $(curdir)/$(LIBC)/compile:=$(curdir)/gcc/initial/install
$(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install $(curdir)/gcc/final/compile:=$(curdir)/$(LIBC)/install
$(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install $(curdir)/$(LIBC)/utils/compile:=$(curdir)/gcc/final/install
$(curdir)/$(LIBC)/prepare:=$(curdir)/$(LIBC)/headers/prepare
$(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare $(curdir)/$(LIBC)/utils/prepare:=$(curdir)/$(LIBC)/headers/prepare
endif endif
$(curdir)/builddirs-compile:=$($(curdir)/builddirs-prepare)
$(curdir)/builddirs-install:=$($(curdir)/builddirs-compile)
ifndef DUMP_TARGET_DB ifndef DUMP_TARGET_DB
ifneq ($(ARCH),) ifneq ($(ARCH),)
$(TOOLCHAIN_DIR)/info.mk: .config $(TOOLCHAIN_DIR)/info.mk: .config

View File

@ -170,9 +170,29 @@ GCC_MAKE:= \
CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \ CFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" \
CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)" CXXFLAGS_FOR_TARGET="$(TARGET_CFLAGS)"
define Host/SetToolchainInfo
$(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
$(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
endef
ifneq ($(GCC_PREPARE),)
define Host/Prepare
$(call Host/SetToolchainInfo)
$(call Host/Prepare/Default)
ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_SOURCE_DIR)/
$(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_SOURCE_DIR)/gcc/config/*/t-*
$(SED) 'd' $(HOST_SOURCE_DIR)/gcc/DEV-PHASE
$(SED) 's, DATESTAMP,,' $(HOST_SOURCE_DIR)/gcc/version.c
#(cd $(HOST_SOURCE_DIR)/libstdc++-v3; autoconf;);
$(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_SOURCE_DIR)/libstdc++-v3/configure
mkdir -p $(GCC_BUILD_DIR)
endef
else
define Host/Prepare define Host/Prepare
mkdir -p $(GCC_BUILD_DIR) mkdir -p $(GCC_BUILD_DIR)
endef endef
endif
define Host/Configure define Host/Configure
(cd $(GCC_BUILD_DIR) && rm -f config.cache; \ (cd $(GCC_BUILD_DIR) && rm -f config.cache; \
@ -181,7 +201,7 @@ define Host/Configure
endef endef
define Host/Clean define Host/Clean
rm -rf \ rm -rf $(if $(GCC_PREPARE),$(HOST_SOURCE_DIR)) \
$(STAGING_DIR_HOST)/stamp/.gcc_* \ $(STAGING_DIR_HOST)/stamp/.gcc_* \
$(STAGING_DIR_HOST)/stamp/.binutils_* \ $(STAGING_DIR_HOST)/stamp/.binutils_* \
$(GCC_BUILD_DIR) \ $(GCC_BUILD_DIR) \

View File

@ -1,4 +1,5 @@
GCC_VARIANT:=initial GCC_VARIANT:=initial
GCC_PREPARE=$(CONFIG_USE_MUSL)
include ../common.mk include ../common.mk
@ -10,7 +11,6 @@ GCC_CONFIGURE += \
--disable-threads \ --disable-threads \
define Host/Compile define Host/Compile
$(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \ +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) \
all-build-libiberty \ all-build-libiberty \
all-gcc \ all-gcc \

View File

@ -1,4 +1,5 @@
GCC_VARIANT:=minimal GCC_VARIANT:=minimal
GCC_PREPARE=$(if $(CONFIG_USE_MUSL),,1)
include ../common.mk include ../common.mk
@ -11,24 +12,6 @@ GCC_CONFIGURE += \
--disable-shared \ --disable-shared \
--disable-threads --disable-threads
define Host/SetToolchainInfo
$(SED) 's,TARGET_CROSS=.*,TARGET_CROSS=$(REAL_GNU_TARGET_NAME)-,' $(TOOLCHAIN_DIR)/info.mk
$(SED) 's,GCC_VERSION=.*,GCC_VERSION=$(GCC_VERSION),' $(TOOLCHAIN_DIR)/info.mk
endef
define Host/Prepare
$(call Host/SetToolchainInfo)
$(call Host/Prepare/Default)
ln -snf $(GCC_DIR) $(BUILD_DIR_TOOLCHAIN)/$(PKG_NAME)
$(CP) $(SCRIPT_DIR)/config.{guess,sub} $(HOST_BUILD_DIR)/
$(SED) 's,^MULTILIB_OSDIRNAMES,# MULTILIB_OSDIRNAMES,' $(HOST_BUILD_DIR)/gcc/config/*/t-*
$(SED) 'd' $(HOST_BUILD_DIR)/gcc/DEV-PHASE
$(SED) 's, DATESTAMP,,' $(HOST_BUILD_DIR)/gcc/version.c
#(cd $(HOST_BUILD_DIR)/libstdc++-v3; autoconf;);
$(SED) 's,gcc_no_link=yes,gcc_no_link=no,' $(HOST_BUILD_DIR)/libstdc++-v3/configure
mkdir -p $(GCC_BUILD_DIR)
endef
define Host/Compile define Host/Compile
+$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all-gcc all-target-libgcc +$(GCC_MAKE) $(HOST_JOBS) -C $(GCC_BUILD_DIR) all-gcc all-target-libgcc
endef endef

View File

@ -15,6 +15,7 @@ define Host/Install
install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \ install_root="$(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev" \
install-bootstrap-headers=yes \ install-bootstrap-headers=yes \
install-headers install-headers
$(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
$(MAKE) -C $(CUR_BUILD_DIR) \ $(MAKE) -C $(CUR_BUILD_DIR) \
csu/subdir_lib csu/subdir_lib
( cd $(CUR_BUILD_DIR); \ ( cd $(CUR_BUILD_DIR); \

View File

@ -1,16 +0,0 @@
PATH_PREFIX:=..
include ../common.mk
HOST_STAMP_BUILT:=$(HOST_BUILD_DIR)/.headers_built
HOST_STAMP_INSTALLED:=$(TOOLCHAIN_DIR)/stamp/.uclibc_headers_installed
define Host/Compile
endef
define Host/Install
endef
$(eval $(call HostBuild))

View File

@ -20,6 +20,7 @@ define Host/Install
ARCH="$(CONFIG_ARCH)" \ ARCH="$(CONFIG_ARCH)" \
pregen \ pregen \
install_headers install_headers
$(CP) $(BUILD_DIR_TOOLCHAIN)/linux-dev/* $(BUILD_DIR_TOOLCHAIN)/$(LIBC)-dev/
endef endef
$(eval $(call HostBuild)) $(eval $(call HostBuild))