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

5 6
MOSTLYCLEANFILES = 
CLEANFILES = $(BUILT_SOURCES)
7
EXTRA_DIST = $(DIST_sources) install.js npvlc_rc.rc.in vlc.r
8

9
SOURCES_mozilla_common = \
10 11 12
	vlcshell.cpp \
	vlcplugin.cpp \
	vlcplugin.h \
13 14 15 16
	control/npolibvlc.cpp \
	control/npolibvlc.h \
	control/nporuntime.cpp \
	control/nporuntime.h \
17
	support/classinfo.h
18

19
DIST_sources = $(SOURCES_mozilla_common) \
20
	support/npwin.cpp support/npmac.cpp support/npunix.c
21

22 23
if BUILD_MOZILLA

24 25
LIBRARIES_libvlc = $(top_builddir)/src/libvlc.la \
				   $(top_builddir)/src/libvlccore.la
26 27 28

if HAVE_WIN32

29 30 31
# 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.
32 33
#
lib_LTLIBRARIES = npvlc.la
34 35 36

SOURCES_support = support/npwin.cpp
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
37 38 39 40 41 42
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)
43
npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
44
				   $(LDFLAGS_mozilla_EXTRA)
45
npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)
46 47

DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
48 49 50
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir =

51
npvlc_rc.$(OBJEXT): npvlc_rc.rc
52
	$(WINDRES) --include-dir $(srcdir) -i $< -o $@
53

54 55
else
if HAVE_DARWIN
56

57 58 59 60 61
#
# MacOS X
#

lib_LTLIBRARIES = npvlc.la
62 63

SOURCES_support = support/npmac.cpp
64 65
CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c \
	-F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) \
66 67 68
	-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 \
69
	-include mozilla-config.h
70
LDFLAGS_mozilla_EXTRA = -no-undefined -bundle -Wl,-read_only_relocs -Wl,suppress \
71
	-Wl,-headerpad_max_install_names -shrext $(LIBEXT) -Wl,-framework,Carbon -Wl,-framework,System
72 73 74 75 76

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)
77
npvlc_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version \
78
				   $(LDFLAGS_mozilla_EXTRA)
79 80
npvlc_la_LIBADD = `$(VLC_CONFIG) -libs mozilla` $(LIBRARIES_libvlc)

81 82 83 84

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

86
npvlc.rsrc: vlc.r
87
	/Developer/Tools/Rez -useDF /Developer/Headers/FlatCarbon/Types.r $< -o $@
88

89 90 91 92
#
# 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
93
# it is safer to force dylibs to locate dependents through a fixed path
94 95 96 97 98 99 100 101 102 103 104
#
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

105
VLC\ Plugin.plugin: npvlc.rsrc $(lib_LTLIBRARIES)
106
	rm -Rf "$@"
107 108 109 110 111
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/MacOS/lib"
	$(INSTALL) -d "VLC-Plugin.plugin/Contents/Resources"
	ACTION="release-makefile" PRODUCT="VLC-Plugin.plugin" src_dir=$(srcdir) build_dir=$(top_builddir) sh ../macosx/framework/Pre-Compile.sh
	$(INSTALL) .libs/npvlc.dylib "VLC-Plugin.plugin/Contents/MacOS/VLC Plugin"
	dylib="VLC-Plugin.plugin/Contents/MacOS/VLC Plugin"; $(FIXEXECPATH);
112 113
	$(INSTALL) .libs/npvlc.dylib "VLC-Plugin.plugin/Contents/MacOS/lib"
	dylib="VLC-Plugin.plugin/Contents/MacOS/lib/npvlc.dylib"; $(FIXEXECPATH);
114 115 116
	$(INSTALL) npvlc.rsrc "VLC-Plugin.plugin/Contents/Resources/VLC Plugin.rsrc"
	$(INSTALL) "$(top_builddir)/extras/package/macosx/plugin/Info.plist" "VLC-Plugin.plugin/Contents/Info.plist"
	mv "VLC-Plugin.plugin" "VLC Plugin.plugin"
117 118
	find "VLC Plugin.plugin" -type d -exec chmod ugo+rx '{}' \;
	find "VLC Plugin.plugin" -type f -exec chmod ugo+r '{}' \;
119

120 121 122
# 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 \
123
#	    dylib="$(srcdir)/$@/Contents/MacOS/`basename $${i}`" ; \
124 125 126 127
#	    $(INSTALL) -m 644 "$${i}" "$$dylib" ; \
#	    $(FIXEXECPATH); \
#	  done ; \
#	fi
128

129
else
130

131 132 133
#
# UNIX/Others platforms
#
134

135 136
CPPFLAGS_mozilla_EXTRA = -DDATA_PATH=\"$(pkgdatadir)\"

137 138
npvlc_LTLIBRARIES = libvlcplugin.la

139 140 141
npvlc = libvlcplugin$(LIBEXT)
npvlcdir = $(libdir)/mozilla/plugins
SOURCES_support = support/npunix.c
142

143
libvlcplugin_la_SOURCES = $(SOURCES_mozilla_common) $(SOURCES_support)
144 145
libvlcplugin_la_CFLAGS = `$(VLC_CONFIG) --cflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
libvlcplugin_la_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla` $(CPPFLAGS_mozilla_EXTRA)
146
libvlcplugin_la_LDFLAGS = `$(VLC_CONFIG) --ldflags mozilla` -module -avoid-version -shrext $(LIBEXT)
147
libvlcplugin_la_LIBADD = $(LIBRARIES_libvlc) `$(VLC_CONFIG) -libs mozilla`
148 149
# automake gets confused by the ../..
libvlcplugin_la_DEPENDENCIES = $(AM_LIBADD) 
150 151 152
endif
endif
endif
153