author | Mike Sullivan <Mike.Sullivan@Oracle.COM> |
Thu, 17 Dec 2015 17:50:05 -0800 | |
changeset 5213 | 68d34c2581d6 |
parent 4357 | 417c7cb1b3aa |
child 5682 | 94c0ca64c022 |
permissions | -rw-r--r-- |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
1 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
2 |
# CDDL HEADER START |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
3 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
4 |
# The contents of this file are subject to the terms of the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
5 |
# Common Development and Distribution License (the "License"). |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
6 |
# You may not use this file except in compliance with the License. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
7 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
8 |
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
9 |
# or http://www.opensolaris.org/os/licensing. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
10 |
# See the License for the specific language governing permissions |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
11 |
# and limitations under the License. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
12 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
13 |
# When distributing Covered Code, include this CDDL HEADER in each |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
14 |
# file and include the License file at usr/src/OPENSOLARIS.LICENSE. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
15 |
# If applicable, add the following below this CDDL HEADER, with the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
16 |
# fields enclosed by brackets "[]" replaced with your own identifying |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
17 |
# information: Portions Copyright [yyyy] [name of copyright owner] |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
18 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
19 |
# CDDL HEADER END |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
20 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
21 |
# Copyright (c) 2010, 2015, Oracle and/or its affiliates. All rights reserved. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
22 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
23 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
24 |
GPATCH = /usr/gnu/bin/patch |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
25 |
PATCH_LEVEL ?= 1 |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
26 |
GPATCH_BACKUP = --backup --version-control=numbered |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
27 |
GPATCH_FLAGS = --strip=$(PATCH_LEVEL) $(GPATCH_BACKUP) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
28 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
29 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
30 |
# Rules for patching source that is downloaded and unpacked or pulled from |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
31 |
# a source repository. Patches should be named |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
32 |
# patches/{patch-file-name}.patch{version} where {patch-file-name} is a |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
33 |
# meaningful name for the patch contents and {version} corresponds to the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
34 |
# COMPONENT_NAME{version} of the source to be patched. Typically, version |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
35 |
# would be something like "_1", "_2", ... After all {version} patches have |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
36 |
# been applied, a final set of patches without a {version} suffix may be |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
37 |
# applied. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
38 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
39 |
# PATCH_DIR can be overridden to move patches to a different location |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
40 |
# PATCH_PATTERN can be overridden to adjust the patch naming scheme that the |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
41 |
# build recognizes. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
42 |
# EXTRA_PATCHES{version} can be defined in the component Makefile to include |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
43 |
# additional patches. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
44 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
45 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
46 |
PATCH_PATTERN ?= *.patch* |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
47 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
48 |
PATCH_DIR ?= patches |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
49 |
# patches specific to parfait builds. |
4254
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
50 |
ifeq ($(strip $(PARFAIT_BUILD)),yes) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
51 |
PARFAIT_PATCH_DIR = parfait |
4254
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
52 |
endif |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
53 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
54 |
PATCHES = $(shell find $(PATCH_DIR) $(PARFAIT_PATCH_DIR) -type f \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
55 |
-name '$(PATCH_PATTERN)' 2>/dev/null | \ |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
56 |
LC_COLLATE=C sort) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
57 |
|
4251
2bf7e2c1ca74
21029374 probably shouldn't overload TMP_SUFFIXES in userland fragments
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4196
diff
changeset
|
58 |
PCH_SUFFIXES = $(patsubst .patch_%,%, $(filter-out .patch,$(suffix $(PATCHES)))) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
59 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
60 |
define patch-rule |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
61 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
62 |
ifeq ($(1),_0) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
63 |
PATCH_PATTERN$(1) ?= %.patch |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
64 |
PATCHES$(1) = $(filter %.patch,$(PATCHES)) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
65 |
else |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
66 |
PATCH_PATTERN$(1) ?= %.patch$(1) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
67 |
PATCHES$(1) = $(filter %.patch$(1),$(PATCHES)) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
68 |
endif |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
69 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
70 |
ifneq ($$(PATCHES$(1)),) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
71 |
PATCH_STAMPS$(1) += $$(PATCHES$(1):$(PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%) |
4254
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
72 |
ifeq ($(strip $(PARFAIT_BUILD)),yes) |
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
73 |
PATCH_STAMPS$(1) += $$(PATCHES$(1):$(PARFAIT_PATCH_DIR)/%=$$(SOURCE_DIR$(1))/.patched-%) |
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
74 |
endif |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
75 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
76 |
# We should unpack the source that we patch before we patch it. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
77 |
$$(PATCH_STAMPS$(1):: $$(UNPACK_STAMP$(1)) unpack |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
78 |
|
4357
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
79 |
# Adding MAKEFILE_PREREQ because gmake seems to evaluate the need to patch |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
80 |
# before re-unpacking if the Makefile changed. The various stamps are |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
81 |
# removed as part of the unpacking process, and it doesn't appear to |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
82 |
# re-evaluate the need for patching. If we ever move the stamps to the build |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
83 |
# directory, we may not need the dependency any more. |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
84 |
$$(SOURCE_DIR$(1))/.patched-%: $(PATCH_DIR)/% $(MAKEFILE_PREREQ) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
85 |
$(GPATCH) -d $$(@D) $$(GPATCH_FLAGS) < $$< |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
86 |
$(TOUCH) $$(@) |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
87 |
|
4357
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
88 |
$$(SOURCE_DIR$(1))/.patched-%: $(PARFAIT_PATCH_DIR)/% $(MAKEFILE_PREREQ) |
4254
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
89 |
$(GPATCH) -d $$(@D) $$(GPATCH_FLAGS) < $$< |
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
90 |
$(TOUCH) $$(@) |
f1fca132ea31
21020731 parfait-only patching seems broken
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4252
diff
changeset
|
91 |
|
4357
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
92 |
$$(SOURCE_DIR$(1))/.patched: $$(PATCH_STAMPS$(1)) |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
93 |
$(TOUCH) $$(@) |
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
94 |
|
417c7cb1b3aa
21086455 gmake prep doesn't always apply patches
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4254
diff
changeset
|
95 |
patch:: $$(SOURCE_DIR$(1))/.patched |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
96 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
97 |
REQUIRED_PACKAGES += text/gnu-patch |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
98 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
99 |
endif |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
100 |
endef |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
101 |
|
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
102 |
# |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
103 |
# Define the rules required to download any source archives and augment any |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
104 |
# cleanup macros. |
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
105 |
# |
4251
2bf7e2c1ca74
21029374 probably shouldn't overload TMP_SUFFIXES in userland fragments
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
4196
diff
changeset
|
106 |
$(foreach suffix, $(PCH_SUFFIXES), $(eval $(call patch-rule,_$(suffix)))) |
4196
d697072a92f5
19782029 userland should be able to build from SCM repositories
Norm Jacobs <Norm.Jacobs@Oracle.COM>
parents:
diff
changeset
|
107 |
$(eval $(call patch-rule,)) # this must be last so we don't drop *.patch_%. |