]> git.sesse.net Git - vlc/blob - projects/mozilla/Makefile.am
input: Export input_GetState().
[vlc] / projects / mozilla / Makefile.am
1 ###############################################################################
2 # Building the Mozilla plugin
3 ###############################################################################
4
5 MOSTLYCLEANFILES = 
6 CLEANFILES = $(BUILT_SOURCES)
7 EXTRA_DIST = $(DIST_sources) install.js npvlc_rc.rc vlc.r
8
9 SOURCES_mozilla_common = \
10         vlcshell.cpp \
11         vlcplugin.cpp \
12         vlcplugin.h \
13         control/npolibvlc.cpp \
14         control/npolibvlc.h \
15         control/nporuntime.cpp \
16         control/nporuntime.h \
17         support/classinfo.h
18
19 DIST_sources = $(SOURCES_mozilla_common) \
20         support/npwin.cpp support/npmac.cpp support/npunix.c
21
22 if BUILD_MOZILLA
23
24 LIBRARIES_libvlc = $(top_builddir)/src/libvlc.la \
25                                    $(top_builddir)/src/libvlccore.la
26
27 if HAVE_WIN32
28
29 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
30 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
31 # under Win32 and npunix.c under Unix.
32 #
33 lib_LTLIBRARIES = npvlc.la
34
35 SOURCES_support = support/npwin.cpp
36 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
37 LDFLAGS_mozilla_EXTRA = -no-undefined -Wl,--kill-at -Wl,$(DATA_npvlc_rc)
38
39 npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
40 npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_extra)
41 npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_extra)
42 npvlc_la_DEPENDENCIES = $(DATA_npvlc_rc) $(LIBRARIES_libvlc)
43 npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
44                                    $(LDFLAGS_mozilla_EXTRA)
45 npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)
46
47 DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
48 noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
49 noinst_npvlc_rcdir =
50
51 npvlc_rc.$(OBJEXT): npvlc_rc.rc
52         $(WINDRES) -DVERSION=$(VERSION) \
53                 -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` \
54                 --include-dir $(srcdir) -i $< -o $@
55
56 else
57 if HAVE_DARWIN
58
59 #
60 # MacOS X
61 #
62
63 lib_LTLIBRARIES = npvlc.la
64
65 SOURCES_support = support/npmac.cpp
66 CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
67         -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
68         -I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
69         -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 \
70         -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 \
71         -include mozilla-config.h
72 LDFLAGS_mozilla_EXTRA = -no-undefined -bundle -Wl,-read_only_relocs -Wl,suppress \
73         -Wl,-headerpad_max_install_names -shrext $(LIBEXT) -Wl,-framework,Carbon -Wl,-framework,System
74
75 npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
76 npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
77 npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA) 
78 npvlc_la_DEPENDENCIES = $(LIBRARIES_libvlc)
79 npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
80                                    $(LDFLAGS_mozilla_EXTRA)
81 npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)
82
83
84 noinst_DATA = npvlc.rsrc VLC\ Plugin.plugin
85 MOSTLYCLEANFILES += npvlc.rsrc
86 CLEANFILES += VLC\ Plugin.plugin
87
88 npvlc.rsrc: $(srcdir)/vlc.r
89         /Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
90
91 #
92 # Plugin uses shared libraries that are located relatively through @executable_path,
93 # which unfortunately references the path of the App using the Plugin, rather than the
94 # Plugin itself. Since this Plugin should always be installed in '/Library/Internet Plug-Ins',
95 # it is safer to force dylibs to locate dependents through a fixed path
96 #
97 define FIXEXECPATH
98         otool -L "$$dylib" | \
99         awk -v libdylib="$$dylib" ' \
100         /@executable_path/ { \
101             newpath=$$1 ; \
102             sub("@executable_path","/Library/Internet Plug-Ins/VLC Plugin.plugin/Contents/MacOS",newpath) ; \
103             print "install_name_tool -change \""$$1"\" \""newpath"\" \""libdylib"\"" ; \
104         }' | sh -x
105 endef
106
107 VLC\ Plugin.plugin: npvlc.rsrc $(lib_LTLIBRARIES)
108         rm -Rf "$@"
109         $(INSTALL) -d "$@/Contents/MacOS/lib"
110         $(INSTALL) ".libs/npvlc.dylib" "$@/Contents/MacOS/VLC Plugin"
111         $(INSTALL) -d "$(srcdir)/$@/Contents/MacOS/lib"; \
112         install_name_tool -change "$(libdir)/libvlccore.0.dylib" \
113             "@executable_path/lib/libvlccore.dylib" \
114             "$@/Contents/MacOS/VLC Plugin"
115         install_name_tool -change "$(libdir)/libvlc.2.dylib" \
116             "@executable_path/lib/libvlc.dylib" \
117             "$@/Contents/MacOS/VLC Plugin"
118         $(INSTALL) "$(top_builddir)/src/.libs/libvlccore.0.dylib" \
119             "$@/Contents/MacOS/lib/libvlccore.dylib"
120         $(INSTALL) "$(top_builddir)/src/.libs/libvlc.2.dylib" \
121             "$@/Contents/MacOS/lib/libvlc.dylib"
122         install_name_tool -change "$(libdir)/libvlccore.0.dylib" \
123             "@executable_path/lib/libvlccore.dylib" \
124             "$@/Contents/MacOS/lib/libvlc.dylib"
125         dylib="$@/Contents/MacOS/VLC Plugin"; $(FIXEXECPATH) ;
126         dylib="$@/Contents/MacOS/lib/libvlccore.dylib"; $(FIXEXECPATH) ;
127         dylib="$@/Contents/MacOS/lib/libvlc.dylib"; $(FIXEXECPATH) ;
128         $(INSTALL) -d "$@/Contents/Resources"
129         $(INSTALL) npvlc.rsrc "$@/Contents/Resources/VLC Plugin.rsrc"
130         cp -r "$(top_srcdir)/extras/package/macosx/plugin/English.lproj" "$@/Contents/Resources/"
131         cp -r "$(top_builddir)/extras/package/macosx/plugin/English.lproj" "$@/Contents/Resources/"
132         $(INSTALL) "$(top_builddir)/extras/package/macosx/plugin/Info.plist" "$@/Contents/Info.plist"
133         $(INSTALL) -d "$@/Contents/MacOS/modules"
134         find $(top_srcdir)/modules/ -name '*_plugin.$(LIBEXT)' | \
135         while read i; do \
136           if test -n "$$i" ; then \
137             dylib="$@/Contents/MacOS/modules/`basename $$i`"; \
138             $(INSTALL) "$$i" "$$dylib"; \
139             install_name_tool -change "$(libdir)/libvlccore.0.dylib" \
140                 "@executable_path/lib/libvlccore.dylib" "$$dylib"; \
141             $(FIXEXECPATH) ; \
142           fi ; \
143         done
144         if test -d $(top_srcdir)/extras/contrib/vlc-lib; then \
145           for i in $(top_srcdir)/extras/contrib/vlc-lib/*.dylib ; do \
146             dylib="$@/Contents/MacOS/lib/`basename $${i}`" ; \
147             $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
148             $(FIXEXECPATH); \
149           done ; \
150         fi
151 # uncomment if dependencies on XPCOM libs is sought
152 #       if test -d "$(MOZILLA_SDK_PATH)/lib"; then \
153 #         for i in "$(MOZILLA_SDK_PATH)"/lib/*.dylib ; do \
154 #           dylib="$(srcdir)/$@/Contents/MacOS/`basename $${i}`" ; \
155 #           $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
156 #           $(FIXEXECPATH); \
157 #         done ; \
158 #       fi
159
160 else
161
162 #
163 # UNIX/Others platforms
164 #
165
166 CPPFLAGS_mozilla_EXTRA = -DDATA_PATH=\"$(pkgdatadir)\"
167
168 npvlc_LTLIBRARIES = libvlcplugin.la
169
170 npvlc = libvlcplugin$(LIBEXT)
171 npvlcdir = $(libdir)/mozilla/plugins
172 SOURCES_support = support/npunix.c
173
174 libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
175 libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
176 libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
177 libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version -shrext $(LIBEXT)
178 libvlcplugin_la_LIBADD = $(LIBRARIES_libvlc) `$(VLC_CONFIG) -libs mozilla`
179 # automake gets confused by the ../..
180 libvlcplugin_la_DEPENDENCIES = $(AM_LIBADD) 
181 endif
182 endif
183 endif
184