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