How to make a new option default during upgrade? (gnuplot/aquaterm)

Mojca Miklavec mojca.miklavec.lists at gmail.com
Fri Aug 10 08:32:12 PDT 2012


On Fri, Aug 10, 2012 at 4:24 PM, Markus Weissmann wrote:
> I'll try to sum up the problem:
> 1.) The terminal used by gnuplot must be decided at compile time and upstream is not willing to change that

a) Actually, you can compile multiple terminals (decision about which
ones has to be made at compile time). But one of them will become the
default one. On mac that's unconditionally AquaTerm. (This is usually
easy to change, always run "set term qt" when you start gnuplot, but
in Octave it is less convenient to remember gnuplot-specific commands.
One would prefer to have the right/desired terminal from the start.)

b) On linux you can easily do
    ./configure -DDEFAULTTERM="qt"
and this will make qt the default terminal. However, on Apple
-DDEFAULTTERM is ignored as soon as AquaTerm is present.

The source code goes like that:
    char *term_name = DEFAULTTERM; // can be provided by user during compilation
    #ifdef QTTERM
        if (term_name == (char *) NULL)
        term_name = "qt"; // won't change term_name if DEFAULTTERM has been set
    #endif
    ...
    #if defined(__APPLE__) && defined(__MACH__) && defined(HAVE_LIBAQUATERM)
        term_name = "aqua"; // unconditionally overwrite any user preference
    #endif

So ./configure -DDEFAULTTERM="wxt" would work under linux, but not
under OS X. This particular bit requires a trivial change (which can
easily be done in MacPorts), and *that* patch has been refused
upstream, arguing that compile time is the wrong point in time to
decide about default terminal (but then I don't know why it is allowed
to work under linux).

> 2.) There exists a fairly large number of variants that let you do the decision from 1.) when installing gnuplot

On Mac there are four (and unlikely there will be any more any time soon):
    AquaTerm, X11, Qt, wxWidgets.

> 3.) One of the possible targets is Aquaterm which is currently broken in the MacPorts repository

AquaTerm is only broken when:
a) either user installs an incompatible standalone version of AquaTerm
b) or uses 32-bit gnuplot (this happens if wxWidgets 2.8 are used).
With my recent patches for AquaTerm upgrade to 1.1.1 most of those
problems should go away.

> If I got this correct I see several (non necessarily disjunct) approaches to solve this problem:
> 1.) Fork gnuplot (cleanest solution but probably not what you want)
> 2.) Apply the patch to the MacPorts gnuplot
> 3.) Fix MacPorts Aquaterm

I have a patch on trac (http://trac.macports.org/ticket/34346). But
fixing AquaTerm is unrelated to the question of ability to set default
terminal.

> 4.) Make the variants to a unique port each, preferably subports that can be installed side by side with a unique installation prefix (great side effect: binary packages for every choice)

Four subports would probably be an even bigger overkill than four
extra options (default_aqua, default_x11, default_qt, default_wxt).
Keep in mind that even if one would install four subports alongside,
one could make all four of them use all four terminals, only using the
different default. That's *really* an overkill.

5.) Of course, one can also make a trivial patch that would read the
default terminal from some place in macports settings.

6.) User can always set an environmental variable GNUTERM (or put that
setting in a file). But if mutiple binaries contain different sets of
terminals, that breaks the behaviour since the fallback is to
"undefined" rather than the usual default.

Mojca

> Regards
>
> -Markus
>
> On Aug 10, 2012, at 01:58 , Mojca Miklavec wrote:
>
>> On Fri, Aug 10, 2012 at 1:13 AM, Ryan Schmidt wrote:
>>> On Aug 9, 2012, at 16:53, Mojca Miklavec wrote:
>>>
>>>> After the discussion about transition from "no_x11" to "x11" and the
>>>> need for the following lines
>>>>
>>>> if {[variant_isset no_x11]} {
>>>>   default_variants -x11
>>>> } else {
>>>>   default_variants +x11
>>>> }
>>>>
>>>> the following question popped up in my mind. In this suggested patch:
>>>>   http://trac.macports.org/attachment/ticket/34423/gnuplot-use-aqt-framework-extra-option.patch
>>>> I added a new default option "+aquaterm". This option should be used
>>>> by everyone except when explicitly disabled with "-aquaterm". During
>>>> upgrade the option +aquaterm should automatically be used.
>>>>
>>>> My question is: how can I add the +aquaterm option and:
>>>> - make sure that "port upgrade gnuplot" won't delete aquaterm
>>>> - make sure that "port install gnuplot -aquaterm" & "port upgrade
>>>> gnuplot" won't install aquaterm
>>>
>>> That's what adding +aquaterm to default_variants does. So the patch already includes that functionality.
>>
>> Oh, that's perfect then, thank you.
>>
>>>> At the same time it might be nice to replace no_x11 with x11 ... and
>>>> all those flags & transitional "if"s look like a mess ;)
>>>
>>> They're a little bit unpretty, but it's only a few extra lines, and they go away after a year.
>>
>> If they go away, even better.
>>
>>>> As far as a new +aquaterm option is concerned, the reason why I
>>>> suggested its addition is that removing aquaterm support is a
>>>> "quick-and-dirty" solution to make a different terminal the default
>>>> one. With working x11/qt/wxt there are a lot of options to choose
>>>> from, and there is reasonable number of people wanting to change the
>>>> default.
>>>>
>>>> An alternative to "+aquaterm" is to add a patch (rejected by gnuplot
>>>> developers last time when I asked) which would enable setting the
>>>> default terminal. So instead of
>>>>
>>>>   [+]aqua, [+]luaterm, (legacy) no_x11, [+]pangocairo, qt, tutorial,
>>>> universal, wxwidgets, wxwidgets_devel, [+]x11
>>>>
>>>> one would end up with
>>>>
>>>>   [+]default_aqua, default_x11, default_qt, default_wxt, [+]luaterm,
>>>> (legacy) no_x11, [+]pangocairo, qt, tutorial, universal, wxwidgets,
>>>> wxwidgets_devel, [+]x11
>>>>
>>>> Maybe that option is better after all.
>>>
>>> That sounds nasty. Why can't the selection of what kind of terminal to use by default be a setting that gnuplot reads from a preferences file? That would seem to be the immediately obvious way that such a feature would be implemented, wouldn't it?
>>
>> It may be set in a preference file or in an environmental variable
>> GNUTERM, but it becomes problematic as soon as there are multiple
>> gnuplot versions available on the system. Here's why:
>>
>> I have my own version of gnuplot in PATH as my default/modified
>> gnuplot, but also one provided by MacPorts for the sake of Octave.
>> MacPorts currently ships with broken*** AquaTerm. So I *have to* set
>> GNUTERM to x11 (or qt or wxt) for example. However, as soon as I
>> launch the other gnuplot (compiled without the particular terminal
>> from my settings), gnuplot launches with "unknown" terminal which is
>> rather useless, and particularly nasty in case of Octave. Of course
>> the reverse is also true. I used to have 'qt' as my GNUTERM, but that
>> made Octave 'useless' until MacPorts was able to use gnuplot's qt
>> terminal.
>>
>> I also don't like the large number of long "default_<term>" options
>> (it would be cool to have --default_term=qt :). But I don't know what
>> else to do, except for, as already suggested, allowing the user to
>> completely disable aquaterm and only enable his terminal of choice.
>>
>> Mojca
>>
>> *** I'm currently not able to disable AquaTerm in MacPorts' gnuplot
>> and it always launches /Applications/AquaTerm.app instead of
>> /Applications/MacPorts/AquaTerm.app. And *that* is fully broken at the
>> moment: I cannot plot anything.


More information about the macports-dev mailing list