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