Makefile.am 5.26 KB
Newer Older
1 2 3 4
###############################################################################
# Building the Mozilla plugin
###############################################################################

5
EXTRA_DIST = package/npvlc_rc.rc.in package/npvlc.dll.manifest
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
6
MOSTLYCLEANFILES =
7
CLEANFILES = $(BUILT_SOURCES)
8 9
npvlcdir = $(libdir)/mozilla/plugins

10
AM_CPPFLAGS = $(LIBVLC_CFLAGS) -Inpapi-sdk $(MOZILLA_CFLAGS)
11

12
libvlcplugin_la_SOURCES = \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
13
	common.h \
14 15
	events.h \
	events.cpp \
16
	vlcshell.h \
17
	vlcshell.cpp \
18
	vlcplugin.h \
Cheng Sun's avatar
Cheng Sun committed
19 20
	vlcplugin_base.cpp \
	vlcplugin_base.h \
21 22 23 24
	control/npolibvlc.cpp \
	control/npolibvlc.h \
	control/nporuntime.cpp \
	control/nporuntime.h \
25
	../common/position.h \
26
	support/classinfo.h \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
27
	../common/vlc_player_options.h \
28 29
	../common/vlc_player.cpp \
	../common/vlc_player.h \
30
	$(SOURCES_support)
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
31

32
EXTRA_libvlcplugin_la_SOURCES = \
33
	support/npwin.cpp support/npmac.cpp support/npunix.cpp
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
34

35 36 37 38 39
libvlcplugin_la_DEPENDENCIES =
libvlcplugin_la_LIBADD = $(LIBVLC_LIBS)
libvlcplugin_la_LDFLAGS = \
	-module -avoid-version \
	-no-undefined
Gildas Bazin's avatar
Gildas Bazin committed
40

41 42 43 44
npvlc_la_SOURCES = $(libvlcplugin_la_SOURCES)
npvlc_la_DEPENDENCIES = $(libvlcplugin_la_DEPENDENCIES)
npvlc_la_LIBADD = $(libvlcplugin_la_LIBADD)
npvlc_la_LDFLAGS = $(libvlcplugin_la_LDFLAGS)
45

46 47 48
npapi-sdk:
	svn export http://npapi-sdk.googlecode.com/svn/trunk/headers npapi-sdk-svn -r HEAD
	mv npapi-sdk-svn npapi-sdk
49

50 51
if !HAVE_DARWIN
if !HAVE_WIN32
52

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
53
# Unix (x11) platforms
54 55 56
#
npvlc_LTLIBRARIES = libvlcplugin.la

57
if FETCH_NPAPI
58
$(libvlcplugin_la_OBJECTS): npapi-sdk
59 60
endif

Cheng Sun's avatar
Cheng Sun committed
61 62 63
AM_CPPFLAGS += -DXP_UNIX -DDATA_PATH=\"$(pkgdatadir)\"
libvlcplugin_la_LIBADD += $(MOZILLA_LIBS)

Ludovic Fauvet's avatar
Ludovic Fauvet committed
64 65 66
SOURCES_support = \
	support/npunix.cpp

67 68
if WITH_GTK
AM_CPPFLAGS += $(GTK_CFLAGS)
69
libvlcplugin_la_LIBADD += $(GTK_LIBS) $(X_LIBS) $(X_PRE_LIBS) -lX11
Ludovic Fauvet's avatar
Ludovic Fauvet committed
70
SOURCES_support += \
Cheng Sun's avatar
Cheng Sun committed
71 72
	vlcplugin_gtk.cpp \
	vlcplugin_gtk.h
73
else # !WITH_GTK
74 75
AM_CPPFLAGS += $(XCB_CFLAGS)
libvlcplugin_la_LIBADD += $(XCB_LIBS)
Ludovic Fauvet's avatar
Ludovic Fauvet committed
76
SOURCES_support += \
77 78
	vlcplugin_xcb.cpp \
	vlcplugin_xcb.h
Cheng Sun's avatar
Cheng Sun committed
79
endif # !USE_GTK
80

Ludovic Fauvet's avatar
Ludovic Fauvet committed
81 82 83 84 85
if HAVE_XCB
AM_CPPFLAGS += $(XCB_CFLAGS)
libvlcplugin_la_LIBADD += $(XCB_LIBS)
SOURCES_support += \
	vlcwindowless_xcb.cpp \
86 87 88
	vlcwindowless_xcb.h \
	vlcwindowless_base.cpp \
	vlcwindowless_base.h
Ludovic Fauvet's avatar
Ludovic Fauvet committed
89 90
endif # !HAVE_XCB

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
91
else # Win32
92

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
93 94
# Under Win32|Mac, Mozilla plugins need to be named NP******.DLL, but under Unix
# the common naming scheme is lib******plugin.so.
95 96
#
lib_LTLIBRARIES = npvlc.la
97

98
if FETCH_NPAPI
99
$(npvlc_la_OBJECTS): npapi-sdk
100 101
endif

102 103
AM_CPPFLAGS += -DXP_WIN -DXP_WIN32 \
	-DXPCOM_GLUE -DHAVE_CPP_MODERN_SPECIALIZE_TEMPLATE_SYNTAX
Cheng Sun's avatar
Cheng Sun committed
104 105 106 107
SOURCES_support = \
	support/npwin.cpp \
	vlcplugin_win.cpp \
	vlcplugin_win.h \
108
	../common/win32_fullscreen.cpp \
109 110
	../common/win32_fullscreen.h \
	../common/win32_vlcwnd.cpp \
111
	../common/win32_vlcwnd.h
112

113 114 115
npvlc_la_DEPENDENCIES += $(DATA_npvlc_rc)
npvlc_la_LDFLAGS += -Wl,--kill-at -Wl,$(DATA_npvlc_rc)
npvlc_la_LIBADD += -lgdi32
116

117
DATA_npvlc_rc = $(noinst_DATA)
118
noinst_DATA = npvlc_rc.$(OBJEXT)
119

120
npvlc_rc.$(OBJEXT): package/npvlc_rc.rc
121
	$(WINDRES) --include-dir $(srcdir) -i $< -o $@
122

123
endif
124
else
125

126
if FETCH_NPAPI
127
$(npvlc_la_OBJECTS): npapi-sdk
128 129
endif

130
# MacOS X
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
131
# Mac OS plugins need .r files that will be processed into rsrc files
132 133
#
lib_LTLIBRARIES = npvlc.la
134

135 136
AM_CPPFLAGS += -I. -I$(top_builddir) -c \
	-DXP_UNIX -DXP_MACOSX=1 \
Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
137
	-DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0
138

139 140
SOURCES_support = support/npmac.cpp \
                  vlcplugin_mac.cpp \
141
                  vlcplugin_mac.h \
142 143
                  vlcwindowless_base.cpp \
                  vlcwindowless_base.h \
144 145
                  vlcwindowless_mac.cpp \
                  vlcwindowless_mac.h
146
libvlcplugin_la_LDFLAGS += \
147 148
	-bundle -Wl,-headerpad_max_install_names \
	-Wl,-framework,CoreFoundation -Wl,-framework,ApplicationServices \
149
	-shrext .dylib
150

151
noinst_DATA = VLC\ Plugin.plugin
152
CLEANFILES += VLC\ Plugin.plugin
153

154 155 156 157
#
# Plugin uses shared libraries that are located relatively through @executable_path,
# which unfortunately references the path of the App using the Plugin, rather than the
# Plugin itself. Since this Plugin should always be installed in '/Library/Internet Plug-Ins',
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
158
# it is safer to force dylibs to locate dependents through a fixed path
159 160 161 162 163 164 165 166 167 168 169
#
define FIXEXECPATH
	otool -L "$$dylib" | \
	awk -v libdylib="$$dylib" ' \
	/@executable_path/ { \
	    newpath=$$1 ; \
	    sub("@executable_path","/Library/Internet Plug-Ins/VLC Plugin.plugin/Contents/MacOS",newpath) ; \
	    print "install_name_tool -change \""$$1"\" \""newpath"\" \""libdylib"\"" ; \
	}' | sh -x
endef

170
VLC\ Plugin.plugin: $(lib_LTLIBRARIES)
171
	rm -Rf "$@"
172 173
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/MacOS/lib"
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/Resources"
174 175
	ACTION="release-makefile" PRODUCT="VLC-Plugin.plugin" libvlc_dir=$(LIBVLC_PREFIX) src_dir=$(srcdir) build_dir=$(top_builddir) sh "$(top_srcdir)/extras/macosx/build-package.sh"
	$(INSTALL) "$(top_builddir)/extras/macosx/Info.plist" "VLC-Plugin.plugin/Contents/Info.plist"
176
	mv "VLC-Plugin.plugin" "VLC Plugin.plugin"
177 178
	find "VLC Plugin.plugin" -type d -exec chmod ugo+rx '{}' \;
	find "VLC Plugin.plugin" -type f -exec chmod ugo+r '{}' \;
179

180 181 182
# uncomment if dependencies on XPCOM libs is sought
#	if test -d "$(MOZILLA_SDK_PATH)/lib"; then \
#	  for i in "$(MOZILLA_SDK_PATH)"/lib/*.dylib ; do \
183
#	    dylib="$(srcdir)/$@/Contents/MacOS/`basename $${i}`" ; \
184 185 186 187
#	    $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
#	    $(FIXEXECPATH); \
#	  done ; \
#	fi
188

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
189
endif # Mac