4 # The contents of this file are subject to the terms of the
5 # Common Development and Distribution License (the "License").
6 # You may not use this file except in compliance with the License.
8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 # or http://www.opensolaris.org/os/licensing.
10 # See the License for the specific language governing permissions
11 # and limitations under the License.
13 # When distributing Covered Code, include this CDDL HEADER in each
14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 # If applicable, add the following below this CDDL HEADER, with the
16 # fields enclosed by brackets "[]" replaced with your own identifying
17 # information: Portions Copyright [yyyy] [name of copyright owner]
23 # Copyright 2021 Till Wegmueller
26 include ..
/..
/..
/make-rules
/shared-macros.mk
30 COMPONENT_NAME
= golang
31 COMPONENT_MAJOR_VERSION
= 1.17
32 COMPONENT_VERSION
= $(COMPONENT_MAJOR_VERSION
).13
33 COMPONENT_FMRI
= developer
/golang
34 COMPONENT_CLASSIFICATION
= Development
/Other Languages
35 COMPONENT_SUMMARY
= The Go Programming Language
36 COMPONENT_SRC
= $(COMPONENT_NAME
)-$(COMPONENT_VERSION
)
37 COMPONENT_PROJECT_URL
= https
://golang.org
/
38 COMPONENT_ARCHIVE
= go
$(COMPONENT_VERSION
).src.
tar.gz
39 COMPONENT_ARCHIVE_URL
= https
://storage.googleapis.com
/golang
/$(COMPONENT_ARCHIVE
)
40 COMPONENT_ARCHIVE_HASH
= sha256
:a1a48b23afb206f95e7bbaa9b898d965f90826f6f1d1fc0c1d784ada0cd300fd
41 COMPONENT_LICENSE
= BSD-style
, Patent Grant
42 COMPONENT_LICENSE_FILE
= $(COMPONENT_NAME
).license
43 MEDIATEDUSRSHAREMAN1DIR
= $(PROTO_DIR
)/usr
/share
/golang
/$(COMPONENT_MAJOR_VERSION
)/man
/man1
45 # Go has a number of supplementary tools and packages that are located in
46 # separate archives or source repositories. Because Go currently forces a
47 # recompile of all packages whenever the compiler changes, building and
48 # delivering them within the same build component build process is the best
51 # Bake in where Go package will be installed.
52 GOROOT_FINAL
= /usr
/lib
/golang
/$(COMPONENT_MAJOR_VERSION
)
53 # Enable easier stack unwinding for debugging.
55 COMPONENT_BUILD_ENV
+= GOROOT_FINAL
="$(GOROOT_FINAL)"
56 COMPONENT_BUILD_ENV
+= GOEXPERIMENT
="$(GOEXPERIMENT)"
57 COMPONENT_BUILD_ENV
+= GOOS
="illumos"
58 COMPONENT_BUILD_ENV
+= GOCACHE
="$(SOURCE_DIR)/gocache"
59 COMPONENT_BUILD_ENV
+= GOPATH
="$(SOURCE_DIR)/gopath"
60 COMPONENT_BUILD_ENV
+= GO_LDSO
=/lib
/64/ld.so
.1
62 # For convenience during installation of supplementary packages.
63 COMPONENT_INSTALL_ENV
+= PATH
="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
64 COMPONENT_INSTALL_ENV
+= GOROOT
="$(PROTO_DIR)$(GOROOT_FINAL)"
65 COMPONENT_INSTALL_ENV
+= GOCACHE
="$(SOURCE_DIR)/gocache"
66 COMPONENT_INSTALL_ENV
+= GOPATH
="$(SOURCE_DIR)/gopath"
71 include $(WS_MAKE_RULES
)/common.mk
73 # We have to fiddle with the package archives to get them into the same source
74 # directory so that we can use the standard build targets. We're effectively
75 # building multiple components using a single target.
76 COMPONENT_POST_UNPACK_ACTION
= \
77 $(MV
) go
$(COMPONENT_SRC
)
79 # Go doesn't have a standard Makefile-based build process, so override the
81 COMPONENT_BUILD_ACTION
= \
82 cd
$(@D
)/src
; $(ENV
) $(COMPONENT_BUILD_ENV
) .
/make.bash
84 COMPONENT_TARGET_DIR
= \
85 $(PROTOUSRLIBDIR
)/$(COMPONENT_NAME
)/$(COMPONENT_MAJOR_VERSION
)
87 # We can't do any ASLR'ing as the Go 6l linker has no understanding of the
88 # -z aslr=... option. So just override where needed in the .p5m files.
89 ASLR_MODE
= $(ASLR_DISABLE
)
91 COMPONENT_TEST_ENV
+= PATH
="$(@D)/bin:$(PATH)"
92 COMPONENT_TEST_ENV
+= GOROOT
="$(@D)"
93 COMPONENT_TEST_DIR
= $(@D
)/src
94 COMPONENT_TEST_CMD
= .
/run.bash
95 COMPONENT_TEST_TARGETS
=
96 # Remove measured times (eg. 11.106s, 0.312s or 1,16s):
97 COMPONENT_TEST_TRANSFORMS
+= '-e "s/[0-9][0-9].[0-9][0-9][0-9]s//" '
98 COMPONENT_TEST_TRANSFORMS
+= '-e "s/[0-9].[0-9][0-9][0-9]s//" '
99 COMPONENT_TEST_TRANSFORMS
+= '-e "s/[0-9].[0-9][0-9]s//" '
100 # Remove occurrences of "(cached)":
101 COMPONENT_TEST_TRANSFORMS
+= '-e "s/(cached)//" '
102 # Replace port numbers with nnnnn on localhost:
103 COMPONENT_TEST_TRANSFORMS
+= '-e "s/127.0.0.1\:[0-9]*/127.0.0.1\:nnnnn/" '
104 # Remove trailing random numbers on TestReadOnlyWriteFile:
105 COMPONENT_TEST_TRANSFORMS
+= '-e "s/TestReadOnlyWriteFile[0-9]*/TestReadOnlyWriteFile/" '
107 # Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT
108 # Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools
109 define COMPONENT_INSTALL_ACTION
=
110 ($(MKDIR
) $(COMPONENT_TARGET_DIR
)/src
); \
111 (cd
$(SOURCE_DIR
) && \
112 /usr
/gnu
/bin
/find .
-maxdepth
1 -path
"./$(COMPONENT_SRC_NAME)" \
113 -prune
-o \
( ! -iname
".*" \
) -print \
114 -exec
/usr
/gnu
/bin
/cp
-r \
115 --parents
{} $(COMPONENT_TARGET_DIR
) \
;); \
116 (cd
$(BUILD_DIR_64
) && \
117 /usr
/gnu
/bin
/find src
-type f \
118 -exec
/usr
/gnu
/bin
/cp
--parents
{} $(COMPONENT_TARGET_DIR
) \
;); \
119 (cd
$(BUILD_DIR_64
) && $(CP
) -r bin
$(COMPONENT_TARGET_DIR
)/); \
120 (cd
$(BUILD_DIR_64
) && $(CP
) -r pkg
$(COMPONENT_TARGET_DIR
)/); \
121 (rm -r
$(COMPONENT_TARGET_DIR
)/pkg
/obj
); \
122 ($(MKDIR
) -p
$(MEDIATEDUSRSHAREMAN1DIR
)); \
123 /usr
/gnu
/bin
/find
$(COMPONENT_TARGET_DIR
)/src
-type f \
124 | egrep
-v
'\.go|\.s|\.bash|\.txt|\.c|\.tmpl|\.h|\.pl|\.md|\.S|\.py|\.dist|\.rc|\.bat|README|Makefile|\.awk|\.rules|\.mod|\.json|LICENSE|PATENTS'\
128 REQUIRED_PACKAGES
+= developer
/golang-116
129 # Auto-generated dependencies
130 REQUIRED_PACKAGES
+= system
/library