# HG changeset patch
# User Mike Hommey
# Parent 202570dfd2a5defb5ae390030ee81b46cb60c3fd
Bug 618195 - Build services-crypto (or just nsSyncJPAKE) unconditionally as part of tier_platform
(mozilla + firefox part)

diff --git a/browser/build.mk b/browser/build.mk
--- a/browser/build.mk
+++ b/browser/build.mk
@@ -45,17 +45,17 @@ ifdef MOZ_EXTENSIONS
 tier_app_dirs += extensions
 endif
 
 tier_app_dirs += $(MOZ_BRANDING_DIRECTORY)
 
 tier_app_dirs += toolkit/components/console/hudservice
 
 ifdef MOZ_SERVICES_SYNC
-tier_app_dirs += services/sync
+tier_app_dirs += services
 endif
 
 tier_app_dirs += browser
 # Never add other tier_app_dirs after browser. They won't get packaged
 # properly on mac.
 
 installer:
 	@$(MAKE) -C browser/installer installer
diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -225,16 +225,17 @@
 @BINPATH@/components/proxyObject.xpt
 @BINPATH@/components/rdf.xpt
 @BINPATH@/components/satchel.xpt
 @BINPATH@/components/saxparser.xpt
 @BINPATH@/components/sessionstore.xpt
 #ifdef MOZ_SERVICES_SYNC
 @BINPATH@/components/services-crypto.xpt
 #endif
+@BINPATH@/components/services-crypto-component.xpt
 @BINPATH@/components/shellservice.xpt
 @BINPATH@/components/shistory.xpt
 @BINPATH@/components/spellchecker.xpt
 @BINPATH@/components/storage.xpt
 @BINPATH@/components/toolkitprofile.xpt
 #ifdef MOZ_ENABLE_XREMOTE
 @BINPATH@/components/toolkitremote.xpt
 #endif
diff --git a/services/crypto/Makefile.in b/services/crypto/Makefile.in
--- a/services/crypto/Makefile.in
+++ b/services/crypto/Makefile.in
@@ -43,37 +43,18 @@ VPATH     = @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = services-crypto
 XPIDL_MODULE = services-crypto
 
 XPIDLSRCS = \
   IWeaveCrypto.idl \
-  nsISyncJPAKE.idl \
-  $(NULL)
-
-LIBRARY_NAME   = services-crypto
-EXPORT_LIBRARY = 1
-IS_COMPONENT   = 1
-MODULE_NAME    = nsServicesCryptoModule
-LIBXUL_LIBRARY = 1
-FORCE_USE_PIC  = 1
-MOZILLA_INTERNAL_API = 1
-
-CPPSRCS = \
-  nsSyncJPAKE.cpp \
   $(NULL)
 
 libs::
 	$(PYTHON) $(topsrcdir)/config/nsinstall.py $(srcdir)/modules/* $(FINAL_TARGET)/modules/services-crypto
 
 ifdef ENABLE_TESTS
 DIRS += tests
 endif
 
 include $(topsrcdir)/config/rules.mk
-
-EXTRA_DSO_LDOPTS += \
-	$(MOZ_COMPONENT_LIBS) \
-    $(NSPR_LIBS) \
-    $(NSS_LIBS) \
-    $(NULL)
diff --git a/services/crypto/component/Makefile.in b/services/crypto/component/Makefile.in
new file mode 100644
--- /dev/null
+++ b/services/crypto/component/Makefile.in
@@ -0,0 +1,75 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Philipp von Weitershausen <philipp@weitershausen.de>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH     = ../../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = services-crypto
+XPIDL_MODULE = services-crypto-component
+
+XPIDLSRCS = \
+  nsISyncJPAKE.idl \
+  $(NULL)
+
+LIBRARY_NAME   = services-crypto
+EXPORT_LIBRARY = 1
+IS_COMPONENT   = 1
+MODULE_NAME    = nsServicesCryptoModule
+LIBXUL_LIBRARY = 1
+FORCE_USE_PIC  = 1
+MOZILLA_INTERNAL_API = 1
+
+CPPSRCS = \
+  nsSyncJPAKE.cpp \
+  $(NULL)
+
+ifdef ENABLE_TESTS
+DIRS += tests
+endif
+
+include $(topsrcdir)/config/rules.mk
+
+EXTRA_DSO_LDOPTS += \
+    $(MOZ_COMPONENT_LIBS) \
+    $(NSPR_LIBS) \
+    $(NSS_LIBS) \
+    $(NULL)
diff --git a/services/crypto/nsISyncJPAKE.idl b/services/crypto/component/nsISyncJPAKE.idl
rename from services/crypto/nsISyncJPAKE.idl
rename to services/crypto/component/nsISyncJPAKE.idl
diff --git a/services/crypto/nsSyncJPAKE.cpp b/services/crypto/component/nsSyncJPAKE.cpp
rename from services/crypto/nsSyncJPAKE.cpp
rename to services/crypto/component/nsSyncJPAKE.cpp
diff --git a/services/crypto/nsSyncJPAKE.h b/services/crypto/component/nsSyncJPAKE.h
rename from services/crypto/nsSyncJPAKE.h
rename to services/crypto/component/nsSyncJPAKE.h
diff --git a/services/crypto/component/tests/Makefile.in b/services/crypto/component/tests/Makefile.in
new file mode 100644
--- /dev/null
+++ b/services/crypto/component/tests/Makefile.in
@@ -0,0 +1,50 @@
+#
+# ***** BEGIN LICENSE BLOCK *****
+# Version: MPL 1.1/GPL 2.0/LGPL 2.1
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+# http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# The Original Code is mozilla.org code.
+#
+# The Initial Developer of the Original Code is
+# the Mozilla Foundation.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+#
+# Contributor(s):
+# Philipp von Weitershausen <philipp@weitershausen.de>
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either of the GNU General Public License Version 2 or later (the "GPL"),
+# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
+# in which case the provisions of the GPL or the LGPL are applicable instead
+# of those above. If you wish to allow use of your version of this file only
+# under the terms of either the GPL or the LGPL, and not to allow others to
+# use your version of this file under the terms of the MPL, indicate your
+# decision by deleting the provisions above and replace them with the notice
+# and other provisions required by the GPL or the LGPL. If you do not delete
+# the provisions above, a recipient may use your version of this file under
+# the terms of any one of the MPL, the GPL or the LGPL.
+#
+# ***** END LICENSE BLOCK *****
+
+DEPTH     = ../../../..
+topsrcdir = @top_srcdir@
+srcdir    = @srcdir@
+VPATH     = @srcdir@
+relativesrcdir = services/crypto/components/tests
+
+include $(DEPTH)/config/autoconf.mk
+
+MODULE = test_services_crypto
+XPCSHELL_TESTS = unit
+
+include $(topsrcdir)/config/rules.mk
diff --git a/services/crypto/tests/unit/test_jpake.js b/services/crypto/component/tests/unit/test_jpake.js
rename from services/crypto/tests/unit/test_jpake.js
rename to services/crypto/component/tests/unit/test_jpake.js
--- a/services/crypto/tests/unit/test_jpake.js
+++ b/services/crypto/component/tests/unit/test_jpake.js
@@ -1,8 +1,11 @@
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
 // Ensure PSM is initialized.
 Cc["@mozilla.org/psm;1"].getService(Ci.nsISupports);
 
 function do_check_throws(func) {
   let have_error = false;
   try {
     func();
   } catch(ex) {
diff --git a/toolkit/library/libxul-config.mk b/toolkit/library/libxul-config.mk
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -345,19 +345,17 @@ DEFINES += -DMOZ_SPELLCHECK
 COMPONENT_LIBS += spellchecker
 endif
 
 ifdef MOZ_ZIPWRITER
 DEFINES += -DMOZ_ZIPWRITER
 COMPONENT_LIBS += zipwriter
 endif
 
-ifdef MOZ_SERVICES_SYNC
 COMPONENT_LIBS += services-crypto
-endif
 
 ifdef MOZ_DEBUG
 ifdef ENABLE_TESTS
 COMPONENT_LIBS += gkdebug
 endif
 endif
 
 ifdef MOZ_APP_COMPONENT_LIBS
diff --git a/toolkit/library/nsStaticXULComponents.cpp b/toolkit/library/nsStaticXULComponents.cpp
--- a/toolkit/library/nsStaticXULComponents.cpp
+++ b/toolkit/library/nsStaticXULComponents.cpp
@@ -228,21 +228,17 @@
 #endif
 
 #if defined(BUILD_CTYPES)
 #define JSCTYPES_MODULE MODULE(jsctypes)
 #else
 #define JSCTYPES_MODULE
 #endif
 
-#ifdef MOZ_SERVICES_SYNC
 #define SERVICES_CRYPTO_MODULE MODULE(nsServicesCryptoModule)
-#else
-#define SERVICES_CRYPTO_MODULE
-#endif
 
 #if defined(MOZ_APP_COMPONENT_INCLUDE)
 #include MOZ_APP_COMPONENT_INCLUDE
 #else
 #define APP_COMPONENT_MODULES
 #endif
 
 #define XUL_MODULES                          \
diff --git a/toolkit/toolkit-tiers.mk b/toolkit/toolkit-tiers.mk
--- a/toolkit/toolkit-tiers.mk
+++ b/toolkit/toolkit-tiers.mk
@@ -230,19 +230,17 @@ tier_platform_dirs	+= security/manager
 else
 tier_platform_dirs	+= security/manager/boot/public security/manager/ssl/public
 endif
 
 ifdef MOZ_PREF_EXTENSIONS
 tier_platform_dirs += extensions/pref
 endif
 
-ifdef MOZ_SERVICES_SYNC
-tier_platform_dirs += services/crypto
-endif
+tier_platform_dirs += services/crypto/component
 
 # JavaXPCOM JNI code is compiled into libXUL
 ifdef MOZ_JAVAXPCOM
 tier_platform_dirs += extensions/java/xpcom/src
 endif
 
 ifndef BUILD_STATIC_LIBS
 ifneq (,$(MOZ_ENABLE_GTK2))
