On 2025/02/18 14:55, Christian Schulte wrote:
> Thanks a lot. I will create an upstream issue for this. Could you also
> point me to some port example using custom build instructions? This
> library is using cmake for compiling 2 C source files and this already
> introduces the issue that it does not seem to be possible to build a
> shared and a static library in one go. All it needs to do is calling the
> compiler to compile 2 source files and then install one header, a .so
> and a .a version.

It's definitely possible. The library names in add_library (and other
related bits in cmake config) must be different (e.g. foo_shared
and foo_static) and then the output filename must be set via
set_target_properties OUTPUT_NAME.

However static libraries are not usually all that useful in
ports/packages. When they're used it is a pain because we need to chase
through the tree to find other ports to bump after an update. In the
past we used these a bit for software frequently installed in a chroot
jail, but usually it's simpler to copy the libraries into the jail
instead. Otherwise the main use is for things linking against OpenSSL
libraries to slightly reduce the problems when there are conflicts
with LibreSSL (but this is only of limited help, some things still
don't work). For the most part they just waste link time, disk space,
and bandwidth.

> It should be straight forward to just do this manually
> without cmake, configure, whatever.

Yes, sure. And it's easy but different on most OS where you might want
to do this. But fortunately developers of most ported software don't do
this and use a few fairly common methods so that we don't need to keep
patching things for the way OpenBSD does it across the tree, and can
largely confine to modules dealing with certain build systems.

Reply via email to