Yifei Zhan <openbsd@zhan.science> writes:

> I'm updating the port of obfs4proxy, which is written in golang, it's 
> a simple port similar to snowflake_proxy, but so far i'm unable to 
> build it from port tree.
>
> It fails with the following error:
>
> $ make
> ===>  Configuring for obfs4proxy-0.0.13
> ln: /portworks/obj/obfs4proxy-0.0.13/gitlab.com/yawning/obfs4.git: No such 
> file or directory
> *** Error 1 in . (/usr/ports/infrastructure/mk/bsd.port.mk:2918 
> '_pre-configure-modules': @ln -sf 
> /portworks/obj/obfs4proxy-0.0.13/obfs4-obf...)
>
> I think it is due to go-module not be able to locate the source, 'man 
> go-module' mentioned the _pre-configure behaviour and I can see the 
> /gitlab.com/yawning/obfs4.git part is coming from MODGO_MODNAME, but I 
> don't know why it act that way :[
>
>      During execution of pre-configure target module moves source code from
>      ${MODGO_SUBDIR} to ${WRKSRC}, subdirectory of ${MODGO_WORKSPACE} -
>      specially-crafted Go workspace located at ${WRKDIR}/go.
>
> $ doas make show=WRKSRC       
> /obj/obfs4proxy-0.0.13/obfs4-obfs4proxy-0.0.13-77af0cba934d73c4baeb709560bcfc9a9fbc661c
> $ doas make show=MODGO_SUBDIR 
> /obj/obfs4proxy-0.0.13/obfs4-obfs4proxy-0.0.13
>
> I'm able to build it with:
>
>     $ cd `make show=WRKSRC`
>     $ go build -o obfs4proxy/obfs4proxy ./obfs4proxy
>
> and the result binary works, so I believe the new version is not to 
> blame.
>
> I attached the WIP port, anyone would like to take a look?
>
> [2. application/x-tar; obfs4proxy.wip.tar]...

Looks like you are combining MASTER_SITES and the MODGO_* stuff. Better
to use one or the other.

This port in particular can be generated (mostly) with 'portgen go
gitlab.com/yawning/obfs4.git'. There is one missing bit though. Since
upstream put the various bits of code in subdirectories, we need to tell
Go to build recursively by adding "/..." to the ALL_TARGET variable.

The result looks like:

COMMENT =       todo

MODGO_MODNAME = gitlab.com/yawning/obfs4.git
MODGO_VERSION = v0.0.0-20220204003609-77af0cba934d

DISTNAME =      obfs4.git-${MODGO_VERSION}
PKGNAME =       obfs4.git-20220204003609

CATEGORIES =    go

# unknown license -> 'unknown'
PERMIT_PACKAGE =        unknown license
PERMIT_DISTFILES =      unknown license

MODULES =               lang/go

ALL_TARGET =            ${MODGO_MODNAME}/...

MODGO_MODULES = \
        filippo.io/edwards25519                                  
v1.0.0-rc.1.0.20210721174708-390f27c3be20 \
        git.torproject.org/pluggable-transports/goptlib.git      v1.0.0 \
        github.com/dchest/siphash                                v1.2.1 \
        gitlab.com/yawning/edwards25519-extra.git                
v0.0.0-20211229043746-2f91fcc9fbdb \
        golang.org/x/crypto                                      
v0.0.0-20210711020723-a769d52b0f97 \
        golang.org/x/net                                         
v0.0.0-20210226172049-e18ecbb05110 \
        golang.org/x/sys                                         
v0.0.0-20210615035016-665e8c7367d1 \
        golang.org/x/term                                        
v0.0.0-20201126162022-7de9c90e9dd1 \
        golang.org/x/text                                        v0.3.3 \
        golang.org/x/tools                                       
v0.0.0-20180917221912-90fa682c2a6e
MODGO_MODFILES =        \
        golang.org/x/sys         v0.0.0-20201119102817-f84b799fce68

.include <bsd.port.mk>

You should be able to combine this with the existing stuff (dropping
MASTER_SITES) to get things functional! If not, let me know what errors
you are hitting!

Cheers,
Aaron

Reply via email to