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