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