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]
22 # Copyright 2016 Aurelien Larcher
23 # Copyright 2017 Till Wegmueller
26 include ..
/..
/..
/make-rules
/shared-macros.mk
32 # This component is needed for bootstrapping golang 1.19 so it cannot be obsoleted yet.
35 COMPONENT_NAME
= golang
36 COMPONENT_VERSION
= 1.8.7
38 COMPONENT_MAJOR_VERSION
= $(shell echo
$(COMPONENT_VERSION
) | gsed
-e
's/\([0-9]\+\.[0-9]\+\).*/\1/')
39 COMPONENT_FMRI
= developer
/golang
40 COMPONENT_CLASSIFICATION
= Development
/Other Languages
41 COMPONENT_SUMMARY
= The Go Programming Language
42 COMPONENT_SRC
= $(COMPONENT_NAME
)-$(COMPONENT_VERSION
)
43 COMPONENT_PROJECT_URL
= https
://golang.org
/
44 COMPONENT_ARCHIVE
= go
$(COMPONENT_VERSION
).src.
tar.gz
45 COMPONENT_ARCHIVE_URL
= https
://storage.googleapis.com
/golang
/$(COMPONENT_ARCHIVE
)
46 COMPONENT_ARCHIVE_HASH
= sha256
:5911e751807eebbc1980dad4305ef5492b96d6cd720bf93cbcefa86e1c195f9e
47 COMPONENT_LICENSE
= BSD-style
, Patent Grant
48 COMPONENT_LICENSE_FILE
= $(COMPONENT_NAME
).license
49 MEDIATEDUSRSHAREMAN1DIR
= $(PROTO_DIR
)/usr
/share
/golang
/1.8/man
/man1
51 # Go has a number of supplementary tools and packages that are located in
52 # separate archives or source repositories. Because Go currently forces a
53 # recompile of all packages whenever the compiler changes, building and
54 # delivering them within the same build component build process is the best
57 # This version of Go is not actually packaged; it is only used to bootstrap the
58 # actual version of the Go that will be packaged. The long-term plan is
61 # - verify 1.5 produces "correct" result for bootstrapping 1.5 (upstream
62 # still uses 1.4 officially)
63 # - after 1.5 has been available for at least a few builds in the WOS, switch
64 # to building Go with system version of Go
65 # - when SPARC support is integrated into Go upstream, build upstream version
66 # using system Go for x86, then build Go for SPARC using upstream version
67 # just built for x86 (cross-compilation), package both at the same time
68 # - after SPARC version has been available for at least a few builds in the
69 # WOS, switch to building Go with system version for x86 and SPARC
72 COMPONENT_NAME_1
= golang
73 COMPONENT_VERSION_1
= 1.4.3
74 COMPONENT_SRC_NAME_1
= $(COMPONENT_NAME_1
)$(COMPONENT_VERSION_1
)
75 COMPONENT_SRC_1
= $(COMPONENT_SRC_NAME_1
)
76 COMPONENT_ARCHIVE_1
= go
$(COMPONENT_VERSION_1
).src.
tar.gz
77 COMPONENT_ARCHIVE_HASH_1
= \
78 sha256
:9947fc705b0b841b5938c48b22dc33e9647ec0752bae66e50278df4f23f64959
79 COMPONENT_ARCHIVE_URL_1
= https
://storage.googleapis.com
/golang
/$(COMPONENT_ARCHIVE_1
)
81 # Bake in where Go package will be installed.
82 GOROOT_FINAL
= /usr
/lib
/golang
/$(COMPONENT_MAJOR_VERSION
)
83 # Enable easier stack unwinding for debugging.
84 GOEXPERIMENT
= framepointer
85 COMPONENT_BUILD_ENV
+= CFLAGS
="$(CFLAGS) $(CPP_XPG6MODE)"
86 COMPONENT_BUILD_ENV
+= GOROOT_FINAL
="$(GOROOT_FINAL)"
87 COMPONENT_BUILD_ENV
+= GOEXPERIMENT
="$(GOEXPERIMENT)"
88 COMPONENT_BUILD_ENV
+= \
89 GOROOT_BOOTSTRAP
="$(BUILD_DIR_64)/$(COMPONENT_SRC_NAME_1)"
91 # For convenience during installation of supplementary packages.
92 COMPONENT_INSTALL_ENV
+= PATH
="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
93 COMPONENT_INSTALL_ENV
+= GOROOT
="$(PROTO_DIR)$(GOROOT_FINAL)"
94 COMPONENT_INSTALL_ENV
+= GOPATH
="$(SUPP_ROOT)"
96 include $(WS_MAKE_RULES
)/prep.mk
97 include $(WS_MAKE_RULES
)/justmake.mk
98 include $(WS_MAKE_RULES
)/ips.mk
100 # We have to fiddle with the package archives to get them into the same source
101 # directory so that we can use the standard build targets. We're effectively
102 # building multiple components using a single target.
103 COMPONENT_POST_UNPACK_ACTION
= \
104 $(MV
) go
$(COMPONENT_SRC
)
106 COMPONENT_POST_UNPACK_ACTION_1
= \
107 $(MV
) go
$(COMPONENT_SRC_1
) && \
108 $(CP
) -r
$(COMPONENT_SRC_1
) $(COMPONENT_SRC
)/$(COMPONENT_SRC_1
)
110 # Fixup compressed data affected by patches.
111 COMPONENT_PREP_ACTION
= \
112 cd
$(COMPONENT_SRC
) && \
113 bzip2
-c src
/compress
/testdata
/Mark.Twain-Tom.Sawyer.txt
> \
114 src
/compress
/bzip2
/testdata
/Mark.Twain-Tom.Sawyer.txt.bz2
116 # Build the bootstrap compiler before attempting to build Go 1.5+. For the
117 # bootstrap compiler ensure GOROOT_FINAL is unset as it will be executed out of
118 # the build area, and ensure GOROOT_BOOTSTRAP is also not set. GOEXPERIMENT
119 # must also be unset as it is 1.5+ only.
120 COMPONENT_PRE_BUILD_ACTION
= \
121 cd
$(@D
)/$(COMPONENT_SRC_NAME_1
)/src
; \
122 $(ENV
) $(COMPONENT_BUILD_ENV
) \
123 PATH
="$(GCC_BINDIR):$(PATH)" \
124 GOEXPERIMENT
= GOROOT_BOOTSTRAP
= GOROOT_FINAL
= .
/make.bash
126 # Go doesn't have a standard Makefile-based build process, so override the
128 COMPONENT_BUILD_ACTION
= \
129 cd
$(@D
)/src
; $(ENV
) $(COMPONENT_BUILD_ENV
) \
130 PATH
="$(GCC_BINDIR):$(PATH)" \
133 COMPONENT_TARGET_DIR
= \
134 $(PROTOUSRLIBDIR
)/$(COMPONENT_NAME
)/$(COMPONENT_MAJOR_VERSION
)
136 # We can't do any ASLR'ing as the Go 6l linker has no understanding of the
137 # -z aslr=... option. So just override where needed in the .p5m files.
138 ASLR_MODE
= $(ASLR_DISABLE
)
140 COMPONENT_TEST_ENV
+= PATH
="$(@D)/bin:$(GCC_BINDIR):$(PATH)"
141 COMPONENT_TEST_ENV
+= GOROOT
="$(@D)"
142 COMPONENT_TEST_DIR
= $(@D
)/src
143 COMPONENT_TEST_CMD
= .
/run.bash
144 COMPONENT_TEST_TARGETS
=
146 define COMPONENT_INSTALL_ACTION
=
147 ($(MKDIR
) $(COMPONENT_TARGET_DIR
)/src
); \
148 (cd
$(SOURCE_DIR
) && \
149 /usr
/gnu
/bin
/find .
-maxdepth
1 -path
"./$(COMPONENT_SRC_NAME_1)" \
150 -prune
-o \
( ! -iname
".*" \
) -print \
151 -exec
/usr
/gnu
/bin
/cp
-r \
152 --parents
{} $(COMPONENT_TARGET_DIR
) \
;); \
153 (cd
$(BUILD_DIR_64
) && \
154 /usr
/gnu
/bin
/find src
-type f \
155 -exec
/usr
/gnu
/bin
/cp
--parents
{} $(COMPONENT_TARGET_DIR
) \
;); \
156 (cd
$(BUILD_DIR_64
) && $(CP
) -r bin
$(COMPONENT_TARGET_DIR
)/); \
157 (cd
$(BUILD_DIR_64
) && $(CP
) -r pkg
$(COMPONENT_TARGET_DIR
)/); \
158 ($(MKDIR
) -p
$(MEDIATEDUSRSHAREMAN1DIR
) && cp
-f
$(COMPONENT_DIR
)/files
/go
.1 $(MEDIATEDUSRSHAREMAN1DIR
));
164 install: build
$(INSTALL_64
)
168 # Auto-generated dependencies
169 REQUIRED_PACKAGES
+= system
/library