Index: gears/Makefile
===================================================================
--- gears/Makefile	(revision 3240)
+++ gears/Makefile	(working copy)
@@ -27,6 +27,17 @@
 # This reduces the time taken for make to parse VPATH files by 80%.
 .SUFFIXES:
 
+# Have to define the Opera variables as simply-expanded so that they
+# are not clobbered by the Chrome trickery at the end of the file
+OPERA_CPPSRCS := $(NULL)
+OPERA_CPPFLAGS := $(NULL)
+OPERA_VPATH := $(NULL)
+OPERA_DLLFLAGS := $(NULL)
+OPERA_M4SRCS := $(NULL)
+OPERA_IDLSRCS := $(NULL)
+OPERA_HTML_M4SRCS := $(NULL)
+OPERA_LIBS := $(NULL)
+
 include tools/version.mk
 include tools/config.mk
 include tools/sanity.mk
@@ -1052,6 +1063,7 @@
 
 CHROME_CPPSRCS	+= \
 		js_runner_cr.cc \
+		message_queue_cr.cc \
 		module_cr.cc \
 		paths_cr.cc \
 		$(NULL)
@@ -1077,7 +1089,6 @@
 NPAPI_CPPSRCS	+= \
 		detect_version_collision_win32.cc \
 		ie_version.cc \
-		message_queue_cr.cc \
 		$(NULL)
 # TODO(mpcomplete): use WIN32_LINK_EXTRAS here.
 NPAPI_LINK_EXTRAS  += \
@@ -1985,6 +1996,7 @@
 
 OPERA_CPPSRCS	+= \
 		http_request_op.cc \
+		opera_local_server_impl.cc \
 		$(NULL)
 
 #-----------------------------------------------------------------------------
@@ -2335,6 +2347,20 @@
 FF2_CPPSRCS += $(FF3_CPPSRCS)
 
 
+# Opera Mobile specific. Opera Mobile is built with BROWSER=OPERA and OS=wince.
+ifeq ($(BROWSER),OPERA)
+# Opera uses the NPAPI base plus some Opera specific things.
+OPERA_CPPSRCS += $(NPAPI_CPPSRCS)
+OPERA_CPPFLAGS += $(NPAPI_CPPFLAGS)
+OPERA_VPATH += $(NPAPI_VPATH)
+OPERA_DLLFLAGS += $(NPAPI_DLLFLAGS)
+OPERA_M4SRCS += $(NPAPI_M4SRCS)
+OPERA_IDLSRCS += $(NPAPI_IDLSRCS)
+OPERA_HTML_M4SRCS += $(NPAPI_HTML_M4SRCS)
+# OPERA_LINK_EXTRAS is set independently of NPAPI_LINK_EXTRAS
+endif
+
+
 # Chrome-specific hackery. Chrome is built with BROWSER=NPAPI and OS=win32.
 ifeq ($(BROWSER),NPAPI)
 ifeq ($(OS),win32)
@@ -2354,24 +2380,6 @@
 endif
 endif
 
-
-# Opera Mobile specific. Opera Mobile is built with BROWSER=OPERA and OS=wince.
-ifeq ($(BROWSER),OPERA)
-ifeq ($(OS),wince)
-
-# Opera uses the NPAPI base plus some Opera specific things.
-OPERA_CPPSRCS += $(NPAPI_CPPSRCS)
-OPERA_CPPFLAGS += $(NPAPI_CPPFLAGS)
-OPERA_VPATH += $(NPAPI_VPATH)
-OPERA_DLLFLAGS += $(NPAPI_DLLFLAGS)
-OPERA_M4SRCS += $(NPAPI_M4SRCS)
-OPERA_IDLSRCS += $(NPAPI_IDLSRCS)
-OPERA_HTML_M4SRCS += $(NPAPI_HTML_M4SRCS)
-OPERA_LIBS += $(NPAPI_LIBS)
-# OPERA_LINK_EXTRAS is set independently of NPAPI_LINK_EXTRAS
-endif
-endif
-
 # IE Mobile specific. IE Mobile is built with BROWSER=IEMOBILE and OS=wince.
 ifeq ($(BROWSER),IEMOBILE)
 ifeq ($(OS),wince)
Index: gears/tools/config.mk
===================================================================
--- gears/tools/config.mk	(revision 3240)
+++ gears/tools/config.mk	(working copy)
@@ -755,7 +755,7 @@
 # no arguments and have it output empty string. The workaround is to call it
 # with a trailing dot. For more info, see:
 # http://blogs.msdn.com/oldnewthing/archive/2008/04/03/8352719.aspx
-ECHO=@echo.
+ECHO=@echo
 
 # Most Windows headers use the cross-platform NDEBUG and DEBUG #defines
 # (handled later).  But a few Windows files look at _DEBUG instead.
@@ -895,6 +895,7 @@
 IE_DLLFLAGS = /DEF:tools/mscom.def
 
 CHROME_DLLFLAGS = /DEF:base/chrome/module.def
+OPERA_DLLFLAGS = /DEF:base/npapi/module.def
 
 # Set the preferred base address.  This value was chosen because (a) it's near
 # the top of the valid address range, and (b) it doesn't conflict with other
@@ -923,14 +924,12 @@
 ifeq ($(OS),win32)
 IE_LIBS = kernel32.lib user32.lib gdi32.lib uuid.lib sensapi.lib shlwapi.lib shell32.lib advapi32.lib wininet.lib comdlg32.lib user32.lib
 else # wince
-IE_LIBS = $(WINCE_LIBS) coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib atlosapis.lib piedocvw.lib htmlview.lib imaging.lib aygshell.lib 
+IE_LIBS = $(WINCE_LIBS) coredll.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib atlosapis.lib piedocvw.lib htmlview.lib imaging.lib aygshell.lib
 endif
 ifeq ($(OS),wince)
-# We don't want to use these NPAPI libraries on WinCE
-else #wince
-NPAPI_LIBS = delayimp.lib /DELAYLOAD:"comdlg32.dll" comdlg32.lib
-endif
 OPERA_LIBS = $(WINCE_LIBS)
+endif
+NPAPI_LIBS = delayimp.lib /DELAYLOAD:"comdlg32.dll" comdlg32.lib
 
 # Other tools specific to win32/wince builds.
 RC = rc
Index: gears/tools/rules.mk
===================================================================
--- gears/tools/rules.mk	(revision 3240)
+++ gears/tools/rules.mk	(working copy)
@@ -435,10 +435,8 @@
 endif
 
 ifeq ($(BROWSER),OPERA)
+modules:: $(OPERA_MODULE_DLL)
 ifeq ($(OS),wince)
-# Add dependency on OPERA_MODULE_DLL for Win32 once we have Gears for Opera on
-# desktop.
-modules:: $(OPERA_MODULE_DLL)
 modules:: $(OPERA_WINCESETUP_DLL)
 endif
 endif
@@ -851,6 +849,11 @@
 OUR_COMPONENT_GUID_NPAPI_REGISTRY = \
   $(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_NPAPI_REGISTRY-$(VERSION))
 
+OUR_OPERA_PRODUCT_ID = \
+  $(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_OPERA_ID-$(VERSION))
+OUR_COMPONENT_GUID_OPERA_FILES = \
+  $(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_OPERA_FILES-$(VERSION))
+
 WIX_DEFINES_I18N = $(foreach lang,$(subst -,_,$(I18N_LANGS)),-dOurComponentGUID_FFLang$(lang)DirFiles=$(shell $(GGUIDGEN) $(NAMESPACE_GUID) OUR_COMPONENT_GUID_FF_$(lang)_DIR_FILES-$(VERSION)))
 
 # MSI version numbers must have the form <major>.<minor>.<build>. To meet this,
@@ -881,6 +884,9 @@
 	  -dOurNpapiPath=$(OUTDIR)/$(OS)-$(ARCH)/npapi \
 	  -dOurComponentGUID_NpapiFiles=$(OUR_COMPONENT_GUID_NPAPI_FILES) \
 	  -dOurComponentGUID_NpapiRegistry=$(OUR_COMPONENT_GUID_NPAPI_REGISTRY) \
+	  -dOurOperaProductId=$(OUR_OPERA_PRODUCT_ID) \
+	  -dOurOperaPath=$(OUTDIR)/$(OS)-$(ARCH)/opera \
+	  -dOurComponentGUID_OperaFiles=$(OUR_COMPONENT_GUID_OPERA_FILES) \
 	  -dOurMsiVersion=$(MSI_VERSION) \
 	  $(WIX_DEFINES_I18N)
 endif
