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
)
13 ifeq ($(MAKECMDGOALS
),refresh
)
18 @for patch in
$$$$( (cd
$(1) && ls
) 2>/dev
/null
); do
( \
19 cp
"$(1)/$$$$patch" $(PKG_BUILD_DIR
); \
20 cd
$(PKG_BUILD_DIR
); \
21 quilt import
-P
$(2)$$$$patch -p
1 "$$$$patch"; \
22 quilt push
-f
>/dev
/null
2>/dev
/null
; \
27 QUILT?
=$(strip $(shell test -f
$(PKG_BUILD_DIR
)/.quilt_used
&& echo y
))
29 STAMP_PREPARED
:=$(strip $(STAMP_PREPARED
))_q
30 STAMP_PATCHED
:=$(PKG_BUILD_DIR
)/.quilt_patched
31 override CONFIG_AUTOREBUILD
=
32 define Build
/Patch
/Default
33 rm -rf
$(PKG_BUILD_DIR
)/patches
34 mkdir
-p
$(PKG_BUILD_DIR
)/patches
35 $(call Quilt
/Patch
,$(PATCH_DIR
),)
37 touch
$(PKG_BUILD_DIR
)/.quilt_used
39 $(STAMP_CONFIGURED
): $(STAMP_PATCHED
) FORCE
40 prepare
: $(STAMP_PATCHED
)
41 quilt-check
: $(STAMP_PATCHED
)
43 define Build
/Patch
/Default
44 @if
[ -d
$(PATCH_DIR
) -a
"$$$$(ls $(PATCH_DIR) | wc -l)" -gt
0 ]; then \
45 $(PATCH
) $(PKG_BUILD_DIR
) $(PATCH_DIR
); \
50 define Kernel
/Patch
/Default
51 if
[ -d
$(GENERIC_PLATFORM_DIR
)/files
]; then
$(CP
) $(GENERIC_PLATFORM_DIR
)/files
/* $(LINUX_DIR
)/; fi
52 if
[ -d .
/files
]; then
$(CP
) .
/files
/* $(LINUX_DIR
)/; fi
53 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(GENERIC_PATCH_DIR
),generic
/), \
54 if
[ -d
$(GENERIC_PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(GENERIC_PATCH_DIR
); fi \
56 $(if
$(strip $(QUILT
)),$(call Quilt
/Patch
,$(PATCH_DIR
),platform
/), \
57 if
[ -d
$(PATCH_DIR
) ]; then
$(PATCH
) $(LINUX_DIR
) $(PATCH_DIR
); fi \
59 $(if
$(strip $(QUILT
)),touch
$(PKG_BUILD_DIR
)/.quilt_used
)
62 $(STAMP_PATCHED
): $(STAMP_PREPARED
)
63 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null || true
65 cd
$(PKG_BUILD_DIR
)/patches
; \
66 find
* -type f \
! -name series |
sort > series
; \
68 if
[ -s
"$(PKG_BUILD_DIR)/patches/series" ]; then
(cd
$(PKG_BUILD_DIR
); quilt push
-a
); fi
71 define Quilt
/RefreshDir
73 -rm -f
$(1)/* 2>/dev
/null
>/dev
/null
75 for patch in
$$($(if
$(2),grep
"^$(2)",cat
) $(PKG_BUILD_DIR
)/patches
/series | awk
'{print $$1}'); do \
76 $(CP
) -v
"$(PKG_BUILD_DIR)/patches/$$patch" $(1); \
81 define Quilt
/Refresh
/Package
82 $(call Quilt
/RefreshDir
,$(PATCH_DIR
))
85 define Quilt
/Refresh
/Kernel
86 @
[ -z
"$$(grep -v '^generic/' $(PKG_BUILD_DIR)/patches/series | grep -v '^platform/')" ] ||
{ \
87 echo
"All kernel patches must start with either generic/ or platform/"; \
90 $(call Quilt
/RefreshDir
,$(GENERIC_PATCH_DIR
),generic
/)
91 $(call Quilt
/RefreshDir
,$(PATCH_DIR
),platform
/)
94 quilt-check
: $(STAMP_PREPARED
) FORCE
95 @
[ -f
"$(PKG_BUILD_DIR)/.quilt_used" ] ||
{ \
96 echo
"The source directory was not unpacked using quilt. Please rebuild with QUILT=1"; \
99 @
[ -f
"$(PKG_BUILD_DIR)/patches/series" ] ||
{ \
100 echo
"The source directory contains no quilt patches."; \
103 @
[ "$$(cat $(PKG_BUILD_DIR)/patches/series | md5sum)" = "$$(sort $(PKG_BUILD_DIR)/patches/series | md5sum)" ] ||
{ \
104 echo
"The patches are not sorted in the right order. Please fix."; \
109 @cd
$(PKG_BUILD_DIR
); quilt pop
-a
-f
>/dev
/null
2>/dev
/null
110 @cd
$(PKG_BUILD_DIR
); while quilt next
2>/dev
/null
>/dev
/null
&& quilt push
; do \
112 done
; ! quilt next
2>/dev
/null
>/dev
/null
113 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
116 $(if
$(KERNEL_BUILD
),$(Quilt
/Refresh
/Kernel
),$(Quilt
/Refresh
/Package
))
This page took 0.060335 seconds and 5 git commands to generate.