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