Merge all platforms into a single XPI, changes the names to the latest name
of the plugin, adds code to compute the JS window of the calling code and
the top-level URL directly rather than relying on the value passed in, and
implements tab identity.

A side effect of the changes to compute window/URL is that FF1.5-2 are not
currently supported, though we may add it back in the future if there is demand
and we can find another way to do this.

Patch by: sgross, jat
Review by: jat, rice


git-svn-id: https://google-web-toolkit.googlecode.com/svn/trunk@6742 8db76d5a-ed1c-0410-87a9-c151d255dfc7
diff --git a/plugins/xpcom/Makefile b/plugins/xpcom/Makefile
index f36f9dc..ae8ab58 100644
--- a/plugins/xpcom/Makefile
+++ b/plugins/xpcom/Makefile
@@ -24,8 +24,10 @@
 DEFAULT_FIREFOX_LIBS ?= /Applications/Firefox.app/Contents/MacOS
 RUN_PATH_FLAG = -executable_path
 DLL_SUFFIX = .dylib
-DLLFLAGS = -bundle -arch $(MARCH)
-TARGET_PLATFORM = Darwin_$(ARCH)-gcc3
+DLLFLAGS = -bundle $(ALLARCHCFLAGS)
+CFLAGS += $(ALLARCHCFLAGS)
+CXXFLAGS += $(ALLARCHCFLAGS)
+TARGET_PLATFORM = Darwin-gcc3
 # Mac puts multiple architectures into the same files
 GECKO_PLATFORM = Darwin-gcc3
 else
@@ -51,6 +53,7 @@
 BROWSER=ff3
 endif
 
+CFLAGS += -DBROWSER=$(BROWSER)
 GECKO_MINOR_VERSION=
 ifeq ($(BROWSER),ff2)
 BROWSER_VERSION   = 1.8
@@ -86,11 +89,11 @@
 COMMON            = ../common/libcommon$(FLAG32BIT).a
 
 OBJ_OUTDIR        = build/$(TARGET_PLATFORM)-$(BROWSER)
-EXTENSION_OUTDIR  = prebuilt/extension-$(BROWSER)
-FF_PLATFORM_DIR   = $(EXTENSION_OUTDIR)/platform/$(TARGET_PLATFORM)
+EXTENSION_OUTDIR  = prebuilt/extension
+FF_PLATFORM_DIR   = $(EXTENSION_OUTDIR)/lib/$(TARGET_PLATFORM)/$(BROWSER)
 
-INSTALLER_XPI     = prebuilt/gwt-dmp-$(BROWSER).xpi
-FF_DLL            = $(OBJ_OUTDIR)/libgwt_dmp_$(BROWSER)$(DLL_SUFFIX)
+INSTALLER_XPI     = prebuilt/gwt-dev-plugin.xpi
+FF_DLL            = $(OBJ_OUTDIR)/libgwt_dev_$(BROWSER)$(DLL_SUFFIX)
 #FF_TYPELIB        = build/IOOPHM.xpt
 #FF_HEADER         = $(OBJ_OUTDIR)/IOOPHM.h
 FF_TYPELIB        = prebuilt/extension/components/IOOPHM.xpt
@@ -119,11 +122,11 @@
 
 INC += -I$(GECKO_PLAT_INC) -I$(GECKO_SDK)/include -I$(dir $(FF_HEADER))
 
-VERSION=0.9.$(shell ./getversion).$(shell date +%Y%m%d%H%M%S)
+VERSION ?= 0.9.$(shell ./getversion).$(shell date +%Y%m%d%H%M%S)
 
 .PHONY: all xpi lib common browser clean depend install install-platform find-ff-libs
 
-all:: common xpi
+all:: common lib xpi
 
 lib:: browser $(OBJ_OUTDIR) $(EXTENSION_OUTDIR) $(FF_DLL)
 xpi:: $(EXTENSION_OUTDIR) $(INSTALLER_XPI)
@@ -140,17 +143,16 @@
 #	    $(error Missing Firefox libraries at $(GECKO_LIBS))
 #	fi
 
-# Not needed currently, but keeping around for now in case we change back to
-# putting it in build
-$(EXTENSION_OUTDIR):
-	rm -rf $@
-	mkdir -p $@
-	#cp -r prebuilt/extension/. $(EXTENSION_OUTDIR)
-	cp -r prebuilt/extension-$(BROWSER)/. $(EXTENSION_OUTDIR)
-	@mkdir -p $@/components
+generate-install:: $(EXTENSION_OUTDIR) install-template.rdf
+	sed -e s/GWT_DEV_PLUGIN_VERSION/$(VERSION)/ install-template.rdf >$(INSTALL_RDF)
 
-generate-install:: $(EXTENSION_OUTDIR) install-template-$(BROWSER).rdf
-	sed -e s/GWT_OOPHM_VERSION/$(VERSION)/ install-template-$(BROWSER).rdf >$(INSTALL_RDF)
+linuxplatforms:
+	$(MAKE) BROWSER=ff3 ARCH=x86
+	$(MAKE) BROWSER=ff3+ ARCH=x86
+	$(MAKE) BROWSER=ff35 ARCH=x86
+	$(MAKE) BROWSER=ff3 ARCH=x86_64
+	$(MAKE) BROWSER=ff3+ ARCH=x86_64
+	$(MAKE) BROWSER=ff35 ARCH=x86_64
 
 SRCS =	\
 		ExternalWrapper.cpp \
@@ -168,26 +170,22 @@
 $(OBJ_OUTDIR)::
 	@mkdir -p $@
 
-$(INSTALLER_XPI): $(FF_TYPELIB) $(EXTENSION_OUTDIR) generate-install $(shell find prebuilt/extension $(EXTENSION_OUTDIR)) $(FF_DLL)
+$(INSTALLER_XPI): $(FF_TYPELIB) $(EXTENSION_OUTDIR) generate-install $(shell find prebuilt/extension $(EXTENSION_OUTDIR))
 	@mkdir -p $(EXTENSION_OUTDIR)/components
-	(cd prebuilt/extension; find . \( -name .svn -prune \) -o -print | cpio -pmdua ../../$(EXTENSION_OUTDIR))
+	#(cd prebuilt/extension; find . \( -name .svn -prune \) -o -print | cpio -pmdua ../../$(EXTENSION_OUTDIR))
 	-rm $(INSTALLER_XPI)
 	(cd $(EXTENSION_OUTDIR) && zip -r -D -9 $(DIR)/$(INSTALLER_XPI) * -x '*/.svn/*' -x 'META-INF/*')
 
 $(FF_TYPELIB): IOOPHM.idl
 	$(XPIDL) $(XPIDL_FLAGS) -m typelib -e $@ $<
 
-$(FF_HEADER): IOOPHM.idl
+$(FF_HEADER): IOOPHM.idl $(OBJ_OUTDIR)
 	$(XPIDL) $(XPIDL_FLAGS) -m header -e $@ $<
 
 $(FF_DLL): $(FF_OBJS) $(COMMON)
 	$(CXX) -m$(FLAG32BIT) -o $@ $(FF_OBJS) $(COMMON) $(DLLFLAGS) 
-	@mkdir -p $(FF_PLATFORM_DIR)/components
-	cp $(FF_DLL) $(FF_PLATFORM_DIR)/components/
-#ifeq ($(OS),mac)
-#	@mkdir -p $(subst x86,ppc,$(FF_PLATFORM_DIR))/components
-#	cp $(FF_DLL) $(subst x86,ppc,$(FF_PLATFORM_DIR))/components/
-#endif
+	@mkdir -p $(FF_PLATFORM_DIR)
+	cp $(FF_DLL) $(FF_PLATFORM_DIR)/
 
 $(OBJ_OUTDIR)/%.o: %.cpp $(FF_HEADER)
 	$(CXX) $(CXXFLAGS) -c -o $@ -I. -I../common $<
@@ -200,8 +198,8 @@
 
 install-platform:
 ifdef BROWSER
-	@-mkdir -p $(subst $(EXTENSION_OUTDIR),prebuilt/extension-$(BROWSER),$(FF_PLATFORM_DIR))/components
-	-cp $(FF_DLL) $(subst $(EXTENSION_OUTDIR),prebuilt/extension-$(BROWSER),$(FF_PLATFORM_DIR))/components
+	@-mkdir -p $(FF_PLATFORM_DIR)
+	-cp $(FF_DLL) $(FF_PLATFORM_DIR))/
 ifeq ($(OS),mac)
 	@-mkdir -p $(subst $(EXTENSION_OUTDIR),prebuilt/extension-$(BROWSER),$(subst x86,ppc,$(FF_PLATFORM_DIR)))/components
 	-cp $(FF_DLL) $(subst $(EXTENSION_OUTDIR),prebuilt/extension-$(BROWSER),$(subst x86,ppc,$(FF_PLATFORM_DIR)))/components
@@ -209,6 +207,8 @@
 else
 	@$(MAKE) $@ BROWSER=ff2
 	@$(MAKE) $@ BROWSER=ff3
+	@$(MAKE) $@ BROWSER=ff3+
+	@$(MAKE) $@ BROWSER=ff35
 endif
 
 DEPEND = g++ -MM -MT'$$(OBJ_OUTDIR)/$(patsubst %.cpp,%.o,$(src))' \