Commit d2b09db5 authored by Damien Fouilleul's avatar Damien Fouilleul

all: fixed mozilla plugin compilation for MacOS X

parent d3ec9953
...@@ -2,10 +2,10 @@ ...@@ -2,10 +2,10 @@
# Building the Mozilla plugin # Building the Mozilla plugin
############################################################################### ###############################################################################
EXTRA_LIBRARIES = libplugin.a noinst_LIBRARIES = $(noinst_LIBRARIES_mozilla)
MOSTLYCLEANFILES = $(LIBRARIES_mozilla) MOSTLYCLEANFILES = $(LIBRARIES_mozilla)
EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) vlcintf.idl EXTRA_DIST = $(SOURCES_mozilla) $(DIST_rsrc) $(DIST_misc)
BUILT_SOURCES = $(BUILT_SOURCES_mozilla) BUILT_SOURCES = $(BUILT_SOURCES_mozilla)
SOURCES_mozilla = \ SOURCES_mozilla = \
...@@ -15,57 +15,107 @@ SOURCES_mozilla = \ ...@@ -15,57 +15,107 @@ SOURCES_mozilla = \
vlcpeer.cpp \ vlcpeer.cpp \
vlcpeer.h \ vlcpeer.h \
support/classinfo.h \ support/classinfo.h \
$(SOURCES_win32) \ $(SOURCES_support) \
$(SOURCES_macosx) \
$(SOURCES_unix) \
$(NULL) $(NULL)
DIST_rsrc = \ DIST_rsrc = \
npvlc_rc.rc \ $(SOURCES_rsrc) \
$(NULL)
DIST_misc = \
vlcintf.idl \
$(NULL) $(NULL)
# Under Win32, Mozilla plugins need to be named NP******.DLL, but under Unix # 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 # the common naming scheme is lib******plugin.so. Also, we need npwin.cpp
# under Win32 and npunix.c under Unix. # under Win32 and npunix.c under Unix.
if HAVE_WIN32 if HAVE_WIN32
LIBRARIES_mozilla = npvlc$(LIBEXT)
SOURCES_win32 = support/npwin.cpp
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
npvlc_DATA = npvlc$(LIBEXT)
npvlcdir = $(libdir)
SOURCES_support = support/npwin.cpp
SOURCES_rsrc = npvlc_rc.rc
CPPFLAGS_mozilla_EXTRA = -DXP_WIN -DXP_WIN32
DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir = $(libdir)
npvlc_rc.$(OBJEXT): npvlc_rc.rc
$(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 $@
LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin`
else else
if HAVE_DARWIN if HAVE_DARWIN
# We don't define LIBRARIES_mozilla because we'll be using project builder, or not...
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc.a
npvlc_DATA = $(noinst_npvlc_DATA)
noinst_npvlc_DATA = npvlc$(LIBEXT)
noinst_npvlcdir = $(libdir)
BUNDLE_mozilla = VLC\ Plugin.plugin BUNDLE_mozilla = VLC\ Plugin.plugin
vlc_moz_FLAGS = `$(VLC_CONFIG) --libs vlc builtin pic mozilla` SOURCES_support = support/npmac.cpp
moz_CFLAGS = `$(MOZILLA_CONFIG) --cflags plugin java nspr/obsolete nspr oji xpcom xpconnect` SOURCES_rsrc = vlc.r
moz_plugin_FLAGS = -I. -I$(top_builddir) -I$(srcdir)/../include -c -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) -I/Developer/Headers/FlatCarbon -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 -g -include mozilla-config.h
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a DATA_bundle = $(noinst_bundle_DATA)
noinst_bundle_DATA = VLC\ Plugin.plugin
noinst_bundledir = $(libdir)
VLC\ Plugin.plugin: npvlc.rsrc npvlc.dylib
rm -rf "$@"
mkdir -p "./$@/Contents/MacOS"
cp npvlc.dylib "./$@/Contents/MacOS/$@"
mkdir -p ./"$@"/Contents/Resources
cp npvlc.rsrc "./$@/Contents/MacOS/$@.rsrc"
cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist "./$@/Contents/Info.plist"
cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist "./$@/Contents/pbdevelopment.plist"
cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj "./$@/Contents/Resources/"
(cd $(top_builddir)/VLC.app/Contents/MacOS/; tar cf - modules)| \
(cd "./$@/Contents/MacOS"; tar xf -)
CPPFLAGS_mozilla_EXTRA = -I. -I$(top_builddir) -I$(srcdir)/../include -c -F/System/Library/Frameworks/CoreFoundation.framework $(moz_CFLAGS) -I/Developer/Headers/FlatCarbon -arch ppc -fno-common -fpascal-strings -O0 -Wmost -Wno-four-char-constants -Wno-unknown-pragmas -DXP_MACOSX=1 -DNO_X11=1 -DUSE_SYSTEM_CONSOLE=1 -pipe -fmessage-length=0 -g -include mozilla-config.h
DATA_npvlc_rsrc = $(noinst_npvlc_rsrc_DATA)
noinst_npvlc_rsrc_DATA = npvlc.rsrc
noinst_npvlc_rsrcdir = $(libdir)
npvlc.rsrc: $(srcdir)/vlc.r
/Developer/Tools/Rez /Developer/Headers/FlatCarbon/Types.r $< -o $@
LDFLAGS_npvlc = -arch ppc -bundle -read_only_relocs suppress $(LIBRARIES_libvlc) -dylib `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
else else
LIBRARIES_mozilla = libvlcplugin$(LIBEXT)
SOURCES_unix = support/npunix.c
LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a LIBRARIES_libvlc = $(top_builddir)/lib/libvlc_pic.a
npvlc_DATA = libvlcplugin$(LIBEXT)
npvlcdir = $(libdir)/mozilla/plugins
SOURCES_support = support/npunix.c
LDFLAGS_npvlc = -shared $(LIBRARIES_libvlc) `$(VLC_CONFIG) --libs mozilla vlc builtin $(pic)`
endif endif
endif endif
if BUILD_MOZILLA if BUILD_MOZILLA
libplugin_a_SOURCES = $(SOURCES_mozilla)
libplugin_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \ noinst_LIBRARIES_mozilla = libnpvlc.a
$(CPPFLAGS_mozilla_EXTRA) -Imozilla
libplugin_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \ libnpvlc_a_SOURCES = $(SOURCES_mozilla)
$(CPPFLAGS_mozilla_EXTRA) -Imozilla libnpvlc_a_CFLAGS = `$(VLC_CONFIG) --cflags mozilla $(pic)` \
libplugin_a_DEPENDENCIES = $(DATA_npvlc_rc) $(CPPFLAGS_mozilla_EXTRA)
libnpvlc_a_CXXFLAGS = `$(VLC_CONFIG) --cxxflags mozilla $(pic)` \
$(CPPFLAGS_mozilla_EXTRA)
libnpvlc_a_DEPENDENCIES = $(DATA_npvlc_rc)
BUILT_SOURCES_mozilla = vlcintf.h BUILT_SOURCES_mozilla = vlcintf.h
$(SOURCES_mozilla): vlcintf.h $(SOURCES_mozilla): vlcintf.h
plugin_DATA = $(LIBRARIES_mozilla) $(BUNDLE_mozilla) npvlc$(LIBEXT): $(libnpvlc_a_OBJECTS) \
plugindir = $(libdir)/mozilla/plugins $(libnpvlc_a_DEPENDENCIES) stamp-pic
$(LIBRARIES_mozilla): $(libplugin_a_OBJECTS) \ $(CXXLINK) $(libnpvlc_a_OBJECTS) $(DATA_npvlc_rc) \
$(libplugin_a_DEPENDENCIES) stamp-pic $(LDFLAGS_npvlc)
$(CXXLINK) $(libplugin_a_OBJECTS) $(DATA_npvlc_rc) \
$(LIBRARIES_libvlc) -shared \
`$(VLC_CONFIG) --libs vlc mozilla builtin $(pic)`
vlcintf_xpt_DATA = vlcintf.xpt vlcintf_xpt_DATA = vlcintf.xpt
vlcintf_xptdir = $(libdir)/mozilla/components vlcintf_xptdir = $(libdir)/mozilla/components
...@@ -77,36 +127,17 @@ vlcintf.h: vlcintf.idl ...@@ -77,36 +127,17 @@ vlcintf.h: vlcintf.idl
$(XPIDL) $(XPIDL_INCL) \ $(XPIDL) $(XPIDL_INCL) \
-m header -o vlcintf $(srcdir)/vlcintf.idl -m header -o vlcintf $(srcdir)/vlcintf.idl
if HAVE_WIN32
DATA_npvlc_rc = $(noinst_npvlc_rc_DATA)
noinst_npvlc_rc_DATA = npvlc_rc.$(OBJEXT)
noinst_npvlc_rcdir = $(libdir)
npvlc_rc.$(OBJEXT): npvlc_rc.rc
$(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 $@
endif
if HAVE_DARWIN
VLC\ Plugin.plugin:
rm -rf ./VLC\ Plugin.plugin
mkdir -p ./VLC\ Plugin.plugin/Contents/MacOS
mkdir -p ./VLC\ Plugin.plugin/Contents/Resources
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcplugin.cpp -o ./libplugin_a-vlcplugin.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcshell.cpp -o ./libplugin_a-vlcshell.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/vlcpeer.cpp -o ./libplugin_a-vlcpeer.o
/usr/bin/g++3 $(moz_plugin_FLAGS) $(srcdir)/support/npmac.cpp -o ./libplugin_a-npmac.o
/usr/bin/g++3 ./libplugin_a-vlcplugin.o ./libplugin_a-vlcshell.o ./libplugin_a-vlcpeer.o ./libplugin_a-npmac.o -o ./VLC\ Plugin.plugin/Contents/MacOS/VLC\ Plugin -L/usr/lib -F/System/Library/Frameworks/CoreFoundation.framework -framework CoreFoundation -arch ppc -bundle -read_only_relocs suppress $(LIBRARIES_libvlc) -dylib $(vlc_moz_FLAGS)
cp $(top_srcdir)/extras/MacOSX/plugin/Info.plist ./VLC\ Plugin.plugin/Contents/Info.plist
cp $(top_srcdir)/extras/MacOSX/plugin/pbdevelopment.plist ./VLC\ Plugin.plugin/Contents/pbdevelopment.plist
cp -r $(top_srcdir)/extras/MacOSX/plugin/English.lproj ./VLC\ Plugin.plugin/Contents/Resources/
Rez /Developer/Headers/FlatCarbon/Types.r $(srcdir)/vlc.r -o ./VLC\ Plugin.plugin/Contents/Resources/Vlc\ Plugin.rsrc
mkdir ./VLC\ Plugin.plugin/Contents/MacOS/modules
cp -r $(top_builddir)/VLC.app/Contents/MacOS/modules/* ./VLC\ Plugin.plugin/Contents/MacOS/modules/
endif
endif endif
############################################################################### ###############################################################################
# Stamp rules # Stamp rules
############################################################################### ###############################################################################
clean: clean-stamp clean-bundle clean-local: clean-stamp clean-bundle
clean-bundle::
rm -rf ./VLC\ Plugin.plugin
clean-stamp: clean-stamp:
rm -f stamp-pic rm -f stamp-pic
...@@ -119,9 +150,6 @@ stamp-pic: FORCE ...@@ -119,9 +150,6 @@ stamp-pic: FORCE
done done
@if test ! -f $@; then printf "" > $@; fi @if test ! -f $@; then printf "" > $@; fi
clean-bundle:
rm -rf ./VLC\ Plugin.plugin
############################################################################### ###############################################################################
# Force rule # Force rule
############################################################################### ###############################################################################
......
...@@ -295,7 +295,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc, ...@@ -295,7 +295,7 @@ NPError NPP_New( NPMIMEType pluginType, NPP instance, uint16 mode, int16 argc,
home_user = strdup( getenv("HOME") ); home_user = strdup( getenv("HOME") );
directory = strdup( "/Library/Internet Plug-Ins/VLC Plugin.plugin/" directory = strdup( "/Library/Internet Plug-Ins/VLC Plugin.plugin/"
"Contents/MacOS/modules" ); "Contents/MacOS/modules" );
plugin_path = malloc( strlen( directory ) + strlen( home_user ) ); plugin_path = (char *)malloc( strlen( directory ) + strlen( home_user ) );
memcpy( plugin_path , home_user , strlen(home_user) ); memcpy( plugin_path , home_user , strlen(home_user) );
memcpy( plugin_path + strlen( home_user ) , directory , memcpy( plugin_path + strlen( home_user ) , directory ,
strlen( directory ) ); strlen( directory ) );
...@@ -534,7 +534,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -534,7 +534,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
#if USE_LIBVLC #if USE_LIBVLC
#ifdef XP_MACOSX #ifdef XP_MACOSX
value.i_int = ((NP_Port*) (window->window))->port; value.i_int = (int)(((NP_Port*) (window->window))->port);
VLC_VariableSet( p_plugin->i_vlc, "drawable", value ); VLC_VariableSet( p_plugin->i_vlc, "drawable", value );
valueportx.i_int = ((NP_Port*) (window->window))->portx; valueportx.i_int = ((NP_Port*) (window->window))->portx;
...@@ -569,7 +569,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window ) ...@@ -569,7 +569,7 @@ NPError NPP_SetWindow( NPP instance, NPWindow* window )
black_rect.bottom = valueb.i_int - valuey.i_int; black_rect.bottom = valueb.i_int - valuey.i_int;
black_rect.right = valuer.i_int - valuex.i_int; black_rect.right = valuer.i_int - valuex.i_int;
SetPort( value.i_int ); SetPort( (GrafPtr)value.i_int );
SetOrigin( valueportx.i_int , valueporty.i_int ); SetOrigin( valueportx.i_int , valueporty.i_int );
ForeColor(blackColor); ForeColor(blackColor);
PenMode( patCopy ); PenMode( patCopy );
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment