components/golang/Makefile
changeset 5428 3c05d530e67e
parent 5331 9c955076ffe3
child 5715 f94135b42f59
--- a/components/golang/Makefile	Tue Feb 09 15:21:35 2016 -0800
+++ b/components/golang/Makefile	Tue Feb 09 15:41:19 2016 -0800
@@ -20,7 +20,7 @@
 #
 
 #
-# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
 #
 
 # The golang build process just doesn't work with Parfait.
@@ -32,7 +32,7 @@
 
 COMPONENT_NAME=		golang
 COMPONENT_VERSION=	1.5
-COMPONENT_MAJOR_VERSION=	$(shell echo $(COMPONENT_VERSION) | gsed -e 's/\([0-9]\+\.[0-9]\+\).*/\1/')
+COMPONENT_MAJOR_VERSION=	$(shell echo $(COMPONENT_VERSION) | $(GSED) -e 's/\([0-9]\+\.[0-9]\+\).*/\1/')
 COMPONENT_SRC=		$(COMPONENT_NAME)-$(COMPONENT_VERSION)
 COMPONENT_PROJECT_URL=	https://golang.org/
 COMPONENT_ARCHIVE=	go$(COMPONENT_VERSION).src.tar.gz
@@ -123,9 +123,16 @@
 # Go package imports for lint are found in github directory.
 COMPONENT_IMPORT_SRC_lint=	github.com/golang
 
+# Go's "not well-formed" elf objects confuse elfsign, which then causes
+# problems for RE.  For now, we workaround this by adding the
+# 'com.oracle.elfsign=false' tag to every elf object.
+NO_ELFSIGN_MOG=		$(BUILD_DIR)/no-elfsign.mog
+
 # We're x86-only for now.
 ifeq ($(MACH), sparc)
 PUBLISH_STAMP=
+else
+PUBLISH_STAMP= $(NO_ELFSIGN_MOG) $(BUILD_DIR)/.published-$(MACH)
 endif
 
 # Bake in where Go package will be installed.
@@ -173,6 +180,14 @@
 	PUBLISH_TRANSFORMS += $(WS_TOP)/transforms/evaluation
 endif
 
+$(NO_ELFSIGN_MOG): install
+	cd $(PROTO_DIR); \
+	find . -type f -exec elffile {} + | grep 'ELF [36]' | \
+	    $(GSED) -e 's/^..\(.*\):.*$$/<transform file path=\1$$ -> \\\
+	        default com.oracle.elfsign false>/' > $@
+
+PUBLISH_TRANSFORMS +=	$(NO_ELFSIGN_MOG)
+
 # Building go from the source repository version requires that we set an
 # effective version and add some sort of unique identifier (in the case of
 # pre-release versions), so we use 'devel' + archive hash + date similar to how
@@ -262,7 +277,8 @@
 	(cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
 	(cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
 	($(MKDIR) $(PROTOUSRSHAREMAN1DIR)); \
-	($(CP) $(BUILD_DIR)/man1/go.1 $(PROTOUSRSHAREMAN1DIR)/)
+	($(CP) $(BUILD_DIR)/man1/go.1 $(PROTOUSRSHAREMAN1DIR)/); \
+	($(RM) $(NO_ELFSIGN_MOG))
 endef
 
 INSTALL_amd64= $(INSTALL_64)
@@ -321,6 +337,9 @@
 # Go's test suite is currently designed to be run from the build area.
 system-test:	$(SYSTEM_TESTS_NOT_IMPLEMENTED)
 
+# Used in this Makefile.
+REQUIRED_PACKAGES += file/gnu-findutils
+REQUIRED_PACKAGES += text/gnu-sed
 # Required to build man pages.
 REQUIRED_PACKAGES += developer/documentation-tool/xml2roff
 # There's a single test script which requires perl.