On 2018/06/27 10:17, Leonid Bobrov wrote:
> I need help to go further. After reading Porter's hanbook,
> bsd.port.mk(5) and print/poppler example I am confused what to do.
>
> I put resulting ports at https://github.com/mazocomp/mystuff
>
> Note -main is client:
>
> mazocomp$ make show=SUBPACKAGE
> -main
> mazocomp$ make show=BUILD_PACKAGES
> -main -server
> mazocomp$
>
> The problem here is that when I do `make build`, the test inside
> Makefile:
>
> .if ${BUILD_PACKAGES:M-main}
> CONFIGURE_ENV += CXXFLAGS="-I${X11BASE}/include"
> .endif
>
> .if ${BUILD_PACKAGES:M-server}
> CONFIGURE_ARGS+= -DBUILD_CLIENT=FALSE -DBUILD_SERVER=TRUE
> .endif
>
> Matches both conditions and instead of client I get server with
> -I/usr/X11R6/include building. Should I manually set BUILD_PACKAGES?
Being able to knock out individual subpackages (i.e. use the
BUILD_PACKAGES and PSEUDO_FLAVORS=no_XX mechanism) is useful when there
are a lot of optional extras, especially for things which you might want
to update manually from ports without doing a full update on a machine
(to pick a few examples: PHP, asterisk).
It's also useful when an optional dependency is unavailable on certain
arches but you still want the main part of the port to work.
I don't think there's all that much advantage to using BUILD_PACKAGES
and the PSEUDO_FLAVORS=no_<whatever> mechanism at all for this port.
If you wanted to build client without server the only extra dep is
postgresql. If you wanted to build server without client there are a
few more but they're not too huge to build, and available widely on
the various arches.
If you did want to do this, you would probably want something like:
CONFIGURE_ENV += CXXFLAGS="-I${X11BASE}/include"
.if ${BUILD_PACKAGES:M-client}
CONFIGURE_ARGS+= -DBUILD_CLIENT=TRUE
.else
CONFIGURE_ARGS+= -DBUILD_CLIENT=FALSE
.endif
.if ${BUILD_PACKAGES:M-server}
CONFIGURE_ARGS+= -DBUILD_SERVER=TRUE
.else
CONFIGURE_ARGS+= -DBUILD_SERVER=FALSE
.endif
> After a bit of thinking I came up to this:
>
> PSEUDO_FLAVORS = no_main no_server
> FLAVOR ?= no_server
>
> Which resulted in:
>
> mazocomp$ make show=BUILD_PACKAGES
> -main
> mazocomp$ env FLAVOR='no_main' make show=BUILD_PACKAGES
> -server
> mazocomp$ env SUBPACKAGE=-main make show=BUILD_PACKAGES
> -main
> mazocomp$ env FLAVOR='' make show=BUILD_PACKAGES
> -main -server
> mazocomp$ env SUBPACKAGE=-server make show=BUILD_PACKAGES
> -main
> mazocomp$
There is rarely any reason to set the SUBPACKAGE variable yourself.
The only reason I can think of is if you want to use "make install"
to install a subset of packages (personally I never use it, just
'make install-all'..)
> I don't want to write a complex script, is there an easy way?
> Should I manually set BUILD_PACKAGES?
No, don't manually set BUILD_PACKAGES. Let the ports infrastructure set
it initially. In some special cases you can _modify_ that - some ports
have a no_db pseudoflavour to knock out all database-related subpackages,
which strips out multiple entries from BUILD_PACKAGES - but not relevant
here.