Adam Števko
2016-05-08 4d720dab7bcefcc03a2580e922c0c9306ce06ccc
Adapt REQUIRED_PACKAGES for oi-userland
4 files modified
124 ■■■■ changed files
doc/makefile-targets.txt 22 ●●●●● patch | view | raw | blame | history
make-rules/environment.mk 65 ●●●● patch | view | raw | blame | history
make-rules/ips.mk 8 ●●●● patch | view | raw | blame | history
make-rules/shared-macros.mk 29 ●●●●● patch | view | raw | blame | history
doc/makefile-targets.txt
@@ -1,4 +1,3 @@
This is a guide to explain various useful targets in Userland component
Makefiles.  There is a set of targets that all Makefiles must include, plus
some addtional targets that are there for convenience.
@@ -16,7 +15,9 @@
  included by $(WS_MAKE_RULES)/shares-macros.mk.  It uses the REQUIRE_PACKAGES
  macro contents to attempt to install any required packages in the current
  environment.  It should never by used by developers to update any public
  build machines as those are managed by dedicated staff.
  build machines as those are managed by dedicated staff. To use this target
  user has to be assigned "Software Installation" or "Primary Administrator"
  profile.
download::
  This target is present in all Makefiles.  It can be used at the top level
@@ -52,16 +53,6 @@
  Makefile.  It depends on the previously described "download" target, as well
  as internal interim targets to unpack source archives and apply patches to
  the unpacked source.
configure:
  This target is an optional target that can be included in component Makefiles
  to run the community source configuration phase of a component build.  It is
  typically defined in component Makefiles that make use of the
  $(WS_MAKE_RULES)/configure.mk Makefile fragment, but could be defined in
  others that include a source code configuration step.  It is not explicitly
  called during the build, but provides a convenient means of downloading,
  unpacking, patching, and "configuring" component source for building without
  actually compiling the bits.
build::
  This target must be present in all Makefiles.  It can be used at the top level
@@ -120,5 +111,8 @@
  be used to generate the set of REQUIRED_PACKAGES that is needed by the
  'pkgdepend resolve' portion of package generation and publication (publish
  target).  It automatically appends to the component Makefile, but the results
  should be
  manually verified.
  should be manually verified.
print-VAR
  This target will print contents of variable VAR and also provide information
  about variable origin and variable flavor.
make-rules/environment.mk
@@ -22,20 +22,21 @@
#
# Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
#
SUDO =        /usr/bin/sudo
PFEXEC =               /usr/bin/pfexec
define separator-line
    @$(PYTHON) -c 'l="="*(40-len("$1")/2); print("%s%s%s" % (l, "$1", l))'
       @$(PYTHON) -c 'l="="*(40-len("$1")/2); print("%s%s%s" % (l, "$1", l))'
endef
component-environment-check::
    $(call separator-line,Workspace)
    @echo " Path:        $(WS_TOP)"
    @echo " Branch:      $$(hg identify -b)"
    @echo " Changeset:   $$(hg identify -n)($$(hg identify -i))"
    @echo " Branch:      $$(git rev-parse --abbrev-ref HEAD)"
    @echo " Changeset:   $$(git rev-parse HEAD)"
    $(call separator-line,System)
    @/usr/bin/uname -a
    @echo "Zone:  $$(/usr/sbin/zonename)"
    @echo "Zone: $$(/usr/bin/zonename)"
    @echo "Zone IP type: $$(/usr/bin/zonename -t)"
    @/usr/sbin/psrinfo -vp
    @/usr/sbin/ipadm show-addr
    $(call separator-line,Required Packages)
@@ -45,57 +46,5 @@
component-environment-prep::
    @echo "Adding required packages to build environment..."
    @-echo $(REQUIRED_PACKAGES:%=/%) | xargs \
        $(SUDO) /usr/bin/pkg install --accept -v
               $(PFEXEC) /usr/bin/pkg install --accept -v
#
# For building in a constructed zone.  Currently this assumes a template zone
# with /ws (tools mountpoint) and /builds (workspace mountpoint) mounted
# in the same place as in the global zone.  It also assumes the current
# $USER account is replicated in the template zone.
#
ZONENAME=bz-$(shell echo "$(WS_TOP)" | md5sum | cut -c0-7)-$(COMPONENT_NAME)
$(BUILD_DIR)/packages.xml:    Makefile    $(BUILD_DIR)
    @echo "$(REQUIRED_PACKAGES:%=\t\t<name>pkg:/%</name>\n)" >$(@)
$(BUILD_DIR)/ai_manifest.xml:    $(WS_TOOLS)/zone_default.xml $(BUILD_DIR)
    $(CP) $< $(@)
$(BUILD_DIR)/sc_profile.xml:    $(WS_TOOLS)/sc_profile.xml $(BUILD_DIR)
    $(GSED) -e "s/XXX_USER_XXX/$${USER}/g" -e "s/XXX_UID_XXX/$$(id -u)/g" $< >$(@)
component-zone-build:    $(BUILD_DIR)/ai_manifest.xml $(BUILD_DIR)/packages.xml \
            $(BUILD_DIR)/sc_profile.xml download
    $(call separator-line)
    $(call separator-line,Create $(ZONENAME))
    $(SUDO) /usr/sbin/zonecfg -z $(ZONENAME) create -t template
    #@$(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) clone template
    $(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) install \
        -m $(BUILD_DIR)/ai_manifest.xml \
        -c $(BUILD_DIR)/sc_profile.xml
    $(call separator-line,Boot $(ZONENAME))
    $(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) boot
    @while $$(true) ; do \
        echo "waiting for zone ..." ; \
        $(SUDO) /usr/sbin/zlogin -l $${USER} $(ZONENAME) \
                /bin/true >/dev/null 2>&1 && break ; \
        sleep 10 ; \
    done
    #$(call separator-line,Prep $(ZONENAME))
    #@$(SUDO) /usr/sbin/zlogin -S $(ZONENAME) \
    #    "cd $(COMPONENT_DIR) ; gmake component-be-prep"
    $(call separator-line,Build in $(ZONENAME))
    $(SUDO) /usr/sbin/zlogin -l $${USER} $(ZONENAME) \
        "cd $(COMPONENT_DIR) ; gmake component-be-check install"
    #    "cd $(COMPONENT_DIR) ; gmake component-be-check publish PKGLINT=/bin/true"
    $(call separator-line,Halt $(ZONENAME))
    $(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) halt
    $(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) uninstall -F
    $(SUDO) /usr/sbin/zonecfg -z $(ZONENAME) delete -F
    $(call separator-line)
component-zone-cleanup::
    -$(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) halt
    -$(SUDO) /usr/sbin/zoneadm -z $(ZONENAME) uninstall -F
    -$(SUDO) /usr/sbin/zonecfg -z $(ZONENAME) delete -F
make-rules/ips.mk
@@ -384,11 +384,11 @@
# You must still include packages for tools you build and test with.
#
REQUIRED_PACKAGES::     $(RESOLVED)
       $(GMAKE) RESOLVE_DEPS= $(BUILD_DIR)/.resolved-$(MACH)
       @echo "# Auto-generated contents below.  Please manually verify and remove this comment" >>Makefile
       @$(PKGMOGRIFY) $(WS_TRANSFORMS)/$@ $(RESOLVED) | \
    $(GMAKE) RESOLVE_DEPS= $(BUILD_DIR)/.resolved-$(MACH)
    @echo "# Auto-generated contents below.  Please manually verify and remove this comment" >>Makefile
    @$(PKGMOGRIFY) $(WS_TRANSFORMS)/$@ $(RESOLVED) | \
               $(GSED) -e '/^[\t ]*$$/d' -e '/^#/d' | sort -u >>Makefile
       @echo "*** Please edit your Makefile and verify the new content at the end ***"
    @echo "*** Please edit your Makefile and verify the new content at the end ***"
# lint the manifests all at once
make-rules/shared-macros.mk
@@ -995,34 +995,7 @@
#
# Packages with tools that are required to build Userland components
#
REQUIRED_PACKAGES += developer/build/gnu-make
REQUIRED_PACKAGES += developer/build/make
ifeq ($(COMPILER),gcc)
REQUIRED_PACKAGES += developer/gcc-53
endif
ifeq ($(COMPILER),studio)
ifneq ($(findstring /opt/solarisstudio12.4,$(CC)),)
# If we are setup to build with an installed compiler, require the package
# we can uncomment this when we know that pkglint can find it.
#REQUIRED_PACKAGES += /solarisstudio/developer/solarisstudio-124
endif
endif
ifeq ($(PARFAIT_BUILD),yes)
# uncomment this line if you need to install Parfait
#REQUIRED_PACKAGES += developer/parfait/parfait-tools-161
endif
REQUIRED_PACKAGES += developer/versioning/mercurial
REQUIRED_PACKAGES += file/gnu-findutils
REQUIRED_PACKAGES += package/pkg
REQUIRED_PACKAGES += runtime/python-27
REQUIRED_PACKAGES += shell/bash
REQUIRED_PACKAGES += shell/ksh93
REQUIRED_PACKAGES += system/linker
REQUIRED_PACKAGES += text/gawk
REQUIRED_PACKAGES += text/gnu-grep
REQUIRED_PACKAGES += text/gnu-sed
REQUIRED_PACKAGES += developer/java/jdk-8
REQUIRED_PACKAGES += security/sudo
REQUIRED_PACKAGES += metapackages/build-essential
# Only a default dependency if component being built produces binaries.
ifneq ($(strip $(BUILD_BITS)),NO_ARCH)