[MacPorts] #51303: netcdf: Request: Add static library libnetcdf.a to build

MacPorts noreply at macports.org
Tue Dec 3 13:14:37 UTC 2019

#51303: netcdf: Request: Add static library libnetcdf.a to build
  Reporter:  anowacki     |      Owner:  tenomoto
      Type:  enhancement  |     Status:  new
  Priority:  Normal       |  Milestone:
 Component:  ports        |    Version:
Resolution:               |   Keywords:
      Port:  netcdf       |

Comment (by ryandesign):

 Replying to [comment:1 tenomoto]:
 > {{{netcdf}}} uses CMake and the upstream developers offer a switch
 {{{BUILD_SHARED_LIBS}}} to build either shared ({{{ON}}}) or static
 ({{{OFF}}}). It is possible to build both by conducting {{{configure}}}
 and {{{build}}} phases twice, but it will complicate {{{Portfile}}}, which
 I don't like to do.  You can ask the upstream developers to add an option
 to build both.

 As you say, cmake in general does not support building both static and
 dynamic libraries at the same time; you must choose one or the other, and
 we certainly choose dynamic libraries in MacPorts. If the developers of
 netcdf can add to their cmake files to make building and installing both
 possible for netcdf, that's fine; we can then update the port to use that.
 I'm not sure if anybody has tried to contact them yet to suggest that or
 if they are interested in doing that.

 If we want to develop a general-purpose solution that could be applied to
 any cmake-using port that does not have specific upstream support for
 this, it should go into the cmake-1.1 portgroup. But I don't know if we
 want to put that much effort into it, since using static libraries is not
 the best idea on macOS and we especially need to encourage that practice.

 > However, I could easily add a static variant, which does not install
 shared libraries with the current {{{CMakeLists.txt}}}.

 You should not add such a variant, because if the user installs the port
 with this variant, it will break any other port the user has installed (or
 later receives a binary of from our packages server) that links with the
 dynamic library.

 I suggest that this ticket should be closed as "wontfix" and the reporter
 should work with the developers of the software he wants to use so that
 they work with netcdf's dynamic libraries.

Ticket URL: <https://trac.macports.org/ticket/51303#comment:4>
MacPorts <https://www.macports.org/>
Ports system for macOS

More information about the macports-tickets mailing list