4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
21 # Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
22 # Copyright 2014 Andrzej Szeszo. All rights reserved.
26 # Rules and Macros for generating an IPS package manifest and publishing an
27 # IPS package to a pkg depot.
29 # To use these rules, include ../make-rules/ips.mk in your Makefile
30 # and define an "install" target appropriate to building your component.
33 # install: $(BUILD_DIR)/build/$(MACH32)/.installed \
34 # $(BUILD_DIR)/build/$(MACH64)/.installed
36 # This set of rules makes the "publish" target the default target for make(1)
39 PKGDEPEND
= /usr
/bin
/pkgdepend
40 PKGFMT
= /usr
/bin
/pkgfmt
41 PKGMOGRIFY
= /usr
/bin
/pkgmogrify
42 PKGSEND
= /usr
/bin
/pkgsend
43 ifeq ($(strip $(PKGLINT_COMPONENT
)),)
44 PKGLINT
= /usr
/bin
/pkglint
46 PKGLINT
= ${WS_TOOLS}/pkglint
48 PKGMANGLE
= $(WS_TOOLS
)/userland-mangler
50 WS_TRANSFORMS
= $(WS_TOP
)/transforms
52 GENERATE_HISTORY
= $(WS_TOOLS
)/generate-history
55 # Package headers should all pretty much follow the same format
56 METADATA_TEMPLATE
= $(WS_TOP
)/transforms
/manifest-metadata-template
57 COPYRIGHT_TEMPLATE
= $(WS_TOP
)/transforms
/copyright-template
60 GENERATE_TRANSFORMS
+= $(WS_TOP
)/transforms
/generate-cleanup
62 PKGMOGRIFY_TRANSFORMS
+= $(WS_TOP
)/transforms
/libtool-drop
63 PKGMOGRIFY_TRANSFORMS
+= $(WS_TOP
)/transforms
/ignore-libs
65 COMPARISON_TRANSFORMS
+= $(WS_TOP
)/transforms
/comparison-cleanup
66 COMPARISON_TRANSFORMS
+= $(PKGMOGRIFY_TRANSFORMS
)
68 LICENSE_TRANSFORMS
= $(WS_TOP
)/transforms
/license-changes
71 PUBLISH_TRANSFORMS
+= $(LICENSE_TRANSFORMS
)
72 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/variant-cleanup
73 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/autopyc
74 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/defaults
75 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/actuators
76 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/devel
77 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/docs
78 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/locale
79 PUBLISH_TRANSFORMS
+= $(PKGMOGRIFY_TRANSFORMS
)
80 PUBLISH_TRANSFORMS
+= $(WS_TOP
)/transforms
/publish-cleanup
82 ifeq ($(strip $(COMPONENT_AUTOGEN_MANIFEST
)),yes
)
83 AUTOGEN_MANIFEST_TRANSFORMS
+= $(WS_TOP
)/transforms
/generate-cleanup
85 AUTOGEN_MANIFEST_TRANSFORMS
+= $(WS_TOP
)/transforms
/drop-all
88 PKG_MACROS
+= MACH
=$(MACH
)
89 PKG_MACROS
+= MACH32
=$(MACH32
)
90 PKG_MACROS
+= MACH64
=$(MACH64
)
91 PKG_MACROS
+= PUBLISHER
=$(PUBLISHER
)
92 PKG_MACROS
+= PUBLISHER_LOCALIZABLE
=$(PUBLISHER_LOCALIZABLE
)
93 PKG_MACROS
+= CONSOLIDATION
=$(CONSOLIDATION
)
94 PKG_MACROS
+= BUILD_VERSION
=$(BUILD_VERSION
)
95 PKG_MACROS
+= SOLARIS_VERSION
=$(SOLARIS_VERSION
)
96 PKG_MACROS
+= OS_VERSION
=$(OS_VERSION
)
97 PKG_MACROS
+= PKG_SOLARIS_VERSION
=$(PKG_SOLARIS_VERSION
)
98 PKG_MACROS
+= HUMAN_VERSION
=$(HUMAN_VERSION
)
99 PKG_MACROS
+= IPS_COMPONENT_VERSION
=$(IPS_COMPONENT_VERSION
)
100 PKG_MACROS
+= COMPONENT_VERSION
=$(COMPONENT_VERSION
)
101 PKG_MACROS
+= COMPONENT_PROJECT_URL
=$(COMPONENT_PROJECT_URL
)
102 PKG_MACROS
+= COMPONENT_ARCHIVE_URL
=$(COMPONENT_ARCHIVE_URL
)
103 PKG_MACROS
+= COMPONENT_HG_URL
=$(COMPONENT_HG_URL
)
104 PKG_MACROS
+= COMPONENT_HG_REV
=$(COMPONENT_HG_REV
)
105 PKG_MACROS
+= COMPONENT_NAME
=$(COMPONENT_NAME
)
106 PKG_MACROS
+= COMPONENT_FMRI
=$(COMPONENT_FMRI
)
107 PKG_MACROS
+= COMPONENT_LICENSE
="$(COMPONENT_LICENSE)"
108 PKG_MACROS
+= COMPONENT_LICENSE_FILE
=$(COMPONENT_LICENSE_FILE
)
109 PKG_MACROS
+= TPNO
=$(TPNO
)
110 PKG_MACROS
+= USERLAND_GIT_REMOTE
=$(USERLAND_GIT_REMOTE
)
111 PKG_MACROS
+= USERLAND_GIT_BRANCH
=$(USERLAND_GIT_BRANCH
)
112 PKG_MACROS
+= USERLAND_GIT_REV
=$(USERLAND_GIT_REV
)
114 PKG_OPTIONS
+= $(PKG_MACROS
:%=-D
%) -D COMPONENT_SUMMARY
="$(COMPONENT_SUMMARY)" -D COMPONENT_CLASSIFICATION
="org.opensolaris.category.2008:$(COMPONENT_CLASSIFICATION)"
116 MANGLED_DIR
= $(PROTO_DIR
)/mangled
118 PKG_PROTO_DIRS
+= $(MANGLED_DIR
) $(PROTO_DIR
) $(@D
) $(COMPONENT_DIR
) $(COMPONENT_SRC
)
120 MANIFEST_BASE
= $(BUILD_DIR
)/manifest-
$(MACH
)
122 CANONICAL_MANIFESTS
= $(wildcard *.p5m
)
123 ifneq ($(wildcard $(HISTORY
)),)
124 HISTORICAL_MANIFESTS
= $(shell $(NAWK
) -v FUNCTION
=name
-f
$(GENERATE_HISTORY
) < $(HISTORY
))
127 # Look for manifests which need to be duplicated for each version of python.
128 ifeq ($(findstring -PYVER
,$(CANONICAL_MANIFESTS
)),-PYVER
)
129 UNVERSIONED_MANIFESTS
= $(filter-out %-GENFRAG.p5m
,$(filter-out %-PYVER.p5m
,$(CANONICAL_MANIFESTS
)))
130 PY_MANIFESTS
= $(filter %-PYVER.p5m
,$(CANONICAL_MANIFESTS
))
131 PYV_MANIFESTS
= $(foreach v
,$(shell echo
$(PYTHON_VERSIONS
) | tr
-d .
),$(shell echo
$(PY_MANIFESTS
) | sed
-e
's/-PYVER.p5m/-$(v).p5m/g'))
132 PYNV_MANIFESTS
= $(shell echo
$(PY_MANIFESTS
) | sed
-e
's/-PYVER//')
134 UNVERSIONED_MANIFESTS
= $(CANONICAL_MANIFESTS
)
137 # Look for manifests which need to be duplicated for each version of perl.
138 ifeq ($(findstring -PERLVER
,$(UNVERSIONED_MANIFESTS
)),-PERLVER
)
139 NOPERL_MANIFESTS
= $(filter-out %-GENFRAG.p5m
,$(filter-out %-PERLVER.p5m
,$(UNVERSIONED_MANIFESTS
)))
140 PERL_MANIFESTS
= $(filter %-PERLVER.p5m
,$(UNVERSIONED_MANIFESTS
))
141 PERLV_MANIFESTS
= $(foreach v
,$(shell echo
$(PERL_VERSIONS
) | tr
-d .
),$(shell echo
$(PERL_MANIFESTS
) | sed
-e
's/-PERLVER.p5m/-$(v).p5m/g'))
142 PERLNV_MANIFESTS
= $(shell echo
$(PERL_MANIFESTS
) | sed
-e
's/-PERLVER//')
144 NOPERL_MANIFESTS
= $(UNVERSIONED_MANIFESTS
)
147 # Look for manifests which need to be duplicated for each version of ruby.
148 # NOPERL_MANIFESTS represents the manifests that are not Python or
149 # Perl manifests. Extract the Ruby Manifests from NOPERL_MANIFESTS.
150 # Any remaining manifests are stored in NONRUBY_MANIFESTS
151 ifeq ($(findstring -RUBYVER
,$(NOPERL_MANIFESTS
)),-RUBYVER
)
152 NORUBY_MANIFESTS
= $(filter-out %GENFRAG.p5m
,\
153 $(filter-out %-RUBYVER.p5m
,$(NOPERL_MANIFESTS
)))
154 RUBY_MANIFESTS
= $(filter %-RUBYVER.p5m
,$(NOPERL_MANIFESTS
))
155 RUBYV_MANIFESTS
= $(foreach v
,$(shell echo
$(RUBY_VERSIONS
)),\
156 $(shell echo
$(RUBY_MANIFESTS
) |\
157 sed
-e
's/-RUBYVER.p5m/-$(shell echo $(v) |\
158 cut -d. -f1,2 | tr -d .).p5m/g'))
159 RUBYNV_MANIFESTS
= $(shell echo
$(RUBY_MANIFESTS
) | sed
-e
's/-RUBYVER//')
161 NORUBY_MANIFESTS
= $(NOPERL_MANIFESTS
)
164 VERSIONED_MANIFESTS
= \
165 $(PYV_MANIFESTS
) $(PYNV_MANIFESTS
) \
166 $(PERLV_MANIFESTS
) $(PERLNV_MANIFESTS
) \
167 $(RUBYV_MANIFESTS
) $(RUBYNV_MANIFESTS
) \
168 $(NORUBY_MANIFESTS
) $(HISTORICAL_MANIFESTS
)
170 GENERATED
= $(MANIFEST_BASE
)-generated
171 COMBINED
= $(MANIFEST_BASE
)-combined
172 MANIFESTS
= $(VERSIONED_MANIFESTS
:%=$(MANIFEST_BASE
)-%)
175 DEPENDED
=$(VERSIONED_MANIFESTS
:%.p5m
=$(MANIFEST_BASE
)-%.depend
)
176 RESOLVED
=$(VERSIONED_MANIFESTS
:%.p5m
=$(MANIFEST_BASE
)-%.depend.res
)
177 PUBLISHED
=$(RESOLVED
:%.depend.res
=%.published
)
179 COPYRIGHT_FILE ?
= $(COMPONENT_NAME
)-$(COMPONENT_VERSION
).copyright
180 IPS_COMPONENT_VERSION ?
= $(COMPONENT_VERSION
)
186 # allow publishing to be overridden, such as when
187 # a package is for one architecture only.
188 PUBLISH_STAMP ?
= $(BUILD_DIR
)/.published-
$(MACH
)
190 publish
: build
install $(PUBLISH_STAMP
)
192 sample-manifest
: $(GENERATED
).p5m
194 $(GENERATED
).p5m
: install
195 $(PKGSEND
) generate
$(PKG_HARDLINKS
:%=--target
%) $(PROTO_DIR
) | \
196 $(PKGMOGRIFY
) $(PKG_OPTIONS
) /dev
/fd
/0 $(GENERATE_TRANSFORMS
) | \
197 sed
-e
'/^$$/d' -e
'/^#.*$$/d' |
$(PKGFMT
) | \
198 cat
$(METADATA_TEMPLATE
) - >$@
200 # copy the canonical manifest(s) to the build tree
201 $(MANIFEST_BASE
)-%.generate
: %.p5m canonical-manifests
202 cat
$(METADATA_TEMPLATE
) $< >$@
204 # The text of a transform that will emit a dependency conditional on the
205 # presence of a particular version of a runtime, which will then draw in the
206 # runtime-version-specific version of the package we're operating on. $(1) is
207 # the name of the runtime package, and $(2) is the version suffix.
209 echo
"<transform set name=pkg.fmri value=(?:pkg:/)?(.+)-\#\#\#@(.*)" \
210 "-> emit depend nodrop=true type=conditional" \
211 "predicate=$(1)-$(2) fmri=%<1>-$(2)@%<2>>" >> $@
;
213 # Define and execute a macro that generates a rule to create a manifest for a
214 # python module specific to a particular version of the python runtime.
215 define python-manifest-rule
216 $(MANIFEST_BASE
)-%-$(shell echo
$(1) | tr
-d .
).p5m
: %-PYVER.p5m
217 $(PKGMOGRIFY
) -D PYVER
=$(1) -D PYV
=$(shell echo
$(1) | tr
-d .
) $$< > $$@
219 $(foreach ver
,$(PYTHON_VERSIONS
),$(eval
$(call python-manifest-rule
,$(ver
))))
221 # A rule to create a helper transform package for python, that will insert the
222 # appropriate conditional dependencies into a python library's
223 # runtime-version-generic package to pull in the version-specific bits when the
224 # corresponding version of python is on the system.
225 $(WS_TOP
)/transforms
/mkgeneric-python
: $(WS_TOP
)/make-rules
/shared-macros.mk
227 $(foreach ver
,$(shell echo
$(PYTHON_VERSIONS
) | tr
-d .
), \
228 $(call mkgeneric
,runtime
/python
,$(ver
)))
230 # Build Python version-wrapping manifests from the generic version.
231 $(MANIFEST_BASE
)-%.p5m
: %-PYVER.p5m
$(WS_TOP
)/transforms
/mkgeneric-python
232 $(PKGMOGRIFY
) -D PYV
=### $(WS_TOP)/transforms/mkgeneric-python \
233 $(WS_TOP
)/transforms
/mkgeneric
$< > $@
234 if
[ -f
$*-GENFRAG.p5m
]; then cat
$*-GENFRAG.p5m
>> $@
; fi
236 # Define and execute a macro that generates a rule to create a manifest for a
237 # perl module specific to a particular version of the perl runtime.
238 define perl-manifest-rule
239 $(MANIFEST_BASE
)-%-$(shell echo
$(1) | tr
-d .
).p5m
: %-PERLVER.p5m
240 $(PKGMOGRIFY
) -D PERLVER
=$(1) -D PLV
=$(shell echo
$(1) | tr
-d .
) \
241 -D PERL_ARCH
=$(call PERL_ARCH_FUNC
,$(PERL.
$(1))) $$< > $$@
243 $(foreach ver
,$(PERL_VERSIONS
),$(eval
$(call perl-manifest-rule
,$(ver
))))
245 # A rule to create a helper transform package for perl, that will insert the
246 # appropriate conditional dependencies into a perl library's
247 # runtime-version-generic package to pull in the version-specific bits when the
248 # corresponding version of perl is on the system.
249 $(WS_TOP
)/transforms
/mkgeneric-perl
: $(WS_TOP
)/make-rules
/shared-macros.mk
251 $(foreach ver
,$(shell echo
$(PERL_VERSIONS
) | tr
-d .
), \
252 $(call mkgeneric
,runtime
/perl
,$(ver
)))
254 # Build Perl version-wrapping manifests from the generic version.
255 $(MANIFEST_BASE
)-%.p5m
: %-PERLVER.p5m
$(WS_TOP
)/transforms
/mkgeneric-perl
256 $(PKGMOGRIFY
) -D PLV
=### $(WS_TOP)/transforms/mkgeneric-perl \
257 $(WS_TOP
)/transforms
/mkgeneric
$< > $@
258 if
[ -f
$*-GENFRAG.p5m
]; then cat
$*-GENFRAG.p5m
>> $@
; fi
260 # Rule to generate historical manifests from the $(HISTORY) file.
261 define history-manifest-rule
262 $(MANIFEST_BASE
)-$(1): $(HISTORY
) $(BUILD_DIR
)
263 $(NAWK
) -v TARGET
=$(1) -v FUNCTION
=manifest
-f
$(GENERATE_HISTORY
) < \
266 $(foreach mfst
,$(HISTORICAL_MANIFESTS
),$(eval
$(call history-manifest-rule
,$(mfst
))))
268 # Define and execute a macro that generates a rule to create a manifest for a
269 # ruby module specific to a particular version of the ruby runtime.
270 # Creates build/manifest-*-modulename-##.p5m file where ## is replaced with
271 # the version number.
272 define ruby-manifest-rule
273 $(MANIFEST_BASE
)-%-$(shell echo
$(1) | tr
-d .
).mogrified
: \
274 PKG_MACROS
+= RUBY_VERSION
=$(1) RUBY_LIB_VERSION
=$(2) \
275 RUBYV
=$(subst .
,,$(1))
277 $(MANIFEST_BASE
)-%-$(shell echo
$(1) | tr
-d .
).p5m
: %-RUBYVER.p5m
278 if
[ -f
$$*-$(shell echo
$(1) | tr
-d .
)GENFRAG.p5m
]; then \
279 cat
$$*-$(shell echo
$(1) | tr
-d .
)GENFRAG.p5m
>> $$@
; \
281 $(PKGMOGRIFY
) -D RUBY_VERSION
=$(1) -D RUBY_LIB_VERSION
=$(2) \
282 -D RUBYV
=$(shell echo
$(1) | tr
-d .
) $$< > $$@
284 $(foreach ver
,$(RUBY_VERSIONS
),\
285 $(eval
$(call ruby-manifest-rule
,$(shell echo
$(ver
) | \
286 cut
-d.
-f1
,2),$(ver
))))
288 # A rule to create a helper transform package for ruby, that will insert the
289 # appropriate conditional dependencies into a ruby library's
290 # runtime-version-generic package to pull in the version-specific bits when the
291 # corresponding version of ruby is on the system.
292 $(BUILD_DIR
)/mkgeneric-ruby
: $(WS_TOP
)/make-rules
/shared-macros.mk
294 $(foreach ver
,$(RUBY_VERSIONS
),\
295 $(call mkgeneric
,runtime
/ruby
,$(shell echo
$(ver
) | \
296 cut
-d.
-f1
,2 | tr
-d .
)))
298 # Build Ruby version-wrapping manifests from the generic version.
299 # Creates build/manifest-*-modulename.p5m file.
301 $(MANIFEST_BASE
)-%.p5m
: %-RUBYVER.p5m
$(BUILD_DIR
)/mkgeneric-ruby
302 $(PKGMOGRIFY
) -D RUBYV
=### $(BUILD_DIR)/mkgeneric-ruby \
303 $(WS_TOP
)/transforms
/mkgeneric
$< > $@
304 if
[ -f
$*-GENFRAG.p5m
]; then cat
$*-GENFRAG.p5m
>> $@
; fi
306 ifeq ($(strip $(COMPONENT_AUTOGEN_MANIFEST
)),yes
)
307 # auto-generate file/directory list
308 $(MANIFEST_BASE
)-%.generated
: %.p5m
$(BUILD_DIR
)
309 (cat
$(METADATA_TEMPLATE
); \
310 $(PKGSEND
) generate
$(PKG_HARDLINKS
:%=--target
%) $(PROTO_DIR
)) | \
311 $(PKGMOGRIFY
) $(PKG_OPTIONS
) /dev
/fd
/0 $(AUTOGEN_MANIFEST_TRANSFORMS
) | \
312 sed
-e
'/^$$/d' -e
'/^#.*$$/d' |
$(PKGFMT
) | \
315 # mogrify non-parameterized manifests
316 $(MANIFEST_BASE
)-%.mogrified
: %.generated
317 $(PKGMOGRIFY
) $(PKG_OPTIONS
) $< \
318 $(PUBLISH_TRANSFORMS
) | \
319 sed
-e
'/^$$/d' -e
'/^#.*$$/d' | uniq
>$@
321 # mogrify parameterized manifests
322 $(MANIFEST_BASE
)-%.mogrified
: $(MANIFEST_BASE
)-%.generated
323 $(PKGMOGRIFY
) $(PKG_OPTIONS
) $< \
324 $(PUBLISH_TRANSFORMS
) | \
325 sed
-e
'/^$$/d' -e
'/^#.*$$/d' | uniq
>$@
327 # mogrify non-parameterized manifests
328 $(MANIFEST_BASE
)-%.mogrified
: %.p5m
$(BUILD_DIR
)
329 $(PKGMOGRIFY
) $(PKG_OPTIONS
) $< \
330 $(PUBLISH_TRANSFORMS
) | \
331 sed
-e
'/^$$/d' -e
'/^#.*$$/d' | uniq
>$@
333 # mogrify parameterized manifests
334 $(MANIFEST_BASE
)-%.mogrified
: $(MANIFEST_BASE
)-%.p5m
$(BUILD_DIR
)
335 $(PKGMOGRIFY
) $(PKG_OPTIONS
) $< \
336 $(PUBLISH_TRANSFORMS
) | \
337 sed
-e
'/^$$/d' -e
'/^#.*$$/d' | uniq
>$@
340 # mangle the file contents
341 $(BUILD_DIR
) $(MANGLED_DIR
):
344 PKGMANGLE_OPTIONS
= -D
$(MANGLED_DIR
) $(PKG_PROTO_DIRS
:%=-d
%)
345 $(MANIFEST_BASE
)-%.mangled
: $(MANIFEST_BASE
)-%.mogrified
$(MANGLED_DIR
)
346 $(PKGMANGLE
) $(PKGMANGLE_OPTIONS
) -m
$< >$@
348 # generate dependencies
349 PKGDEPEND_GENERATE_OPTIONS
= -m
$(PKG_PROTO_DIRS
:%=-d
%)
350 $(MANIFEST_BASE
)-%.depend
: $(MANIFEST_BASE
)-%.mangled
351 $(PKGDEPEND
) generate
$(PKGDEPEND_GENERATE_OPTIONS
) $< >$@
353 # These files should contain a list of packages that the component is known to
354 # depend on. Using resolve.deps is not required, but significantly speeds up
355 # the "pkg resolve" step.
356 # XXX existing pkg5 is too old for that
357 #EXTDEPFILES = $(wildcard $(sort $(addsuffix ../resolve.deps, $(dir $(DEPENDED)))))
359 # This is a target that should only be run by hand, and not something that
360 # .resolved-$(MACH) should depend on.
362 echo
"<transform depend type=(require|require-any) -> print %(fmri)>" > rd-trans
363 for i in build
/*.depend
; do \
364 $(PKGMOGRIFY
) -O
/dev
/null
$$i rd-trans | tr
" " "\n" |
sort -u
> m1
; \
365 $(PKGMOGRIFY
) -O
/dev
/null
$$i.res rd-trans | tr
" " "\n" |
sort -u
> m2
; \
367 done | sed
-e
's/@[^ ]*//g' -e
's,pkg:/,,g' |
sort -u
> resolve.deps
369 if
[[ ! -s resolve.deps
]]; then \
370 echo
"No computed dependencies found; removing empty resolve.deps."; \
371 $(RM
) resolve.deps
; \
375 # resolve the dependencies all at once
376 $(BUILD_DIR
)/.resolved-
$(MACH
): $(DEPENDED
)
377 $(PKGDEPEND
) resolve
$(EXTDEPFILES
:%=-e
%) -m
$(DEPENDED
)
381 # Generate a set of REQUIRED_PACKAGES based on what is needed to for pkgdepend
382 # to resolve properly. Automatically append this to your Makefile for the truly
383 # lazy among us. This is only a piece of the REQUIRED_PACKAGES puzzle.
384 # You must still include packages for tools you build and test with.
386 REQUIRED_PACKAGES
:: $(RESOLVED
)
387 $(GMAKE
) RESOLVE_DEPS
= $(BUILD_DIR
)/.resolved-
$(MACH
)
388 @echo
"# Auto-generated contents below. Please manually verify and remove this comment" >>Makefile
389 @
$(PKGMOGRIFY
) $(WS_TRANSFORMS
)/$@
$(RESOLVED
) | \
390 $(GSED
) -e
'/^[\t ]*$$/d' -e
'/^#/d' |
sort -u
>>Makefile
391 @echo
"*** Please edit your Makefile and verify the new content at the end ***"
394 # lint the manifests all at once
395 $(BUILD_DIR
)/.linted-
$(MACH
): $(BUILD_DIR
)/.resolved-
$(MACH
)
396 @echo
"VALIDATING MANIFEST CONTENT: $(RESOLVED)"
397 $(ENV
) PYTHONPATH
=$(WS_TOOLS
)/python PROTO_PATH
="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV
)\
398 $(PKGLINT
) $(CANONICAL_REPO
:%=-c
$(WS_LINT_CACHE
)) \
399 -f
$(WS_TOOLS
)/pkglintrc
$(RESOLVED
)
403 @echo
"VALIDATING MANIFEST CONTENT: $(RESOLVED)"
404 $(ENV
) PYTHONPATH
=$(WS_TOOLS
)/python PROTO_PATH
="$(PKG_PROTO_DIRS)" $(COMPONENT_PKGLINT_ENV
)\
405 $(PKGLINT
) $(CANONICAL_REPO
:%=-c
$(WS_LINT_CACHE
)) \
406 -f
$(WS_TOOLS
)/pkglintrc
$(RESOLVED
)
412 PKGSEND_PUBLISH_OPTIONS
= -s
$(WS_REPO
) publish
--fmri-in-manifest
413 PKGSEND_PUBLISH_OPTIONS
+= $(PKG_PROTO_DIRS
:%=-d
%)
414 PKGSEND_PUBLISH_OPTIONS
+= -T \
*.py
415 $(MANIFEST_BASE
)-%.published
: $(MANIFEST_BASE
)-%.depend.res
$(BUILD_DIR
)/.linted-
$(MACH
)
416 $(PKGSEND
) $(PKGSEND_PUBLISH_OPTIONS
) $<
419 $(BUILD_DIR
)/.published-
$(MACH
): $(PUBLISHED
)
422 print-package-names
: canonical-manifests
423 @cat
$(VERSIONED_MANIFESTS
) $(WS_TOP
)/transforms
/print-pkgs | \
424 $(PKGMOGRIFY
) $(PKG_OPTIONS
) /dev
/fd
/0 | \
425 sed
-e
'/^$$/d' -e
'/^#.*$$/d' |
sort -u
427 print-package-paths
: canonical-manifests
428 @cat
$(VERSIONED_MANIFESTS
) $(WS_TOP
)/transforms
/print-paths | \
429 $(PKGMOGRIFY
) $(PKG_OPTIONS
) /dev
/fd
/0 | \
430 sed
-e
'/^$$/d' -e
'/^#.*$$/d' |
sort -u
432 install-packages
: publish
433 @if
[ $(IS_GLOBAL_ZONE
) = 0 -o x
$(ROOT
) != x
]; then \
434 cat
$(VERSIONED_MANIFESTS
) $(WS_TOP
)/transforms
/print-paths | \
435 $(PKGMOGRIFY
) $(PKG_OPTIONS
) /dev
/fd
/0 | \
436 sed
-e
'/^$$/d' -e
'/^#.*$$/d' -e
's;/;;' |
sort -u | \
437 (cd
$(PROTO_DIR
) ; pfexec
/bin
/cpio
-dump
$(ROOT
)) ; \
439 echo
"unsafe to install package(s) automatically" ; \
444 canonical-manifests
: $(CANONICAL_MANIFESTS
) Makefile
$(PATCHES
)
445 ifeq ($(strip $(CANONICAL_MANIFESTS
)),)
446 # If there were no canonical manifests in the workspace, nothing will
447 # be published and we should fail. A sample manifest can be generated
449 # $ gmake sample-manifest
450 # Once created, it will need to be reviewed, edited, and added to the
452 $(error Missing canonical manifest
(s
))
455 # This converts required paths to containing package names for be able to
456 # properly setup the build environment for a component.
457 required-pkgs.mk
: Makefile
458 @echo
"generating $@ from Makefile REQUIRED_* data"
459 @pkg search
-H
-l
'<$(DEPENDS:%=% OR) /bin/true>' \
460 | sed
-e
's/pkg:\/\(.*\)@.*/REQUIRED_PKGS += \1/g' >$@
462 pre-prep
: required-pkgs.mk
465 CLEAN_PATHS
+= required-pkgs.mk