From 7fd3b8c890a4519ecfddf10b621e48242ee5a2da Mon Sep 17 00:00:00 2001 From: Abdoulaye Walsimou Gaye Date: Wed, 8 Jan 2014 21:33:42 +0100 Subject: Build system: give ability to wipe out packages workspace after successful build Signed-off-by: Abdoulaye Walsimou Gaye --- defconfigs/common.kconfig | 1 + kconfig/hosttools-buildopts.kconfig | 7 +++++++ mk/binutils.mk | 2 ++ mk/macros.packages.mk | 22 ++++++++++++++++++---- packages/misc/foo/foo-autotools.mk | 6 ++++++ 5 files changed, 34 insertions(+), 4 deletions(-) diff --git a/defconfigs/common.kconfig b/defconfigs/common.kconfig index 689f5ec..d378a30 100644 --- a/defconfigs/common.kconfig +++ b/defconfigs/common.kconfig @@ -1,3 +1,4 @@ +CONFIG_EMBTK_WIPEOUTWORKSPACES=y CONFIG_EMBTK_GCC_LANGUAGE_CPP=y CONFIG_EMBTK_HAVE_GDB_SYSTEM=y CONFIG_EMBTK_HAVE_GDB=y diff --git a/kconfig/hosttools-buildopts.kconfig b/kconfig/hosttools-buildopts.kconfig index 8dfccfe..59431af 100644 --- a/kconfig/hosttools-buildopts.kconfig +++ b/kconfig/hosttools-buildopts.kconfig @@ -64,6 +64,13 @@ config EMBTK_DOWNLOAD_DIR downloaded packages in the default location under EmbToolkit, not make clean. +config EMBTK_WIPEOUTWORKSPACES + bool "Wipe out packages workspace after successful build" + help + Wipe out packages workspace after successful build. If is highly + recommended to enable this option if you want to save disk space on you + host development. + config EMBTK_CACHE_PATCHES bool "Preserve first downloaded patches and do not download new one" default y diff --git a/mk/binutils.mk b/mk/binutils.mk index 1f5344f..d4cf8e5 100644 --- a/mk/binutils.mk +++ b/mk/binutils.mk @@ -31,6 +31,8 @@ BINUTILS_PACKAGE := binutils-$(BINUTILS_VERSION).tar.bz2 BINUTILS_SRC_DIR := $(embtk_toolsb)/binutils-$(BINUTILS_VERSION) BINUTILS_BUILD_DIR := $(embtk_toolsb)/binutils-build +BINUTILS_KEEP_SRC_DIR := $(embtk_toolchain_has_llvm-y) + BINUTILS_CONFIGURE_OPTS := --disable-werror --with-sysroot=$(embtk_sysroot) BINUTILS_CONFIGURE_OPTS += --disable-nls --disable-multilib BINUTILS_CONFIGURE_OPTS += --enable-gold --enable-plugins diff --git a/mk/macros.packages.mk b/mk/macros.packages.mk index a184a9f..9e22103 100644 --- a/mk/macros.packages.mk +++ b/mk/macros.packages.mk @@ -155,6 +155,7 @@ __embtk_pkg_version = $(or $(__embtk_pkg_usegit),$(__embtk_pkg_versionsvn),$(st __embtk_pkg_package_f = $(strip $(embtk_dldir))/$(__embtk_pkg_package) __embtk_pkg_srcdir = $(or $(__embtk_pkg_localgit),$(__embtk_pkg_localsvn),$(patsubst %/,%,$(strip $($(PKGV)_SRC_DIR)))) __embtk_pkg_builddir = $(patsubst %/,%,$(strip $($(PKGV)_BUILD_DIR))) +__embtk_pkg_nowipeworkspace = $(strip $($(PKGV)_KEEP_SRC_DIR)) # State dir: where build system stores package states: installed, patched, etc. ____embtk_pkg_statedir = $(dir $(__embtk_pkg_builddir)) ___embtk_pkg_statedir = $(____embtk_pkg_statedir)/.embtk-$(__embtk_pkg_name)-$(pkgv) @@ -222,6 +223,14 @@ __embtk_unsetinstalled_pkg = rm -rf $(__embtk_pkg_dotinstalled_f) __embtk_setkconfigured_pkg = mkdir -p $(__embtk_pkg_statedir) && touch $(__embtk_pkg_dotkconfig_f) __embtk_unsetkconfigured_pkg = rm -rf $(__embtk_pkg_dotkconfig_f) +ifeq ($(CONFIG_EMBTK_WIPEOUTWORKSPACES),y) +define __embtk_wipeoutworkspace_pkg + $(if $(__embtk_pkg_usegit)$(__embtk_pkg_usesvn),, + rm -rf $(__embtk_pkg_builddir) + rm -rf $(__embtk_pkg_srcdir)) +endef +endif + # Some useful macros about packages __embtk_rootfs_pkgs-y = $(patsubst %_install,%,$(ROOTFS_COMPONENTS-y)) __embtk_rootfs_nrpkgs-y = $(words $(__embtk_rootfs_pkgs-y)) @@ -545,7 +554,9 @@ __embtk_xinstall_xpkg_allvarset-y = $(and $(__embtk_pkg_name), \ define __embtk_install_pkg $(if $(__embtk_pkg_installed-y),true, $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_pkg_make,$(1),autotools)) + $(Q)$(call __embtk_install_pkg_make,$(1),autotools) + $(call __embtk_wipeoutworkspace_pkg,$(1))) + $(call __embtk_wipeoutworkspace_pkg,$(1)) $(if $(embtk_postinstall_$(pkgv)),$(embtk_postinstall_$(pkgv))) endef @@ -565,7 +576,8 @@ define embtk_makeinstall_pkg $(if $(__embtk_xinstall_xpkg_allvarset-y), $(if $(__embtk_pkg_installed-y),true, $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_pkg_make,$(1))) + $(Q)$(call __embtk_install_pkg_make,$(1)) + $(call __embtk_wipeoutworkspace_pkg,$(1))) $(if $(embtk_postinstall_$(pkgv)),$(embtk_postinstall_$(pkgv))), $(call __embtk_install_paramsfailure,$(1))) endef @@ -580,7 +592,8 @@ endef define __embtk_install_hostpkg $(if $(__embtk_pkg_installed-y),true, $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_hostpkg_make,$(1),autotools)) + $(Q)$(call __embtk_install_hostpkg_make,$(1),autotools) + $(call __embtk_wipeoutworkspace_pkg,$(1))) $(if $(embtk_postinstall_$(pkgv)),$(embtk_postinstall_$(pkgv))) endef define embtk_install_hostpkg @@ -599,7 +612,8 @@ define embtk_makeinstall_hostpkg $(if $(__embtk_xinstall_xpkg_allvarset-y), $(if $(__embtk_pkg_installed-y),true, $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_hostpkg_make,$(1))) + $(Q)$(call __embtk_install_hostpkg_make,$(1)) + $(call __embtk_wipeoutworkspace_pkg,$(1))) $(or $(embtk_postinstall_$(pkgv)),true), $(call __embtk_install_paramsfailure,$(1))) endef diff --git a/packages/misc/foo/foo-autotools.mk b/packages/misc/foo/foo-autotools.mk index bc0acc6..d698dbd 100644 --- a/packages/misc/foo/foo-autotools.mk +++ b/packages/misc/foo/foo-autotools.mk @@ -50,3 +50,9 @@ FOO_MAKE_OPTS := FOO_MAKE_DIRS := FOO_DEPS := + +# +# if not empty, force build system to not remove this package workspace after +# successful build even if it is globally configured to do so. +# +FOO_KEEP_SRC_DIR := -- cgit v1.2.3