Print this page
6574 Package print/lp/ipp/ipp-listener disappears when ENABLE_IPP_PRINTING is undefined
Split |
Close |
Expand all |
Collapse all |
--- old/usr/src/pkg/Makefile
+++ new/usr/src/pkg/Makefile
1 1 #
2 2 # CDDL HEADER START
3 3 #
4 4 # The contents of this file are subject to the terms of the
5 5 # Common Development and Distribution License (the "License").
6 6 # You may not use this file except in compliance with the License.
7 7 #
8 8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 9 # or http://www.opensolaris.org/os/licensing.
10 10 # See the License for the specific language governing permissions
11 11 # and limitations under the License.
12 12 #
13 13 # When distributing Covered Code, include this CDDL HEADER in each
14 14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
↓ open down ↓ |
14 lines elided |
↑ open up ↑ |
15 15 # If applicable, add the following below this CDDL HEADER, with the
16 16 # fields enclosed by brackets "[]" replaced with your own identifying
17 17 # information: Portions Copyright [yyyy] [name of copyright owner]
18 18 #
19 19 # CDDL HEADER END
20 20 #
21 21
22 22 #
23 23 # Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
24 24 # Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved.
25 +# Copyright 2016 Gary Mills
25 26 #
26 27
27 28 include $(SRC)/Makefile.master
28 29 include $(SRC)/Makefile.buildnum
29 30
30 31 #
31 32 # Make sure we're getting a consistent execution environment for the
32 33 # embedded scripts.
33 34 #
34 35 SHELL= /usr/bin/ksh93
35 36
36 37 #
37 38 # To suppress package dependency generation on any system, regardless
38 39 # of how it was installed, set SUPPRESSPKGDEP=true in the build
39 40 # environment.
40 41 #
41 42 SUPPRESSPKGDEP= false
42 43
43 44 #
44 45 # Comment this line out or set "PKGDEBUG=" in your build environment
45 46 # to get more verbose output from the make processes in usr/src/pkg
46 47 #
47 48 PKGDEBUG= @
48 49
49 50 #
50 51 # Cross platform packaging notes
51 52 #
52 53 # By default, we package the proto area from the same architecture as
53 54 # the packaging build. In other words, if you're running nightly or
54 55 # bldenv on an x86 platform, it will take objects from the x86 proto
55 56 # area and use them to create x86 repositories.
56 57 #
57 58 # If you want to create repositories for an architecture that's
58 59 # different from $(uname -p), you do so by setting PKGMACH in your
59 60 # build environment.
60 61 #
61 62 # For this to work correctly, the following must all happen:
62 63 #
63 64 # 1. You need the desired proto area, which you can get either by
64 65 # doing a gatekeeper-style build with the -U option to
65 66 # nightly(1), or by using rsync. If you don't do this, you will
66 67 # get packaging failures building all packages, because pkgsend
67 68 # is unable to find the required binaries.
68 69 # 2. You need the desired tools proto area, which you can get in the
69 70 # same ways as the normal proto area. If you don't do this, you
70 71 # will get packaging failures building onbld, because pkgsend is
71 72 # unable to find the tools binaries.
72 73 # 3. The remainder of this Makefile should never refer directly to
73 74 # $(MACH). Instead, $(PKGMACH) should be used whenever an
74 75 # architecture-specific path or token is needed. If this is done
75 76 # incorrectly, then packaging will fail, and you will see the
76 77 # value of $(uname -p) instead of the value of $(PKGMACH) in the
77 78 # commands that fail.
78 79 # 4. Each time a rule in this Makefile invokes $(MAKE), it should
79 80 # pass PKGMACH=$(PKGMACH) explicitly on the command line. If
80 81 # this is done incorrectly, then packaging will fail, and you
81 82 # will see the value of $(uname -p) instead of the value of
82 83 # $(PKGMACH) in the commands that fail.
83 84 #
84 85 # Refer also to the convenience targets defined later in this
85 86 # Makefile.
86 87 #
87 88 PKGMACH= $(MACH)
88 89
89 90 #
90 91 # ROOT, TOOLS_PROTO, and PKGARCHIVE should be set by nightly or
91 92 # bldenv. These macros translate them into terms of $PKGMACH, instead
92 93 # of $ARCH.
93 94 #
94 95 PKGROOT.cmd= print $(ROOT) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
95 96 PKGROOT= $(PKGROOT.cmd:sh)
96 97 TOOLSROOT.cmd= print $(TOOLS_PROTO) | sed -e s:/root_$(MACH):/root_$(PKGMACH):
97 98 TOOLSROOT= $(TOOLSROOT.cmd:sh)
98 99 PKGDEST.cmd= print $(PKGARCHIVE) | sed -e s:/$(MACH)/:/$(PKGMACH)/:
99 100 PKGDEST= $(PKGDEST.cmd:sh)
100 101
101 102 EXCEPTIONS= packaging
102 103
103 104 PKGMOGRIFY= pkgmogrify
104 105
105 106 #
106 107 # Always build the redistributable repository, but only build the
107 108 # nonredistributable bits if we have access to closed source.
108 109 #
109 110 # Some objects that result from the closed build are still
110 111 # redistributable, and should be packaged as part of an open-only
111 112 # build. Access to those objects is provided via the closed-bins
112 113 # tarball. See usr/src/tools/scripts/bindrop.sh for details.
113 114 #
114 115 REPOS= redist
115 116
116 117 #
117 118 # The packages directory will contain the processed manifests as
118 119 # direct build targets and subdirectories for package metadata extracted
119 120 # incidentally during manifest processing.
120 121 #
121 122 # Nothing underneath $(PDIR) should ever be managed by SCM.
122 123 #
123 124 PDIR= packages.$(PKGMACH)
124 125
125 126 #
126 127 # The tools proto must be specified for dependency generation.
127 128 # Publication from the tools proto area is managed in the
128 129 # publication rule.
129 130 #
130 131 $(PDIR)/developer-build-onbld.dep:= PKGROOT= $(TOOLSROOT)
131 132
132 133 PKGPUBLISHER= $(PKGPUBLISHER_REDIST)
133 134
134 135 #
135 136 # To get these defaults, manifests should simply refer to $(PKGVERS).
136 137 #
137 138 PKGVERS_COMPONENT= 0.$(RELEASE)
138 139 PKGVERS_BUILTON= $(RELEASE)
139 140 PKGVERS_BRANCH= 0.$(ONNV_BUILDNUM)
140 141 PKGVERS= $(PKGVERS_COMPONENT),$(PKGVERS_BUILTON)-$(PKGVERS_BRANCH)
141 142
142 143 #
143 144 # The ARCH32 and ARCH64 macros are used in the manifests to express
144 145 # architecture-specific subdirectories in the installation paths
145 146 # for isaexec'd commands.
146 147 #
147 148 # We can't simply use $(MACH32) and $(MACH64) here, because they're
148 149 # only defined for the build architecture. To do cross-platform
149 150 # packaging, we need both values.
150 151 #
151 152 i386_ARCH32= i86
152 153 sparc_ARCH32= sparcv7
153 154 i386_ARCH64= amd64
154 155 sparc_ARCH64= sparcv9
155 156
156 157 #
157 158 # macros and transforms needed by pkgmogrify
158 159 #
159 160 # If you append to this list using target-specific assignments (:=),
160 161 # be very careful that the targets are of the form $(PDIR)/pkgname. If
161 162 # you use a higher level target, or a package list, you'll trigger a
162 163 # complete reprocessing of all manifests because they'll fail command
163 164 # dependency checking.
164 165 #
165 166 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
166 167 extract_metadata
167 168 PM_INC= transforms manifests
168 169
169 170 PKGMOG_DEFINES= \
170 171 i386_ONLY=$(POUND_SIGN) \
171 172 sparc_ONLY=$(POUND_SIGN) \
172 173 $(PKGMACH)_ONLY= \
173 174 ARCH=$(PKGMACH) \
174 175 ARCH32=$($(PKGMACH)_ARCH32) \
175 176 ARCH64=$($(PKGMACH)_ARCH64) \
176 177 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
177 178 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
178 179 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
179 180 PKGVERS=$(PKGVERS) \
180 181 PERL_ARCH=$(PERL_ARCH) \
181 182 PERL_VERSION=$(PERL_VERSION) \
182 183 PERL_PKGVERS=$(PERL_PKGVERS)
183 184
184 185 PKGDEP_TOKENS_i386= \
185 186 'PLATFORM=i86hvm' \
186 187 'PLATFORM=i86pc' \
187 188 'PLATFORM=i86xpv' \
188 189 'ISALIST=amd64' \
189 190 'ISALIST=i386'
190 191 PKGDEP_TOKENS_sparc= \
191 192 'PLATFORM=sun4u' \
192 193 'PLATFORM=sun4v' \
193 194 'ISALIST=sparcv9' \
194 195 'ISALIST=sparc'
195 196 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
196 197
197 198 #
198 199 # The package lists are generated with $(PKGDEP_TYPE) as their
199 200 # dependency types, so that they can be included by either an
200 201 # incorporation or a group package.
201 202 #
202 203 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
↓ open down ↓ |
168 lines elided |
↑ open up ↑ |
203 204 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
204 205
205 206 PKGDEP_INCORP= \
206 207 depend fmri=consolidation/osnet/osnet-incorporation type=require
207 208
208 209 #
209 210 # All packaging build products should go into $(PDIR), so they don't
210 211 # need to be included separately in CLOBBERFILES.
211 212 #
212 213 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH) install-$(PKGMACH).out \
213 - license-list
214 + $(DYN_MANI) license-list
214 215
215 216 #
216 217 # By default, PKGS will list all manifests. To build and/or publish a
217 218 # subset of packages, override this on the command line or in the
218 219 # build environment and then reference (implicitly or explicitly) the all
219 220 # or install targets. Using ls -1 (that's a one) or print or echo to
220 221 # get the list of manifests is a little hackish, but avoids having a
221 222 # 900+ line file to explicitly list them all.
222 223 #
223 -# We want some manifests to optionally built based on environment
224 -# options, so those are excluded and optionally added back in.
225 -# We also want a relatively easy way to add files to the list of
226 -# manifests given special treatment. Add any other special ones
227 -# to the SPECIAL_MANIFESTS vaiable. It can contain wildcards in
228 -# regexp form, i.e. SUNW.* as one useful example.
224 +
229 225 #
230 -SPECIAL_MANIFESTS = print-lp-ipp-ipp-listener.mf
226 +# Special manifests are symbolic links to real manifests with
227 +# either *.mf.obs or *.mf.cur names, depending on the value of
228 +# the ENABLE_IPP_PRINTING macro. They are excluded from the
229 +# MANIFESTS macro because they may not exist when it is set,
230 +# but are added unconditionally on the next line.
231 +#
232 +
233 +SPECIAL_MANIFESTS = SUNWippl.mf print-lp-ipp-ipp-listener.mf
234 +DYN_MANI = $(SPECIAL_MANIFESTS:%=manifests/%)
231 235 LIST_MANIFESTS_CMD = (cd manifests ; /usr/bin/ls -1 *.mf |\
232 236 $(SED) $(SPECIAL_MANIFESTS:%=-e '/^%$$/d') )
233 237 MANIFESTS = $(LIST_MANIFESTS_CMD:sh)
238 +MANIFESTS += $(SPECIAL_MANIFESTS)
234 239
235 -# Conditionally add back lp-ipp
236 -$(ENABLE_IPP_PRINTING) MANIFESTS += print-lp-ipp-ipp-listener.mf
237 -
238 240 PKGS= $(MANIFESTS:%.mf=%)
239 241 DEP_PKGS= $(PKGS:%=$(PDIR)/%.dep)
240 242 PROC_PKGS= $(PKGS:%=$(PDIR)/%.mog)
241 243
242 244 #
243 245 # Track the synthetic manifests separately so we can properly express
244 246 # build rules and dependencies. The synthetic and real packages use
245 247 # different sets of transforms and macros for pkgmogrify.
246 248 #
247 249 SYNTH_PKGS= osnet-incorporation osnet-redist
248 250 DEP_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.dep)
249 251 PROC_SYNTH_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.mog)
250 252
251 253 #
252 254 # Root of pkg image to use for dependency resolution
253 255 # Normally / on the machine used to build the binaries
254 256 #
255 257 PKGDEP_RESOLVE_IMAGE = /
256 258
257 259 #
258 260 # For each package, we determine the target repository based on
259 261 # manifest-embedded metadata. Because we make that determination on
260 262 # the fly, the publication target cannot be expressed as a
261 263 # subdirectory inside the unknown-by-the-makefile target repository.
262 264 #
263 265 # In order to limit the target set to real files in known locations,
264 266 # we use a ".pub" file in $(PDIR) for each processed manifest, regardless
265 267 # of content or target repository.
266 268 #
267 269 PUB_PKGS= $(SYNTH_PKGS:%=$(PDIR)/%.pub) $(PKGS:%=$(PDIR)/%.pub)
268 270
269 271 #
270 272 # Any given repository- and status-specific package list may be empty,
271 273 # but we can only determine that dynamically, so we always generate all
272 274 # lists for each repository we're building.
273 275 #
274 276 # The meanings of each package status are as follows:
275 277 #
276 278 # PKGSTAT meaning
277 279 # ---------- ----------------------------------------------------
278 280 # noincorp Do not include in incorporation or group package
279 281 # obsolete Include in incorporation, but not group package
280 282 # renamed Include in incorporation, but not group package
281 283 # current Include in incorporation and group package
282 284 #
283 285 # Since the semantics of the "noincorp" package status dictate that
284 286 # such packages are not included in the incorporation or group packages,
285 287 # there is no need to build noincorp package lists.
286 288 #
287 289 PKGLISTS= \
288 290 $(REPOS:%=$(PDIR)/packages.%.current) \
289 291 $(REPOS:%=$(PDIR)/packages.%.renamed) \
290 292 $(REPOS:%=$(PDIR)/packages.%.obsolete)
291 293
292 294 .KEEP_STATE:
293 295
294 296 .PARALLEL: $(PKGS) $(PROC_PKGS) $(DEP_PKGS) \
295 297 $(PROC_SYNTH_PKGS) $(DEP_SYNTH_PKGS) $(PUB_PKGS)
296 298
297 299 #
298 300 # For a single manifest, the dependency chain looks like this:
299 301 #
300 302 # raw manifest (mypkg.mf)
301 303 # |
302 304 # | use pkgmogrify to process raw manifest
303 305 # |
304 306 # processed manifest (mypkg.mog)
305 307 # |
306 308 # * | use pkgdepend generate to generate dependencies
307 309 # |
308 310 # manifest with TBD dependencies (mypkg.dep)
309 311 # |
310 312 # % | use pkgdepend resolve to resolve dependencies
311 313 # |
312 314 # manifest with dependencies resolved (mypkg.res)
313 315 # |
314 316 # | use pkgsend to publish the package
315 317 # |
316 318 # placeholder to indicate successful publication (mypkg.pub)
317 319 #
318 320 # * This may be suppressed via SUPPRESSPKGDEP. The resulting
319 321 # packages will install correctly, but care must be taken to
320 322 # install all dependencies, because pkg will not have the input
321 323 # it needs to determine this automatically.
322 324 #
323 325 # % This is included in this diagram to make the picture complete, but
324 326 # this is a point of synchronization in the build process.
325 327 # Dependency resolution is actually done once on the entire set of
326 328 # manifests, not on a per-package basis.
327 329 #
328 330 # The full dependency chain for generating everything that needs to be
329 331 # published, without actually publishing it, looks like this:
330 332 #
331 333 # processed synthetic packages
332 334 # | |
333 335 # package lists synthetic package manifests
334 336 # |
335 337 # processed real packages
336 338 # | |
337 339 # package dir real package manifests
338 340 #
339 341 # Here, each item is a set of real or synthetic packages. For this
340 342 # portion of the build, no reference is made to the proto area. It is
341 343 # therefore suitable for the "all" target, as opposed to "install."
342 344 #
343 345 # Since each of these steps is expressed explicitly, "all" need only
344 346 # depend on the head of the chain.
345 347 #
346 348 # From the end of manifest processing, the publication dependency
347 349 # chain looks like this:
348 350 #
349 351 # repository metadata (catalogs and search indices)
350 352 # |
351 353 # | pkgrepo refresh
352 354 # |
353 355 # published packages
354 356 # | |
355 357 # | | pkgsend publish
356 358 # | |
357 359 # repositories resolved dependencies
↓ open down ↓ |
110 lines elided |
↑ open up ↑ |
358 360 # | |
359 361 # pkgsend | | pkgdepend resolve
360 362 # create-repository |
361 363 # | generated dependencies
362 364 # repo directories |
363 365 # | pkgdepend
364 366 # |
365 367 # processed manifests
366 368 #
367 369
368 -ALL_TARGETS= $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
370 +ALL_TARGETS= $(DYN_MANI) $(PROC_SYNTH_PKGS) proto_list_$(PKGMACH)
369 371
370 372 all: $(ALL_TARGETS)
371 373
372 374 #
375 +# Rule to create symlinks to *.mf.obs or *.mf.cur for special manifests
376 +# Also removes the previous special manifest
377 +#
378 +DYN_TYP = obs
379 +$(ENABLE_IPP_PRINTING) DYN_TYP = cur
380 +$(DYN_MANI): $$(@).$(DYN_TYP)
381 + $(RM) $(@)
382 + $(SYMLINK) $(@F).$(DYN_TYP) $(@)
383 +
384 +#
373 385 # This will build the directory to contain the processed manifests
374 386 # and the metadata symlinks.
375 387 #
376 388 $(PDIR):
377 389 @print "Creating $(@)"
378 390 $(PKGDEBUG)$(INS.dir)
379 391
380 392 #
381 393 # This rule resolves dependencies across all published manifests.
382 394 #
383 395 # We shouldn't have to ignore the error from pkgdepend, but until
384 396 # 16012 and its dependencies are resolved, pkgdepend will always exit
385 397 # with an error.
386 398 #
387 399 $(PDIR)/gendeps: $(DEP_SYNTH_PKGS) $(DEP_PKGS)
388 400 -$(PKGDEBUG)if [ "$(SUPPRESSPKGDEP)" = "true" ]; then \
389 401 print "Suppressing dependency resolution"; \
390 402 for p in $(DEP_PKGS:%.dep=%); do \
391 403 $(CP) $$p.dep $$p.res; \
392 404 done; \
393 405 else \
394 406 print "Resolving dependencies"; \
395 407 pkgdepend -R $(PKGDEP_RESOLVE_IMAGE) resolve \
396 408 -m $(DEP_SYNTH_PKGS) $(DEP_PKGS); \
397 409 for p in $(DEP_SYNTH_PKGS:%.dep=%) $(DEP_PKGS:%.dep=%); do \
398 410 if [ "$$(print $$p.metadata.*)" = \
399 411 "$$(print $$p.metadata.noincorp.*)" ]; \
400 412 then \
401 413 print "Removing dependency versions from $$p"; \
402 414 $(PKGMOGRIFY) $(PKGMOG_VERBOSE) \
403 415 -O $$p.res -I transforms \
404 416 strip_versions $$p.dep.res; \
405 417 $(RM) $$p.dep.res; \
406 418 else \
407 419 $(MV) $$p.dep.res $$p.res; \
408 420 fi; \
409 421 done; \
410 422 fi
411 423 $(PKGDEBUG)$(TOUCH) $(@)
412 424
413 425 install: $(ALL_TARGETS) repository-metadata
414 426
415 427 repository-metadata: publish_pkgs
416 428 $(PKGDEBUG)for r in $(REPOS); do \
417 429 pkgrepo refresh -s $(PKGDEST)/repo.$$r; \
418 430 done
419 431
420 432 #
421 433 # Since we create zero-length processed manifests for a graceful abort
422 434 # from pkgmogrify, we need to detect that here and make no effort to
423 435 # publish the package.
424 436 #
425 437 # For all other packages, we publish them regardless of status. We
426 438 # derive the target repository as a component of the metadata-derived
427 439 # symlink for each package.
428 440 #
429 441 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
430 442
431 443 #
432 444 # Before publishing, we want to pull the license files from $CODEMGR_WS
433 445 # into the proto area. This allows us to NOT pass $SRC (or
434 446 # $CODEMGR_WS) as a basedir for publication.
435 447 #
436 448 $(PUB_PKGS): stage-licenses
437 449
438 450 #
439 451 # Initialize the empty on-disk repositories
440 452 #
441 453 $(REPOS:%=$(PKGDEST)/repo.%):
442 454 @print "Initializing $(@F)"
443 455 $(PKGDEBUG)$(INS.dir)
444 456 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
445 457 --set-property publisher.prefix=$(PKGPUBLISHER)
446 458
447 459 #
448 460 # rule to process real manifests
449 461 #
450 462 # To allow redistributability and package status to change, we must
451 463 # remove not only the actual build target (the processed manifest), but
452 464 # also the incidental ones (the metadata-derived symlinks).
453 465 #
454 466 # If pkgmogrify exits cleanly but fails to create the specified output
455 467 # file, it means that it encountered an abort directive. That means
456 468 # that this package should not be published for this particular build
457 469 # environment. Since we can't prune such packages from $(PKGS)
458 470 # retroactively, we need to create an empty target file to keep make
459 471 # from trying to rebuild it every time. For these empty targets, we
460 472 # do not create metadata symlinks.
461 473 #
462 474 # Automatic dependency resolution to files is also done at this phase of
463 475 # processing. The skipped packages are skipped due to existing bugs
464 476 # in pkgdepend.
465 477 #
466 478 # The incorporation dependency is tricky: it needs to go into all
467 479 # current and renamed manifests (ie all incorporated packages), but we
468 480 # don't know which those are until after we run pkgmogrify. So
469 481 # instead of expressing it as a transform, we tack it on ex post facto.
470 482 #
471 483 # Implementation notes:
472 484 #
473 485 # - The first $(RM) must not match other manifests, or we'll run into
474 486 # race conditions with parallel manifest processing.
475 487 #
476 488 # - The make macros [ie $(MACRO)] are evaluated when the makefile is
477 489 # read in, and will result in a fixed, macro-expanded rule for each
478 490 # target enumerated in $(PROC_PKGS).
479 491 #
480 492 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule
481 493 # is executed. The results may only be referenced in the shell in
482 494 # which they are assigned, so from the perspective of make, all code
483 495 # that needs these variables needs to be part of the same line of
484 496 # code. Hence the use of command separators and line continuation
485 497 # characters.
486 498 #
487 499 # - The extract_metadata transforms are designed to spit out shell
488 500 # variable assignments to stdout. Those are published to the
489 501 # .vars temporary files, and then used as input to the eval
490 502 # statement. This is done in stages specifically so that pkgmogrify
491 503 # can signal failure if the manifest has a syntactic or other error.
492 504 # The eval statement should begin with the default values, and the
493 505 # output from pkgmogrify (if any) should be in the form of a
494 506 # variable assignment to override those defaults.
495 507 #
496 508 # - When this rule completes execution, it must leave an updated
497 509 # target file ($@) in place, or make will reprocess the package
498 510 # every time it encounters it as a dependency. Hence the "touch"
499 511 # statement to ensure that the target is created, even when
500 512 # pkgmogrify encounters an abort in the publish transforms.
501 513 #
502 514
503 515 .SUFFIXES: .mf .mog .dep .res .pub
504 516
505 517 $(PDIR)/%.mog: manifests/%.mf
506 518 @print "Processing manifest $(<F)"
507 519 @env PKGFMT_OUTPUT=v1 pkgfmt -c $<
508 520 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
509 521 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
510 522 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
511 523 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
512 524 $(<) $(PM_TRANSFORMS)
513 525 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
514 526 `$(CAT) -s $(@).vars`; \
515 527 if [ -f $(@) ]; then \
516 528 if [ "$$NODEPEND" != "false" ]; then \
517 529 $(TOUCH) $(@:%.mog=%.nodepend); \
518 530 fi; \
519 531 $(LN) -s $(@F) \
520 532 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
521 533 if [ \( "$$PKGSTAT" = "current" \) -o \
522 534 \( "$$PKGSTAT" = "renamed" \) ]; \
523 535 then print $(PKGDEP_INCORP) >> $(@); \
524 536 fi; \
525 537 print $$LICS > $(@:%.mog=%.lics); \
526 538 else \
527 539 $(TOUCH) $(@) $(@:%.mog=%.lics); \
528 540 fi
529 541 $(PKGDEBUG)$(RM) $(@).vars
530 542
531 543 $(PDIR)/%.dep: $(PDIR)/%.mog
532 544 @print "Generating dependencies for $(<F)"
533 545 $(PKGDEBUG)$(RM) $(@)
534 546 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
535 547 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
536 548 $(PKGROOT) > $(@); \
537 549 else \
538 550 $(CP) $(<) $(@); \
539 551 fi
540 552
541 553 #
542 554 # The full chain implies that there should be a .dep.res suffix rule,
543 555 # but dependency generation is done on a set of manifests, rather than
544 556 # on a per-manifest basis. Instead, see the gendeps rule above.
545 557 #
546 558
547 559 $(PDIR)/%.pub: $(PDIR)/%.res
548 560 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
549 561 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
550 562 if [ -s $(<) ]; then \
551 563 print "Publishing $(@F:%.pub=%) to $$r repository"; \
552 564 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
553 565 -d $(PKGROOT) -d $(TOOLSROOT) \
554 566 -d license_files -d $(PKGROOT)/licenses \
555 567 --fmri-in-manifest --no-index --no-catalog $(<) \
556 568 > /dev/null; \
557 569 fi; \
558 570 $(TOUCH) $(@);
559 571
560 572 #
561 573 # rule to build the synthetic manifests
562 574 #
563 575 # This rule necessarily has PKGDEP_TYPE that changes according to
564 576 # the specific synthetic manifest. Rather than escape command
565 577 # dependency checking for the real manifest processing, or failing to
566 578 # express the (indirect) dependency of synthetic manifests on real
567 579 # manifests, we simply split this rule out from the one above.
568 580 #
569 581 # The implementation notes from the previous rule are applicable
570 582 # here, too.
571 583 #
572 584 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
573 585 @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
574 586 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
575 587 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
576 588 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
577 589 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
578 590 $(PM_TRANSFORMS) synthetic
579 591 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
580 592 if [ -f $(@) ]; then \
581 593 $(LN) -s $(@F) \
582 594 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
583 595 else \
584 596 $(TOUCH) $(@); \
585 597 fi
586 598 $(PKGDEBUG)$(RM) $(@).vars
587 599
588 600 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
589 601 @print "Skipping dependency generation for $(@F:%.dep=%)"
590 602 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
591 603
592 604 clean:
593 605
594 606 clobber: clean
595 607 $(RM) -r $(CLOBBERFILES)
596 608
597 609 #
598 610 # This rule assumes that all links in the $PKGSTAT directories
599 611 # point to valid manifests, and will fail the make run if one
600 612 # does not contain an fmri.
601 613 #
602 614 # We do this in the BEGIN action instead of using pattern matching
603 615 # because we expect the fmri to be at or near the first line of each input
604 616 # file, and this way lets us avoid reading the rest of the file after we
605 617 # find what we need.
606 618 #
607 619 # We keep track of a failure to locate an fmri, so we can fail the
608 620 # make run, but we still attempt to process each package in the
609 621 # repo/pkgstat-specific subdir, in hopes of maybe giving some
610 622 # additional useful info.
611 623 #
612 624 # The protolist is used for bfu archive creation, which may be invoked
613 625 # interactively by the user. Both protolist and PKGLISTS targets
614 626 # depend on $(PROC_PKGS), but protolist builds them recursively.
615 627 # To avoid collisions, we insert protolist into the dependency chain
616 628 # here. This has two somewhat subtle benefits: it allows bfu archive
617 629 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
618 630 # and it ensures that a protolist file here will always correspond to the
619 631 # contents of the processed manifests, which can vary depending on build
620 632 # environment.
621 633 #
622 634 $(PKGLISTS): $(PROC_PKGS)
623 635 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \
624 636 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
625 637 print "Generating $$r $$s package list"; \
626 638 $(RM) $(@); $(TOUCH) $(@); \
627 639 $(NAWK) 'BEGIN { \
628 640 if (ARGC < 2) { \
629 641 exit; \
630 642 } \
631 643 retcode = 0; \
632 644 for (i = 1; i < ARGC; i++) { \
633 645 do { \
634 646 e = getline f < ARGV[i]; \
635 647 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \
636 648 close(ARGV[i]); \
637 649 if (e == 1) { \
638 650 l = split(f, a, "="); \
639 651 print "depend fmri=" a[l], \
640 652 "type=$$(PKGDEP_TYPE)"; \
641 653 } else { \
642 654 print "no fmri in " ARGV[i] >> "/dev/stderr"; \
643 655 retcode = 2; \
644 656 } \
645 657 } \
646 658 exit retcode; \
647 659 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
648 660 -name NOSUCHFILE \)` >> $(@)
649 661
650 662 #
651 663 # rules to validate proto area against manifests, check for safe
652 664 # file permission modes, and generate a faux proto list
653 665 #
654 666 # For the check targets, the dependencies on $(PROC_PKGS) is specified
655 667 # as a subordinate make process in order to suppress output.
656 668 #
657 669 makesilent:
658 670 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
659 671 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
660 672
661 673 #
662 674 # The .lics files were created during pkgmogrification, and list the
663 675 # set of licenses to pull from $SRC for each package. Because
664 676 # licenses may be duplicated between packages, we uniquify them as
665 677 # well as aggregating them here.
666 678 #
667 679 license-list: makesilent
668 680 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
669 681 do print $$l; done ) | sort -u > $@
670 682
671 683 #
672 684 # Staging the license and description files in the proto area allows
673 685 # us to do proper unreferenced file checking of both license and
674 686 # description files without blanket exceptions, and to pull license
675 687 # content without reference to $CODEMGR_WS during publication.
676 688 #
677 689 stage-licenses: license-list FRC
678 690 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
679 691 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
680 692 `$(NAWK) '{ \
681 693 print "$(PKGROOT)/licenses/" $$0; \
682 694 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
683 695 }' license-list` > /dev/null;
684 696
685 697 protocmp: makesilent
686 698 @validate_pkg -a $(PKGMACH) -v \
687 699 $(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \
688 700 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
689 701
690 702 pmodes: makesilent
691 703 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
692 704 -e $(CODEMGR_WS)/exception_lists/pmodes
693 705
694 706 check: protocmp pmodes
695 707
696 708 protolist: proto_list_$(PKGMACH)
697 709
698 710 proto_list_$(PKGMACH): $(PROC_PKGS)
699 711 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
700 712
701 713 $(PROC_PKGS): $(PDIR)
702 714
703 715 #
704 716 # This is a convenience target to allow package names to function as
705 717 # build targets. Generally, using it is only useful when iterating on
706 718 # development of a manifest.
707 719 #
708 720 # When processing a manifest, use the basename (without extension) of
709 721 # the package. When publishing, use the basename with a ".pub"
710 722 # extension.
711 723 #
712 724 # Other than during manifest development, the preferred usage is to
713 725 # avoid these targets and override PKGS on the make command line and
714 726 # use the provided all and install targets.
715 727 #
716 728 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
717 729
718 730 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
719 731
720 732 #
721 733 # This is a convenience target to resolve dependencies without publishing
722 734 # packages.
723 735 #
724 736 gendeps: $(PDIR)/gendeps
725 737
726 738 #
727 739 # These are convenience targets for cross-platform packaging. If you
728 740 # want to build any of "the normal" targets for a different
729 741 # architecture, simply use "arch/target" as your build target.
730 742 #
731 743 # Since the most common use case for this is "install," the architecture
732 744 # specific install targets have been further abbreviated to elide "/install."
733 745 #
734 746 i386/% sparc/%:
735 747 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
736 748
737 749 i386 sparc: $$(@)/install
738 750
739 751 FRC:
↓ open down ↓ |
357 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX