pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/caddy caddy: Fix build on SunOS.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/651bdd5d688a
branches:  trunk
changeset: 388578:651bdd5d688a
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Nov 23 10:07:30 2022 +0000

description:
caddy: Fix build on SunOS.

diffstat:

 www/caddy/Makefile                         |  10 ++++-
 www/caddy/distinfo                         |   4 +-
 www/caddy/patches/patch-listen__illumos.go |  50 ++++++++++++++++++++++++++++++
 www/caddy/patches/patch-listen__unix.go    |  15 +++++++++
 4 files changed, 76 insertions(+), 3 deletions(-)

diffs (114 lines):

diff -r fe5fcbd87180 -r 651bdd5d688a www/caddy/Makefile
--- a/www/caddy/Makefile        Wed Nov 23 09:34:34 2022 +0000
+++ b/www/caddy/Makefile        Wed Nov 23 10:07:30 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.61 2022/11/02 19:39:50 bsiegert Exp $
+# $NetBSD: Makefile,v 1.62 2022/11/23 10:07:30 jperkin Exp $
 
 DISTNAME=      caddy-2.6.2
 PKGREVISION=   1
@@ -11,9 +11,15 @@
 COMMENT=       General-purpose web server
 LICENSE=       apache-2.0
 
-GO_BUILD_PATTERN=      ./...
 EXTRACT_USING=         bsdtar
 
+# Work around go's lack of conditional compilation.
+pre-patch:
+       ${CP} ${WRKSRC}/listen_unix.go ${WRKSRC}/listen_illumos.go
+
+post-patch:
+       ${CP} ${WRKSRC}/listen_illumos.go ${WRKSRC}/listen_solaris.go
+
 .include "go-modules.mk"
 
 .include "../../lang/go/go-module.mk"
diff -r fe5fcbd87180 -r 651bdd5d688a www/caddy/distinfo
--- a/www/caddy/distinfo        Wed Nov 23 09:34:34 2022 +0000
+++ b/www/caddy/distinfo        Wed Nov 23 10:07:30 2022 +0000
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.15 2022/10/25 18:12:33 bsiegert Exp $
+$NetBSD: distinfo,v 1.16 2022/11/23 10:07:30 jperkin Exp $
 
 BLAKE2s (caddy-2.6.2.tar.gz) = 38591c87355c19b11561051e09bd8c196087d6bcf30cbeff3664bbc7056f9af7
 SHA512 (caddy-2.6.2.tar.gz) = 01761de707668d589af7eeecdd694c94e867d5710f0b72285b4d2e6fb26cf9e10baeed3920e9b9b292c75568c84ff79b400026e37d7dcc003cebb839469b6c1b
@@ -3330,3 +3330,5 @@
 BLAKE2s (sourcegraph.com_sourcegraph_appdash_@v_v0.0.0-20190731080439-ebfcffb1b5c0.mod) = 540120cf9a874588188b78b9cb2cb50598bfffd4f144e5fb2315313375937a3c
 SHA512 (sourcegraph.com_sourcegraph_appdash_@v_v0.0.0-20190731080439-ebfcffb1b5c0.mod) = 
7d863e4af4e480a247bc767d1de96ff8050b12a13a182a9a8fa68c983c2f0b1a16b509d40de3cca552082535f876458034e1510f0f0feef383f16e1f84f81282
 Size (sourcegraph.com_sourcegraph_appdash_@v_v0.0.0-20190731080439-ebfcffb1b5c0.mod) = 43 bytes
+SHA1 (patch-listen__illumos.go) = b809ece5d61c1a1fd1f7826e4bef9715d3d2ea4f
+SHA1 (patch-listen__unix.go) = f24cd2be693e32d318bb4cd94b118ee1717ff528
diff -r fe5fcbd87180 -r 651bdd5d688a www/caddy/patches/patch-listen__illumos.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/caddy/patches/patch-listen__illumos.go        Wed Nov 23 10:07:30 2022 +0000
@@ -0,0 +1,50 @@
+$NetBSD: patch-listen__illumos.go,v 1.1 2022/11/23 10:07:30 jperkin Exp $
+
+SunOS platforms do not have SO_REUSEPORT.
+
+--- listen_illumos.go.orig     2022-11-23 09:48:44.378654914 +0000
++++ listen_illumos.go
+@@ -15,7 +15,7 @@
+ // TODO: Go 1.19 introduced the "unix" build tag. We have to support Go 1.18 until Go 1.20 is released.
+ // When Go 1.19 is our minimum, remove this build tag, since "_unix" in the filename will do this.
+ // (see also change needed in listen.go)
+-//go:build aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || linux || netbsd || openbsd || solaris
++//go:build illumos || solaris
+ 
+ package caddy
+ 
+@@ -26,9 +26,6 @@ import (
+       "net"
+       "sync/atomic"
+       "syscall"
+-
+-      "go.uber.org/zap"
+-      "golang.org/x/sys/unix"
+ )
+ 
+ // reuseUnixSocket copies and reuses the unix domain socket (UDS) if we already
+@@ -96,23 +93,7 @@ func listenTCPOrUnix(ctx context.Context
+                               return err
+                       }
+               }
+-              return reusePort(network, address, c)
+-      }
+-      return config.Listen(ctx, network, address)
+-}
+-
+-// reusePort sets SO_REUSEPORT. Ineffective for unix sockets.
+-func reusePort(network, address string, conn syscall.RawConn) error {
+-      if isUnixNetwork(network) {
+               return nil
+       }
+-      return conn.Control(func(descriptor uintptr) {
+-              if err := unix.SetsockoptInt(int(descriptor), unix.SOL_SOCKET, unix.SO_REUSEPORT, 1); err != nil {
+-                      Log().Error("setting SO_REUSEPORT",
+-                              zap.String("network", network),
+-                              zap.String("address", address),
+-                              zap.Uintptr("descriptor", descriptor),
+-                              zap.Error(err))
+-              }
+-      })
++      return config.Listen(ctx, network, address)
+ }
diff -r fe5fcbd87180 -r 651bdd5d688a www/caddy/patches/patch-listen__unix.go
--- /dev/null   Thu Jan 01 00:00:00 1970 +0000
+++ b/www/caddy/patches/patch-listen__unix.go   Wed Nov 23 10:07:30 2022 +0000
@@ -0,0 +1,15 @@
+$NetBSD: patch-listen__unix.go,v 1.1 2022/11/23 10:07:30 jperkin Exp $
+
+SunOS platforms do not have SO_REUSEPORT.
+
+--- listen_unix.go.orig        2022-10-13 17:30:57.000000000 +0000
++++ listen_unix.go
+@@ -15,7 +15,7 @@
+ // TODO: Go 1.19 introduced the "unix" build tag. We have to support Go 1.18 until Go 1.20 is released.
+ // When Go 1.19 is our minimum, remove this build tag, since "_unix" in the filename will do this.
+ // (see also change needed in listen.go)
+-//go:build aix || android || darwin || dragonfly || freebsd || hurd || illumos || ios || linux || netbsd || openbsd || solaris
++//go:build aix || android || darwin || dragonfly || freebsd || hurd || ios || linux || netbsd || openbsd
+ 
+ package caddy
+ 



Home | Main Index | Thread Index | Old Index