Difference between revisions of "OutOfTreeCompile"

From VideoLAN Wiki
Jump to navigation Jump to search
m
Line 34: Line 34:
  
 
<pre>
 
<pre>
prefix = /usr/local
+
libdir = $(shell pkg-config --variable=libdir vlc-plugin )
libdir = $(prefix)/lib
 
 
vlclibdir = $(libdir)/vlc
 
vlclibdir = $(libdir)/vlc
  
Line 50: Line 49:
  
 
install: all
 
install: all
 +
        mkdir -p $(DESTDIR)$(vlclibdir)/
 
         install -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/
 
         install -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/
  
 
install-strip: all
 
install-strip: all
 +
        mkdir -p $(DESTDIR)$(vlclibdir)/
 
         install -s -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/
 
         install -s -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/
  
uninstall: all
+
uninstall:
 
         rm -f -- $(DESTDIR)$(vlclibdir)/libx264_plugin.so
 
         rm -f -- $(DESTDIR)$(vlclibdir)/libx264_plugin.so
  

Revision as of 23:19, 27 January 2009

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.

libdir = $(shell pkg-config --variable=libdir vlc-plugin )
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
        mkdir -p $(DESTDIR)$(vlclibdir)/
        install -m 0755 libx264_plugin.so $(DESTDIR)$(vlclibdir)/

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

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