Bug 306907 - Build libsqlite as a standard name separate shared library. Patch by Michael Wu <michael.wu@mozilla.com>, Robert Relyea <rrelyea@redhat.com>, Ryan VanderMeulen <ryanvm@gmail.com>, and Shawn Wilsher <me@shawnwilsher.com>. r=benjamin
authorsdwilsh@shawnwilsher.com
Wed, 18 Jul 2007 09:20:12 -0700
changeset 3614 36c8f79299ab134f315f3336a8a2a881a480c690
parent 3613 0fe57234014a3639961821f62f23bb0df34ce1e1
child 3615 d08b385ef96a2798932ff0e0c09b3d71c5ac8773
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbenjamin
bugs306907
milestone1.9a7pre
Bug 306907 - Build libsqlite as a standard name separate shared library. Patch by Michael Wu <michael.wu@mozilla.com>, Robert Relyea <rrelyea@redhat.com>, Ryan VanderMeulen <ryanvm@gmail.com>, and Shawn Wilsher <me@shawnwilsher.com>. r=benjamin
config/static-config.mk
config/system-headers
db/sqlite3/src/Makefile.in
db/sqlite3/src/sqlite3file.h
storage/build/Makefile.in
toolkit/library/libxul-config.mk
xpcom/stub/Makefile.in
--- a/config/static-config.mk
+++ b/config/static-config.mk
@@ -100,16 +100,20 @@ endif
 ifdef MOZ_ENABLE_XFT
 STATIC_EXTRA_LIBS	+= $(MOZ_XFT_LIBS)
 endif
 
 ifdef MOZ_ENABLE_PANGO
 STATIC_EXTRA_LIBS	+= $(MOZ_PANGO_LIBS)
 endif
 
+ifdef MOZ_STORAGE
+EXTRA_DSO_LIBS += sqlite3
+endif
+
 ifdef MOZ_ENABLE_STARTUP_NOTIFICATION
 STATIC_EXTRA_LIBS	+= $(MOZ_STARTUP_NOTIFICATION_LIBS)
 endif
 
 # Component Makefile always brings in this.
 # STATIC_EXTRA_LIBS	+= $(TK_LIBS)
 
 # Some random modules require this
--- a/config/system-headers
+++ b/config/system-headers
@@ -603,16 +603,18 @@ shlguid.h
 shlobj.h
 sigcontext.h
 signal.h
 SimpleGameSound.h
 SIOUX.h
 size_t.h
 someincludefile.h
 Sound.h
+sqlite3.h
+sqlite3file.h
 ssdef.h
 sslerr.h
 ssl.h
 sslproto.h
 sstream
 stack
 StandardFile.h
 starlet.h
--- a/db/sqlite3/src/Makefile.in
+++ b/db/sqlite3/src/Makefile.in
@@ -40,19 +40,26 @@
 DEPTH		= ../../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
 MODULE           = sqlite3
-LIBRARY_NAME     = sqlite3_s
-MODULE_NAME      = sqlite3
-FORCE_STATIC_LIB = 1
+LIBRARY_NAME     = sqlite3
+FORCE_SHARED_LIB = 1
+VISIBILITY_FLAGS =
+
+ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
+ifndef GNU_CC
+MAPFILE = $(LIBRARY_NAME).map
+DEFFILE = $(win_srcdir)/sqlite.def
+endif
+endif
 
 ifdef GNU_CC
 MODULE_OPTIMIZE_FLAGS = -O3
 else
 ifeq ($(OS_ARCH),SunOS)
 MODULE_OPTIMIZE_FLAGS = -fast
 endif
 ifeq ($(OS_ARCH),WINNT)
@@ -72,20 +79,12 @@ CSRCS = \
 DEFINES = -DSQLITE_ENABLE_REDEF_IO -DSQLITE_SECURE_DELETE=1 -DTHREADSAFE=1
 
 ifeq ($(OS_ARCH),OS2)
 ifdef MOZ_OS2_HIGH_MEMORY
 DEFINES += -DOS2_HIGH_MEMORY
 endif
 endif
 
-ifdef ENABLE_TESTS
-##LIBS = $(DIST)/lib/$(LIB_PREFIX)sqlite3_s.$(LIB_SUFFIX)
-##SIMPLE_PROGRAMS = sqlite-shell
-endif
-
 include $(topsrcdir)/config/rules.mk
 
-sqlite-shell.$(OBJ_SUFFIX): shell.c
-	$(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $(_VPATH_SRCS)
-
 # next line allows use of MOZ_OBJDIR in .mozconfig with older gcc on BeOS, maybe others
 LOCAL_INCLUDES += -I$(srcdir)
--- a/db/sqlite3/src/sqlite3file.h
+++ b/db/sqlite3/src/sqlite3file.h
@@ -195,12 +195,16 @@ struct sqlite3OsVtbl {
     IF_DLOPEN( sqlite3OsDlopen ),
     IF_DLOPEN( sqlite3OsDlsym ),
     IF_DLOPEN( sqlite3OsDlclose ),
   };
 #else
   /*
   ** Files other than os.c just reference the global virtual function table. 
   */
+#ifdef XP_WIN
+  extern __declspec(dllimport) struct sqlite3OsVtbl sqlite3Os;
+#else
   extern struct sqlite3OsVtbl sqlite3Os;
+#endif // windows symbol ifdef
 #endif /* _SQLITE_OS_C_ */
 
 } // extern "C"
--- a/storage/build/Makefile.in
+++ b/storage/build/Makefile.in
@@ -16,16 +16,17 @@
 #
 # The Initial Developer of the Original Code is
 #   Oracle Corporation
 # Portions created by the Initial Developer are Copyright (C) 2004
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
 #   Vladimir Vukicevic <vladimir.vukicevic@oracle.com>
+#   Shawn Wilsher <me@shawnwilsher.com>
 #
 # 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
@@ -64,19 +65,20 @@ EXPORTS = mozStorageCID.h
 
 CPPSRCS = mozStorageModule.cpp
 
 LOCAL_INCLUDES = \
 	-I$(srcdir)/../src
 
 SHARED_LIBRARY_LIBS = \
 	../src/$(LIB_PREFIX)storage_s.$(LIB_SUFFIX) \
-	$(DEPTH)/db/sqlite3/src/$(LIB_PREFIX)sqlite3_s.$(LIB_SUFFIX) \
 	$(NULL)
- 
+
+EXTRA_DSO_LIBS += sqlite3
+
 EXTRA_DSO_LDOPTS += \
 	$(LIBS_DIR) \
 	$(EXTRA_DSO_LIBS) \
 	$(MOZ_COMPONENT_LIBS) \
 	$(MOZ_JS_LIBS) \
 	$(NULL)
 
 include $(topsrcdir)/config/rules.mk
--- a/toolkit/library/libxul-config.mk
+++ b/toolkit/library/libxul-config.mk
@@ -16,16 +16,17 @@
 #
 # The Initial Developer of the Original Code is
 # Benjamin Smedberg <benjamin@smedbergs.us>
 #
 # Portions created by the Initial Developer are Copyright (C) 2005
 # the Initial Developer. All Rights Reserved.
 #
 # Contributor(s):
+#   Shawn Wilsher <me@shawnwilsher.com>
 #
 # 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
@@ -201,16 +202,17 @@ ifdef MOZ_XPFE_COMPONENTS
 COMPONENT_LIBS += fileview
 DEFINES += -DMOZ_FILEVIEW
 endif
 endif
 endif
 
 ifdef MOZ_STORAGE
 COMPONENT_LIBS += storagecomps
+EXTRA_DSO_LIBS += sqlite3
 endif
 
 ifdef MOZ_PLACES
 STATIC_LIBS += morkreader_s
 
 COMPONENT_LIBS += \
 	places \
 	$(NULL)
--- a/xpcom/stub/Makefile.in
+++ b/xpcom/stub/Makefile.in
@@ -90,16 +90,17 @@ DEPENDENT_LIBS_LIST += \
 
 ifdef MOZ_ENABLE_LIBXUL
 
 DEPENDENT_LIBS_LIST += \
 	$(LIB_PREFIX)softokn3$(DLL_SUFFIX) \
 	$(LIB_PREFIX)nss3$(DLL_SUFFIX) \
 	$(LIB_PREFIX)ssl3$(DLL_SUFFIX) \
 	$(LIB_PREFIX)smime3$(DLL_SUFFIX) \
+	$(LIB_PREFIX)sqlite3$(DLL_SUFFIX) \
 	$(NULL)
 
 ifeq (,$(filter-out WINNT WINCE,$(OS_ARCH)))
 DEPENDENT_LIBS_LIST += js$(MOZ_BITS)$(VERSION_NUMBER)$(DLL_SUFFIX)
 else
 DEPENDENT_LIBS_LIST += $(LIB_PREFIX)mozjs$(DLL_SUFFIX)
 endif