From f2dac09c2084727c184cf7535d441a6ff81c226e Mon Sep 17 00:00:00 2001 From: Abdoulaye Walsimou Gaye Date: Mon, 7 Jul 2014 21:36:16 +0200 Subject: Build system: allow packages defining their recipe to use __embtk_{pre,post}install_pkg Signed-off-by: Abdoulaye Walsimou Gaye --- core/kconfig/uclibc-kconfigs/embtk-uclibc.kconfig | 27 ++++++++++++-- core/mk/bmake.mk | 10 +---- core/mk/eglibc.mk | 7 +--- core/mk/glibc.mk | 8 +--- core/mk/linux.mk | 28 ++++++-------- core/mk/musl.mk | 11 +----- core/mk/pkg-macros/install.mk | 45 ++++++++++------------- core/mk/uclibc.mk | 10 ++--- core/toolchain/binutils/binutils.mk | 2 +- core/toolchain/gcc/gcc.mk | 6 +-- core/toolchain/toolchain.kconfig | 2 +- 11 files changed, 68 insertions(+), 88 deletions(-) diff --git a/core/kconfig/uclibc-kconfigs/embtk-uclibc.kconfig b/core/kconfig/uclibc-kconfigs/embtk-uclibc.kconfig index 087f6f2..0335468 100644 --- a/core/kconfig/uclibc-kconfigs/embtk-uclibc.kconfig +++ b/core/kconfig/uclibc-kconfigs/embtk-uclibc.kconfig @@ -1,6 +1,6 @@ ################################################################################ # Embtoolkit -# Copyright(C) 2009-2012 GAYE Abdoulaye Walsimou. +# Copyright(C) 2009-2014 GAYE Abdoulaye Walsimou. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -60,17 +60,36 @@ config EMBTK_UCLIBC_GIT_BRANCH default "master" depends on EMBTK_UCLIBC_VERSION_GIT help - The branch of the git repository to use, the default is master. + The branch of the git repository to use, the default is master. config EMBTK_UCLIBC_GIT_REVISION string "Checkout a specific revision instead of the latest" depends on EMBTK_UCLIBC_VERSION_GIT help - Chechout a specific revision instead of the latest. + Chechout a specific revision instead of the latest. config EMBTK_UCLIBC_NEED_PATCH bool -config EMBTK_UCLIBC_NEED_AUTORECONF + select EMBTK_UCLIBC_HEADERS_NEED_PATCH + + +config EMBTK_UCLIBC_HEADERS_VERSION_STRING + string + default EMBTK_UCLIBC_VERSION_STRING + +config EMBTK_UCLIBC_HEADERS_REFSPEC + string + default EMBTK_UCLIBC_REFSPEC + +config EMBTK_UCLIBC_HEADERS_GIT_BRANCH + string + default EMBTK_UCLIBC_GIT_BRANCH + +config EMBTK_UCLIBC_HEADERS_GIT_REVISION + string + default EMBTK_UCLIBC_GIT_REVISION + +config EMBTK_UCLIBC_HEADERS_NEED_PATCH bool # diff --git a/core/mk/bmake.mk b/core/mk/bmake.mk index 4dccf83..5be67fe 100644 --- a/core/mk/bmake.mk +++ b/core/mk/bmake.mk @@ -1,6 +1,6 @@ ################################################################################ # Embtoolkit -# Copyright(C) 2013 Abdoulaye Walsimou GAYE. +# Copyright(C) 2013-2014 Abdoulaye Walsimou GAYE. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,19 +31,13 @@ BMAKE_SRC_DIR := $(embtk_toolsb)/bmake BMAKE_BUILD_DIR := $(embtk_toolsb)/bmake-build define __embtk_install_bmake - $(call embtk_pinfo,"Install bmake-$(BMAKE_VERSION)...") - $(call embtk_download_pkg,bmake) - $(call embtk_decompress_pkg,bmake) cd $(BMAKE_BUILD_DIR) && MAKEFLAGS="" \ $(BMAKE_SRC_DIR)/boot-strap \ --prefix=$(embtk_htools)/usr --install - $(call __embtk_setinstalled_pkg,bmake) - $(call __embtk_pkg_gen_dotkconfig_f,bmake) - $(eval __embtk_bmake_installed := y) endef define embtk_install_bmake - $(if $(call __embtk_pkg_runrecipe-y,bmake),$(__embtk_install_bmake)) + $(__embtk_install_bmake) endef define embtk_cleanup_bmake diff --git a/core/mk/eglibc.mk b/core/mk/eglibc.mk index f96bbcc..6087e76 100644 --- a/core/mk/eglibc.mk +++ b/core/mk/eglibc.mk @@ -84,8 +84,6 @@ define embtk_configure_eglibc endef define __embtk_install_eglibc - $(call embtk_pinfo,"Installing eglibc...") - $(call embtk_download_pkg,eglibc) touch `find $(EGLIBC_SRC_DIR) -name configure` $(embtk_parse_eglibc_optgroups) $(embtk_configure_eglibc) @@ -96,13 +94,10 @@ define __embtk_install_eglibc BUILD_CFLAGS="$(embtk_eglibc_buildcflags)" \ BUILD_LDFLAGS="$(embtk_eglibc_buildldflags)" \ install_root=$(embtk_sysroot) install - $(call __embtk_setinstalled_pkg,eglibc) - $(call __embtk_pkg_gen_dotkconfig_f,eglibc) - $(eval __embtk_eglibc_installed := y) endef define embtk_install_eglibc - $(if $(call __embtk_pkg_runrecipe-y,eglibc),$(__embtk_install_eglibc)) + $(__embtk_install_eglibc) endef # diff --git a/core/mk/glibc.mk b/core/mk/glibc.mk index 3561884..d721070 100644 --- a/core/mk/glibc.mk +++ b/core/mk/glibc.mk @@ -77,9 +77,6 @@ define embtk_configure_glibc endef define __embtk_install_glibc - $(call embtk_pinfo,"Installing glibc...") - $(call embtk_download_pkg,glibc) - $(call embtk_decompress_pkg,glibc) mkdir -p $(GLIBC_BUILD_DIR) $(embtk_configure_glibc) PATH=$(PATH):$(embtk_tools)/bin/ $(MAKE) -C $(GLIBC_BUILD_DIR) $(J) \ @@ -89,13 +86,10 @@ define __embtk_install_glibc BUILD_CFLAGS="$(embtk_glibc_buildcflags)" \ BUILD_LDFLAGS="$(embtk_glibc_buildldflags)" \ install_root=$(embtk_sysroot) install - $(call __embtk_setinstalled_pkg,glibc) - $(call __embtk_pkg_gen_dotkconfig_f,glibc) - $(eval __embtk_glibc_installed := y) endef define embtk_install_glibc - $(if $(call __embtk_pkg_runrecipe-y,glibc),$(__embtk_install_glibc)) + $(__embtk_install_glibc) endef # diff --git a/core/mk/linux.mk b/core/mk/linux.mk index b9a08ff..03f72c8 100644 --- a/core/mk/linux.mk +++ b/core/mk/linux.mk @@ -40,7 +40,7 @@ LINUX_SRC_DIR := $(embtk_toolsb)/linux-$(LINUX_VERSION) LINUX_BUILD_DIR := $(embtk_toolsb)/linux-$(LINUX_VERSION) LINUX_KEEP_SRC_DIR := $(CONFIG_EMBTK_BUILD_LINUX_KERNEL) -LINUX_HEADERS_NAME := linux_headers +LINUX_HEADERS_NAME := linux LINUX_HEADERS_VERSION := $(LINUX_VERSION) LINUX_HEADERS_SITE := $(LINUX_SITE) LINUX_HEADERS_PACKAGE := $(LINUX_PACKAGE) @@ -54,18 +54,15 @@ LINUX_MAKE_OPTS += ARCH=$(LINUX_ARCH) LINUX_MAKE_OPTS += CROSS_COMPILE=$(CROSS_COMPILE_CACHED) LINUX_MAKE_OPTS += HOSTCC="$(HOSTCC)" HOSTCXX="$(HOSTCXX)" +# +# linux headers install +# +define embtk_install_linux_headers + $(__embtk_install_linux_headers) +endef define __embtk_install_linux_headers - $(call embtk_pinfo,"Installing linux-$(LINUX_VERSION) headers...") - $(call embtk_download_pkg,linux) - $(call embtk_decompress_pkg,linux) $(MAKE) -C $(LINUX_BUILD_DIR) $(LINUX_MAKE_OPTS) \ INSTALL_HDR_PATH=$(embtk_sysroot)/usr headers_install - $(call __embtk_setinstalled_pkg,linux_headers) - $(call __embtk_pkg_gen_dotkconfig_f,linux_headers) - $(eval __embtk_linux_headers_installed := y) -endef -define embtk_install_linux_headers - $(if $(call __embtk_pkg_runrecipe-y,linux_headers),$(__embtk_install_linux_headers)) endef # @@ -99,7 +96,6 @@ define __embtk_install_linux_check_extsrc endef define __embtk_install_linux - $(call embtk_pinfo,"Generating linux kernel image...") $(__embtk_install_linux_check_config) $(if $(CONFIG_EMBTK_LINUX_BUILD_USE_EXTSRC), $(__embtk_install_linux_check_extsrc)) @@ -110,22 +106,20 @@ define __embtk_install_linux cp $(CONFIG_EMBTK_LINUX_DOTCONFIG) $(__embtk_linux_srcdir)/.config $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) silentoldconfig $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) $(J) - $(call __embtk_setinstalled_pkg,linux) - $(call __embtk_pkg_gen_dotkconfig_f,linux) - $(eval __embtk_linux_installed := y) endef define embtk_install_linux - $(if $(call __embtk_pkg_runrecipe-y,linux),$(__embtk_install_linux)) - $(if $(__embtk_linux_support_modules),$(embtk_postinstall_linux)) + $(__embtk_install_linux) endef define embtk_postinstall_linux + $(if $(__embtk_linux_support_modules),$(__embtk_postinstall_linux)) +endef +define __embtk_postinstall_linux $(call embtk_pinfo,"Install linux kernel modules...") $(MAKE) -C $(__embtk_linux_srcdir) $(LINUX_MAKE_OPTS) \ INSTALL_MOD_PATH=$(embtk_rootfs) modules_install endef - # # clean target and macros # diff --git a/core/mk/musl.mk b/core/mk/musl.mk index 980bd3c..cd66efa 100644 --- a/core/mk/musl.mk +++ b/core/mk/musl.mk @@ -38,6 +38,7 @@ __embtk_musl_cflags := $(TARGET_CFLAGS) __embtk_musl_cflags += $(if $(embtk_toolchain_use_llvm-y),-Wno-unknown-warning-option) define embtk_beforeinstall_musl + $(MAKE) -C $(MUSL_BUILD_DIR) distclean cd $(MUSL_SRC_DIR); \ CC=$(TARGETCC_CACHED) \ CROSS_COMPILE="$(CROSS_COMPILE)" \ @@ -52,22 +53,14 @@ define embtk_beforeinstall_musl endef define __embtk_install_musl - $(call embtk_pinfo,"Build and install musl-$(MUSL_VERSION) ...") - $(call embtk_download_pkg,musl) - $(call embtk_decompress_pkg,musl) - $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) distclean - $(embtk_beforeinstall_musl) $(Q)$(MAKE) -C $(MUSL_BUILD_DIR) \ DESTDIR=$(embtk_sysroot) install-libs install-headers $(Q)cd $(embtk_sysroot)/$(LIBDIR); \ ln -sf libc.so $(embtk_musl_dlinker).so.1 - $(call __embtk_setinstalled_pkg,musl) - $(call __embtk_pkg_gen_dotkconfig_f,musl) - $(eval __embtk_musl_installed := y) endef define embtk_install_musl - $(if $(call __embtk_pkg_runrecipe-y,musl),$(__embtk_install_musl)) + $(__embtk_install_musl) endef define embtk_cleanup_musl diff --git a/core/mk/pkg-macros/install.mk b/core/mk/pkg-macros/install.mk index 22ffc05..8ba548e 100644 --- a/core/mk/pkg-macros/install.mk +++ b/core/mk/pkg-macros/install.mk @@ -285,33 +285,30 @@ __embtk_xinstall_xpkg_allvarset-y = $(and $(__embtk_pkg_name), \ # define embtk_install_pkg $(if $(__embtk_xinstall_xpkg_allvarset-y), - $(or $(embtk_install_$(pkgv)),$(call __embtk_install_pkg,$(1))), + $(call __embtk_install_pkg,$(1)), $(call __embtk_install_paramsfailure,$(1))) endef define __embtk_install_pkg $(if $(__embtk_pkg_runrecipe-y), $(call __embtk_preinstall_pkg,$(1)) - $(if $(__embtk_pkg_usewaf-y), - $(call __embtk_install_pkg_waf,$(1)), - $(call __embtk_install_pkg_make,$(1),autotools)) + $(or $(embtk_install_$(pkgv)),$(call ___embtk_install_pkg,$(1))) $(call __embtk_postinstall_pkg,$(1))) $(embtk_postinstall_$(pkgv)) endef - +define ___embtk_install_pkg + $(if $(__embtk_pkg_usewaf-y), + $(call __embtk_install_pkg_waf,$(1)), + $(call __embtk_install_pkg_make,$(1),autotools)) +endef # # A macro to automatically install a package intended to run on the target, # using simple Makefile and an nstall target. # Usage: -# $(call embtk_makeinstall_pkg,package) +# # autotooled: add this optional string to install an autotooled package +# $(call embtk_makeinstall_pkg,package[,autotooled]) # define embtk_makeinstall_pkg - $(if $(__embtk_xinstall_xpkg_allvarset-y), - $(if $(__embtk_pkg_runrecipe-y), - $(call __embtk_preinstall_pkg,$(1)) - $(call __embtk_install_pkg_make,$(1)) - $(call __embtk_postinstall_pkg,$(1))) - $(embtk_postinstall_$(pkgv)), - $(call __embtk_install_paramsfailure,$(1))) + $(call __embtk_install_pkg_make,$(1),$(2)) endef # @@ -322,33 +319,31 @@ endef # define embtk_install_hostpkg $(if $(__embtk_xinstall_xpkg_allvarset-y), - $(or $(embtk_install_$(pkgv)),$(call __embtk_install_hostpkg,$(1))), + $(call __embtk_install_hostpkg,$(1)), $(call __embtk_install_paramsfailure,$(1))) endef define __embtk_install_hostpkg $(if $(__embtk_pkg_runrecipe-y), $(call __embtk_preinstall_hostpkg,$(1)) - $(if $(__embtk_pkg_usewaf-y), - $(call __embtk_install_hostpkg_waf,$(1)), - $(call __embtk_install_hostpkg_make,$(1),autotools)) + $(or $(embtk_install_$(pkgv)),$(call ___embtk_install_hostpkg,$(1))) $(call __embtk_postinstall_pkg,$(1))) $(embtk_postinstall_$(pkgv)) endef +define ___embtk_install_hostpkg + $(if $(__embtk_pkg_usewaf-y), + $(call __embtk_install_hostpkg_waf,$(1)), + $(call __embtk_install_hostpkg_make,$(1),autotools)) +endef # # A macro to automatically install a package intended to run on the host # development machine, using simple Makefile and an install target. # Usage: -# $(call embtk_makeinstall_hostpkg,package) +# autotooled: add this optional string to install an autotooled package +# $(call embtk_makeinstall_hostpkg,package[,autotooled]) # define embtk_makeinstall_hostpkg - $(if $(__embtk_xinstall_xpkg_allvarset-y), - $(if $(__embtk_pkg_runrecipe-y), - $(call __embtk_preinstall_hostpkg,$(1)) - $(call __embtk_install_hostpkg_make,$(1)) - $(call __embtk_postinstall_pkg,$(1))) - $(embtk_postinstall_$(pkgv)), - $(call __embtk_install_paramsfailure,$(1))) + $(call __embtk_install_hostpkg_make,$(1),$(2)) endef # diff --git a/core/mk/uclibc.mk b/core/mk/uclibc.mk index 2aa63ab..64162d0 100755 --- a/core/mk/uclibc.mk +++ b/core/mk/uclibc.mk @@ -31,7 +31,7 @@ UCLIBC_PACKAGE := uClibc-$(UCLIBC_VERSION).tar.bz2 UCLIBC_SRC_DIR := $(embtk_toolsb)/uClibc-$(UCLIBC_VERSION) UCLIBC_BUILD_DIR := $(call __embtk_pkg_srcdir,uClibc) -UCLIBC_HEADERS_NAME := uClibc_headers +UCLIBC_HEADERS_NAME := uClibc UCLIBC_HEADERS_VERSION := $(UCLIBC_VERSION) UCLIBC_HEADERS_SITE := $(UCLIBC_SITE) UCLIBC_HEADERS_GIT_SITE := $(UCLIBC_GIT_SITE) @@ -39,6 +39,7 @@ UCLIBC_HEADERS_PACKAGE := $(UCLIBC_PACKAGE) UCLIBC_HEADERS_SRC_DIR := $(UCLIBC_SRC_DIR) UCLIBC_HEADERS_BUILD_DIR := $(UCLIBC_BUILD_DIR) UCLIBC_HEADERS_KCONFIGS_NAME := UCLIBC +UCLIBC_HEADERS_KEEP_SRC_DIR := y UCLIBC_DOTCONFIG := $(UCLIBC_BUILD_DIR)/.config EMBTK_UCLIBC_CFLAGS := $(filter-out $(__clang_cflags),$(TARGET_CFLAGS)) @@ -95,21 +96,16 @@ endef # Uclibc headers install # define __embtk_install_uclibc_headers - $(call embtk_pinfo,"Install uClibc-$(UCLIBC_VERSION) headers ...") - $(call embtk_download_pkg,uClibc) - $(call embtk_decompress_pkg,uClibc) $(MAKE) -C $(UCLIBC_BUILD_DIR) distclean $(embtk_configure_uclibc) $(MAKE) -C $(UCLIBC_BUILD_DIR) silentoldconfig $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_headers $(MAKE) -C $(UCLIBC_BUILD_DIR) $(UCLIBC_MAKE_OPTS) install_startfiles $(__embtk_install_uclibc_dummy) - $(call __embtk_setinstalled_pkg,uclibc_headers) - $(eval __embtk_uclibc_headers_installed := y) endef define embtk_install_uclibc_headers - $(if $(call __embtk_pkg_runrecipe-y,uclubc_headers),$(__embtk_install_uclibc_headers)) + $(__embtk_install_uclibc_headers) endef # diff --git a/core/toolchain/binutils/binutils.mk b/core/toolchain/binutils/binutils.mk index ca5fc49..1f85bd7 100644 --- a/core/toolchain/binutils/binutils.mk +++ b/core/toolchain/binutils/binutils.mk @@ -55,5 +55,5 @@ define embtk_beforeinstall_binutils endef define embtk_install_binutils - $(call __embtk_install_hostpkg,binutils) + $(call embtk_makeinstall_hostpkg,binutils,autotooled) endef diff --git a/core/toolchain/gcc/gcc.mk b/core/toolchain/gcc/gcc.mk index 6fb93ee..6d09b66 100644 --- a/core/toolchain/gcc/gcc.mk +++ b/core/toolchain/gcc/gcc.mk @@ -64,15 +64,15 @@ define embtk_beforeinstall_gcc1_notused endef define embtk_install_gcc1 - $(call __embtk_install_hostpkg,gcc1) + $(call embtk_makeinstall_hostpkg,gcc1,autootooled) endef define embtk_install_gcc2 - $(call __embtk_install_hostpkg,gcc2) + $(call embtk_makeinstall_hostpkg,gcc2,autootooled) endef define embtk_install_gcc3 - $(call __embtk_install_hostpkg,gcc3) + $(call embtk_makeinstall_hostpkg,gcc3,autootooled) endef define __embtk_postinstall_libgcc diff --git a/core/toolchain/toolchain.kconfig b/core/toolchain/toolchain.kconfig index 534cb00..94f4e21 100644 --- a/core/toolchain/toolchain.kconfig +++ b/core/toolchain/toolchain.kconfig @@ -113,7 +113,7 @@ choice see http://www.eglibc.org for more information about eglibc. config EMBTK_CLIB_GLIBC - bool "GLIBC" + bool "glibc" help GNU GLIBC is the well known general purpose c library found on most general purpose GNU Linux distribution. -- cgit v1.2.3