33 # $(COMPONENT_SRC)/build-$(MACH64)/.installed |
33 # $(COMPONENT_SRC)/build-$(MACH64)/.installed |
34 # |
34 # |
35 # This set of rules makes the "publish" target the default target for make(1) |
35 # This set of rules makes the "publish" target the default target for make(1) |
36 # |
36 # |
37 |
37 |
|
38 PKGDEPEND = /usr/bin/pkgdepend |
|
39 PKGFMT = /usr/bin/pkgfmt |
|
40 PKGMOGRIFY = /usr/bin/pkgmogrify |
38 PKGSEND = /usr/bin/pkgsend |
41 PKGSEND = /usr/bin/pkgsend |
39 PKGMOGRIFY = /usr/bin/pkgmogrify |
|
40 PKGDEPEND = /usr/bin/pkgdepend |
|
41 |
42 |
42 # Add some default transforms that should apply to everyone |
43 # Package headers should all pretty much follow the same format |
43 PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/defaults |
44 METADATA_TEMPLATE = $(WS_TOP)/transforms/manifest-metadata-template |
44 PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/actuators |
45 COPYRIGHT_TEMPLATE = $(WS_TOP)/transforms/copyright-template |
45 PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/devel |
|
46 PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/docs |
|
47 PKGMOGRIFY_TRANSFORMS += $(WS_TOP)/transforms/locale |
|
48 |
46 |
49 MANIFEST = manifest-$(MACH) |
47 # order is important |
|
48 GENERATE_TRANSFORMS += $(WS_TOP)/transforms/generate-cleanup |
|
49 GENERATE_TRANSFORMS += $(WS_TOP)/transforms/variant.arch |
50 |
50 |
51 .DEFAULT: publish |
51 COMPARISON_TRANSFORMS += $(WS_TOP)/transforms/comparison-cleanup |
|
52 COMPARISON_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS) |
52 |
53 |
53 publish: $(COMPONENT_SRC)/.published |
54 # order is important |
|
55 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/defaults |
|
56 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/actuators |
|
57 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/devel |
|
58 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/docs |
|
59 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/locale |
|
60 PUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS) |
|
61 PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/publish-cleanup |
|
62 |
|
63 PKG_MACROS += MACH=$(MACH) |
|
64 PKG_MACROS += ARCH=$(MACH) |
|
65 PKG_MACROS += MACH32=$(MACH32) |
|
66 PKG_MACROS += MACH64=$(MACH64) |
|
67 PKG_MACROS += IPS_PKG_NAME=$(IPS_PKG_NAME) |
|
68 PKG_MACROS += PUBLISHER=$(PUBLISHER) |
|
69 PKG_MACROS += CONSOLIDATION=$(CONSOLIDATION) |
|
70 PKG_MACROS += BUILD_VERSION=$(BUILD_VERSION) |
|
71 PKG_MACROS += SOLARIS_VERSION=$(SOLARIS_VERSION) |
|
72 PKG_MACROS += OS_VERSION=$(OS_VERSION) |
|
73 PKG_MACROS += IPS_COMPONENT_VERSION=$(IPS_COMPONENT_VERSION) |
|
74 PKG_MACROS += COMPONENT_PROJECT_URL=$(COMPONENT_PROJECT_URL) |
|
75 PKG_MACROS += COMPONENT_ARCHIVE_URL=$(COMPONENT_ARCHIVE_URL) |
|
76 |
|
77 PKG_OPTIONS += $(PKG_MACROS:%=-D %) |
|
78 # multi-word macros get broken up, so we handle them "specially" |
|
79 PKG_OPTIONS += -D COMPONENT_SUMMARY=\"$(COMPONENT_SUMMARY)\" |
|
80 PKG_OPTIONS += -D COMPONENT_DESCRIPTION=\"$(COMPONENT_DESCRIPTION)\" |
|
81 PKG_OPTIONS += -D COMPONENT_CLASSIFICATION=\"$(COMPONENT_CLASSIFICATION)\" |
|
82 |
|
83 MANIFEST_BASE = $(COMPONENT_SRC)/manifest-$(MACH) |
|
84 |
|
85 CANONICAL_MANIFESTS = $(wildcard *.ips) |
|
86 GENERATED = $(MANIFEST_BASE)-generated |
|
87 COMBINED = $(MANIFEST_BASE)-combined |
|
88 MANIFESTS = $(CANONICAL_MANIFESTS:%=$(MANIFEST_BASE)-%) |
|
89 |
|
90 |
|
91 MOGRIFIED=$(CANONICAL_MANIFESTS:%.ips=$(MANIFEST_BASE)-%.resolved) |
|
92 PUBLISHED=$(MOGRIFIED:%.resolved=%.published) |
54 |
93 |
55 COPYRIGHT_FILE = $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright |
94 COPYRIGHT_FILE = $(COMPONENT_NAME)-$(COMPONENT_VERSION).copyright |
|
95 IPS_PKG_NAME = $(COMPONENT_NAME) |
56 IPS_COMPONENT_VERSION = $(COMPONENT_VERSION) |
96 IPS_COMPONENT_VERSION = $(COMPONENT_VERSION) |
57 |
97 |
58 $(PROTO_DIR)/$(COPYRIGHT_FILE): $(COMPONENT_COPYRIGHT) |
98 .DEFAULT: publish |
59 $(CP) $< $@ |
|
60 |
99 |
61 $(COMPONENT_SRC)/$(MANIFEST): install |
100 .SECONDARY: $(GENERATED).fdeps |
62 pkgsend generate $(PROTO_DIR) >$@ |
|
63 |
101 |
64 $(COMPONENT_SRC)/$(MANIFEST).mog: $(COMPONENT_SRC)/$(MANIFEST) $(PROTO_DIR)/$(COPYRIGHT_FILE) |
102 publish: install $(COMPONENT_SRC)/.published |
65 echo "set name=pkg.fmri value=pkg:/$(PUBLISHER)/$(COMPONENT_NAME)@$(IPS_COMPONENT_VERSION),$(BUILD_VERSION)" >$@ |
|
66 echo "set name=pkg.description value=\"$(COMPONENT_DESCRIPTION)\"" >>$@ |
|
67 echo "set name=pkg.name value=\"$(COMPONENT_DESCRIPTION)\"" >>$@ |
|
68 echo "set name=org.opensolaris.consolidation value=$(CONSOLIDATION)" >>$@ |
|
69 echo "license $(COPYRIGHT_FILE) license=$(COPYRIGHT_FILE)" >>$@ |
|
70 pkgmogrify $(PKGMOGRIFY_MACROS:%=-D %) $(PKGMOGRIFY_TRANSFORMS) $< >>$@ |
|
71 |
103 |
72 $(COMPONENT_SRC)/$(MANIFEST).fdeps: $(COMPONENT_SRC)/$(MANIFEST).mog |
104 sample-manifest: $(GENERATED).ips |
73 pkgdepend generate -m $< $(PROTO_DIR) >$@ |
|
74 |
105 |
75 $(COMPONENT_SRC)/$(MANIFEST).fdeps.res: $(COMPONENT_SRC)/$(MANIFEST).fdeps |
106 # |
76 pkgdepend resolve -m $< |
107 # Rules for generating a manifest automatically. Generated manifests will |
|
108 # contain the following: |
|
109 # copyright - template copyright information |
|
110 # metadata - mogrified template metadata |
|
111 # actions - "normalized" actions for the paths to be installed. |
|
112 # depends - automatically generated dependencies |
|
113 # |
77 |
114 |
78 $(COMPONENT_SRC)/.published: $(COMPONENT_SRC)/$(MANIFEST).fdeps.res |
115 # transform template metadata into slightly more package specific metadata. |
79 pkgsend -s $(PKG_REPO) publish --fmri-in-manifest \ |
116 $(GENERATED).metadata: $(METADATA_TEMPLATE) install |
80 -d $(PROTO_DIR) $< |
117 $(PKGMOGRIFY) -D IPS_PKG_NAME=$(IPS_PKG_NAME) $< | \ |
|
118 sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@ |
|
119 |
|
120 # generate actions from the proto dir |
|
121 $(GENERATED).generate: install |
|
122 $(PKGSEND) generate $(PKG_HARDLINKS:%=--target %) $(PROTO_DIR) >$@ |
|
123 |
|
124 # convert actions to a "normalized" format |
|
125 $(GENERATED).actions: $(GENERATED).generate |
|
126 $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(GENERATE_TRANSFORMS) | \ |
|
127 sed -e '/^$$/d' -e '/^#.*$$/d' | $(PKGFMT) >$@ |
|
128 |
|
129 # generate dependencies |
|
130 $(MANIFEST_BASE)-%.fdeps: $(MANIFEST_BASE)-%.generate |
|
131 $(PKGDEPEND) generate $(PKG_OPTIONS) $< $(PROTO_DIR) >$@ |
|
132 |
|
133 $(MANIFEST_BASE)-%.depend: $(MANIFEST_BASE)-%.fdeps |
|
134 $(PKGDEPEND) resolve -o $< | sed -e '1d' >$@ |
|
135 |
|
136 # generate a complete manifest from the pieces |
|
137 $(GENERATED).ips: $(GENERATED).metadata $(GENERATED).actions \ |
|
138 $(GENERATED).depend |
|
139 cat $(COPYRIGHT_TEMPLATE) $(GENERATED).metadata $(GENERATED).actions \ |
|
140 $(GENERATED).depend >$@ |
|
141 |
|
142 # |
|
143 # Rules to generate a combined manifest from the canonical manifest(s) checked |
|
144 # into the workspace. |
|
145 # |
|
146 |
|
147 # Combine the canonical manifest(s) for this component and "normalize" them |
|
148 # for comparison. |
|
149 $(COMBINED).ips: canonical-manifests |
|
150 cat $(CANONICAL_MANIFESTS) | $(PKGMOGRIFY) $(PKG_OPTIONS) /dev/fd/0 | \ |
|
151 sed -e '/^$$/d' -e '/^#.*$$/d' | sort -u | $(PKGFMT) >$@ |
|
152 |
|
153 $(MANIFEST_BASE)-%.compare: $(MANIFEST_BASE)-%.ips |
|
154 $(PKGMOGRIFY) $(PKG_OPTIONS) $(COMPARISON_TRANSFORMS) $< >$@ |
|
155 |
|
156 manifest-compare: $(COMBINED).compare $(GENERATED).compare |
|
157 @echo "Manifest comparison" |
|
158 @pkgdiff $(GENERATED).compare $(COMBINED).compare |
|
159 |
|
160 # mogrify the canonical manifest(s) |
|
161 # |
|
162 $(MANIFEST_BASE)-%.resolved: %.ips manifest-compare |
|
163 $(PKGMOGRIFY) $(PKG_OPTIONS) $< $(PUBLISH_TRANSFORMS) >$@ |
|
164 |
|
165 $(MANIFEST_BASE)-%.published: $(MANIFEST_BASE)-%.resolved |
|
166 $(PKGSEND) -s $(PKG_REPO) publish --fmri-in-manifest \ |
|
167 -d $(PROTO_DIR) -d . $< |
81 $(TOUCH) $@ |
168 $(TOUCH) $@ |
|
169 |
|
170 $(COMPONENT_SRC)/.published: manifest-compare $(PUBLISHED) |
|
171 $(TOUCH) $@ |
|
172 |
|
173 canonical-manifests: $(CANONICAL_MANIFESTS) |
|
174 ifeq ($(strip $(CANONICAL_MANIFESTS)),) |
|
175 # If there were no canonical manifests in the workspace, nothing will |
|
176 # be published and we should fail. A sample manifest can be generated |
|
177 # with |
|
178 # $ gmake sample-manifest |
|
179 # Once created, it will need to be reviewed, edited, and added to the |
|
180 # workspace. |
|
181 $(error Missing canonical manifest(s)) |
|
182 endif |