Marcel Telka
2024-04-08 5d8bcb58722b250c296fc0324f9d06470fb3d7d0
commit | author | age
458d38 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_STYLE= justmake
27 USE_COMMON_TEST_MASTER= no
28 CLONEY_ARGS= CLONEY_MODE="copy"
1d5fdb 29 USE_PARALLEL_BUILD= yes
458d38 30 include ../../../make-rules/shared-macros.mk
TW 31
32 PATCH_EACH_ARCHIVE= 1
33
34 COMPONENT_NAME=            golang
35 COMPONENT_MAJOR_VERSION=    1.19
088c3e 36 COMPONENT_VERSION=        $(COMPONENT_MAJOR_VERSION).13
1d5fdb 37 COMPONENT_REVISION=        2
458d38 38 COMPONENT_SUMMARY=        The Go Programming Language
TW 39 COMPONENT_SRC=            $(COMPONENT_NAME)-$(COMPONENT_VERSION)
40 COMPONENT_PROJECT_URL=        https://golang.org/
41 COMPONENT_ARCHIVE=        go$(COMPONENT_VERSION).src.tar.gz
42 COMPONENT_ARCHIVE_URL=        https://storage.googleapis.com/golang/$(COMPONENT_ARCHIVE)
088c3e 43 COMPONENT_ARCHIVE_HASH=        sha256:ccf36b53fb0024a017353c3ddb22c1f00bc7a8073c6aac79042da24ee34434d3
155edf 44 COMPONENT_FMRI=            developer/golang
AW 45 COMPONENT_CLASSIFICATION=    Development/Other Languages
458d38 46 COMPONENT_LICENSE=        BSD-style, Patent Grant
155edf 47 COMPONENT_LICENSE_FILE=        LICENSE
AW 48
458d38 49 MEDIATEDUSRSHAREMAN1DIR=    $(PROTO_DIR)/usr/share/golang/$(COMPONENT_MAJOR_VERSION)/man/man1
TW 50
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
55 # option for now.
56
57 # Bake in where Go package will be installed.
58 GOROOT_FINAL=        /usr/lib/golang/$(COMPONENT_MAJOR_VERSION)
59 # Enable easier stack unwinding for debugging.
60 GOEXPERIMENT=
9e64ec 61 # Use golang 1.8 to bootstrap golang 1.19
MT 62 COMPONENT_BUILD_ENV += GOROOT_BOOTSTRAP="/usr/lib/golang/1.8"
458d38 63 COMPONENT_BUILD_ENV +=    GOROOT_FINAL="$(GOROOT_FINAL)"
TW 64 COMPONENT_BUILD_ENV +=    GOEXPERIMENT="$(GOEXPERIMENT)"
65 COMPONENT_BUILD_ENV +=    GOOS="illumos"
66 COMPONENT_BUILD_ENV +=    GOCACHE="$(SOURCE_DIR)/gocache"
67 COMPONENT_BUILD_ENV +=  GOPATH="$(SOURCE_DIR)/gopath"
68 COMPONENT_BUILD_ENV +=  GO_LDSO=/lib/64/ld.so.1
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 += GOPATH="$(SOURCE_DIR)/gopath"
75
76 include $(WS_MAKE_RULES)/common.mk
77
78 # We have to fiddle with the package archives to get them into the same source
79 # directory so that we can use the standard build targets.  We're effectively
80 # building multiple components using a single target.
81 COMPONENT_POST_UNPACK_ACTION= \
82     $(MV) go $(COMPONENT_SRC)
83
84 # Go doesn't have a standard Makefile-based build process, so override the
85 # default.
86 COMPONENT_BUILD_ACTION=    \
87     cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash
88
89 COMPONENT_TARGET_DIR= \
90     $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION)
91
92 # We can't do any ASLR'ing as the Go 6l linker has no understanding of the
93 # -z aslr=... option. So just override where needed in the .p5m files.
94 ASLR_MODE = $(ASLR_DISABLE)
95
96 COMPONENT_TEST_ENV +=    PATH="$(@D)/bin:$(PATH)"
97 COMPONENT_TEST_ENV +=    GOROOT="$(@D)"
98 COMPONENT_TEST_DIR =    $(@D)/src
99 COMPONENT_TEST_CMD =    ./run.bash
100 COMPONENT_TEST_TARGETS =
9e64ec 101 # Remove CPU
MT 102 COMPONENT_TEST_TRANSFORMS += "-e '/^\# CPU:/d'"
103 # Remove OS Version
104 COMPONENT_TEST_TRANSFORMS += "-e '/^\# OS Version:/d'"
458d38 105 # Remove measured times (eg. 11.106s, 0.312s or 1,16s):
9e64ec 106 COMPONENT_TEST_TRANSFORMS += "-e 's/[ \t]*[0-9]\{1,\}\.[0-9]\{1,\}s//'"
458d38 107
TW 108 # Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT
109 # Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools
110 define COMPONENT_INSTALL_ACTION=
111     ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \
112     (cd $(SOURCE_DIR) && \
113     /usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \
114       -prune -o \( ! -iname ".*" \) -print \
115       -exec /usr/gnu/bin/cp -r \
116       --parents {} $(COMPONENT_TARGET_DIR) \;); \
117     (cd $(BUILD_DIR_64) && \
118     /usr/gnu/bin/find src -type f \
119         -exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \
120     (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
121     (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
122     (rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \
123     ($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \
124     /usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \
125            | 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'\
126     | xargs rm;
127 endef
128
9e64ec 129 REQUIRED_PACKAGES += developer/golang-18
0e8d0a 130
458d38 131 # Auto-generated dependencies
TW 132 REQUIRED_PACKAGES += system/library