5329N/A#
5329N/A# CDDL HEADER START
5329N/A#
5329N/A# The contents of this file are subject to the terms of the
5329N/A# Common Development and Distribution License (the "License").
5329N/A# You may not use this file except in compliance with the License.
5329N/A#
5329N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
5329N/A# or http://www.opensolaris.org/os/licensing.
5329N/A# See the License for the specific language governing permissions
5329N/A# and limitations under the License.
5329N/A#
5329N/A# When distributing Covered Code, include this CDDL HEADER in each
5329N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
5329N/A# If applicable, add the following below this CDDL HEADER, with the
5329N/A# fields enclosed by brackets "[]" replaced with your own identifying
5329N/A# information: Portions Copyright [yyyy] [name of copyright owner]
5329N/A#
5329N/A# CDDL HEADER END
5329N/A#
5329N/A
5329N/A#
5426N/A# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
5329N/A#
5713N/ABUILD_ARCH= i386
5713N/ABUILD_BITS= 64
5713N/ACOMPILER= gcc
5329N/A# The golang build process just doesn't work with Parfait.
5329N/Aexport PARFAIT_BUILD=no
5329N/Ainclude ../../make-rules/shared-macros.mk
5329N/A
5329N/APATCH_EACH_ARCHIVE= 1
5329N/A
5329N/ACOMPONENT_NAME= golang
5329N/ACOMPONENT_VERSION= 1.5
5426N/ACOMPONENT_MAJOR_VERSION= $(shell echo $(COMPONENT_VERSION) | $(GSED) -e 's/\([0-9]\+\.[0-9]\+\).*/\1/')
5329N/ACOMPONENT_PROJECT_URL= https://golang.org/
5329N/ACOMPONENT_ARCHIVE= go$(COMPONENT_VERSION).src.tar.gz
5329N/ACOMPONENT_ARCHIVE_URL= https://storage.googleapis.com/golang/$(COMPONENT_ARCHIVE)
5329N/ACOMPONENT_ARCHIVE_HASH= \
5329N/A sha256:be81abec996d5126c05f2d36facc8e58a94d9183a56f026fc9441401d80062db
5329N/ACOMPONENT_PROJECT_URL= https://golang.org
5329N/A
5329N/AARC_CASE= PSARC/2015/203
5329N/ATPNO= 23679
5329N/A
5329N/A# Go has a number of supplementary tools and packages that are located in
5329N/A# separate archives or source repositories. Because Go currently forces a
5329N/A# recompile of all packages whenever the compiler changes, building and
5329N/A# delivering them within the same build component build process is the best
5329N/A# option for now.
5329N/A
5713N/A# The long-term plan for packaging Go is roughly as follows:
5329N/A#
5329N/A# - when SPARC support is integrated into Go upstream, build upstream version
5329N/A# using system Go for x86, then build Go for SPARC using upstream version
5329N/A# just built for x86 (cross-compilation), package both at the same time
5329N/A# - after SPARC version has been available for at least a few builds in the
5329N/A# WOS, switch to building Go with system version for x86 and SPARC
5329N/A#
5329N/A
5329N/A# Supplementary packages; these are delivered as source only for now as the
5329N/A# paths to the compiled packages are written directly into the binaries and
5329N/A# there's no way (currently) to fix that during the build process.
5329N/ASUPP_PACKAGES= crypto image lint net sys text tools tour
5329N/A
5329N/Adefine supp-rules
5329N/ACOMPONENT_NAME_$(1)= $(1)
5329N/ACOMPONENT_VERSION_$(1)= $(COMPONENT_VERSION)
6909N/ACOMPONENT_LABEL_$(1)=
5329N/ACOMPONENT_IMPORT_SRC_$(1)= golang.org/x
5329N/AGIT_REPO_$(1)= https://github.com/golang/$(1).git
5329N/ATPNO_$(1)= $(TPNO)
5329N/Aendef
5329N/A
5329N/A$(foreach suffix, $(SUPP_PACKAGES), $(eval $(call supp-rules,$(suffix))))
5329N/A
5329N/A# Desired "revision" of Go's "community" libraries; these are arbitrary
5329N/A# revisions chosen from the last commit to the respective repository at the
5329N/A# same time that this component was updated as there is no formal release
5329N/A# process for these packages. Whenever Go is updated, these should be as well.
5779N/AGIT_COMMIT_ID_crypto= 1777f3ba8c1fed80fcaec3317e3aaa4f627764d2
5329N/AGIT_COMMIT_ID_image= baddd3465a05d84a6d8d3507547a91cb188c81ea
5779N/AGIT_COMMIT_ID_lint= 8f348af5e29faa4262efdc14302797f23774e477
5779N/AGIT_COMMIT_ID_net= fb93926129b8ec0056f2f458b1f519654814edf0
5779N/AGIT_COMMIT_ID_sys= 9eef40adf05b951699605195b829612bd7b69952
5779N/AGIT_COMMIT_ID_text= 5ee49cfe751141f8017047bab800d1f528ee3be1
5779N/AGIT_COMMIT_ID_tools= 5da1e91fb2cc877989e7c73748b505a0612956f2
5779N/AGIT_COMMIT_ID_tour= 41d86d51aaa4f1cf4f66e42456ba137c93cad950
5329N/A
5329N/A# Resulting hash of related git commit once archived.
5831N/AGIT_HASH_crypto= sha256:05003de0b534b6e0303dc7c2a0f88a1cd53af11acde96fa5a38bcbaf31250c5e
5831N/AGIT_HASH_image= sha256:96951cea9d34603209961d46010610894df6c708321e1b4781d71bdd180e75b8
5831N/AGIT_HASH_lint= sha256:1ad5bbf9c21327c73cb67db1329aee8253e18de994302c8ce1a98581bda4da44
5831N/AGIT_HASH_net= sha256:ca7830ac9af95232204ebc52d27c4726c32e4c0df760e039faba0224075fcb59
5831N/AGIT_HASH_sys= sha256:b5fdef2664d43430e58250c25564b0376895eb44fbd7e292d5251e5deea8a0c8
5831N/AGIT_HASH_text= sha256:f65d0191d15042773899efe405fd3e4168922bba2494b2e68f0408bbef23e777
5831N/AGIT_HASH_tools= sha256:c260308533abc9ea95328eee34616f59ccef1737c51be9be6d652f538777b661
5831N/AGIT_HASH_tour= sha256:c484f1dbdd67e5108418574d808daf223cc4c544c0f9e4bea4150978197914bc
5329N/A
5329N/A# Go package imports for lint are found in github directory.
5329N/ACOMPONENT_IMPORT_SRC_lint= github.com/golang
5329N/A
5426N/A# Go's "not well-formed" elf objects confuse elfsign, which then causes
5426N/A# problems for RE. For now, we workaround this by adding the
5426N/A# 'com.oracle.elfsign=false' tag to every elf object.
5426N/ANO_ELFSIGN_MOG= $(BUILD_DIR)/no-elfsign.mog
5426N/A
5329N/A# We're x86-only for now.
5329N/Aifeq ($(MACH), sparc)
5329N/APUBLISH_STAMP=
5426N/Aelse
5426N/APUBLISH_STAMP= $(NO_ELFSIGN_MOG) $(BUILD_DIR)/.published-$(MACH)
5329N/Aendif
5329N/A
5329N/A# Bake in where Go package will be installed.
5329N/AGOROOT_FINAL= /usr/lib/golang/$(COMPONENT_MAJOR_VERSION)
5329N/A# Enable easier stack unwinding for debugging.
5329N/AGOEXPERIMENT= framepointer
5329N/ACOMPONENT_BUILD_ENV += GOROOT_FINAL="$(GOROOT_FINAL)"
5329N/ACOMPONENT_BUILD_ENV += GOEXPERIMENT="$(GOEXPERIMENT)"
5329N/ACOMPONENT_BUILD_ENV += \
5713N/A GOROOT_BOOTSTRAP="$(USRLIBDIR)/golang/1.5"
5329N/A
5329N/A# Install root for supplementary packages.
5329N/ASUPP_ROOT=$(PROTOUSRLIBDIR)/gocode/$(COMPONENT_MAJOR_VERSION)
5329N/A
5329N/A# For convenience during installation of supplementary packages.
5329N/ACOMPONENT_INSTALL_ENV += PATH="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
5329N/ACOMPONENT_INSTALL_ENV += GOROOT="$(PROTO_DIR)$(GOROOT_FINAL)"
5329N/ACOMPONENT_INSTALL_ENV += GOPATH="$(SUPP_ROOT)"
5329N/A
5713N/ABUILD_STYLE= justmake
5713N/ABUILD_64 += $(BUILD_DIR)/man1/go.1
5713N/AINSTALL_64 := build $(INSTALL_64)
5713N/Ainclude $(WS_MAKE_RULES)/common.mk
5329N/A
5329N/A# Simplify source copying for install by eliding patch detritus.
5329N/AGPATCH_BACKUP=
5329N/A
5329N/A# Enable local transforms.
5329N/APKG_OPTIONS += -I $(COMPONENT_DIR)
5329N/A
5329N/A# Avoid some of the default transforms:
5329N/A# - facet.devel serves no useful purpose for a development package
5329N/A# - facet.doc wrongly assumes all things in a doc directory are documentation;
5329N/A# in Go's case, some are binaries
5329N/A#
5329N/A# This requires completely redefining PUBLISH_TRANSFORMS for now.
5329N/APUBLISH_TRANSFORMS= $(LICENSE_TRANSFORMS)
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/variant-cleanup
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/defaults
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/actuators
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/locale
5329N/APUBLISH_TRANSFORMS += $(PKGMOGRIFY_TRANSFORMS)
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/incorporate
5329N/APUBLISH_TRANSFORMS += $(WS_TOP)/transforms/publish-cleanup
5329N/Aifeq ($(BUILD_TYPE),evaluation)
5329N/A PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/evaluation
5329N/Aendif
5329N/A
5426N/A$(NO_ELFSIGN_MOG): install
5426N/A cd $(PROTO_DIR); \
5426N/A find . -type f -exec elffile {} + | grep 'ELF [36]' | \
5426N/A $(GSED) -e 's/^..\(.*\):.*$$/<transform file path=\1$$ -> \\\
5426N/A default com.oracle.elfsign false>/' > $@
5426N/A
5426N/APUBLISH_TRANSFORMS += $(NO_ELFSIGN_MOG)
5426N/A
5329N/A# Building go from the source repository version requires that we set an
5329N/A# effective version and add some sort of unique identifier (in the case of
5329N/A# pre-release versions), so we use 'devel' + archive hash + date similar to how
5329N/A# Go internally determines one normally from git revision info. Uncomment the
5329N/A# block below when building from the upstream source repository:
5329N/A#COMPONENT_POST_UNPACK_ACTION= \
5329N/A# $(MV) go-master $(COMPONENT_SRC) && \
5329N/A# $(TOUCH) $(COMPONENT_SRC)/VERSION && \
5329N/A# echo "devel $(shell digest -a md5 $(COMPONENT_ARCHIVE)) \
5329N/A# $(shell date -u +'%a %b %e %T %Z %Y')" > \
5329N/A# $(COMPONENT_SRC)/VERSION
5329N/A
5329N/A# We have to fiddle with the package archives to get them into the same source
5329N/A# directory so that we can use the standard build targets. We're effectively
5329N/A# building multiple components using a single target.
5329N/ACOMPONENT_POST_UNPACK_ACTION= \
5329N/A $(MV) go $(COMPONENT_SRC)
5329N/A
5329N/A# Fixup compressed data affected by patches.
5329N/ACOMPONENT_PREP_ACTION= \
5329N/A cd $(COMPONENT_SRC) && \
5329N/A bzip2 -c src/compress/testdata/Mark.Twain-Tom.Sawyer.txt > \
5329N/A src/compress/bzip2/testdata/Mark.Twain-Tom.Sawyer.txt.bz2
5329N/A
5329N/A# Go doesn't have a standard Makefile-based build process, so override the
5329N/A# default.
5329N/ACOMPONENT_BUILD_ACTION= \
5329N/A cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash
5329N/A
5329N/ACOMPONENT_TARGET_DIR= \
5329N/A $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION)
5329N/A
5329N/A# We can't do any ASLR'ing as the Go 6l linker has no understanding of the
5329N/A# -z aslr=... option. So just override where needed in the .p5m files.
5329N/AASLR_MODE = $(ASLR_DISABLE)
5329N/A
5778N/A# The timestamp is generated immediately once when the Makefile is evaluated to
5778N/A# ensure every package gets the same one.
5778N/AGOTS := $(shell date +"%Y%m%dT%H%M%SZ")
5778N/A
5329N/A# Make sure the source code and object files have identical timestamps so
5329N/A# the Go compiler doesn't try to rebuild them.
5778N/APKG_MACROS += TIMESTAMP=$(GOTS)
5329N/A# Extra macros for packaging convenience.
5329N/APKG_MACROS += COMPONENT_MAJOR_VERSION=$(COMPONENT_MAJOR_VERSION)
5329N/A# COMPONENT_MAJOR_VERSION suitable for use in regular expressions.
5329N/APKG_MACROS += COMPONENT_RE_MAJOR_VERSION=$(subst .,\\.,$(COMPONENT_MAJOR_VERSION))
5329N/A
5329N/ACOMPONENT_TEST_ENV += PATH="$(@D)/bin:$(PATH)"
5329N/ACOMPONENT_TEST_ENV += GOROOT="$(@D)"
5329N/ACOMPONENT_TEST_DIR= $(@D)/src
5329N/ACOMPONENT_TEST_CMD= ./run.bash
5329N/ACOMPONENT_TEST_TARGETS=
5329N/A
5329N/A# Go's test suite does not have deterministic output or order, and as such,
5329N/A# success can only be determined by exit code, not by output comparison.
5329N/ACOMPONENT_TEST_CREATE_TRANSFORMS=
5329N/ACOMPONENT_TEST_PERFORM_TRANSFORM=
5329N/ACOMPONENT_TEST_COMPARE=
5329N/A
5329N/AXML2ROFF= $(USRSHAREDIR)/xml/xsolbook/python/xml2roff.py
5329N/A
5329N/A$(BUILD_DIR)/man1/go.1:
5329N/A $(XML2ROFF) $(COMPONENT_DIR)/docs/go.1 -o $(BUILD_DIR)
5329N/A
5329N/Adefine COMPONENT_INSTALL_ACTION=
5329N/A ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \
5329N/A (cd $(SOURCE_DIR) && \
5713N/A $(GNUBIN)/find . -maxdepth 1 -print \
5713N/A -exec $(GNUBIN)/cp -r \
5329N/A --parents {} $(COMPONENT_TARGET_DIR) \;); \
5329N/A (cd $(BUILD_DIR_64) && \
5713N/A $(GNUBIN)/find src -type f \
5713N/A -exec $(GNUBIN)/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \
5329N/A (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
5329N/A (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
5329N/A ($(MKDIR) $(PROTOUSRSHAREMAN1DIR)); \
5426N/A ($(CP) $(BUILD_DIR)/man1/go.1 $(PROTOUSRSHAREMAN1DIR)/); \
5426N/A ($(RM) $(NO_ELFSIGN_MOG))
5329N/Aendef
5329N/A
5795N/A# clear COMPONENT_POST_INSTALL_ACTION so we can append PERL_SCRIPTS_PROCESS
5795N/A# at the end
5795N/ACOMPONENT_POST_INSTALL_ACTION =
5795N/A
5329N/A#
5329N/A# Magic to deliver supplemental package source into proto area.
5329N/A#
5329N/Adefine install-rules
5329N/A$(MANIFEST_BASE)-$(1)-15.mogrified: PKG_PROTO_DIRS= $(MANGLED_DIR) $(PROTO_DIR) $(@D) $(COMPONENT_DIR) $(COMPONENT_SRC_$(1))
5329N/A
5713N/ABUILD_64 += $$(UNPACK_STAMP_$(1))
5329N/A
5329N/ACOMPONENT_POST_INSTALL_ACTION += \
5329N/A ($(MKDIR) \
5329N/A $(SUPP_ROOT)/src/$$(COMPONENT_IMPORT_SRC_$(1))/$$(COMPONENT_NAME_$(1)); \
5329N/A $(CP) -r $$(COMPONENT_SRC_$(1))/* \
5329N/A $(SUPP_ROOT)/src/$$(COMPONENT_IMPORT_SRC_$(1))/$$(COMPONENT_NAME_$(1)));
5329N/A
5329N/Aendef
5329N/A
5329N/A$(foreach suffix,$(SUPP_PACKAGES), $(eval $(call install-rules,$(suffix))))
5329N/A# Install supplementary packages (this cannot be done one-by-one); install
5329N/A# tools/go/types first to avoid quirk with trimpath and dependencies. This is
5329N/A# technically a build and install, but go's build command won't "install"
5329N/A# results, it only verifies a target can be built and dumps it into a temporary
5329N/A# directory.
5329N/A#
5329N/A# The -trimpath option used here ensures that the paths recorded in the
5778N/A# pre-built packages do not contain the containing directory; the result is a
5778N/A# path that Go will evaluate relative to $GOPATH and so will pass the "stale"
5778N/A# object checks that Go performs at build time allowing reuse of the pre-built
5778N/A# packages.
5778N/APROTO_ROOT= $(SUPP_ROOT)
5778N/ACOMPONENT_POST_INSTALL_ACTION += \
5778N/A ($(ENV) $(COMPONENT_INSTALL_ENV) go install \
5778N/A -asmflags -trimpath=$(PROTO_ROOT) -gcflags -trimpath=$(PROTO_ROOT) \
5778N/A "golang.org/x/tools/go/types"; \
5778N/A $(ENV) $(COMPONENT_INSTALL_ENV) go install \
5778N/A -asmflags -trimpath=$(PROTO_ROOT) -gcflags -trimpath=$(PROTO_ROOT) \
5778N/A "golang.org/x/..."; \
5778N/A $(ENV) $(COMPONENT_INSTALL_ENV) go install \
5778N/A -asmflags -trimpath=$(PROTO_ROOT) -gcflags -trimpath=$(PROTO_ROOT) \
5778N/A "github.com/golang/...");
5329N/A
5795N/APERL_SCRIPTS= \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/plan9/mksyscall.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_netbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksyscall_solaris.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksyscall.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_freebsd.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysctl_openbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_dragonfly.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_openbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_linux.pl \
5795N/A $(PROTOUSRLIBDIR)/gocode/1.5/src/golang.org/x/sys/unix/mksysnum_darwin.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/regexp/syntax/make_perl_groups.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_freebsd.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysctl_openbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksyscall.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_openbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_darwin.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_netbsd.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_linux.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksyscall_solaris.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/src/syscall/mksysnum_dragonfly.pl \
5795N/A $(PROTOUSRLIBDIR)/golang/1.5/test/errchk
5795N/A
5795N/ACOMPONENT_POST_INSTALL_ACTION += $(PERL_SCRIPTS_PROCESS)
5795N/A
5713N/A# Go's test suite is currently designed to be run from the build area.
5329N/A
5713N/A# Used during the build.
5713N/AREQUIRED_PACKAGES += developer/gcc
5713N/Aifneq ($(MACH), sparc)
5713N/A# Go 1.5 now bootstraps itself using 1.5; 1.6 will bootstrap using 1.5 as well.
5713N/AREQUIRED_PACKAGES += developer/golang-15
5713N/Aendif
5426N/A# Used in this Makefile.
5426N/AREQUIRED_PACKAGES += file/gnu-findutils
5426N/AREQUIRED_PACKAGES += text/gnu-sed
5329N/A# Required to build man pages.
5329N/AREQUIRED_PACKAGES += developer/documentation-tool/xml2roff
5329N/A# There's a single test script which requires perl.
5795N/AREQUIRED_PACKAGES += $(PERL_PKG)
5329N/AREQUIRED_PACKAGES += system/header
5329N/AREQUIRED_PACKAGES += system/library
5713N/A# Used for cgo support at runtime; we don't add a package dependency since cgo
5713N/A# support is optional.
5713N/AREQUIRED_PACKAGES += system/library/gcc/gcc-c-runtime
5329N/AREQUIRED_PACKAGES += system/linker