Re: [gedit-list] Plugin compilation under OS X for the native app



On Sun, Mar 20, 2011 at 18:29, Emmanuel Rodriguez
<emmanuel rodriguez gmail com> wrote:
> Hi,
>
> I wrote a simple gedit plugin [1] and I was asked by a user on how to
> compile and install the plugin under OS X so that it works with the
> native app that's provided through the dmg image that's hosted in the
> Gnome FTP servers.
>
> I have access to a OS X laptop and I managed to install both the
> native and the X11 versions of gedit. I can compile through macports
> my plugin for the X11 version and load it too but I don't know how to
> proceed to compile and load the plugin for the native version.

I found how to achieve this. Here's what I found out.

First of all, the native application doesn't provide the header files
for recompiling puglins so these have to be installed "manually" by
the user.  Secondly, the native OS X application is compiled only for
i386, so even if you're running on a 64 version of OS X (which most
recent apple users do) you MUST compile the plugin for i386. Finally,
the install path for the application has to be changed since OS X
applications are not installed in /usr but usually under
/Applications/APP-NAME/Contents/Resources.

I solved the missing headers by using macports for installing gedit
and gedit-plugins:
   sudo port install gedit gedit-plugins

This takes a while but eventually you will get the X11 version of
gedit, but most important you will get all build dependencies and
headers files installed.

To compile the plugin for i386 simply pass -arch i386 to the compiler,
if the plugin uses autotools & co then you can simply add this
compiler flag:
  CFLAGS="-arch i386".

Finally if you installed the native application to /Applications/ as
most users do then you simply need to pass
  --prefix=/Applications/gedit.app/Contents/Resources

TL;DR at the end the commands to use are:
  CFLAGS="-arch i386" ./configure
--prefix=/Applications/gedit.app/Contents/Resources
  make
  make install

I hope that i can help others to build plugins that are not bundled with gedit.

-- 
Emmanuel Rodriguez


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]