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