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