Till Wegmüller
2024-04-07 32d55185c6e52012a7f3fbcd5ff32dbce22c3104
component(developer/golang-122): Add Component

Signed-off-by: Till Wegmüller <toasterson@gmail.com>
6 files added
25435 ■■■■■ changed files
components/developer/golang-122/Makefile 137 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/golang-122.p5m 12618 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/manifests/sample-manifest.p5m 12601 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/patches/02_Dup2_golang10.patch 41 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/patches/03-mkfifo-backport.patch 28 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/pkg5 10 ●●●●● patch | view | raw | blame | history
components/developer/golang-122/Makefile
New file
@@ -0,0 +1,137 @@
#
# CDDL HEADER START
#
# The contents of this file are subject to the terms of the
# Common Development and Distribution License (the "License").
# You may not use this file except in compliance with the License.
#
# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
# or http://www.opensolaris.org/os/licensing.
# See the License for the specific language governing permissions
# and limitations under the License.
#
# When distributing Covered Code, include this CDDL HEADER in each
# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
# If applicable, add the following below this CDDL HEADER, with the
# fields enclosed by brackets "[]" replaced with your own identifying
# information: Portions Copyright [yyyy] [name of copyright owner]
#
# CDDL HEADER END
#
#
# Copyright 2023 Till Wegmueller
#
BUILD_BITS= 64
BUILD_STYLE= justmake
USE_COMMON_TEST_MASTER= no
CLONEY_ARGS= CLONEY_MODE="copy"
USE_PARALLEL_BUILD= yes
include ../../../make-rules/shared-macros.mk
COMPONENT_NAME=            golang
COMPONENT_MAJOR_VERSION=    1.22
COMPONENT_VERSION=        $(COMPONENT_MAJOR_VERSION).2
COMPONENT_SUMMARY=        The Go Programming Language
COMPONENT_SRC=            $(COMPONENT_NAME)-$(COMPONENT_VERSION)
COMPONENT_PROJECT_URL=        https://golang.org/
COMPONENT_ARCHIVE=        go$(COMPONENT_VERSION).src.tar.gz
COMPONENT_ARCHIVE_URL=        https://storage.googleapis.com/golang/$(COMPONENT_ARCHIVE)
COMPONENT_ARCHIVE_HASH=        sha256:374ea82b289ec738e968267cac59c7d5ff180f9492250254784b2044e90df5a9
COMPONENT_FMRI=            developer/golang
COMPONENT_CLASSIFICATION=    Development/Other Languages
COMPONENT_LICENSE=        BSD-style, Patent Grant
COMPONENT_LICENSE_FILE=        LICENSE
PATCH_EACH_ARCHIVE= 1
MEDIATEDUSRSHAREMAN1DIR=    $(PROTO_DIR)/usr/share/golang/$(COMPONENT_MAJOR_VERSION)/man/man1
# Go has a number of supplementary tools and packages that are located in
# separate archives or source repositories. Because Go currently forces a
# recompile of all packages whenever the compiler changes, building and
# delivering them within the same build component build process is the best
# option for now.
# Bake in where Go package will be installed.
GOROOT_FINAL=        /usr/lib/golang/$(COMPONENT_MAJOR_VERSION)
# Enable easier stack unwinding for debugging.
GOEXPERIMENT=
COMPONENT_BUILD_ENV +=    GOROOT_FINAL="$(GOROOT_FINAL)"
COMPONENT_BUILD_ENV +=    GOEXPERIMENT="$(GOEXPERIMENT)"
COMPONENT_BUILD_ENV +=    GOOS="illumos"
COMPONENT_BUILD_ENV +=    GOCACHE="$(SOURCE_DIR)/gocache"
COMPONENT_BUILD_ENV +=  GOPATH="$(SOURCE_DIR)/gopath"
COMPONENT_BUILD_ENV +=  GO_LDSO=/lib/64/ld.so.1
COMPONENT_BUILD_ENV +=  GOROOT_BOOTSTRAP=/usr/lib/golang/1.21
# For convenience during installation of supplementary packages.
COMPONENT_INSTALL_ENV += PATH="$(PROTO_DIR)$(GOROOT_FINAL)/bin:$(PATH)"
COMPONENT_INSTALL_ENV += GOROOT="$(PROTO_DIR)$(GOROOT_FINAL)"
COMPONENT_INSTALL_ENV += GOCACHE="$(SOURCE_DIR)/gocache"
COMPONENT_INSTALL_ENV += GOROOT_BOOTSTRAP=/usr/lib/golang/1.21
COMPONENT_INSTALL_ENV += GOPATH="$(SOURCE_DIR)/gopath"
include $(WS_MAKE_RULES)/common.mk
# We have to fiddle with the package archives to get them into the same source
# directory so that we can use the standard build targets.  We're effectively
# building multiple components using a single target.
COMPONENT_POST_UNPACK_ACTION= $(MV) go $(COMPONENT_SRC)
# Go doesn't have a standard Makefile-based build process, so override the
# default.
COMPONENT_BUILD_ACTION=    \
    cd $(@D)/src; $(ENV) $(COMPONENT_BUILD_ENV) ./make.bash
COMPONENT_TARGET_DIR= \
    $(PROTOUSRLIBDIR)/$(COMPONENT_NAME)/$(COMPONENT_MAJOR_VERSION)
# We can't do any ASLR'ing as the Go 6l linker has no understanding of the
# -z aslr=... option. So just override where needed in the .p5m files.
ASLR_MODE = $(ASLR_DISABLE)
COMPONENT_TEST_ENV +=    PATH="$(@D)/bin:$(PATH)"
COMPONENT_TEST_ENV +=    GOROOT="$(@D)"
COMPONENT_TEST_ENV +=     GOCACHE="$(SOURCE_DIR)/gocache"
COMPONENT_TEST_ENV +=    TMPDIR="/var/tmp"
COMPONENT_TEST_DIR =    $(@D)/src
COMPONENT_TEST_CMD =    ./run.bash
COMPONENT_TEST_TARGETS =
# Remove measured times (eg. 11.106s, 0.312s or 1,16s):
COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9][0-9].[0-9][0-9][0-9]s//" '
COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9].[0-9][0-9][0-9]s//" '
COMPONENT_TEST_TRANSFORMS += '-e "s/[0-9].[0-9][0-9]s//" '
# Remove occurrences of "(cached)":
COMPONENT_TEST_TRANSFORMS += '-e "s/(cached)//" '
# Replace port numbers with nnnnn on localhost:
COMPONENT_TEST_TRANSFORMS += '-e "s/127.0.0.1\:[0-9]*/127.0.0.1\:nnnnn/" '
# Remove trailing random numbers on TestReadOnlyWriteFile:
COMPONENT_TEST_TRANSFORMS += '-e "s/TestReadOnlyWriteFile[0-9]*/TestReadOnlyWriteFile/" '
# Use this Command to copy the Go Source tree into the proto area. In order to deliver the Go SDK under GOROOT
# Additionally nuke all the funky binary files used for test suites. They keep bothering the packaging tools
define COMPONENT_INSTALL_ACTION=
    ($(MKDIR) $(COMPONENT_TARGET_DIR)/src); \
    (cd $(SOURCE_DIR) && \
    /usr/gnu/bin/find . -maxdepth 1 -path "./$(COMPONENT_SRC_NAME)" \
      -prune -o \( ! -iname ".*" \) -print \
      -exec /usr/gnu/bin/cp -r \
      --parents {} $(COMPONENT_TARGET_DIR) \;); \
    (cd $(BUILD_DIR_64) && \
    /usr/gnu/bin/find src -type f \
        -exec /usr/gnu/bin/cp --parents {} $(COMPONENT_TARGET_DIR) \;); \
    (cd $(BUILD_DIR_64) && $(CP) -r bin $(COMPONENT_TARGET_DIR)/); \
    (cd $(BUILD_DIR_64) && $(CP) -r pkg $(COMPONENT_TARGET_DIR)/); \
    (rm -r $(COMPONENT_TARGET_DIR)/pkg/obj); \
    ($(MKDIR) -p $(MEDIATEDUSRSHAREMAN1DIR)); \
    /usr/gnu/bin/find $(COMPONENT_TARGET_DIR)/src -type f \
           | 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'\
    | xargs rm;
endef
REQUIRED_PACKAGES += developer/golang-121
# Auto-generated dependencies
REQUIRED_PACKAGES += system/library
components/developer/golang-122/golang-122.p5m
New file
Diff too large
components/developer/golang-122/manifests/sample-manifest.p5m
New file
Diff too large
components/developer/golang-122/patches/02_Dup2_golang10.patch
New file
@@ -0,0 +1,41 @@
--- golang-1.10/src/syscall/zsyscall_solaris_amd64.go    2018-02-16 09:12:19.000000000 +0000
+++ golang-1.10/src/syscall/zsyscall_solaris_amd64.go.1    2018-05-01 03:21:18.224140250 +0000
@@ -21,6 +21,7 @@
 //go:cgo_import_dynamic libc_Chroot chroot "libc.so"
 //go:cgo_import_dynamic libc_Close close "libc.so"
 //go:cgo_import_dynamic libc_Dup dup "libc.so"
+//go:cgo_import_dynamic libc_Dup2 dup2 "libc.so"
 //go:cgo_import_dynamic libc_Fchdir fchdir "libc.so"
 //go:cgo_import_dynamic libc_Fchmod fchmod "libc.so"
 //go:cgo_import_dynamic libc_Fchown fchown "libc.so"
@@ -105,6 +106,7 @@
 //go:linkname libc_Chroot libc_Chroot
 //go:linkname libc_Close libc_Close
 //go:linkname libc_Dup libc_Dup
+//go:linkname libc_Dup2 libc_Dup2
 //go:linkname libc_Fchdir libc_Fchdir
 //go:linkname libc_Fchmod libc_Fchmod
 //go:linkname libc_Fchown libc_Fchown
@@ -192,6 +194,7 @@
     libc_Chroot,
     libc_Close,
     libc_Dup,
+    libc_Dup2,
     libc_Fchdir,
     libc_Fchmod,
     libc_Fchown,
@@ -410,6 +413,14 @@
     return
 }
+func Dup2(oldfd int, newfd int) (err error) {
+        _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Dup2)), 2, uintptr(oldfd), uintptr(newfd), 0, 0, 0, 0)
+        if e1 != 0 {
+                err = errnoErr(e1)
+        }
+        return
+}
+
 func Fchdir(fd int) (err error) {
     _, _, e1 := sysvicall6(uintptr(unsafe.Pointer(&libc_Fchdir)), 1, uintptr(fd), 0, 0, 0, 0, 0)
     if e1 != 0 {
components/developer/golang-122/patches/03-mkfifo-backport.patch
New file
@@ -0,0 +1,28 @@
From a2671e12b19ecab0e60e745a29eb8e0751fe45a8 Mon Sep 17 00:00:00 2001
From: Jonathan Perkin <jonathan@perkin.org.uk>
Date: Tue, 02 Apr 2024 18:07:25 +0000
Subject: [PATCH] syscall: implement Mkfifo on illumos
Change-Id: Ied223c3a0121d907b6f32005ea9f1bf5e4aebdc4
GitHub-Last-Rev: 38142b90bc8fbf25a31d3e12702e22af5d5af1e2
GitHub-Pull-Request: golang/go#66648
Userland-Porter: Toasterson
Userland-Port-Note: This PR has been backported and wont be needed in the future. Mark for review and possible removal in golang 1.23
---
diff --git a/src/syscall/syscall_solaris.go b/src/syscall/syscall_solaris.go
index 30400b4..89e9459 100644
--- a/src/syscall/syscall_solaris.go
+++ b/src/syscall/syscall_solaris.go
@@ -280,6 +280,10 @@
     return int(r0), err
 }
+func Mkfifo(path string, mode uint32) (err error) {
+    return Mknod(path, mode|S_IFIFO, 0)
+}
+
 func gethostname() (name string, err uintptr)
 func Gethostname() (name string, err error) {
components/developer/golang-122/pkg5
New file
@@ -0,0 +1,10 @@
{
    "dependencies": [
        "developer/golang-121",
        "system/library"
    ],
    "fmris": [
        "developer/golang-122"
    ],
    "name": "golang"
}