Makefile.am 5.13 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
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 86 87 88
if HAVE_XCB
AM_CPPFLAGS += $(XCB_CFLAGS)
libvlcplugin_la_LIBADD += $(XCB_LIBS)
SOURCES_support += \
	vlcwindowless_xcb.cpp \
	vlcwindowless_xcb.h
endif # !HAVE_XCB

Jean-Baptiste Kempf's avatar
Jean-Baptiste Kempf committed
89
else # Win32
90

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

96
if FETCH_NPAPI
97
$(npvlc_la_OBJECTS): npapi-sdk
98 99
endif

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

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

115
DATA_npvlc_rc = $(noinst_DATA)
116
noinst_DATA = npvlc_rc.$(OBJEXT)
117

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

121
endif
122
else
123

124
if FETCH_NPAPI
125
$(npvlc_la_OBJECTS): npapi-sdk
126 127
endif

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

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

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

147
noinst_DATA = VLC\ Plugin.plugin
148
CLEANFILES += VLC\ Plugin.plugin
149

150 151 152 153
#
# 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
154
# it is safer to force dylibs to locate dependents through a fixed path
155 156 157 158 159 160 161 162 163 164 165
#
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

166
VLC\ Plugin.plugin: $(lib_LTLIBRARIES)
167
	rm -Rf "$@"
168 169
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/MacOS/lib"
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/Resources"
170 171
	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"
172
	mv "VLC-Plugin.plugin" "VLC Plugin.plugin"
173 174
	find "VLC Plugin.plugin" -type d -exec chmod ugo+rx '{}' \;
	find "VLC Plugin.plugin" -type f -exec chmod ugo+r '{}' \;
175

176 177 178
# 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 \
179
#	    dylib="$(srcdir)/$@/Contents/MacOS/`basename $${i}`" ; \
180 181 182 183
#	    $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
#	    $(FIXEXECPATH); \
#	  done ; \
#	fi
184

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