OutOfTreeCompile

From VideoLAN Wiki
Revision as of 15:34, 18 January 2009 by Courmisch (talk | contribs)
Jump to navigation Jump to search

Aim

Being able to build a vlc module without needing to build the whole vlc source. It can be used if you develop a new module, if your module can't be distributed at the same time as VLC due to some IP issues or to reduce the number of build-dependancies for a source package

Preparation

If you're taking a module from VLC source code, you may need to modify it slightly.

Internationalization

You can't use the main VLC internationalization (gettext) "domain". So you can either add your own domain declaration:

#define DOMAIN  "vlc-myplugin"
#define _(str)  dgettext(DOMAIN, str)
#define N_(str) (str)

/* ... */

vlc_module_begin()
   set_text_domain (DOMAIN)
   set_description (N_("My plugin"))
   /* ... */
vlc_module_end()

or disable internationalization completely:

#define _(str)  (str)
#define N_(str) (str)

Building

With plain makefile=

The following Makefile is an example based on the x264 module of VLC. You will need to adapt to your module.

prefix = /usr/local
libdir = $(prefix)/lib
vlclibdir = $(libdir)/vlc

all: libx264_plugin.so
 
libx264_plugin.so: libx264_plugin.o
        gcc -shared -std=gnu99 $< `pkg-config  --libs vlc-plugin x264`  -Wl,-soname -Wl,$@ -o $@
 
libx264_plugin.o: x264.c
        gcc -c -std=gnu99  $< `pkg-config  --cflags vlc-plugin x264` -D__PLUGIN__  -DMODULE_STRING=\"x264\" -o $@  
 
clean:
        rm -f libx264_plugin.o libx264_plugin.so

install: all
        install -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/

install-strip: all
        install -s -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/

uninstall: all
        rm -f -- $(DESTDIR)$(vlclibdir)/libx264_plugin.so

.PHONY: all clean install uninstall

With autotools

If using automake and libtool, you can follow this example Makefile.am instead:

vlclibdir = $(libdir)/vlc

vlclib_libx264_plugin_la_SOURCES = x264.c
vlclib_libx264_plugin_la_CFLAGS = $(VLC_PLUGIN_CFLAGS) $(X264_CFLAGS) \
      -D__PLUGIN__ -DMODULE_STRING=\"x264\"
vlclib_libx264_plugin_la_LIBADD = $(VLC_PLUGIN_LIBS) $(X264_LIBS)
vlclib_libx264_plugin_la_LDFLAGS = \
      -avoid-version -module -export-symbol-regex ^vlc_entry