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