diff options
author | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2014-05-10 20:39:13 +0200 |
---|---|---|
committer | Abdoulaye Walsimou Gaye <awg@embtoolkit.org> | 2014-05-10 20:47:49 +0200 |
commit | 5de829c9ee3bd76012df0a73e66ba1ea7a435c66 (patch) | |
tree | fe72ed0f42156b0d3415ed2653226c8df02b6752 /core/mk/pkg-macros | |
parent | 5d44167723c5b863b69f9fa08a9e220e941a44d7 (diff) | |
download | embtoolkit-5de829c9ee3bd76012df0a73e66ba1ea7a435c66.tar.gz embtoolkit-5de829c9ee3bd76012df0a73e66ba1ea7a435c66.tar.bz2 embtoolkit-5de829c9ee3bd76012df0a73e66ba1ea7a435c66.tar.xz |
Build system: Initial support of waf build system for host/taget packages
This patch adds initial support of waf build syste.
Beside other requirements the packages using this build system feature
are required to:
- Define in their .kconfig file
config EMBTK_PACKAGENAME_USE_WAF
bool
default y
select EMBTK_HOST_HAVE_WAF
- Have waf commands: configure build install
Signed-off-by: Abdoulaye Walsimou Gaye <awg@embtoolkit.org>
Diffstat (limited to 'core/mk/pkg-macros')
-rw-r--r-- | core/mk/pkg-macros/configure.mk | 57 | ||||
-rw-r--r-- | core/mk/pkg-macros/install.mk | 36 | ||||
-rw-r--r-- | core/mk/pkg-macros/vars.mk | 9 |
3 files changed, 98 insertions, 4 deletions
diff --git a/core/mk/pkg-macros/configure.mk b/core/mk/pkg-macros/configure.mk index 1485d5f..2761c7b 100644 --- a/core/mk/pkg-macros/configure.mk +++ b/core/mk/pkg-macros/configure.mk @@ -143,3 +143,60 @@ define embtk_configure_hostpkg $(__embtk_pkg_configureopts) $(Q)$(call __embtk_setconfigured_pkg,$(1)) endef + +# +# +# Usage: +# $(call embtk_wafconfigure_pkg,xxxx) +# +define embtk_wafconfigure_pkg + $(Q)test -e $(__embtk_pkg_srcdir)/wscript || exit 1 + $(call __embtk_print_configure_opts,$(__embtk_pkg_configureopts)) + $(Q)cd $(__embtk_pkg_srcdir); \ + $(__embtk_pkg_cc) \ + $(__embtk_pkg_cxx) \ + AR=$(TARGETAR) \ + RANLIB=$(TARGETRANLIB) \ + AS=$(CROSS_COMPILE)as \ + NM=$(TARGETNM) \ + STRIP=$(TARGETSTRIP) \ + OBJDUMP=$(TARGETOBJDUMP) \ + OBJCOPY=$(TARGETOBJCOPY) \ + CFLAGS="$(__embtk_pkg_cflags) $(TARGET_CFLAGS)" \ + CXXFLAGS="$(__embtk_pkg_cxxflags) $(TARGET_CXXFLAGS)" \ + LDFLAGS="$(__embtk_pkg_ildflags) $(__embtk_pkg_ldflags)" \ + CPPFLAGS="-I$(embtk_sysroot)/usr/include $(__embtk_pkg_cppflags)" \ + PKG_CONFIG="$(PKGCONFIG_BIN)" \ + PKG_CONFIG_PATH="$(EMBTK_PKG_CONFIG_PATH)" \ + PKG_CONFIG_LIBDIR="$(EMBTK_PKG_CONFIG_LIBDIR)" \ + $(__embtk_pkg_configureenv) $(__embtk_pkg_scanbuild) \ + $(embtk_waf) configure \ + --prefix=/usr \ + --out=$(__embtk_pkg_builddir) \ + $(__embtk_pkg_configureopts) + $(Q)$(call __embtk_setconfigured_pkg,$(1)) +endef + +# +# +# Usage: +# $(call embtk_wafconfigure_hostpkg,xxxx) +# +define embtk_wafconfigure_hostpkg + $(Q)test -e $(__embtk_pkg_srcdir)/wscript || exit 1 + $(call __embtk_print_configure_opts,$(__embtk_pkg_configureopts)) + $(Q)cd $(__embtk_pkg_srcdir); \ + CPPFLAGS="$(__embtk_hostpkg_cppflags)" \ + LDFLAGS="$(__embtk_hostpkg_ldflags)" \ + PKG_CONFIG="$(PKGCONFIG_BIN)" \ + PKG_CONFIG_PATH="$(EMBTK_HOST_PKG_CONFIG_PATH)" \ + $(if $(__embtk_pkg_noccache),,CC=$(HOSTCC_CACHED)) \ + $(if $(__embtk_pkg_noccache),,CXX=$(HOSTCXX_CACHED)) \ + $(__embtk_pkg_configureenv) \ + $(embtk_waf) configure \ + --prefix=$(strip $(if $(__embtk_pkg_prefix), \ + $(__embtk_pkg_prefix),$(embtk_htools)/usr)) \ + --out=$(__embtk_pkg_builddir) \ + $(__embtk_pkg_configureopts) + $(Q)$(call __embtk_setconfigured_pkg,$(1)) +endef diff --git a/core/mk/pkg-macros/install.mk b/core/mk/pkg-macros/install.mk index 56abe02..79d6c98 100644 --- a/core/mk/pkg-macros/install.mk +++ b/core/mk/pkg-macros/install.mk @@ -210,6 +210,34 @@ define __embtk_install_hostpkg_make $(call __embtk_postinstall_pkg,$(1)) endef +__embtk_waf_build = cd $(__embtk_pkg_builddir); \ + $(embtk_waf) build $(J) --progress + +__embtk_waf_install = cd $(__embtk_pkg_builddir); \ + $(embtk_waf) install --progress \ + $(if $(__embtk_pkg_nodestdir),, \ + --destdir=$(embtk_sysroot)$(if $(__embtk_pkg_sysrootsuffix),/$(__embtk_pkg_sysrootsuffix))) + +__embtk_waf_hostinstall = cd $(__embtk_pkg_builddir); \ + $(embtk_waf) install --progress \ + $(if $(__embtk_pkg_destdir),--destdir=$(__embtk_pkg_destdir)) + +define __embtk_install_pkg_waf + $(call __embtk_preinstall_pkg,$(1)) + $(call embtk_wafconfigure_pkg,$(1)) + $(call __embtk_waf_build,$(1)) + $(call __embtk_waf_install,$(1)) + $(call __embtk_postinstall_pkg,$(1)) +endef + +define __embtk_install_hostpkg_waf + $(call __embtk_preinstall_pkg,$(1)) + $(call embtk_wafconfigure_hostpkg,$(1)) + $(call __embtk_waf_build,$(1)) + $(call __embtk_waf_hostinstall,$(1)) + $(call __embtk_postinstall_pkg,$(1)) +endef + # # A macro to exit with error when needed package variables not define. # Usage: @@ -269,7 +297,9 @@ endef define __embtk_install_pkg $(if $(__embtk_pkg_runrecipe-y), $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_pkg_make,$(1),autotools)) + $(if $(__embtk_pkg_usewaf-y), + $(Q)$(call __embtk_install_pkg_waf,$(1)), + $(Q)$(call __embtk_install_pkg_make,$(1),autotools))) $(embtk_postinstall_$(pkgv)) endef @@ -302,7 +332,9 @@ endef define __embtk_install_hostpkg $(if $(__embtk_pkg_runrecipe-y), $(Q)mkdir -p $(__embtk_pkg_builddir) - $(Q)$(call __embtk_install_hostpkg_make,$(1),autotools)) + $(if $(__embtk_pkg_usewaf-y), + $(Q)$(call __embtk_install_hostpkg_waf,$(1)), + $(Q)$(call __embtk_install_hostpkg_make,$(1),autotools))) $(embtk_postinstall_$(pkgv)) endef diff --git a/core/mk/pkg-macros/vars.mk b/core/mk/pkg-macros/vars.mk index f690868..d48a061 100644 --- a/core/mk/pkg-macros/vars.mk +++ b/core/mk/pkg-macros/vars.mk @@ -116,13 +116,18 @@ __embtk_pkg_kconfigs = $(sort $(filter CONFIG_EMBTK_$(__embtk_pkg_kconfigsname) __embtk_pkg_kconfigs_v = $(foreach k,$(__embtk_pkg_kconfigs),$(k)=$($(k))) __embtk_pkg_deps_kconfigs_v = $(foreach d,$(__embtk_pkg_depspkgv),$(call __embtk_pkg_kconfigs_v,$(d))) __embtk_pkg_kconfigs_all_v = $(strip $(__embtk_pkg_kconfigs_v) $(__embtk_pkg_deps_kconfigs_v)) + __embtk_pkg_cflags = $(strip $($(PKGV)_CFLAGS)) __embtk_pkg_cppflags = $(strip $($(PKGV)_CPPFLAGS)) __embtk_pkg_cxxflags = $(strip $($(PKGV)_CXXFLAGS)) __embtk_pkg_ldflags = $(strip $($(PKGV)_LDFLAGS)) + __embtk_pkg_noccache = $(CONFIG_EMBTK_$(PKGV)_NOCCACHE) +__embtk_pkg_scanbuild-y = $(and $(CONFIG_EMBTK_$(PKGV)_USE_SCANBUILD),$(embtk_toolchain_has_llvm-y)) +__embtk_pkg_scanbuild = $(if $(__embtk_pkg_scanbuild-y),$(TARGETSCANBUILD) -o $(__embtk_pkg_srcdir)-scanbuild-results) + __embtk_pkg_makedirs = $(strip $($(PKGV)_MAKE_DIRS)) __embtk_pkg_makeenv = $(strip $($(PKGV)_MAKE_ENV)) __embtk_pkg_makeopts = $(strip $($(PKGV)_MAKE_OPTS)) -__embtk_pkg_scanbuild-y = $(and $(CONFIG_EMBTK_$(PKGV)_USE_SCANBUILD),$(embtk_toolchain_has_llvm-y)) -__embtk_pkg_scanbuild = $(if $(__embtk_pkg_scanbuild-y),$(TARGETSCANBUILD) -o $(__embtk_pkg_srcdir)-scanbuild-results) + +__embtk_pkg_usewaf-y = $(CONFIG_EMBTK_$(PKGV)_USE_WAF) |