On 2022/12/22 00:27:59 +0000, Yifei Zhan <openbsd@zhan.science> wrote:
> Here is an attempt to convert net/snowflake_proxy into subpackages.
> 
> snowflake_proxy has 3 components, correspond to 3 subpackages:
> 
> - standalone server, tor not required (The only currently packaged components)
> - serverside managed pluggable transport for Tor
> - clientside managed pluggable transport for Tor (Required for Tor Browser's 
> built in snowflake bridges)
> 
> The attached port does not work yet, all packages seem to be resolved to 
> -main 
> when building, despite setting SUBPACKAGE="-client" or SUBPACKAGE="-server", 
> I'm 
> out of ideas on what I did wrong, can someone more experienced with 
> subpackage 
> give me a pointer?
> 
> My current Makefile for subpackages looks like this:
> 
> COMMENT-main= standalone proxy providing Tor access to others with censored 
> net
> COMMENT-server= serverside managed pluggable transport for Tor
> COMMENT-client= clientside managed pluggable transport for Tor
> 
> ...cut...
> 
> PKGNAME-main= snowflake_proxy-standalone-$V
> PKGNAME-server=       snowflake_proxy-server-$V
> PKGNAME-client=       snowflake_proxy-client-$V
> 
> ...cut...
> 
> 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)

`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.)

(at the cost of being annoying) remember:

 - flavors => multiple builds, one per combination
 - multipackage- => one build split in sub packages

> ...cut...
> 
> post-install:
> 
> .if ${BUILD_PACKAGES:M-main}
>       cd ${PREFIX}/bin && mv proxy snowflake_proxy
> .endif
> .if ${BUILD_PACKAGES:M-server}
>       cd ${PREFIX}/bin && mv server snowflake_server
> .endif
> .if ${BUILD_PACKAGES:M-client}
>       cd ${PREFIX}/bin && mv client snowflake_client
> .endif
> 
> ...cut...


Reply via email to