[Buildroot] [PATCH 1/2] package: pkg-generic: Support building override source without copying in common package infrastructure.

Sonic Zhang sonic.adi at gmail.com
Tue Aug 14 08:57:00 UTC 2012


From: Sonic Zhang <sonic.zhang at analog.com>

1) Set _SRCDIR a different path from _DIR if _OVERRIDE_SRCDIR is
defined. Generic package's make rules should replace $@ by $(_SRCDIR).
2) Set object path to _MAKE_FLAGS if _OVERRIDE_SRCDIR is defined.
Generic package's make rules should forward _MAKE_FLAGS to the make
command.
3) Remove unused makefile target .stamp_rsynced and .stamp_rsync_sourced.
4) Add .stamp_patch target to patch the external source tree
if _OVERRIDE_SRCDIR is defined.

Signed-off-by: Sonic Zhang <sonic.zhang at analog.com>
---
 package/pkg-generic.mk |   42 ++++++++----------------------------------
 1 files changed, 8 insertions(+), 34 deletions(-)

diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
index 68d23ba..9dfc0e3 100644
--- a/package/pkg-generic.mk
+++ b/package/pkg-generic.mk
@@ -50,25 +50,6 @@ $(BUILD_DIR)/%/.stamp_extracted:
 	$(foreach hook,$($(PKG)_POST_EXTRACT_HOOKS),$(call $(hook))$(sep))
 	$(Q)touch $@
 
-# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
-# used.
-$(BUILD_DIR)/%/.stamp_rsynced:
-	@$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
-	@test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
-	rsync -au $(SRCDIR)/ $(@D)
-	$(Q)touch $@
-
-# Handle the SOURCE_CHECK and SHOW_EXTERNAL_DEPS cases for rsynced
-# packages
-$(BUILD_DIR)/%/.stamp_rsync_sourced:
-ifeq ($(DL_MODE),SOURCE_CHECK)
-	test -d $(SRCDIR)
-else ifeq ($(DL_MODE),SHOW_EXTERNAL_DEPS)
-	echo "file://$(SRCDIR)"
-else
-	@true # Nothing to do to source a local package
-endif
-
 # Patch
 #
 # The RAWNAME variable is the lowercased package name, which allows to
@@ -225,6 +206,10 @@ $(2)_BUILDDIR		       ?= $$($(2)_SRCDIR)
 
 ifneq ($$($(2)_OVERRIDE_SRCDIR),)
 $(2)_VERSION = custom
+$(2)_MAKE_FLAGS =  O="$$($(2)_DIR)"
+$(2)_SRCDIR	=  $$($(2)_OVERRIDE_SRCDIR)
+else
+$(2)_SRCDIR	=  $$($(2)_DIR)
 endif
 
 ifndef $(2)_SOURCE
@@ -293,8 +278,6 @@ $(2)_TARGET_INSTALL_IMAGES =	$$($(2)_DIR)/.stamp_images_installed
 $(2)_TARGET_INSTALL_HOST =      $$($(2)_DIR)/.stamp_host_installed
 $(2)_TARGET_BUILD =		$$($(2)_DIR)/.stamp_built
 $(2)_TARGET_CONFIGURE =		$$($(2)_DIR)/.stamp_configured
-$(2)_TARGET_RSYNC =	        $$($(2)_DIR)/.stamp_rsynced
-$(2)_TARGET_RSYNC_SOURCE =      $$($(2)_DIR)/.stamp_rsync_sourced
 $(2)_TARGET_PATCH =		$$($(2)_DIR)/.stamp_patched
 $(2)_TARGET_EXTRACT =		$$($(2)_DIR)/.stamp_extracted
 $(2)_TARGET_SOURCE =		$$($(2)_DIR)/.stamp_downloaded
@@ -375,17 +358,15 @@ $(1)-depends:		$$($(2)_DEPENDENCIES)
 $(1)-source:		$$($(2)_TARGET_SOURCE)
 else
 # In the package override case, the sequence of steps
-#  source, by rsyncing
+#  patch
 #  depends
 #  configure
-$(1)-configure:		$(1)-depends \
+$(1)-configure:		$(1)-patch $(1)-depends \
 			$$($(2)_TARGET_CONFIGURE)
 
-$(1)-depends:		$(1)-rsync $$($(2)_DEPENDENCIES)
-
-$(1)-rsync:		$$($(2)_TARGET_RSYNC)
+$(1)-patch:		$$($(2)_TARGET_PATCH)
 
-$(1)-source:		$$($(2)_TARGET_RSYNC_SOURCE)
+$(1)-depends:		$$($(2)_DEPENDENCIES)
 endif
 
 $(1)-show-depends:
@@ -399,9 +380,6 @@ $(1)-clean:		$(1)-uninstall \
 $(1)-dirclean:		$$($(2)_TARGET_DIRCLEAN)
 
 $(1)-clean-for-rebuild:
-ifneq ($$($(2)_OVERRIDE_SRCDIR),)
-			rm -f $$($(2)_TARGET_RSYNC)
-endif
 			rm -f $$($(2)_TARGET_BUILD)
 			rm -f $$($(2)_TARGET_INSTALL_STAGING)
 			rm -f $$($(2)_TARGET_INSTALL_TARGET)
@@ -423,10 +401,6 @@ $$($(2)_TARGET_INSTALL_IMAGES):		PKG=$(2)
 $$($(2)_TARGET_INSTALL_HOST):           PKG=$(2)
 $$($(2)_TARGET_BUILD):			PKG=$(2)
 $$($(2)_TARGET_CONFIGURE):		PKG=$(2)
-$$($(2)_TARGET_RSYNC):                  SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
-$$($(2)_TARGET_RSYNC):                  PKG=$(2)
-$$($(2)_TARGET_RSYNC_SOURCE):		SRCDIR=$$($(2)_OVERRIDE_SRCDIR)
-$$($(2)_TARGET_RSYNC_SOURCE):		PKG=$(2)
 $$($(2)_TARGET_PATCH):			PKG=$(2)
 $$($(2)_TARGET_PATCH):			RAWNAME=$(patsubst host-%,%,$(1))
 $$($(2)_TARGET_EXTRACT):		PKG=$(2)
-- 
1.7.0.4




More information about the buildroot mailing list