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