Marcel Telka
2024-04-05 e5e9b978d16f3a418fcae51695fb9398f0a160ed
commit | author | age
531cdb 1 #
TW 2 # CDDL HEADER START
3 #
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.
7 #
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.
12 #
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]
18 #
19 # CDDL HEADER END
20 #
21
22 #
23 # Copyright 2021 Till Wegmueller
24 #
25
26 BUILD_BITS= 64
27 BUILD_STYLE= justmake
28 USE_COMMON_TEST_MASTER= no
29 CLONEY_ARGS= CLONEY_MODE="copy"
18b52d 30 USE_PARALLEL_BUILD= yes
531cdb 31 include ../../../make-rules/shared-macros.mk
TW 32
33 PATCH_EACH_ARCHIVE= 1
34
35 COMPONENT_NAME=            golang
36 COMPONENT_MAJOR_VERSION=    1.20
13c7b1 37 COMPONENT_VERSION=        $(COMPONENT_MAJOR_VERSION).14
18b52d 38 COMPONENT_REVISION=        1
531cdb 39 COMPONENT_SUMMARY=        The Go Programming Language
TW 40 COMPONENT_SRC=            $(COMPONENT_NAME)-$(COMPONENT_VERSION)
41 COMPONENT_PROJECT_URL=        https://golang.org/
42 COMPONENT_ARCHIVE=        go$(COMPONENT_VERSION).src.tar.gz
43 COMPONENT_ARCHIVE_URL=        https://storage.googleapis.com/golang/$(COMPONENT_ARCHIVE)
13c7b1 44 COMPONENT_ARCHIVE_HASH=        sha256:1aef321a0e3e38b7e91d2d7eb64040666cabdcc77d383de3c9522d0d69b67f4e
531cdb 45 COMPONENT_FMRI=            developer/golang
TW 46 COMPONENT_CLASSIFICATION=    Development/Other Languages
47 COMPONENT_LICENSE=        BSD-style, Patent Grant
48 COMPONENT_LICENSE_FILE=        LICENSE
49
50 MEDIATEDUSRSHAREMAN1DIR=    $(PROTO_DIR)/usr/share/golang/$(COMPONENT_MAJOR_VERSION)/man/man1
51
52 # Go has a number of supplementary tools and packages that are located in
53 # separate archives or source repositories. Because Go currently forces a
54 # recompile of all packages whenever the compiler changes, building and
55 # delivering them within the same build component build process is the best
56 # option for now.
57
58 # Bake in where Go package will be installed.
59 GOROOT_FINAL=        /usr/lib/golang/$(COMPONENT_MAJOR_VERSION)
60 # Enable easier stack unwinding for debugging.
61 GOEXPERIMENT=
62 COMPONENT_BUILD_ENV +=    GOROOT_FINAL="$(GOROOT_FINAL)"
63 COMPONENT_BUILD_ENV +=    GOEXPERIMENT="$(GOEXPERIMENT)"
64 COMPONENT_BUILD_ENV +=    GOOS="illumos"
65 COMPONENT_BUILD_ENV +=    GOCACHE="$(SOURCE_DIR)/gocache"
66 COMPONENT_BUILD_ENV +=  GOPATH="$(SOURCE_DIR)/gopath"
67 COMPONENT_BUILD_ENV +=  GO_LDSO=/lib/64/ld.so.1
68 COMPONENT_BUILD_ENV +=  GOROOT_BOOTSTRAP="$(shell realpath .)/go_bootstrap"
69
70 # For convenience during installation of supplementary packages.
71 COMPONENT_INSTALL_ENV += PATH="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
72 COMPONENT_INSTALL_ENV += GOROOT="$(PROTO_DIR)$(GOROOT_FINAL)"
73 COMPONENT_INSTALL_ENV += GOCACHE="$(SOURCE_DIR)/gocache"
74 COMPONENT_INSTALL_ENV += GOROOT_BOOTSTRAP="$(shell realpath .)/go_bootstrap"
75 COMPONENT_INSTALL_ENV += GOPATH="$(SOURCE_DIR)/gopath"
76
77 include $(WS_MAKE_RULES)/common.mk
78
79 # We have to fiddle with the package archives to get them into the same source
80 # directory so that we can use the standard build targets.  We're effectively
81 # building multiple components using a single target.
82 COMPONENT_POST_UNPACK_ACTION= \
83     $(MV) go $(COMPONENT_SRC); ./bootstrap_get.sh
84
85 # Go doesn't have a standard Makefile-based build process, so override the
86 # default.
87 COMPONENT_BUILD_ACTION=    \
88     cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash
89
90 COMPONENT_TARGET_DIR= \
91     $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION)
92
93 # We can't do any ASLR'ing as the Go 6l linker has no understanding of the
94 # -z aslr=... option. So just override where needed in the .p5m files.
95 ASLR_MODE = $(ASLR_DISABLE)
96
97 COMPONENT_TEST_ENV +=    PATH="$(@D)/bin:$(PATH)"
98 COMPONENT_TEST_ENV +=    GOROOT="$(@D)"
99 COMPONENT_TEST_DIR =    $(@D)/src
100 COMPONENT_TEST_CMD =    ./run.bash
101 COMPONENT_TEST_TARGETS =
102 # Remove measured times (eg. 11.106s, 0.312s or 1,16s):
103 COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9][0-9].[0-9][0-9][0-9]s//" '
104 COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9].[0-9][0-9][0-9]s//" '
105 COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9].[0-9][0-9]s//" '
106 # Remove occurrences of "(cached)":
107 COMPONENT_TEST_TRANSFORMS += '-e "s/(cached)//" '
108 # Replace port numbers with nnnnn on localhost:
109 COMPONENT_TEST_TRANSFORMS += '-e "s/127.0.0.1\:[0-9]*/127.0.0.1\:nnnnn/" '
110 # Remove trailing random numbers on TestReadOnlyWriteFile: 
111 COMPONENT_TEST_TRANSFORMS += '-e "s/TestReadOnlyWriteFile[0-9]*/TestReadOnlyWriteFile/" '
112
113 # Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT
114 # Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools
115 define COMPONENT_INSTALL_ACTION=
116     ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \
117     (cd $(SOURCE_DIR) && \
118     /usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \
119       -prune -o \( ! -iname ".*" \) -print \
120       -exec /usr/gnu/bin/cp -r \
121       --parents {} $(COMPONENT_TARGET_DIR) \;); \
122     (cd $(BUILD_DIR_64) && \
123     /usr/gnu/bin/find src -type f \
124         -exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \
125     (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
126     (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
127     (rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \
128     ($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \
129     /usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \
130            | egrep -v '\.go|\.s|\.bash|\.txt|\.c|\.tmpl|\.h|\.pl|\.md|\.S|\.py|\.dist|\.rc|\.bat|README|Makefile|\.awk|\.rules|\.mod|\.json|LICENSE|PATENTS|\.bin'\
131     | xargs rm;
132 endef
133
134 REQUIRED_PACKAGES += developer/golang-119
135
136 # Auto-generated dependencies
137 REQUIRED_PACKAGES += system/library