variants

Mojca Miklavec mojca at macports.org
Tue Apr 12 16:09:53 PDT 2016


On 12 April 2016 at 20:49, Daniel J. Luke wrote:
> On Apr 12, 2016, at 1:34 PM, Christopher Jones wrote:
>> Take if you want, as a real world case, ROOT6, which I know well. It has a large number of variants, because upstream’s build system offers all these as optional extras. Many of them have dependencies I do not wish to force on all users, if they don’t require that feature.
>>
>> Some of them create additional libraries for the new features, some just add the functionality to existing ones. Most will also extend the introspection system as part of root. None can be built as afterthoughts. You have to configure ROOT from the start with the features you want. So for this port there is no chance in hell I am going to implement them as sub-ports.
>
> It would be nice if upstream could be convinced to 'fix' this.
>
> (As an end user, it's much easier to understand application + optional plugins than application configured in one of many possible states).
>
> ROOT6 may well be a 'special case' where we can't easily work-around

I would say it's rather the opposite. Almost any given software I have
ever compiled or packaged offers configure options and then builds the
main binary that links against the libraries chosen during configure
phase.

Imagine some simple C program:

#ifdef HAVE_LIBPNG
#include <png.h>
#endif
#ifdef HAVE_JPEG
#include <jpeglib.h>
#endif
#ifdef HAVE_READLINE
#include <readline.h>
#endif

int main() {
#ifdef HAVE_LIBPNG
    // do some stuff that requires PNG
    // perhaps add a button "Save as PNG" and add a pretty PNG picture
for the background
#endif
#ifdef HAVE_JPEG
    // do some stuff that requires JPEG
    // add a button "Save as JPEG" and show a JPEG picture in the corner
#endif
#ifdef HAVE_READLINE
    // handle input with the library
#else
    // an alternative "poor man's" implementation doing the same as
readline would
#endif

    return 0;
}

You end up with a single executable that links to up to three external
libraries.

I'm not saying it's completely impossible to do it, but reimplementing
this in a way that you would be able to install four submodules, each
one with some extra files, would require quite some extra trickery.

Mojca


More information about the macports-dev mailing list