On 2022/12/22 09:03, Omar Polo wrote:
> On 2022/12/22 00:27:59 +0000, Yifei Zhan <[email protected]> wrote:
> > MULTI_PACKAGES= -main -server -client
> >
> > ...cut...
> >
> > .if ${BUILD_PACKAGES:M-main}
> > ALL_TARGET= ./proxy/
> > .endif
> >
> > .if ${BUILD_PACKAGES:M-client}
> > ALL_TARGET= ./client/
> > .endif
> >
> > .if ${BUILD_PACKAGES:M-server}
> > ALL_TARGET= ./server/
> > .endif
>
> I've not looked at the tarball but glancing at this it looks wrong.
>
> MULTI_PACKAGES is a way to do a *single* build and generate multiple
> packages. So, what you are doing here is just setting ALL_TARGET to
> ./proxy/, you're just building the -main subpackage. (this due to how
> make handles multiple definition of the same variable)
Exactly.
> `ALL_TARGET+= ./foo/' *may* work (again, i haven't downloaded the
> tarball), but it gives the idea.
>
> Also, I'm not sure how much it buys to have all these
>
> .if ${BUILD_PACKAGES:M-XXX}
>
> if all the three packages are always built. It may be useful to do
> that when you need to disable the building of some parts for reasons
> (for e.g. look at x11/wxWidgets where one subpackage can't be built on
> all architectures -- but then you'll likely need to use PSEUDO_FLAVORS
> as well.)
Also where there's a port providing a main package plus many plugins,
some with heavy dependencies (and especially in cases where you might
actually need to build it from ports rather than packages).
> (at the cost of being annoying) remember:
>
> - flavors => multiple builds, one per combination
> - multipackage- => one build split in sub packages
and having separate ports using the same distfile is totally ok too -
either fully separate, or a ports/category/basename/{server,client} type
of arrangement with shared parts.
Don't overthink things though, there's really no need to split this
up, a single package is fine (and maybe preferable in this case, as it
stops a passive observer from figuring out whether you downloaded
the proxy or server or client parts).
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/snowflake_proxy/Makefile,v
retrieving revision 1.7
diff -u -p -r1.7 Makefile
--- Makefile 6 Oct 2022 17:05:25 -0000 1.7
+++ Makefile 22 Dec 2022 08:15:38 -0000
@@ -1,7 +1,8 @@
-COMMENT= proxy providing Tor access to others with censored net
+COMMENT= proxy daemon and pluggable transports for Tor access with
censored net
MODGO_MODNAME= git.torproject.org/pluggable-transports/snowflake.git/v2
V= 2.3.1
+REVISION= 0
MODGO_VERSION= v$V
DISTNAME= snowflake.git-${MODGO_VERSION}
@@ -17,7 +18,7 @@ PERMIT_PACKAGE= Yes
WANTLIB += c pthread
MODULES= lang/go
-ALL_TARGET= ./proxy/
+ALL_TARGET= ./proxy/ ./client/ ./server/
# done as a sed instead of patch because the path includes the version number
post-extract:
@@ -25,7 +26,9 @@ post-extract:
${WRKSRC}/proxy/lib/pt_event_logger.go
post-install:
- cd ${PREFIX}/bin && mv proxy snowflake_proxy
+.for i in proxy client server
+ mv ${PREFIX}/bin/$i ${PREFIX}/bin/snowflake_$i
+.endfor
.include "modules.inc"
.include <bsd.port.mk>
Index: pkg/DESCR
===================================================================
RCS file: /cvs/ports/net/snowflake_proxy/pkg/DESCR,v
retrieving revision 1.1.1.1
diff -u -p -r1.1.1.1 DESCR
--- pkg/DESCR 28 Feb 2022 16:54:13 -0000 1.1.1.1
+++ pkg/DESCR 22 Dec 2022 08:15:38 -0000
@@ -12,5 +12,6 @@ e.g. by configuring it in Tor Browser.
Technical information is in
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake/-/wikis/Technical%20Overview
-This package provides a proxy, for those who would like to use their
-internet connection to provide access to others via this protocol.
+This package provides a standalone proxy, for those who would like to use
+their internet connection to provide access to others via this protocol,
+and pluggable transports for Tor to allow using snowflake proxies.
Index: pkg/PLIST
===================================================================
RCS file: /cvs/ports/net/snowflake_proxy/pkg/PLIST,v
retrieving revision 1.3
diff -u -p -r1.3 PLIST
--- pkg/PLIST 4 Mar 2022 10:46:34 -0000 1.3
+++ pkg/PLIST 22 Dec 2022 08:15:38 -0000
@@ -1,6 +1,8 @@
@newgroup _snowflakeproxy:874
@newuser _snowflakeproxy:874:_snowflakeproxy::snowflake_proxy
user:/nonexistent:/sbin/nologin
@rcscript ${RCDIR}/snowflake_proxy
+@bin bin/snowflake_client
@bin bin/snowflake_proxy
+@bin bin/snowflake_server
share/examples/login.conf.d/snowflake_proxy
@sample ${SYSCONFDIR}/login.conf.d/snowflake_proxy