Thursday, May 26, 2011

Re: Compiling Vim with X on Mac

Ben Schmidt wrote:

> 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).

OK, I got confused. I think in vim.h FEAT_GUI should be defined even
when NO_X11_INCLUDES is defined. If there is some place where FEAT_GUI
causes trouble then add a check for NO_X11_INCLUDES there. That should
be a lot cleaner an avoids unexpected side effects. NO_X11_INCLUDES
suggests only the includes are skipped, nothing else.

> > 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.

I would rather only make changes if we know what we are doing :-).

--
hundred-and-one symptoms of being an internet addict:
115. You are late picking up your kid from school and try to explain
to the teacher you were stuck in Web traffic.

/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///

--
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: