build: copy contents of 'src' folder to build dirs (if present)

The normal Prepare step for a build is unpack, apply patches.
But for certain packages, patches contain whole files, which
would be nice to have separately and copied over as a last step
in the Prepare phase.

We need it for some other packages + patches, but I think
the 'hostapd' package can be used as a test for this.

As a quick note:
the reason the condition is being evaluated as
`[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)`
and not with
`[ -d ./src/ ] && $(CP) ./src/* $(HOST_BUILD_DIR)`
is that the latter would translate in a build failure if the `src`
folder is not present (the exit code would be 1).
The first one, succeeds for both cases (if `src` present or not).

Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
This commit is contained in:
Alexandru Ardelean 2016-10-05 17:28:46 +03:00 committed by John Crispin
parent 02d5f9477b
commit 7c8c3226dc
2 changed files with 2 additions and 0 deletions

View file

@ -43,6 +43,7 @@ Host/Patch:=$(Host/Patch/Default)
ifneq ($(strip $(HOST_UNPACK)),) ifneq ($(strip $(HOST_UNPACK)),)
define Host/Prepare/Default define Host/Prepare/Default
$(HOST_UNPACK) $(HOST_UNPACK)
[ ! -d ./src/ ] || $(CP) ./src/* $(HOST_BUILD_DIR)
$(Host/Patch) $(Host/Patch)
endef endef
endif endif

View file

@ -62,6 +62,7 @@ Build/Patch:=$(Build/Patch/Default)
ifneq ($(strip $(PKG_UNPACK)),) ifneq ($(strip $(PKG_UNPACK)),)
define Build/Prepare/Default define Build/Prepare/Default
$(PKG_UNPACK) $(PKG_UNPACK)
[ ! -d ./src/ ] || $(CP) ./src/* $(PKG_BUILD_DIR)
$(Build/Patch) $(Build/Patch)
endef endef
endif endif