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
Mon, 16 Jul 2007 14:23:29 -0700
changeset 3530 b6f6e946061b7ead5964c39a5ef8a5ce7dbe8303
parent 3529 2f65d0afd9e162294984551fad97fcfe7c5dc746
child 3531 3bddc2c6c4cd2935689e40f9dd07294812b0dd80
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
db/sqlite3/src/Makefile.in
db/sqlite3/src/sqlite.def
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/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)
new file mode 100644
--- /dev/null
+++ b/db/sqlite3/src/sqlite.def
@@ -0,0 +1,159 @@
+; ***** 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 Initial Developer of this code is Robert Relyea <rrelyea@redhat.com>
+;
+; Portions created by the Initial Developer are Copyright (C) 2007
+; the Initial Developer. All Rights Reserved.
+;
+; Contributor(s): Shawn Wilsher <me@shawnwilsher.com>
+;                 Ryan VanderMeulen <ryanvm@gmail.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
+; 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 *****
+
+LIBRARY sqlite3.dll
+
+EXPORTS sqlite3_aggregate_context
+        sqlite3_aggregate_count
+        sqlite3_apis
+        sqlite3_auto_extension
+        sqlite3_bind_blob
+        sqlite3_bind_double
+        sqlite3_bind_int
+        sqlite3_bind_int64
+        sqlite3_bind_null
+        sqlite3_bind_parameter_count
+        sqlite3_bind_parameter_index
+        sqlite3_bind_parameter_name
+        sqlite3_bind_text
+        sqlite3_bind_text16
+        sqlite3_bind_value
+        sqlite3_busy_handler
+        sqlite3_busy_timeout
+        sqlite3_changes
+        sqlite3_clear_bindings
+        sqlite3_close
+        sqlite3_collation_needed
+        sqlite3_collation_needed16
+        sqlite3_column_blob
+        sqlite3_column_bytes
+        sqlite3_column_bytes16
+        sqlite3_column_count
+        sqlite3_column_decltype
+        sqlite3_column_decltype16
+        sqlite3_column_double
+        sqlite3_column_int
+        sqlite3_column_int64
+        sqlite3_column_name
+        sqlite3_column_name16
+        sqlite3_column_text
+        sqlite3_column_text16
+        sqlite3_column_type
+        sqlite3_column_value
+        sqlite3_commit_hook
+        sqlite3_complete
+        sqlite3_complete16
+        sqlite3_create_collation
+        sqlite3_create_collation16
+        sqlite3_create_function
+        sqlite3_create_function16
+        sqlite3_create_module
+        sqlite3_data_count
+        sqlite3_db_handle
+        sqlite3_declare_vtab
+        sqlite3_enable_load_extension
+        sqlite3_enable_shared_cache
+        sqlite3_errcode
+        sqlite3_errmsg
+        sqlite3_errmsg16
+        sqlite3_exec
+        sqlite3_expired
+        sqlite3_extended_result_codes
+        sqlite3_finalize
+        sqlite3_free
+        sqlite3_free_table
+        sqlite3_get_autocommit
+        sqlite3_get_auxdata
+        sqlite3_get_table
+        sqlite3_global_recover
+        sqlite3_interrupt
+        sqlite3_last_insert_rowid
+        sqlite3_libversion
+        sqlite3_libversion_number
+        sqlite3_load_extension
+        sqlite3_malloc
+        sqlite3_mprintf
+        sqlite3_open
+        sqlite3_open16
+        sqlite3_overload_function
+        sqlite3_prepare
+        sqlite3_prepare16
+        sqlite3_prepare16_v2
+        sqlite3_prepare_v2
+        sqlite3_profile
+        sqlite3_progress_handler
+        sqlite3_realloc
+        sqlite3_reset
+        sqlite3_reset_auto_extension
+        sqlite3_result_blob
+        sqlite3_result_double
+        sqlite3_result_error
+        sqlite3_result_error16
+        sqlite3_result_int
+        sqlite3_result_int64
+        sqlite3_result_null
+        sqlite3_result_text
+        sqlite3_result_text16
+        sqlite3_result_text16be
+        sqlite3_result_text16le
+        sqlite3_result_value
+        sqlite3_rollback_hook
+        sqlite3_set_authorizer
+        sqlite3_set_auxdata
+        sqlite3_sleep
+        sqlite3_snprintf
+        sqlite3_step
+        sqlite3_thread_cleanup
+        sqlite3_total_changes
+        sqlite3_trace
+        sqlite3_transfer_bindings
+        sqlite3_update_hook
+        sqlite3_user_data
+        sqlite3_value_blob
+        sqlite3_value_bytes
+        sqlite3_value_bytes16
+        sqlite3_value_double
+        sqlite3_value_int
+        sqlite3_value_int64
+        sqlite3_value_numeric_type
+        sqlite3_value_text
+        sqlite3_value_text16
+        sqlite3_value_text16be
+        sqlite3_value_text16le
+        sqlite3_value_type
+        sqlite3_version
+        sqlite3_vmprintf
+        sqlite3ApiExit               ;needed by mozStorage
+        sqlite3Os DATA               ;needed by mozStorage
--- 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
@@ -196,16 +197,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
@@ -88,16 +88,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