02.01.2026 02:32, Edd Barrett пишет:
> Hi,
> 
> I recently noticed hard-coded paths in a syncthing patch. Below is a diff to
> fix that.
> 
> I had planned to to the SUBST_CMD in a pre-configure, but that doesn't work as
> expected in go ports. Is what I've done instead correct?
> 
> Syncthing is still able to open a broswer and restart itself after this 
> change.
> 
> I bumped, even though it'd only matter if you installed packages somewhere
> other than the default /usr/local.

As you like, I just stopped bothering with what is practically a constant.

> OK?
> 
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/Makefile,v
> diff -u -p -r1.74 Makefile
> --- Makefile  1 Jan 2026 22:24:37 -0000       1.74
> +++ Makefile  1 Jan 2026 23:16:37 -0000
> @@ -1,6 +1,7 @@
>  COMMENT =    open decentralized synchronization utility
>  
>  V =          2.0.12
> +REVISION =   0
>  DISTNAME =   syncthing-${V}
>  DISTFILES =  syncthing-source-v${V}${EXTRACT_SUFX}
>  
> @@ -28,6 +29,9 @@ MODULES =           lang/go
>  ST_CMDS =    syncthing stdiscosrv strelaysrv
>  
>  MAKE_ENV =   GOMAXPROCS=${MAKE_JOBS}
> +
> +pre-build:
> +     ${SUBST_CMD} ${WRKSRC}/cmd/syncthing/main.go
>  
>  # If at any point quic is busted for our in-tree go version, then you can
>  # temporarily add `-tags noquic` to at least get syncthing building (albeit
> Index: patches/patch-cmd_syncthing_main_go
> ===================================================================
> RCS file: /cvs/ports/net/syncthing/patches/patch-cmd_syncthing_main_go,v
> diff -u -p -r1.4 patch-cmd_syncthing_main_go
> --- patches/patch-cmd_syncthing_main_go       1 Jan 2026 22:24:37 -0000       
> 1.4
> +++ patches/patch-cmd_syncthing_main_go       1 Jan 2026 22:57:09 -0000
> @@ -23,11 +23,11 @@ Index: cmd/syncthing/main.go
>  +            panic(err)
>  +    }
>  +
> -+    if err := unix.Unveil("/usr/local/bin/syncthing", "rx"); err != nil {
> ++    if err := unix.Unveil("${PREFIX}/bin/syncthing", "rx"); err != nil {

This would be right,

>  +            panic(err)
>  +    }
>  +
> -+    if err := unix.Unveil("/usr/local/bin/xdg-open", "rx"); err != nil {
> ++    if err := unix.Unveil("${LOCALBASE}/bin/xdg-open", "rx"); err != nil {

this, however should be LOCALBASE, see bsd.port.mk(5).

That goes to show that you're off the rails and on your own
as soon as you build ports with anything other than /usr/local/.

>  +            panic(err)
>  +    }
>  +
> 

Reply via email to