Wednesday, May 25, 2011

Re: Compiling Vim with X on Mac

On 26/05/11 2:19 AM, Bram Moolenaar wrote:
> Ben Schmidt wrote (quite a long time ago):
>
>> Finally getting around to compiling Vim 7.3, and taking a little more
>> interest in the mailing list again. Would love to get back into Vim
>> development again if I can find time.
>>
>> I use Vim in X on the Mac (gtk2), as well as in the console, as well as
>> MacVim. Building for X isn't done much these days, and has caused a
>> couple of problems, because os_macosx.c and os_mac_conv.c define
>> #NO_X11_INCLUDES.
>>
>> - netbeans.pro uses the type BalloonEval which is not included if no X11
>> headers are; I worked around this by adding typedef void to the .c
>> files that #define NO_X11_INCLUDES. It's a nasty hack, but I haven't
>> fiddled with the Vim source code for so long I don't have any idea
>> what the 'right way' would be, so I figured I might as well just do a
>> hack and someone else would know the proper way.
>
> In src/proto.h there already is a workaround for this. Adjusting the
> #ifdef should work.

Ah, OK. Yes, this works:

#if !defined(FEAT_BEVAL) || defined (NO_X11_INCLUDES)

> Is FEAT_BEVAL defined in your case? Perhaps it should not be.

It is indeed defined. I don't use the feature, myself, but I don't see
any reason it wouldn't work or shouldn't be compiled in if all the code
to make it work is there in the GTK and Vim GTK GUI code.

>> - FEAT_GUI is not defined if NO_X11_INCLUDES is defined (because doing
>> so would pull in a lot of stuff that needs the X headers), so the
>> check of FEAT_GUI in os_macosx.c is useless; I worked around it by
>> unconditionally defining a different constant.
>>
>> It'd be great if you could put similar workarounds in the source, Bram,
>> so it can compile out of the box.
>
> I'm puzzeled by how you can compile Vim with GTK while NO_X11_INCLUDES
> is defined. What are you using for building?

I build with a standard toolset using ./configure and make.
NO_X11_INCLUDES is only defined in and by the two Mac-specific source
files named above. As one of the code comments says, this is to avoid a
clash between definitions of Boolean in the X11 and Mac header files.
All the actual GTK components compile with the X11 headers included (and
not any Mac headers).

> Is this already in src/INSTALLmac.txt? If not, can you add it?

I don't think INSTALLmac.txt needs any modification. It does use
--disable-darwin to compile an X11 GUI, which I don't do (I seem to
remember that it disabled something I wanted--maybe native Mac clipboard
support--I can't remember). At any rate, it is nicer not to need to
supply it, and perhaps future Mac-specific features will rely on it that
we don't want to disable just because the GUI is GTK. So perhaps it
would be appropriate to remove --disable-darwin from INSTALLmac.txt, but
I'm unsure of exactly what the consequences are, and it's certainly not
necessary to change it.

Ben.

--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

No comments:

Post a Comment