2 # Copyright (C) 2007 OpenWrt.org
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
8 ifeq ($(KERNEL_BUILD
),1)
9 PKG_BUILD_DIR
:=$(LINUX_DIR
)
14 @for patch in
$$$$( (cd
$(1) && ls
) 2>/dev
/null
); do
( \
15 cp
"$(1)/$$$$patch" $(PKG_BUILD_DIR
); \
16 cd
$(PKG_BUILD_DIR
); \
17 quilt import
-P
$(2)$$$$patch -p
1 "$$$$patch"; \
18 quilt push
-f
>/dev
/null
2>/dev
/null
; \
23 QUILT?
=$(strip $(shell test -f
$(PKG_BUILD_DIR
)/.quilt_used
&& echo y
))
25 STAMP_PREPARED
:=$(strip $(STAMP_PREPARED
))_q
26 STAMP_PATCHED
:=$(PKG_BUILD_DIR
)/.quilt_patched
29 define Build
/Patch
/Default
30 rm -rf
$(PKG_BUILD_DIR
)/patches
31 mkdir
-p
$(PKG_BUILD_DIR
)/patches
32 $(call Quilt
/Patch
,$(PATCH_DIR
),)
34 touch
$(PKG_BUILD_DIR
)/.quilt_used
36 $(STAMP_CONFIGURED
): $(STAMP_PATCHED
) FORCE
37 prepare
: $(STAMP_PATCHED
)
38 quilt-check
: $(STAMP_PATCHED
)
40 define Build
/Patch
/Default
41 @if
[ -d
$(PATCH_DIR
) -a
"$$$$(ls $(PATCH_DIR) | wc -l)" -gt
0 ]; then \
42 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
47 define Kernel
/Patch
/Default
48 if
[ -d
$(GENERIC_PLATFORM_DIR
)/files
]; then
$(CP
) $(GENERIC_PLATFORM_DIR
)/files
/* $(LINUX_DIR
)/; fi
49 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
50 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(GENERIC_PATCH_DIR
),generic
/), \
51 if
[ -d
$(GENERIC_PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PATCH_DIR
); fi \
53 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(PATCH_DIR
),platform
/), \
54 if
[ -d
$(PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(PATCH_DIR
); fi \
56 $(if
$(strip $(QUILT
)),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
59 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
60 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
62 cd
$(PKG_BUILD_DIR
)/patches
; \
63 find
* -type f \
! -name series |
sort > series
; \
65 [ -f
"$(PKG_BUILD_DIR)/patches/series" ] && cd
$(PKG_BUILD_DIR
); quilt push
-a
68 define Quilt
/RefreshDir
70 -rm -f
$(1)/* 2>/dev
/null
>/dev
/null
72 for patch in
$$($(if
$(2),grep
"^$(2)",cat
) $(PKG_BUILD_DIR
)/patches
/series | awk
'{print $$1}'); do \
73 $(CP
) -v
"$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
78 define Quilt
/Refresh
/Package
79 $(call Quilt
/RefreshDir
,$(PATCH_DIR
))
82 define Quilt
/Refresh
/Kernel
83 @
[ -z
"$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] ||
{ \
84 echo
"All kernel patches must start with either generic/ or platform/"; \
87 $(call Quilt
/RefreshDir
,$(GENERIC_PATCH_DIR
),generic
/)
88 $(call Quilt
/RefreshDir
,$(PATCH_DIR
),platform
/)
91 quilt-check
: $(STAMP_PREPARED
) FORCE
92 @
[ -f
"$(PKG_BUILD_DIR)/.quilt_used" ] ||
{ \
93 echo
"The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \
96 @
[ -f
"$(PKG_BUILD_DIR)/patches/series" ] ||
{ \
97 echo
"The source directory contains no quilt patches."; \
100 @
[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] ||
{ \
101 echo
"The patches are not sorted in the right order. Please fix."; \
106 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null
107 @cd
$(PKG_BUILD_DIR
); while quilt next
2>/dev
/null
>/dev
/null
&& quilt push
; do \
109 done
; ! quilt next
2>/dev
/null
>/dev
/null
110 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
113 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
This page took 0.042573 seconds and 5 git commands to generate.