1 ###############################################################################
2 # Building the Mozilla plugin
3 ###############################################################################
5 noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
7 MOSTLYCLEANFILES = $(npvlc_DATA)
8 CLEANFILES = stamp-pic $(BUILT_SOURCES)
9 EXTRA_DIST = $(DIST_sources) npvlc_rc.rc vlc.r
11 SOURCES_mozilla_common = \
15 control/npolibvlc.cpp \
19 control/nporuntime.cpp \
20 control/nporuntime.h \
23 DIST_sources = $(SOURCES_mozilla_common) \
24 support/npwin.cpp support/npmac.cpp support/npunix.c
27 LIBRARIES_libvlc_pic = -Wl,-rpath '$(libdir)' -L$(top_builddir)/src -lvlc
28 LIBRARIES_libvlc_nopic = $(LIBRARIES_libvlc_pic)
30 LIBRARIES_libvlc_pic = $(top_builddir)/src/libvlc.a
31 LIBRARIES_libvlc_nopic = $(top_builddir)/src/libvlc.a
36 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
37 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
38 # under Win32 and npunix.c under Unix.
41 LIBRARIES_libvlc = $(LIBRARIES_libvlc_nopic)
42 npvlc = npvlc$(LIBEXT)
44 noinst_DATA = npvlc_rc.$(OBJEXT)
46 SOURCES_support = support/npwin.cpp
47 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
48 LDFLAGS_npvlc = -shared -Wl,--kill-at $(LIBRARIES_libvlc)
50 DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
51 noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
54 npvlc_rc.$(OBJEXT): npvlc_rc.rc
55 $(WINDRES) -DVERSION=$(VERSION) \
56 -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` \
57 --include-dir $(srcdir) -i $< -o $@
62 LIBRARIES_libvlc = $(LIBRARIES_libvlc_nopic)
63 npvlc = npvlc$(LIBEXT)
65 noinst_DATA = npvlc.rsrc VLC\ Plugin.plugin
66 MOSTLYCLEANFILES += npvlc.rsrc
67 CLEANFILES += VLC\ Plugin.plugin
69 SOURCES_support = support/npmac.cpp
70 CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
71 -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
72 -I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
73 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 \
74 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 \
75 -include mozilla-config.h
76 LDFLAGS_npvlc = -bundle -read_only_relocs suppress \
77 $(LIBRARIES_libvlc) -dylib -headerpad_max_install_names
79 npvlc.rsrc: $(srcdir)/vlc.r
80 /Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
83 # Plugin uses shared libraries that are located relatively through @executable_path,
84 # which unfortunately references the path of the App using the Plugin, rather than the
85 # Plugin itself. Since this Plugin should always be installed in '/Library/Internet Plug-Ins',
86 # it is safer to force dylibs to locate dependants through a fixed path
89 otool -L "$$dylib" | \
90 awk -v libdylib="$$dylib" ' \
91 /@executable_path/ { \
93 sub("@executable_path","/Library/Internet Plug-Ins/VLC Plugin.plugin/Contents/MacOS",newpath) ; \
94 print "install_name_tool -change \""$$1"\" \""newpath"\" \""libdylib"\"" ; \
98 VLC\ Plugin.plugin: npvlc.rsrc npvlc.dylib
100 $(INSTALL) -d "./$@/Contents/MacOS"
101 $(INSTALL) npvlc.dylib "./$@/Contents/MacOS/VLC Plugin"
102 dylib="./$@/Contents/MacOS/VLC Plugin"; $(FIXEXECPATH) ;
103 $(INSTALL) -d "./$@/Contents/Resources"
104 $(INSTALL) npvlc.rsrc "./$@/Contents/Resources/VLC Plugin.rsrc"
105 cp -r "$(top_srcdir)/extras/MacOSX/plugin/English.lproj" "./$@/Contents/Resources/"
106 $(INSTALL) "$(top_srcdir)/extras/MacOSX/plugin/Info.plist" "./$@/Contents/Info.plist"
107 $(INSTALL) -d "./$@/Contents/MacOS/modules"
108 for i in "" `$(VLC_CONFIG) --target plugin` ; do \
109 if test -n "$$i" ; then \
110 dylib="./$@/Contents/MacOS/modules/`basename $$i$(LIBEXT)`"; \
111 $(INSTALL) "$$i$(LIBEXT)" "$$dylib"; \
115 if test -d $(top_srcdir)/extras/contrib/vlc-lib; then \
116 $(INSTALL) -d "./$@/Contents/MacOS/lib"; \
117 for i in $(top_srcdir)/extras/contrib/vlc-lib/*.dylib ; do \
118 dylib="./$@/Contents/MacOS/lib/`basename $${i}`" ; \
119 $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
123 # uncomment if dependencies on XPCOM libs is sought
124 # if test -d "$(MOZILLA_SDK_PATH)/lib"; then \
125 # for i in "$(MOZILLA_SDK_PATH)"/lib/*.dylib ; do \
126 # dylib="./$@/Contents/MacOS/`basename $${i}`" ; \
127 # $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
134 LIBRARIES_libvlc = $(LIBRARIES_libvlc_pic)
135 npvlc = libvlcplugin$(LIBEXT)
136 npvlcdir = $(libdir)/mozilla/plugins
137 SOURCES_support = support/npunix.c
140 LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc)
144 noinst_LIBRARIES_mozilla = libnpvlc.a
147 # FIXME: name is incorrect on Win32 & Darwin
148 npvlc_LTLIBRARIES = libvlcplugin.la
150 npvlc_DATA = $(npvlc)
151 EXTRA_LIBRARIES = libnpvlc.a
161 libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
162 libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla`
163 libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla`
164 libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --libs mozilla` -module -avoid-version -shrext $(LIBEXT)
165 libvlcplugin_la_LIBADD = ../src/libvlc-control.la
167 libnpvlc_a_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
168 libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla pic` \
169 $(CPPFLAGS_mozilla_EXTRA)
170 libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla pic` \
171 $(CPPFLAGS_mozilla_EXTRA)
172 LDFLAGS_libnpvlc = $(LDFLAGS_npvlc) `$(VLC_CONFIG) --libs mozilla libvlc builtin pic`
173 libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
175 $(npvlc): $(libnpvlc_a_OBJECTS) $(libnpvlc_a_DEPENDENCIES) stamp-pic
176 $(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
179 @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
181 ###############################################################################
183 ###############################################################################
185 @for dep in "" `$(VLC_CONFIG) --target builtin pic`; do \
186 if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
191 @if test ! -f $@; then printf "" > $@; fi
193 ###############################################################################
195 ###############################################################################