Print this page
3011 OPENSSL10_ONLY is evaluated over and over
Reviewed by: Jonathan Adams <t12nslookup@gmail.com>
Reviewed by: Gary Mills <gary_mills@fastmail.fm>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Reviewed by: Garrett D'Amore <garrett@damore.org>
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)
155 +# The form "MACRO :sh= COMMAND" ensures that the COMMAND is executed only once,
156 +# whereas with the form "MACRO = $(COMMAND:sh)" the COMMAND is executed
157 +# whenever the reference is evaluated.
158 +#
159 +# The form "MACRO :sh= COMMAND" does not substitue macros in COMMAND, so macros
160 +# defined in Makefile.master is not used here.
161 +OPENSSL10_ONLY :sh= /usr/bin/openssl version | \
162 + /usr/bin/nawk '{if($2<1){print "\043";}}'
158 163
159 164 #
160 165 # macros and transforms needed by pkgmogrify
161 166 #
162 167 # If you append to this list using target-specific assignments (:=),
163 168 # be very careful that the targets are of the form $(PDIR)/pkgname. If
164 169 # you use a higher level target, or a package list, you'll trigger a
165 170 # complete reprocessing of all manifests because they'll fail command
166 171 # dependency checking.
167 172 #
168 173 PM_TRANSFORMS= common_actions publish restart_fmri facets defaults \
169 174 extract_metadata
170 175 PM_INC= transforms manifests
171 176
172 177 PKGMOG_DEFINES= \
173 178 i386_ONLY=$(POUND_SIGN) \
174 179 sparc_ONLY=$(POUND_SIGN) \
175 180 OPENSSL10_ONLY=$(OPENSSL10_ONLY) \
176 181 $(PKGMACH)_ONLY= \
177 182 ARCH=$(PKGMACH) \
178 183 ARCH32=$($(PKGMACH)_ARCH32) \
179 184 ARCH64=$($(PKGMACH)_ARCH64) \
180 185 PKGVERS_COMPONENT=$(PKGVERS_COMPONENT) \
181 186 PKGVERS_BUILTON=$(PKGVERS_BUILTON) \
182 187 PKGVERS_BRANCH=$(PKGVERS_BRANCH) \
183 188 PKGVERS=$(PKGVERS)
184 189
185 190 PKGDEP_TOKENS_i386= \
186 191 'PLATFORM=i86hvm' \
187 192 'PLATFORM=i86pc' \
188 193 'PLATFORM=i86xpv' \
189 194 'ISALIST=amd64' \
190 195 'ISALIST=i386'
191 196 PKGDEP_TOKENS_sparc= \
192 197 'PLATFORM=sun4u' \
193 198 'PLATFORM=sun4v' \
194 199 'ISALIST=sparcv9' \
195 200 'ISALIST=sparc'
196 201 PKGDEP_TOKENS= $(PKGDEP_TOKENS_$(PKGMACH))
197 202
198 203 #
199 204 # The package lists are generated with $(PKGDEP_TYPE) as their
200 205 # dependency types, so that they can be included by either an
201 206 # incorporation or a group package.
202 207 #
203 208 $(PDIR)/osnet-redist.mog := PKGDEP_TYPE= require
204 209 $(PDIR)/osnet-incorporation.mog:= PKGDEP_TYPE= incorporate
205 210
206 211 PKGDEP_INCORP= \
207 212 depend fmri=consolidation/osnet/osnet-incorporation type=require
208 213
209 214 #
210 215 # All packaging build products should go into $(PDIR), so they don't
211 216 # need to be included separately in CLOBBERFILES.
212 217 #
213 218 CLOBBERFILES= $(PDIR) proto_list_$(PKGMACH)
214 219
215 220 #
216 221 # By default, PKGS will list all manifests. To build and/or publish a
217 222 # subset of packages, override this on the command line or in the
218 223 # build environment and then reference (implicitly or explicitly) the all
219 224 # or install targets.
220 225 #
221 226 MANIFESTS :sh= (cd manifests; print *.mf)
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 # | pkg.depotd
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 @print "Creating repository metadata"
401 406 $(PKGDEBUG)for r in $(REPOS); do \
402 407 /usr/lib/pkg.depotd -d $(PKGDEST)/repo.$$r \
403 408 --add-content --exit-ready; \
404 409 done
405 410
406 411 #
407 412 # Since we create zero-length processed manifests for a graceful abort
408 413 # from pkgmogrify, we need to detect that here and make no effort to
409 414 # publish the package.
410 415 #
411 416 # For all other packages, we publish them regardless of status. We
412 417 # derive the target repository as a component of the metadata-derived
413 418 # symlink for each package.
414 419 #
415 420 publish_pkgs: $(REPOS:%=$(PKGDEST)/repo.%) $(PDIR)/gendeps .WAIT $(PUB_PKGS)
416 421
417 422 #
418 423 # Before publishing, we want to pull the license files from $CODEMGR_WS
419 424 # into the proto area. This allows us to NOT pass $SRC (or
420 425 # $CODEMGR_WS) as a basedir for publication.
421 426 #
422 427 $(PUB_PKGS): stage-licenses
423 428
424 429 #
425 430 # Initialize the empty on-disk repositories
426 431 #
427 432 $(REPOS:%=$(PKGDEST)/repo.%):
428 433 @print "Initializing $(@F)"
429 434 $(PKGDEBUG)$(INS.dir)
430 435 $(PKGDEBUG)pkgsend -s file://$(@) create-repository \
431 436 --set-property publisher.prefix=$(PKGPUBLISHER)
432 437
433 438 #
434 439 # rule to process real manifests
435 440 #
436 441 # To allow redistributability and package status to change, we must
437 442 # remove not only the actual build target (the processed manifest), but
438 443 # also the incidental ones (the metadata-derived symlinks).
439 444 #
440 445 # If pkgmogrify exits cleanly but fails to create the specified output
441 446 # file, it means that it encountered an abort directive. That means
442 447 # that this package should not be published for this particular build
443 448 # environment. Since we can't prune such packages from $(PKGS)
444 449 # retroactively, we need to create an empty target file to keep make
445 450 # from trying to rebuild it every time. For these empty targets, we
446 451 # do not create metadata symlinks.
447 452 #
448 453 # Automatic dependency resolution to files is also done at this phase of
449 454 # processing. The skipped packages are skipped due to existing bugs
450 455 # in pkgdepend.
451 456 #
452 457 # The incorporation dependency is tricky: it needs to go into all
453 458 # current and renamed manifests (ie all incorporated packages), but we
454 459 # don't know which those are until after we run pkgmogrify. So
455 460 # instead of expressing it as a transform, we tack it on ex post facto.
456 461 #
457 462 # Implementation notes:
458 463 #
459 464 # - The first $(RM) must not match other manifests, or we'll run into
460 465 # race conditions with parallel manifest processing.
461 466 #
462 467 # - The make macros [ie $(MACRO)] are evaluated when the makefile is
463 468 # read in, and will result in a fixed, macro-expanded rule for each
464 469 # target enumerated in $(PROC_PKGS).
465 470 #
466 471 # - The shell variables (ie $$VAR) are assigned on the fly, as the rule
467 472 # is executed. The results may only be referenced in the shell in
468 473 # which they are assigned, so from the perspective of make, all code
469 474 # that needs these variables needs to be part of the same line of
470 475 # code. Hence the use of command separators and line continuation
471 476 # characters.
472 477 #
473 478 # - The extract_metadata transforms are designed to spit out shell
474 479 # variable assignments to stdout. Those are published to the
475 480 # .vars temporary files, and then used as input to the eval
476 481 # statement. This is done in stages specifically so that pkgmogrify
477 482 # can signal failure if the manifest has a syntactic or other error.
478 483 # The eval statement should begin with the default values, and the
479 484 # output from pkgmogrify (if any) should be in the form of a
480 485 # variable assignment to override those defaults.
481 486 #
482 487 # - When this rule completes execution, it must leave an updated
483 488 # target file ($@) in place, or make will reprocess the package
484 489 # every time it encounters it as a dependency. Hence the "touch"
485 490 # statement to ensure that the target is created, even when
486 491 # pkgmogrify encounters an abort in the publish transforms.
487 492 #
488 493
489 494 .SUFFIXES: .mf .mog .dep .res .pub
490 495
491 496 $(PDIR)/%.mog: manifests/%.mf
492 497 @print "Processing manifest $(<F)"
493 498 @env PKGFMT_OUTPUT=v1 pkgfmt -c $<
494 499 $(PKGDEBUG)$(RM) $(@) $(@:%.mog=%) $(@:%.mog=%.nodepend) \
495 500 $(@:%.mog=%.lics) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
496 501 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) $(PM_INC:%= -I %) \
497 502 $(PKGMOG_DEFINES:%=-D %) -P $(@).vars -O $(@) \
498 503 $(<) $(PM_TRANSFORMS)
499 504 $(PKGDEBUG)eval REPO=redist PKGSTAT=current NODEPEND=$(SUPPRESSPKGDEP) \
500 505 `$(CAT) -s $(@).vars`; \
501 506 if [ -f $(@) ]; then \
502 507 if [ "$$NODEPEND" != "false" ]; then \
503 508 $(TOUCH) $(@:%.mog=%.nodepend); \
504 509 fi; \
505 510 $(LN) -s $(@F) \
506 511 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
507 512 if [ \( "$$PKGSTAT" = "current" \) -o \
508 513 \( "$$PKGSTAT" = "renamed" \) ]; \
509 514 then print $(PKGDEP_INCORP) >> $(@); \
510 515 fi; \
511 516 print $$LICS > $(@:%.mog=%.lics); \
512 517 else \
513 518 $(TOUCH) $(@) $(@:%.mog=%.lics); \
514 519 fi
515 520 $(PKGDEBUG)$(RM) $(@).vars
516 521
517 522 $(PDIR)/%.dep: $(PDIR)/%.mog
518 523 @print "Generating dependencies for $(<F)"
519 524 $(PKGDEBUG)$(RM) $(@)
520 525 $(PKGDEBUG)if [ ! -f $(@:%.dep=%.nodepend) ]; then \
521 526 pkgdepend generate -m $(PKGDEP_TOKENS:%=-D %) $(<) \
522 527 $(PKGROOT) > $(@); \
523 528 else \
524 529 $(CP) $(<) $(@); \
525 530 fi
526 531
527 532 #
528 533 # The full chain implies that there should be a .dep.res suffix rule,
529 534 # but dependency generation is done on a set of manifests, rather than
530 535 # on a per-manifest basis. Instead, see the gendeps rule above.
531 536 #
532 537
533 538 $(PDIR)/%.pub: $(PDIR)/%.res
534 539 $(PKGDEBUG)m=$$(basename $(@:%.pub=%).metadata.*); \
535 540 r=$${m#$(@F:%.pub=%.metadata.)+(?).}; \
536 541 if [ -s $(<) ]; then \
537 542 print "Publishing $(@F:%.pub=%) to $$r repository"; \
538 543 pkgsend -s file://$(PKGDEST)/repo.$$r publish \
539 544 -d $(PKGROOT) -d $(TOOLSROOT) \
540 545 -d license_files -d $(PKGROOT)/licenses \
541 546 --fmri-in-manifest --no-index --no-catalog $(<) \
542 547 > /dev/null; \
543 548 fi; \
544 549 $(TOUCH) $(@);
545 550
546 551 #
547 552 # rule to build the synthetic manifests
548 553 #
549 554 # This rule necessarily has PKGDEP_TYPE that changes according to
550 555 # the specific synthetic manifest. Rather than escape command
551 556 # dependency checking for the real manifest processing, or failing to
552 557 # express the (indirect) dependency of synthetic manifests on real
553 558 # manifests, we simply split this rule out from the one above.
554 559 #
555 560 # The implementation notes from the previous rule are applicable
556 561 # here, too.
557 562 #
558 563 $(PROC_SYNTH_PKGS): $(PKGLISTS) $$(@F:%.mog=%.mf)
559 564 @print "Processing synthetic manifest $(@F:%.mog=%.mf)"
560 565 $(PKGDEBUG)$(RM) $(@) $(PDIR)/$(@F:%.mog=%).metadata.* $(@).vars
561 566 $(PKGDEBUG)$(PKGMOGRIFY) $(PKGMOG_VERBOSE) -I transforms -I $(PDIR) \
562 567 $(PKGMOG_DEFINES:%=-D %) -D PKGDEP_TYPE=$(PKGDEP_TYPE) \
563 568 -P $(@).vars -O $(@) $(@F:%.mog=%.mf) \
564 569 $(PM_TRANSFORMS) synthetic
565 570 $(PKGDEBUG)eval REPO=redist PKGSTAT=current `$(CAT) -s $(@).vars`; \
566 571 if [ -f $(@) ]; then \
567 572 $(LN) -s $(@F) \
568 573 $(PDIR)/$(@F:%.mog=%).metadata.$$PKGSTAT.$$REPO; \
569 574 else \
570 575 $(TOUCH) $(@); \
571 576 fi
572 577 $(PKGDEBUG)$(RM) $(@).vars
573 578
574 579 $(DEP_SYNTH_PKGS): $$(@:%.dep=%.mog)
575 580 @print "Skipping dependency generation for $(@F:%.dep=%)"
576 581 $(PKGDEBUG)$(CP) $(@:%.dep=%.mog) $(@)
577 582
578 583 clean:
579 584
580 585 clobber: clean
581 586 $(RM) -r $(CLOBBERFILES)
582 587
583 588 #
584 589 # This rule assumes that all links in the $PKGSTAT directories
585 590 # point to valid manifests, and will fail the make run if one
586 591 # does not contain an fmri.
587 592 #
588 593 # We do this in the BEGIN action instead of using pattern matching
589 594 # because we expect the fmri to be at or near the first line of each input
590 595 # file, and this way lets us avoid reading the rest of the file after we
591 596 # find what we need.
592 597 #
593 598 # We keep track of a failure to locate an fmri, so we can fail the
594 599 # make run, but we still attempt to process each package in the
595 600 # repo/pkgstat-specific subdir, in hopes of maybe giving some
596 601 # additional useful info.
597 602 #
598 603 # The protolist is used for bfu archive creation, which may be invoked
599 604 # interactively by the user. Both protolist and PKGLISTS targets
600 605 # depend on $(PROC_PKGS), but protolist builds them recursively.
601 606 # To avoid collisions, we insert protolist into the dependency chain
602 607 # here. This has two somewhat subtle benefits: it allows bfu archive
603 608 # creation to work correctly, even when -a was not part of NIGHTLY_OPTIONS,
604 609 # and it ensures that a protolist file here will always correspond to the
605 610 # contents of the processed manifests, which can vary depending on build
606 611 # environment.
607 612 #
608 613 $(PKGLISTS): $(PROC_PKGS)
609 614 $(PKGDEBUG)sdotr=$(@F:packages.%=%); \
610 615 r=$${sdotr%.+(?)}; s=$${sdotr#+(?).}; \
611 616 print "Generating $$r $$s package list"; \
612 617 $(RM) $(@); $(TOUCH) $(@); \
613 618 $(NAWK) 'BEGIN { \
614 619 if (ARGC < 2) { \
615 620 exit; \
616 621 } \
617 622 retcode = 0; \
618 623 for (i = 1; i < ARGC; i++) { \
619 624 do { \
620 625 e = getline f < ARGV[i]; \
621 626 } while ((e == 1) && (f !~ /name=pkg.fmri/)); \
622 627 close(ARGV[i]); \
623 628 if (e == 1) { \
624 629 l = split(f, a, "="); \
625 630 print "depend fmri=" a[l], \
626 631 "type=$$(PKGDEP_TYPE)"; \
627 632 } else { \
628 633 print "no fmri in " ARGV[i] >> "/dev/stderr"; \
629 634 retcode = 2; \
630 635 } \
631 636 } \
632 637 exit retcode; \
633 638 }' `find $(PDIR) -type l -a \( $(PKGS:%=-name %.metadata.$$s.$$r -o) \
634 639 -name NOSUCHFILE \)` >> $(@)
635 640
636 641 #
637 642 # rules to validate proto area against manifests, check for safe
638 643 # file permission modes, and generate a faux proto list
639 644 #
640 645 # For the check targets, the dependencies on $(PROC_PKGS) is specified
641 646 # as a subordinate make process in order to suppress output.
642 647 #
643 648 makesilent:
644 649 @$(MAKE) -e $(PROC_PKGS) PKGMACH=$(PKGMACH) \
645 650 SUPPRESSPKGDEP=$(SUPPRESSPKGDEP) > /dev/null
646 651
647 652 #
648 653 # The .lics files were created during pkgmogrification, and list the
649 654 # set of licenses to pull from $SRC for each package. Because
650 655 # licenses may be duplicated between packages, we uniquify them as
651 656 # well as aggregating them here.
652 657 #
653 658 license-list: makesilent
654 659 $(PKGDEBUG)( for l in `cat $(PROC_PKGS:%.mog=%.lics)`; \
655 660 do print $$l; done ) | sort -u > $@
656 661
657 662 #
658 663 # Staging the license and description files in the proto area allows
659 664 # us to do proper unreferenced file checking of both license and
660 665 # description files without blanket exceptions, and to pull license
661 666 # content without reference to $CODEMGR_WS during publication.
662 667 #
663 668 stage-licenses: license-list FRC
664 669 $(PKGDEBUG)$(MAKE) -e -f Makefile.lic \
665 670 PKGDEBUG=$(PKGDEBUG) LICROOT=$(PKGROOT)/licenses \
666 671 `$(NAWK) '{ \
667 672 print "$(PKGROOT)/licenses/" $$0; \
668 673 print "$(PKGROOT)/licenses/" $$0 ".descrip"; \
669 674 }' license-list` > /dev/null;
670 675
671 676 protocmp: makesilent
672 677 @validate_pkg -a $(PKGMACH) -v \
673 678 $(EXCEPTIONS:%=-e $(CODEMGR_WS)/exception_lists/%) \
674 679 -m $(PDIR) -p $(PKGROOT) -p $(TOOLSROOT)
675 680
676 681 pmodes: makesilent
677 682 @validate_pkg -a $(PKGMACH) -M -m $(PDIR) \
678 683 -e $(CODEMGR_WS)/exception_lists/pmodes
679 684
680 685 check: protocmp pmodes
681 686
682 687 protolist: proto_list_$(PKGMACH)
683 688
684 689 proto_list_$(PKGMACH): $(PROC_PKGS)
685 690 @validate_pkg -a $(PKGMACH) -L -m $(PDIR) > $(@)
686 691
687 692 $(PROC_PKGS): $(PDIR)
688 693
689 694 #
690 695 # This is a convenience target to allow package names to function as
691 696 # build targets. Generally, using it is only useful when iterating on
692 697 # development of a manifest.
693 698 #
694 699 # When processing a manifest, use the basename (without extension) of
695 700 # the package. When publishing, use the basename with a ".pub"
696 701 # extension.
697 702 #
698 703 # Other than during manifest development, the preferred usage is to
699 704 # avoid these targets and override PKGS on the make command line and
700 705 # use the provided all and install targets.
701 706 #
702 707 $(PKGS) $(SYNTH_PKGS): $(PDIR)/$$(@:%=%.mog)
703 708
704 709 $(PKGS:%=%.pub) $(SYNTH_PKGS:%=%.pub): $(PDIR)/$$(@)
705 710
706 711 #
707 712 # This is a convenience target to resolve dependencies without publishing
708 713 # packages.
709 714 #
710 715 gendeps: $(PDIR)/gendeps
711 716
712 717 #
713 718 # These are convenience targets for cross-platform packaging. If you
714 719 # want to build any of "the normal" targets for a different
715 720 # architecture, simply use "arch/target" as your build target.
716 721 #
717 722 # Since the most common use case for this is "install," the architecture
718 723 # specific install targets have been further abbreviated to elide "/install."
719 724 #
720 725 i386/% sparc/%:
721 726 $(MAKE) -e $(@F) PKGMACH=$(@D) SUPPRESSPKGDEP=$(SUPPRESSPKGDEP)
722 727
723 728 i386 sparc: $$(@)/install
724 729
725 730 FRC:
726 731
727 732 # EXPORT DELETE START
728 733 XMOD_PKGS= \
729 734 BRCMbnx \
730 735 BRCMbnxe \
731 736 SUNWadpu320 \
732 737 SUNWibsdpib \
733 738 SUNWkdc \
734 739 SUNWlsimega \
735 740 SUNWwbint \
736 741 SUNWwbsup
737 742
738 743 EXPORT_SRC: CRYPT_SRC
739 744 $(RM) $(XMOD_PKGS:%=manifests/%.mf)
740 745 $(RM) Makefile+
741 746 $(SED) -e "/^# EXPORT DELETE START/,/^# EXPORT DELETE END/d" \
742 747 < Makefile > Makefile+
743 748 $(MV) -f Makefile+ Makefile
744 749 $(CHMOD) 444 Makefile
745 750 # EXPORT DELETE END
↓ open down ↓ |
578 lines elided |
↑ open up ↑ |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX