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

damienf's avatar
damienf committed
5
6
MOSTLYCLEANFILES = 
CLEANFILES = $(BUILT_SOURCES)
damienf's avatar
damienf committed
7
EXTRA_DIST = $(DIST_sources) install.js npvlc_rc.rc vlc.r
8

9
SOURCES_mozilla_common = \
10
11
12
	vlcshell.cpp \
	vlcplugin.cpp \
	vlcplugin.h \
damienf's avatar
damienf committed
13
14
15
16
17
18
	control/npolibvlc.cpp \
	control/npolibvlc.h \
	control/npovlc.cpp \
	control/npovlc.h \
	control/nporuntime.cpp \
	control/nporuntime.h \
19
	support/classinfo.h
20

21
DIST_sources = $(SOURCES_mozilla_common) \
Rémi Denis-Courmont's avatar
Rémi Denis-Courmont committed
22
	support/npwin.cpp support/npmac.cpp support/npunix.c
gbazin's avatar
   
gbazin committed
23

24
25
if BUILD_MOZILLA

damienf's avatar
damienf committed
26
27
28
29
30
LIBRARIES_libvlc = $(top_builddir)/src/libvlc-control.la \
				   $(top_builddir)/src/libvlc.la

if HAVE_WIN32

31
32
33
# Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix
# the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
# under Win32 and npunix.c under Unix.
damienf's avatar
damienf committed
34
35
#
lib_LTLIBRARIES = npvlc.la
36
37
38

SOURCES_support = support/npwin.cpp
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
damienf's avatar
damienf committed
39
40
41
42
43
44
45
46
47
LDFLAGS_mozilla_EXTRA = -no-undefined -Wl,--kill-at -Wl,$(DATA_npvlc_rc)

npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_extra)
npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_extra)
npvlc_la_DEPENDENCIES = $(DATA_npvlc_rc) $(LIBRARIES_libvlc)
npvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs mozilla` -module -avoid-version \
				   $(LDFLAGS_mozilla_EXTRA)
npvlc_la_LIBADD = $(LIBRARIES_libvlc)
48
49

DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
50
51
52
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir =

53
npvlc_rc.$(OBJEXT): npvlc_rc.rc
54
55
56
	$(WINDRES) -DVERSION=$(VERSION) \
		-DVERSION_NUMBER=`echo $(VERSION).0.0.0 | sed 's/\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\)[^.]*\.*\([0-9]*\).*/\1,\2,\3,\4/'` \
		--include-dir $(srcdir) -i $< -o $@
57

58
59
else
if HAVE_DARWIN
60

damienf's avatar
damienf committed
61
62
63
64
65
#
# MacOS X
#

lib_LTLIBRARIES = npvlc.la
66
67

SOURCES_support = support/npmac.cpp
68
69
CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
	-F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
70
71
72
	-I/Developer/Headers/FlatCarbon -fno-common -fpascal-strings \
	-Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 \
	-DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 \
73
	-include mozilla-config.h
damienf's avatar
damienf committed
74
75
76
77
78
79
80
81
82
83
84
85
86
87
LDFLAGS_mozilla_EXTRA = -no-undefined -bundle -read_only_relocs suppress \
	-dylib -headerpad_max_install_names -shrext $(LIBEXT)

npvlc_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
npvlc_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
npvlc_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA) 
npvlc_la_DEPENDENCIES = $(LIBRARIES_libvlc)
npvlc_la_LDFLAGS = `$(VLC_CONFIG) --libs mozilla` -module -avoid-version \
				   $(LDFLAGS_mozilla_EXTRA)
npvlc_la_LIBADD = $(LIBRARIES_libvlc)

noinst_DATA = npvlc.rsrc VLC\ Plugin.plugin
MOSTLYCLEANFILES += npvlc.rsrc
CLEANFILES += VLC\ Plugin.plugin
88

89
npvlc.rsrc: $(srcdir)/vlc.r
90
	/Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
91

92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
#
# 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',
# it is safer to force dylibs to locate dependants through a fixed path
#
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

damienf's avatar
damienf committed
108
VLC\ Plugin.plugin: npvlc.rsrc $(lib_LTLIBRARIES)
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
	rm -Rf "$@"
	$(INSTALL) -d "./$@/Contents/MacOS"
	$(INSTALL) npvlc.dylib "./$@/Contents/MacOS/VLC Plugin"
	dylib="./$@/Contents/MacOS/VLC Plugin"; $(FIXEXECPATH) ;
	$(INSTALL) -d "./$@/Contents/Resources"
	$(INSTALL) npvlc.rsrc "./$@/Contents/Resources/VLC Plugin.rsrc"
	cp -r "$(top_srcdir)/extras/MacOSX/plugin/English.lproj" "./$@/Contents/Resources/"
	$(INSTALL) "$(top_srcdir)/extras/MacOSX/plugin/Info.plist" "./$@/Contents/Info.plist"
	$(INSTALL) -d "./$@/Contents/MacOS/modules"
	for i in "" `$(VLC_CONFIG) --target plugin` ; do \
	  if test -n "$$i" ; then \
	    dylib="./$@/Contents/MacOS/modules/`basename $$i$(LIBEXT)`"; \
	    $(INSTALL) "$$i$(LIBEXT)" "$$dylib"; \
	    $(FIXEXECPATH) ; \
	  fi ; \
	done
	if test -d $(top_srcdir)/extras/contrib/vlc-lib; then \
	  $(INSTALL) -d "./$@/Contents/MacOS/lib"; \
	  for i in $(top_srcdir)/extras/contrib/vlc-lib/*.dylib ; do \
	    dylib="./$@/Contents/MacOS/lib/`basename $${i}`" ; \
	    $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
	    $(FIXEXECPATH); \
	  done ; \
	fi
133
134
135
136
137
138
139
140
# 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 \
#	    dylib="./$@/Contents/MacOS/`basename $${i}`" ; \
#	    $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
#	    $(FIXEXECPATH); \
#	  done ; \
#	fi
141

142
else
143

damienf's avatar
damienf committed
144
145
146
#
# UNIX/Others platforms
#
147

148
149
npvlc_LTLIBRARIES = libvlcplugin.la

damienf's avatar
damienf committed
150
151
152
npvlc = libvlcplugin$(LIBEXT)
npvlcdir = $(libdir)/mozilla/plugins
SOURCES_support = support/npunix.c
Sam Hocevar's avatar
Sam Hocevar committed
153

154
155
156
libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla`
libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla`
157
libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --libs mozilla` -module -avoid-version -shrext $(LIBEXT)
damienf's avatar
damienf committed
158
libvlcplugin_la_LIBADD = $(LIBRARIES_libvlc)
159

damienf's avatar
damienf committed
160
161
162
endif
endif
endif
163