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