Difference between revisions of "OutOfTreeCompile"
Manolamancha (talk | contribs) |
|||
Line 4: | Line 4: | ||
==Preparation== | ==Preparation== | ||
− | If you're taking a module from VLC source code, you may need to modify it slightly. | + | If you're taking a module from VLC source code, you may need to modify it slightly. |
===Internationalization=== | ===Internationalization=== | ||
You can't use the main VLC internationalization (gettext) "domain". | You can't use the main VLC internationalization (gettext) "domain". | ||
Line 27: | Line 27: | ||
#define N_(str) (str) | #define N_(str) (str) | ||
</pre> | </pre> | ||
+ | ===Symbols=== | ||
+ | For your module to be loaded by VLC, you'll need to define the symbol '''__PLUGIN__'''. This should enable exported symbols similar to the following: | ||
+ | <pre> | ||
+ | EXPORTS | ||
+ | vlc_entry__1_1_0g | ||
+ | vlc_entry_license__1_1_0g | ||
+ | </pre> | ||
+ | Optionally, you can also define the '''__LIBVLC__''' symbol. | ||
==Building== | ==Building== |
Revision as of 03:05, 12 February 2011
Contents
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)
Symbols
For your module to be loaded by VLC, you'll need to define the symbol __PLUGIN__. This should enable exported symbols similar to the following:
EXPORTS vlc_entry__1_1_0g vlc_entry_license__1_1_0g
Optionally, you can also define the __LIBVLC__ symbol.
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