#
USE_ICU = 0
+# Set this non-0 to dynamically link to the MSVC runtime library.
+#
+USE_CRT_DLL = 0
+
+# Set this non-0 to use the native libraries paths for cross-compiling
+# the command line tools needed during the compilation process.
+#
+USE_NATIVE_LIBPATHS = 0
+
# Set this non-0 to compile binaries suitable for the WinRT environment.
# This setting does not apply to any binaries that require Tcl to operate
# properly (i.e. the text fixture, etc).
#
FOR_WINRT = 0
+# Set this non-0 to skip attempting to look for and/or link with the Tcl
+# runtime library.
+#
+NO_TCL = 0
+
# Set this to non-0 to create and use PDBs.
#
SYMBOLS = 1
#
DEBUG = 0
-# C Compiler and options for use in building executables that
+# Check for the predefined command macro CC. This should point to the compiler
+# binary for the target platform. If it is not defined, simply define it to
+# the legacy default value 'cl.exe'.
+#
+!IFNDEF CC
+CC = cl.exe
+!ENDIF
+
+# Check for the command macro LD. This should point to the linker binary for
+# the target platform. If it is not defined, simply define it to the legacy
+# default value 'link.exe'.
+#
+!IFNDEF LD
+LD = link.exe
+!ENDIF
+
+# Check for the command macro NCC. This should point to the compiler binary
+# for the platform the compilation process is taking place on. If it is not
+# defined, simply define it to have the same value as the CC macro. When
+# cross-compiling, it is suggested that this macro be modified via the command
+# line (since nmake itself does not provide a built-in method to guess it).
+# For example, to use the x86 compiler when cross-compiling for x64, a command
+# line similar to the following could be used (all on one line):
+#
+# nmake /f Makefile.msc
+# "NCC=""%VCINSTALLDIR%\bin\cl.exe"""
+# USE_NATIVE_LIBPATHS=1
+#
+!IFDEF NCC
+NCC = $(NCC:\\=\)
+!ELSE
+NCC = $(CC)
+!ENDIF
+
+# Check for the MSVC runtime library path macro. Othertise, this
+# value will default to the 'lib' directory underneath the MSVC
+# installation directory.
+#
+!IFNDEF NCRTLIBPATH
+NCRTLIBPATH = $(VCINSTALLDIR)\lib
+!ENDIF
+
+NCRTLIBPATH = $(NCRTLIBPATH:\\=\)
+
+# Check for the Platform SDK library path macro. Othertise, this
+# value will default to the 'lib' directory underneath the Windows
+# SDK installation directory (the environment variable used appears
+# to be available when using Visual C++ 2008 or later via the
+# command line).
+#
+!IFNDEF NSDKLIBPATH
+NSDKLIBPATH = $(WINDOWSSDKDIR)\lib
+!ENDIF
+
+NSDKLIBPATH = $(NSDKLIBPATH:\\=\)
+
+# C compiler and options for use in building executables that
# will run on the platform that is doing the build.
#
-BCC = cl.exe -W3
+BCC = $(NCC) -W3
-# C Compile and options for use in building executables that
+# Check if the native library paths should be used when compiling
+# the command line tools used during the compilation process. If
+# so, set the necessary macro now.
+#
+!IF $(USE_NATIVE_LIBPATHS)!=0
+NLTLIBPATHS = "/LIBPATH:$(NCRTLIBPATH)" "/LIBPATH:$(NSDKLIBPATH)"
+!ENDIF
+
+# C compiler and options for use in building executables that
# will run on the target platform. (BCC and TCC are usually the
# same unless your are cross-compiling.)
#
-TCC = cl.exe -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
+TCC = $(CC) -W3 -DSQLITE_OS_WIN=1 -I. -I$(TOP)\src -fp:precise
# When compiling the library for use in the WinRT environment,
# the following compile-time options must be used as well to
# disable use of Win32 APIs that are not available and to enable
# use of Win32 APIs that are specific to Windows 8 and/or WinRT.
-# Also, we need to dynamically link to the MSVC runtime when
-# compiling for WinRT.
#
!IF $(FOR_WINRT)!=0
-TCC = $(TCC) -DSQLITE_OS_WINRT=1 -MD
+TCC = $(TCC) -DSQLITE_OS_WINRT=1
+TCC = $(TCC) -DWINAPI_FAMILY=WINAPI_PARTITION_APP
+!ENDIF
+
+# Also, we need to dynamically link to the correct MSVC runtime
+# when compiling for WinRT (e.g. debug or release) OR if the
+# USE_CRT_DLL option is set to force dynamically linking to the
+# MSVC runtime library.
+#
+!IF $(FOR_WINRT)!=0 || $(USE_CRT_DLL)!=0
+!IF $(DEBUG)>0
+TCC = $(TCC) -MDd
+!ELSE
+TCC = $(TCC) -MD
+!ENDIF
+!ELSE
+!IF $(DEBUG)>0
+TCC = $(TCC) -MTd
+!ELSE
+TCC = $(TCC) -MT
+!ENDIF
!ENDIF
# The mksqlite3c.tcl and mksqlite3h.tcl scripts will pull in
!ENDIF
#
-# Prevent warnings about "insecure" runtime library functions being used.
+# Prevent warnings about "insecure" MSVC runtime library functions
+# being used.
#
TCC = $(TCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
BCC = $(BCC) -D_CRT_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS
+#
+# Prevent warnings about "deprecated" POSIX functions being used.
+#
+TCC = $(TCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
+BCC = $(BCC) -D_CRT_NONSTDC_NO_DEPRECATE -D_CRT_NONSTDC_NO_WARNINGS
+
#
# Use native Win32 heap instead of malloc/free?
#
# prior to running nmake in order to match the actual installed location and
# version on this machine.
#
-!if "$(TCLINCDIR)" == ""
+!IFNDEF TCLINCDIR
TCLINCDIR = c:\tcl\include
-!endif
+!ENDIF
-!if "$(TCLLIBDIR)" == ""
+!IFNDEF TCLLIBDIR
TCLLIBDIR = c:\tcl\lib
-!endif
+!ENDIF
-!if "$(LIBTCL)" == ""
+!IFNDEF LIBTCL
LIBTCL = tcl85.lib
-!endif
+!ENDIF
# The locations of the ICU header and library files. These variables
# (ICUINCDIR, ICULIBDIR, and LIBICU) may be overridden via the environment
# prior to running nmake in order to match the actual installed location on
# this machine.
#
-!if "$(ICUINCDIR)" == ""
+!IFNDEF ICUINCDIR
ICUINCDIR = c:\icu\include
-!endif
+!ENDIF
-!if "$(ICULIBDIR)" == ""
+!IFNDEF ICULIBDIR
ICULIBDIR = c:\icu\lib
-!endif
+!ENDIF
-!if "$(LIBICU)" == ""
+!IFNDEF LIBICU
LIBICU = icuuc.lib icuin.lib
-!endif
+!ENDIF
# This is the command to use for tclsh - normally just "tclsh", but we may
# know the specific version we want to use. This variable (TCLSH_CMD) may be
# overridden via the environment prior to running nmake in order to select a
# specific Tcl shell to use.
#
-!if "$(TCLSH_CMD)" == ""
+!IFNDEF TCLSH_CMD
TCLSH_CMD = tclsh85
-!endif
+!ENDIF
# Compiler options needed for programs that use the readline() library.
#
# Any target libraries which libsqlite must be linked against
#
-!if "$(TLIBS)" == ""
+!IFNDEF TLIBS
TLIBS =
-!endif
+!ENDIF
# Flags controlling use of the in memory btree implementation
#
# Note that the vcvars*.bat family of batch files typically
# set this for you. Otherwise, the linker will attempt
# to deduce the binary type based on the object files.
-!IF "$(PLATFORM)"!=""
+!IFDEF PLATFORM
LTLINKOPTS = /MACHINE:$(PLATFORM)
LTLIBOPTS = /MACHINE:$(PLATFORM)
!ENDIF
# If either debugging or symbols are enabled, enable PDBs.
!IF $(DEBUG)>0 || $(SYMBOLS)!=0
-LTLINKOPTS = $(LTLINKOPTS) /DEBUG
-BCC = $(BCC) /DEBUG
+LDFLAGS = /DEBUG
!ENDIF
# Start with the Tcl related linker options.
+!IF $(NO_TCL)==0
LTLIBPATHS = /LIBPATH:$(TCLLIBDIR)
LTLIBS = $(LIBTCL)
+!ENDIF
# If ICU support is enabled, add the linker options for it.
!IF $(USE_ICU)!=0
copy $(TOP)\src\lempar.c .
lemon.exe: $(TOP)\tool\lemon.c lempar.c
- $(BCC) -Fe$@ $(TOP)\tool\lemon.c
+ $(BCC) -Daccess=_access -Fe$@ $(TOP)\tool\lemon.c /link $(NLTLIBPATHS)
# Rules to build individual *.lo files from generated *.c files. This
# applies to:
$(TCLSH_CMD) $(TOP)\tool\mksqlite3h.tcl $(TOP) > sqlite3.h
mkkeywordhash.exe: $(TOP)\tool\mkkeywordhash.c
- $(BCC) -Femkkeywordhash.exe $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c
+ $(BCC) -Fe$@ $(OPT_FEATURE_FLAGS) $(OPTS) $(TOP)\tool\mkkeywordhash.c /link $(NLTLIBPATHS)
keywordhash.h: $(TOP)\tool\mkkeywordhash.c mkkeywordhash.exe
.\mkkeywordhash.exe > keywordhash.h
del /Q sqlite3.dll sqlite3.lib sqlite3.exp sqlite3.def
del /Q sqlite3.c
del /Q sqlite3_analyzer.exe sqlite3_analyzer.exp sqlite3_analyzer.c
+ del /Q sqlite-output.vsix
#
# Windows section
| sort >> sqlite3.def
sqlite3.dll: $(LIBOBJ) sqlite3.def
- link $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LTLIBS) $(TLIBS)
+ $(LD) $(LDFLAGS) $(LTLINKOPTS) $(LTLIBPATHS) /DLL /DEF:sqlite3.def /OUT:$@ $(LIBOBJ) $(LTLIBS) $(TLIBS)
-C Version\s3.7.13
-D 2012-06-11T02:05:22.539
+C Backport\sVSIX\spackaging\ssupport\sand\srelated\schanges.
+D 2012-08-06T23:21:05.223
F Makefile.arm-wince-mingw32ce-gcc d6df77f1f48d690bd73162294bbba7f59507c72f
F Makefile.in d17fddaa4e81f93a7c9c7c0808aacb3fc95f79f4
F Makefile.linux-gcc 91d710bdc4998cb015f39edf3cb314ec4f4d7e23
-F Makefile.msc fd86027849a59a2f621b791b79eabf3f8ffbd684
+F Makefile.msc d95ad0a339193647036a7d0db441b323a2e4bc98
F Makefile.vxworks 3b7fe7a0571fdadc61363ebc1b23732d2d6363ca
F README cd04a36fbc7ea56932a4052d7d0b7f09f27c33d6
F VERSION 3e857b9b826e818eec9411eafe2c3fa22c1dbb8a
F test/win32lock.test b2a539e85ae6b2d78475e016a9636b4451dc7fb9
F test/zeroblob.test caaecfb4f908f7bc086ed238668049f96774d688
F test/zerodamage.test 0de750389990b1078bab203c712dc3fefd1d8b82
+F tool/build-all-msvc.bat 1a18aa39983ae7354d834bc55a850a54fc007576 x
F tool/build-shell.sh b64a481901fc9ffe5ca8812a2a9255b6cfb77381
F tool/diffdb.c 7524b1b5df217c20cd0431f6789851a4e0cb191b
F tool/extract.c 054069d81b095fbdc189a6f5d4466e40380505e2
F tool/mksqlite3c.tcl f289ba51f74f45c71a80c13e6c74a6dd92763253
F tool/mksqlite3h.tcl 78013ad79a5e492e5f764f3c7a8ef834255061f8
F tool/mksqlite3internalh.tcl 7b43894e21bcb1bb39e11547ce7e38a063357e87
+F tool/mkvsix.tcl 19b2ab9ea16445953a76568a5bbe4cb864f92dfe
F tool/offsets.c fe4262fdfa378e8f5499a42136d17bf3b98f6091
F tool/omittest.tcl 72a49b8a9a8b0bf213a438180307a0df836d4380
F tool/opcodeDoc.awk b3a2a3d5d3075b8bd90b7afe24283efdd586659c
F tool/vdbe-compress.tcl d70ea6d8a19e3571d7ab8c9b75cba86d1173ff0f
F tool/warnings-clang.sh f6aa929dc20ef1f856af04a730772f59283631d4
F tool/warnings.sh fbc018d67fd7395f440c28f33ef0f94420226381
-P 0ae0ce630a2e11f81dca50a9cfb04c4a41c03b2d
-R 45dae5fdb66a9a88c8595b45bd7db627
-T +bgcolor * #d0c0ff
-T +sym-release *
-T +sym-version-3.7.13 *
-U drh
-Z c0babe9c1caac24f66a10b2544a508b6
+F tool/win/sqlite.vsix 67d8a99aceb56384a81b3f30d6c71743146d2cc9
+P f5b5a13f7394dc143aa136f1d4faba6839eaa6dc
+R 52d11d3e50315aa019808706f6c354a0
+T *branch * vsix-3.7.13
+T *sym-vsix-3.7.13 *
+T -sym-trunk *
+U mistachkin
+Z 5965af1d21ac0216d85a0ca8ada1cdef
-f5b5a13f7394dc143aa136f1d4faba6839eaa6dc
\ No newline at end of file
+0620285da63ed2273776a5f4feeee54d2f802dc9
\ No newline at end of file
--- /dev/null
+@ECHO OFF\r
+\r
+::\r
+:: build-all-msvc.bat --\r
+::\r
+:: Multi-Platform Build Tool for MSVC\r
+::\r
+\r
+SETLOCAL\r
+\r
+REM SET __ECHO=ECHO\r
+REM SET __ECHO2=ECHO\r
+IF NOT DEFINED _AECHO (SET _AECHO=REM)\r
+IF NOT DEFINED _CECHO (SET _CECHO=REM)\r
+IF NOT DEFINED _VECHO (SET _VECHO=REM)\r
+\r
+%_AECHO% Running %0 %*\r
+\r
+REM SET DFLAGS=/L\r
+\r
+%_VECHO% DFlags = '%DFLAGS%'\r
+\r
+SET FFLAGS=/V /F /G /H /I /R /Y /Z\r
+\r
+%_VECHO% FFlags = '%FFLAGS%'\r
+\r
+SET ROOT=%~dp0\..\r
+SET ROOT=%ROOT:\\=\%\r
+\r
+%_VECHO% Root = '%ROOT%'\r
+\r
+REM\r
+REM NOTE: The first and only argument to this batch file should be the output\r
+REM directory where the platform-specific binary directories should be\r
+REM created.\r
+REM\r
+SET BINARYDIRECTORY=%1\r
+\r
+IF NOT DEFINED BINARYDIRECTORY (\r
+ GOTO usage\r
+)\r
+\r
+%_VECHO% BinaryDirectory = '%BINARYDIRECTORY%'\r
+\r
+SET DUMMY=%2\r
+\r
+IF DEFINED DUMMY (\r
+ GOTO usage\r
+)\r
+\r
+REM\r
+REM NOTE: From this point, we need a clean error level. Reset it now.\r
+REM\r
+CALL :fn_ResetErrorLevel\r
+\r
+REM\r
+REM NOTE: Change the current directory to the root of the source tree, saving\r
+REM the current directory on the directory stack.\r
+REM\r
+%__ECHO2% PUSHD "%ROOT%"\r
+\r
+IF ERRORLEVEL 1 (\r
+ ECHO Could not change directory to "%ROOT%".\r
+ GOTO errors\r
+)\r
+\r
+REM\r
+REM NOTE: This batch file requires the ComSpec environment variable to be set,\r
+REM typically to something like "C:\Windows\System32\cmd.exe".\r
+REM\r
+IF NOT DEFINED ComSpec (\r
+ ECHO The ComSpec environment variable must be defined.\r
+ GOTO errors\r
+)\r
+\r
+REM\r
+REM NOTE: This batch file requires the VcInstallDir environment variable to be\r
+REM set. Tyipcally, this means this batch file needs to be run from an\r
+REM MSVC command prompt.\r
+REM\r
+IF NOT DEFINED VCINSTALLDIR (\r
+ ECHO The VCINSTALLDIR environment variable must be defined.\r
+ GOTO errors\r
+)\r
+\r
+REM\r
+REM NOTE: If the list of platforms is not already set, use the default list.\r
+REM\r
+IF NOT DEFINED PLATFORMS (\r
+ SET PLATFORMS=x86 x86_amd64 x86_arm\r
+)\r
+\r
+%_VECHO% Platforms = '%PLATFORMS%'\r
+\r
+REM\r
+REM NOTE: Setup environment variables to translate between the MSVC platform\r
+REM names and the names to be used for the platform-specific binary\r
+REM directories.\r
+REM\r
+SET x86_NAME=x86\r
+SET x86_amd64_NAME=x64\r
+SET x86_arm_NAME=ARM\r
+\r
+%_VECHO% x86_Name = '%x86_NAME%'\r
+%_VECHO% x86_amd64_Name = '%x86_amd64_NAME%'\r
+%_VECHO% x86_arm_Name = '%x86_arm_NAME%'\r
+\r
+REM\r
+REM NOTE: Check for the external tools needed during the build process ^(i.e.\r
+REM those that do not get compiled as part of the build process itself^)\r
+REM along the PATH.\r
+REM\r
+FOR %%T IN (gawk.exe tclsh85.exe) DO (\r
+ SET %%T_PATH=%%~dp$PATH:T\r
+)\r
+\r
+REM\r
+REM NOTE: Set the TOOLPATH variable to contain all the directories where the\r
+REM external tools were found in the search above.\r
+REM\r
+SET TOOLPATH=%gawk.exe_PATH%;%tclsh85.exe_PATH%\r
+\r
+%_VECHO% ToolPath = '%TOOLPATH%'\r
+\r
+REM\r
+REM NOTE: Check for MSVC 2012 because the Windows SDK directory handling is\r
+REM slightly different for that version.\r
+REM\r
+IF "%VisualStudioVersion%" == "11.0" (\r
+ SET SET_NSDKLIBPATH=1\r
+) ELSE (\r
+ CALL :fn_UnsetVariable SET_NSDKLIBPATH\r
+)\r
+\r
+REM\r
+REM NOTE: This is the outer loop. There should be exactly one iteration per\r
+REM platform.\r
+REM\r
+FOR %%P IN (%PLATFORMS%) DO (\r
+ REM\r
+ REM NOTE: Using the MSVC platform name, lookup the simpler platform name to\r
+ REM be used for the name of the platform-specific binary directory via\r
+ REM the environment variables setup earlier.\r
+ REM\r
+ CALL :fn_SetVariable %%P_NAME PLATFORMNAME\r
+\r
+ REM\r
+ REM NOTE: This is the inner loop. There should be exactly one iteration.\r
+ REM This loop is necessary because the PlatformName environment\r
+ REM variable was set above and that value is needed by some of the\r
+ REM commands contained in the inner loop. If these commands were\r
+ REM directly contained in the outer loop, the PlatformName environment\r
+ REM variable would be stuck with its initial empty value instead.\r
+ REM\r
+ FOR /F "tokens=2* delims==" %%D IN ('SET PLATFORMNAME') DO (\r
+ REM\r
+ REM NOTE: Attempt to clean the environment of all variables used by MSVC\r
+ REM and/or Visual Studio. This block may need to be updated in the\r
+ REM future to account for additional environment variables.\r
+ REM\r
+ CALL :fn_UnsetVariable DevEnvDir\r
+ CALL :fn_UnsetVariable ExtensionSdkDir\r
+ CALL :fn_UnsetVariable Framework35Version\r
+ CALL :fn_UnsetVariable FrameworkDir\r
+ CALL :fn_UnsetVariable FrameworkDir32\r
+ CALL :fn_UnsetVariable FrameworkVersion\r
+ CALL :fn_UnsetVariable FrameworkVersion32\r
+ CALL :fn_UnsetVariable FSHARPINSTALLDIR\r
+ CALL :fn_UnsetVariable INCLUDE\r
+ CALL :fn_UnsetVariable LIB\r
+ CALL :fn_UnsetVariable LIBPATH\r
+ CALL :fn_UnsetVariable Platform\r
+ REM CALL :fn_UnsetVariable VCINSTALLDIR\r
+ CALL :fn_UnsetVariable VSINSTALLDIR\r
+ CALL :fn_UnsetVariable WindowsSdkDir\r
+ CALL :fn_UnsetVariable WindowsSdkDir_35\r
+ CALL :fn_UnsetVariable WindowsSdkDir_old\r
+\r
+ REM\r
+ REM NOTE: Reset the PATH here to the absolute bare minimum required.\r
+ REM\r
+ SET PATH=%TOOLPATH%;%SystemRoot%\System32;%SystemRoot%\r
+\r
+ REM\r
+ REM NOTE: Launch a nested command shell to perform the following steps:\r
+ REM\r
+ REM 1. Setup the MSVC environment for this platform using the\r
+ REM official batch file.\r
+ REM\r
+ REM 2. Make sure that no stale build output files are present.\r
+ REM\r
+ REM 3. Build the "sqlite3.dll" and "sqlite3.lib" binaries for this\r
+ REM platform.\r
+ REM\r
+ REM 4. Copy the "sqlite3.dll" and "sqlite3.lib" binaries for this\r
+ REM platform to the platform-specific directory beneath the\r
+ REM binary directory.\r
+ REM\r
+ "%ComSpec%" /C (\r
+ REM\r
+ REM NOTE: Attempt to setup the MSVC environment for this platform.\r
+ REM\r
+ %__ECHO% CALL "%VCINSTALLDIR%\vcvarsall.bat" %%P\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to call "%VCINSTALLDIR%\vcvarsall.bat" for platform %%P.\r
+ GOTO errors\r
+ )\r
+\r
+ REM\r
+ REM NOTE: If this batch file is not running in "what-if" mode, check to\r
+ REM be sure we were actually able to setup the MSVC environment as\r
+ REM current versions of their official batch file do not set the\r
+ REM exit code upon failure.\r
+ REM\r
+ IF NOT DEFINED __ECHO (\r
+ IF NOT DEFINED WindowsSdkDir (\r
+ ECHO Cannot build, Windows SDK not found for platform %%P.\r
+ GOTO errors\r
+ )\r
+ )\r
+\r
+ REM\r
+ REM NOTE: When using MSVC 2012, the native SDK path cannot simply use\r
+ REM the "lib" sub-directory beneath the location specified in the\r
+ REM WindowsSdkDir environment variable because that location does\r
+ REM not actually contain the necessary library files for x86.\r
+ REM This must be done for each iteration because it relies upon\r
+ REM the WindowsSdkDir environment variable being set by the batch\r
+ REM file used to setup the MSVC environment.\r
+ REM\r
+ IF DEFINED SET_NSDKLIBPATH (\r
+ CALL :fn_SetVariable WindowsSdkDir NSDKLIBPATH\r
+ CALL :fn_AppendVariable NSDKLIBPATH \lib\win8\um\x86\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Unless prevented from doing so, invoke NMAKE with the MSVC\r
+ REM makefile to clean any stale build output from previous\r
+ REM iterations of this loop and/or previous runs of this batch\r
+ REM file, etc.\r
+ REM\r
+ IF NOT DEFINED NOCLEAN (\r
+ %__ECHO% nmake -f Makefile.msc clean\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to clean for platform %%P.\r
+ GOTO errors\r
+ )\r
+ ) ELSE (\r
+ REM\r
+ REM NOTE: Even when the cleaning step has been disabled, we still need\r
+ REM to remove the build output for the files we are specifically\r
+ REM wanting to build for each platform.\r
+ REM\r
+ %__ECHO% DEL /Q sqlite3.dll sqlite3.lib sqlite3.pdb\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Invoke NMAKE with the MSVC makefile to build the "sqlite3.dll"\r
+ REM binary. The x86 compiler will be used to compile the native\r
+ REM command line tools needed during the build process itself.\r
+ REM Also, disable looking for and/or linking to the native Tcl\r
+ REM runtime library.\r
+ REM\r
+ %__ECHO% nmake -f Makefile.msc sqlite3.dll "NCC=""%VCINSTALLDIR%\bin\cl.exe""" USE_NATIVE_LIBPATHS=1 NO_TCL=1 %NMAKE_ARGS%\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to build "sqlite3.dll" for platform %%P.\r
+ GOTO errors\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Copy the "sqlite3.dll" file to the platform-specific directory\r
+ REM beneath the binary directory.\r
+ REM\r
+ %__ECHO% XCOPY sqlite3.dll "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to copy "sqlite3.dll" to "%BINARYDIRECTORY%\%%D\".\r
+ GOTO errors\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Copy the "sqlite3.lib" file to the platform-specific directory\r
+ REM beneath the binary directory.\r
+ REM\r
+ %__ECHO% XCOPY sqlite3.lib "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to copy "sqlite3.lib" to "%BINARYDIRECTORY%\%%D\".\r
+ GOTO errors\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Copy the "sqlite3.pdb" file to the platform-specific directory\r
+ REM beneath the binary directory unless we are prevented from doing\r
+ REM so.\r
+ REM\r
+ IF NOT DEFINED NOSYMBOLS (\r
+ %__ECHO% XCOPY sqlite3.pdb "%BINARYDIRECTORY%\%%D\" %FFLAGS% %DFLAGS%\r
+\r
+ IF ERRORLEVEL 1 (\r
+ ECHO Failed to copy "sqlite3.pdb" to "%BINARYDIRECTORY%\%%D\".\r
+ GOTO errors\r
+ )\r
+ )\r
+ )\r
+ )\r
+\r
+ REM\r
+ REM NOTE: Handle any errors generated during the nested command shell.\r
+ REM\r
+ IF ERRORLEVEL 1 (\r
+ GOTO errors\r
+ )\r
+)\r
+\r
+REM\r
+REM NOTE: Restore the saved current directory from the directory stack.\r
+REM\r
+%__ECHO2% POPD\r
+\r
+IF ERRORLEVEL 1 (\r
+ ECHO Could not restore directory.\r
+ GOTO errors\r
+)\r
+\r
+REM\r
+REM NOTE: If we get to this point, we have succeeded.\r
+REM\r
+GOTO no_errors\r
+\r
+:fn_ResetErrorLevel\r
+ VERIFY > NUL\r
+ GOTO :EOF\r
+\r
+:fn_SetErrorLevel\r
+ VERIFY MAYBE 2> NUL\r
+ GOTO :EOF\r
+\r
+:fn_SetVariable\r
+ SETLOCAL\r
+ IF NOT DEFINED %1 GOTO :EOF\r
+ IF "%2" == "" GOTO :EOF\r
+ SET __ECHO_CMD=ECHO %%%1%%\r
+ FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (\r
+ SET VALUE=%%V\r
+ )\r
+ ENDLOCAL && SET %2=%VALUE%\r
+ GOTO :EOF\r
+\r
+:fn_UnsetVariable\r
+ IF NOT "%1" == "" (\r
+ SET %1=\r
+ CALL :fn_ResetErrorLevel\r
+ )\r
+ GOTO :EOF\r
+\r
+:fn_AppendVariable\r
+ SET __ECHO_CMD=ECHO %%%1%%\r
+ IF DEFINED %1 (\r
+ FOR /F "delims=" %%V IN ('%__ECHO_CMD%') DO (\r
+ SET %1=%%V%~2\r
+ )\r
+ ) ELSE (\r
+ SET %1=%~2\r
+ )\r
+ SET __ECHO_CMD=\r
+ CALL :fn_ResetErrorLevel\r
+ GOTO :EOF\r
+\r
+:usage\r
+ ECHO.\r
+ ECHO Usage: %~nx0 ^<binaryDirectory^>\r
+ ECHO.\r
+ GOTO errors\r
+\r
+:errors\r
+ CALL :fn_SetErrorLevel\r
+ ENDLOCAL\r
+ ECHO.\r
+ ECHO Failure, errors were encountered.\r
+ GOTO end_of_file\r
+\r
+:no_errors\r
+ CALL :fn_ResetErrorLevel\r
+ ENDLOCAL\r
+ ECHO.\r
+ ECHO Success, no errors were encountered.\r
+ GOTO end_of_file\r
+\r
+:end_of_file\r
+%__ECHO% EXIT /B %ERRORLEVEL%\r
--- /dev/null
+#!/usr/bin/tclsh
+#
+# This script is used to generate a VSIX (Visual Studio Extension) file for
+# SQLite usable by Visual Studio.
+
+proc fail { {error ""} {usage false} } {
+ if {[string length $error] > 0} then {
+ puts stdout $error
+ if {!$usage} then {exit 1}
+ }
+
+ puts stdout "usage:\
+[file tail [info nameofexecutable]]\
+[file tail [info script]] <binaryDirectory> \[sourceDirectory\]"
+
+ exit 1
+}
+\f
+proc getEnvironmentVariable { name } {
+ #
+ # NOTE: Returns the value of the specified environment variable or an empty
+ # string for environment variables that do not exist in the current
+ # process environment.
+ #
+ return [expr {[info exists ::env($name)] ? $::env($name) : ""}]
+}
+\f
+proc getTemporaryPath {} {
+ #
+ # NOTE: Returns the normalized path to the first temporary directory found
+ # in the typical set of environment variables used for that purpose
+ # or an empty string to signal a failure to locate such a directory.
+ #
+ set names [list]
+
+ foreach name [list TEMP TMP] {
+ lappend names [string toupper $name] [string tolower $name] \
+ [string totitle $name]
+ }
+
+ foreach name $names {
+ set value [getEnvironmentVariable $name]
+
+ if {[string length $value] > 0} then {
+ return [file normalize $value]
+ }
+ }
+
+ return ""
+}
+\f
+proc appendArgs { args } {
+ #
+ # NOTE: Returns all passed arguments joined together as a single string with
+ # no intervening spaces between arguments.
+ #
+ eval append result $args
+}
+\f
+proc readFile { fileName } {
+ #
+ # NOTE: Reads and returns the entire contents of the specified file, which
+ # may contain binary data.
+ #
+ set file_id [open $fileName RDONLY]
+ fconfigure $file_id -encoding binary -translation binary
+ set result [read $file_id]
+ close $file_id
+ return $result
+}
+\f
+proc writeFile { fileName data } {
+ #
+ # NOTE: Writes the entire contents of the specified file, which may contain
+ # binary data.
+ #
+ set file_id [open $fileName {WRONLY CREAT TRUNC}]
+ fconfigure $file_id -encoding binary -translation binary
+ puts -nonewline $file_id $data
+ close $file_id
+ return ""
+}
+\f
+proc substFile { fileName } {
+ #
+ # NOTE: Performs all Tcl command, variable, and backslash substitutions in
+ # the specified file and then re-writes the contents of that same file
+ # with the substituted data.
+ #
+ return [writeFile $fileName [uplevel 1 [list subst [readFile $fileName]]]]
+}
+\f
+proc replacePlatform { fileName platformName } {
+ #
+ # NOTE: Returns the specified file name containing the platform name instead
+ # of platform placeholder tokens.
+ #
+ return [string map [list <platform> $platformName] $fileName]
+}
+\f
+set script [file normalize [info script]]
+
+if {[string length $script] == 0} then {
+ fail "script file currently being evaluated is unknown" true
+}
+
+set path [file dirname $script]
+set rootName [file rootname [file tail $script]]
+
+###############################################################################
+
+#
+# NOTE: Process and verify all the command line arguments.
+#
+set argc [llength $argv]
+if {$argc != 1 && $argc != 2} then {fail}
+
+set binaryDirectory [lindex $argv 0]
+
+if {[string length $binaryDirectory] == 0} then {
+ fail "invalid binary directory"
+}
+
+if {![file exists $binaryDirectory] || \
+ ![file isdirectory $binaryDirectory]} then {
+ fail "binary directory does not exist"
+}
+
+if {$argc == 2} then {
+ set sourceDirectory [lindex $argv 1]
+} else {
+ #
+ # NOTE: Assume that the source directory is the parent directory of the one
+ # that contains this script file.
+ #
+ set sourceDirectory [file dirname $path]
+}
+
+if {[string length $sourceDirectory] == 0} then {
+ fail "invalid source directory"
+}
+
+if {![file exists $sourceDirectory] || \
+ ![file isdirectory $sourceDirectory]} then {
+ fail "source directory does not exist"
+}
+
+###############################################################################
+
+#
+# NOTE: Evaluate the user-specific customizations file, if it exists.
+#
+set userFile [file join $path [appendArgs \
+ $rootName . $tcl_platform(user) .tcl]]
+
+if {[file exists $userFile] && \
+ [file isfile $userFile]} then {
+ source $userFile
+}
+
+###############################################################################
+
+set templateFile [file join $path win sqlite.vsix]
+
+if {![file exists $templateFile] || \
+ ![file isfile $templateFile]} then {
+ fail [appendArgs "template file \"" $templateFile "\" does not exist"]
+}
+
+set currentDirectory [pwd]
+set outputFile [file join $currentDirectory sqlite-output.vsix]
+
+if {[file exists $outputFile]} then {
+ fail [appendArgs "output file \"" $outputFile "\" already exists"]
+}
+
+###############################################################################
+
+#
+# NOTE: Make sure that a valid temporary directory exists.
+#
+set temporaryDirectory [getTemporaryPath]
+
+if {[string length $temporaryDirectory] == 0 || \
+ ![file exists $temporaryDirectory] || \
+ ![file isdirectory $temporaryDirectory]} then {
+ fail "cannot locate a usable temporary directory"
+}
+
+#
+# NOTE: Setup the staging directory to have a unique name inside of the
+# configured temporary directory.
+#
+set stagingDirectory [file normalize [file join $temporaryDirectory \
+ [appendArgs $rootName . [pid]]]]
+
+###############################################################################
+
+#
+# NOTE: Configure the external zipping tool. First, see if it has already
+# been pre-configured. If not, try to query it from the environment.
+# Finally, fallback on the default of simply "zip", which will then
+# be assumed to exist somewhere along the PATH.
+#
+if {![info exists zip]} then {
+ if {[info exists env(ZipTool)]} then {
+ set zip $env(ZipTool)
+ }
+ if {![info exists zip] || ![file exists $zip]} then {
+ set zip zip
+ }
+}
+
+#
+# NOTE: Configure the external unzipping tool. First, see if it has already
+# been pre-configured. If not, try to query it from the environment.
+# Finally, fallback on the default of simply "unzip", which will then
+# be assumed to exist somewhere along the PATH.
+#
+if {![info exists unzip]} then {
+ if {[info exists env(UnZipTool)]} then {
+ set unzip $env(UnZipTool)
+ }
+ if {![info exists unzip] || ![file exists $unzip]} then {
+ set unzip unzip
+ }
+}
+
+###############################################################################
+
+#
+# NOTE: Attempt to extract the SQLite version from the "sqlite3.h" header file
+# in the source directory. This script assumes that the header file has
+# already been generated by the build process.
+#
+set pattern {^#define\s+SQLITE_VERSION\s+"(.*)"$}
+set data [readFile [file join $sourceDirectory sqlite3.h]]
+
+if {![regexp -line -- $pattern $data dummy version]} then {
+ fail [appendArgs "cannot locate SQLITE_VERSION value in \"" \
+ [file join $sourceDirectory sqlite3.h] \"]
+}
+
+###############################################################################
+
+#
+# NOTE: Setup the master file list data, including the necessary flags.
+#
+if {![info exists fileNames(source)]} then {
+ set fileNames(source) [list "" "" "" \
+ [file join $sourceDirectory sqlite3.h] \
+ [file join $binaryDirectory <platform> sqlite3.lib] \
+ [file join $binaryDirectory <platform> sqlite3.dll]]
+
+ if {![info exists no(symbols)]} then {
+ lappend fileNames(source) \
+ [file join $binaryDirectory <platform> sqlite3.pdb]
+ }
+}
+
+if {![info exists fileNames(destination)]} then {
+ set fileNames(destination) [list \
+ [file join $stagingDirectory extension.vsixmanifest] \
+ [file join $stagingDirectory SDKManifest.xml] \
+ [file join $stagingDirectory DesignTime CommonConfiguration \
+ <platform> SQLite.WinRT.props] \
+ [file join $stagingDirectory DesignTime CommonConfiguration \
+ <platform> sqlite3.h] \
+ [file join $stagingDirectory DesignTime CommonConfiguration \
+ <platform> sqlite3.lib] \
+ [file join $stagingDirectory Redist CommonConfiguration \
+ <platform> sqlite3.dll]]
+
+ if {![info exists no(symbols)]} then {
+ lappend fileNames(destination) \
+ [file join $stagingDirectory Redist Debug \
+ <platform> sqlite3.pdb]
+ }
+}
+
+if {![info exists fileNames(neutral)]} then {
+ set fileNames(neutral) [list 1 1 1 1 0 0]
+
+ if {![info exists no(symbols)]} then {
+ lappend fileNames(neutral) 0
+ }
+}
+
+if {![info exists fileNames(subst)]} then {
+ set fileNames(subst) [list 1 1 1 0 0 0]
+
+ if {![info exists no(symbols)]} then {
+ lappend fileNames(subst) 0
+ }
+}
+
+###############################################################################
+
+#
+# NOTE: Setup the list of platforms supported by this script.
+#
+if {![info exists platformNames]} then {
+ set platformNames [list x86 x64 ARM]
+}
+
+###############################################################################
+
+#
+# NOTE: Make sure the staging directory exists, creating it if necessary.
+#
+file mkdir $stagingDirectory
+
+#
+# NOTE: Build the Tcl command used to extract the template package to the
+# staging directory.
+#
+set extractCommand [list exec -- $unzip $templateFile -d $stagingDirectory]
+
+#
+# NOTE: Extract the template package to the staging directory.
+#
+eval $extractCommand
+
+###############################################################################
+
+#
+# NOTE: Process each file in the master file list. There are actually four
+# parallel lists that contain the source file names, destination file
+# names, the platform-neutral flags, and the use-subst flags. When the
+# platform-neutral flag is non-zero, the file is not platform-specific.
+# When the use-subst flag is non-zero, the file is considered to be a
+# text file that may contain Tcl variable and/or command replacements,
+# to be dynamically replaced during processing. If the source file name
+# is an empty string, then the destination file name will be assumed to
+# already exist in the staging directory and will not be copied; however,
+# dynamic replacements may still be performed on the destination file
+# prior to the package being re-zipped.
+#
+foreach sourceFileName $fileNames(source) \
+ destinationFileName $fileNames(destination) \
+ isNeutral $fileNames(neutral) useSubst $fileNames(subst) {
+ #
+ # NOTE: If the current file is platform-neutral, then only one platform will
+ # be processed for it, namely "neutral"; otherwise, each supported
+ # platform will be processed for it individually.
+ #
+ foreach platformName [expr {$isNeutral ? [list neutral] : $platformNames}] {
+ #
+ # NOTE: Use the actual platform name in the destination file name.
+ #
+ set newDestinationFileName [replacePlatform $destinationFileName \
+ $platformName]
+
+ #
+ # NOTE: Does the source file need to be copied to the destination file?
+ #
+ if {[string length $sourceFileName] > 0} then {
+ #
+ # NOTE: First, make sure the destination directory exists.
+ #
+ file mkdir [file dirname $newDestinationFileName]
+
+ #
+ # NOTE: Then, copy the source file to the destination file verbatim.
+ #
+ file copy [replacePlatform $sourceFileName $platformName] \
+ $newDestinationFileName
+ }
+
+ #
+ # NOTE: Does the destination file contain dynamic replacements that must
+ # be processed now?
+ #
+ if {$useSubst} then {
+ #
+ # NOTE: Perform any dynamic replacements contained in the destination
+ # file and then re-write it in-place.
+ #
+ substFile $newDestinationFileName
+ }
+ }
+}
+
+###############################################################################
+
+#
+# NOTE: Change the current directory to the staging directory so that the
+# external archive building tool can pickup the necessary files using
+# relative paths.
+#
+cd $stagingDirectory
+
+#
+# NOTE: Build the Tcl command used to archive the final package in the
+# output directory.
+#
+set archiveCommand [list exec -- $zip -r $outputFile *]
+
+#
+# NOTE: Build the final package archive in the output directory.
+#
+eval $archiveCommand
+
+#
+# NOTE: Change back to the previously saved current directory.
+#
+cd $currentDirectory
+
+#
+# NOTE: Cleanup the temporary staging directory.
+#
+file delete -force $stagingDirectory
+
+###############################################################################
+
+#
+# NOTE: Success, emit the fully qualified path of the generated VSIX file.
+#
+puts stdout $outputFile