1 ###############################################################################
2 # Building the Mozilla plugin
3 ###############################################################################
5 noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
7 MOSTLYCLEANFILES = $(npvlc_DATA) $(vlcintf_xpt_DATA)
8 CLEANFILES = stamp-pic $(BUILT_SOURCES)
9 EXTRA_DIST = $(DIST_sources) vlcintf.idl npvlc_rc.rc vlc.r
11 SOURCES_mozilla_common = \
21 DIST_sources = $(SOURCES_mozilla_common) \
22 support/npwin.cpp support/npmac.cpp support/npunix.c
25 LIBRARIES_libvlc_pic = -Wl,-rpath '$(libdir)' -L$(top_builddir)/src -lvlc
26 LIBRARIES_libvlc_nopic = $(LIBRARIES_libvlc_pic)
28 LIBRARIES_libvlc_pic = $(top_builddir)/src/libvlc.a
29 LIBRARIES_libvlc_nopic = $(top_builddir)/src/libvlc.a
34 # Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
35 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
36 # under Win32 and npunix.c under Unix.
39 LIBRARIES_libvlc = $(LIBRARIES_libvlc_nopic)
40 npvlc = npvlc$(LIBEXT)
42 noinst_DATA = npvlc_rc.$(OBJEXT)
44 SOURCES_support = support/npwin.cpp
45 CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
46 LDFLAGS_npvlc = -shared -Wl,--kill-at $(LIBRARIES_libvlc)
48 DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
49 noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
52 npvlc_rc.$(OBJEXT): npvlc_rc.rc
53 $(WINDRES) -DVERSION=$(VERSION) \
54 -DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` \
55 --include-dir $(srcdir) -i $< -o $@
60 LIBRARIES_libvlc = $(LIBRARIES_libvlc_nopic)
61 npvlc = npvlc$(LIBEXT)
63 noinst_DATA = npvlc.rsrc VLC\ Plugin.plugin
64 MOSTLYCLEANFILES += npvlc.rsrc
65 CLEANFILES += VLC\ Plugin.plugin
67 SOURCES_support = support/npmac.cpp
68 CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
69 -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
70 -I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
71 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 \
72 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 \
73 -include mozilla-config.h
74 LDFLAGS_npvlc = -bundle -read_only_relocs suppress \
75 $(LIBRARIES_libvlc) -dylib -headerpad_max_install_names
77 npvlc.rsrc: $(srcdir)/vlc.r
78 /Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
81 # Plugin uses shared libraries that are located relatively through @executable_path,
82 # which unfortunately references the path of the App using the Plugin, rather than the
83 # Plugin itself. Since this Plugin should always be installed in '/Library/Internet Plug-Ins',
84 # it is safer to force dylibs to locate dependants through a fixed path
87 otool -L "$$dylib" | \
88 awk -v libdylib="$$dylib" ' \
89 /@executable_path/ { \
91 sub("@executable_path","/Library/Internet Plug-Ins/VLC Plugin.plugin/Contents/MacOS",newpath) ; \
92 print "install_name_tool -change \""$$1"\" \""newpath"\" \""libdylib"\"" ; \
96 VLC\ Plugin.plugin: npvlc.rsrc npvlc.dylib
98 $(INSTALL) -d "./$@/Contents/MacOS"
99 $(INSTALL) npvlc.dylib "./$@/Contents/MacOS/VLC Plugin"
100 dylib="./$@/Contents/MacOS/VLC Plugin"; $(FIXEXECPATH) ;
101 $(INSTALL) -d "./$@/Contents/Resources"
102 $(INSTALL) npvlc.rsrc "./$@/Contents/Resources/VLC Plugin.rsrc"
103 cp -r "$(top_srcdir)/extras/MacOSX/plugin/English.lproj" "./$@/Contents/Resources/"
104 $(INSTALL) "$(top_srcdir)/extras/MacOSX/plugin/Info.plist" "./$@/Contents/Info.plist"
105 $(INSTALL) -d "./$@/Contents/MacOS/modules"
106 for i in "" `$(VLC_CONFIG) --target plugin` ; do \
107 if test -n "$$i" ; then \
108 dylib="./$@/Contents/MacOS/modules/`basename $$i$(LIBEXT)`"; \
109 $(INSTALL) "$$i$(LIBEXT)" "$$dylib"; \
113 if test -d $(top_srcdir)/extras/contrib/vlc-lib; then \
114 $(INSTALL) -d "./$@/Contents/MacOS/lib"; \
115 for i in $(top_srcdir)/extras/contrib/vlc-lib/*.dylib ; do \
116 dylib="./$@/Contents/MacOS/lib/`basename $${i}`" ; \
117 $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
121 # uncomment if dependencies on XPCOM libs is sought
122 # if test -d "$(MOZILLA_SDK_PATH)/lib"; then \
123 # for i in "$(MOZILLA_SDK_PATH)"/lib/*.dylib ; do \
124 # dylib="./$@/Contents/MacOS/`basename $${i}`" ; \
125 # $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
132 LIBRARIES_libvlc = $(LIBRARIES_libvlc_pic)
133 npvlc = libvlcplugin$(LIBEXT)
134 npvlcdir = $(libdir)/mozilla/plugins
135 SOURCES_support = support/npunix.c
138 LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc)
142 noinst_LIBRARIES_mozilla = libnpvlc.a
144 $(SOURCES_mozilla): vlcintf.h
146 BUILT_SOURCES = vlcintf.h
147 vlcintf_xpt_DATA = vlcintf.xpt
150 # FIXME: name is incorrect on Win32 & Darwin
151 npvlc_LTLIBRARIES = libvlcplugin.la
153 npvlc_DATA = $(npvlc)
154 EXTRA_LIBRARIES = libnpvlc.a
158 libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
159 libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla`
160 libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla`
161 libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --libs mozilla` -module -avoid-version -shrext $(LIBEXT)
162 libvlcplugin_la_LIBADD = ../src/libvlc.la
164 libnpvlc_a_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
165 libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
166 $(CPPFLAGS_mozilla_EXTRA)
167 libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
168 $(CPPFLAGS_mozilla_EXTRA)
169 LDFLAGS_libnpvlc = $(LDFLAGS_npvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
170 libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
172 $(npvlc): $(libnpvlc_a_OBJECTS) $(libnpvlc_a_DEPENDENCIES) stamp-pic
173 $(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
176 @if test -f "$@.exe"; then mv -f "$@.exe" "$@"; fi
178 vlcintf_xptdir = $(libdir)/mozilla/components
179 vlcintf.xpt: vlcintf.idl
180 $(XPIDL) $(XPIDL_INCL) \
181 -m typelib -o vlcintf $(srcdir)/vlcintf.idl
183 vlcintf.h: vlcintf.idl
184 $(XPIDL) $(XPIDL_INCL) \
185 -m header -o vlcintf $(srcdir)/vlcintf.idl
187 ###############################################################################
189 ###############################################################################
191 @for dep in "" `$(VLC_CONFIG) --target builtin $(pic)`; do \
192 if test "$${dep}" -nt "$(LIBRARIES_mozilla)"; then \
197 @if test ! -f $@; then printf "" > $@; fi
199 ###############################################################################
201 ###############################################################################